@yahoo/uds 3.25.1 → 3.25.2

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.
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var e=require("../chunk-J3PI3MDO.cjs"),r=require("../chunk-VJTVQTQR.cjs"),a=require("../chunk-NSWOPWQR.cjs"),t=require("../chunk-PPKNIQYI.cjs"),d=require("../chunk-OGHG2IRY.cjs"),s=require("../chunk-NUEZVMWZ.cjs"),n=require("@ariakit/react/menu"),i=require("react"),c=require("use-sync-external-store/shim/index.js"),u=require("@yahoo/uds/fixtures"),o=require("motion/react"),l=require("react/jsx-runtime"),x=require("@ariakit/react");function m(e){return e&&e.__esModule?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(a){if("default"!==a){var t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,t.get?t:{enumerable:!0,get:function(){return e[a]}})}}),r.default=e,Object.freeze(r)}var b=p(i),f=m(c);function h(e){return e}function _(e,r){const a=e.__unstableInternals;return function(e,r){if(!e)throw new Error(r)}(a,"Invalid store"),a[r]}var{useSyncExternalStore:v}=f.default;function g(e,r=h){const a=b.useCallback(r=>e?function(e,...r){if(e)return _(e,"subscribe")(...r)}(e,null,r):()=>{},[e]),t=()=>{const a="string"==typeof r?r:null,t="function"==typeof r?r:null,d=null==e?void 0:e.getState();if(t)return t(d);/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */
3
- var s,n;if(d&&(a&&(s=d,n=a,"function"==typeof Object.hasOwn?Object.hasOwn(s,n):Object.prototype.hasOwnProperty.call(s,n))))return d[a]};return v(a,t,t)}var I=o.m.create(a.VStack),y=5,S=.97,w={top:{x:0,y:y},bottom:{x:0,y:-5},left:{x:y,y:0},right:{x:-5,y:0}},j=e=>i.useMemo(()=>((e="bottom")=>{const[r="top"]=e?.split("-");return{closed:{...w[r],opacity:0,scale:S},open:{y:0,x:0,opacity:1,scale:1}}})(e),[e]),C=i.forwardRef(function({gap:e,spacing:r,spacingBottom:a,spacingEnd:t,spacingStart:s,spacingTop:c,gutter:x="1",backgroundColor:m="primary",borderRadius:p="md",borderColor:b,borderWidth:f="thin",overflow:h,dropShadow:_="lg",className:v,sameWidth:y,focusable:S,children:w,portalElement:C,portal:k=!0,disableAutoBorderRadius:N,...M},V){const E=n.useMenuContext(),R=g(E,"open"),P=g(E,"mounted"),O=g(E,"currentPlacement"),q=g(E,"placement"),[z,T]=i.useState(O),[A,B]=i.useState(O);i.useEffect(()=>{q!==A&&B(q)},[q]),i.useEffect(()=>{O!==A&&B(O)},[O]),i.useEffect(()=>{P&&A!==z&&T(A)},[P,A,z]);const D=i.useMemo(()=>R&&P?"open":"closed",[R,P]),H=i.useMemo(()=>R?_:"none",[R,_]),W=j(A),G=(({borderRadius:e,spacing:r})=>{if(void 0===r||"0"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))]";case"sm":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))]";case"md":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))]";case"lg":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))]"}if("px"===r||"0.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_2px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))]"}if("1"===r||"1.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_4px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_4px)]"}if("2"===r||"2.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_8px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_8px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_8px)]"}if("3"===r||"3.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))]";case"md":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-md)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-md)_-_6px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))] [&>*:last-child]:rounded-b-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))]"}if("4"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_16px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_16px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))]"}switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))] [&>*:last-child]:rounded-b-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))]"}})({borderRadius:p,spacing:r}),$=i.useMemo(()=>u.spacingMap[x],[x]);return l.jsx(o.AnimatePresence,{initial:!1,children:l.jsx(n.Menu,{gutter:$,sameWidth:y,focusable:S,store:E,ref:V,portalElement:C,portal:k,...M,render:l.jsx(I,{backgroundColor:m,gap:e,spacing:r,spacingBottom:a,spacingEnd:t,spacingStart:s,spacingTop:c,borderRadius:p,borderColor:b,borderWidth:f,overflow:h,animate:D,variants:W,dropShadow:H,className:d.cx("uds-menu-content","transition-shadow","duration-200","ease-in-out","min-w-60","max-w-lg","max-h-96","overflow-auto","uds-ring","z-10","group",!N&&G,v),children:w})})})}),k=i.forwardRef(function({role:r="separator",contentPosition:a="start",gap:t="4",children:s,spacingVertical:n=(s?"2":"0"),spacingHorizontal:i=(s?"4":"0"),className:c,...u},o){const x={root:d.getStyles({menuDividerVariantRoot:"default",className:c}),text:d.getStyles({menuDividerVariantText:"default"}),line:d.getStyles({menuDividerVariantLine:"default"})};return l.jsx(e.DividerInternal,{ref:o,role:r,variant:"inherit",contentPosition:a,gap:t,spacingVertical:n,spacingHorizontal:i,className:x.root,layerClassNames:x,...u,children:s})});k.displayName="MenuDivider";var N={};s.__export(N,{Content:()=>C,Divider:()=>k,Item:()=>R,ItemCheckbox:()=>P,Provider:()=>z,Trigger:()=>T,useMenuContext:()=>n.useMenuContext,useMenuStore:()=>n.useMenuStore,useStoreState:()=>x.useStoreState});var M="uds-menu-item",V={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},E=i.forwardRef(function({spacing:e="0",spacingBottom:t,spacingEnd:s,spacingHorizontal:n="4",spacingStart:c,spacingTop:u,spacingVertical:x="3.5",columnGap:m="2",className:p,children:b,endIcon:f,startIcon:h,hideEndIcon:_,active:v,disabled:g,as:I,rootProps:y,name:S,alignItems:w="center",justifyContent:j="space-between",layerClassNames:C,...k},N){const E=i.Children.count(b)>1,R=(({active:e,disabled:r,className:a})=>d.cx(M,"focus-visible:text-brand","focus-visible:bg-brand-secondary","focus-visible:z-10","uds-ring","!-outline-offset-2",e&&["[&:not([aria-checked])]:cursor-default"],r&&"opacity-25 cursor-not-allowed","duration-20 transition-[font-variation-settings] ease-in-out","z-0",a))({active:v,disabled:g,className:p}),P=d.getStyles({className:d.cx(`${M}-content truncate`,C?.text),textAlign:"start",...E&&{columnGap:m,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),O=i.useMemo(()=>({root:d.getStyles({menuSizeRoot:"default",className:d.cx(C?.root,R)}),startIcon:d.getStyles({menuSizeStartIcon:"default",className:C?.startIcon}),endIcon:d.getStyles({menuSizeEndIcon:"default",className:C?.endIcon})}),[C,R]);return l.jsx(d.Box,{asChild:!0,spacing:e,spacingBottom:t,spacingEnd:s,spacingHorizontal:n,spacingStart:c,spacingTop:u,spacingVertical:x,columnGap:m,className:O.root,alignItems:w,justifyContent:j,children:l.jsxs(I,{render:l.jsx(r.Pressable,{ref:N,...k}),name:S??"",disabled:g,...y,children:[l.jsxs(a.HStack,{gap:m,alignItems:"center",width:"full",children:[l.jsx(o.AnimatePresence,{initial:!1,children:h&&l.jsx(o.m.span,{variants:V,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:l.jsx(d.IconSlot,{icon:h,className:O.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),l.jsx("span",{className:P,children:b})]}),l.jsx(o.AnimatePresence,{initial:!1,mode:"popLayout",children:!_&&f&&l.jsx(o.m.span,{variants:V,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:l.jsx(d.IconSlot,{icon:f,className:O.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),R=i.forwardRef(function({active:e,...r},a){const t={root:d.getStyles({menuItemVariantRoot:"default",menuItemVariantActiveRoot:e?"on":"off"}),text:d.getStyles({menuItemVariantText:"default",menuItemVariantActiveText:e?"on":"off"}),startIcon:d.getStyles({menuItemVariantIcon:"default",menuItemVariantActiveIcon:e?"on":"off"})};return l.jsx(E,{ref:a,as:n.MenuItem,active:e,layerClassNames:t,...r})});R.displayName="MenuItem";var P=i.forwardRef(function({name:e,endIcon:a=r.e,checked:t,defaultChecked:s,className:c,...u},o){const m=e,p=i.useRef(!1),b=n.useMenuContext(),f=x.useStoreState(b);i.useEffect(()=>{!p.current&&void 0!==s&&b&&(b.setValues(e=>({...e,[m]:s})),p.current=!0)},[b,s,m]);const h=i.useMemo(()=>{if(void 0!==t)return t;if(f?.items?.length){const e=f?.items.find(e=>e.element?.name===m);if(e?.element)return e.element.checked}const e=f?.values[m];return"boolean"==typeof e?e:s??!1},[f?.items,f?.values,m,t,s]),_=i.useCallback(e=>{void 0===t&&b?.setValues(r=>({...r,[m]:e.target.checked}))},[m,b,t]),v={root:d.getStyles({menuItemCheckboxVariantRoot:"default",menuItemCheckboxVariantActiveRoot:h?"on":"off"}),text:d.getStyles({menuItemCheckboxVariantText:"default",menuItemCheckboxVariantActiveText:h?"on":"off"}),startIcon:d.getStyles({menuItemCheckboxVariantStartIcon:"default",menuItemCheckboxVariantActiveStartIcon:h?"on":"off"}),endIcon:d.getStyles({menuItemCheckboxVariantEndIcon:"default",menuItemCheckboxVariantActiveEndIcon:h?"on":"off"})};return l.jsx(E,{ref:o,as:n.MenuItemCheckbox,hideEndIcon:!h,endIcon:a,active:h,className:d.cx("uds-menu-item-checkbox",c),layerClassNames:v,rootProps:{name:e,onChange:_,defaultChecked:s,checked:void 0!==t?t:void 0},...u})});P.displayName="MenuItemCheckbox";var O=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},q=e=>{const[r,a]=i.useState(O);return i.useEffect(()=>{if(e?.explicit)return void a(e.explicit);const r=(e=>{const r=new MutationObserver(r=>{r.some(e=>"attributes"===e.type&&"dir"===e.attributeName)&&e()});return r.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),r})(()=>{a(O())});return()=>r.disconnect()},[e?.explicit]),r},z=function({placement:e="bottom",rtl:r,...a}){const d=q({explicit:r}),s=((e,r)=>{const a=r?.rtl;if("start"===e)return a?"right":"left";if("end"===e)return a?"left":"right";if(e?.includes("-")){const[r,t]=e.split("-");if(!("start"!==r&&"end"!==r||"top"!==t&&"bottom"!==t))return`${"start"===r?a?"right":"left":a?"left":"right"}-${"bottom"===t?"end":"start"}`;if("top"===r||"bottom"===r)return`${r}-${"start"===t?a?"end":"start":a?"start":"end"}`}return e})(e,{rtl:d});return l.jsx(t.SpringMotionConfig,{children:l.jsx(n.MenuProvider,{placement:s,rtl:d,...a})})},T=i.forwardRef(function({asChild:e,children:r,className:a,...t},s){const c=i.useRef(null),u=e?{render:l.jsx(d.Box,{asChild:!0,ref:c,className:"uds-ring h-fit w-fit",children:r})}:{children:r},o=i.useCallback(()=>{const e=c.current?.firstChild;e instanceof HTMLElement&&"function"==typeof e.focus&&e.focus()},[c]);return l.jsx(n.MenuButton,{onFocus:o,onFocusVisible:o,ref:s,className:d.cx("uds-menu-trigger",a),...u,...t})});exports.Menu=N;
2
+ "use strict";var e=require("../chunk-J3PI3MDO.cjs"),r=require("../chunk-VJTVQTQR.cjs"),t=require("../chunk-NSWOPWQR.cjs"),a=require("../chunk-PPKNIQYI.cjs"),d=require("../chunk-OGHG2IRY.cjs"),s=require("../chunk-NUEZVMWZ.cjs"),n=require("@ariakit/react/menu"),i=require("react"),c=require("use-sync-external-store/shim/index.js"),o=require("@yahoo/uds/fixtures"),u=require("motion/react"),l=require("react/jsx-runtime"),x=require("@ariakit/react");function m(e){return e&&e.__esModule?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var b=p(i),f=m(c);function h(e){return e}function _(e,r){const t=e.__unstableInternals;return function(e,r){if(!e)throw new Error(r)}(t,"Invalid store"),t[r]}var{useSyncExternalStore:v}=f.default;function g(e,r=h){const t=b.useCallback(r=>e?function(e,...r){if(e)return _(e,"subscribe")(...r)}(e,null,r):()=>{},[e]),a=()=>{const t="string"==typeof r?r:null,a="function"==typeof r?r:null,d=null==e?void 0:e.getState();if(a)return a(d);/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */
3
+ var s,n;if(d&&(t&&(s=d,n=t,"function"==typeof Object.hasOwn?Object.hasOwn(s,n):Object.prototype.hasOwnProperty.call(s,n))))return d[t]};return v(t,a,a)}var I=u.m.create(t.VStack),y=5,S=.97,w={top:{x:0,y:y},bottom:{x:0,y:-5},left:{x:y,y:0},right:{x:-5,y:0}},C=e=>i.useMemo(()=>((e="bottom")=>{const[r="top"]=e?.split("-");return{closed:{...w[r],opacity:0,scale:S},open:{y:0,x:0,opacity:1,scale:1}}})(e),[e]),j=i.forwardRef(function({gap:e,spacing:r,spacingBottom:t,spacingEnd:a,spacingStart:s,spacingTop:c,gutter:x="1",backgroundColor:m="primary",borderRadius:p="md",borderColor:b,borderWidth:f="thin",overflow:h,dropShadow:_="lg",className:v,sameWidth:y,focusable:S,children:w,portalElement:j,portal:k=!0,disableAutoBorderRadius:N,...M},V){const E=n.useMenuContext(),R=g(E,"open"),P=g(E,"mounted"),O=g(E,"currentPlacement"),q=g(E,"placement"),[z,T]=i.useState(O),[A,B]=i.useState(O);i.useEffect(()=>{q!==A&&B(q)},[q]),i.useEffect(()=>{O!==A&&B(O)},[O]),i.useEffect(()=>{P&&A!==z&&T(A)},[P,A,z]);const D=i.useMemo(()=>R&&P?"open":"closed",[R,P]),H=i.useMemo(()=>R?_:"none",[R,_]),W=C(A),G=(({borderRadius:e,spacing:r})=>{if(void 0===r||"0"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))]";case"sm":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))]";case"md":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))]";case"lg":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))]"}if("px"===r||"0.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_2px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))]"}if("1"===r||"1.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_4px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_4px)]"}if("2"===r||"2.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_8px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_8px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_8px)]"}if("3"===r||"3.5"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))]";case"md":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-md)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-md)_-_6px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))] [&>*:last-child]:rounded-b-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))]"}if("4"===r)switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_16px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_16px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))]"}switch(e){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))] [&>*:last-child]:rounded-b-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))]"}})({borderRadius:p,spacing:r}),$=i.useMemo(()=>o.spacingMap[x],[x]);return l.jsx(u.AnimatePresence,{initial:!1,children:l.jsx(n.Menu,{gutter:$,sameWidth:y,focusable:S,store:E,ref:V,portalElement:j,portal:k,...M,render:l.jsx(I,{backgroundColor:m,gap:e,spacing:r,spacingBottom:t,spacingEnd:a,spacingStart:s,spacingTop:c,borderRadius:p,borderColor:b,borderWidth:f,overflow:h,animate:D,variants:W,dropShadow:H,className:d.cx("uds-menu-content","transition-shadow","duration-200","ease-in-out","min-w-60","max-w-lg","max-h-96","overflow-auto","uds-ring","z-10","group",!N&&G,v),children:w})})})}),k=i.forwardRef(function({role:r="separator",contentPosition:t="start",gap:a="4",children:s,spacingVertical:n=(s?"2":"0"),spacingHorizontal:i=(s?"4":"0"),className:c,...o},u){const x={root:d.getStyles({menuDividerVariantRoot:"default",className:c}),text:d.getStyles({menuDividerVariantText:"default"}),line:d.getStyles({menuDividerVariantLine:"default"})};return l.jsx(e.DividerInternal,{ref:u,role:r,variant:"inherit",contentPosition:t,gap:a,spacingVertical:n,spacingHorizontal:i,className:x.root,layerClassNames:x,...o,children:s})});k.displayName="MenuDivider";var N={};s.__export(N,{Content:()=>j,Divider:()=>k,Item:()=>R,ItemCheckbox:()=>P,Provider:()=>z,Trigger:()=>T,useMenuContext:()=>n.useMenuContext,useMenuStore:()=>n.useMenuStore,useStoreState:()=>x.useStoreState});var M="uds-menu-item",V={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},E=i.forwardRef(function({spacing:e="0",spacingBottom:a,spacingEnd:s,spacingHorizontal:n="4",spacingStart:c,spacingTop:o,spacingVertical:x="3.5",columnGap:m="2",className:p,children:b,endIcon:f,startIcon:h,hideEndIcon:_,active:v,disabled:g,as:I,rootProps:y,name:S,alignItems:w="center",justifyContent:C="space-between",layerClassNames:j,...k},N){const E=i.Children.count(b)>1,R=(({active:e,disabled:r,className:t})=>d.cx(M,"focus-visible:text-brand","focus-visible:bg-brand-secondary","focus-visible:z-10","uds-ring","!-outline-offset-2",e&&["[&:not([aria-checked])]:cursor-default"],r&&"opacity-25 cursor-not-allowed","duration-20 transition-[font-variation-settings] ease-in-out","z-0",t))({active:v,disabled:g,className:p}),P=d.getStyles({className:d.cx(`${M}-content truncate`,j?.text),textAlign:"start",...E&&{columnGap:m,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),O=i.useMemo(()=>({root:d.getStyles({menuSizeRoot:"default",className:d.cx(j?.root,R)}),startIcon:d.getStyles({menuSizeStartIcon:"default",className:j?.startIcon}),endIcon:d.getStyles({menuSizeEndIcon:"default",className:j?.endIcon})}),[j,R]);return l.jsx(d.Box,{asChild:!0,spacing:e,spacingBottom:a,spacingEnd:s,spacingHorizontal:n,spacingStart:c,spacingTop:o,spacingVertical:x,columnGap:m,className:O.root,alignItems:w,justifyContent:C,children:l.jsxs(I,{render:l.jsx(r.Pressable,{ref:N,...k}),name:S??"",disabled:g,...y,children:[l.jsxs(t.HStack,{gap:m,alignItems:"center",width:"full",children:[l.jsx(u.AnimatePresence,{initial:!1,children:h&&l.jsx(u.m.span,{variants:V,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:l.jsx(d.IconSlot,{icon:h,className:O.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),l.jsx("span",{className:P,children:b})]}),l.jsx(u.AnimatePresence,{initial:!1,mode:"popLayout",children:!_&&f&&l.jsx(u.m.span,{variants:V,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:l.jsx(d.IconSlot,{icon:f,className:O.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),R=i.forwardRef(function({active:e,hideOnClick:r,...t},a){const s={root:d.getStyles({menuItemVariantRoot:"default",menuItemVariantActiveRoot:e?"on":"off"}),text:d.getStyles({menuItemVariantText:"default",menuItemVariantActiveText:e?"on":"off"}),startIcon:d.getStyles({menuItemVariantIcon:"default",menuItemVariantActiveIcon:e?"on":"off"})};return l.jsx(E,{ref:a,as:n.MenuItem,active:e,layerClassNames:s,rootProps:{hideOnClick:r},...t})});R.displayName="MenuItem";var P=i.forwardRef(function({name:e,endIcon:t=r.e,checked:a,defaultChecked:s,hideOnClick:c,className:o,...u},m){const p=e,b=i.useRef(!1),f=n.useMenuContext(),h=x.useStoreState(f);i.useEffect(()=>{!b.current&&void 0!==s&&f&&(f.setValues(e=>({...e,[p]:s})),b.current=!0)},[f,s,p]);const _=i.useMemo(()=>{if(void 0!==a)return a;if(h?.items?.length){const e=h?.items.find(e=>e.element?.name===p);if(e?.element)return e.element.checked}const e=h?.values[p];return"boolean"==typeof e?e:s??!1},[h?.items,h?.values,p,a,s]),v=i.useCallback(e=>{void 0===a&&f?.setValues(r=>({...r,[p]:e.target.checked}))},[p,f,a]),g={root:d.getStyles({menuItemCheckboxVariantRoot:"default",menuItemCheckboxVariantActiveRoot:_?"on":"off"}),text:d.getStyles({menuItemCheckboxVariantText:"default",menuItemCheckboxVariantActiveText:_?"on":"off"}),startIcon:d.getStyles({menuItemCheckboxVariantStartIcon:"default",menuItemCheckboxVariantActiveStartIcon:_?"on":"off"}),endIcon:d.getStyles({menuItemCheckboxVariantEndIcon:"default",menuItemCheckboxVariantActiveEndIcon:_?"on":"off"})};return l.jsx(E,{ref:m,as:n.MenuItemCheckbox,hideEndIcon:!_,endIcon:t,active:_,className:d.cx("uds-menu-item-checkbox",o),layerClassNames:g,rootProps:{name:e,onChange:v,defaultChecked:s,checked:void 0!==a?a:void 0,hideOnClick:c},...u})});P.displayName="MenuItemCheckbox";var O=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},q=e=>{const[r,t]=i.useState(O);return i.useEffect(()=>{if(e?.explicit)return void t(e.explicit);const r=(e=>{const r=new MutationObserver(r=>{r.some(e=>"attributes"===e.type&&"dir"===e.attributeName)&&e()});return r.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),r})(()=>{t(O())});return()=>r.disconnect()},[e?.explicit]),r},z=function({placement:e="bottom",rtl:r,...t}){const d=q({explicit:r}),s=((e,r)=>{const t=r?.rtl;if("start"===e)return t?"right":"left";if("end"===e)return t?"left":"right";if(e?.includes("-")){const[r,a]=e.split("-");if(!("start"!==r&&"end"!==r||"top"!==a&&"bottom"!==a))return`${"start"===r?t?"right":"left":t?"left":"right"}-${"bottom"===a?"end":"start"}`;if("top"===r||"bottom"===r)return`${r}-${"start"===a?t?"end":"start":t?"start":"end"}`}return e})(e,{rtl:d});return l.jsx(a.SpringMotionConfig,{children:l.jsx(n.MenuProvider,{placement:s,rtl:d,...t})})},T=i.forwardRef(function({asChild:e,children:r,className:t,...a},s){const c=i.useRef(null),o=e?{render:l.jsx(d.Box,{asChild:!0,ref:c,className:"uds-ring h-fit w-fit",children:r})}:{children:r},u=i.useCallback(()=>{const e=c.current?.firstChild;e instanceof HTMLElement&&"function"==typeof e.focus&&e.focus()},[c]);return l.jsx(n.MenuButton,{onFocus:u,onFocusVisible:u,ref:s,className:d.cx("uds-menu-trigger",t),...o,...a})});exports.Menu=N;
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{DividerInternal as r}from"../chunk-5JTRBHDY.js";import{Pressable as e,e as a}from"../chunk-7NF4SALL.js";import{VStack as d,HStack as t}from"../chunk-ZPJKP4RI.js";import{SpringMotionConfig as s}from"../chunk-RZTLEOVZ.js";import{cx as i,getStyles as n,Box as c,IconSlot as o}from"../chunk-KNDHLLAW.js";import{__export as u}from"../chunk-S5UKKXRV.js";import{useMenuContext as l,Menu as m,useMenuStore as x,MenuItem as p,MenuItemCheckbox as h,MenuProvider as b,MenuButton as f}from"@ariakit/react/menu";import*as _ from"react";import{forwardRef as v,useState as g,useEffect as I,useMemo as w,Children as y,useRef as C,useCallback as N}from"react";import k from"use-sync-external-store/shim/index.js";import{spacingMap as V}from"@yahoo/uds/fixtures";import{m as S,AnimatePresence as E}from"motion/react";import{jsx as R,jsxs as j}from"react/jsx-runtime";import{useStoreState as T}from"@ariakit/react";function z(r){return r}function P(r,e){const a=r.__unstableInternals;return function(r,e){if(!r)throw new Error(e)}(a,"Invalid store"),a[e]}var{useSyncExternalStore:A}=k;function M(r,e=z){const a=_.useCallback(e=>r?function(r,...e){if(r)return P(r,"subscribe")(...e)}(r,null,e):()=>{},[r]),d=()=>{const a="string"==typeof e?e:null,d="function"==typeof e?e:null,t=null==r?void 0:r.getState();if(d)return d(t);/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */
3
- var s,i;if(t&&(a&&(s=t,i=a,"function"==typeof Object.hasOwn?Object.hasOwn(s,i):Object.prototype.hasOwnProperty.call(s,i))))return t[a]};return A(a,d,d)}var L=S.create(d),O=5,D=.97,H={top:{x:0,y:O},bottom:{x:0,y:-5},left:{x:O,y:0},right:{x:-5,y:0}},B=r=>w(()=>((r="bottom")=>{const[e="top"]=r?.split("-");return{closed:{...H[e],opacity:0,scale:D},open:{y:0,x:0,opacity:1,scale:1}}})(r),[r]),W=v(function({gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,gutter:n="1",backgroundColor:c="primary",borderRadius:o="md",borderColor:u,borderWidth:x="thin",overflow:p,dropShadow:h="lg",className:b,sameWidth:f,focusable:_,children:v,portalElement:y,portal:C=!0,disableAutoBorderRadius:N,...k},S){const j=l(),T=M(j,"open"),z=M(j,"mounted"),P=M(j,"currentPlacement"),A=M(j,"placement"),[O,D]=g(P),[H,W]=g(P);I(()=>{A!==H&&W(A)},[A]),I(()=>{P!==H&&W(P)},[P]),I(()=>{z&&H!==O&&D(H)},[z,H,O]);const $=w(()=>T&&z?"open":"closed",[T,z]),F=w(()=>T?h:"none",[T,h]),K=B(H),G=(({borderRadius:r,spacing:e})=>{if(void 0===e||"0"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))]";case"sm":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))]";case"md":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))]";case"lg":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))]"}if("px"===e||"0.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_2px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))]"}if("1"===e||"1.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_4px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_4px)]"}if("2"===e||"2.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_8px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_8px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_8px)]"}if("3"===e||"3.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))]";case"md":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-md)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-md)_-_6px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))] [&>*:last-child]:rounded-b-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))]"}if("4"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_16px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_16px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))]"}switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))] [&>*:last-child]:rounded-b-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))]"}})({borderRadius:o,spacing:e}),Z=w(()=>V[n],[n]);return R(E,{initial:!1,children:R(m,{gutter:Z,sameWidth:f,focusable:_,store:j,ref:S,portalElement:y,portal:C,...k,render:R(L,{backgroundColor:c,gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,borderRadius:o,borderColor:u,borderWidth:x,overflow:p,animate:$,variants:K,dropShadow:F,className:i("uds-menu-content","transition-shadow","duration-200","ease-in-out","min-w-60","max-w-lg","max-h-96","overflow-auto","uds-ring","z-10","group",!N&&G,b),children:v})})})}),$=v(function({role:e="separator",contentPosition:a="start",gap:d="4",children:t,spacingVertical:s=(t?"2":"0"),spacingHorizontal:i=(t?"4":"0"),className:c,...o},u){const l={root:n({menuDividerVariantRoot:"default",className:c}),text:n({menuDividerVariantText:"default"}),line:n({menuDividerVariantLine:"default"})};return R(r,{ref:u,role:e,variant:"inherit",contentPosition:a,gap:d,spacingVertical:s,spacingHorizontal:i,className:l.root,layerClassNames:l,...o,children:t})});$.displayName="MenuDivider";var F={};u(F,{Content:()=>W,Divider:()=>$,Item:()=>J,ItemCheckbox:()=>U,Provider:()=>q,Trigger:()=>Q,useMenuContext:()=>l,useMenuStore:()=>x,useStoreState:()=>T});var K="uds-menu-item",G={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},Z=v(function({spacing:r="0",spacingBottom:a,spacingEnd:d,spacingHorizontal:s="4",spacingStart:u,spacingTop:l,spacingVertical:m="3.5",columnGap:x="2",className:p,children:h,endIcon:b,startIcon:f,hideEndIcon:_,active:v,disabled:g,as:I,rootProps:C,name:N,alignItems:k="center",justifyContent:V="space-between",layerClassNames:T,...z},P){const A=y.count(h)>1,M=(({active:r,disabled:e,className:a})=>i(K,"focus-visible:text-brand","focus-visible:bg-brand-secondary","focus-visible:z-10","uds-ring","!-outline-offset-2",r&&["[&:not([aria-checked])]:cursor-default"],e&&"opacity-25 cursor-not-allowed","duration-20 transition-[font-variation-settings] ease-in-out","z-0",a))({active:v,disabled:g,className:p}),L=n({className:i(`${K}-content truncate`,T?.text),textAlign:"start",...A&&{columnGap:x,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),O=w(()=>({root:n({menuSizeRoot:"default",className:i(T?.root,M)}),startIcon:n({menuSizeStartIcon:"default",className:T?.startIcon}),endIcon:n({menuSizeEndIcon:"default",className:T?.endIcon})}),[T,M]);return R(c,{asChild:!0,spacing:r,spacingBottom:a,spacingEnd:d,spacingHorizontal:s,spacingStart:u,spacingTop:l,spacingVertical:m,columnGap:x,className:O.root,alignItems:k,justifyContent:V,children:j(I,{render:R(e,{ref:P,...z}),name:N??"",disabled:g,...C,children:[j(t,{gap:x,alignItems:"center",width:"full",children:[R(E,{initial:!1,children:f&&R(S.span,{variants:G,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:R(o,{icon:f,className:O.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),R("span",{className:L,children:h})]}),R(E,{initial:!1,mode:"popLayout",children:!_&&b&&R(S.span,{variants:G,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:R(o,{icon:b,className:O.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),J=v(function({active:r,...e},a){const d={root:n({menuItemVariantRoot:"default",menuItemVariantActiveRoot:r?"on":"off"}),text:n({menuItemVariantText:"default",menuItemVariantActiveText:r?"on":"off"}),startIcon:n({menuItemVariantIcon:"default",menuItemVariantActiveIcon:r?"on":"off"})};return R(Z,{ref:a,as:p,active:r,layerClassNames:d,...e})});J.displayName="MenuItem";var U=v(function({name:r,endIcon:e=a,checked:d,defaultChecked:t,className:s,...c},o){const u=r,m=C(!1),x=l(),p=T(x);I(()=>{!m.current&&void 0!==t&&x&&(x.setValues(r=>({...r,[u]:t})),m.current=!0)},[x,t,u]);const b=w(()=>{if(void 0!==d)return d;if(p?.items?.length){const r=p?.items.find(r=>r.element?.name===u);if(r?.element)return r.element.checked}const r=p?.values[u];return"boolean"==typeof r?r:t??!1},[p?.items,p?.values,u,d,t]),f=N(r=>{void 0===d&&x?.setValues(e=>({...e,[u]:r.target.checked}))},[u,x,d]),_={root:n({menuItemCheckboxVariantRoot:"default",menuItemCheckboxVariantActiveRoot:b?"on":"off"}),text:n({menuItemCheckboxVariantText:"default",menuItemCheckboxVariantActiveText:b?"on":"off"}),startIcon:n({menuItemCheckboxVariantStartIcon:"default",menuItemCheckboxVariantActiveStartIcon:b?"on":"off"}),endIcon:n({menuItemCheckboxVariantEndIcon:"default",menuItemCheckboxVariantActiveEndIcon:b?"on":"off"})};return R(Z,{ref:o,as:h,hideEndIcon:!b,endIcon:e,active:b,className:i("uds-menu-item-checkbox",s),layerClassNames:_,rootProps:{name:r,onChange:f,defaultChecked:t,checked:void 0!==d?d:void 0},...c})});U.displayName="MenuItemCheckbox";var X=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},Y=r=>{const[e,a]=g(X);return I(()=>{if(r?.explicit)return void a(r.explicit);const e=(r=>{const e=new MutationObserver(e=>{e.some(r=>"attributes"===r.type&&"dir"===r.attributeName)&&r()});return e.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),e})(()=>{a(X())});return()=>e.disconnect()},[r?.explicit]),e},q=function({placement:r="bottom",rtl:e,...a}){const d=Y({explicit:e}),t=((r,e)=>{const a=e?.rtl;if("start"===r)return a?"right":"left";if("end"===r)return a?"left":"right";if(r?.includes("-")){const[e,d]=r.split("-");if(!("start"!==e&&"end"!==e||"top"!==d&&"bottom"!==d))return`${"start"===e?a?"right":"left":a?"left":"right"}-${"bottom"===d?"end":"start"}`;if("top"===e||"bottom"===e)return`${e}-${"start"===d?a?"end":"start":a?"start":"end"}`}return r})(r,{rtl:d});return R(s,{children:R(b,{placement:t,rtl:d,...a})})},Q=v(function({asChild:r,children:e,className:a,...d},t){const s=C(null),n=r?{render:R(c,{asChild:!0,ref:s,className:"uds-ring h-fit w-fit",children:e})}:{children:e},o=N(()=>{const r=s.current?.firstChild;r instanceof HTMLElement&&"function"==typeof r.focus&&r.focus()},[s]);return R(f,{onFocus:o,onFocusVisible:o,ref:t,className:i("uds-menu-trigger",a),...n,...d})});export{F as Menu};
2
+ import{DividerInternal as r}from"../chunk-5JTRBHDY.js";import{Pressable as e,e as a}from"../chunk-7NF4SALL.js";import{VStack as d,HStack as t}from"../chunk-ZPJKP4RI.js";import{SpringMotionConfig as s}from"../chunk-RZTLEOVZ.js";import{cx as i,getStyles as n,Box as c,IconSlot as o}from"../chunk-KNDHLLAW.js";import{__export as u}from"../chunk-S5UKKXRV.js";import{useMenuContext as l,Menu as m,useMenuStore as x,MenuItem as p,MenuItemCheckbox as h,MenuProvider as b,MenuButton as f}from"@ariakit/react/menu";import*as _ from"react";import{forwardRef as v,useState as g,useEffect as I,useMemo as w,Children as y,useRef as C,useCallback as k}from"react";import N from"use-sync-external-store/shim/index.js";import{spacingMap as V}from"@yahoo/uds/fixtures";import{m as S,AnimatePresence as E}from"motion/react";import{jsx as R,jsxs as j}from"react/jsx-runtime";import{useStoreState as P}from"@ariakit/react";function T(r){return r}function z(r,e){const a=r.__unstableInternals;return function(r,e){if(!r)throw new Error(e)}(a,"Invalid store"),a[e]}var{useSyncExternalStore:O}=N;function A(r,e=T){const a=_.useCallback(e=>r?function(r,...e){if(r)return z(r,"subscribe")(...e)}(r,null,e):()=>{},[r]),d=()=>{const a="string"==typeof e?e:null,d="function"==typeof e?e:null,t=null==r?void 0:r.getState();if(d)return d(t);/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */
3
+ var s,i;if(t&&(a&&(s=t,i=a,"function"==typeof Object.hasOwn?Object.hasOwn(s,i):Object.prototype.hasOwnProperty.call(s,i))))return t[a]};return O(a,d,d)}var M=S.create(d),L=5,D=.97,H={top:{x:0,y:L},bottom:{x:0,y:-5},left:{x:L,y:0},right:{x:-5,y:0}},B=r=>w(()=>((r="bottom")=>{const[e="top"]=r?.split("-");return{closed:{...H[e],opacity:0,scale:D},open:{y:0,x:0,opacity:1,scale:1}}})(r),[r]),W=v(function({gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,gutter:n="1",backgroundColor:c="primary",borderRadius:o="md",borderColor:u,borderWidth:x="thin",overflow:p,dropShadow:h="lg",className:b,sameWidth:f,focusable:_,children:v,portalElement:y,portal:C=!0,disableAutoBorderRadius:k,...N},S){const j=l(),P=A(j,"open"),T=A(j,"mounted"),z=A(j,"currentPlacement"),O=A(j,"placement"),[L,D]=g(z),[H,W]=g(z);I(()=>{O!==H&&W(O)},[O]),I(()=>{z!==H&&W(z)},[z]),I(()=>{T&&H!==L&&D(H)},[T,H,L]);const $=w(()=>P&&T?"open":"closed",[P,T]),F=w(()=>P?h:"none",[P,h]),K=B(H),G=(({borderRadius:r,spacing:e})=>{if(void 0===e||"0"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xs)_-_var(--uds-border-width-thin))]";case"sm":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-sm)_-_var(--uds-border-width-thin))]";case"md":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-md)_-_var(--uds-border-width-thin))]";case"lg":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-lg)_-_var(--uds-border-width-thin))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_var(--uds-border-width-thin))]"}if("px"===e||"0.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_2px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_2px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_2px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_2px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xl)_-_2px))]"}if("1"===e||"1.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_4px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_4px)]"}if("2"===e||"2.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_8px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_8px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_8px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-lg)_-_8px))]";case"xl":return"[&>*:first-child]:rounded-t-[calc(var(--uds-border-radius-xl)_-_8px)] [&>*:last-child]:rounded-b-[calc(var(--uds-border-radius-xl)_-_8px)]"}if("3"===e||"3.5"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-xs)_-_6px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-sm)_-_6px))]";case"md":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-md)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-md)_-_6px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_6px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))] [&>*:last-child]:rounded-b-[min(20px,calc(var(--uds-border-radius-xl)_-_6px))]"}if("4"===e)switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_16px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_16px))]";case"md":return"[&>*:first-child]:rounded-t-[max(4px,calc(var(--uds-border-radius-md)_-_16px))] [&>*:last-child]:rounded-b-[max(4px,calc(var(--uds-border-radius-md)_-_16px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-lg)_-_16px))]";case"xl":return"[&>*:first-child]:rounded-t-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))] [&>*:last-child]:rounded-b-[max(6px,calc(var(--uds-border-radius-xl)_-_16px))]"}switch(r){case"xs":return"[&>*:first-child]:rounded-t-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))] [&>*:last-child]:rounded-b-[max(1px,calc(var(--uds-border-radius-xs)_-_4px))]";case"sm":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-sm)_-_4px))]";case"md":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-md)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-md)_-_4px))]";case"lg":return"[&>*:first-child]:rounded-t-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))] [&>*:last-child]:rounded-b-[max(2px,calc(var(--uds-border-radius-lg)_-_4px))]";case"xl":return"[&>*:first-child]:rounded-t-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))] [&>*:last-child]:rounded-b-[min(18px,calc(var(--uds-border-radius-xl)_-_4px))]"}})({borderRadius:o,spacing:e}),Z=w(()=>V[n],[n]);return R(E,{initial:!1,children:R(m,{gutter:Z,sameWidth:f,focusable:_,store:j,ref:S,portalElement:y,portal:C,...N,render:R(M,{backgroundColor:c,gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,borderRadius:o,borderColor:u,borderWidth:x,overflow:p,animate:$,variants:K,dropShadow:F,className:i("uds-menu-content","transition-shadow","duration-200","ease-in-out","min-w-60","max-w-lg","max-h-96","overflow-auto","uds-ring","z-10","group",!k&&G,b),children:v})})})}),$=v(function({role:e="separator",contentPosition:a="start",gap:d="4",children:t,spacingVertical:s=(t?"2":"0"),spacingHorizontal:i=(t?"4":"0"),className:c,...o},u){const l={root:n({menuDividerVariantRoot:"default",className:c}),text:n({menuDividerVariantText:"default"}),line:n({menuDividerVariantLine:"default"})};return R(r,{ref:u,role:e,variant:"inherit",contentPosition:a,gap:d,spacingVertical:s,spacingHorizontal:i,className:l.root,layerClassNames:l,...o,children:t})});$.displayName="MenuDivider";var F={};u(F,{Content:()=>W,Divider:()=>$,Item:()=>J,ItemCheckbox:()=>U,Provider:()=>q,Trigger:()=>Q,useMenuContext:()=>l,useMenuStore:()=>x,useStoreState:()=>P});var K="uds-menu-item",G={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},Z=v(function({spacing:r="0",spacingBottom:a,spacingEnd:d,spacingHorizontal:s="4",spacingStart:u,spacingTop:l,spacingVertical:m="3.5",columnGap:x="2",className:p,children:h,endIcon:b,startIcon:f,hideEndIcon:_,active:v,disabled:g,as:I,rootProps:C,name:k,alignItems:N="center",justifyContent:V="space-between",layerClassNames:P,...T},z){const O=y.count(h)>1,A=(({active:r,disabled:e,className:a})=>i(K,"focus-visible:text-brand","focus-visible:bg-brand-secondary","focus-visible:z-10","uds-ring","!-outline-offset-2",r&&["[&:not([aria-checked])]:cursor-default"],e&&"opacity-25 cursor-not-allowed","duration-20 transition-[font-variation-settings] ease-in-out","z-0",a))({active:v,disabled:g,className:p}),M=n({className:i(`${K}-content truncate`,P?.text),textAlign:"start",...O&&{columnGap:x,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),L=w(()=>({root:n({menuSizeRoot:"default",className:i(P?.root,A)}),startIcon:n({menuSizeStartIcon:"default",className:P?.startIcon}),endIcon:n({menuSizeEndIcon:"default",className:P?.endIcon})}),[P,A]);return R(c,{asChild:!0,spacing:r,spacingBottom:a,spacingEnd:d,spacingHorizontal:s,spacingStart:u,spacingTop:l,spacingVertical:m,columnGap:x,className:L.root,alignItems:N,justifyContent:V,children:j(I,{render:R(e,{ref:z,...T}),name:k??"",disabled:g,...C,children:[j(t,{gap:x,alignItems:"center",width:"full",children:[R(E,{initial:!1,children:f&&R(S.span,{variants:G,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:R(o,{icon:f,className:L.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),R("span",{className:M,children:h})]}),R(E,{initial:!1,mode:"popLayout",children:!_&&b&&R(S.span,{variants:G,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:R(o,{icon:b,className:L.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),J=v(function({active:r,hideOnClick:e,...a},d){const t={root:n({menuItemVariantRoot:"default",menuItemVariantActiveRoot:r?"on":"off"}),text:n({menuItemVariantText:"default",menuItemVariantActiveText:r?"on":"off"}),startIcon:n({menuItemVariantIcon:"default",menuItemVariantActiveIcon:r?"on":"off"})};return R(Z,{ref:d,as:p,active:r,layerClassNames:t,rootProps:{hideOnClick:e},...a})});J.displayName="MenuItem";var U=v(function({name:r,endIcon:e=a,checked:d,defaultChecked:t,hideOnClick:s,className:c,...o},u){const m=r,x=C(!1),p=l(),b=P(p);I(()=>{!x.current&&void 0!==t&&p&&(p.setValues(r=>({...r,[m]:t})),x.current=!0)},[p,t,m]);const f=w(()=>{if(void 0!==d)return d;if(b?.items?.length){const r=b?.items.find(r=>r.element?.name===m);if(r?.element)return r.element.checked}const r=b?.values[m];return"boolean"==typeof r?r:t??!1},[b?.items,b?.values,m,d,t]),_=k(r=>{void 0===d&&p?.setValues(e=>({...e,[m]:r.target.checked}))},[m,p,d]),v={root:n({menuItemCheckboxVariantRoot:"default",menuItemCheckboxVariantActiveRoot:f?"on":"off"}),text:n({menuItemCheckboxVariantText:"default",menuItemCheckboxVariantActiveText:f?"on":"off"}),startIcon:n({menuItemCheckboxVariantStartIcon:"default",menuItemCheckboxVariantActiveStartIcon:f?"on":"off"}),endIcon:n({menuItemCheckboxVariantEndIcon:"default",menuItemCheckboxVariantActiveEndIcon:f?"on":"off"})};return R(Z,{ref:u,as:h,hideEndIcon:!f,endIcon:e,active:f,className:i("uds-menu-item-checkbox",c),layerClassNames:v,rootProps:{name:r,onChange:_,defaultChecked:t,checked:void 0!==d?d:void 0,hideOnClick:s},...o})});U.displayName="MenuItemCheckbox";var X=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},Y=r=>{const[e,a]=g(X);return I(()=>{if(r?.explicit)return void a(r.explicit);const e=(r=>{const e=new MutationObserver(e=>{e.some(r=>"attributes"===r.type&&"dir"===r.attributeName)&&r()});return e.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}),e})(()=>{a(X())});return()=>e.disconnect()},[r?.explicit]),e},q=function({placement:r="bottom",rtl:e,...a}){const d=Y({explicit:e}),t=((r,e)=>{const a=e?.rtl;if("start"===r)return a?"right":"left";if("end"===r)return a?"left":"right";if(r?.includes("-")){const[e,d]=r.split("-");if(!("start"!==e&&"end"!==e||"top"!==d&&"bottom"!==d))return`${"start"===e?a?"right":"left":a?"left":"right"}-${"bottom"===d?"end":"start"}`;if("top"===e||"bottom"===e)return`${e}-${"start"===d?a?"end":"start":a?"start":"end"}`}return r})(r,{rtl:d});return R(s,{children:R(b,{placement:t,rtl:d,...a})})},Q=v(function({asChild:r,children:e,className:a,...d},t){const s=C(null),n=r?{render:R(c,{asChild:!0,ref:s,className:"uds-ring h-fit w-fit",children:e})}:{children:e},o=k(()=>{const r=s.current?.firstChild;r instanceof HTMLElement&&"function"==typeof r.focus&&r.focus()},[s]);return R(f,{onFocus:o,onFocusVisible:o,ref:t,className:i("uds-menu-trigger",a),...n,...d})});export{F as Menu};