@contractspec/lib.design-system 4.4.1 → 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 +6 -3
- package/dist/browser/components/shell/AppShell.js +1 -1
- package/dist/browser/components/shell/PageOutline.js +1 -1
- package/dist/components/shell/AppShell.js +1 -1
- package/dist/components/shell/PageOutline.d.ts +1 -1
- package/dist/components/shell/PageOutline.js +1 -1
- package/dist/components/shell/PageOutline.native.d.ts +1 -0
- package/dist/native/components/shell/AppShell.js +1 -1
- package/dist/native/components/shell/PageOutline.js +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -232,9 +232,12 @@ import { AppShell } from "@contractspec/lib.design-system/shell";
|
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
On desktop web, `AppShell` renders a collapsible sidebar, sticky topbar, content
|
|
235
|
-
region, and optional `PageOutline
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
region, and optional floating `PageOutline`. The outline does not reserve a
|
|
236
|
+
right-side content column: it reduces to a slim rail while inactive and expands
|
|
237
|
+
on hover or keyboard focus, keeping wide page content centered. The desktop
|
|
238
|
+
topbar is inset beside the sidebar and includes a sidebar toggle. On small web
|
|
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
|
|
238
241
|
navigation to bottom tabs and keeps overflow navigation, actions, user content,
|
|
239
242
|
and page outline inside the menu sheet.
|
|
240
243
|
|
|
@@ -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
|
|
1
|
+
import{jsx as G,jsxs as Y,Fragment as X}from"react/jsx-runtime";import{cn as M}from"@contractspec/lib.ui-kit-web/ui/utils";import*as U from"react";import{resolvePageOutlineItems as W}from"./outline";export function PageOutline({items:C,activeId:J,onNavigate:Q,ariaLabel:S="On this page",variant:B="rail",maxLevel:E=3,className:D,...H}){const K=U.useMemo(()=>W(C,E),[C,E]);if(!K.length)return null;return G("nav",{"aria-label":S,className:M("text-muted-foreground text-sm",B==="rail"&&"sticky top-20 max-h-[calc(100svh-6rem)] overflow-auto border-l pl-4",B==="compact"&&"rounded-md border p-3",B==="floating"&&"group fixed top-24 right-4 z-20 hidden max-h-[calc(100svh-7rem)] w-10 overflow-hidden rounded-md border border-transparent bg-background/70 py-2 backdrop-blur-xs transition-[width,background-color,border-color,box-shadow] duration-200 focus-within:w-64 focus-within:border-border focus-within:bg-background/95 focus-within:shadow-md hover:w-64 hover:border-border hover:bg-background/95 hover:shadow-md xl:block",D),...H,children:G("ol",{className:M("m-0 list-none space-y-1 p-0",B==="floating"&&"w-64 pr-2"),children:K.map((z)=>{const T=J===z.id,V=z.href??`#${z.id}`;return G("li",{children:G("a",{href:V,"aria-current":T?"location":void 0,onClick:()=>Q?.(z),className:M("block rounded-xs px-2 py-1 transition-colors hover:bg-accent hover:text-accent-foreground",B==="floating"&&"grid grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 overflow-hidden",B!=="floating"&&z.resolvedLevel===2&&"pl-5",B!=="floating"&&z.resolvedLevel===3&&"pl-8 text-xs",B==="floating"&&z.resolvedLevel===3&&"text-xs",T&&"bg-accent font-medium text-accent-foreground"),children:B==="floating"?Y(X,{children:[G("span",{"aria-hidden":"true",className:M("h-1.5 w-1.5 rounded-full bg-border transition-colors",z.resolvedLevel===2&&"ml-1",z.resolvedLevel===3&&"ml-2 h-1 w-1",T&&"bg-accent-foreground")}),G("span",{className:"truncate opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100",children:z.label})]}):z.label})},`${z.id}-${z.resolvedLevel}`)})})})}export function usePageOutlineActiveItem(C,J){const[Q,S]=U.useState(C[0]);U.useEffect(()=>{if(!C.length||typeof IntersectionObserver>"u")return;const B=new IntersectionObserver((E)=>{const D=E.filter((H)=>H.isIntersecting).sort((H,K)=>K.intersectionRatio-H.intersectionRatio)[0];if(D?.target.id)S(D.target.id)},J??{rootMargin:"-20% 0px -65% 0px",threshold:[0,0.25,0.5,1]});for(const E of C){const D=document.getElementById(E);if(D)B.observe(D)}return()=>B.disconnect()},[C,J]);return Q}
|
|
@@ -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]})]})})]})}
|
|
@@ -5,7 +5,7 @@ export interface PageOutlineProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
5
5
|
activeId?: string;
|
|
6
6
|
onNavigate?: (item: PageOutlineItem) => void;
|
|
7
7
|
ariaLabel?: string;
|
|
8
|
-
variant?: 'rail' | 'compact';
|
|
8
|
+
variant?: 'rail' | 'compact' | 'floating';
|
|
9
9
|
maxLevel?: PageOutlineLevel;
|
|
10
10
|
}
|
|
11
11
|
export declare function PageOutline({ items, activeId, onNavigate, ariaLabel, variant, maxLevel, className, ...props }: PageOutlineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as G,jsxs as Y,Fragment as X}from"react/jsx-runtime";import{cn as M}from"@contractspec/lib.ui-kit-web/ui/utils";import*as U from"react";import{resolvePageOutlineItems as W}from"./outline";export function PageOutline({items:C,activeId:J,onNavigate:Q,ariaLabel:S="On this page",variant:B="rail",maxLevel:E=3,className:D,...H}){const K=U.useMemo(()=>W(C,E),[C,E]);if(!K.length)return null;return G("nav",{"aria-label":S,className:M("text-muted-foreground text-sm",B==="rail"&&"sticky top-20 max-h-[calc(100svh-6rem)] overflow-auto border-l pl-4",B==="compact"&&"rounded-md border p-3",B==="floating"&&"group fixed top-24 right-4 z-20 hidden max-h-[calc(100svh-7rem)] w-10 overflow-hidden rounded-md border border-transparent bg-background/70 py-2 backdrop-blur-xs transition-[width,background-color,border-color,box-shadow] duration-200 focus-within:w-64 focus-within:border-border focus-within:bg-background/95 focus-within:shadow-md hover:w-64 hover:border-border hover:bg-background/95 hover:shadow-md xl:block",D),...H,children:G("ol",{className:M("m-0 list-none space-y-1 p-0",B==="floating"&&"w-64 pr-2"),children:K.map((z)=>{const T=J===z.id,V=z.href??`#${z.id}`;return G("li",{children:G("a",{href:V,"aria-current":T?"location":void 0,onClick:()=>Q?.(z),className:M("block rounded-xs px-2 py-1 transition-colors hover:bg-accent hover:text-accent-foreground",B==="floating"&&"grid grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 overflow-hidden",B!=="floating"&&z.resolvedLevel===2&&"pl-5",B!=="floating"&&z.resolvedLevel===3&&"pl-8 text-xs",B==="floating"&&z.resolvedLevel===3&&"text-xs",T&&"bg-accent font-medium text-accent-foreground"),children:B==="floating"?Y(X,{children:[G("span",{"aria-hidden":"true",className:M("h-1.5 w-1.5 rounded-full bg-border transition-colors",z.resolvedLevel===2&&"ml-1",z.resolvedLevel===3&&"ml-2 h-1 w-1",T&&"bg-accent-foreground")}),G("span",{className:"truncate opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100",children:z.label})]}):z.label})},`${z.id}-${z.resolvedLevel}`)})})})}export function usePageOutlineActiveItem(C,J){const[Q,S]=U.useState(C[0]);U.useEffect(()=>{if(!C.length||typeof IntersectionObserver>"u")return;const B=new IntersectionObserver((E)=>{const D=E.filter((H)=>H.isIntersecting).sort((H,K)=>K.intersectionRatio-H.intersectionRatio)[0];if(D?.target.id)S(D.target.id)},J??{rootMargin:"-20% 0px -65% 0px",threshold:[0,0.25,0.5,1]});for(const E of C){const D=document.getElementById(E);if(D)B.observe(D)}return()=>B.disconnect()},[C,J]);return Q}
|
|
@@ -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
|
|
1
|
+
import{jsx as G,jsxs as Y,Fragment as X}from"react/jsx-runtime";import{cn as M}from"@contractspec/lib.ui-kit-web/ui/utils";import*as U from"react";import{resolvePageOutlineItems as W}from"./outline";export function PageOutline({items:C,activeId:J,onNavigate:Q,ariaLabel:S="On this page",variant:B="rail",maxLevel:E=3,className:D,...H}){const K=U.useMemo(()=>W(C,E),[C,E]);if(!K.length)return null;return G("nav",{"aria-label":S,className:M("text-muted-foreground text-sm",B==="rail"&&"sticky top-20 max-h-[calc(100svh-6rem)] overflow-auto border-l pl-4",B==="compact"&&"rounded-md border p-3",B==="floating"&&"group fixed top-24 right-4 z-20 hidden max-h-[calc(100svh-7rem)] w-10 overflow-hidden rounded-md border border-transparent bg-background/70 py-2 backdrop-blur-xs transition-[width,background-color,border-color,box-shadow] duration-200 focus-within:w-64 focus-within:border-border focus-within:bg-background/95 focus-within:shadow-md hover:w-64 hover:border-border hover:bg-background/95 hover:shadow-md xl:block",D),...H,children:G("ol",{className:M("m-0 list-none space-y-1 p-0",B==="floating"&&"w-64 pr-2"),children:K.map((z)=>{const T=J===z.id,V=z.href??`#${z.id}`;return G("li",{children:G("a",{href:V,"aria-current":T?"location":void 0,onClick:()=>Q?.(z),className:M("block rounded-xs px-2 py-1 transition-colors hover:bg-accent hover:text-accent-foreground",B==="floating"&&"grid grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 overflow-hidden",B!=="floating"&&z.resolvedLevel===2&&"pl-5",B!=="floating"&&z.resolvedLevel===3&&"pl-8 text-xs",B==="floating"&&z.resolvedLevel===3&&"text-xs",T&&"bg-accent font-medium text-accent-foreground"),children:B==="floating"?Y(X,{children:[G("span",{"aria-hidden":"true",className:M("h-1.5 w-1.5 rounded-full bg-border transition-colors",z.resolvedLevel===2&&"ml-1",z.resolvedLevel===3&&"ml-2 h-1 w-1",T&&"bg-accent-foreground")}),G("span",{className:"truncate opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100",children:z.label})]}):z.label})},`${z.id}-${z.resolvedLevel}`)})})})}export function usePageOutlineActiveItem(C,J){const[Q,S]=U.useState(C[0]);U.useEffect(()=>{if(!C.length||typeof IntersectionObserver>"u")return;const B=new IntersectionObserver((E)=>{const D=E.filter((H)=>H.isIntersecting).sort((H,K)=>K.intersectionRatio-H.intersectionRatio)[0];if(D?.target.id)S(D.target.id)},J??{rootMargin:"-20% 0px -65% 0px",threshold:[0,0.25,0.5,1]});for(const E of C){const D=document.getElementById(E);if(D)B.observe(D)}return()=>B.disconnect()},[C,J]);return Q}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.design-system",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.3",
|
|
4
4
|
"description": "Design tokens and theming primitives",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"tree-shake": true,
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@contractspec/lib.ai-agent": "8.0.
|
|
35
|
-
"@contractspec/lib.contracts-runtime-client-react": "3.14.
|
|
36
|
-
"@contractspec/lib.contracts-spec": "6.
|
|
37
|
-
"@contractspec/lib.presentation-runtime-core": "5.2.
|
|
38
|
-
"@contractspec/lib.presentation-runtime-react": "40.0.
|
|
34
|
+
"@contractspec/lib.ai-agent": "8.0.16",
|
|
35
|
+
"@contractspec/lib.contracts-runtime-client-react": "3.14.1",
|
|
36
|
+
"@contractspec/lib.contracts-spec": "6.3.0",
|
|
37
|
+
"@contractspec/lib.presentation-runtime-core": "5.2.2",
|
|
38
|
+
"@contractspec/lib.presentation-runtime-react": "40.0.2",
|
|
39
39
|
"@contractspec/lib.schema": "3.7.14",
|
|
40
|
-
"@contractspec/lib.translation-runtime": "0.2.
|
|
41
|
-
"@contractspec/lib.ui-kit": "4.1.
|
|
42
|
-
"@contractspec/lib.ui-kit-core": "3.8.
|
|
43
|
-
"@contractspec/lib.ui-kit-web": "3.13.
|
|
40
|
+
"@contractspec/lib.translation-runtime": "0.2.1",
|
|
41
|
+
"@contractspec/lib.ui-kit": "4.1.5",
|
|
42
|
+
"@contractspec/lib.ui-kit-core": "3.8.8",
|
|
43
|
+
"@contractspec/lib.ui-kit-web": "3.13.3",
|
|
44
44
|
"@hookform/resolvers": "5.2.2",
|
|
45
45
|
"class-variance-authority": "^0.7.1",
|
|
46
46
|
"clsx": "^2.1.1",
|