@epam/ai-dial-ui-kit 0.14.0-dev.30 → 0.14.0-dev.33

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.
Files changed (37) hide show
  1. package/dist/CHANGELOG.md +9 -0
  2. package/dist/{DateCellRenderer-BdsPUuVy.cjs → DateCellRenderer-B0o0BqbW.cjs} +1 -1
  3. package/dist/DateCellRenderer-B41xNX7a.cjs +1 -0
  4. package/dist/components/Grid/constants.js +7 -2
  5. package/dist/components/New/Dropdown/Dropdown.js +170 -189
  6. package/dist/components/New/Dropdown/DropdownSubMenuItem.js +62 -104
  7. package/dist/components/New/Dropdown/constants.js +19 -26
  8. package/dist/components/New/Dropdown/item-mark.js +6 -0
  9. package/dist/components/New/MenuItem/MenuItem.js +108 -0
  10. package/dist/components/New/MenuItem/constants.js +16 -0
  11. package/dist/components/New/Select/Select.js +218 -229
  12. package/dist/components/New/Select/SelectSubMenuItem.js +54 -71
  13. package/dist/components/New/Select/constants.js +22 -37
  14. package/dist/components/New/constants/overlay.js +11 -7
  15. package/dist/components-manifest.json +143 -4
  16. package/dist/dial-ui-kit.cjs +2 -2
  17. package/dist/dial-ui-kit.js +247 -243
  18. package/dist/file-manager.cjs +1 -1
  19. package/dist/grid.cjs +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/src/components/New/Dropdown/Dropdown.d.ts +10 -0
  22. package/dist/src/components/New/Dropdown/constants.d.ts +5 -4
  23. package/dist/src/components/New/Dropdown/item-mark.d.ts +15 -0
  24. package/dist/src/components/New/MenuItem/MenuItem.d.ts +68 -0
  25. package/dist/src/components/New/MenuItem/constants.d.ts +5 -0
  26. package/dist/src/components/New/Select/Select.d.ts +14 -2
  27. package/dist/src/components/New/Select/SelectSubMenuItem.d.ts +3 -0
  28. package/dist/src/components/New/Select/constants.d.ts +12 -5
  29. package/dist/src/components/New/constants/overlay.d.ts +7 -0
  30. package/dist/src/index.d.ts +3 -0
  31. package/dist/src/models/dropdown.d.ts +17 -1
  32. package/dist/src/models/select.d.ts +6 -0
  33. package/dist/src/types/menu-item.d.ts +21 -0
  34. package/dist/types/menu-item.js +4 -0
  35. package/dist/{use-file-manager-tabs-CmpcHI2g.cjs → use-file-manager-tabs-CkYH0CvF.cjs} +1 -1
  36. package/package.json +1 -1
  37. package/dist/DateCellRenderer-BmzYCUIt.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),C=require("./DateCellRenderer-B0o0BqbW.cjs"),P=require("@tabler/icons-react"),l=require("react"),p=require("./IconButton-BCbBgnzo.cjs"),g=require("./merge-classes-Dipy1Ih1.cjs"),S=require("@floating-ui/react"),fe=require("./icon-DhjrDQ8I.cjs"),re=require("./icon-CrGVkVpG.cjs"),ct=require("classnames");var ke=(e=>(e.Top="top",e.Right="right",e.Bottom="bottom",e.Left="left",e))(ke||{});const it=7,ut=2,dt=500,mt="fill-control-inverted",ft="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",Ge=l.createContext(null),ze=()=>{const e=l.useContext(Ge);if(e==null)throw new Error("Tooltip components must be wrapped in <TooltipContainer />");return e},pt=({initialOpen:e=!1,placement:r=ke.Bottom,isTriggerClickable:n=!1,open:s,onOpenChange:u}={})=>{const[d,a]=l.useState(e),m=l.useRef(null),f=s??d,c=u??a,h=S.useFloating({placement:r,open:f,onOpenChange:c,whileElementsMounted:S.autoUpdate,middleware:[S.offset(it+ut),S.flip({fallbackAxisSideDirection:"start",padding:5}),S.shift({padding:5}),S.arrow({element:m})]}),y=S.useHover(h.context,{move:!1,enabled:s==null,mouseOnly:n,delay:{open:dt,close:0}}),N=S.useFocus(h.context,{enabled:s==null}),A=S.useDismiss(h.context),_=S.useRole(h.context,{role:"tooltip"}),j=S.useInteractions([y,N,A,_]);return l.useEffect(()=>{if(!f)return;const v=h.refs.reference.current;if(!(v instanceof Element))return;const D=new IntersectionObserver(([O])=>{O.isIntersecting||c(!1)},{root:null,threshold:0});return D.observe(v),()=>D.disconnect()},[f,h.refs.reference,c]),l.useMemo(()=>({open:f,setOpen:c,arrowRef:m,...j,...h}),[f,c,j,h])},Re=({children:e,...r})=>{const n=pt(r);return t.jsx(Ge.Provider,{value:n,children:e})},Ae=({style:e,...r})=>{const n=ze(),s=p.useIsMobileScreen(),u=C.useThemeScope(),d=l.useRef(null),a=S.useMergeRefs([n.refs.setFloating,d]);return!n.open||s?null:t.jsx(S.FloatingPortal,{id:"tooltip-portal",children:t.jsxs("div",{ref:a,"data-placement":n.placement,style:{...n.floatingStyles,...e},...n.getFloatingProps(r),className:ct(ft,u,n.getFloatingProps(r).className),children:[r.children,t.jsx(S.FloatingArrow,{ref:n.arrowRef,context:n.context,className:mt})]})})},we=({children:e,asChild:r=!1,...n})=>{const s=ze(),u=r&&l.isValidElement(e),d=u?e.props?.ref:null,a=S.useMergeRefs([s.refs.setReference,...d?[d]:[]]);if(u){const m=e.props;return l.cloneElement(e,s.getReferenceProps({...m,...n,className:g.mergeClasses(m.className,n.className)||void 0,ref:a}))}return t.jsx("span",{ref:a,...s.getReferenceProps(n),className:n.className??"text-start",children:e})},Pe=({hideTooltip:e=!1,tooltip:r,children:n,asChild:s=!1,triggerClassName:u,contentClassName:d,...a})=>{const m=!e&&!!r;return t.jsxs(Re,{...a,children:[t.jsx(we,{asChild:s,className:u,children:n}),m&&t.jsx(Ae,{className:d,children:r})]})},Le={[p.ButtonVariant.Primary]:{[p.ButtonAppearance.Solid]:"dial-kit-primary-solid-button",[p.ButtonAppearance.Ghost]:"dial-kit-primary-ghost-button",[p.ButtonAppearance.Link]:"dial-kit-primary-link-button"},[p.ButtonVariant.Neutral]:{[p.ButtonAppearance.Solid]:"dial-kit-neutral-solid-button",[p.ButtonAppearance.Outlined]:"dial-kit-neutral-outlined-button"},[p.ButtonVariant.Danger]:{[p.ButtonAppearance.Solid]:"dial-kit-danger-solid-button",[p.ButtonAppearance.Ghost]:"dial-kit-danger-ghost-button",[p.ButtonAppearance.Outlined]:"dial-kit-danger-outlined-button"},[p.ButtonVariant.Static]:{[p.ButtonAppearance.Solid]:"dial-kit-static-solid-button"},[p.ButtonVariant.Success]:{},[p.ButtonVariant.Secondary]:{},[p.ButtonVariant.Tertiary]:{}},He=(e=p.ButtonVariant.Primary,r=p.ButtonAppearance.Solid)=>{const n=Le[e]?.[r];return n||(console.warn(`Could not find Button styles for variant: ${e} and appearance: ${r}. Using default primary solid button styles.`),Le[p.ButtonVariant.Primary][p.ButtonAppearance.Solid])},gt={[p.ElementSize.Small]:"size-[24px]",[p.ElementSize.Standard]:"size-[40px] dial-kit-enhanced-target",[p.ElementSize.Large]:"size-[48px] dial-kit-enhanced-target"},pe=({variant:e,appearance:r=p.ButtonAppearance.Solid,size:n=p.ElementSize.Standard,className:s,icon:u,tooltipProps:d,type:a="button",...m})=>{const f=g.mergeClasses("dial-kit-base-icon-button dial-kit-base-button",e&&He(e,r),gt[n],s),c=t.jsx("button",{...m,type:a,className:f,"aria-label":p.resolveAccessibleName(m["aria-label"],d?.tooltip),children:u});return d?t.jsx(Pe,{asChild:!0,...d,children:c}):c},We=({caption:e,onClick:r,"aria-label":n})=>{if(!e)return null;const s=g.mergeClasses("text-secondary hover:text-control-accent-hover active:text-control-accent-active","focus-visible:outline focus-visible:outline-focus");return t.jsx(pe,{"aria-label":n,className:s,icon:t.jsx(P.IconInfoCircle,{size:re.DIAL_ICON_SIZE.SM,stroke:fe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),onClick:r,size:p.ElementSize.Small,tooltipProps:{tooltip:e}})},Te=({label:e,required:r,className:n,containerClassName:s,caption:u,size:d=p.ElementSize.Small,...a})=>e?t.jsxs("span",{className:g.mergeClasses("flex items-center gap-0.5",s),children:[t.jsxs("label",{...a,className:g.mergeClasses("text-secondary flex items-center gap-0.5",d===p.ElementSize.Small?"dial-tiny-semi-text":"dial-small-text",n),children:[typeof e=="string"?t.jsx("span",{className:"min-h-4",children:e}):e,r&&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:u})]}):null;var T=(e=>(e.None="none",e.Check="check",e.Tint="tint",e.Checkbox="checkbox",e.Highlight="highlight",e))(T||{});const _e=(e,r)=>({appearance:s,...u})=>t.jsx(pe,{...u,variant:e,appearance:s||r}),Ve=(e,r)=>({variant:s,...u})=>t.jsx(pe,{...u,variant:s||r,appearance:e}),ht=_e(p.ButtonVariant.Primary,p.ButtonAppearance.Solid),xt=_e(p.ButtonVariant.Neutral,p.ButtonAppearance.Solid),Ct=_e(p.ButtonVariant.Danger,p.ButtonAppearance.Ghost),Ue=Ve(p.ButtonAppearance.Ghost,p.ButtonVariant.Primary),bt=Ve(p.ButtonAppearance.Solid,p.ButtonVariant.Static),Ke=({ariaLabel:e="Close",className:r,size:n=p.ElementSize.Small,onClose:s,...u})=>t.jsx(Ue,{...u,size:n,"aria-label":e,className:r,onClick:s,icon:t.jsx(P.IconX,{size:n===p.ElementSize.Small?re.DIAL_ICON_SIZE.SM:re.DIAL_ICON_SIZE.MD,stroke:fe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"})}),St=e=>{const r=l.useRef(null),[n,s]=l.useState(!1),[u,d]=l.useState(""),a=l.useRef(!1),m=l.useCallback(()=>{const c=r.current;c&&(a.current&&d(c.textContent??""),s(c.scrollWidth>c.clientWidth))},[]),f=l.useCallback(()=>C.scheduleMeasure(m),[m]);return l.useEffect(()=>{const c=r.current;if(c)return C.observeElementSize(c,m)},[m]),l.useEffect(()=>{a.current=typeof e!="string",f()},[e,f]),{ref:r,isTruncated:n,textContent:u,remeasure:f}},ge=({text:e,className:r,contentClassName:n,hideTooltip:s=!1,id:u,customTooltipContent:d,...a})=>{const{ref:m,isTruncated:f,textContent:c,remeasure:h}=St(e),y=typeof e=="string"?e:c,N=l.useMemo(()=>s||!f?null:d??y,[d,y,s,f]);return t.jsxs(Re,{...a,children:[t.jsx(we,{asChild:!0,onMouseEnter:h,onFocusCapture:h,children:t.jsx("span",{id:u,ref:m,"aria-label":f&&y?y:void 0,className:g.mergeClasses("block min-w-0 max-w-full flex-1 truncate text-start",r),children:e})}),!!N&&t.jsx(Ae,{className:n,children:N})]})},$e="rounded-xl bg-layer-raised p-1 shadow-md",qe=g.mergeClasses($e,"w-max"),Xe=g.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"),Ze="bg-control-accent-alpha",Nt=g.mergeClasses(Ze,"text-accent"),Et=g.mergeClasses("cursor-not-allowed text-control-disable-primary","bg-transparent hover:bg-transparent"),Ye=4,yt=g.mergeClasses("flex items-center gap-2 align-middle","h-auto px-0 bg-transparent border-0"),It=g.mergeClasses("z-[53] focus-visible:outline-none",$e),vt=qe,kt="my-1 border-t border-tertiary",Z=Ye,Rt=t.jsx(P.IconChevronRight,{size:re.DIAL_ICON_SIZE.SM,stroke:fe.DIAL_KIT_ICON_STROKE,"aria-hidden":"true"}),Fe={size:14,stroke:3,"aria-hidden":!0},je=({isSelected:e=!1,isIndeterminate:r=!1,invalid:n=!1,disabled:s=!1,htmlFor:u,className:d})=>{const a=r||e,m=!!u,f=g.mergeClasses("grid size-[20px] shrink-0 place-items-center rounded border transition-colors duration-200",m&&"dial-kit-minimum-target",m&&"peer-focus-visible:outline peer-focus-visible:outline-focus",s?"border-transparent bg-control-disable-primary text-control-disable-primary":g.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"),s?"cursor-not-allowed":m&&"cursor-pointer",d),c=r?t.jsx(P.IconMinus,{...Fe}):e&&t.jsx(P.IconCheck,{...Fe});return m?t.jsx("label",{htmlFor:u,className:f,children:c}):t.jsx("span",{"aria-hidden":"true",className:f,children:c})},At=t.jsx(P.IconCheck,{size:re.DIAL_ICON_SIZE.SM,stroke:fe.DIAL_KIT_ICON_STROKE,className:"shrink-0","aria-hidden":!0}),de=({label:e,icon:r,description:n,mark:s=T.None,selected:u=!1,danger:d=!1,trailing:a,rightControl:m,ellipsisLabel:f=!1,labelClassName:c,children:h,className:y,disabled:N=!1,type:A="button",..._})=>{const j=u&&s===T.Highlight,v=u&&(s===T.Checkbox||s===T.Tint),D=g.mergeClasses(d&&"text-error",N&&"text-control-disable-primary"),O=g.mergeClasses(Xe,"aria-expanded:bg-control-accent-alpha-hover",j&&Nt,v&&Ze,N&&Et,d&&"text-error",y),U=t.jsxs("button",{type:A,disabled:N,"data-menu-item-row":m?"":void 0,className:m?"flex h-full min-w-0 flex-1 items-center gap-2 truncate text-start focus-visible:outline-none":O,..._,children:[h??t.jsxs(t.Fragment,{children:[s===T.Checkbox&&t.jsx(je,{isSelected:u,disabled:N}),r&&t.jsx(C.DialIcon,{icon:r,className:D}),f?t.jsx(ge,{text:e,className:g.mergeClasses(D,c)}):t.jsx("span",{className:g.mergeClasses("min-w-0 flex-1 truncate text-start",D,c),children:e}),n&&t.jsx("span",{className:g.mergeClasses("shrink-0 text-secondary dial-small-text",N&&"text-control-disable-primary"),children:n}),u&&s===T.Check&&At]}),a&&t.jsx("span",{className:g.mergeClasses("ml-auto shrink-0",D),children:a})]});return m?t.jsxs("div",{role:"none",className:g.mergeClasses(O,"has-[[data-menu-item-row]:focus-visible]:outline","has-[[data-menu-item-row]:focus-visible]:outline-focus"),children:[U,m]}):U},me=e=>e.mark??(e.selectable?T.Checkbox:T.None),Je=e=>e.selectable?"menuitemcheckbox":me(e)===T.Check?"menuitemradio":"menuitem",wt=({item:e,onRootClose:r})=>{const{isOpen:n,refs:s,floatingStyles:u,context:d,getReferenceProps:a,getFloatingProps:m}=C.useSubMenuFloating(Z,"menu",!!e.disabled),f=l.useCallback(c=>h=>{c.disabled||(c.onClick?.({key:c.key,domEvent:h}),c.selectable||r())},[r]);return t.jsxs(t.Fragment,{children:[t.jsx(de,{ref:s.setReference,role:"menuitem","aria-haspopup":"menu","aria-expanded":n,"aria-disabled":!!e.disabled,disabled:e.disabled,icon:e.icon,label:e.label,trailing:Rt,className:e.className,...a(),children:e.renderItem?.(e)}),n&&t.jsx(C.SubMenuPanel,{refs:s,floatingStyles:u,context:d,getFloatingProps:m,role:"menu",surfaceClassName:vt,children:e.renderSubMenu?e.renderSubMenu():t.jsxs(t.Fragment,{children:[e.menuHeader&&(typeof e.menuHeader=="function"?e.menuHeader():e.menuHeader),e.children.map(c=>{const h=Je(c);return t.jsx(de,{role:h,"aria-checked":h==="menuitem"?void 0:!!c.checked,"aria-current":me(c)===T.Highlight&&c.checked?!0:void 0,"aria-disabled":!!c.disabled,disabled:c.disabled,mark:me(c),selected:!!c.checked,danger:c.danger,icon:c.icon,label:c.label,className:c.className,rightControl:c.rightControl,onClick:f(c),children:c.renderItem?.(c)},c.key)}),e.menuFooter&&(typeof e.menuFooter=="function"?e.menuFooter():e.menuFooter)]})})]})},Tt='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]',_t=e=>!e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true",jt=["ArrowDown","ArrowUp","Home","End"],Dt=(e,r,n)=>{if(e==="Home")return 0;if(e==="End")return n-1;const s=e==="ArrowDown"?1:-1;return r===-1?s===1?0:n-1:(r+s+n)%n},Bt=e=>"clientWidth"in e?e.clientWidth:e.getBoundingClientRect?.()?.width??0,Qe=({children:e,items:r,onItemClick:n,menuHeader:s,menuFooter:u,renderOverlay:d,trigger:a=[C.DropdownTrigger.Click],placement:m,disabled:f=!1,open:c,defaultOpen:h=!1,onOpenChange:y,closable:N=!1,onClose:A,className:_,overlayContentClassName:j,separatorClassName:v,listClassName:D,outsidePressIgnoreRef:O,outsideClosable:U=!0,allowedPlacements:se,anchorToMouse:R=!1,matchReferenceWidth:K=!0,maxDropdownHeight:Y})=>{const I=C.useThemeScope(),[he,xe]=l.useState(h),J=c!==void 0,w=J?!!c:he,H=l.useRef(null),[oe,M]=l.useState(!0),E=l.useCallback((o,b,k)=>{o&&M(k!=="hover"&&k!=="safe-polygon"),J||xe(o),y?.(o)},[J,y]),Q=l.useId(),ae=m===void 0,{refs:G,floatingStyles:Ce,context:W}=S.useFloating({placement:m,open:w,onOpenChange:E,whileElementsMounted:S.autoUpdate,middleware:[S.offset({mainAxis:Z,crossAxis:0}),ae?S.autoPlacement({alignment:"start",crossAxis:!0,padding:Z,allowedPlacements:se}):S.flip({padding:Z}),S.shift({padding:Z}),S.size({padding:Z,apply({availableWidth:o,availableHeight:b,elements:k}){const B=k.floating,i=Bt(k.reference);B.style.setProperty("--fui-available-height",`${Math.floor(b)}px`),B.style.setProperty("--reference-width",K?`${Math.round(i)}px`:"0px"),K?B.style.minWidth=`${Math.round(i)}px`:B.style.removeProperty("min-width"),B.style.maxWidth=`${Math.floor(o)}px`;const x=Math.floor(b);B.style.maxHeight=`${Y?Math.min(x,Y):x}px`}})]}),z=S.useClick(W,{enabled:a.includes(C.DropdownTrigger.Click)&&!f}),$=S.useHover(W,{enabled:a.includes(C.DropdownTrigger.Hover)&&!f,move:!1,restMs:40,delay:{open:80,close:80}}),ee=S.useDismiss(W,{bubbles:!0,referencePress:!1,outsidePress:o=>{if(!U)return!1;const b=o.target;return!(O?.current&&b instanceof Node&&O.current.contains(b))}}),q=S.useRole(W,{role:"menu"}),{getReferenceProps:be,getFloatingProps:te}=S.useInteractions([z,$,ee,q]),V=l.useCallback((o,b)=>{G.setPositionReference({getBoundingClientRect:()=>({width:0,height:0,x:o,y:b,top:b,left:o,right:o,bottom:b})})},[G]),Se=l.useCallback(o=>{!a.includes(C.DropdownTrigger.ContextMenu)||f||(o.preventDefault(),R&&(V(o.clientX,o.clientY),H.current=document.elementFromPoint(o.clientX,o.clientY)),E(!0))},[R,f,E,V,a]),le=l.useCallback(o=>{!R||f||(a.includes(C.DropdownTrigger.ContextMenu)&&w&&E(!1),V(o.clientX,o.clientY),H.current=document.elementFromPoint(o.clientX,o.clientY))},[R,f,V,w,a,E]);l.useEffect(()=>{f&&w&&E(!1)},[f,w,E]);const X=l.useCallback(o=>{if(o.defaultPrevented||!jt.includes(o.key))return;const b=Array.from(o.currentTarget.querySelectorAll(Tt)).filter(_t);if(b.length===0)return;o.preventDefault();const k=o.currentTarget.ownerDocument.activeElement,B=b.findIndex(i=>i===k);b[Dt(o.key,B,b.length)]?.focus()},[]),ce=l.useCallback(o=>b=>{o.disabled||(o.onClick?.({key:o.key,domEvent:b}),n?.({key:o.key,domEvent:b}),o.selectable||E(!1))},[n,E]),Ne=l.useMemo(()=>d?d():r?t.jsxs(t.Fragment,{children:[s&&t.jsx(t.Fragment,{children:typeof s=="function"?s():s}),t.jsx("div",{role:"none",className:g.mergeClasses("py-1",j),"aria-label":"dropdown",children:r.map(o=>{if(o.type===C.DropdownItemType.Divider)return t.jsx("div",{role:"separator",className:g.mergeClasses(kt,v)},o.key);if(o.type===C.DropdownItemType.PlainText)return t.jsx("div",{className:g.mergeClasses("px-3 py-2 text-secondary dial-caption-text",o.className),children:o.label},o.key);if(o.children?.length)return t.jsx(wt,{item:o,onRootClose:()=>E(!1)},o.key);const b=me(o),k=Je(o);return t.jsx(de,{role:k,"aria-checked":k==="menuitem"?void 0:!!o.checked,"aria-current":b===T.Highlight&&o.checked?!0:void 0,"aria-disabled":!!o.disabled,disabled:o.disabled,mark:b,selected:!!o.checked,danger:o.danger,icon:o.icon,label:o.label,className:o.className,rightControl:o.rightControl,onClick:ce(o),children:o.renderItem?.(o)},o.key)})}),u&&t.jsx(t.Fragment,{children:typeof u=="function"?u():u})]}):null,[ce,r,u,s,d,E,j,v]),Ee=be({onContextMenu:Se,onMouseDown:le});return l.useEffect(()=>{if(!w)return;const o=G.reference.current;let b=null;if(o instanceof Element?b=o:H.current instanceof Element&&(b=H.current),!b)return;const k=new IntersectionObserver(([B])=>{B.isIntersecting||E(!1)},{root:null,threshold:0});return k.observe(b),()=>k.disconnect()},[w,G.reference,E]),t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:G.setReference,className:g.mergeClasses(yt,f&&"!cursor-not-allowed opacity-75",_),"aria-haspopup":"menu","aria-expanded":w,"aria-controls":Q,...Ee,children:e}),w&&t.jsx(S.FloatingPortal,{children:t.jsx(S.FloatingFocusManager,{context:W,modal:!1,initialFocus:oe?0:-1,returnFocus:!0,children:t.jsxs("div",{id:Q,ref:G.setFloating,style:Ce,className:g.mergeClasses(It,!K&&"w-max","overflow-auto",I,D),...te({onKeyDown:X}),children:[N&&t.jsx("div",{className:"flex items-center justify-between px-2 pt-2",children:t.jsx(Ke,{ariaLabel:"Close dropdown",onClose:o=>{A?.(o),E(!1)}})}),Ne]})})})]})},De=({id:e,labelProps:r,isSelected:n=!1,isIndeterminate:s=!1,invalid:u=!1,disabled:d,onChange:a,caption:m,className:f,boxClassName:c,...h})=>{const y=l.useId(),N=e??y,A=m?`${N}-caption`:void 0,_=l.useCallback(v=>{a?.(v.target.checked)},[a]),j=l.useCallback(v=>{v&&(v.indeterminate=s)},[s]);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:g.mergeClasses("flex items-center gap-2",f),children:[t.jsx("input",{...h,ref:j,type:"checkbox",id:N,checked:n,disabled:d,onChange:_,"aria-checked":s?"mixed":n,"aria-invalid":u||void 0,"aria-label":p.resolveAccessibleName(typeof r?.label!="string"?h["aria-label"]:void 0),"aria-describedby":A,className:"peer sr-only"}),t.jsx(je,{htmlFor:N,isSelected:n,isIndeterminate:s,invalid:u,disabled:d,className:c}),r&&t.jsx(Te,{size:p.ElementSize.Standard,...r,htmlFor:N,className:g.mergeClasses("py-[1px]",d?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",r.className)})]}),m&&t.jsx("span",{id:A,className:"dial-tiny-text text-secondary ml-[28px]",children:m})]})},et=({id:e,name:r,value:n,labelProps:s,isSelected:u=!1,disabled:d,onChange:a,caption:m,className:f,...c})=>{const h=l.useId(),y=e??h,N=m?`${y}-caption`:void 0,A=l.useCallback(_=>{_.target.checked&&a?.(n)},[a,n]);return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:g.mergeClasses("flex items-center gap-2 ",f),children:[t.jsx("input",{...c,type:"radio",id:y,name:r,value:n,checked:u,disabled:d,onChange:A,"aria-label":p.resolveAccessibleName(typeof s?.label!="string"?c["aria-label"]:void 0),"aria-describedby":N,className:"peer sr-only"}),t.jsx("label",{htmlFor:y,className:g.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",d?"cursor-not-allowed border-default bg-control-disable-primary":g.mergeClasses("cursor-pointer",u?"border border-accent bg-control-neutral":"border-default bg-control-neutral")),children:u&&t.jsx("span",{className:g.mergeClasses("size-3 rounded-full",d?"bg-control-disable-secondary":"bg-control-accent")})}),s&&t.jsx(Te,{size:p.ElementSize.Standard,...s,htmlFor:y,className:g.mergeClasses("py-[1px]",d?"cursor-not-allowed text-control-disable-primary":"cursor-pointer text-primary",s.className)})]}),m&&t.jsx("span",{id:N,className:"dial-tiny-text text-secondary ml-[26px]",children:m})]})},Ot=60,tt=({title:e,description:r,icon:n,live:s=!1,className:u,titleClassName:d,descriptionClassName:a})=>t.jsxs("div",{role:s?"status":void 0,className:g.mergeClasses("flex size-full flex-col items-center justify-center gap-2 text-tertiary",u),children:[n??t.jsx(P.IconClipboardX,{size:Ot,stroke:.5,"aria-hidden":"true"}),t.jsx("span",{className:g.mergeClasses("dial-body-semi-text text-primary",d),children:e}),r&&t.jsx("span",{className:g.mergeClasses("dial-small-text text-secondary",a),children:r})]}),nt="dial-kit-grid",Lt="dial-kit-grid-with-selection",Ft="dial-kit-grid-without-header-borders",Mt="dial-kit-grid-row-select",Gt="dial-kit-grid-header-select",zt="dial-kit-grid-selection-visible",Pt="dial-kit-grid-align-right",ve=40,ye="0.5px solid var(--stroke-tertiary, #E0E6F0)",ue={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 F=(e=>(e.API="api",e.ROW_DATA_CHANGED="rowDataChanged",e.CHECKBOX_SELECTED="checkboxSelected",e))(F||{});const Ht=({params:e,mode:r,label:n,radioName:s,rowId:u,disabled:d})=>{const a=e.node,[m,f]=l.useState(()=>!!a.isSelected());l.useEffect(()=>{const h=()=>f(!!a.isSelected());return h(),a.addEventListener("rowSelected",h),()=>a.removeEventListener("rowSelected",h)},[a]);const c=h=>{d||a.setSelected(h,r===C.GridSelectionMode.SINGLE,F.CHECKBOX_SELECTED)};return r===C.GridSelectionMode.SINGLE?t.jsx(et,{name:s,value:u,isSelected:m,disabled:d,"aria-label":n,onChange:()=>c(!0)}):t.jsx(De,{isSelected:m,disabled:d,"aria-label":n,onChange:c})},Me=e=>{let r=0,n=0;return e.forEachNodeAfterFilter(s=>{s.selectable!==!1&&(n++,s.isSelected()&&r++)}),{selected:r,selectable:n}},Wt=({api:e,label:r})=>{const[{selected:n,selectable:s},u]=l.useState(()=>Me(e));l.useEffect(()=>{const a=()=>u(Me(e));return a(),e.addEventListener("selectionChanged",a),e.addEventListener("modelUpdated",a),()=>{e.isDestroyed()||(e.removeEventListener("selectionChanged",a),e.removeEventListener("modelUpdated",a))}},[e]);const d=l.useCallback(a=>{if(a){e.selectAll("filtered",F.CHECKBOX_SELECTED);return}e.deselectAll("filtered",F.CHECKBOX_SELECTED)},[e]);return t.jsx(De,{isSelected:s>0&&n===s,isIndeterminate:n>0&&n<s,disabled:s===0,"aria-label":r,onChange:d})},rt="en-US",st={year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"},Ie=40,Vt={minWidth:Ie,width:Ie,maxWidth:Ie,resizable:!1,sortable:!1,filter:!1,floatingFilter:!1,suppressMovable:!0,suppressHeaderMenuButton:!0,suppressAutoSize:!0,suppressSizeToFit:!0};C.setupAgTestIds({testIdAttribute:"dataQA"});C.ModuleRegistry.registerModules([C.AllCommunityModule]);const ot="dial-kit-grid-selection",Ut=150,Kt=100,$t=({columnDefs:e,rowData:r,additionalGridOptions:n,getContextMenuItems:s,className:u,ariaLabel:d="Data grid",wrapCustomCellRenderers:a=!0,disabledRowIds:m,selectedRowIds:f,onSelectionChange:c,onGridApiChange:h,getRowId:y,alternateOddRowColors:N=!1,filterPlaceholder:A="Enter value",emptyStateIcon:_,emptyStateTitle:j="No results found",emptyStateDescription:v="Sorry, we couldn't find any results for your search.",loading:D=!1,wrapperBorder:O=!0,withoutHeaderBorders:U=!1,allowDisabledContextMenu:se=!1,selectionMode:R,selectRowLabel:K,selectAllLabel:Y="Select all rows"})=>{const[I,he]=l.useState(),xe=p.useIsMobileScreen(),J=C.useIsTabletScreen(),w=l.useRef(new Set),H=l.useRef(void 0),oe=`dial-kit-grid-selection-${l.useId()}`,M=l.useRef({getRowId:y,getContextMenuItems:s,onSelectionChange:c,selectRowLabel:K,wrapCustomCellRenderers:a});M.current={getRowId:y,getContextMenuItems:s,onSelectionChange:c,selectRowLabel:K,wrapCustomCellRenderers:a};const E=l.useCallback(i=>{const x=M.current.getRowId;return x?x(i):String(i.id??JSON.stringify(i))},[]),Q=!!s,ae=!!a,G=l.useMemo(()=>C.themeBalham.withPart(C.colorSchemeLight).withParams({...ue,oddRowBackgroundColor:N?ue.oddRowBackgroundColor:ue.backgroundColor,wrapperBorder:O}),[N,O]),Ce=l.useCallback(i=>{i.api.sizeColumnsToFit()},[]),W=xe||J||(f?.size??0)>0,z=l.useCallback(i=>!!i&&!!m?.has(E(i)),[m,E]),$=l.useCallback((i,x,L)=>Q?t.jsx(Qe,{trigger:[C.DropdownTrigger.ContextMenu],items:i.data?M.current.getContextMenuItems?.(i.data)??[]:[],anchorToMouse:!0,matchReferenceWidth:!0,className:g.mergeClasses("size-full",L&&"cursor-not-allowed opacity-75"),disabled:L&&!se,children:t.jsx("span",{className:"block min-w-0 max-w-full flex-1",children:x})}):x,[Q,se]),ee=l.useCallback(i=>{if(!i.data)return null;const x=z(i.data);return $(i,t.jsx(ge,{text:i.value==null?"":String(i.value),className:"max-w-full dial-small-text text-primary",hideTooltip:x}),x)},[z,$]),q=l.useCallback(i=>i===F.API||i===F.ROW_DATA_CHANGED,[]),be=l.useMemo(()=>C.debounceFn(i=>{const L=(i.selectedNodes??[]).map(Be=>Be.data),ne=new Set(L.map(E));w.current=ne,H.current=i.source,!q(i.source)&&M.current.onSelectionChange?.(ne,L)},Kt),[q,E]),te=l.useMemo(()=>{if(R)return{...Vt,colId:ot,headerName:"",headerClass:Gt,cellClass:Mt,headerComponent:R===C.GridSelectionMode.MULTIPLE?Wt:void 0,headerComponentParams:{label:Y},cellRenderer:i=>{if(!i.data)return null;const x=E(i.data);return t.jsx(Ht,{params:i,mode:R,rowId:x,radioName:oe,label:M.current.selectRowLabel?.(i.data)??"Select row",disabled:m?.has(x)})}}},[R,Y,E,m,oe]),V=l.useCallback(i=>{if(!i.cellRenderer)return{...i,cellRenderer:ee};const x=M.current.wrapCustomCellRenderers;if(!(typeof x=="function"?x(i):!!x))return i;const ne=i.cellRenderer;return{...i,cellRenderer:ie=>{const at=z(ie.data),Oe=typeof ne=="function"?ne:void 0,lt=Oe?t.jsx(Oe,{...ie}):ee(ie);return $(ie,lt,at)}}},[z,ee,$]),Se=l.useMemo(()=>{const i=ae?(e??[]).map(V):e??[];return te?[te,...i]:i},[e,ae,V,te]),{defaultColDef:le,rowSelection:X,...ce}=n??{},Ne=l.useMemo(()=>({minWidth:Ut,resizable:!0,sortable:!0,floatingFilter:!0,filter:"agTextColumnFilter",filterParams:{filterPlaceholder:A,buttons:["reset"]},comparator:C.baseColumnComparator,...C.omitUndefined(le)}),[A,le]),Ee=i=>{i.api.sizeColumnsToFit(),he(i.api),n?.onGridReady?.(i),h?.(i.api)};l.useEffect(()=>{I&&r&&I.setGridOption("rowData",r)},[I,r]);const o=l.useCallback(()=>t.jsx(tt,{live:!0,title:j,description:v,icon:_??t.jsx(P.IconZoomCancel,{size:100,stroke:.5,"aria-hidden":"true"})}),[j,v,_]),b=typeof X=="object"?X:void 0,k=l.useMemo(()=>R?{isRowSelectable:i=>!z(i.data),...b,mode:R===C.GridSelectionMode.SINGLE?"singleRow":"multiRow",checkboxes:!1,headerCheckbox:!1}:X,[X,b,z,R]);l.useEffect(()=>{I&&r&&w.current.size&&w.current.forEach(i=>{const x=I.getRowNode(i);x&&!x.isSelected()&&x.setSelected(!0,!1,F.API)})},[I,r]),l.useEffect(()=>{I&&f&&(I.deselectAll("all",F.API),f.forEach(i=>{const x=I.getRowNode(i);x&&!x.isSelected()&&x.setSelected(!0,!1,F.API)}))},[I,f]);const B=l.useCallback(i=>i.data?E(i.data):"",[E]);return l.useEffect(()=>{const i=q(H.current);if(I&&f?.size&&i){const x=Array.from(f)[0];if(x){const L=I.getRowNode(x);L&&I.ensureNodeVisible(L)}}},[I,q,f]),t.jsx("div",{className:g.mergeClasses(nt,"size-full",R&&Lt,R&&W&&zt,U&&Ft,u),role:"region","aria-label":d,"aria-busy":D,children:t.jsx("div",{className:"h-full overflow-x-auto",children:t.jsx(C.AgGridReact,{rowModelType:"clientSide",headerHeight:ve,rowHeight:ve,cellSelection:!1,theme:G,autoSizeStrategy:{type:"fitGridWidth"},columnDefs:Se,defaultColDef:Ne,onGridSizeChanged:Ce,onGridReady:Ee,loading:D,suppressCellFocus:!0,suppressDragLeaveHidesColumns:!0,noRowsOverlayComponent:o,rowData:r,rowSelection:k,onSelectionChanged:be,getRowId:B,...ce})})})},qt=({value:e,locale:r=rt,options:n=st,emptyPlaceholder:s,className:u,hideTooltip:d=!1})=>{const a=C.convertToDate(e),m=l.useMemo(()=>a?new Intl.DateTimeFormat(r,n).format(a):s,[a,s,r,n]),f=a?a.toISOString():void 0;return t.jsx(ge,{text:f?t.jsx("time",{dateTime:f,children:m}):t.jsx("span",{children:m}),className:g.mergeClasses("dial-small-text text-primary",u),hideTooltip:d})};exports.Checkbox=De;exports.CheckboxBox=je;exports.CloseButton=Ke;exports.DEFAULT_DATE_FORMAT_OPTIONS=st;exports.DEFAULT_LOCALE=rt;exports.DangerIconButton=Ct;exports.DateCellRenderer=qt;exports.Dropdown=Qe;exports.EllipsisTooltip=ge;exports.GRID_ALIGN_RIGHT_CLASS=Pt;exports.GRID_ROOT_CLASS=nt;exports.GRID_SELECTION_COLUMN_ID=ot;exports.GRID_THEME_PARAMS=ue;exports.GhostIconButton=Ue;exports.Grid=$t;exports.IconButton=pe;exports.InfoButton=We;exports.Label=Te;exports.MenuItem=de;exports.MenuItemMark=T;exports.NeutralIconButton=xt;exports.NoDataContent=tt;exports.PrimaryIconButton=ht;exports.ROW_HEIGHT=ve;exports.Radio=et;exports.StaticIconButton=bt;exports.Tooltip=Pe;exports.TooltipContainer=Re;exports.TooltipContent=Ae;exports.TooltipPlacement=ke;exports.TooltipTrigger=we;exports.getButtonClassNames=He;exports.overlayGap=Ye;exports.overlayItemClassName=Xe;exports.overlaySubMenuClassName=qe;
@@ -2,10 +2,15 @@ const o = "h-full w-full", e = ".ag-checkbox-input", t = {
2
2
  accentColor: "var(--bg-control-accent, var(--bg-accent-primary, #5C8DEA))",
3
3
  backgroundColor: "var(--bg-layer-raised, var(--bg-layer-3, #FCFCFC))",
4
4
  oddRowBackgroundColor: "var(--bg-layer-sunken, var(--bg-layer-2, #EEF1F7))",
5
- selectedRowBackgroundColor: "var(--controls-bg-accent-primary-alpha-active, var(--bg-accent-primary-alpha, #7DA4FF26))",
5
+ // The row tint has to stay translucent: the row it paints carries body text
6
+ // and a checkbox filled with `accentColor`, so an opaque accent hides both.
7
+ // `--bg-accent-primary-alpha` is the tint every other 1.0 control hovers
8
+ // with; the controls' `*-alpha-active` token this used to read is the
9
+ // pressed-state fill, which themes do define opaque.
10
+ selectedRowBackgroundColor: "var(--bg-accent-primary-alpha, #7DA4FF26)",
6
11
  borderColor: "var(--bg-layer-4, #D1DBEA)",
7
12
  rowBorder: "1px solid var(--stroke-tertiary, var(--stroke-primary, #6B7280))",
8
- rowHoverColor: "var(--controls-bg-accent-primary-alpha-active, var(--bg-accent-primary-alpha, #7DA4FF26))",
13
+ rowHoverColor: "var(--bg-accent-primary-alpha, #7DA4FF26)",
9
14
  borderRadius: 3,
10
15
  browserColorScheme: "dark",
11
16
  chromeBackgroundColor: "var(--bg-layer-1, #E0E6F0)",
@@ -1,103 +1,104 @@
1
- import { jsxs as D, Fragment as b, jsx as n } from "react/jsx-runtime";
2
- import { useFloating as pe, autoUpdate as me, offset as he, autoPlacement as ye, flip as xe, shift as be, size as we, useClick as ge, useHover as Ce, useDismiss as ke, useRole as ve, useInteractions as Ne, FloatingPortal as De, FloatingFocusManager as Ee } from "@floating-ui/react";
3
- import { useState as _, useRef as Pe, useCallback as h, useId as Ie, useEffect as $, useMemo as Ae } from "react";
4
- import { DialIcon as Me } from "../../Icon/Icon.js";
5
- import { DropdownTrigger as w, DropdownItemType as W } from "../../../types/dropdown.js";
6
- import { dropdownGap as g, dropdownDividerClassName as Oe, dropdownItemDangerClassName as Fe, dropdownItemDisabledClassName as Se, dropdownItemSelectedClassName as Re, dropdownItemBaseClassName as Be, dropdownBaseClassName as Le, dropdownListBaseClassName as Te } from "./constants.js";
7
- import { CloseButton as Ye } from "../CloseButton/CloseButton.js";
8
- import { CheckboxBox as _e } from "../Checkbox/CheckboxBox.js";
9
- import { useThemeScope as $e } from "../ThemeScope/ThemeScope.js";
10
- import { mergeClasses as d } from "../../../utils/merge-classes.js";
11
- import { DropdownSubMenuItem as We } from "./DropdownSubMenuItem.js";
12
- const je = '[role="menuitem"], [role="menuitemcheckbox"], [role="option"]', Ke = (r) => !r.hasAttribute("disabled") && r.getAttribute("aria-disabled") !== "true", Ue = ["ArrowDown", "ArrowUp", "Home", "End"], Ve = (r, u, f) => {
1
+ import { jsxs as A, Fragment as E, jsx as s } from "react/jsx-runtime";
2
+ import { useFloating as pe, autoUpdate as me, offset as he, autoPlacement as ye, flip as ge, shift as we, size as xe, useClick as ve, useHover as ke, useDismiss as be, useRole as Ce, useInteractions as Ee, FloatingPortal as Pe, FloatingFocusManager as Me } from "@floating-ui/react";
3
+ import { useState as _, useRef as De, useCallback as m, useId as Ae, useEffect as $, useMemo as Ie } from "react";
4
+ import { DropdownTrigger as g, DropdownItemType as W } from "../../../types/dropdown.js";
5
+ import { MenuItemMark as Ne } from "../../../types/menu-item.js";
6
+ import { dropdownGap as w, dropdownDividerClassName as Oe, dropdownBaseClassName as Fe, dropdownListBaseClassName as Re } from "./constants.js";
7
+ import { CloseButton as Se } from "../CloseButton/CloseButton.js";
8
+ import { MenuItem as Le } from "../MenuItem/MenuItem.js";
9
+ import { useThemeScope as Be } from "../ThemeScope/ThemeScope.js";
10
+ import { mergeClasses as x } from "../../../utils/merge-classes.js";
11
+ import { DropdownSubMenuItem as Te } from "./DropdownSubMenuItem.js";
12
+ import { resolveItemMark as Ye, getItemRole as _e } from "./item-mark.js";
13
+ const $e = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]', We = (r) => !r.hasAttribute("disabled") && r.getAttribute("aria-disabled") !== "true", je = ["ArrowDown", "ArrowUp", "Home", "End"], Ke = (r, u, d) => {
13
14
  if (r === "Home") return 0;
14
- if (r === "End") return f - 1;
15
+ if (r === "End") return d - 1;
15
16
  const a = r === "ArrowDown" ? 1 : -1;
16
- return u === -1 ? a === 1 ? 0 : f - 1 : (u + a + f) % f;
17
- }, Xe = (r) => "clientWidth" in r ? r.clientWidth : r.getBoundingClientRect?.()?.width ?? 0, rt = ({
17
+ return u === -1 ? a === 1 ? 0 : d - 1 : (u + a + d) % d;
18
+ }, Ue = (r) => "clientWidth" in r ? r.clientWidth : r.getBoundingClientRect?.()?.width ?? 0, ot = ({
18
19
  children: r,
19
20
  items: u,
20
- onItemClick: f,
21
+ onItemClick: d,
21
22
  menuHeader: a,
22
- menuFooter: y,
23
- renderOverlay: E,
24
- trigger: p = [w.Click],
25
- placement: A,
26
- disabled: c = !1,
27
- open: M,
23
+ menuFooter: h,
24
+ renderOverlay: P,
25
+ trigger: f = [g.Click],
26
+ placement: I,
27
+ disabled: i = !1,
28
+ open: N,
28
29
  defaultOpen: j = !1,
29
30
  onOpenChange: O,
30
31
  closable: K = !1,
31
32
  onClose: U,
32
33
  className: V,
33
34
  overlayContentClassName: F,
34
- separatorClassName: S,
35
+ separatorClassName: R,
35
36
  listClassName: X,
36
- outsidePressIgnoreRef: R,
37
+ outsidePressIgnoreRef: S,
37
38
  outsideClosable: q = !0,
38
39
  allowedPlacements: z,
39
- anchorToMouse: C = !1,
40
- matchReferenceWidth: P = !0,
41
- maxDropdownHeight: B
40
+ anchorToMouse: v = !1,
41
+ matchReferenceWidth: M = !0,
42
+ maxDropdownHeight: L
42
43
  }) => {
43
- const G = $e(), [J, Q] = _(j), I = M !== void 0, i = I ? !!M : J, k = Pe(null), [Z, H] = _(!0), o = h(
44
- (e, t, s) => {
45
- e && H(s !== "hover" && s !== "safe-polygon"), I || Q(e), O?.(e);
44
+ const G = Be(), [H, J] = _(j), D = N !== void 0, c = D ? !!N : H, k = De(null), [Q, Z] = _(!0), n = m(
45
+ (e, t, o) => {
46
+ e && Z(o !== "hover" && o !== "safe-polygon"), D || J(e), O?.(e);
46
47
  },
47
- [I, O]
48
- ), L = Ie(), ee = A === void 0, { refs: m, floatingStyles: te, context: x } = pe({
49
- placement: A,
50
- open: i,
51
- onOpenChange: o,
48
+ [D, O]
49
+ ), B = Ae(), ee = I === void 0, { refs: p, floatingStyles: te, context: y } = pe({
50
+ placement: I,
51
+ open: c,
52
+ onOpenChange: n,
52
53
  whileElementsMounted: me,
53
54
  middleware: [
54
- he({ mainAxis: g, crossAxis: 0 }),
55
+ he({ mainAxis: w, crossAxis: 0 }),
55
56
  ee ? ye({
56
57
  alignment: "start",
57
58
  crossAxis: !0,
58
- padding: g,
59
+ padding: w,
59
60
  allowedPlacements: z
60
- }) : xe({ padding: g }),
61
- be({ padding: g }),
62
- we({
63
- padding: g,
64
- apply({ availableWidth: e, availableHeight: t, elements: s }) {
65
- const l = s.floating, N = Xe(s.reference);
61
+ }) : ge({ padding: w }),
62
+ we({ padding: w }),
63
+ xe({
64
+ padding: w,
65
+ apply({ availableWidth: e, availableHeight: t, elements: o }) {
66
+ const l = o.floating, C = Ue(o.reference);
66
67
  l.style.setProperty(
67
68
  "--fui-available-height",
68
69
  `${Math.floor(t)}px`
69
70
  ), l.style.setProperty(
70
71
  "--reference-width",
71
- P ? `${Math.round(N)}px` : "0px"
72
- ), P ? l.style.minWidth = `${Math.round(N)}px` : l.style.removeProperty("min-width"), l.style.maxWidth = `${Math.floor(e)}px`;
72
+ M ? `${Math.round(C)}px` : "0px"
73
+ ), M ? l.style.minWidth = `${Math.round(C)}px` : l.style.removeProperty("min-width"), l.style.maxWidth = `${Math.floor(e)}px`;
73
74
  const Y = Math.floor(t);
74
- l.style.maxHeight = `${B ? Math.min(Y, B) : Y}px`;
75
+ l.style.maxHeight = `${L ? Math.min(Y, L) : Y}px`;
75
76
  }
76
77
  })
77
78
  ]
78
- }), ne = ge(x, {
79
- enabled: p.includes(w.Click) && !c
80
- }), oe = Ce(x, {
81
- enabled: p.includes(w.Hover) && !c,
79
+ }), ne = ve(y, {
80
+ enabled: f.includes(g.Click) && !i
81
+ }), oe = ke(y, {
82
+ enabled: f.includes(g.Hover) && !i,
82
83
  move: !1,
83
84
  restMs: 40,
84
85
  delay: { open: 80, close: 80 }
85
- }), re = ke(x, {
86
+ }), re = be(y, {
86
87
  bubbles: !0,
87
88
  referencePress: !1,
88
89
  outsidePress: (e) => {
89
90
  if (!q) return !1;
90
91
  const t = e.target;
91
- return !(R?.current && t instanceof Node && R.current.contains(t));
92
+ return !(S?.current && t instanceof Node && S.current.contains(t));
92
93
  }
93
- }), se = ve(x, { role: "menu" }), { getReferenceProps: le, getFloatingProps: ce } = Ne([
94
+ }), se = Ce(y, { role: "menu" }), { getReferenceProps: le, getFloatingProps: ie } = Ee([
94
95
  ne,
95
96
  oe,
96
97
  re,
97
98
  se
98
- ]), v = h(
99
+ ]), b = m(
99
100
  (e, t) => {
100
- m.setPositionReference({
101
+ p.setPositionReference({
101
102
  getBoundingClientRect: () => ({
102
103
  width: 0,
103
104
  height: 0,
@@ -110,207 +111,187 @@ const je = '[role="menuitem"], [role="menuitemcheckbox"], [role="option"]', Ke =
110
111
  })
111
112
  });
112
113
  },
113
- [m]
114
- ), ie = h(
114
+ [p]
115
+ ), ce = m(
115
116
  (e) => {
116
- !p.includes(w.ContextMenu) || c || (e.preventDefault(), C && (v(e.clientX, e.clientY), k.current = document.elementFromPoint(
117
+ !f.includes(g.ContextMenu) || i || (e.preventDefault(), v && (b(e.clientX, e.clientY), k.current = document.elementFromPoint(
117
118
  e.clientX,
118
119
  e.clientY
119
- )), o(!0));
120
+ )), n(!0));
120
121
  },
121
- [C, c, o, v, p]
122
- ), ae = h(
122
+ [v, i, n, b, f]
123
+ ), ae = m(
123
124
  (e) => {
124
- !C || c || (p.includes(w.ContextMenu) && i && o(!1), v(e.clientX, e.clientY), k.current = document.elementFromPoint(
125
+ !v || i || (f.includes(g.ContextMenu) && c && n(!1), b(e.clientX, e.clientY), k.current = document.elementFromPoint(
125
126
  e.clientX,
126
127
  e.clientY
127
128
  ));
128
129
  },
129
- [C, c, v, i, p, o]
130
+ [v, i, b, c, f, n]
130
131
  );
131
132
  $(() => {
132
- c && i && o(!1);
133
- }, [c, i, o]);
134
- const de = h(
133
+ i && c && n(!1);
134
+ }, [i, c, n]);
135
+ const ue = m(
135
136
  (e) => {
136
- if (e.defaultPrevented || !Ue.includes(e.key)) return;
137
+ if (e.defaultPrevented || !je.includes(e.key)) return;
137
138
  const t = Array.from(
138
139
  e.currentTarget.querySelectorAll(
139
- je
140
+ $e
140
141
  )
141
- ).filter(Ke);
142
+ ).filter(We);
142
143
  if (t.length === 0) return;
143
144
  e.preventDefault();
144
- const s = e.currentTarget.ownerDocument.activeElement, l = t.findIndex((N) => N === s);
145
- t[Ve(e.key, l, t.length)]?.focus();
145
+ const o = e.currentTarget.ownerDocument.activeElement, l = t.findIndex((C) => C === o);
146
+ t[Ke(e.key, l, t.length)]?.focus();
146
147
  },
147
148
  []
148
- ), T = h(
149
+ ), T = m(
149
150
  (e) => (t) => {
150
- e.disabled || (e.onClick?.({ key: e.key, domEvent: t }), f?.({ key: e.key, domEvent: t }), e.selectable || o(!1));
151
+ e.disabled || (e.onClick?.({ key: e.key, domEvent: t }), d?.({ key: e.key, domEvent: t }), e.selectable || n(!1));
151
152
  },
152
- [f, o]
153
- ), ue = Ae(() => E ? E() : u ? /* @__PURE__ */ D(b, { children: [
154
- a && /* @__PURE__ */ n(b, { children: typeof a == "function" ? a() : a }),
155
- /* @__PURE__ */ n(
153
+ [d, n]
154
+ ), de = Ie(() => P ? P() : u ? /* @__PURE__ */ A(E, { children: [
155
+ a && /* @__PURE__ */ s(E, { children: typeof a == "function" ? a() : a }),
156
+ /* @__PURE__ */ s(
156
157
  "div",
157
158
  {
158
159
  role: "none",
159
- className: d("py-1", F),
160
+ className: x("py-1", F),
160
161
  "aria-label": "dropdown",
161
- children: u.map((e) => e.type === W.Divider ? /* @__PURE__ */ n(
162
- "div",
163
- {
164
- role: "separator",
165
- className: d(
166
- Oe,
167
- S
168
- )
169
- },
170
- e.key
171
- ) : e.type === W.PlainText ? /* @__PURE__ */ n(
172
- "div",
173
- {
174
- className: d(
175
- "px-3 py-2 text-secondary dial-caption-text",
176
- e.className
177
- ),
178
- children: e.label
179
- },
180
- e.key
181
- ) : e.children?.length ? /* @__PURE__ */ n(
182
- We,
183
- {
184
- item: e,
185
- onRootClose: () => o(!1)
186
- },
187
- e.key
188
- ) : /* @__PURE__ */ n(
189
- "button",
190
- {
191
- role: e.selectable ? "menuitemcheckbox" : "menuitem",
192
- "aria-checked": e.selectable ? !!e.checked : void 0,
193
- type: "button",
194
- "aria-disabled": !!e.disabled,
195
- className: d(
196
- Be,
197
- e.selectable && e.checked && Re,
198
- e.disabled && Se,
199
- e.danger && Fe,
200
- e.className
201
- ),
202
- disabled: e.disabled,
203
- onClick: T(e),
204
- children: e.renderItem ? e.renderItem(e) : /* @__PURE__ */ D(b, { children: [
205
- e.selectable && /* @__PURE__ */ n(
206
- _e,
207
- {
208
- isSelected: !!e.checked,
209
- disabled: e.disabled
210
- }
211
- ),
212
- e.icon && /* @__PURE__ */ n(
213
- "span",
214
- {
215
- className: d(
216
- e.danger && "text-error",
217
- e.disabled && "text-control-disable-primary"
218
- ),
219
- children: /* @__PURE__ */ n(Me, { icon: e.icon })
220
- }
221
- ),
222
- /* @__PURE__ */ n(
223
- "span",
224
- {
225
- className: d(
226
- "flex-1 truncate text-start",
227
- e.danger && "text-error",
228
- e.disabled && "text-control-disable-primary"
229
- ),
230
- children: e.label
231
- }
232
- )
233
- ] })
234
- },
235
- e.key
236
- ))
162
+ children: u.map((e) => {
163
+ if (e.type === W.Divider)
164
+ return /* @__PURE__ */ s(
165
+ "div",
166
+ {
167
+ role: "separator",
168
+ className: x(
169
+ Oe,
170
+ R
171
+ )
172
+ },
173
+ e.key
174
+ );
175
+ if (e.type === W.PlainText)
176
+ return /* @__PURE__ */ s(
177
+ "div",
178
+ {
179
+ className: x(
180
+ "px-3 py-2 text-secondary dial-caption-text",
181
+ e.className
182
+ ),
183
+ children: e.label
184
+ },
185
+ e.key
186
+ );
187
+ if (e.children?.length)
188
+ return /* @__PURE__ */ s(
189
+ Te,
190
+ {
191
+ item: e,
192
+ onRootClose: () => n(!1)
193
+ },
194
+ e.key
195
+ );
196
+ const t = Ye(e), o = _e(e);
197
+ return /* @__PURE__ */ s(
198
+ Le,
199
+ {
200
+ role: o,
201
+ "aria-checked": o === "menuitem" ? void 0 : !!e.checked,
202
+ "aria-current": t === Ne.Highlight && e.checked ? !0 : void 0,
203
+ "aria-disabled": !!e.disabled,
204
+ disabled: e.disabled,
205
+ mark: t,
206
+ selected: !!e.checked,
207
+ danger: e.danger,
208
+ icon: e.icon,
209
+ label: e.label,
210
+ className: e.className,
211
+ rightControl: e.rightControl,
212
+ onClick: T(e),
213
+ children: e.renderItem?.(e)
214
+ },
215
+ e.key
216
+ );
217
+ })
237
218
  }
238
219
  ),
239
- y && /* @__PURE__ */ n(b, { children: typeof y == "function" ? y() : y })
220
+ h && /* @__PURE__ */ s(E, { children: typeof h == "function" ? h() : h })
240
221
  ] }) : null, [
241
222
  T,
242
223
  u,
243
- y,
224
+ h,
244
225
  a,
245
- E,
246
- o,
226
+ P,
227
+ n,
247
228
  F,
248
- S
229
+ R
249
230
  ]), fe = le({
250
- onContextMenu: ie,
231
+ onContextMenu: ce,
251
232
  onMouseDown: ae
252
233
  });
253
234
  return $(() => {
254
- if (!i) return;
255
- const e = m.reference.current;
235
+ if (!c) return;
236
+ const e = p.reference.current;
256
237
  let t = null;
257
238
  if (e instanceof Element ? t = e : k.current instanceof Element && (t = k.current), !t) return;
258
- const s = new IntersectionObserver(
239
+ const o = new IntersectionObserver(
259
240
  ([l]) => {
260
- l.isIntersecting || o(!1);
241
+ l.isIntersecting || n(!1);
261
242
  },
262
243
  { root: null, threshold: 0 }
263
244
  );
264
- return s.observe(t), () => s.disconnect();
265
- }, [i, m.reference, o]), /* @__PURE__ */ D(b, { children: [
266
- /* @__PURE__ */ n(
245
+ return o.observe(t), () => o.disconnect();
246
+ }, [c, p.reference, n]), /* @__PURE__ */ A(E, { children: [
247
+ /* @__PURE__ */ s(
267
248
  "span",
268
249
  {
269
- ref: m.setReference,
270
- className: d(
271
- Le,
272
- c && "!cursor-not-allowed opacity-75",
250
+ ref: p.setReference,
251
+ className: x(
252
+ Fe,
253
+ i && "!cursor-not-allowed opacity-75",
273
254
  V
274
255
  ),
275
256
  "aria-haspopup": "menu",
276
- "aria-expanded": i,
277
- "aria-controls": L,
257
+ "aria-expanded": c,
258
+ "aria-controls": B,
278
259
  ...fe,
279
260
  children: r
280
261
  }
281
262
  ),
282
- i && /* @__PURE__ */ n(De, { children: /* @__PURE__ */ n(
283
- Ee,
263
+ c && /* @__PURE__ */ s(Pe, { children: /* @__PURE__ */ s(
264
+ Me,
284
265
  {
285
- context: x,
266
+ context: y,
286
267
  modal: !1,
287
- initialFocus: Z ? 0 : -1,
268
+ initialFocus: Q ? 0 : -1,
288
269
  returnFocus: !0,
289
- children: /* @__PURE__ */ D(
270
+ children: /* @__PURE__ */ A(
290
271
  "div",
291
272
  {
292
- id: L,
293
- ref: m.setFloating,
273
+ id: B,
274
+ ref: p.setFloating,
294
275
  style: te,
295
- className: d(
296
- Te,
297
- !P && "w-max",
276
+ className: x(
277
+ Re,
278
+ !M && "w-max",
298
279
  "overflow-auto",
299
280
  G,
300
281
  X
301
282
  ),
302
- ...ce({ onKeyDown: de }),
283
+ ...ie({ onKeyDown: ue }),
303
284
  children: [
304
- K && /* @__PURE__ */ n("div", { className: "flex items-center justify-between px-2 pt-2", children: /* @__PURE__ */ n(
305
- Ye,
285
+ K && /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-2 pt-2", children: /* @__PURE__ */ s(
286
+ Se,
306
287
  {
307
288
  ariaLabel: "Close dropdown",
308
289
  onClose: (e) => {
309
- U?.(e), o(!1);
290
+ U?.(e), n(!1);
310
291
  }
311
292
  }
312
293
  ) }),
313
- ue
294
+ de
314
295
  ]
315
296
  }
316
297
  )
@@ -319,5 +300,5 @@ const je = '[role="menuitem"], [role="menuitemcheckbox"], [role="option"]', Ke =
319
300
  ] });
320
301
  };
321
302
  export {
322
- rt as Dropdown
303
+ ot as Dropdown
323
304
  };