@contractspec/lib.design-system 4.4.2 → 4.4.3
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.
package/README.md
CHANGED
|
@@ -236,9 +236,10 @@ region, and optional floating `PageOutline`. The outline does not reserve a
|
|
|
236
236
|
right-side content column: it reduces to a slim rail while inactive and expands
|
|
237
237
|
on hover or keyboard focus, keeping wide page content centered. The desktop
|
|
238
238
|
topbar is inset beside the sidebar and includes a sidebar toggle. On small web
|
|
239
|
-
screens, navigation
|
|
240
|
-
|
|
241
|
-
navigation
|
|
239
|
+
screens, navigation moves behind an accessible menu trigger and AppShell hides
|
|
240
|
+
the page outline to preserve layout stability. On native, the shell maps primary
|
|
241
|
+
navigation to bottom tabs and keeps overflow navigation, actions, user content,
|
|
242
|
+
and page outline inside the menu sheet.
|
|
242
243
|
|
|
243
244
|
`AppShell` also accepts a prop-driven `notifications` center for in-app
|
|
244
245
|
notifications. Hosts provide structural `items`, `unreadCount`, loading/empty
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as
|
|
1
|
+
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as N,DialogContent as O,DialogHeader as S,DialogTitle as p}from"@contractspec/lib.ui-kit-web/ui/dialog";import{SidebarInset as H,SidebarProvider as b,SidebarTrigger as g}from"@contractspec/lib.ui-kit-web/ui/sidebar";import{cn as U}from"@contractspec/lib.ui-kit-web/ui/utils";import{MenuIcon as v}from"lucide-react";import*as w from"react";import{Button as y}from"../atoms/Button";import{NavBrand as u}from"../atoms/NavBrand";import{Breadcrumbs as h}from"../molecules/Breadcrumbs";import{CommandSearchTrigger as _}from"../molecules/CommandSearchTrigger";import{PageOutline as x}from"./PageOutline";import{ShellNotifications as f}from"./ShellNotifications";import{ShellSidebar as l}from"./ShellSidebar";function j({sections:q,activeHref:G}){return k("nav",{className:"flex flex-col gap-5","aria-label":"Application navigation",children:q.map((F,J)=>z("div",{className:"flex flex-col gap-2",children:[F.title&&k("div",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:F.title}),k("div",{className:"flex flex-col gap-1",children:F.items.map((A)=>k(E,{item:A,activeHref:G},A.key??A.href??String(A.label)))})]},F.key??J))})}function E({item:q,activeHref:G,depth:F=0}){const J=q.active||Boolean(q.href)&&Boolean(G)&&(q.match==="startsWith"?G?.startsWith(q.href??""):G===q.href),A=z("span",{className:U("inline-flex min-w-0 items-center gap-2",F>0&&"pl-4"),children:[q.icon,k("span",{className:"truncate",children:q.label}),q.badge?k("span",{className:"ml-auto text-muted-foreground text-xs",children:q.badge}):null]}),Q=q.disabled||q.policyDecision?.effect==="deny";return z("div",{className:"flex flex-col gap-1",children:[q.href&&!Q?k("a",{href:q.href,target:q.target,"aria-current":J?"page":void 0,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground",J&&"bg-accent font-medium text-accent-foreground"),children:A}):k("button",{type:"button","aria-disabled":Q||void 0,disabled:Q,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",J&&"bg-accent font-medium text-accent-foreground"),children:A}),q.children?.length?k("div",{className:"flex flex-col gap-1",children:q.children.map((K)=>k(E,{item:K,activeHref:G,depth:F+1},K.key??K.href??String(K.label)))}):null]})}export function AppShell({brand:q,logo:G,title:F,homeHref:J,navigation:A=[],commands:Q=[],notifications:K,breadcrumbs:X=[],pageOutline:Y=[],activeHref:Z,activeOutlineId:L,userMenu:V,topbarStart:P,topbarEnd:D,children:B,className:I,contentClassName:T,onNavigate:d}){const[C,$]=w.useState(!1),R=q??k(u,{href:J,logo:G,title:F}),W=(M=!1)=>Q.length?k(_,{groups:Q,placeholder:"Search or run action...",compact:M}):null;return z("div",{className:U("min-h-svh bg-background",I),children:[z(b,{children:[k(l,{sections:A,brand:R,commandTrigger:W(),footer:V,activeHref:Z,withProvider:!1}),z(H,{className:"min-h-svh min-w-0",children:[k("header",{className:"sticky top-0 z-30 border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60",children:z("div",{className:"flex h-14 min-w-0 items-center gap-3 px-3 md:px-4",children:[k(y,{variant:"ghost",size:"icon",className:"md:hidden",ariaLabelI18n:"Open navigation",onPress:()=>$(!0),children:k(v,{className:"h-4 w-4"})}),k(g,{"aria-label":"Toggle sidebar",className:"hidden md:inline-flex"}),k("div",{className:"min-w-0 md:hidden",children:R}),k("div",{className:"hidden min-w-0 md:block",children:P}),k("div",{className:"min-w-0 flex-1 overflow-hidden",children:X.length?k(h,{items:X}):null}),k("div",{className:"hidden shrink-0 md:block",children:W()}),z("div",{className:"flex shrink-0 items-center gap-2",children:[K?k(f,{notifications:K}):null,D,V]})]})}),z("div",{className:"min-h-0 flex-1",children:[k("div",{className:U("min-w-0 px-4 py-5 md:px-6",T),children:B}),Y.length?k("aside",{className:"hidden xl:block",children:k(x,{items:Y,activeId:L,variant:"floating"})}):null]})]})]}),k(N,{open:C,onOpenChange:$,children:z(O,{className:"max-h-[85svh] overflow-auto sm:max-w-sm",children:[k(S,{children:k(p,{children:"Menu"})}),z("div",{className:"flex flex-col gap-4",children:[W(),k(j,{sections:A,activeHref:Z}),V]})]})})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as
|
|
1
|
+
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as N,DialogContent as O,DialogHeader as S,DialogTitle as p}from"@contractspec/lib.ui-kit-web/ui/dialog";import{SidebarInset as H,SidebarProvider as b,SidebarTrigger as g}from"@contractspec/lib.ui-kit-web/ui/sidebar";import{cn as U}from"@contractspec/lib.ui-kit-web/ui/utils";import{MenuIcon as v}from"lucide-react";import*as w from"react";import{Button as y}from"../atoms/Button";import{NavBrand as u}from"../atoms/NavBrand";import{Breadcrumbs as h}from"../molecules/Breadcrumbs";import{CommandSearchTrigger as _}from"../molecules/CommandSearchTrigger";import{PageOutline as x}from"./PageOutline";import{ShellNotifications as f}from"./ShellNotifications";import{ShellSidebar as l}from"./ShellSidebar";function j({sections:q,activeHref:G}){return k("nav",{className:"flex flex-col gap-5","aria-label":"Application navigation",children:q.map((F,J)=>z("div",{className:"flex flex-col gap-2",children:[F.title&&k("div",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:F.title}),k("div",{className:"flex flex-col gap-1",children:F.items.map((A)=>k(E,{item:A,activeHref:G},A.key??A.href??String(A.label)))})]},F.key??J))})}function E({item:q,activeHref:G,depth:F=0}){const J=q.active||Boolean(q.href)&&Boolean(G)&&(q.match==="startsWith"?G?.startsWith(q.href??""):G===q.href),A=z("span",{className:U("inline-flex min-w-0 items-center gap-2",F>0&&"pl-4"),children:[q.icon,k("span",{className:"truncate",children:q.label}),q.badge?k("span",{className:"ml-auto text-muted-foreground text-xs",children:q.badge}):null]}),Q=q.disabled||q.policyDecision?.effect==="deny";return z("div",{className:"flex flex-col gap-1",children:[q.href&&!Q?k("a",{href:q.href,target:q.target,"aria-current":J?"page":void 0,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground",J&&"bg-accent font-medium text-accent-foreground"),children:A}):k("button",{type:"button","aria-disabled":Q||void 0,disabled:Q,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",J&&"bg-accent font-medium text-accent-foreground"),children:A}),q.children?.length?k("div",{className:"flex flex-col gap-1",children:q.children.map((K)=>k(E,{item:K,activeHref:G,depth:F+1},K.key??K.href??String(K.label)))}):null]})}export function AppShell({brand:q,logo:G,title:F,homeHref:J,navigation:A=[],commands:Q=[],notifications:K,breadcrumbs:X=[],pageOutline:Y=[],activeHref:Z,activeOutlineId:L,userMenu:V,topbarStart:P,topbarEnd:D,children:B,className:I,contentClassName:T,onNavigate:d}){const[C,$]=w.useState(!1),R=q??k(u,{href:J,logo:G,title:F}),W=(M=!1)=>Q.length?k(_,{groups:Q,placeholder:"Search or run action...",compact:M}):null;return z("div",{className:U("min-h-svh bg-background",I),children:[z(b,{children:[k(l,{sections:A,brand:R,commandTrigger:W(),footer:V,activeHref:Z,withProvider:!1}),z(H,{className:"min-h-svh min-w-0",children:[k("header",{className:"sticky top-0 z-30 border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60",children:z("div",{className:"flex h-14 min-w-0 items-center gap-3 px-3 md:px-4",children:[k(y,{variant:"ghost",size:"icon",className:"md:hidden",ariaLabelI18n:"Open navigation",onPress:()=>$(!0),children:k(v,{className:"h-4 w-4"})}),k(g,{"aria-label":"Toggle sidebar",className:"hidden md:inline-flex"}),k("div",{className:"min-w-0 md:hidden",children:R}),k("div",{className:"hidden min-w-0 md:block",children:P}),k("div",{className:"min-w-0 flex-1 overflow-hidden",children:X.length?k(h,{items:X}):null}),k("div",{className:"hidden shrink-0 md:block",children:W()}),z("div",{className:"flex shrink-0 items-center gap-2",children:[K?k(f,{notifications:K}):null,D,V]})]})}),z("div",{className:"min-h-0 flex-1",children:[k("div",{className:U("min-w-0 px-4 py-5 md:px-6",T),children:B}),Y.length?k("aside",{className:"hidden xl:block",children:k(x,{items:Y,activeId:L,variant:"floating"})}):null]})]})]}),k(N,{open:C,onOpenChange:$,children:z(O,{className:"max-h-[85svh] overflow-auto sm:max-w-sm",children:[k(S,{children:k(p,{children:"Menu"})}),z("div",{className:"flex flex-col gap-4",children:[W(),k(j,{sections:A,activeHref:Z}),V]})]})})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as
|
|
1
|
+
import{jsx as k,jsxs as z}from"react/jsx-runtime";import{Dialog as N,DialogContent as O,DialogHeader as S,DialogTitle as p}from"@contractspec/lib.ui-kit-web/ui/dialog";import{SidebarInset as H,SidebarProvider as b,SidebarTrigger as g}from"@contractspec/lib.ui-kit-web/ui/sidebar";import{cn as U}from"@contractspec/lib.ui-kit-web/ui/utils";import{MenuIcon as v}from"lucide-react";import*as w from"react";import{Button as y}from"../atoms/Button";import{NavBrand as u}from"../atoms/NavBrand";import{Breadcrumbs as h}from"../molecules/Breadcrumbs";import{CommandSearchTrigger as _}from"../molecules/CommandSearchTrigger";import{PageOutline as x}from"./PageOutline";import{ShellNotifications as f}from"./ShellNotifications";import{ShellSidebar as l}from"./ShellSidebar";function j({sections:q,activeHref:G}){return k("nav",{className:"flex flex-col gap-5","aria-label":"Application navigation",children:q.map((F,J)=>z("div",{className:"flex flex-col gap-2",children:[F.title&&k("div",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:F.title}),k("div",{className:"flex flex-col gap-1",children:F.items.map((A)=>k(E,{item:A,activeHref:G},A.key??A.href??String(A.label)))})]},F.key??J))})}function E({item:q,activeHref:G,depth:F=0}){const J=q.active||Boolean(q.href)&&Boolean(G)&&(q.match==="startsWith"?G?.startsWith(q.href??""):G===q.href),A=z("span",{className:U("inline-flex min-w-0 items-center gap-2",F>0&&"pl-4"),children:[q.icon,k("span",{className:"truncate",children:q.label}),q.badge?k("span",{className:"ml-auto text-muted-foreground text-xs",children:q.badge}):null]}),Q=q.disabled||q.policyDecision?.effect==="deny";return z("div",{className:"flex flex-col gap-1",children:[q.href&&!Q?k("a",{href:q.href,target:q.target,"aria-current":J?"page":void 0,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground",J&&"bg-accent font-medium text-accent-foreground"),children:A}):k("button",{type:"button","aria-disabled":Q||void 0,disabled:Q,"aria-label":q.ariaLabel,onClick:()=>q.onSelect?.(),className:U("rounded-xs px-2 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",J&&"bg-accent font-medium text-accent-foreground"),children:A}),q.children?.length?k("div",{className:"flex flex-col gap-1",children:q.children.map((K)=>k(E,{item:K,activeHref:G,depth:F+1},K.key??K.href??String(K.label)))}):null]})}export function AppShell({brand:q,logo:G,title:F,homeHref:J,navigation:A=[],commands:Q=[],notifications:K,breadcrumbs:X=[],pageOutline:Y=[],activeHref:Z,activeOutlineId:L,userMenu:V,topbarStart:P,topbarEnd:D,children:B,className:I,contentClassName:T,onNavigate:d}){const[C,$]=w.useState(!1),R=q??k(u,{href:J,logo:G,title:F}),W=(M=!1)=>Q.length?k(_,{groups:Q,placeholder:"Search or run action...",compact:M}):null;return z("div",{className:U("min-h-svh bg-background",I),children:[z(b,{children:[k(l,{sections:A,brand:R,commandTrigger:W(),footer:V,activeHref:Z,withProvider:!1}),z(H,{className:"min-h-svh min-w-0",children:[k("header",{className:"sticky top-0 z-30 border-b bg-background/95 backdrop-blur-xs supports-backdrop-filter:bg-background/60",children:z("div",{className:"flex h-14 min-w-0 items-center gap-3 px-3 md:px-4",children:[k(y,{variant:"ghost",size:"icon",className:"md:hidden",ariaLabelI18n:"Open navigation",onPress:()=>$(!0),children:k(v,{className:"h-4 w-4"})}),k(g,{"aria-label":"Toggle sidebar",className:"hidden md:inline-flex"}),k("div",{className:"min-w-0 md:hidden",children:R}),k("div",{className:"hidden min-w-0 md:block",children:P}),k("div",{className:"min-w-0 flex-1 overflow-hidden",children:X.length?k(h,{items:X}):null}),k("div",{className:"hidden shrink-0 md:block",children:W()}),z("div",{className:"flex shrink-0 items-center gap-2",children:[K?k(f,{notifications:K}):null,D,V]})]})}),z("div",{className:"min-h-0 flex-1",children:[k("div",{className:U("min-w-0 px-4 py-5 md:px-6",T),children:B}),Y.length?k("aside",{className:"hidden xl:block",children:k(x,{items:Y,activeId:L,variant:"floating"})}):null]})]})]}),k(N,{open:C,onOpenChange:$,children:z(O,{className:"max-h-[85svh] overflow-auto sm:max-w-sm",children:[k(S,{children:k(p,{children:"Menu"})}),z("div",{className:"flex flex-col gap-4",children:[W(),k(j,{sections:A,activeHref:Z}),V]})]})})]})}
|