@yahoo/uds 3.26.0-beta.1 → 3.26.0-beta.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-2M7CRULY.cjs"),r=require("../chunk-KMJDX4H6.cjs"),a=require("../chunk-NEJGYZBS.cjs"),t=require("../chunk-Y5TAAZAI.cjs"),d=require("../chunk-ESWWMVEC.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 y=o.m.create(a.VStack),I=5,S=.97,w={top:{x:0,y:I},bottom:{x:0,y:-5},left:{x:I,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: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:I,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"),A=g(E,"currentPlacement"),q=g(E,"placement"),[z,O]=i.useState(A),[T,B]=i.useState(A);i.useEffect(()=>{q!==T&&B(q)},[q]),i.useEffect(()=>{A!==T&&B(A)},[A]),i.useEffect(()=>{P&&T!==z&&O(T)},[P,T,z]);const D=i.useMemo(()=>R&&P?"open":"closed",[R,P]),H=i.useMemo(()=>R?_:"none",[R,_]),W=C(T),$=(({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}),G=i.useMemo(()=>u.spacingMap[x],[x]);return l.jsx(o.AnimatePresence,{initial:!1,children:l.jsx(n.Menu,{gutter:G,sameWidth:I,focusable:S,store:E,ref:V,portalElement:j,portal:k,...M,render:l.jsx(y,{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&&$,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:()=>j,Divider:()=>k,Item:()=>R,ItemCheckbox:()=>P,Provider:()=>z,Trigger:()=>O,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:y,rootProps:I,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: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`,j?.text),textAlign:"start",...E&&{columnGap:m,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),A=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:t,spacingEnd:s,spacingHorizontal:n,spacingStart:c,spacingTop:u,spacingVertical:x,columnGap:m,className:A.root,alignItems:w,justifyContent:C,children:l.jsxs(y,{render:l.jsx(r.Pressable,{ref:N,...k}),name:S??"",disabled:g,...I,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:A.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:A.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 A=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},q=e=>{const[r,a]=i.useState(A);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(A())});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})})},O=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-2M7CRULY.cjs"),r=require("../chunk-KMJDX4H6.cjs"),t=require("../chunk-NEJGYZBS.cjs"),a=require("../chunk-Y5TAAZAI.cjs"),d=require("../chunk-ESWWMVEC.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 y=u.m.create(t.VStack),I=5,S=.97,C={top:{x:0,y:I},bottom:{x:0,y:-5},left:{x:I,y:0},right:{x:-5,y:0}},w=e=>i.useMemo(()=>((e="bottom")=>{const[r="top"]=e?.split("-");return{closed:{...C[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:I,focusable:S,children:C,portalElement:j,portal:k=!0,disableAutoBorderRadius:N,...M},V){const E=n.useMenuContext(),R=g(E,"open"),O=g(E,"mounted"),P=g(E,"currentPlacement"),A=g(E,"placement"),[q,z]=i.useState(P),[T,B]=i.useState(P);i.useEffect(()=>{A!==T&&B(A)},[A]),i.useEffect(()=>{P!==T&&B(P)},[P]),i.useEffect(()=>{O&&T!==q&&z(T)},[O,T,q]);const D=i.useMemo(()=>R&&O?"open":"closed",[R,O]),H=i.useMemo(()=>R?_:"none",[R,_]),W=w(T),$=(({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}),G=i.useMemo(()=>o.spacingMap[x],[x]);return l.jsx(u.AnimatePresence,{initial:!1,children:l.jsx(n.Menu,{gutter:G,sameWidth:I,focusable:S,store:E,ref:V,portalElement:j,portal:k,...M,render:l.jsx(y,{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&&$,v),children:C})})})}),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:()=>O,Provider:()=>q,Trigger:()=>z,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:y,rootProps:I,name:S,alignItems:C="center",justifyContent:w="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}),O=d.getStyles({className:d.cx(`${M}-content truncate`,j?.text),textAlign:"start",...E&&{columnGap:m,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),P=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:P.root,alignItems:C,justifyContent:w,children:l.jsxs(y,{render:l.jsx(r.Pressable,{ref:N,...k}),name:S??"",disabled:g,...I,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:P.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),l.jsx("span",{className:O,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:P.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 O=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})});O.displayName="MenuItemCheckbox";var P=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},A=e=>{const[r,t]=i.useState(P);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(P())});return()=>r.disconnect()},[e?.explicit]),r},q=function({placement:e="bottom",rtl:r,...t}){const d=A({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})})},z=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-5WVRSSFO.js";import{Pressable as e,e as a}from"../chunk-OIGO4EIU.js";import{VStack as d,HStack as t}from"../chunk-4HTXIBEW.js";import{SpringMotionConfig as s}from"../chunk-FEBCSS3H.js";import{cx as i,getStyles as n,Box as c,IconSlot as o}from"../chunk-BQMHZMXW.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 S}from"@yahoo/uds/fixtures";import{m as V,AnimatePresence as E}from"motion/react";import{jsx as j,jsxs as M}from"react/jsx-runtime";import{useStoreState as R}from"@ariakit/react";function z(r){return r}function T(r,e){const a=r.__unstableInternals;return function(r,e){if(!r)throw new Error(e)}(a,"Invalid store"),a[e]}var{useSyncExternalStore:O}=k;function P(r,e=z){const a=_.useCallback(e=>r?function(r,...e){if(r)return T(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 A=V.create(d),B=5,H=.97,W={top:{x:0,y:B},bottom:{x:0,y:-5},left:{x:B,y:0},right:{x:-5,y:0}},D=r=>w(()=>((r="bottom")=>{const[e="top"]=r?.split("-");return{closed:{...W[e],opacity:0,scale:H},open:{y:0,x:0,opacity:1,scale:1}}})(r),[r]),F=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},V){const M=l(),R=P(M,"open"),z=P(M,"mounted"),T=P(M,"currentPlacement"),O=P(M,"placement"),[B,H]=g(T),[W,F]=g(T);I(()=>{O!==W&&F(O)},[O]),I(()=>{T!==W&&F(T)},[T]),I(()=>{z&&W!==B&&H(W)},[z,W,B]);const $=w(()=>R&&z?"open":"closed",[R,z]),G=w(()=>R?h:"none",[R,h]),L=D(W),X=(({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}),K=w(()=>S[n],[n]);return j(E,{initial:!1,children:j(m,{gutter:K,sameWidth:f,focusable:_,store:M,ref:V,portalElement:y,portal:C,...k,render:j(A,{backgroundColor:c,gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,borderRadius:o,borderColor:u,borderWidth:x,overflow:p,animate:$,variants:L,dropShadow:G,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&&X,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 j(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 G={};u(G,{Content:()=>F,Divider:()=>$,Item:()=>U,ItemCheckbox:()=>Q,Provider:()=>J,Trigger:()=>Y,useMenuContext:()=>l,useMenuStore:()=>x,useStoreState:()=>R});var L="uds-menu-item",X={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},K=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:S="space-between",layerClassNames:R,...z},T){const O=y.count(h)>1,P=(({active:r,disabled:e,className:a})=>i(L,"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}),A=n({className:i(`${L}-content truncate`,R?.text),textAlign:"start",...O&&{columnGap:x,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),B=w(()=>({root:n({menuSizeRoot:"default",className:i(R?.root,P)}),startIcon:n({menuSizeStartIcon:"default",className:R?.startIcon}),endIcon:n({menuSizeEndIcon:"default",className:R?.endIcon})}),[R,P]);return j(c,{asChild:!0,spacing:r,spacingBottom:a,spacingEnd:d,spacingHorizontal:s,spacingStart:u,spacingTop:l,spacingVertical:m,columnGap:x,className:B.root,alignItems:k,justifyContent:S,children:M(I,{render:j(e,{ref:T,...z}),name:N??"",disabled:g,...C,children:[M(t,{gap:x,alignItems:"center",width:"full",children:[j(E,{initial:!1,children:f&&j(V.span,{variants:X,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:j(o,{icon:f,className:B.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),j("span",{className:A,children:h})]}),j(E,{initial:!1,mode:"popLayout",children:!_&&b&&j(V.span,{variants:X,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:j(o,{icon:b,className:B.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),U=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 j(K,{ref:a,as:p,active:r,layerClassNames:d,...e})});U.displayName="MenuItem";var Q=v(function({name:r,endIcon:e=a,checked:d,defaultChecked:t,className:s,...c},o){const u=r,m=C(!1),x=l(),p=R(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 j(K,{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})});Q.displayName="MenuItemCheckbox";var Z=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},q=r=>{const[e,a]=g(Z);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(Z())});return()=>e.disconnect()},[r?.explicit]),e},J=function({placement:r="bottom",rtl:e,...a}){const d=q({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 j(s,{children:j(b,{placement:t,rtl:d,...a})})},Y=v(function({asChild:r,children:e,className:a,...d},t){const s=C(null),n=r?{render:j(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 j(f,{onFocus:o,onFocusVisible:o,ref:t,className:i("uds-menu-trigger",a),...n,...d})});export{G as Menu};
2
+ import{DividerInternal as r}from"../chunk-5WVRSSFO.js";import{Pressable as e,e as a}from"../chunk-OIGO4EIU.js";import{VStack as d,HStack as t}from"../chunk-4HTXIBEW.js";import{SpringMotionConfig as s}from"../chunk-FEBCSS3H.js";import{cx as i,getStyles as n,Box as c,IconSlot as o}from"../chunk-BQMHZMXW.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 C,Children as w,useRef as y,useCallback as k}from"react";import N from"use-sync-external-store/shim/index.js";import{spacingMap as S}from"@yahoo/uds/fixtures";import{m as V,AnimatePresence as E}from"motion/react";import{jsx as j,jsxs as O}from"react/jsx-runtime";import{useStoreState as M}from"@ariakit/react";function R(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:T}=N;function P(r,e=R){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 T(a,d,d)}var A=V.create(d),B=5,H=.97,W={top:{x:0,y:B},bottom:{x:0,y:-5},left:{x:B,y:0},right:{x:-5,y:0}},D=r=>C(()=>((r="bottom")=>{const[e="top"]=r?.split("-");return{closed:{...W[e],opacity:0,scale:H},open:{y:0,x:0,opacity:1,scale:1}}})(r),[r]),F=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:w,portal:y=!0,disableAutoBorderRadius:k,...N},V){const O=l(),M=P(O,"open"),R=P(O,"mounted"),z=P(O,"currentPlacement"),T=P(O,"placement"),[B,H]=g(z),[W,F]=g(z);I(()=>{T!==W&&F(T)},[T]),I(()=>{z!==W&&F(z)},[z]),I(()=>{R&&W!==B&&H(W)},[R,W,B]);const $=C(()=>M&&R?"open":"closed",[M,R]),G=C(()=>M?h:"none",[M,h]),L=D(W),X=(({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}),K=C(()=>S[n],[n]);return j(E,{initial:!1,children:j(m,{gutter:K,sameWidth:f,focusable:_,store:O,ref:V,portalElement:w,portal:y,...N,render:j(A,{backgroundColor:c,gap:r,spacing:e,spacingBottom:a,spacingEnd:d,spacingStart:t,spacingTop:s,borderRadius:o,borderColor:u,borderWidth:x,overflow:p,animate:$,variants:L,dropShadow:G,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&&X,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 j(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 G={};u(G,{Content:()=>F,Divider:()=>$,Item:()=>U,ItemCheckbox:()=>Q,Provider:()=>J,Trigger:()=>Y,useMenuContext:()=>l,useMenuStore:()=>x,useStoreState:()=>M});var L="uds-menu-item",X={visible:{scale:1,opacity:1},hidden:{scale:.7,opacity:0}},K=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:y,name:k,alignItems:N="center",justifyContent:S="space-between",layerClassNames:M,...R},z){const T=w.count(h)>1,P=(({active:r,disabled:e,className:a})=>i(L,"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}),A=n({className:i(`${L}-content truncate`,M?.text),textAlign:"start",...T&&{columnGap:x,display:"flex",alignItems:"center",width:"full",justifyContent:"space-between"}}),B=C(()=>({root:n({menuSizeRoot:"default",className:i(M?.root,P)}),startIcon:n({menuSizeStartIcon:"default",className:M?.startIcon}),endIcon:n({menuSizeEndIcon:"default",className:M?.endIcon})}),[M,P]);return j(c,{asChild:!0,spacing:r,spacingBottom:a,spacingEnd:d,spacingHorizontal:s,spacingStart:u,spacingTop:l,spacingVertical:m,columnGap:x,className:B.root,alignItems:N,justifyContent:S,children:O(I,{render:j(e,{ref:z,...R}),name:k??"",disabled:g,...y,children:[O(t,{gap:x,alignItems:"center",width:"full",children:[j(E,{initial:!1,children:f&&j(V.span,{variants:X,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-start-icon",children:j(o,{icon:f,className:B.startIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})}),j("span",{className:A,children:h})]}),j(E,{initial:!1,mode:"popLayout",children:!_&&b&&j(V.span,{variants:X,initial:"hidden",animate:"visible",exit:"hidden",className:"uds-end-icon",children:j(o,{icon:b,className:B.endIcon,iconProps:{size:"sm",variant:v?"fill":"outline",color:"current"}})})})]})})}),U=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 j(K,{ref:d,as:p,active:r,layerClassNames:t,rootProps:{hideOnClick:e},...a})});U.displayName="MenuItem";var Q=v(function({name:r,endIcon:e=a,checked:d,defaultChecked:t,hideOnClick:s,className:c,...o},u){const m=r,x=y(!1),p=l(),b=M(p);I(()=>{!x.current&&void 0!==t&&p&&(p.setValues(r=>({...r,[m]:t})),x.current=!0)},[p,t,m]);const f=C(()=>{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 j(K,{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})});Q.displayName="MenuItemCheckbox";var Z=()=>{if("undefined"==typeof document)return!1;return"rtl"===getComputedStyle(document.documentElement).direction},q=r=>{const[e,a]=g(Z);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(Z())});return()=>e.disconnect()},[r?.explicit]),e},J=function({placement:r="bottom",rtl:e,...a}){const d=q({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 j(s,{children:j(b,{placement:t,rtl:d,...a})})},Y=v(function({asChild:r,children:e,className:a,...d},t){const s=y(null),n=r?{render:j(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 j(f,{onFocus:o,onFocusVisible:o,ref:t,className:i("uds-menu-trigger",a),...n,...d})});export{G as Menu};
@@ -1 +1,2 @@
1
+ "use client";
1
2
  import{FormLabel as t}from"../../chunk-FA375VSX.js";import{SpringMotionConfig as e,AvoidMotionLibraryProvider as a}from"../../chunk-FEBCSS3H.js";import{Box as o,cx as i,getStyles as n,IconSlot as r}from"../../chunk-BQMHZMXW.js";import*as l from"motion/react-m";import{forwardRef as c,useId as s,useRef as d,useState as h,useCallback as u,useEffect as m}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */var w=()=>import("../../domMax-OBCHPQP3.js").then(({domMax:t})=>t),y=l.create(o),b=c(function({id:a,isOn:l,defaultIsOn:c,onChange:b,label:v,labelPosition:x="start",size:N="md",onIcon:C,offIcon:S,reduceMotion:g,disabled:V,required:k,onFocus:I,onBlur:H,className:z,layerClassNames:M,...j},A){const B=s(),F=a??`uds-input-${B}`,P=d(null),q=void 0!==l,[O,R]=h(q?l:c),Q=u(t=>{b?.(t),q||R(t.target.checked)},[q,b]),X=u(t=>{I?.(t)},[I]),D=u(t=>{H?.(t)},[H]),E=g?"always":"user",W=g?"duration-0":"duration-120 motion-reduce:duration-0";m(()=>{q&&R(l)},[l,q]);const Z={root:n({switchSizeRoot:N,switchVariantRoot:"default",switchVariantActiveRoot:O?"on":"off",className:i("group","flex","items-center","start"===x?"flex-row":"flex-row-reverse",...V?["cursor-default","opacity-50"]:["cursor-pointer"],M?.root,z)}),switch:n({switchVariantSwitch:"default",switchSizeSwitch:N,switchVariantActiveSwitch:O?"on":"off",className:i("uds-ring","uds-ring-within","relative","rounded-full","items-center",W,"transition-[background-color,box-shadow]",M?.switch)}),handleContainer:i("pointer-events-none","relative","w-full","h-full"),handle:n({switchSizeHandle:N,className:i("absolute","top-0","bottom-0",O?"right-0":"left-0",M?.handle)}),handleContents:i("relative","w-full","h-full","rounded-full","overflow-hidden",!V&&"group-hover:scale-105","opacity-95",!V&&"group-hover:opacity-100",W,"transition-[transform,opacity]"),handleCircle:n({switchVariantActiveHandle:O?"on":"off",switchVariantHandle:"default",className:i("absolute","top-0","left-0","right-0","bottom-0")}),handleIcon:n({switchSizeHandleIcon:N,switchVariantHandleIcon:"default",switchVariantActiveHandleIcon:O?"on":"off",className:i("absolute","opacity-0","top-1/2","left-1/2","transform","translate-x-[-50%]","translate-y-[-50%]",W,"transition-opacity")}),htmlCheckbox:i("cursor-[inherit]","absolute","opacity-0","top-1/2","left-1/2","w-[calc(100%+2px)]","h-[calc(100%+2px)]","transform","translate-x-[-50%]","translate-y-[-50%]"),label:i("start"===x?"text-start":"text-end",M?.label)};return f(e,{reducedMotion:E,loadFeatures:w,layoutVariant:"bouncy",layoutSpeed:"4",children:p(v?"label":"div",{className:Z.root,"data-testid":"switch-root",tabIndex:-1,children:[p(o,{className:Z.switch,children:[f("input",{type:"checkbox",...j,ref:t=>{P.current=t,"function"==typeof A?A(t):null!==A&&(A.current=t)},onFocus:X,onBlur:D,id:F,disabled:V,required:k,checked:q?O:void 0,defaultChecked:q?void 0:c,onChange:Q,className:Z.htmlCheckbox,style:{}}),f(o,{className:Z.handleContainer,children:f(y,{className:Z.handle,layout:"position",layoutDependency:O,children:p(o,{className:Z.handleContents,children:[f(o,{className:Z.handleCircle}),C&&f(r,{icon:C,iconProps:{variant:"fill",size:"sm"},"data-testid":"on-icon",className:i(Z.handleIcon,O?"opacity-100":"opacity-0")}),S&&f(r,{icon:S,iconProps:{variant:"fill",size:"sm"},"data-testid":"off-icon",className:i(Z.handleIcon,O?"opacity-0":"opacity-100")})]})})})]}),v&&f(t,{as:"div",variant:"inherit",color:"inherit",required:k,label:v,className:Z.label})]})})});b.displayName="SwitchV2";var v=a;export{b as SwitchV2,v as SwitchV2AvoidMotionLibraryProvider};