selma / assets /FileTreeView-CYYStfKZ.js
berangerthomas's picture
Upload 269 files
197d1d7 verified
import{r as e}from"./searchRegex-CeS3IjCx.js";import{d as t,f as n,i as r,o as i,v as a}from"./index-Dccfkm0d.js";import{n as o,r as s,t as c}from"./useSidebar-BnAyulmM.js";import{n as l,r as u,t as d}from"./NodeIcon-iut9oW1f.js";var f=e(),p=({node:e,depth:i})=>{let{data:o,dagData:c,expanded:m,activeId:h,setActiveId:g,toggleNode:_,requestForceCenter:v,isFullyExpanded:y,searchQuery:b}=r(),{t:x}=a(),S=m.has(e.id),C=h===e.id,w=!!e.children&&e.children.length>0,T=t=>{if(t.stopPropagation(),w){let t=!S;_(e.id),setTimeout(()=>{g(e.id),(t||y)&&v()},80)}else g(e.id)},E=x(`nodes.${e.id}.name`,{defaultValue:e.name||``});return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`flex items-center py-1.5 px-2 cursor-pointer transition-colors ${C?`bg-blue-100 dark:bg-blue-900/30`:`hover:bg-black/5 dark:hover:bg-white/5`}`,style:{paddingLeft:`${i*20+8}px`},onClick:T,children:[(0,f.jsx)(`div`,{className:`flex-shrink-0 w-6 flex justify-center items-center mr-1 text-gray-400 dark:text-gray-500`,children:w&&(0,f.jsx)(`div`,{className:`transition-transform duration-200 ${S?`rotate-90`:``}`,children:(0,f.jsx)(l,{})})}),(0,f.jsx)(d,{node:e,data:o,dagData:c}),(0,f.jsxs)(`div`,{className:`text-sm select-none whitespace-nowrap overflow-hidden text-ellipsis ${C?`font-semibold text-blue-700 dark:text-blue-300`:`text-gray-800 dark:text-gray-200`}`,children:[(0,f.jsx)(s,{text:E,query:b}),e.attachments&&e.attachments.length>0&&(0,f.jsx)(u,{size:12,className:`ml-1 inline-block opacity-70 text-gray-600 dark:text-gray-300 flex-shrink-0`})]}),c&&n(c,e.id)&&(0,f.jsxs)(`button`,{onClick:e=>{e.stopPropagation()},title:`Also in: ${t(c,e.id).map(e=>c.nodes[e]?.name??e).join(`, `)}`,className:`ml-1.5 text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 dark:bg-amber-900/40\r
text-amber-700 dark:text-amber-300 flex-shrink-0 cursor-pointer hover:bg-amber-200\r
dark:hover:bg-amber-800/60 transition-colors`,"aria-label":`${t(c,e.id).length} parent groups — click to see`,children:[`×`,t(c,e.id).length]})]}),w&&S&&(0,f.jsx)(`div`,{className:`flex flex-col`,children:e.children.map(e=>(0,f.jsx)(p,{node:e,depth:i+1},e.id))})]})},m=({ref:e})=>{let{data:t,activeId:n}=r(),{open:a,setOpen:s,width:l,setWidth:u}=c(n),d=t?i(t,n):null;return(0,f.jsxs)(`div`,{ref:e,className:`flex h-[95vh] w-full overflow-hidden bg-white dark:bg-[#1e1e1e]`,onClick:()=>{s(!1)},children:[(0,f.jsx)(`div`,{className:`flex-1 overflow-auto pt-4 pb-32`,style:{paddingLeft:`260px`},children:(0,f.jsx)(`div`,{className:`max-w-5xl px-6`,children:t&&(0,f.jsx)(p,{node:t,depth:0})})}),a&&(0,f.jsx)(`div`,{style:{width:l,flexShrink:0}}),(0,f.jsx)(o,{open:a,onClose:()=>{s(!1)},node:d,initialWidth:l,onWidthChange:e=>u(e)})]})};export{m as default};