@mich8060/unified-design-system 0.2.32 → 0.2.34

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.
@@ -12,6 +12,7 @@ Hard requirements:
12
12
  - Use only `--uds-*` variables or hardcoded literals.
13
13
  - Use canonical prop names only (reject Ant-style aliases like `Menu.items`, `Flex.vertical`, `Button.type`).
14
14
  - Default `Container` to `appearance=\"transparent\"` and `padding=\"large\"` (24px) unless a different requirement is explicit.
15
+ - Default `Menu.showSearch` to `false` unless search is explicitly required.
15
16
  - Return deterministic JSON only.
16
17
 
17
18
  Preferred flow:
@@ -14,6 +14,7 @@ Hard rules:
14
14
  - Prefer canonical props from the AI manifest and component contracts.
15
15
  - Load icon options from `@mich8060/unified-design-system/ai/icons` (alias: `@mich8060/unified-design-system/ai/icons.json`) before assigning any icon prop.
16
16
  - Default `Container` to `appearance=\"transparent\"` and `padding=\"large\"` (24px) unless overridden by explicit requirements.
17
+ - Default `Menu.showSearch` to `false` unless search is explicitly required.
17
18
 
18
19
  Required layout scaffold:
19
20
  - App root must be wrapped in `BrowserRouter` (or `RouterProvider`) before rendering any UDS component that consumes routing.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),n=require("react"),h=require("../Icon/Icon.cjs"),q=require("../ActionMenu/ActionMenu.cjs");;/* empty css */const e="uds-dropdown",g={compact:"compact",default:null},b={default:null,focused:"focused",error:"error",disabled:"disabled"};function y({options:i=[],value:l,onChange:o,placeholder:m="Select an option",size:p="default",state:f="default",placement:j="bottom-start",id:v,label:r,className:N="",disabled:a=!1,...S}){const[u,w]=n.useState(!1),x=n.useId(),_=v||`dropdown-${x}`,c=n.useMemo(()=>i.map(s=>typeof s=="string"?{value:s,label:s}:s),[i]),$=a?"disabled":f==="default"&&u?"focused":f,d=c.find(s=>s.value===l),M=d?d.label:m,C=n.useMemo(()=>c.map(s=>({id:s.value,label:s.label,active:s.value===l,onClick:()=>{o&&!a&&o(s.value)}})),[c,l,o,a]),I=[e,g[p]&&`${e}--${g[p]}`,b[$]&&`${e}--${b[$]}`,u&&`${e}--open`,N].filter(Boolean).join(" "),O=t.jsxs("button",{type:"button",id:_,className:`${e}__trigger`,disabled:a,"aria-label":r||m,...S,children:[t.jsx("span",{className:`${e}__value ${d?"":`${e}__value--placeholder`}`,children:M}),t.jsx(h.default,{name:"CaretDown",size:16,appearance:"regular",className:`${e}__icon ${u?`${e}__icon--open`:""}`})]});return t.jsxs("div",{className:`${e}-outer`,children:[r&&t.jsx("label",{htmlFor:_,className:`${e}__label`,children:r}),t.jsx(q.default,{trigger:O,items:C,placement:j,fullWidth:!0,disabled:a,onOpenChange:w,className:I,menuClassName:`${e}__menu`})]})}const A=n.memo(y);exports.default=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),a=require("react"),q=require("../Icon/Icon.cjs"),A=require("../ActionMenu/ActionMenu.cjs");;/* empty css */const t="uds-dropdown",g={compact:"compact",default:null},b={default:null,focused:"focused",error:"error",disabled:"disabled"};function B({options:m=[],value:o,onChange:r,placeholder:l,size:f="default",state:p="default",placement:v="bottom-start",id:j,label:c,className:S="",disabled:s=!1,...w}){const[u,x]=a.useState(!1),M=a.useId(),N=j||`dropdown-${M}`,i=a.useMemo(()=>m.map(e=>typeof e=="string"?{value:e,label:e}:e),[m]),$=s?"disabled":p==="default"&&u?"focused":p,d=i.find(e=>e.value===o),_=typeof c=="string"&&c.trim().length>0?c.trim():"Select an option",y=typeof l=="string"&&l.trim().length>0?l.trim():_,C=d?d.label:y,I=a.useMemo(()=>i.map(e=>({id:e.value,label:e.label,active:e.value===o,onClick:()=>{r&&!s&&r(e.value)}})),[i,o,r,s]),O=[t,g[f]&&`${t}--${g[f]}`,b[$]&&`${t}--${b[$]}`,u&&`${t}--open`,S].filter(Boolean).join(" "),h=n.jsxs("button",{type:"button",id:N,className:`${t}__trigger`,disabled:s,"aria-label":_,...w,children:[n.jsx("span",{className:`${t}__value ${d?"":`${t}__value--placeholder`}`,children:C}),n.jsx(q.default,{name:"CaretDown",size:16,appearance:"regular",className:`${t}__icon ${u?`${t}__icon--open`:""}`})]});return n.jsx("div",{className:`${t}-outer`,children:n.jsx(A.default,{trigger:h,items:I,placement:v,fullWidth:!0,disabled:s,onOpenChange:x,className:O,menuClassName:`${t}__menu`})})}const D=a.memo(B);exports.default=D;
