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