@epam/ai-dial-ui-kit 0.14.0-dev.46 → 0.14.0-dev.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DateCellRenderer-D437_mi0.cjs +1 -0
- package/dist/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.js +94 -87
- package/dist/components/FileManager/utils.js +31 -23
- package/dist/components/New/Dropdown/Dropdown.js +94 -93
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +52 -50
- package/dist/components-manifest.json +8 -2
- package/dist/dial-ui-kit.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/src/components/FileManager/FileManager.d.ts +2 -1
- package/dist/src/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.d.ts +2 -0
- package/dist/src/components/FileManager/utils.d.ts +11 -0
- package/dist/src/components/New/Dropdown/Dropdown.d.ts +10 -0
- package/dist/{use-file-manager-tabs-dJ-RvTEw.cjs → use-file-manager-tabs-DjdR_mYM.cjs} +2 -2
- package/package.json +1 -1
- package/dist/DateCellRenderer-BYItGoO_.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),S=require("./DateCellRenderer-BVM-Q8yx.cjs"),$=require("@tabler/icons-react"),o=require("react"),C=require("./merge-classes-Dipy1Ih1.cjs"),p=require("@floating-ui/react"),ge=require("./icon-DhjrDQ8I.cjs"),oe=require("./icon-CrGVkVpG.cjs"),g=require("./IconButton-DWqoaBWf.cjs"),it=require("classnames");var he=(e=>(e.Top="top",e.Right="right",e.Bottom="bottom",e.Left="left",e))(he||{});const ut=7,dt=2,mt=500,ft="fill-control-inverted",pt="z-[55] max-w-[376px] whitespace-pre-wrap break-words rounded-lg bg-control-inverted px-3 py-2 dial-small-text text-control-inverted shadow-xs",Pe=o.createContext(null),ze=()=>{const e=o.useContext(Pe);if(e==null)throw new Error("Tooltip components must be wrapped in <TooltipContainer />");return e},gt=({initialOpen:e=!1,placement:s=he.Bottom,isTriggerClickable:n=!1,open:r,onOpenChange:i}={})=>{const[u,a]=o.useState(e),d=o.useRef(null),m=r??u,h=i??a,b=p.useFloating({placement:s,open:m,onOpenChange:h,whileElementsMounted:p.autoUpdate,middleware:[p.offset(ut+dt),p.flip({fallbackAxisSideDirection:"start",padding:5}),p.shift({padding:5}),p.arrow({element:d})]}),f=p.useHover(b.context,{move:!1,enabled:r==null,mouseOnly:n,delay:{open:mt,close:0}}),N=p.useFocus(b.context,{enabled:r==null}),I=p.useDismiss(b.context),j=p.useRole(b.context,{role:"tooltip"}),A=p.useInteractions([f,N,I,j]);return o.useEffect(()=>{if(!m)return;const y=b.refs.reference.current;if(!(y instanceof Element))return;const k=new IntersectionObserver(([B])=>{B.isIntersecting||h(!1)},{root:null,threshold:0});return k.observe(y),()=>k.disconnect()},[m,b.refs.reference,h]),o.useMemo(()=>({open:m,setOpen:h,arrowRef:d,...A,...b}),[m,h,A,b])},Re=({children:e,...s})=>{const n=gt(s);return t.jsx(Pe.Provider,{value:n,children:e})},je=({style:e,...s})=>{const n=ze(),r=g.useHasHover(),i=S.useThemeScope(),u=o.useRef(null),a=p.useMergeRefs([n.refs.setFloating,u]);return!n.open||!r?null:t.jsx(p.FloatingPortal,{id:"tooltip-portal",children:t.jsxs("div",{ref:a,"data-placement":n.placement,style:{...n.floatingStyles,...e},...n.getFloatingProps(s),className:it(pt,i,n.getFloatingProps(s).className),children:[s.children,t.jsx(p.FloatingArrow,{ref:n.arrowRef,context:n.context,className:ft})]})})},we=({children:e,asChild:s=!1,...n})=>{const r=ze(),i=s&&o.isValidElement(e),u=i?e.props?.ref:null,a=p.useMergeRefs([r.refs.setReference,...u?[u]:[]]);if(i){const d=e.props;return o.cloneElement(e,r.getReferenceProps({...d,...n,className:C.mergeClasses(d.className,n.className)||void 0,ref:a}))}return t.jsx("span",{ref:a,...r.getReferenceProps(n),className:n.className??"text-start",children:e})},He=({hideTooltip:e=!1,tooltip:s,children:n,asChild:r=!1,triggerClassName:i,contentClassName:u,...a})=>{const d=!e&&!!s;return t.jsxs(Re,{...a,children:[t.jsx(we,{asChild:r,className:i,children:n}),d&&t.jsx(je,{className:u,children:s})]})},Le={[g.ButtonVariant.Primary]:{[g.ButtonAppearance.Solid]:"dial-kit-primary-solid-button",[g.ButtonAppearance.Ghost]:"dial-kit-primary-ghost-button",[g.ButtonAppearance.Link]:"dial-kit-primary-link-button"},[g.ButtonVariant.Neutral]:{[g.ButtonAppearance.Solid]:"dial-kit-neutral-solid-button",[g.ButtonAppearance.Outlined]:"dial-kit-neutral-outlined-button"},[g.ButtonVariant.Danger]:{[g.ButtonAppearance.Solid]:"dial-kit-danger-solid-button",[g.ButtonAppearance.Ghost]:"dial-kit-danger-ghost-button",[g.ButtonAppearance.Outlined]:"dial-kit-danger-outlined-button"},[g.ButtonVariant.Static]:{[g.ButtonAppearance.Solid]:"dial-kit-static-solid-button"},[g.ButtonVariant.Success]:{},[g.ButtonVariant.Secondary]:{},[g.ButtonVariant.Tertiary]:{}},Ve=(e=g.ButtonVariant.Primary,s=g.ButtonAppearance.Solid)=>{const n=Le[e]?.[s];return n||(console.warn(`Could not find Button styles for variant: ${e} and appearance: ${s}. Using default primary solid button styles.`),Le[g.ButtonVariant.Primary][g.ButtonAppearance.Solid])},ht={[g.ElementSize.Small]:"size-[24px]",[g.ElementSize.Standard]:"size-[40px] dial-kit-enhanced-target",[g.ElementSize.Large]:"size-[48px] dial-kit-enhanced-target"},xe=({variant:e,appearance:s=g.ButtonAppearance.Solid,size:n=g.ElementSize.Standard,className:r,icon:i,tooltipProps:u,type:a="button",...d})=>{const m=C.mergeClasses("dial-kit-base-icon-button dial-kit-base-button",e&&Ve(e,s),ht[n],r),h=t.jsx("button",{...d,type:a,className:m,"aria-label":g.resolveAccessibleName(d["aria-label"],u?.tooltip),children:i});return u?t.jsx(He,{asChild:!0,...u,children:h}):h},We=({caption:e,onClick:s,"aria-label":n})=>{if(!e)return null;const r=C.mergeClasses("text-secondary hover:text-control-accent-hover active:text-control-accent-active","focus-visible:outline focus-visible:outline-focus");return t.jsx(xe,{"aria-label":n,className:r,icon:t.jsx($.IconInfoCircle,{size:oe.DIAL_ICON_SIZE.SM,stroke:ge.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:s,size:g.ElementSize.Small,tooltipProps:{tooltip:e}})},Ae=({label:e,required:s,className:n,containerClassName:r,caption:i,size:u=g.ElementSize.Small,...a})=>e?t.jsxs("span",{className:C.mergeClasses("flex items-center gap-0.5",r),children:[t.jsxs("label",{...a,className:C.mergeClasses("text-secondary flex items-center gap-0.5",u===g.ElementSize.Small?"dial-tiny-semi-text":"dial-small-text",n),children:[typeof e=="string"?t.jsx("span",{className:"min-h-4",children:e}):e,s&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:"text-error dial-tiny-text",children:"*"}),t.jsx("span",{className:"sr-only",children:"(required)"})]})]}),t.jsx(We,{caption:i})]}):null;var O=(e=>(e.None="none",e.Check="check",e.Tint="tint",e.Checkbox="checkbox",e.Highlight="highlight",e))(O||{});const _e=(e,s)=>({appearance:r,...i})=>t.jsx(xe,{...i,variant:e,appearance:r||s}),Ue=(e,s)=>({variant:r,...i})=>t.jsx(xe,{...i,variant:r||s,appearance:e}),xt=_e(g.ButtonVariant.Primary,g.ButtonAppearance.Solid),Ct=_e(g.ButtonVariant.Neutral,g.ButtonAppearance.Solid),bt=_e(g.ButtonVariant.Danger,g.ButtonAppearance.Ghost),Ke=Ue(g.ButtonAppearance.Ghost,g.ButtonVariant.Primary),St=Ue(g.ButtonAppearance.Solid,g.ButtonVariant.Static),$e=({ariaLabel:e="Close",className:s,size:n=g.ElementSize.Small,onClose:r,...i})=>t.jsx(Ke,{...i,size:n,"aria-label":e,className:s,onClick:r,icon:t.jsx($.IconX,{size:n===g.ElementSize.Small?oe.DIAL_ICON_SIZE.SM:oe.DIAL_ICON_SIZE.MD,stroke:ge.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),Nt=e=>{const s=o.useRef(null),[n,r]=o.useState(!1),[i,u]=o.useState(""),a=o.useRef(!1),d=o.useCallback(()=>{const h=s.current;h&&(a.current&&u(h.textContent??""),r(h.scrollWidth>h.clientWidth))},[]),m=o.useCallback(()=>S.scheduleMeasure(d),[d]);return o.useEffect(()=>{const h=s.current;if(h)return S.observeElementSize(h,d)},[d]),o.useEffect(()=>{a.current=typeof e!="string",m()},[e,m]),{ref:s,isTruncated:n,textContent:i,remeasure:m}},Ce=({text:e,className:s,contentClassName:n,hideTooltip:r=!1,id:i,customTooltipContent:u,...a})=>{const{ref:d,isTruncated:m,textContent:h,remeasure:b}=Nt(e),f=typeof e=="string"?e:h,N=o.useMemo(()=>r||!m?null:u??f,[u,f,r,m]);return t.jsxs(Re,{...a,children:[t.jsx(we,{asChild:!0,onMouseEnter:b,onFocusCapture:b,children:t.jsx("span",{id:i,ref:d,"aria-label":m&&f?f:void 0,className:C.mergeClasses("block min-w-0 max-w-full flex-1 truncate text-start",s),children:e})}),!!N&&t.jsx(je,{className:n,children:N})]})},vt=8,Et=400,It="z-[54] max-w-[320px] rounded-xl bg-layer-0 p-4 dial-small-text text-primary shadow-md",me=({content:e,placement:s=he.Right,children:n,asChild:r=!1,hideTooltip:i=!1,initialOpen:u=!1,open:a,onOpenChange:d,triggerClassName:m,contentClassName:h})=>{const b=S.useIsMobileScreen(),f=S.useThemeScope(),[N,I]=o.useState(u),j=a??N,A=D=>{d?.(D),a==null&&I(D)},y=p.useFloatingNodeId(),{refs:k,floatingStyles:B,context:F}=p.useFloating({nodeId:y,placement:s,open:j,onOpenChange:A,whileElementsMounted:p.autoUpdate,middleware:[p.offset(vt),p.flip({padding:5}),p.shift({padding:5})]}),X=p.useHover(F,{enabled:a==null,handleClose:p.safePolygon(),delay:{open:Et,close:0}}),R=p.useFocus(F,{enabled:a==null}),H=p.useDismiss(F),{getReferenceProps:V,getFloatingProps:E}=p.useInteractions([X,R,H]),ee=o.useRef(null),te=p.useMergeRefs(o.useMemo(()=>[k.setFloating,ee],[k.setFloating])),Z=r&&o.isValidElement(n),L=Z?n.props?.ref:null,w=p.useMergeRefs(o.useMemo(()=>[k.setReference,...L?[L]:[]],[k.setReference,L])),P=!i&&!b&&!!e,M=Z?o.cloneElement(n,V({...n.props,ref:w,className:C.mergeClasses(n.props.className,m)||void 0})):t.jsx("span",{ref:w,...V(),className:m??"text-start",children:n});return t.jsxs(t.Fragment,{children:[M,j&&P&&t.jsx(p.FloatingPortal,{id:"interactive-tooltip-portal",children:t.jsx(p.FloatingFocusManager,{context:F,modal:!1,initialFocus:-1,returnFocus:!1,order:["reference","content"],children:t.jsx("div",{ref:te,"data-placement":F.placement,style:B,...E(),className:C.mergeClasses(It,f,h),children:e})})})]})},qe="rounded-xl bg-layer-raised p-1 shadow-md",Xe=C.mergeClasses(qe,"w-max"),Ze=C.mergeClasses("flex w-full cursor-pointer items-center gap-2 px-3 h-[40px] rounded-lg","dial-small-text text-primary truncate","hover:bg-control-accent-alpha-hover","focus-visible:outline focus-visible:outline-focus"),Ye="bg-control-accent-alpha",yt=C.mergeClasses(Ye,"text-accent"),kt=C.mergeClasses("cursor-not-allowed text-control-disable-primary","bg-transparent hover:bg-transparent"),Je=4,Tt=C.mergeClasses("flex items-center gap-2 align-middle","h-auto px-0 bg-transparent border-0"),Rt=C.mergeClasses("z-[53] focus-visible:outline-none",qe),jt=Xe,wt="my-1 border-t border-tertiary",Q=Je,At=t.jsx($.IconChevronRight,{size:oe.DIAL_ICON_SIZE.SM,stroke:ge.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Me={size:14,stroke:3,"aria-hidden":!0},De=({isSelected:e=!1,isIndeterminate:s=!1,invalid:n=!1,disabled:r=!1,htmlFor:i,className:u})=>{const a=s||e,d=!!i,m=C.mergeClasses("grid size-[20px] shrink-0 place-items-center rounded border transition-colors duration-200",d&&"dial-kit-minimum-target",d&&"peer-focus-visible:outline peer-focus-visible:outline-focus",r?"border-transparent bg-control-disable-primary text-control-disable-primary":C.mergeClasses(n&&a&&"border-transparent bg-control-error text-control-permanent",n&&!a&&"border-error bg-control-neutral",!n&&a&&"border-transparent bg-control-accent text-control-permanent hover:bg-control-accent-hover",!n&&!a&&"border-default bg-control-neutral hover:border-accent hover:bg-control-accent-alpha-hover"),r?"cursor-not-allowed":d&&"cursor-pointer",u),h=s?t.jsx($.IconMinus,{...Me}):e&&t.jsx($.IconCheck,{...Me});return d?t.jsx("label",{htmlFor:i,className:m,children:h}):t.jsx("span",{"aria-hidden":"true",className:m,children:h})},_t=t.jsx($.IconCheck,{size:oe.DIAL_ICON_SIZE.SM,stroke:ge.DIAL_KIT_ICON_STROKE,className:"shrink-0","aria-hidden":!0}),fe=({label:e,icon:s,description:n,mark:r=O.None,selected:i=!1,danger:u=!1,trailing:a,rightControl:d,ellipsisLabel:m=!1,labelClassName:h,children:b,className:f,disabled:N=!1,type:I="button",...j})=>{const A=i&&r===O.Highlight,y=i&&(r===O.Checkbox||r===O.Tint),k=C.mergeClasses(u&&"text-error",N&&"text-control-disable-primary"),B=C.mergeClasses(Ze,"aria-expanded:bg-control-accent-alpha-hover",A&&yt,y&&Ye,N&&kt,u&&"text-error",f),F=t.jsxs("button",{type:I,disabled:N,"data-menu-item-row":d?"":void 0,className:d?"flex h-full min-w-0 flex-1 items-center gap-2 truncate text-start focus-visible:outline-none":B,...j,children:[b??t.jsxs(t.Fragment,{children:[r===O.Checkbox&&t.jsx(De,{isSelected:i,disabled:N}),s&&t.jsx(S.DialIcon,{icon:s,className:k}),m?t.jsx(Ce,{text:e,className:C.mergeClasses(k,h)}):t.jsx("span",{className:C.mergeClasses("min-w-0 flex-1 truncate text-start",k,h),children:e}),n&&t.jsx("span",{className:C.mergeClasses("shrink-0 text-secondary dial-small-text",N&&"text-control-disable-primary"),children:n}),i&&r===O.Check&&_t]}),a&&t.jsx("span",{className:C.mergeClasses("ml-auto shrink-0",k),children:a})]});return d?t.jsxs("div",{role:"none",className:C.mergeClasses(B,"has-[[data-menu-item-row]:focus-visible]:outline","has-[[data-menu-item-row]:focus-visible]:outline-focus"),children:[F,d]}):F},pe=e=>e.mark??(e.selectable?O.Checkbox:O.None),Qe=e=>e.selectable?"menuitemcheckbox":pe(e)===O.Check?"menuitemradio":"menuitem",Dt=({item:e,onRootClose:s})=>{const{isOpen:n,nodeId:r,refs:i,floatingStyles:u,context:a,getReferenceProps:d,getFloatingProps:m}=S.useSubMenuFloating(Q,"menu",!!e.disabled),h=o.useCallback(f=>N=>{f.disabled||(f.onClick?.({key:f.key,domEvent:N}),f.selectable||s())},[s]),b=t.jsx(fe,{ref:i.setReference,role:"menuitem","aria-haspopup":"menu","aria-expanded":n,"aria-disabled":!!e.disabled,disabled:e.disabled,icon:e.icon,label:e.label,trailing:At,className:e.className,...d(),children:e.renderItem?.(e)});return t.jsxs(p.FloatingNode,{id:r,children:[e.interactiveTooltip?t.jsx(me,{asChild:!0,placement:e.interactiveTooltip.placement,content:e.interactiveTooltip.content,contentClassName:e.interactiveTooltip.contentClassName,children:b}):b,n&&t.jsx(S.SubMenuPanel,{refs:i,floatingStyles:u,context:a,getFloatingProps:m,role:"menu",surfaceClassName:jt,children:e.renderSubMenu?e.renderSubMenu():t.jsxs(t.Fragment,{children:[e.menuHeader&&(typeof e.menuHeader=="function"?e.menuHeader():e.menuHeader),e.children.map(f=>{const N=Qe(f),I=t.jsx(fe,{role:N,"aria-checked":N==="menuitem"?void 0:!!f.checked,"aria-current":pe(f)===O.Highlight&&f.checked?!0:void 0,"aria-disabled":!!f.disabled,disabled:f.disabled,mark:pe(f),selected:!!f.checked,danger:f.danger,icon:f.icon,label:f.label,className:f.className,rightControl:f.rightControl,onClick:h(f),children:f.renderItem?.(f)});return t.jsx(o.Fragment,{children:f.interactiveTooltip?t.jsx(me,{asChild:!0,placement:f.interactiveTooltip.placement,content:f.interactiveTooltip.content,contentClassName:f.interactiveTooltip.contentClassName,children:I}):I},f.key)}),e.menuFooter&&(typeof e.menuFooter=="function"?e.menuFooter():e.menuFooter)]})})]})},Ot='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]',Bt=e=>!e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true",Ft=["ArrowDown","ArrowUp","Home","End"],Lt=(e,s,n)=>{if(e==="Home")return 0;if(e==="End")return n-1;const r=e==="ArrowDown"?1:-1;return s===-1?r===1?0:n-1:(s+r+n)%n},Mt=e=>"clientWidth"in e?e.clientWidth:e.getBoundingClientRect?.()?.width??0,et=({children:e,items:s,onItemClick:n,menuHeader:r,menuFooter:i,renderOverlay:u,trigger:a=[S.DropdownTrigger.Click],placement:d,disabled:m=!1,open:h,defaultOpen:b=!1,onOpenChange:f,closable:N=!1,onClose:I,className:j,overlayContentClassName:A,separatorClassName:y,listClassName:k,outsidePressIgnoreRef:B,outsideClosable:F=!0,allowedPlacements:X,anchorToMouse:R=!1,matchReferenceWidth:H=!0,maxDropdownHeight:V,initialFocus:E})=>{const ee=S.useThemeScope(),[te,Z]=o.useState(b),L=h!==void 0,w=L?!!h:te,P=o.useRef(null),[M,D]=o.useState(!0),T=o.useCallback((l,v,c)=>{l&&D(c!=="hover"&&c!=="safe-polygon"),L||Z(l),f?.(l)},[L,f]),ne=o.useId(),be=d===void 0,ae=p.useFloatingNodeId(),{refs:W,floatingStyles:U,context:G}=p.useFloating({nodeId:ae,placement:d,open:w,onOpenChange:T,whileElementsMounted:p.autoUpdate,middleware:[p.offset({mainAxis:Q,crossAxis:0}),be?p.autoPlacement({alignment:"start",crossAxis:!0,padding:Q,allowedPlacements:X}):p.flip({padding:Q}),p.shift({padding:Q}),p.size({padding:Q,apply({availableWidth:l,availableHeight:v,elements:c}){const x=c.floating,_=Mt(c.reference);x.style.setProperty("--fui-available-height",`${Math.floor(v)}px`),x.style.setProperty("--reference-width",H?`${Math.round(_)}px`:"0px"),H?x.style.minWidth=`${Math.round(_)}px`:x.style.removeProperty("min-width"),x.style.maxWidth=`${Math.floor(l)}px`;const K=Math.floor(v);x.style.maxHeight=`${V?Math.min(K,V):K}px`}})]}),se=p.useClick(G,{enabled:a.includes(S.DropdownTrigger.Click)&&!m}),Y=p.useHover(G,{enabled:a.includes(S.DropdownTrigger.Hover)&&!m,move:!1,restMs:40,handleClose:p.safePolygon(),delay:{open:80,close:80}}),Se=p.useDismiss(G,{bubbles:!0,referencePress:!1,outsidePress:l=>{if(!F)return!1;const v=l.target;return!(B?.current&&v instanceof Node&&B.current.contains(v))}}),re=p.useRole(G,{role:"menu"}),{getReferenceProps:le,getFloatingProps:Ne}=p.useInteractions([se,Y,Se,re]),q=o.useCallback((l,v)=>{W.setPositionReference({getBoundingClientRect:()=>({width:0,height:0,x:l,y:v,top:v,left:l,right:l,bottom:v})})},[W]),J=o.useCallback(l=>{!a.includes(S.DropdownTrigger.ContextMenu)||m||(l.preventDefault(),R&&(q(l.clientX,l.clientY),P.current=document.elementFromPoint(l.clientX,l.clientY)),T(!0))},[R,m,T,q,a]),ve=o.useCallback(l=>{!R||m||(a.includes(S.DropdownTrigger.ContextMenu)&&w&&T(!1),q(l.clientX,l.clientY),P.current=document.elementFromPoint(l.clientX,l.clientY))},[R,m,q,w,a,T]);o.useEffect(()=>{m&&w&&T(!1)},[m,w,T]);const Ee=o.useCallback(l=>{if(l.defaultPrevented||!Ft.includes(l.key))return;const v=Array.from(l.currentTarget.querySelectorAll(Ot)).filter(Bt);if(v.length===0)return;l.preventDefault();const c=l.currentTarget.ownerDocument.activeElement,x=v.findIndex(_=>_===c);v[Lt(l.key,x,v.length)]?.focus()},[]),ce=o.useCallback(l=>v=>{l.disabled||(l.onClick?.({key:l.key,domEvent:v}),n?.({key:l.key,domEvent:v}),l.selectable||T(!1))},[n,T]),Ie=o.useMemo(()=>u?u():s?t.jsxs(t.Fragment,{children:[r&&t.jsx(t.Fragment,{children:typeof r=="function"?r():r}),t.jsx("div",{role:"none",className:C.mergeClasses("py-1",A),"aria-label":"dropdown",children:s.map(l=>{if(l.type===S.DropdownItemType.Divider)return t.jsx("div",{role:"separator",className:C.mergeClasses(wt,y)},l.key);if(l.type===S.DropdownItemType.PlainText)return t.jsx("div",{className:C.mergeClasses("px-3 py-2 text-secondary dial-caption-text",l.className),children:l.label},l.key);if(l.children?.length)return t.jsx(Dt,{item:l,onRootClose:()=>T(!1)},l.key);const v=pe(l),c=Qe(l),x=t.jsx(fe,{role:c,"aria-checked":c==="menuitem"?void 0:!!l.checked,"aria-current":v===O.Highlight&&l.checked?!0:void 0,"aria-disabled":!!l.disabled,disabled:l.disabled,mark:v,selected:!!l.checked,danger:l.danger,icon:l.icon,label:l.label,className:l.className,rightControl:l.rightControl,onClick:ce(l),children:l.renderItem?.(l)});return t.jsx(o.Fragment,{children:l.interactiveTooltip?t.jsx(me,{asChild:!0,placement:l.interactiveTooltip.placement,content:l.interactiveTooltip.content,contentClassName:l.interactiveTooltip.contentClassName,children:x}):x},l.key)})}),i&&t.jsx(t.Fragment,{children:typeof i=="function"?i():i})]}):null,[ce,s,i,r,u,T,A,y]),ie=le({onContextMenu:J,onMouseDown:ve});return o.useEffect(()=>{if(!w)return;const l=W.reference.current;let v=null;if(l instanceof Element?v=l:P.current instanceof Element&&(v=P.current),!v)return;const c=new IntersectionObserver(([x])=>{x.isIntersecting||T(!1)},{root:null,threshold:0});return c.observe(v),()=>c.disconnect()},[w,W.reference,T]),t.jsx(p.FloatingTree,{children:t.jsxs(p.FloatingNode,{id:ae,children:[t.jsx("span",{ref:W.setReference,className:C.mergeClasses(Tt,m&&"!cursor-not-allowed opacity-75",j),"aria-haspopup":"menu","aria-expanded":w,"aria-controls":ne,...ie,children:e}),w&&t.jsx(p.FloatingPortal,{children:t.jsx(p.FloatingFocusManager,{context:G,modal:!1,initialFocus:E!==void 0?E:M?0:-1,returnFocus:!0,children:t.jsxs("div",{id:ne,ref:W.setFloating,style:U,className:C.mergeClasses(Rt,!H&&"w-max","overflow-auto",ee,k),...Ne({onKeyDown:Ee}),children:[N&&t.jsx("div",{className:"flex items-center justify-between px-2 pt-2",children:t.jsx($e,{ariaLabel:"Close dropdown",onClose:l=>{I?.(l),T(!1)}})}),Ie]})})})]})})},Oe=({id:e,labelProps:s,isSelected:n=!1,isIndeterminate:r=!1,invalid:i=!1,disabled:u,onChange:a,caption:d,className:m,boxClassName:h,...b})=>{const f=o.useId(),N=e??f,I=d?`${N}-caption`:void 0,j=o.useCallback(y=>{a?.(y.target.checked)},[a]),A=o.useCallback(y=>{y&&(y.indeterminate=r)},[r]);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:C.mergeClasses("flex items-center gap-2",m),children:[t.jsx("input",{...b,ref:A,type:"checkbox",id:N,checked:n,disabled:u,onChange:j,"aria-checked":r?"mixed":n,"aria-invalid":i||void 0,"aria-label":g.resolveAccessibleName(typeof s?.label!="string"?b["aria-label"]:void 0),"aria-describedby":I,className:"peer sr-only"}),t.jsx(De,{htmlFor:N,isSelected:n,isIndeterminate:r,invalid:i,disabled:u,className:h}),s&&t.jsx(Ae,{size:g.ElementSize.Standard,...s,htmlFor:N,className:C.mergeClasses("py-[1px]",u?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",s.className)})]}),d&&t.jsx("span",{id:I,className:"dial-tiny-text text-secondary ml-[28px]",children:d})]})},tt=({id:e,name:s,value:n,labelProps:r,isSelected:i=!1,disabled:u,onChange:a,caption:d,className:m,...h})=>{const b=o.useId(),f=e??b,N=d?`${f}-caption`:void 0,I=o.useCallback(j=>{j.target.checked&&a?.(n)},[a,n]);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:C.mergeClasses("flex items-center gap-2 ",m),children:[t.jsx("input",{...h,type:"radio",id:f,name:s,value:n,checked:i,disabled:u,onChange:I,"aria-label":g.resolveAccessibleName(typeof r?.label!="string"?h["aria-label"]:void 0),"aria-describedby":N,className:"peer sr-only"}),t.jsx("label",{htmlFor:f,className:C.mergeClasses("group grid size-[20px] shrink-0 place-items-center rounded-full border transition-colors duration-200 hover:bg-control-accent-alpha-hover","dial-kit-minimum-target","peer-focus-visible:outline peer-focus-visible:outline-focus",u?"cursor-not-allowed border-default bg-control-disable-primary":C.mergeClasses("cursor-pointer",i?"border border-accent bg-control-neutral":"border-default bg-control-neutral")),children:i&&t.jsx("span",{className:C.mergeClasses("size-3 rounded-full",u?"bg-control-disable-secondary":"bg-control-accent")})}),r&&t.jsx(Ae,{size:g.ElementSize.Standard,...r,htmlFor:f,className:C.mergeClasses("py-[1px]",u?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",r.className)})]}),d&&t.jsx("span",{id:N,className:"dial-tiny-text text-secondary ml-[26px]",children:d})]})},Gt=60,nt=({title:e,description:s,icon:n,live:r=!1,className:i,titleClassName:u,descriptionClassName:a})=>t.jsxs("div",{role:r?"status":void 0,className:C.mergeClasses("flex size-full flex-col items-center justify-center gap-2 text-tertiary",i),children:[n??t.jsx($.IconClipboardX,{size:Gt,stroke:.5,"aria-hidden":"true"}),t.jsx("span",{className:C.mergeClasses("dial-body-semi-text text-primary",u),children:e}),s&&t.jsx("span",{className:C.mergeClasses("dial-small-text text-secondary",a),children:s})]}),st="dial-kit-grid",Pt="dial-kit-grid-with-selection",zt="dial-kit-grid-without-header-borders",Ht="dial-kit-grid-row-select",Vt="dial-kit-grid-header-select",Wt="dial-kit-grid-selection-visible",Ut="dial-kit-grid-align-right",Te=40,ye="0.5px solid var(--stroke-tertiary, #E0E6F0)",de={accentColor:"var(--bg-control-accent, #1D4ED8)",backgroundColor:"var(--bg-layer-raised, #FCFCFC)",oddRowBackgroundColor:"var(--bg-layer-sunken, #EEF1F7)",selectedRowBackgroundColor:"var(--bg-control-accent-alpha, #2764D90F)",rowHoverColor:"var(--bg-control-accent-alpha-hover, #2764D924)",borderColor:"var(--stroke-tertiary, #E0E6F0)",rowBorder:ye,headerRowBorder:ye,headerColumnBorder:ye,chromeBackgroundColor:"var(--bg-layer-base, #F5F7FA)",foregroundColor:"var(--text-primary, #161B2D)",headerTextColor:"var(--text-secondary, #57647A)",browserColorScheme:"light",headerFontSize:14,headerFontWeight:600,fontSize:14,fontFamily:"var(--theme-font, var(--font-inter))",spacing:4,borderRadius:4,wrapperBorderRadius:8};var z=(e=>(e.API="api",e.ROW_DATA_CHANGED="rowDataChanged",e.CHECKBOX_SELECTED="checkboxSelected",e))(z||{});const Kt=({params:e,mode:s,label:n,radioName:r,rowId:i,disabled:u})=>{const a=e.node,[d,m]=o.useState(()=>!!a.isSelected());o.useEffect(()=>{const b=()=>m(!!a.isSelected());return b(),a.addEventListener("rowSelected",b),()=>a.removeEventListener("rowSelected",b)},[a]);const h=b=>{u||a.setSelected(b,s===S.GridSelectionMode.SINGLE,z.CHECKBOX_SELECTED)};return s===S.GridSelectionMode.SINGLE?t.jsx(tt,{name:r,value:i,isSelected:d,disabled:u,"aria-label":n,onChange:()=>h(!0)}):t.jsx(Oe,{isSelected:d,disabled:u,"aria-label":n,onChange:h})},Ge=e=>{let s=0,n=0;return e.forEachNodeAfterFilter(r=>{r.selectable!==!1&&(n++,r.isSelected()&&s++)}),{selected:s,selectable:n}},$t=({api:e,label:s})=>{const[{selected:n,selectable:r},i]=o.useState(()=>Ge(e));o.useEffect(()=>{const a=()=>i(Ge(e));return a(),e.addEventListener("selectionChanged",a),e.addEventListener("modelUpdated",a),()=>{e.isDestroyed()||(e.removeEventListener("selectionChanged",a),e.removeEventListener("modelUpdated",a))}},[e]);const u=o.useCallback(a=>{if(a){e.selectAll("filtered",z.CHECKBOX_SELECTED);return}e.deselectAll("filtered",z.CHECKBOX_SELECTED)},[e]);return t.jsx(Oe,{isSelected:r>0&&n===r,isIndeterminate:n>0&&n<r,disabled:r===0,"aria-label":s,onChange:u})},rt="en-US",ot={year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"},ke=40,qt={minWidth:ke,width:ke,maxWidth:ke,resizable:!1,sortable:!1,filter:!1,floatingFilter:!1,suppressMovable:!0,suppressHeaderMenuButton:!0,suppressAutoSize:!0,suppressSizeToFit:!0},at="dial-kit-grid-selection",Xt=150,Zt=100,Yt=({columnDefs:e,rowData:s,additionalGridOptions:n,getContextMenuItems:r,className:i,ariaLabel:u="Data grid",wrapCustomCellRenderers:a=!0,disabledRowIds:d,selectedRowIds:m,onSelectionChange:h,onGridApiChange:b,getRowId:f,alternateOddRowColors:N=!1,filterPlaceholder:I="Enter value",emptyStateIcon:j,emptyStateTitle:A="No results found",emptyStateDescription:y="Sorry, we couldn't find any results for your search.",loading:k=!1,wrapperBorder:B=!0,withoutHeaderBorders:F=!1,allowDisabledContextMenu:X=!1,selectionMode:R,selectRowLabel:H,selectAllLabel:V="Select all rows"})=>{S.registerAgGridModulesOnce();const[E,ee]=o.useState(),te=S.useIsMobileScreen(),Z=S.useIsTabletScreen(),L=o.useRef(new Set),w=o.useRef(void 0),P=`dial-kit-grid-selection-${o.useId()}`,M=o.useRef({getRowId:f,getContextMenuItems:r,onSelectionChange:h,selectRowLabel:H,wrapCustomCellRenderers:a});M.current={getRowId:f,getContextMenuItems:r,onSelectionChange:h,selectRowLabel:H,wrapCustomCellRenderers:a};const D=o.useCallback(c=>{const x=M.current.getRowId;return x?x(c):String(c.id??JSON.stringify(c))},[]),T=!!r,ne=!!a,be=o.useMemo(()=>S.themeBalham.withPart(S.colorSchemeLight).withParams({...de,oddRowBackgroundColor:N?de.oddRowBackgroundColor:de.backgroundColor,wrapperBorder:B}),[N,B]),ae=o.useCallback(c=>{c.api.sizeColumnsToFit()},[]),W=te||Z||(m?.size??0)>0,U=o.useCallback(c=>!!c&&!!d?.has(D(c)),[d,D]),G=o.useCallback((c,x,_)=>T?t.jsx(et,{trigger:[S.DropdownTrigger.ContextMenu],items:c.data?M.current.getContextMenuItems?.(c.data)??[]:[],anchorToMouse:!0,matchReferenceWidth:!0,className:C.mergeClasses("size-full",_&&"cursor-not-allowed opacity-75"),disabled:_&&!X,children:t.jsx("span",{className:"block min-w-0 max-w-full flex-1",children:x})}):x,[T,X]),se=o.useCallback(c=>{if(!c.data)return null;const x=U(c.data);return G(c,t.jsx(Ce,{text:c.value==null?"":String(c.value),className:"max-w-full dial-small-text text-primary",hideTooltip:x}),x)},[U,G]),Y=o.useCallback(c=>c===z.API||c===z.ROW_DATA_CHANGED,[]),Se=o.useMemo(()=>S.debounceFn(c=>{const _=(c.selectedNodes??[]).map(Be=>Be.data),K=new Set(_.map(D));L.current=K,w.current=c.source,!Y(c.source)&&M.current.onSelectionChange?.(K,_)},Zt),[Y,D]),re=o.useMemo(()=>{if(R)return{...qt,colId:at,headerName:"",headerClass:Vt,cellClass:Ht,headerComponent:R===S.GridSelectionMode.MULTIPLE?$t:void 0,headerComponentParams:{label:V},cellRenderer:c=>{if(!c.data)return null;const x=D(c.data);return t.jsx(Kt,{params:c,mode:R,rowId:x,radioName:P,label:M.current.selectRowLabel?.(c.data)??"Select row",disabled:d?.has(x)})}}},[R,V,D,d,P]),le=o.useCallback(c=>{if(!c.cellRenderer)return{...c,cellRenderer:se};const x=M.current.wrapCustomCellRenderers;if(!(typeof x=="function"?x(c):!!x))return c;const K=c.cellRenderer;return{...c,cellRenderer:ue=>{const lt=U(ue.data),Fe=typeof K=="function"?K:void 0,ct=Fe?t.jsx(Fe,{...ue}):se(ue);return G(ue,ct,lt)}}},[U,se,G]),Ne=o.useMemo(()=>{const c=ne?(e??[]).map(le):e??[];return re?[re,...c]:c},[e,ne,le,re]),{defaultColDef:q,rowSelection:J,...ve}=n??{},Ee=o.useMemo(()=>({minWidth:Xt,resizable:!0,sortable:!0,floatingFilter:!0,filter:"agTextColumnFilter",filterParams:{filterPlaceholder:I,buttons:["reset"]},comparator:S.baseColumnComparator,...S.omitUndefined(q)}),[I,q]),ce=c=>{c.api.sizeColumnsToFit(),ee(c.api),n?.onGridReady?.(c),b?.(c.api)};o.useEffect(()=>{E&&s&&E.setGridOption("rowData",s)},[E,s]);const Ie=o.useCallback(()=>t.jsx(nt,{live:!0,title:A,description:y,icon:j??t.jsx($.IconZoomCancel,{size:100,stroke:.5,"aria-hidden":"true"})}),[A,y,j]),ie=typeof J=="object"?J:void 0,l=o.useMemo(()=>R?{isRowSelectable:c=>!U(c.data),...ie,mode:R===S.GridSelectionMode.SINGLE?"singleRow":"multiRow",checkboxes:!1,headerCheckbox:!1}:J,[J,ie,U,R]);o.useEffect(()=>{E&&s&&L.current.size&&L.current.forEach(c=>{const x=E.getRowNode(c);x&&!x.isSelected()&&x.setSelected(!0,!1,z.API)})},[E,s]),o.useEffect(()=>{E&&m&&(E.deselectAll("all",z.API),m.forEach(c=>{const x=E.getRowNode(c);x&&!x.isSelected()&&x.setSelected(!0,!1,z.API)}))},[E,m]);const v=o.useCallback(c=>c.data?D(c.data):"",[D]);return o.useEffect(()=>{const c=Y(w.current);if(E&&m?.size&&c){const x=Array.from(m)[0];if(x){const _=E.getRowNode(x);_&&E.ensureNodeVisible(_)}}},[E,Y,m]),t.jsx("div",{className:C.mergeClasses(st,"size-full",R&&Pt,R&&W&&Wt,F&&zt,i),role:"region","aria-label":u,"aria-busy":k,children:t.jsx("div",{className:"h-full overflow-x-auto",children:t.jsx(S.AgGridReact,{rowModelType:"clientSide",headerHeight:Te,rowHeight:Te,cellSelection:!1,theme:be,autoSizeStrategy:{type:"fitGridWidth"},columnDefs:Ne,defaultColDef:Ee,onGridSizeChanged:ae,onGridReady:ce,loading:k,suppressCellFocus:!0,suppressDragLeaveHidesColumns:!0,noRowsOverlayComponent:Ie,rowData:s,rowSelection:l,onSelectionChanged:Se,getRowId:v,...ve})})})},Jt=({value:e,locale:s=rt,options:n=ot,emptyPlaceholder:r,className:i,hideTooltip:u=!1})=>{const a=S.convertToDate(e),d=o.useMemo(()=>a?new Intl.DateTimeFormat(s,n).format(a):r,[a,r,s,n]),m=a?a.toISOString():void 0;return t.jsx(Ce,{text:m?t.jsx("time",{dateTime:m,children:d}):t.jsx("span",{children:d}),className:C.mergeClasses("dial-small-text text-primary",i),hideTooltip:u})};exports.Checkbox=Oe;exports.CheckboxBox=De;exports.CloseButton=$e;exports.DEFAULT_DATE_FORMAT_OPTIONS=ot;exports.DEFAULT_LOCALE=rt;exports.DangerIconButton=bt;exports.DateCellRenderer=Jt;exports.Dropdown=et;exports.EllipsisTooltip=Ce;exports.GRID_ALIGN_RIGHT_CLASS=Ut;exports.GRID_ROOT_CLASS=st;exports.GRID_SELECTION_COLUMN_ID=at;exports.GRID_THEME_PARAMS=de;exports.GhostIconButton=Ke;exports.Grid=Yt;exports.IconButton=xe;exports.InfoButton=We;exports.InteractiveTooltip=me;exports.Label=Ae;exports.MenuItem=fe;exports.MenuItemMark=O;exports.NeutralIconButton=Ct;exports.NoDataContent=nt;exports.PrimaryIconButton=xt;exports.ROW_HEIGHT=Te;exports.Radio=tt;exports.StaticIconButton=St;exports.Tooltip=He;exports.TooltipContainer=Re;exports.TooltipContent=je;exports.TooltipPlacement=he;exports.TooltipTrigger=we;exports.getButtonClassNames=Ve;exports.overlayGap=Je;exports.overlayItemClassName=Ze;exports.overlaySubMenuClassName=Xe;
|
package/dist/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.js
CHANGED
|
@@ -1,107 +1,113 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s, Fragment as
|
|
2
|
-
import { DialPopup as
|
|
3
|
-
import { DialFileManager as
|
|
4
|
-
import { PopupSize as
|
|
5
|
-
import { DialPrimaryButton as b, DialNeutralButton as
|
|
6
|
-
import { DialButton as
|
|
7
|
-
import { ButtonAppearance as
|
|
8
|
-
import { IconFolderPlus as
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { DialPopup as Z } from "../../../Popup/Popup.js";
|
|
3
|
+
import { DialFileManager as $ } from "../../FileManager.js";
|
|
4
|
+
import { PopupSize as P } from "../../../../types/popup.js";
|
|
5
|
+
import { DialPrimaryButton as b, DialNeutralButton as F } from "../../../Button/ButtonWrappers.js";
|
|
6
|
+
import { DialButton as L } from "../../../Button/Button.js";
|
|
7
|
+
import { ButtonAppearance as ee } from "../../../../types/button.js";
|
|
8
|
+
import { IconFolderPlus as B, IconEye as ie, IconDotsVertical as oe } from "@tabler/icons-react";
|
|
9
9
|
import { BASE_ICON_PROPS as r } from "../../../../constants/icon.js";
|
|
10
|
-
import { DialSwitch as
|
|
11
|
-
import { useState as
|
|
12
|
-
import { DestinationFolderMode as
|
|
13
|
-
import { DialTooltip as
|
|
14
|
-
import { mergeClasses as
|
|
15
|
-
import { DialNotification as
|
|
16
|
-
import { DialDropdown as
|
|
17
|
-
import { useIsMobileScreen as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
import { DialSwitch as le } from "../../../Switch/Switch.js";
|
|
11
|
+
import { useState as R, useRef as ne, useMemo as x, useCallback as j } from "react";
|
|
12
|
+
import { DestinationFolderMode as T } from "../../../../types/file-manager.js";
|
|
13
|
+
import { DialTooltip as ae } from "../../../Tooltip/Tooltip.js";
|
|
14
|
+
import { mergeClasses as te } from "../../../../utils/merge-classes.js";
|
|
15
|
+
import { DialNotification as se } from "../../../Notification/Notification.js";
|
|
16
|
+
import { DialDropdown as re } from "../../../Dropdown/Dropdown.js";
|
|
17
|
+
import { useIsMobileScreen as ce } from "../../../../hooks/use-is-mobile-screen.js";
|
|
18
|
+
import { excludePathsFromTree as me } from "../../utils.js";
|
|
19
|
+
const we = ({
|
|
20
|
+
onClose: N,
|
|
21
|
+
onConfirm: y,
|
|
22
|
+
onFolderPopupPathChange: v,
|
|
22
23
|
setDestinationFolderPath: C,
|
|
23
|
-
open:
|
|
24
|
-
copyLabel:
|
|
25
|
-
moveLabel:
|
|
24
|
+
open: E,
|
|
25
|
+
copyLabel: D = "Copy",
|
|
26
|
+
moveLabel: O = "Move",
|
|
26
27
|
addFolderLabel: c = "Add folder",
|
|
27
|
-
mode: m =
|
|
28
|
+
mode: m = T.Copy,
|
|
28
29
|
hiddenFilesSwitcherLabel: f = "Show hidden files",
|
|
29
30
|
showHiddenFileSwitcher: l = !0,
|
|
30
|
-
showCreateFolderButton:
|
|
31
|
-
onUploadFiles:
|
|
32
|
-
onValidateUpload:
|
|
33
|
-
maxFileSize:
|
|
34
|
-
header:
|
|
35
|
-
sourceFolder:
|
|
36
|
-
disabledPathTooltip:
|
|
37
|
-
path:
|
|
38
|
-
collapsedFileTree:
|
|
39
|
-
alertProps:
|
|
40
|
-
processDestinationFolderPath:
|
|
31
|
+
showCreateFolderButton: n = !0,
|
|
32
|
+
onUploadFiles: _,
|
|
33
|
+
onValidateUpload: G,
|
|
34
|
+
maxFileSize: H,
|
|
35
|
+
header: U,
|
|
36
|
+
sourceFolder: p,
|
|
37
|
+
disabledPathTooltip: V = "Unavailable for the original path. Please select another folder",
|
|
38
|
+
path: a,
|
|
39
|
+
collapsedFileTree: q = !1,
|
|
40
|
+
alertProps: M,
|
|
41
|
+
processDestinationFolderPath: d,
|
|
42
|
+
excludedPaths: I,
|
|
43
|
+
items: k,
|
|
41
44
|
...o
|
|
42
45
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
const [S, w] = R(!1), [J, h] = R(!1), u = ne(null), K = ce(), Q = x(
|
|
47
|
+
() => me(k, I),
|
|
48
|
+
[k, I]
|
|
49
|
+
), z = j((i) => {
|
|
50
|
+
w(i);
|
|
51
|
+
}, []), W = x(() => {
|
|
46
52
|
const i = [];
|
|
47
|
-
return
|
|
53
|
+
return n && i.push({
|
|
48
54
|
key: "add-folder",
|
|
49
55
|
label: c,
|
|
50
|
-
icon: /* @__PURE__ */ e(
|
|
56
|
+
icon: /* @__PURE__ */ e(B, { ...r, className: "text-secondary" }),
|
|
51
57
|
onClick: () => {
|
|
52
58
|
u.current?.createFolder(), h(!1);
|
|
53
59
|
}
|
|
54
60
|
}), l && i.push({
|
|
55
61
|
key: "show-hidden-files",
|
|
56
62
|
label: f,
|
|
57
|
-
icon: /* @__PURE__ */ e(
|
|
63
|
+
icon: /* @__PURE__ */ e(ie, { ...r, className: "text-secondary" }),
|
|
58
64
|
onClick: () => {
|
|
59
|
-
|
|
65
|
+
w((t) => !t), h(!1);
|
|
60
66
|
}
|
|
61
67
|
}), i;
|
|
62
68
|
}, [
|
|
63
69
|
c,
|
|
64
70
|
f,
|
|
65
71
|
l,
|
|
66
|
-
|
|
67
|
-
]),
|
|
72
|
+
n
|
|
73
|
+
]), X = j(
|
|
68
74
|
(i) => {
|
|
69
75
|
if (i) {
|
|
70
|
-
let t =
|
|
71
|
-
|
|
76
|
+
let t = d ? d(i) : i;
|
|
77
|
+
v?.(t), C?.(t);
|
|
72
78
|
}
|
|
73
79
|
},
|
|
74
80
|
[
|
|
75
|
-
|
|
81
|
+
v,
|
|
76
82
|
C,
|
|
77
|
-
|
|
83
|
+
d
|
|
78
84
|
]
|
|
79
|
-
),
|
|
85
|
+
), Y = m === T.Copy ? "Copy to" : "Move to", g = x(() => !a || !p ? !1 : p === a, [a, p]);
|
|
80
86
|
return /* @__PURE__ */ e(
|
|
81
|
-
|
|
87
|
+
Z,
|
|
82
88
|
{
|
|
83
|
-
open:
|
|
89
|
+
open: E,
|
|
84
90
|
onClose: () => {
|
|
85
|
-
|
|
91
|
+
N();
|
|
86
92
|
},
|
|
87
|
-
size:
|
|
93
|
+
size: P.Lg,
|
|
88
94
|
dividerFooter: !0,
|
|
89
95
|
dividers: !1,
|
|
90
96
|
className: "md:!h-[800px] !bg-layer-2",
|
|
91
97
|
footer: /* @__PURE__ */ s("div", { className: "flex justify-between items-center gap-2 p-4 md:px-6", children: [
|
|
92
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-4 min-w-0", children:
|
|
93
|
-
|
|
98
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-4 min-w-0", children: K ? /* @__PURE__ */ e(
|
|
99
|
+
re,
|
|
94
100
|
{
|
|
95
|
-
items:
|
|
96
|
-
open:
|
|
101
|
+
items: W,
|
|
102
|
+
open: J,
|
|
97
103
|
onOpenChange: h,
|
|
98
104
|
children: /* @__PURE__ */ e(
|
|
99
|
-
|
|
105
|
+
L,
|
|
100
106
|
{
|
|
101
107
|
className: "size-9 shrink-0",
|
|
102
108
|
"aria-label": "More options",
|
|
103
109
|
iconBefore: /* @__PURE__ */ e(
|
|
104
|
-
|
|
110
|
+
oe,
|
|
105
111
|
{
|
|
106
112
|
...r,
|
|
107
113
|
className: "text-secondary"
|
|
@@ -110,67 +116,68 @@ const Oe = ({
|
|
|
110
116
|
}
|
|
111
117
|
)
|
|
112
118
|
}
|
|
113
|
-
) : /* @__PURE__ */ s(
|
|
114
|
-
|
|
119
|
+
) : /* @__PURE__ */ s(A, { children: [
|
|
120
|
+
n && /* @__PURE__ */ e(
|
|
115
121
|
b,
|
|
116
122
|
{
|
|
117
123
|
label: c,
|
|
118
|
-
appearance:
|
|
119
|
-
iconBefore: /* @__PURE__ */ e(
|
|
124
|
+
appearance: ee.Ghost,
|
|
125
|
+
iconBefore: /* @__PURE__ */ e(B, { ...r }),
|
|
120
126
|
onClick: () => {
|
|
121
127
|
u.current?.createFolder();
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
),
|
|
125
|
-
|
|
126
|
-
l && /* @__PURE__ */ e(
|
|
127
|
-
|
|
131
|
+
n && l && /* @__PURE__ */ e("div", { className: "w-px h-[26px] bg-controls-disable-accent my-2" }),
|
|
132
|
+
l && /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e("div", { className: "inline-flex items-center cursor-pointer", children: /* @__PURE__ */ e(
|
|
133
|
+
le,
|
|
128
134
|
{
|
|
129
135
|
label: f,
|
|
130
|
-
isOn:
|
|
131
|
-
onChange:
|
|
136
|
+
isOn: S,
|
|
137
|
+
onChange: z,
|
|
132
138
|
switchId: "hidden-files-switch-modal"
|
|
133
139
|
}
|
|
134
140
|
) }) })
|
|
135
141
|
] }) }),
|
|
136
142
|
/* @__PURE__ */ s("div", { className: "flex space-x-4 items-center", children: [
|
|
137
|
-
/* @__PURE__ */ e(
|
|
138
|
-
g ? /* @__PURE__ */ e(
|
|
143
|
+
/* @__PURE__ */ e(F, { onClick: N, label: "Cancel" }),
|
|
144
|
+
g ? /* @__PURE__ */ e(ae, { tooltip: V, children: /* @__PURE__ */ e(
|
|
139
145
|
b,
|
|
140
146
|
{
|
|
141
|
-
onClick:
|
|
142
|
-
label: m === "copy" ?
|
|
147
|
+
onClick: y,
|
|
148
|
+
label: m === "copy" ? D : O,
|
|
143
149
|
disabled: g,
|
|
144
150
|
"aria-disabled": g
|
|
145
151
|
}
|
|
146
152
|
) }) : /* @__PURE__ */ e(
|
|
147
153
|
b,
|
|
148
154
|
{
|
|
149
|
-
onClick:
|
|
150
|
-
label: m === "copy" ?
|
|
155
|
+
onClick: y,
|
|
156
|
+
label: m === "copy" ? D : O
|
|
151
157
|
}
|
|
152
158
|
)
|
|
153
159
|
] })
|
|
154
160
|
] }),
|
|
155
|
-
header:
|
|
161
|
+
header: U ?? Y,
|
|
156
162
|
children: /* @__PURE__ */ s("div", { className: "bg-layer-2 h-full flex flex-col", children: [
|
|
157
|
-
|
|
163
|
+
M && /* @__PURE__ */ e("div", { className: "px-6 mb-4 pt-4", children: /* @__PURE__ */ e(se, { ...M }) }),
|
|
158
164
|
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ e(
|
|
159
|
-
|
|
165
|
+
$,
|
|
160
166
|
{
|
|
161
167
|
...o,
|
|
168
|
+
items: Q,
|
|
162
169
|
gridClassName: "size-full",
|
|
163
|
-
className:
|
|
170
|
+
className: te(
|
|
164
171
|
o.className,
|
|
165
172
|
"bg-layer-2 h-full flex pt-0"
|
|
166
173
|
),
|
|
167
174
|
actionsRef: u,
|
|
168
|
-
path:
|
|
169
|
-
showHiddenFiles:
|
|
170
|
-
onShowHiddenFilesChange:
|
|
175
|
+
path: a,
|
|
176
|
+
showHiddenFiles: S,
|
|
177
|
+
onShowHiddenFilesChange: z,
|
|
171
178
|
treeOptions: {
|
|
172
179
|
...o.treeOptions,
|
|
173
|
-
collapsed:
|
|
180
|
+
collapsed: q,
|
|
174
181
|
expandedPaths: /* @__PURE__ */ new Set([o.rootItem?.path || "/"]),
|
|
175
182
|
header: o.treeOptions?.header
|
|
176
183
|
},
|
|
@@ -179,10 +186,10 @@ const Oe = ({
|
|
|
179
186
|
elementId: "file-manager-destination-search",
|
|
180
187
|
...o.navigationPanelOptions
|
|
181
188
|
},
|
|
182
|
-
onUploadFiles:
|
|
183
|
-
onValidateUpload:
|
|
184
|
-
onPathChange:
|
|
185
|
-
maxFileSize:
|
|
189
|
+
onUploadFiles: _,
|
|
190
|
+
onValidateUpload: G,
|
|
191
|
+
onPathChange: X,
|
|
192
|
+
maxFileSize: H
|
|
186
193
|
}
|
|
187
194
|
) })
|
|
188
195
|
] })
|
|
@@ -190,5 +197,5 @@ const Oe = ({
|
|
|
190
197
|
);
|
|
191
198
|
};
|
|
192
199
|
export {
|
|
193
|
-
|
|
200
|
+
we as DialDestinationFolderPopup
|
|
194
201
|
};
|
|
@@ -17,7 +17,7 @@ const u = (t, e) => {
|
|
|
17
17
|
if (r.length <= 1) return t[0];
|
|
18
18
|
const o = "/" + r.slice(0, r.length - 1).join("/");
|
|
19
19
|
return u(t, o) ?? t[0];
|
|
20
|
-
},
|
|
20
|
+
}, d = (t) => (t ?? "").toLowerCase(), w = (t) => d(t).replace(/^\./, ""), D = (t) => {
|
|
21
21
|
if (!t) return [];
|
|
22
22
|
const e = [], n = (r) => {
|
|
23
23
|
const o = r.items ?? [];
|
|
@@ -25,11 +25,18 @@ const u = (t, e) => {
|
|
|
25
25
|
e.push(s), s.nodeType === p.FOLDER && n(s);
|
|
26
26
|
};
|
|
27
27
|
return n(t), e;
|
|
28
|
-
}, A = (t
|
|
28
|
+
}, A = (t, e) => {
|
|
29
|
+
if (!t?.length) return [];
|
|
30
|
+
if (!e?.length) return t;
|
|
31
|
+
const n = new Set(e), r = (o) => o.filter((s) => !n.has(s.path)).map(
|
|
32
|
+
(s) => s.items?.length ? { ...s, items: r(s.items) } : s
|
|
33
|
+
);
|
|
34
|
+
return r(t);
|
|
35
|
+
}, E = (t) => (t.name ?? t.path.split("/").pop() ?? "").startsWith("."), h = (t) => {
|
|
29
36
|
if (!t) return "0 bytes";
|
|
30
37
|
const e = 1024, n = e * 1024;
|
|
31
38
|
return t >= n ? `${(t / n).toFixed(1)} MB` : t >= e ? `${(t / e).toFixed(0)} KB` : `${t} bytes`;
|
|
32
|
-
},
|
|
39
|
+
}, v = (t, e = "en-US", n = {
|
|
33
40
|
year: "numeric",
|
|
34
41
|
month: "short",
|
|
35
42
|
day: "2-digit"
|
|
@@ -41,7 +48,7 @@ const u = (t, e) => {
|
|
|
41
48
|
return t;
|
|
42
49
|
}
|
|
43
50
|
};
|
|
44
|
-
function
|
|
51
|
+
function f(t, e, n) {
|
|
45
52
|
if (!t || t.includes("*/*"))
|
|
46
53
|
return !0;
|
|
47
54
|
const r = e.toLowerCase(), o = n && n.includes(".") ? `.${n.split(".").at(-1).toLowerCase()}` : void 0;
|
|
@@ -67,27 +74,27 @@ const g = (t) => t?.map((e) => e.endsWith("/*") ? e.replace("/*", "s") : F(e).fl
|
|
|
67
74
|
const e = t.flags.replace(/[gy]/g, "");
|
|
68
75
|
return new RegExp(t.source, e);
|
|
69
76
|
};
|
|
70
|
-
function
|
|
77
|
+
function B(t, e, n) {
|
|
71
78
|
if (e && T(e)?.test(t.name))
|
|
72
79
|
return n ?? `This ${t.isFolder ? "folder" : "file"} contains forbidden characters in its name. Please rename it.`;
|
|
73
80
|
}
|
|
74
|
-
const
|
|
81
|
+
const O = (t) => {
|
|
75
82
|
const e = t.lastIndexOf("/");
|
|
76
83
|
return e >= 0 ? {
|
|
77
84
|
parent: t.slice(0, e),
|
|
78
85
|
name: t.slice(e + 1)
|
|
79
86
|
} : { parent: "", name: t };
|
|
80
|
-
},
|
|
81
|
-
const r = !t.contentLength || n == null || t.contentLength <= n, o = !t.contentType ||
|
|
87
|
+
}, C = (t, e, n) => {
|
|
88
|
+
const r = !t.contentLength || n == null || t.contentLength <= n, o = !t.contentType || f(e, t.contentType, t.name);
|
|
82
89
|
return r && o;
|
|
83
|
-
},
|
|
90
|
+
}, N = (t, e, n, r, o) => {
|
|
84
91
|
if (t.nodeType === p.FOLDER) return;
|
|
85
92
|
const s = !t.contentLength || n == null || t.contentLength <= n;
|
|
86
|
-
if (!(!t.contentType ||
|
|
93
|
+
if (!(!t.contentType || f(e, t.contentType, t.name)))
|
|
87
94
|
return r ?? (e?.length ? `Unsupported file type. Supported types: ${g(e)}.` : "Unsupported file type.");
|
|
88
95
|
if (!s)
|
|
89
96
|
return o ?? `File is too large. Maximum size: ${h(n)}.`;
|
|
90
|
-
},
|
|
97
|
+
}, M = (t) => t.replace(/\/+$/, "").split("/").filter(Boolean).length, R = (t) => {
|
|
91
98
|
const e = `${m} `, n = new RegExp(`^${m} (\\d+)$`), r = new Set(
|
|
92
99
|
t.map((c) => c.name.toLowerCase())
|
|
93
100
|
), o = t.map((c) => {
|
|
@@ -101,21 +108,22 @@ const B = (t) => {
|
|
|
101
108
|
};
|
|
102
109
|
export {
|
|
103
110
|
T as cleanForbiddenSymbolsRegExp,
|
|
104
|
-
|
|
111
|
+
D as collectAllDescendants,
|
|
112
|
+
A as excludePathsFromTree,
|
|
105
113
|
x as findFolderForPath,
|
|
106
114
|
u as findNodeByPath,
|
|
107
115
|
g as formatAllowedFileTypesForTooltip,
|
|
108
116
|
h as formatBytes,
|
|
109
|
-
|
|
117
|
+
v as formatDate,
|
|
110
118
|
F as getExtensionsListForMimeType,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
M as getFolderNestingDepth,
|
|
120
|
+
B as getForbiddenSymbolsTooltip,
|
|
121
|
+
R as getNextFolderName,
|
|
122
|
+
N as getRowTooltip,
|
|
123
|
+
f as isFileAccepted,
|
|
124
|
+
C as isFileSelectable,
|
|
125
|
+
E as isHiddenDotFile,
|
|
126
|
+
w as normalizeExtensionWithoutDot,
|
|
127
|
+
d as normalizeToLowerCase,
|
|
128
|
+
O as splitPathAndName
|
|
121
129
|
};
|