@mich8060/unified-design-system 0.2.47 → 0.2.48

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.
@@ -44,6 +44,10 @@ export interface AppShellProps {
44
44
  /** Slot wrapper props used by AppShell compound regions. */
45
45
  export interface AppShellSectionProps {
46
46
  children?: React.ReactNode;
47
+ /** Optional width for rail regions like AppShell.SidePanel (e.g. 420 or "28rem"). */
48
+ width?: number | string;
49
+ /** Optional maximum width for rail regions like AppShell.SidePanel (e.g. 480 or "32rem"). */
50
+ maxWidth?: number | string;
47
51
  }
48
52
  type AppShellSlotName = "Menu" | "Content" | "Listview" | "Main" | "SidePanel" | "Footer";
49
53
  type AppShellSlotComponent = React.FC<AppShellSectionProps> & {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),Z=require("./layout.types.cjs"),U=require("../../components/Avatar/Avatar.cjs"),ee=require("../../components/ActionMenu/ActionMenu.cjs"),ne=require("../../components/Button/Button.cjs"),le=require("../../components/Branding/Branding.cjs"),te=require("../../components/Toolbar/Toolbar.cjs");;/* empty css */const i=l=>{const t=({children:h})=>n.jsx(n.Fragment,{children:h});return t.__appShellSlot=l,t},A=l=>{if(l&&(typeof l=="function"||typeof l=="object"&&l!==null))return l.__appShellSlot},k=i("Menu"),w=i("Content"),N=i("Listview"),L=i("Main"),q=i("SidePanel"),$=i("Footer"),d=l=>o.Children.toArray(l).some(t=>typeof t=="string"?t.trim().length>0:t!=null&&t!==!1);function ae({layout:l,slots:t,children:h,standalone:F=!1,brand:m="default",theme:P="light",className:E="",skipToContent:O=!0,skipToContentLabel:I="Skip to content",mainContentId:B,mobileBrandLabel:R,mobileUserName:f="Jane Doe",mobileUserInitials:T="JD",mobileUserAvatarSrc:z,mobileAccountMenuItems:b=[]}){const r=o.useMemo(()=>({...Z.defaultLayout,...l}),[l]),D=o.useId().replace(/[:]/g,""),_=B??`app-shell-main-${D}`,[c,g]=o.useState(!1),J=R??(m==="default"?"design-system":m),G=o.useMemo(()=>Array.isArray(b)?b:[],[b]),p=o.useCallback(()=>g(!1),[]),H=o.useCallback(()=>g(e=>!e),[]);o.useEffect(()=>{if(!c)return;const e=a=>{a.key==="Escape"&&p()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,c]);const K=o.useCallback(e=>{const a=e.target;a&&a.closest("a")&&p()},[p]);let S=null,C=null,v=null,M=null,y=null,j=null;const Q=o.Children.toArray(h);for(const e of Q){const a=A(e.type);if(e.type===k||a==="Menu"){S=e.props.children;continue}if(e.type===w||a==="Content"){C=e.props.children;continue}(e.type===$||a==="Footer")&&(j=e.props.children)}const V=o.Children.toArray(C);for(const e of V){const a=A(e.type);if(e.type===N||a==="Listview"){v=e.props.children;continue}if(e.type===L||a==="Main"){M=e.props.children;continue}(e.type===q||a==="SidePanel")&&(y=e.props.children)}const x=(t==null?void 0:t.Footer)??j,u=!F&&r.sidebar&&d(S),W=d(v),X=d(y),Y=["app-shell",`brand-${m}`,`theme-${P}`,`density-${r.density}`,`container-${r.container}`,`padding-${r.padding}`,u?"app-shell--has-nav":"app-shell--standalone",c?"app-shell--mobile-menu-open":"",E].join(" ");return n.jsxs("div",{className:Y,children:[O?n.jsx("a",{className:"app-shell__skip-link",href:`#${_}`,children:I}):null,u?n.jsx("div",{className:"app-shell__mobile-toolbar-wrap",children:n.jsx(te.Toolbar,{className:"app-shell__mobile-toolbar",left:n.jsx(ne.default,{appearance:"text",icon:"List",label:c?"Close navigation menu":"Open navigation menu",layout:"icon-only","aria-label":c?"Close navigation menu":"Open navigation menu",onClick:H}),center:n.jsx(le.default,{brand:J,symbol:!0}),right:n.jsx(ee.default,{placement:"bottom-end",items:G,trigger:n.jsx("button",{type:"button",className:"app-shell__mobile-avatar-trigger","aria-label":`${f} account menu`,children:n.jsx(U.default,{src:z,initials:T,alt:f?`${f} avatar`:"User avatar",size:"default"})})})})}):null,n.jsxs("div",{className:"app-shell__body",children:[u?n.jsx("aside",{className:"app-shell__sidebar","aria-label":"Primary",onClickCapture:K,children:S}):null,n.jsxs("div",{className:"app-shell__main",children:[n.jsxs("main",{className:"app-shell__content",id:_,tabIndex:-1,children:[W?n.jsx("aside",{className:"app-shell__listview",children:v}):null,n.jsx("section",{className:"app-shell__main-content",children:M}),X?n.jsx("aside",{className:"app-shell__side-panel",children:y}):null]}),r.footer&&d(x)?x:null]})]}),u?n.jsx("button",{type:"button",className:"app-shell__mobile-backdrop",onClick:p,"aria-label":"Close navigation menu"}):null]})}const s=ae;s.Menu=k;s.Content=w;s.Listview=N;s.Main=L;s.SidePanel=q;s.Footer=$;exports.AppShell=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),te=require("./layout.types.cjs"),ae=require("../../components/Avatar/Avatar.cjs"),se=require("../../components/ActionMenu/ActionMenu.cjs"),oe=require("../../components/Button/Button.cjs"),ie=require("../../components/Branding/Branding.cjs"),re=require("../../components/Toolbar/Toolbar.cjs");;/* empty css */const i=l=>{const t=({children:f})=>n.jsx(n.Fragment,{children:f});return t.__appShellSlot=l,t},P=l=>{if(l&&(typeof l=="function"||typeof l=="object"&&l!==null))return l.__appShellSlot},L=i("Menu"),$=i("Content"),q=i("Listview"),F=i("Main"),E=i("SidePanel"),O=i("Footer"),m=l=>s.Children.toArray(l).some(t=>typeof t=="string"?t.trim().length>0:t!=null&&t!==!1);function pe({layout:l,slots:t,children:f,standalone:W=!1,brand:b="default",theme:I="light",className:B="",skipToContent:R=!0,skipToContentLabel:T="Skip to content",mainContentId:z,mobileBrandLabel:D,mobileUserName:S="Jane Doe",mobileUserInitials:J="JD",mobileUserAvatarSrc:G,mobileAccountMenuItems:v=[]}){const r=s.useMemo(()=>({...te.defaultLayout,...l}),[l]),H=s.useId().replace(/[:]/g,""),C=z??`app-shell-main-${H}`,[p,j]=s.useState(!1),K=D??(b==="default"?"design-system":b),Q=s.useMemo(()=>Array.isArray(v)?v:[],[v]),c=s.useCallback(()=>j(!1),[]),V=s.useCallback(()=>j(e=>!e),[]);s.useEffect(()=>{if(!p)return;const e=a=>{a.key==="Escape"&&c()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,p]);const X=s.useCallback(e=>{const a=e.target;a&&a.closest("a")&&c()},[c]);let y=null,w=null,_=null,A=null,g=null,k=null,d,u;const Y=s.Children.toArray(f);for(const e of Y){const a=P(e.type);if(e.type===L||a==="Menu"){y=e.props.children;continue}if(e.type===$||a==="Content"){w=e.props.children;continue}(e.type===O||a==="Footer")&&(k=e.props.children)}const Z=s.Children.toArray(w);for(const e of Z){const a=P(e.type);if(e.type===q||a==="Listview"){_=e.props.children;continue}if(e.type===F||a==="Main"){A=e.props.children;continue}(e.type===E||a==="SidePanel")&&(g=e.props.children,d=e.props.width,u=e.props.maxWidth)}const M=typeof d=="number"?`${d}px`:d,x=typeof u=="number"?`${u}px`:u,U=M||x?{...M?{"--app-shell-side-panel-width":M}:{},...x?{"--app-shell-side-panel-max-width":x}:{}}:void 0,N=(t==null?void 0:t.Footer)??k,h=!W&&r.sidebar&&m(y),ee=m(_),ne=m(g),le=["app-shell",`brand-${b}`,`theme-${I}`,`density-${r.density}`,`container-${r.container}`,`padding-${r.padding}`,h?"app-shell--has-nav":"app-shell--standalone",p?"app-shell--mobile-menu-open":"",B].join(" ");return n.jsxs("div",{className:le,children:[R?n.jsx("a",{className:"app-shell__skip-link",href:`#${C}`,children:T}):null,h?n.jsx("div",{className:"app-shell__mobile-toolbar-wrap",children:n.jsx(re.Toolbar,{className:"app-shell__mobile-toolbar",left:n.jsx(oe.default,{appearance:"text",icon:"List",label:p?"Close navigation menu":"Open navigation menu",layout:"icon-only","aria-label":p?"Close navigation menu":"Open navigation menu",onClick:V}),center:n.jsx(ie.default,{brand:K,symbol:!0}),right:n.jsx(se.default,{placement:"bottom-end",items:Q,trigger:n.jsx("button",{type:"button",className:"app-shell__mobile-avatar-trigger","aria-label":`${S} account menu`,children:n.jsx(ae.default,{src:G,initials:J,alt:S?`${S} avatar`:"User avatar",size:"default"})})})})}):null,n.jsxs("div",{className:"app-shell__body",children:[h?n.jsx("aside",{className:"app-shell__sidebar","aria-label":"Primary",onClickCapture:X,children:y}):null,n.jsxs("div",{className:"app-shell__main",children:[n.jsxs("main",{className:"app-shell__content",id:C,tabIndex:-1,children:[ee?n.jsx("aside",{className:"app-shell__listview",children:_}):null,n.jsx("section",{className:"app-shell__main-content",children:A}),ne?n.jsx("aside",{className:"app-shell__side-panel",style:U,children:g}):null]}),r.footer&&m(N)?N:null]})]}),h?n.jsx("button",{type:"button",className:"app-shell__mobile-backdrop",onClick:c,"aria-label":"Close navigation menu"}):null]})}const o=pe;o.Menu=L;o.Content=$;o.Listview=q;o.Main=F;o.SidePanel=E;o.Footer=O;exports.AppShell=o;
@@ -1 +1 @@
1
- import{jsxs as d,jsx as n,Fragment as ne}from"react/jsx-runtime";import y,{useMemo as L,useId as te,useState as le,useCallback as g,useEffect as oe}from"react";import{defaultLayout as ae}from"./layout.types.js";import ie from"../../components/Avatar/Avatar.js";import se from"../../components/ActionMenu/ActionMenu.js";import re from"../../components/Button/Button.js";import pe from"../../components/Branding/Branding.js";import{Toolbar as ce}from"../../components/Toolbar/Toolbar.js";/* empty css */const a=t=>{const l=({children:h})=>n(ne,{children:h});return l.__appShellSlot=t,l},$=t=>{if(t&&(typeof t=="function"||typeof t=="object"&&t!==null))return t.__appShellSlot},F=a("Menu"),P=a("Content"),x=a("Listview"),E=a("Main"),j=a("SidePanel"),I=a("Footer"),u=t=>y.Children.toArray(t).some(l=>typeof l=="string"?l.trim().length>0:l!=null&&l!==!1);function de({layout:t,slots:l,children:h,standalone:O=!1,brand:m="default",theme:B="light",className:z="",skipToContent:D=!0,skipToContentLabel:J="Skip to content",mainContentId:R,mobileBrandLabel:T,mobileUserName:f="Jane Doe",mobileUserInitials:q="JD",mobileUserAvatarSrc:G,mobileAccountMenuItems:S=[]}){const s=L(()=>({...ae,...t}),[t]),H=te().replace(/[:]/g,""),C=R??`app-shell-main-${H}`,[r,M]=le(!1),K=T??(m==="default"?"design-system":m),Q=L(()=>Array.isArray(S)?S:[],[S]),p=g(()=>M(!1),[]),V=g(()=>M(e=>!e),[]);oe(()=>{if(!r)return;const e=o=>{o.key==="Escape"&&p()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,r]);const W=g(e=>{const o=e.target;o&&o.closest("a")&&p()},[p]);let b=null,A=null,v=null,w=null,_=null,N=null;const X=y.Children.toArray(h);for(const e of X){const o=$(e.type);if(e.type===F||o==="Menu"){b=e.props.children;continue}if(e.type===P||o==="Content"){A=e.props.children;continue}(e.type===I||o==="Footer")&&(N=e.props.children)}const Y=y.Children.toArray(A);for(const e of Y){const o=$(e.type);if(e.type===x||o==="Listview"){v=e.props.children;continue}if(e.type===E||o==="Main"){w=e.props.children;continue}(e.type===j||o==="SidePanel")&&(_=e.props.children)}const k=(l==null?void 0:l.Footer)??N,c=!O&&s.sidebar&&u(b),Z=u(v),U=u(_),ee=["app-shell",`brand-${m}`,`theme-${B}`,`density-${s.density}`,`container-${s.container}`,`padding-${s.padding}`,c?"app-shell--has-nav":"app-shell--standalone",r?"app-shell--mobile-menu-open":"",z].join(" ");return d("div",{className:ee,children:[D?n("a",{className:"app-shell__skip-link",href:`#${C}`,children:J}):null,c?n("div",{className:"app-shell__mobile-toolbar-wrap",children:n(ce,{className:"app-shell__mobile-toolbar",left:n(re,{appearance:"text",icon:"List",label:r?"Close navigation menu":"Open navigation menu",layout:"icon-only","aria-label":r?"Close navigation menu":"Open navigation menu",onClick:V}),center:n(pe,{brand:K,symbol:!0}),right:n(se,{placement:"bottom-end",items:Q,trigger:n("button",{type:"button",className:"app-shell__mobile-avatar-trigger","aria-label":`${f} account menu`,children:n(ie,{src:G,initials:q,alt:f?`${f} avatar`:"User avatar",size:"default"})})})})}):null,d("div",{className:"app-shell__body",children:[c?n("aside",{className:"app-shell__sidebar","aria-label":"Primary",onClickCapture:W,children:b}):null,d("div",{className:"app-shell__main",children:[d("main",{className:"app-shell__content",id:C,tabIndex:-1,children:[Z?n("aside",{className:"app-shell__listview",children:v}):null,n("section",{className:"app-shell__main-content",children:w}),U?n("aside",{className:"app-shell__side-panel",children:_}):null]}),s.footer&&u(k)?k:null]})]}),c?n("button",{type:"button",className:"app-shell__mobile-backdrop",onClick:p,"aria-label":"Close navigation menu"}):null]})}const i=de;i.Menu=F;i.Content=P;i.Listview=x;i.Main=E;i.SidePanel=j;i.Footer=I;export{i as AppShell};
1
+ import{jsxs as h,jsx as n,Fragment as ie}from"react/jsx-runtime";import A,{useMemo as F,useId as se,useState as re,useCallback as w,useEffect as pe}from"react";import{defaultLayout as ce}from"./layout.types.js";import de from"../../components/Avatar/Avatar.js";import ue from"../../components/ActionMenu/ActionMenu.js";import he from"../../components/Button/Button.js";import me from"../../components/Branding/Branding.js";import{Toolbar as fe}from"../../components/Toolbar/Toolbar.js";/* empty css */const a=t=>{const l=({children:f})=>n(ie,{children:f});return l.__appShellSlot=t,l},E=t=>{if(t&&(typeof t=="function"||typeof t=="object"&&t!==null))return t.__appShellSlot},W=a("Menu"),j=a("Content"),I=a("Listview"),O=a("Main"),B=a("SidePanel"),z=a("Footer"),m=t=>A.Children.toArray(t).some(l=>typeof l=="string"?l.trim().length>0:l!=null&&l!==!1);function Se({layout:t,slots:l,children:f,standalone:D=!1,brand:S="default",theme:J="light",className:R="",skipToContent:T=!0,skipToContentLabel:q="Skip to content",mainContentId:G,mobileBrandLabel:H,mobileUserName:v="Jane Doe",mobileUserInitials:K="JD",mobileUserAvatarSrc:Q,mobileAccountMenuItems:b=[]}){const s=F(()=>({...ce,...t}),[t]),V=se().replace(/[:]/g,""),N=G??`app-shell-main-${V}`,[r,k]=re(!1),X=H??(S==="default"?"design-system":S),Y=F(()=>Array.isArray(b)?b:[],[b]),p=w(()=>k(!1),[]),Z=w(()=>k(e=>!e),[]);pe(()=>{if(!r)return;const e=o=>{o.key==="Escape"&&p()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,r]);const U=w(e=>{const o=e.target;o&&o.closest("a")&&p()},[p]);let y=null,L=null,_=null,P=null,g=null,x=null,c,d;const ee=A.Children.toArray(f);for(const e of ee){const o=E(e.type);if(e.type===W||o==="Menu"){y=e.props.children;continue}if(e.type===j||o==="Content"){L=e.props.children;continue}(e.type===z||o==="Footer")&&(x=e.props.children)}const ne=A.Children.toArray(L);for(const e of ne){const o=E(e.type);if(e.type===I||o==="Listview"){_=e.props.children;continue}if(e.type===O||o==="Main"){P=e.props.children;continue}(e.type===B||o==="SidePanel")&&(g=e.props.children,c=e.props.width,d=e.props.maxWidth)}const M=typeof c=="number"?`${c}px`:c,C=typeof d=="number"?`${d}px`:d,te=M||C?{...M?{"--app-shell-side-panel-width":M}:{},...C?{"--app-shell-side-panel-max-width":C}:{}}:void 0,$=(l==null?void 0:l.Footer)??x,u=!D&&s.sidebar&&m(y),le=m(_),oe=m(g),ae=["app-shell",`brand-${S}`,`theme-${J}`,`density-${s.density}`,`container-${s.container}`,`padding-${s.padding}`,u?"app-shell--has-nav":"app-shell--standalone",r?"app-shell--mobile-menu-open":"",R].join(" ");return h("div",{className:ae,children:[T?n("a",{className:"app-shell__skip-link",href:`#${N}`,children:q}):null,u?n("div",{className:"app-shell__mobile-toolbar-wrap",children:n(fe,{className:"app-shell__mobile-toolbar",left:n(he,{appearance:"text",icon:"List",label:r?"Close navigation menu":"Open navigation menu",layout:"icon-only","aria-label":r?"Close navigation menu":"Open navigation menu",onClick:Z}),center:n(me,{brand:X,symbol:!0}),right:n(ue,{placement:"bottom-end",items:Y,trigger:n("button",{type:"button",className:"app-shell__mobile-avatar-trigger","aria-label":`${v} account menu`,children:n(de,{src:Q,initials:K,alt:v?`${v} avatar`:"User avatar",size:"default"})})})})}):null,h("div",{className:"app-shell__body",children:[u?n("aside",{className:"app-shell__sidebar","aria-label":"Primary",onClickCapture:U,children:y}):null,h("div",{className:"app-shell__main",children:[h("main",{className:"app-shell__content",id:N,tabIndex:-1,children:[le?n("aside",{className:"app-shell__listview",children:_}):null,n("section",{className:"app-shell__main-content",children:P}),oe?n("aside",{className:"app-shell__side-panel",style:te,children:g}):null]}),s.footer&&m($)?$:null]})]}),u?n("button",{type:"button",className:"app-shell__mobile-backdrop",onClick:p,"aria-label":"Close navigation menu"}):null]})}const i=Se;i.Menu=W;i.Content=j;i.Listview=I;i.Main=O;i.SidePanel=B;i.Footer=z;export{i as AppShell};