@@ -1 +1 @@
1
- import{jsxs as _,jsx as s}from"react/jsx-runtime";import y,{useState as A,useId as B,useMemo as g}from"react";import D from"../Icon/Icon.js";import z from"../ActionMenu/ActionMenu.js";/* empty css */const e="uds-dropdown",N={compact:"compact",default:null},b={default:null,focused:"focused",error:"error",disabled:"disabled"};function k({options:m=[],value:o,onChange:n,placeholder:d="Select an option",size:i="default",state:p="default",placement:v="bottom-start",id:w,label:l,className:C="",disabled:t=!1,...I}){const[r,S]=A(!1),h=B(),f=w||`dropdown-${h}`,c=g(()=>m.map(a=>typeof a=="string"?{value:a,label:a}:a),[m]),$=t?"disabled":p==="default"&&r?"focused":p,u=c.find(a=>a.value===o),O=u?u.label:d,M=g(()=>c.map(a=>({id:a.value,label:a.label,active:a.value===o,onClick:()=>{n&&!t&&n(a.value)}})),[c,o,n,t]),j=[e,N[i]&&`${e}--${N[i]}`,b[$]&&`${e}--${b[$]}`,r&&`${e}--open`,C].filter(Boolean).join(" "),x=_("button",{type:"button",id:f,className:`${e}__trigger`,disabled:t,"aria-label":l||d,...I,children:[s("span",{className:`${e}__value ${u?"":`${e}__value--placeholder`}`,children:O}),s(D,{name:"CaretDown",size:16,appearance:"regular",className:`${e}__icon ${r?`${e}__icon--open`:""}`})]});return _("div",{className:`${e}-outer`,children:[l&&s("label",{htmlFor:f,className:`${e}__label`,children:l}),s(z,{trigger:x,items:M,placement:v,fullWidth:!0,disabled:t,onOpenChange:S,className:j,menuClassName:`${e}__menu`})]})}const W=y.memo(k);export{W as default};
1
+ import{jsx as s,jsxs as A}from"react/jsx-runtime";import B,{useState as D,useId as k,useMemo as _}from"react";import z from"../Icon/Icon.js";import L from"../ActionMenu/ActionMenu.js";/* empty css */const t="uds-dropdown",g={compact:"compact",default:null},b={default:null,focused:"focused",error:"error",disabled:"disabled"};function E({options:u=[],value:n,onChange:o,placeholder:r,size:d="default",state:p="default",placement:v="bottom-start",id:w,label:l,className:N="",disabled:a=!1,...C}){const[c,I]=D(!1),S=k(),h=w||`dropdown-${S}`,i=_(()=>u.map(e=>typeof e=="string"?{value:e,label:e}:e),[u]),f=a?"disabled":p==="default"&&c?"focused":p,m=i.find(e=>e.value===n),$=typeof l=="string"&&l.trim().length>0?l.trim():"Select an option",y=typeof r=="string"&&r.trim().length>0?r.trim():$,O=m?m.label:y,x=_(()=>i.map(e=>({id:e.value,label:e.label,active:e.value===n,onClick:()=>{o&&!a&&o(e.value)}})),[i,n,o,a]),M=[t,g[d]&&`${t}--${g[d]}`,b[f]&&`${t}--${b[f]}`,c&&`${t}--open`,N].filter(Boolean).join(" "),j=A("button",{type:"button",id:h,className:`${t}__trigger`,disabled:a,"aria-label":$,...C,children:[s("span",{className:`${t}__value ${m?"":`${t}__value--placeholder`}`,children:O}),s(z,{name:"CaretDown",size:16,appearance:"regular",className:`${t}__icon ${c?`${t}__icon--open`:""}`})]});return s("div",{className:`${t}-outer`,children:s(L,{trigger:j,items:x,placement:v,fullWidth:!0,disabled:a,onOpenChange:I,className:M,menuClassName:`${t}__menu`})})}const F=B.memo(E);export{F as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),p=require("react");;/* empty css */const z=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function N(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function a(e){return e.replace(/\s+/g,"-")}function T(e,n){if(e)return"flex-start";if(n)return"flex-end"}function E(e,n){if(e)return"flex-start";if(n)return"flex-end"}function K(e){var l;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((l=n.match(/^spacing-(\d+)$/))==null?void 0:l[1])??n;return z.has(t)?`var(--uds-spacing-${t})`:e}const L=p.forwardRef(function({as:n="div",direction:t="row",justifyContent:l,alignItems:o,top:s=!1,bottom:u=!1,left:F=!1,right:S=!1,wrap:h=!1,gap:i,fullWidth:c=!1,span:j=!1,inline:A=!1,className:$,style:r,children:R,...b},B){const G=N(h),_=String(i).trim()==="auto",d=T(s,u),x=E(F,S),m=l??(t==="row"?x:d),v=o??(t==="row"?d:x),q=["uds-flex",`uds-flex--direction-${t}`,m&&`uds-flex--justify-${a(m)}`,v&&`uds-flex--align-${a(v)}`,`uds-flex--wrap-${a(G)}`,A&&"uds-flex--inline",c&&"uds-flex--full-width",j&&"uds-flex--span",_&&"uds-flex--gap-auto",$].filter(Boolean).join(" "),f={};return i!=null&&(r==null?void 0:r.gap)==null&&(f.gap=K(i)),c&&(r==null?void 0:r.width)==null&&(f.width="100%"),g.jsx(n,{ref:B,className:q,style:{...f,...r},...b,children:R})}),O=p.forwardRef(function({as:n="div",className:t,children:l,...o},s){const u=["uds-flex__full",t].filter(Boolean).join(" ");return g.jsx(n,{ref:s,className:u,...o,children:l})}),w=L;w.Full=O;exports.Flex=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react/jsx-runtime"),S=require("react");;/* empty css */const C=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function E(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function c(e){return e.replace(/\s+/g,"-")}function K(e,n){if(e)return"flex-start";if(n)return"flex-end"}function M(e,n){if(e)return"flex-start";if(n)return"flex-end"}function O(e){var o;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((o=n.match(/^spacing-(\d+)$/))==null?void 0:o[1])??n;return C.has(t)?`var(--uds-spacing-${t})`:e}function k(e){return typeof e=="number"?`${e}px`:typeof e=="string"&&e.trim().length>0?e:"0px"}function J(e){if(typeof e!="number"||!Number.isFinite(e))return;const n=Math.floor(e);return n>0?n:void 0}const U=S.forwardRef(function({as:n="div",direction:t="row",justifyContent:o,alignItems:i,top:u=!1,bottom:l=!1,left:b=!1,right:j=!1,itemsPerRow:A,ItemsPerRow:G,wrap:$=!1,gap:f,fullWidth:d=!1,span:z=!1,inline:P=!1,className:B,style:r,children:I,...N},V){const x=J(A??G),a=t==="row"&&x!==void 0,_=E(a?!0:$),q=String(f).trim()==="auto",m=K(u,l),p=M(b,j),g=o??(t==="row"?p:m),w=i??(t==="row"?m:p),L=["uds-flex",`uds-flex--direction-${t}`,g&&`uds-flex--justify-${c(g)}`,w&&`uds-flex--align-${c(w)}`,`uds-flex--wrap-${c(_)}`,P&&"uds-flex--inline",d&&"uds-flex--full-width",z&&"uds-flex--span",a&&"uds-flex--items-per-row",q&&"uds-flex--gap-auto",B].filter(Boolean).join(" "),s={},v=O(f),h=(r==null?void 0:r.gap)!=null,T=h?r==null?void 0:r.gap:v;return f!=null&&!h&&(s.gap=v),a&&(s["--uds-flex-items-per-row"]=String(x),s["--uds-flex-gap-resolved"]=k(T)),d&&(r==null?void 0:r.width)==null&&(s.width="100%"),F.jsx(n,{ref:V,className:L,style:{...s,...r},...N,children:I})}),D=S.forwardRef(function({as:n="div",className:t,children:o,...i},u){const l=["uds-flex__full",t].filter(Boolean).join(" ");return F.jsx(n,{ref:u,className:l,...i,children:o})}),R=U;R.Full=D;exports.Flex=R;
@@ -1 +1 @@
1
- import{jsx as v}from"react/jsx-runtime";import w from"react";/* empty css */const N=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function b(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function a(e){return e.replace(/\s+/g,"-")}function E(e,n){if(e)return"flex-start";if(n)return"flex-end"}function K(e,n){if(e)return"flex-start";if(n)return"flex-end"}function L(e){var o;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((o=n.match(/^spacing-(\d+)$/))==null?void 0:o[1])??n;return N.has(t)?`var(--uds-spacing-${t})`:e}const T=w.forwardRef(function({as:n="div",direction:t="row",justifyContent:o,alignItems:l,top:f=!1,bottom:s=!1,left:g=!1,right:F=!1,wrap:h=!1,gap:u,fullWidth:c=!1,span:A=!1,inline:S=!1,className:$,style:r,children:j,...B},G){const R=b(h),_=String(u).trim()==="auto",d=E(f,s),x=K(g,F),m=o??(t==="row"?x:d),p=l??(t==="row"?d:x),z=["uds-flex",`uds-flex--direction-${t}`,m&&`uds-flex--justify-${a(m)}`,p&&`uds-flex--align-${a(p)}`,`uds-flex--wrap-${a(R)}`,S&&"uds-flex--inline",c&&"uds-flex--full-width",A&&"uds-flex--span",_&&"uds-flex--gap-auto",$].filter(Boolean).join(" "),i={};return u!=null&&(r==null?void 0:r.gap)==null&&(i.gap=L(u)),c&&(r==null?void 0:r.width)==null&&(i.width="100%"),v(n,{ref:G,className:z,style:{...i,...r},...B,children:j})}),V=w.forwardRef(function({as:n="div",className:t,children:o,...l},f){const s=["uds-flex__full",t].filter(Boolean).join(" ");return v(n,{ref:f,className:s,...l,children:o})}),k=T;k.Full=V;export{k as Flex};
1
+ import{jsx as F}from"react/jsx-runtime";import S from"react";/* empty css */const E=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function K(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function c(e){return e.replace(/\s+/g,"-")}function T(e,n){if(e)return"flex-start";if(n)return"flex-end"}function k(e,n){if(e)return"flex-start";if(n)return"flex-end"}function J(e){var o;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((o=n.match(/^spacing-(\d+)$/))==null?void 0:o[1])??n;return E.has(t)?`var(--uds-spacing-${t})`:e}function M(e){return typeof e=="number"?`${e}px`:typeof e=="string"&&e.trim().length>0?e:"0px"}function O(e){if(typeof e!="number"||!Number.isFinite(e))return;const n=Math.floor(e);return n>0?n:void 0}const U=S.forwardRef(function({as:n="div",direction:t="row",justifyContent:o,alignItems:i,top:f=!1,bottom:l=!1,left:A=!1,right:G=!1,itemsPerRow:R,ItemsPerRow:$,wrap:z=!1,gap:u,fullWidth:d=!1,span:b=!1,inline:j=!1,className:B,style:r,children:I,...N},P){const m=O(R??$),a=t==="row"&&m!==void 0,V=K(a?!0:z),_=String(u).trim()==="auto",p=T(f,l),x=k(A,G),w=o??(t==="row"?x:p),g=i??(t==="row"?p:x),L=["uds-flex",`uds-flex--direction-${t}`,w&&`uds-flex--justify-${c(w)}`,g&&`uds-flex--align-${c(g)}`,`uds-flex--wrap-${c(V)}`,j&&"uds-flex--inline",d&&"uds-flex--full-width",b&&"uds-flex--span",a&&"uds-flex--items-per-row",_&&"uds-flex--gap-auto",B].filter(Boolean).join(" "),s={},h=J(u),v=(r==null?void 0:r.gap)!=null,C=v?r==null?void 0:r.gap:h;return u!=null&&!v&&(s.gap=h),a&&(s["--uds-flex-items-per-row"]=String(m),s["--uds-flex-gap-resolved"]=M(C)),d&&(r==null?void 0:r.width)==null&&(s.width="100%"),F(n,{ref:P,className:L,style:{...s,...r},...N,children:I})}),q=S.forwardRef(function({as:n="div",className:t,children:o,...i},f){const l=["uds-flex__full",t].filter(Boolean).join(" ");return F(n,{ref:f,className:l,...i,children:o})}),D=U;D.Full=q;export{D as Flex};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),n=require("react");;/* empty css */const A=require("react-router-dom"),p=require("../Icon/Icon.cjs"),te=require("../Avatar/Avatar.cjs"),b=require("../Button/Button.cjs"),le=require("../TextInput/TextInput.cjs"),P=require("../Branding/Branding.cjs"),ie=require("../Dropdown/Dropdown.cjs"),ce=require("../Toggle/Toggle.cjs"),re=require("../ActionMenu/ActionMenu.cjs"),ue=require("../Text/Text.cjs"),oe=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return typeof l.label=="string"&&typeof l.path=="string"},de=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return!(typeof l.label!="string"||typeof l.icon!="string"||l.path!==void 0&&typeof l.path!="string"||l.children!==void 0&&(!Array.isArray(l.children)||!l.children.every(oe)))},me=t=>t==="dark"?"dark":"light";function B({title:t,className:l="",navItems:q=[],brands:w=[],activeBrand:z,onBrandChange:S,activeMode:R,onModeChange:h,showBrand:F=!0,showSearch:G=!0,showBrandSwitcher:J=!0,showNav:U=!0,showModeToggle:V=!0,showUser:H=!0,userName:g="Jane Doe",userInitials:K="JD",userAvatarSrc:Q,accountMenuItems:y=[],identity:W="design-system",defaultExpanded:X=!0}){var O;const x=n.useContext(A.UNSAFE_LocationContext),N=!!x,d=((O=x==null?void 0:x.location)==null?void 0:O.pathname)??(typeof window<"u"?window.location.pathname:"/"),[I,k]=n.useState({}),[i,T]=n.useState(X),[v,Y]=n.useState(24),u=n.useMemo(()=>q.filter(de),[q]),C=n.useMemo(()=>w.filter(a=>typeof a=="string"),[w]),Z=typeof t=="string"?t:"Menu",M=typeof z=="string"?z:C[0],D=M==="default"?"design-system":M??W,m=me(R),ee=n.useMemo(()=>Array.isArray(y)?y:[],[y]);n.useEffect(()=>{if(u.length<=v)return;const a=()=>Y(u.length);if(typeof requestIdleCallback=="function"){const r=requestIdleCallback(a);return()=>cancelIdleCallback(r)}const s=window.setTimeout(a,50);return()=>window.clearTimeout(s)},[u.length,v]),n.useEffect(()=>{const a=u.filter(s=>Array.isArray(s.children)&&s.children.some(r=>d===r.path)).map(s=>s.label);a.length!==0&&k(s=>{let r=!1;const o={...s};return a.forEach(j=>{o[j]||(o[j]=!0,r=!0)}),r?o:s})},[u,d]);const $=n.useCallback(a=>{k(s=>({...s,[a]:!s[a]}))},[]),ae=n.useCallback(()=>T(a=>!a),[]),_=n.useCallback(()=>T(!0),[]),ne=n.useCallback(a=>{i||(a.preventDefault(),a.stopPropagation(),_())},[_,i]),E=n.useCallback(a=>{if(!i){_(),k(s=>({...s,[a]:!0}));return}$(a)},[_,i,$]),f=n.useCallback(()=>{i||_()},[_,i]),L=n.useCallback(a=>h==null?void 0:h(a),[h]),se=n.useMemo(()=>u.slice(0,v).map(a=>{const s=a.children??[],r=s.length>0,o=I[a.label],j=i&&o;return r?e.jsxs("div",{className:`uds-menu_nav__item uds-menu_nav__item--accordion${o?" uds-menu_nav__item--open":""}`,children:[e.jsxs("button",{type:"button",className:"uds-menu_nav__item-link",onClick:()=>E(a.label),title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label}),e.jsx("span",{className:`uds-menu_nav__item-caret${o?" uds-menu_nav__item-caret--open":""}`,children:e.jsx(p.default,{name:"CaretDown",size:16})})]}),j?e.jsx("div",{className:"uds-menu_nav__children uds-menu_nav__children--open",children:s.map(c=>N?e.jsx(A.Link,{className:`uds-menu_nav__child-link${d===c.path?" uds-menu_nav__child-link--active":""}`,to:c.path,onClick:f,title:c.label,children:c.label},c.path):e.jsx("a",{className:`uds-menu_nav__child-link${d===c.path?" uds-menu_nav__child-link--active":""}`,href:c.path,onClick:f,title:c.label,children:c.label},c.path))}):null]},a.label):e.jsx("div",{className:`uds-menu_nav__item${d===a.path?" uds-menu_nav__item--active":""}`,children:N?e.jsxs(A.Link,{className:"uds-menu_nav__item-link",to:a.path??"/",onClick:f,title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label})]}):e.jsxs("a",{className:"uds-menu_nav__item-link",href:a.path??"/",onClick:f,title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label})]})},a.path??a.label)}),[u,v,I,i,E,f,N,d]);return e.jsxs("aside",{className:`uds-menu${i?" uds-menu--expanded":""} ${l}`,"aria-label":Z,onClickCapture:ne,children:[F&&e.jsxs("div",{className:"uds-menu_brand",children:[e.jsx(b.default,{appearance:"text",icon:"List",size:"default",label:i?"Collapse menu":"Expand menu",layout:"icon-only","aria-label":i?"Collapse menu":"Expand menu",className:"uds-menu_brand__toggle",onClick:ae}),e.jsx("div",{className:"uds-menu_brand__symbol",children:e.jsx(P.default,{brand:D,symbol:!0})}),e.jsx("div",{className:"uds-menu_brand__full",children:e.jsx(P.default,{brand:D})})]}),G&&e.jsxs("div",{className:"uds-menu_search",children:[e.jsx(b.default,{appearance:"text",icon:"MagnifyingGlass",label:"Search",layout:"icon-only","aria-label":"Search",className:"uds-menu_search__button"}),e.jsx("div",{className:"uds-menu_search__field",children:e.jsx(le.default,{type:"text",placeholder:"Search",icon:"MagnifyingGlass",iconPosition:"right",className:"uds-menu_search__input",size:"compact"})})]}),J&&C.length>0&&S&&e.jsxs("div",{className:"uds-menu_brands",children:[e.jsx(b.default,{appearance:"text",icon:"PlusCircle",label:"Brand",layout:"icon-only","aria-label":"Switch brand",className:"uds-menu_brands__button"}),e.jsx("div",{className:"uds-menu_brands__dropdown",children:e.jsx(ie.default,{options:C.map(a=>({value:a,label:a})),value:M,onChange:a=>{typeof a=="string"&&S(a)},placeholder:"Select brand",placement:"bottom-start",size:"compact"})})]}),U&&e.jsx("nav",{className:"uds-menu_nav",children:se}),V&&h&&e.jsx("div",{className:"uds-menu_footer",children:e.jsxs("div",{className:"uds-menu_mode",children:[e.jsx(b.default,{appearance:"text",icon:m==="light"?"Sun":"Moon",label:m==="light"?"Light mode":"Dark mode",layout:"icon-only",size:"default","aria-label":"Toggle light/dark mode",className:"uds-menu_mode__button",onClick:()=>L(m==="light"?"dark":"light")}),e.jsxs("div",{className:"uds-menu_mode__controls",children:[e.jsx(p.default,{name:m==="light"?"Sun":"Moon",size:20,appearance:"duotone"}),e.jsx("span",{className:"uds-menu_mode__label",children:m==="light"?"Light":"Dark"}),e.jsx(ce.default,{checked:m==="dark",onChange:a=>L(a?"dark":"light"),className:"uds-menu_mode__toggle"})]})]})}),H&&e.jsxs("div",{className:"uds-menu_account",children:[e.jsx(te.default,{src:Q,initials:K,alt:g?`${g} avatar`:"User avatar",size:"default"}),i&&e.jsxs(e.Fragment,{children:[e.jsx(ue.Text,{as:"p",variant:"body-16",weight:"semibold",leading:"regular",className:"uds-menu_account__name",children:g}),e.jsx(re.default,{placement:"top-start",items:ee,trigger:e.jsx(b.default,{appearance:"text",icon:e.jsx(p.default,{name:"DotsThreeVertical",appearance:"bold"}),label:"Account Menu",layout:"icon-only","aria-label":"Account menu"})})]})]})]})}B.defaultProps={title:"Menu"};const _e=n.memo(B);exports.default=_e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),n=require("react");;/* empty css */const A=require("react-router-dom"),p=require("../Icon/Icon.cjs"),te=require("../Avatar/Avatar.cjs"),b=require("../Button/Button.cjs"),le=require("../TextInput/TextInput.cjs"),P=require("../Branding/Branding.cjs"),ie=require("../Dropdown/Dropdown.cjs"),ce=require("../Toggle/Toggle.cjs"),re=require("../ActionMenu/ActionMenu.cjs"),ue=require("../Text/Text.cjs"),oe=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return typeof l.label=="string"&&typeof l.path=="string"},de=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return!(typeof l.label!="string"||typeof l.icon!="string"||l.path!==void 0&&typeof l.path!="string"||l.children!==void 0&&(!Array.isArray(l.children)||!l.children.every(oe)))},me=t=>t==="dark"?"dark":"light";function B({title:t,className:l="",navItems:q=[],brands:w=[],activeBrand:z,onBrandChange:S,activeMode:R,onModeChange:h,showBrand:F=!0,showSearch:G=!1,showBrandSwitcher:J=!0,showNav:U=!0,showModeToggle:V=!0,showUser:H=!0,userName:g="Jane Doe",userInitials:K="JD",userAvatarSrc:Q,accountMenuItems:y=[],identity:W="design-system",defaultExpanded:X=!0}){var O;const x=n.useContext(A.UNSAFE_LocationContext),N=!!x,d=((O=x==null?void 0:x.location)==null?void 0:O.pathname)??(typeof window<"u"?window.location.pathname:"/"),[I,k]=n.useState({}),[i,T]=n.useState(X),[v,Y]=n.useState(24),u=n.useMemo(()=>q.filter(de),[q]),C=n.useMemo(()=>w.filter(a=>typeof a=="string"),[w]),Z=typeof t=="string"?t:"Menu",M=typeof z=="string"?z:C[0],D=M==="default"?"design-system":M??W,m=me(R),ee=n.useMemo(()=>Array.isArray(y)?y:[],[y]);n.useEffect(()=>{if(u.length<=v)return;const a=()=>Y(u.length);if(typeof requestIdleCallback=="function"){const r=requestIdleCallback(a);return()=>cancelIdleCallback(r)}const s=window.setTimeout(a,50);return()=>window.clearTimeout(s)},[u.length,v]),n.useEffect(()=>{const a=u.filter(s=>Array.isArray(s.children)&&s.children.some(r=>d===r.path)).map(s=>s.label);a.length!==0&&k(s=>{let r=!1;const o={...s};return a.forEach(j=>{o[j]||(o[j]=!0,r=!0)}),r?o:s})},[u,d]);const $=n.useCallback(a=>{k(s=>({...s,[a]:!s[a]}))},[]),ae=n.useCallback(()=>T(a=>!a),[]),_=n.useCallback(()=>T(!0),[]),ne=n.useCallback(a=>{i||(a.preventDefault(),a.stopPropagation(),_())},[_,i]),E=n.useCallback(a=>{if(!i){_(),k(s=>({...s,[a]:!0}));return}$(a)},[_,i,$]),f=n.useCallback(()=>{i||_()},[_,i]),L=n.useCallback(a=>h==null?void 0:h(a),[h]),se=n.useMemo(()=>u.slice(0,v).map(a=>{const s=a.children??[],r=s.length>0,o=I[a.label],j=i&&o;return r?e.jsxs("div",{className:`uds-menu_nav__item uds-menu_nav__item--accordion${o?" uds-menu_nav__item--open":""}`,children:[e.jsxs("button",{type:"button",className:"uds-menu_nav__item-link",onClick:()=>E(a.label),title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label}),e.jsx("span",{className:`uds-menu_nav__item-caret${o?" uds-menu_nav__item-caret--open":""}`,children:e.jsx(p.default,{name:"CaretDown",size:16})})]}),j?e.jsx("div",{className:"uds-menu_nav__children uds-menu_nav__children--open",children:s.map(c=>N?e.jsx(A.Link,{className:`uds-menu_nav__child-link${d===c.path?" uds-menu_nav__child-link--active":""}`,to:c.path,onClick:f,title:c.label,children:c.label},c.path):e.jsx("a",{className:`uds-menu_nav__child-link${d===c.path?" uds-menu_nav__child-link--active":""}`,href:c.path,onClick:f,title:c.label,children:c.label},c.path))}):null]},a.label):e.jsx("div",{className:`uds-menu_nav__item${d===a.path?" uds-menu_nav__item--active":""}`,children:N?e.jsxs(A.Link,{className:"uds-menu_nav__item-link",to:a.path??"/",onClick:f,title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label})]}):e.jsxs("a",{className:"uds-menu_nav__item-link",href:a.path??"/",onClick:f,title:a.label,children:[e.jsx("span",{className:"uds-menu_nav__item-icon",children:e.jsx(p.default,{name:a.icon,size:24,appearance:"duotone"})}),e.jsx("div",{className:"uds-menu_nav__item-label",children:a.label})]})},a.path??a.label)}),[u,v,I,i,E,f,N,d]);return e.jsxs("aside",{className:`uds-menu${i?" uds-menu--expanded":""} ${l}`,"aria-label":Z,onClickCapture:ne,children:[F&&e.jsxs("div",{className:"uds-menu_brand",children:[e.jsx(b.default,{appearance:"text",icon:"List",size:"default",label:i?"Collapse menu":"Expand menu",layout:"icon-only","aria-label":i?"Collapse menu":"Expand menu",className:"uds-menu_brand__toggle",onClick:ae}),e.jsx("div",{className:"uds-menu_brand__symbol",children:e.jsx(P.default,{brand:D,symbol:!0})}),e.jsx("div",{className:"uds-menu_brand__full",children:e.jsx(P.default,{brand:D})})]}),G&&e.jsxs("div",{className:"uds-menu_search",children:[e.jsx(b.default,{appearance:"text",icon:"MagnifyingGlass",label:"Search",layout:"icon-only","aria-label":"Search",className:"uds-menu_search__button"}),e.jsx("div",{className:"uds-menu_search__field",children:e.jsx(le.default,{type:"text",placeholder:"Search",icon:"MagnifyingGlass",iconPosition:"right",className:"uds-menu_search__input",size:"compact"})})]}),J&&C.length>0&&S&&e.jsxs("div",{className:"uds-menu_brands",children:[e.jsx(b.default,{appearance:"text",icon:"PlusCircle",label:"Brand",layout:"icon-only","aria-label":"Switch brand",className:"uds-menu_brands__button"}),e.jsx("div",{className:"uds-menu_brands__dropdown",children:e.jsx(ie.default,{options:C.map(a=>({value:a,label:a})),value:M,onChange:a=>{typeof a=="string"&&S(a)},placeholder:"Select brand",placement:"bottom-start",size:"compact"})})]}),U&&e.jsx("nav",{className:"uds-menu_nav",children:se}),V&&h&&e.jsx("div",{className:"uds-menu_footer",children:e.jsxs("div",{className:"uds-menu_mode",children:[e.jsx(b.default,{appearance:"text",icon:m==="light"?"Sun":"Moon",label:m==="light"?"Light mode":"Dark mode",layout:"icon-only",size:"default","aria-label":"Toggle light/dark mode",className:"uds-menu_mode__button",onClick:()=>L(m==="light"?"dark":"light")}),e.jsxs("div",{className:"uds-menu_mode__controls",children:[e.jsx(p.default,{name:m==="light"?"Sun":"Moon",size:20,appearance:"duotone"}),e.jsx("span",{className:"uds-menu_mode__label",children:m==="light"?"Light":"Dark"}),e.jsx(ce.default,{checked:m==="dark",onChange:a=>L(a?"dark":"light"),className:"uds-menu_mode__toggle"})]})]})}),H&&e.jsxs("div",{className:"uds-menu_account",children:[e.jsx(te.default,{src:Q,initials:K,alt:g?`${g} avatar`:"User avatar",size:"default"}),i&&e.jsxs(e.Fragment,{children:[e.jsx(ue.Text,{as:"p",variant:"body-16",weight:"semibold",leading:"regular",className:"uds-menu_account__name",children:g}),e.jsx(re.default,{placement:"top-start",items:ee,trigger:e.jsx(b.default,{appearance:"text",icon:e.jsx(p.default,{name:"DotsThreeVertical",appearance:"bold"}),label:"Account Menu",layout:"icon-only","aria-label":"Account menu"})})]})]})]})}B.defaultProps={title:"Menu"};const _e=n.memo(B);exports.default=_e;
@@ -1 +1 @@
1
- import{jsxs as i,jsx as n,Fragment as ce}from"react/jsx-runtime";import R,{useState as I,useMemo as k,useEffect as F,useCallback as u}from"react";/* empty css */import{UNSAFE_LocationContext as de,Link as G}from"react-router-dom";import h from"../Icon/Icon.js";import ue from"../Avatar/Avatar.js";import v from"../Button/Button.js";import me from"../TextInput/TextInput.js";import J from"../Branding/Branding.js";import _e from"../Dropdown/Dropdown.js";import pe from"../Toggle/Toggle.js";import he from"../ActionMenu/ActionMenu.js";import{Text as fe}from"../Text/Text.js";const be=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return typeof l.label=="string"&&typeof l.path=="string"},ve=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return!(typeof l.label!="string"||typeof l.icon!="string"||l.path!==void 0&&typeof l.path!="string"||l.children!==void 0&&(!Array.isArray(l.children)||!l.children.every(be)))},ge=t=>t==="dark"?"dark":"light";function U({title:t,className:l="",navItems:S=[],brands:D=[],activeBrand:$,onBrandChange:T,activeMode:V,onModeChange:f,showBrand:H=!0,showSearch:K=!0,showBrandSwitcher:Q=!0,showNav:W=!0,showModeToggle:X=!0,showUser:Y=!0,userName:C="Jane Doe",userInitials:Z="JD",userAvatarSrc:ee,accountMenuItems:A=[],identity:ne="design-system",defaultExpanded:ae=!0}){var q;const g=R.useContext(de),x=!!g,m=((q=g==null?void 0:g.location)==null?void 0:q.pathname)??(typeof window<"u"?window.location.pathname:"/"),[E,M]=I({}),[s,L]=I(ae),[N,te]=I(24),c=k(()=>S.filter(ve),[S]),w=k(()=>D.filter(e=>typeof e=="string"),[D]),le=typeof t=="string"?t:"Menu",z=typeof $=="string"?$:w[0],j=z==="default"?"design-system":z??ne,_=ge(V),se=k(()=>Array.isArray(A)?A:[],[A]);F(()=>{if(c.length<=N)return;const e=()=>te(c.length);if(typeof requestIdleCallback=="function"){const o=requestIdleCallback(e);return()=>cancelIdleCallback(o)}const a=window.setTimeout(e,50);return()=>window.clearTimeout(a)},[c.length,N]),F(()=>{const e=c.filter(a=>Array.isArray(a.children)&&a.children.some(o=>m===o.path)).map(a=>a.label);e.length!==0&&M(a=>{let o=!1;const d={...a};return e.forEach(y=>{d[y]||(d[y]=!0,o=!0)}),o?d:a})},[c,m]);const B=u(e=>{M(a=>({...a,[e]:!a[e]}))},[]),ie=u(()=>L(e=>!e),[]),p=u(()=>L(!0),[]),re=u(e=>{s||(e.preventDefault(),e.stopPropagation(),p())},[p,s]),O=u(e=>{if(!s){p(),M(a=>({...a,[e]:!0}));return}B(e)},[p,s,B]),b=u(()=>{s||p()},[p,s]),P=u(e=>f==null?void 0:f(e),[f]),oe=k(()=>c.slice(0,N).map(e=>{const a=e.children??[],o=a.length>0,d=E[e.label],y=s&&d;return o?i("div",{className:`uds-menu_nav__item uds-menu_nav__item--accordion${d?" uds-menu_nav__item--open":""}`,children:[i("button",{type:"button",className:"uds-menu_nav__item-link",onClick:()=>O(e.label),title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label}),n("span",{className:`uds-menu_nav__item-caret${d?" uds-menu_nav__item-caret--open":""}`,children:n(h,{name:"CaretDown",size:16})})]}),y?n("div",{className:"uds-menu_nav__children uds-menu_nav__children--open",children:a.map(r=>x?n(G,{className:`uds-menu_nav__child-link${m===r.path?" uds-menu_nav__child-link--active":""}`,to:r.path,onClick:b,title:r.label,children:r.label},r.path):n("a",{className:`uds-menu_nav__child-link${m===r.path?" uds-menu_nav__child-link--active":""}`,href:r.path,onClick:b,title:r.label,children:r.label},r.path))}):null]},e.label):n("div",{className:`uds-menu_nav__item${m===e.path?" uds-menu_nav__item--active":""}`,children:x?i(G,{className:"uds-menu_nav__item-link",to:e.path??"/",onClick:b,title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label})]}):i("a",{className:"uds-menu_nav__item-link",href:e.path??"/",onClick:b,title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label})]})},e.path??e.label)}),[c,N,E,s,O,b,x,m]);return i("aside",{className:`uds-menu${s?" uds-menu--expanded":""} ${l}`,"aria-label":le,onClickCapture:re,children:[H&&i("div",{className:"uds-menu_brand",children:[n(v,{appearance:"text",icon:"List",size:"default",label:s?"Collapse menu":"Expand menu",layout:"icon-only","aria-label":s?"Collapse menu":"Expand menu",className:"uds-menu_brand__toggle",onClick:ie}),n("div",{className:"uds-menu_brand__symbol",children:n(J,{brand:j,symbol:!0})}),n("div",{className:"uds-menu_brand__full",children:n(J,{brand:j})})]}),K&&i("div",{className:"uds-menu_search",children:[n(v,{appearance:"text",icon:"MagnifyingGlass",label:"Search",layout:"icon-only","aria-label":"Search",className:"uds-menu_search__button"}),n("div",{className:"uds-menu_search__field",children:n(me,{type:"text",placeholder:"Search",icon:"MagnifyingGlass",iconPosition:"right",className:"uds-menu_search__input",size:"compact"})})]}),Q&&w.length>0&&T&&i("div",{className:"uds-menu_brands",children:[n(v,{appearance:"text",icon:"PlusCircle",label:"Brand",layout:"icon-only","aria-label":"Switch brand",className:"uds-menu_brands__button"}),n("div",{className:"uds-menu_brands__dropdown",children:n(_e,{options:w.map(e=>({value:e,label:e})),value:z,onChange:e=>{typeof e=="string"&&T(e)},placeholder:"Select brand",placement:"bottom-start",size:"compact"})})]}),W&&n("nav",{className:"uds-menu_nav",children:oe}),X&&f&&n("div",{className:"uds-menu_footer",children:i("div",{className:"uds-menu_mode",children:[n(v,{appearance:"text",icon:_==="light"?"Sun":"Moon",label:_==="light"?"Light mode":"Dark mode",layout:"icon-only",size:"default","aria-label":"Toggle light/dark mode",className:"uds-menu_mode__button",onClick:()=>P(_==="light"?"dark":"light")}),i("div",{className:"uds-menu_mode__controls",children:[n(h,{name:_==="light"?"Sun":"Moon",size:20,appearance:"duotone"}),n("span",{className:"uds-menu_mode__label",children:_==="light"?"Light":"Dark"}),n(pe,{checked:_==="dark",onChange:e=>P(e?"dark":"light"),className:"uds-menu_mode__toggle"})]})]})}),Y&&i("div",{className:"uds-menu_account",children:[n(ue,{src:ee,initials:Z,alt:C?`${C} avatar`:"User avatar",size:"default"}),s&&i(ce,{children:[n(fe,{as:"p",variant:"body-16",weight:"semibold",leading:"regular",className:"uds-menu_account__name",children:C}),n(he,{placement:"top-start",items:se,trigger:n(v,{appearance:"text",icon:n(h,{name:"DotsThreeVertical",appearance:"bold"}),label:"Account Menu",layout:"icon-only","aria-label":"Account menu"})})]})]})]})}U.defaultProps={title:"Menu"};const Te=R.memo(U);export{Te as default};
1
+ import{jsxs as i,jsx as n,Fragment as ce}from"react/jsx-runtime";import R,{useState as I,useMemo as k,useEffect as F,useCallback as u}from"react";/* empty css */import{UNSAFE_LocationContext as de,Link as G}from"react-router-dom";import h from"../Icon/Icon.js";import ue from"../Avatar/Avatar.js";import v from"../Button/Button.js";import me from"../TextInput/TextInput.js";import J from"../Branding/Branding.js";import _e from"../Dropdown/Dropdown.js";import pe from"../Toggle/Toggle.js";import he from"../ActionMenu/ActionMenu.js";import{Text as fe}from"../Text/Text.js";const be=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return typeof l.label=="string"&&typeof l.path=="string"},ve=t=>{if(typeof t!="object"||t===null)return!1;const l=t;return!(typeof l.label!="string"||typeof l.icon!="string"||l.path!==void 0&&typeof l.path!="string"||l.children!==void 0&&(!Array.isArray(l.children)||!l.children.every(be)))},ge=t=>t==="dark"?"dark":"light";function U({title:t,className:l="",navItems:S=[],brands:D=[],activeBrand:$,onBrandChange:T,activeMode:V,onModeChange:f,showBrand:H=!0,showSearch:K=!1,showBrandSwitcher:Q=!0,showNav:W=!0,showModeToggle:X=!0,showUser:Y=!0,userName:C="Jane Doe",userInitials:Z="JD",userAvatarSrc:ee,accountMenuItems:A=[],identity:ne="design-system",defaultExpanded:ae=!0}){var q;const g=R.useContext(de),x=!!g,m=((q=g==null?void 0:g.location)==null?void 0:q.pathname)??(typeof window<"u"?window.location.pathname:"/"),[E,M]=I({}),[s,L]=I(ae),[N,te]=I(24),c=k(()=>S.filter(ve),[S]),w=k(()=>D.filter(e=>typeof e=="string"),[D]),le=typeof t=="string"?t:"Menu",z=typeof $=="string"?$:w[0],j=z==="default"?"design-system":z??ne,_=ge(V),se=k(()=>Array.isArray(A)?A:[],[A]);F(()=>{if(c.length<=N)return;const e=()=>te(c.length);if(typeof requestIdleCallback=="function"){const o=requestIdleCallback(e);return()=>cancelIdleCallback(o)}const a=window.setTimeout(e,50);return()=>window.clearTimeout(a)},[c.length,N]),F(()=>{const e=c.filter(a=>Array.isArray(a.children)&&a.children.some(o=>m===o.path)).map(a=>a.label);e.length!==0&&M(a=>{let o=!1;const d={...a};return e.forEach(y=>{d[y]||(d[y]=!0,o=!0)}),o?d:a})},[c,m]);const B=u(e=>{M(a=>({...a,[e]:!a[e]}))},[]),ie=u(()=>L(e=>!e),[]),p=u(()=>L(!0),[]),re=u(e=>{s||(e.preventDefault(),e.stopPropagation(),p())},[p,s]),O=u(e=>{if(!s){p(),M(a=>({...a,[e]:!0}));return}B(e)},[p,s,B]),b=u(()=>{s||p()},[p,s]),P=u(e=>f==null?void 0:f(e),[f]),oe=k(()=>c.slice(0,N).map(e=>{const a=e.children??[],o=a.length>0,d=E[e.label],y=s&&d;return o?i("div",{className:`uds-menu_nav__item uds-menu_nav__item--accordion${d?" uds-menu_nav__item--open":""}`,children:[i("button",{type:"button",className:"uds-menu_nav__item-link",onClick:()=>O(e.label),title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label}),n("span",{className:`uds-menu_nav__item-caret${d?" uds-menu_nav__item-caret--open":""}`,children:n(h,{name:"CaretDown",size:16})})]}),y?n("div",{className:"uds-menu_nav__children uds-menu_nav__children--open",children:a.map(r=>x?n(G,{className:`uds-menu_nav__child-link${m===r.path?" uds-menu_nav__child-link--active":""}`,to:r.path,onClick:b,title:r.label,children:r.label},r.path):n("a",{className:`uds-menu_nav__child-link${m===r.path?" uds-menu_nav__child-link--active":""}`,href:r.path,onClick:b,title:r.label,children:r.label},r.path))}):null]},e.label):n("div",{className:`uds-menu_nav__item${m===e.path?" uds-menu_nav__item--active":""}`,children:x?i(G,{className:"uds-menu_nav__item-link",to:e.path??"/",onClick:b,title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label})]}):i("a",{className:"uds-menu_nav__item-link",href:e.path??"/",onClick:b,title:e.label,children:[n("span",{className:"uds-menu_nav__item-icon",children:n(h,{name:e.icon,size:24,appearance:"duotone"})}),n("div",{className:"uds-menu_nav__item-label",children:e.label})]})},e.path??e.label)}),[c,N,E,s,O,b,x,m]);return i("aside",{className:`uds-menu${s?" uds-menu--expanded":""} ${l}`,"aria-label":le,onClickCapture:re,children:[H&&i("div",{className:"uds-menu_brand",children:[n(v,{appearance:"text",icon:"List",size:"default",label:s?"Collapse menu":"Expand menu",layout:"icon-only","aria-label":s?"Collapse menu":"Expand menu",className:"uds-menu_brand__toggle",onClick:ie}),n("div",{className:"uds-menu_brand__symbol",children:n(J,{brand:j,symbol:!0})}),n("div",{className:"uds-menu_brand__full",children:n(J,{brand:j})})]}),K&&i("div",{className:"uds-menu_search",children:[n(v,{appearance:"text",icon:"MagnifyingGlass",label:"Search",layout:"icon-only","aria-label":"Search",className:"uds-menu_search__button"}),n("div",{className:"uds-menu_search__field",children:n(me,{type:"text",placeholder:"Search",icon:"MagnifyingGlass",iconPosition:"right",className:"uds-menu_search__input",size:"compact"})})]}),Q&&w.length>0&&T&&i("div",{className:"uds-menu_brands",children:[n(v,{appearance:"text",icon:"PlusCircle",label:"Brand",layout:"icon-only","aria-label":"Switch brand",className:"uds-menu_brands__button"}),n("div",{className:"uds-menu_brands__dropdown",children:n(_e,{options:w.map(e=>({value:e,label:e})),value:z,onChange:e=>{typeof e=="string"&&T(e)},placeholder:"Select brand",placement:"bottom-start",size:"compact"})})]}),W&&n("nav",{className:"uds-menu_nav",children:oe}),X&&f&&n("div",{className:"uds-menu_footer",children:i("div",{className:"uds-menu_mode",children:[n(v,{appearance:"text",icon:_==="light"?"Sun":"Moon",label:_==="light"?"Light mode":"Dark mode",layout:"icon-only",size:"default","aria-label":"Toggle light/dark mode",className:"uds-menu_mode__button",onClick:()=>P(_==="light"?"dark":"light")}),i("div",{className:"uds-menu_mode__controls",children:[n(h,{name:_==="light"?"Sun":"Moon",size:20,appearance:"duotone"}),n("span",{className:"uds-menu_mode__label",children:_==="light"?"Light":"Dark"}),n(pe,{checked:_==="dark",onChange:e=>P(e?"dark":"light"),className:"uds-menu_mode__toggle"})]})]})}),Y&&i("div",{className:"uds-menu_account",children:[n(ue,{src:ee,initials:Z,alt:C?`${C} avatar`:"User avatar",size:"default"}),s&&i(ce,{children:[n(fe,{as:"p",variant:"body-16",weight:"semibold",leading:"regular",className:"uds-menu_account__name",children:C}),n(he,{placement:"top-start",items:se,trigger:n(v,{appearance:"text",icon:n(h,{name:"DotsThreeVertical",appearance:"bold"}),label:"Account Menu",layout:"icon-only","aria-label":"Account menu"})})]})]})]})}U.defaultProps={title:"Menu"};const Te=R.memo(U);export{Te as default};
@@ -15,6 +15,8 @@ export interface FlexProps extends React.HTMLAttributes<HTMLElement> {
15
15
  bottom?: boolean;
16
16
  left?: boolean;
17
17
  right?: boolean;
18
+ itemsPerRow?: number;
19
+ ItemsPerRow?: number;
18
20
  wrap?: boolean | FlexWrap;
19
21
  gap?: FlexGapToken | FlexGapTokenName | FlexGapSpecial | number | string;
20
22
  fullWidth?: boolean;