@kushagradhawan/kookie-ui 0.1.44 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/sidebar.props.tsx"],
4
- "sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop.js';\nimport { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\n// Re-export base menu props for sidebar menu components\nexport {\n baseMenuContentPropDefs as sidebarContentPropDefs,\n baseMenuItemPropDefs as sidebarItemPropDefs,\n baseMenuCheckboxItemPropDefs as sidebarCheckboxItemPropDefs,\n baseMenuRadioItemPropDefs as sidebarRadioItemPropDefs,\n} from './_internal/base-menu.props.js';\n\n// Sidebar container props\nconst sizes = ['1', '2'] as const;\nconst variants = ['soft', 'outline', 'surface', 'ghost'] as const;\nconst menuVariants = ['solid', 'soft'] as const;\nconst types = ['sidebar', 'floating'] as const;\nconst sides = ['left', 'right'] as const;\nconst collapsibleModes = ['offcanvas', 'icon', 'none'] as const;\nconst layouts = ['rail', 'panel'] as const;\n\nconst sidebarPropDefs = {\n ...asChildPropDef,\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'rt-variant', values: variants, default: 'outline' },\n menuVariant: {\n type: 'enum',\n className: 'rt-menu-variant',\n values: menuVariants,\n default: 'soft',\n },\n type: { type: 'enum', className: 'rt-type', values: types, default: 'sidebar' },\n side: { type: 'enum', className: 'rt-side', values: sides, default: 'left' },\n collapsible: {\n type: 'enum',\n className: 'rt-collapsible',\n values: collapsibleModes,\n default: 'offcanvas',\n },\n layout: { type: 'enum', className: 'rt-layout', values: layouts, default: undefined },\n panelBackground: { type: 'enum', values: ['solid', 'translucent'], default: undefined },\n ...colorPropDef,\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n menuVariant: PropDef<(typeof menuVariants)[number]>;\n type: PropDef<(typeof types)[number]>;\n side: PropDef<(typeof sides)[number]>;\n collapsible: PropDef<(typeof collapsibleModes)[number]>;\n layout: PropDef<(typeof layouts)[number]>;\n panelBackground: PropDef<'solid' | 'translucent'>;\n};\n\nexport { sidebarPropDefs };\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wLAAAE,EAAA,0EAAAC,EAAAH,GAAA,IAAAI,EAA+B,qCAC/BC,EAA6B,kCAC7BC,EAAoC,0CAKpCC,EAKO,0CAGP,MAAMC,EAAQ,CAAC,IAAK,GAAG,EACjBC,EAAW,CAAC,OAAQ,UAAW,UAAW,OAAO,EACjDC,EAAe,CAAC,QAAS,MAAM,EAC/BC,EAAQ,CAAC,UAAW,UAAU,EAC9BC,EAAQ,CAAC,OAAQ,OAAO,EACxBC,EAAmB,CAAC,YAAa,OAAQ,MAAM,EAC/CC,EAAU,CAAC,OAAQ,OAAO,EAE1BZ,EAAkB,CACtB,GAAG,iBACH,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQM,EAAO,QAAS,IAAK,WAAY,EAAK,EAC5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQC,EAAU,QAAS,SAAU,EACvF,YAAa,CACX,KAAM,OACN,UAAW,kBACX,OAAQC,EACR,QAAS,MACX,EACA,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,SAAU,EAC9E,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,MAAO,EAC3E,YAAa,CACX,KAAM,OACN,UAAW,iBACX,OAAQC,EACR,QAAS,WACX,EACA,OAAQ,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQC,EAAS,QAAS,MAAU,EACpF,gBAAiB,CAAE,KAAM,OAAQ,OAAQ,CAAC,QAAS,aAAa,EAAG,QAAS,MAAU,EACtF,GAAG,eACH,GAAG,qBACL",
4
+ "sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop.js';\nimport { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\n// Re-export base menu props for sidebar menu components\nexport {\n baseMenuContentPropDefs as sidebarContentPropDefs,\n baseMenuItemPropDefs as sidebarItemPropDefs,\n baseMenuCheckboxItemPropDefs as sidebarCheckboxItemPropDefs,\n baseMenuRadioItemPropDefs as sidebarRadioItemPropDefs,\n} from './_internal/base-menu.props.js';\n\n// Sidebar container props\nconst sizes = ['1', '2'] as const;\nconst variants = ['soft', 'outline', 'surface', 'ghost'] as const;\nconst menuVariants = ['solid', 'soft'] as const;\nconst types = ['sidebar'] as const;\nconst sides = ['left', 'right'] as const;\nconst collapsibleModes = ['offcanvas', 'icon', 'none'] as const;\nconst layouts = ['rail', 'panel'] as const;\n\nconst sidebarPropDefs = {\n ...asChildPropDef,\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'rt-variant', values: variants, default: 'outline' },\n menuVariant: {\n type: 'enum',\n className: 'rt-menu-variant',\n values: menuVariants,\n default: 'soft',\n },\n type: { type: 'enum', className: 'rt-type', values: types, default: 'sidebar' },\n side: { type: 'enum', className: 'rt-side', values: sides, default: 'left' },\n collapsible: {\n type: 'enum',\n className: 'rt-collapsible',\n values: collapsibleModes,\n default: 'offcanvas',\n },\n layout: { type: 'enum', className: 'rt-layout', values: layouts, default: undefined },\n panelBackground: { type: 'enum', values: ['solid', 'translucent'], default: undefined },\n ...colorPropDef,\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n menuVariant: PropDef<(typeof menuVariants)[number]>;\n type: PropDef<(typeof types)[number]>;\n side: PropDef<(typeof sides)[number]>;\n collapsible: PropDef<(typeof collapsibleModes)[number]>;\n layout: PropDef<(typeof layouts)[number]>;\n panelBackground: PropDef<'solid' | 'translucent'>;\n};\n\nexport { sidebarPropDefs };\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wLAAAE,EAAA,0EAAAC,EAAAH,GAAA,IAAAI,EAA+B,qCAC/BC,EAA6B,kCAC7BC,EAAoC,0CAKpCC,EAKO,0CAGP,MAAMC,EAAQ,CAAC,IAAK,GAAG,EACjBC,EAAW,CAAC,OAAQ,UAAW,UAAW,OAAO,EACjDC,EAAe,CAAC,QAAS,MAAM,EAC/BC,EAAQ,CAAC,SAAS,EAClBC,EAAQ,CAAC,OAAQ,OAAO,EACxBC,EAAmB,CAAC,YAAa,OAAQ,MAAM,EAC/CC,EAAU,CAAC,OAAQ,OAAO,EAE1BZ,EAAkB,CACtB,GAAG,iBACH,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQM,EAAO,QAAS,IAAK,WAAY,EAAK,EAC5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQC,EAAU,QAAS,SAAU,EACvF,YAAa,CACX,KAAM,OACN,UAAW,kBACX,OAAQC,EACR,QAAS,MACX,EACA,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,SAAU,EAC9E,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,MAAO,EAC3E,YAAa,CACX,KAAM,OACN,UAAW,iBACX,OAAQC,EACR,QAAS,WACX,EACA,OAAQ,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQC,EAAS,QAAS,MAAU,EACpF,gBAAiB,CAAE,KAAM,OAAQ,OAAQ,CAAC,QAAS,aAAa,EAAG,QAAS,MAAU,EACtF,GAAG,eACH,GAAG,qBACL",
6
6
  "names": ["sidebar_props_exports", "__export", "sidebarPropDefs", "__toCommonJS", "import_as_child_prop", "import_color_prop", "import_high_contrast_prop", "import_base_menu_props", "sizes", "variants", "menuVariants", "types", "sides", "collapsibleModes", "layouts"]
7
7
  }
@@ -133,10 +133,10 @@ interface TriggerProps extends React.ComponentPropsWithoutRef<'button'> {
133
133
  target: PaneTarget;
134
134
  action?: TriggerAction;
135
135
  /**
136
- * If true, peeks the target on hover and clears on leave.
137
- * If set to 'collapsed', only peeks when the target is currently collapsed (recommended).
136
+ * Whether to show peek preview on hover when the target pane is collapsed.
137
+ * Defaults to false.
138
138
  */
139
- peekOnHover?: boolean | 'collapsed';
139
+ peekOnHover?: boolean;
140
140
  }
141
141
  declare const Trigger: React.ForwardRefExoticComponent<TriggerProps & React.RefAttributes<HTMLButtonElement>>;
142
142
  export { Root, Header, Left, Rail, Panel, Sidebar, Content, Inspector, Bottom, Trigger, useShell, useResponsivePresentation, type PaneMode, type SidebarMode, type ResponsivePresentation, type PaneTarget, type TriggerAction, };
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,KAAK,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACzD,KAAK,sBAAsB,GACvB,iBAAiB,GACjB,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACrF,KAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AACzC,KAAK,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AACrD,KAAK,cAAc,GACf,QAAQ,GACR,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAG5E,KAAK,qBAAqB,GACtB,WAAW,GACX,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG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AAG;AAE7E,QAAA,MAAM,OAAO,uFAEX,CAAC;AAIH,QAAA,MAAM,SAAS,EAoOV,kBAAkB,CAAC;AAKxB,QAAA,MAAM,MAAM,EAyMP,eAAe,CAAC;AAKrB,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AACjF,KAAK,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtD,UAAU,YAAa,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;IACrE,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,OAAO,wFAsFZ,CAAC;AAIF,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,yBAAyB,EACzB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";import*as e from"react";import J from"classnames";import*as G from"./sheet.js";import"./inset.js";import{VisuallyHidden as ce}from"./visually-hidden.js";const se={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},Re=e.createContext(null);function Z(){const s=e.useContext(Re);if(!s)throw new Error("Shell components must be used within <Shell.Root>");return s}const le=e.createContext(null);function Ee(){const s=e.useContext(le);if(!s)throw new Error("Shell.Handle must be used within a resizable pane");return s}const _=e.forwardRef(({className:s,children:b,...r},m)=>{const{containerRef:x,cssVarName:c,minSize:E,maxSize:h,defaultSize:P,orientation:y,edge:C,computeNext:H,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:q,snapTolerance:j,collapseThreshold:K,collapsible:I,target:V,requestCollapse:U,requestToggle:S}=Ee(),p=e.useRef(null);e.useEffect(()=>()=>{try{p.current?.()}catch{}p.current=null},[]);const u=y;return e.createElement("div",{...r,ref:m,className:J("rt-ShellResizer",s),"data-orientation":y,"data-edge":C,role:"slider","aria-orientation":u,"aria-valuemin":E,"aria-valuemax":h,"aria-valuenow":P,tabIndex:0,onPointerDown:t=>{if(!x.current)return;t.preventDefault();const f=x.current,n=t.currentTarget,$=t.pointerId;try{p.current?.()}catch{}f.setAttribute("data-resizing","");try{n.setPointerCapture($)}catch{}const R=y==="vertical"?t.clientX:t.clientY,T=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),v=o=>Math.min(Math.max(o,E),h),B=document.body,d=B.style.cursor,N=B.style.userSelect;B.style.cursor=y==="vertical"?"col-resize":"row-resize",B.style.userSelect="none",g?.(T);const D=o=>{const k=y==="vertical"?o.clientX:o.clientY,z=v(H(k,R,T));f.style.setProperty(c,`${z}px`),n.setAttribute("aria-valuenow",String(z)),a?.(z)},F=()=>{try{n.releasePointerCapture($)}catch{}window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L),window.removeEventListener("keydown",M),n.removeEventListener("lostpointercapture",L),f.removeAttribute("data-resizing"),B.style.cursor=d,B.style.userSelect=N,p.current=null},L=()=>{const o=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`);let k=o;if(q&&q.length){const z=q.reduce((Q,X)=>Math.abs(X-o)<Math.abs(Q-o)?X:Q,q[0]);Math.abs(z-o)<=(j??8)&&(k=z,f.style.setProperty(c,`${k}px`),n.setAttribute("aria-valuenow",String(k)),a?.(k))}I&&typeof K=="number"&&o<=K&&U?.(),w?.(k),F()},M=o=>{o.key==="Escape"&&(f.style.setProperty(c,`${T}px`),n.setAttribute("aria-valuenow",String(T)),w?.(T),F())};window.addEventListener("pointermove",D),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L),window.addEventListener("keydown",M),n.addEventListener("lostpointercapture",L),p.current=F},onDoubleClick:()=>{I&&S?.()},onKeyDown:t=>{if(!x.current)return;const f=x.current,n=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),$=v=>Math.min(Math.max(v,E),h),R=t.shiftKey?32:8;let T=0;if(y==="vertical"?t.key==="ArrowRight"?T=R:t.key==="ArrowLeft"&&(T=-R):t.key==="ArrowDown"?T=R:t.key==="ArrowUp"&&(T=-R),t.key==="Home"){t.preventDefault(),g?.(n);const v=$(E);f.style.setProperty(c,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),w?.(v);return}if(t.key==="End"){t.preventDefault(),g?.(n);const v=$(h);f.style.setProperty(c,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),w?.(v);return}if(T!==0){t.preventDefault(),g?.(n);const v=$(n+(C==="start"&&y==="vertical"?-T:T));f.style.setProperty(c,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),w?.(v)}}},b)});_.displayName="Shell.Handle";const pe=e.forwardRef((s,b)=>e.createElement(_,{...s,ref:b}));pe.displayName="Shell.Panel.Handle";const ue=e.forwardRef((s,b)=>e.createElement(_,{...s,ref:b}));ue.displayName="Shell.Sidebar.Handle";const fe=e.forwardRef((s,b)=>e.createElement(_,{...s,ref:b}));fe.displayName="Shell.Inspector.Handle";const me=e.forwardRef((s,b)=>e.createElement(_,{...s,ref:b}));me.displayName="Shell.Bottom.Handle";function ie(s){const{currentBreakpoint:b}=Z();return e.useMemo(()=>{if(typeof s=="string")return s;if(s[b])return s[b];const m=[...Object.keys(se)].reverse().concat("initial"),x=m.indexOf(b);for(let c=x+1;c<m.length;c++){const E=m[c];if(s[E])return s[E]}return"fixed"},[s,b])}function ge(){const[s,b]=e.useState("initial"),[r,m]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const c=Object.entries(se).map(([h,P])=>[h,window.matchMedia(P)]),E=()=>{const h=c.filter(([,y])=>y.matches).map(([y])=>y),P=h[h.length-1]??"initial";b(P),m(!0)};return E(),c.forEach(([,h])=>h.addEventListener("change",E)),()=>{c.forEach(([,h])=>h.removeEventListener("change",E))}},[]),{bp:s,ready:r}}const Se=e.forwardRef(({className:s,children:b,height:r="full",...m},x)=>{const{bp:c,ready:E}=ge(),[h,P]=e.useState("collapsed"),[y,C]=e.useState("collapsed"),[H,a]=e.useState("expanded"),[g,w]=e.useState("collapsed"),[q,j]=e.useState("collapsed"),[K,I]=e.useState(!1),[V,U]=e.useState(!1),S=e.useRef(l=>l==="collapsed"?"thin":l==="thin"?"expanded":"collapsed"),p=e.useCallback(l=>{S.current=l},[]);e.useEffect(()=>{h==="collapsed"&&C("collapsed")},[h]),e.useEffect(()=>{V&&K&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[V,K]);const[u,t]=e.useState(void 0),f=e.useCallback(l=>t(l),[]),n=e.useRef(64),$=e.useRef(288),R=e.useCallback(l=>{n.current=l},[]),T=e.useCallback(l=>{$.current=l},[]),v=e.useMemo(()=>{const l=e.Children.toArray(b),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return l.some(Y=>W(Y,oe)||W(Y,ne))},[b]),B=e.useMemo(()=>{const l=e.Children.toArray(b),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return l.some(Y=>W(Y,de))},[b]),d=e.useCallback(l=>{switch(l){case"left":case"rail":P(W=>W==="expanded"?"collapsed":"expanded");break;case"panel":h==="collapsed"?(P("expanded"),C("expanded")):C(W=>W==="expanded"?"collapsed":"expanded");break;case"sidebar":a(W=>S.current(W));break;case"inspector":w(W=>W==="expanded"?"collapsed":"expanded");break;case"bottom":j(W=>W==="expanded"?"collapsed":"expanded");break}},[h]),N=e.useCallback(l=>{switch(l){case"left":case"rail":P("expanded");break;case"panel":P("expanded"),C("expanded");break;case"sidebar":a("expanded");break;case"inspector":w("expanded");break;case"bottom":j("expanded");break}},[]),D=e.useCallback(l=>{switch(l){case"left":case"rail":P("collapsed");break;case"panel":C("collapsed");break;case"sidebar":a("collapsed");break;case"inspector":w("collapsed");break;case"bottom":j("collapsed");break}},[]),F=e.useMemo(()=>({leftMode:h,setLeftMode:P,panelMode:y,setPanelMode:C,sidebarMode:H,setSidebarMode:a,inspectorMode:g,setInspectorMode:w,bottomMode:q,setBottomMode:j,hasLeft:K,setHasLeft:I,hasSidebar:V,setHasSidebar:U,currentBreakpoint:c,currentBreakpointReady:E,leftResolvedPresentation:u,togglePane:d,expandPane:N,collapsePane:D,setSidebarToggleComputer:p,onLeftPres:f,onRailDefaults:R,onPanelDefaults:T}),[h,y,H,g,q,K,V,c,E,u,d,N,D,p,f,R,T]),L=e.Children.toArray(b),M=(l,W)=>e.isValidElement(l)&&(l.type===W||l.type?.displayName===W.displayName),o=L.filter(l=>M(l,Me)),k=L.filter(l=>M(l,oe)),z=L.filter(l=>M(l,ne)),Q=L.filter(l=>M(l,de)),X=L.filter(l=>M(l,Pe)),te=L.filter(l=>M(l,ye)),ve=L.filter(l=>M(l,be)),i=e.useMemo(()=>r==="full"?{height:"100vh"}:r==="auto"?{height:"auto"}:typeof r=="string"?{height:r}:typeof r=="number"?{height:`${r}px`}:{},[r]),[O,A]=e.useState(null),ae=e.useCallback(l=>A(l),[]),ee=e.useCallback(()=>A(null),[]);return e.createElement("div",{...m,ref:x,className:J("rt-ShellRoot",s),style:{...i,...m.style}},e.createElement(Re.Provider,{value:{...F,peekTarget:O,setPeekTarget:A,peekPane:ae,clearPeek:ee}},o,e.createElement("div",{className:"rt-ShellBody","data-peek-target":O??void 0,style:O==="rail"||O==="panel"?{"--peek-rail-width":`${n.current}px`}:void 0},v&&!B?(()=>{const l=k[0],W=l?{mode:l.props?.mode,defaultMode:l.props?.defaultMode,onModeChange:l.props?.onModeChange,presentation:l.props?.presentation,collapsible:l.props?.collapsible,onExpand:l.props?.onExpand,onCollapse:l.props?.onCollapse}:{};return e.createElement(he,{...W},k,z)})():Q,X,te),ve))});Se.displayName="Shell.Root";const Me=e.forwardRef(({className:s,height:b=64,style:r,...m},x)=>e.createElement("header",{...m,ref:x,className:J("rt-ShellHeader",s),style:{...r,"--shell-header-height":`${b}px`}}));Me.displayName="Shell.Header";const he=e.forwardRef(({className:s,presentation:b={initial:"overlay",sm:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,collapsible:c=!0,onExpand:E,onCollapse:h,children:P,style:y,...C},H)=>{const a=Z(),g=ie(b),w=g==="overlay",q=g==="stacked",j=e.useRef(null);e.useEffect(()=>{a.onLeftPres?.(g)},[a,g]);const K=e.useCallback(S=>{j.current=S,typeof H=="function"?H(S):H&&(H.current=S)},[H]);e.useEffect(()=>(a.setHasLeft(!0),()=>a.setHasLeft(!1)),[a]);const I=e.useCallback(()=>{if(typeof m=="string")return m;const S=m;if(S&&S[a.currentBreakpoint])return S[a.currentBreakpoint];const u=[...Object.keys(se)].reverse().concat("initial"),t=u.indexOf(a.currentBreakpoint);for(let f=t+1;f<u.length;f++){const n=u[f];if(S&&S[n])return S[n]}return"collapsed"},[m,a.currentBreakpoint]),V=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!a.currentBreakpointReady||V.current===a.currentBreakpoint)return;V.current=a.currentBreakpoint;const S=I();S!==a.leftMode&&a.setLeftMode(S)},[r,a.currentBreakpoint,a.currentBreakpointReady,I,a.leftMode,a.setLeftMode]),e.useEffect(()=>{r!==void 0&&a.leftMode!==r&&a.setLeftMode(r)},[r,a]),e.useEffect(()=>{r===void 0&&x?.(a.leftMode)},[a.leftMode,r,x]),e.useEffect(()=>{a.leftMode==="expanded"?E?.():h?.()},[a.leftMode,E,h]);const U=a.leftMode==="expanded";if(w){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(B,d)=>e.isValidElement(B)&&B.type===d,t=p.find(B=>u(B,oe)),f=p.find(B=>u(B,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,T=!!f,v=(R?n:0)+(a.panelMode==="expanded"&&T?$:0);return e.createElement(G.Root,{open:S,onOpenChange:B=>a.setLeftMode(B?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${v}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},P)))}if(q){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(d,N)=>e.isValidElement(d)&&d.type===N,t=p.find(d=>u(d,oe)),f=p.find(d=>u(d,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,v=!!f&&(a.panelMode==="expanded"||a.peekTarget==="panel"),B=(R?n:0)+(v?$:0);return e.createElement("div",{...C,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y},"data-open":S||void 0},P)}return e.createElement("div",{...C,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y}},P)});he.displayName="Shell.Left";const oe=e.forwardRef(({className:s,presentation:b,mode:r,defaultMode:m,onModeChange:x,expandedSize:c=64,collapsible:E,onExpand:h,onCollapse:P,children:y,style:C,...H},a)=>{const g=Z();e.useEffect(()=>{g.onRailDefaults?.(c)},[g,c]);const w=g.leftMode==="expanded";return e.createElement("div",{...H,ref:a,className:J("rt-ShellRail",s),"data-mode":g.leftMode,"data-peek":g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0,style:{...C,"--rail-size":`${c}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":w||g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0},y))});oe.displayName="Shell.Rail";const ne=e.forwardRef(({className:s,mode:b,onModeChange:r,expandedSize:m=288,minSize:x,maxSize:c,resizable:E,collapsible:h=!0,onExpand:P,onCollapse:y,onResize:C,onResizeStart:H,onResizeEnd:a,snapPoints:g,snapTolerance:w,collapseThreshold:q,paneId:j,persistence:K,children:I,style:V,...U},S)=>{const p=Z();e.useEffect(()=>{p.onPanelDefaults?.(m)},[p,m]);const u=e.useRef(null),t=e.useCallback(d=>{u.current=d,typeof S=="function"?S(d):S&&(S.current=d)},[S]),f=e.Children.toArray(I),n=f.filter(d=>e.isValidElement(d)&&d.type===pe),$=f.filter(d=>!(e.isValidElement(d)&&d.type===pe)),R=p.leftResolvedPresentation==="overlay",T=e.useMemo(()=>{if(!j||K)return K;const d=`kookie-ui:shell:panel:${j}`;return{load:()=>{if(typeof window>"u")return;const D=window.localStorage.getItem(d);return D?Number(D):void 0},save:D=>{typeof window>"u"||window.localStorage.setItem(d,String(D))}}},[j,K]);e.useEffect(()=>{let d=!0;return(async()=>{if(!E||!T?.load||R)return;const N=await T.load();d&&typeof N=="number"&&u.current&&(u.current.style.setProperty("--panel-size",`${N}px`),C?.(N))})(),()=>{d=!1}},[E,T,C,R]),e.useEffect(()=>{u.current&&R&&u.current.style.setProperty("--panel-size",`${m}px`)},[R,m]),e.useEffect(()=>{if(u.current&&p.leftResolvedPresentation!=="overlay"&&p.leftMode==="expanded"&&p.panelMode==="expanded"){const d=u.current.parentElement||null;try{d?.style.removeProperty("width")}catch{}}},[p.leftResolvedPresentation,p.leftMode,p.panelMode]);const v=p.leftMode==="expanded"&&p.panelMode==="expanded",B=E&&p.leftResolvedPresentation!=="overlay"&&v?e.createElement(le.Provider,{value:{containerRef:u,cssVarName:"--panel-size",minSize:typeof x=="number"?x:100,maxSize:typeof c=="number"?c:800,defaultSize:m,orientation:"vertical",edge:"end",computeNext:(d,N,D)=>{const F=getComputedStyle(u.current).direction==="rtl",L=d-N;return D+(F?-L:L)},onResize:C,onResizeStart:d=>{const D=u.current?.parentElement;try{D?.style.removeProperty("width")}catch{}H?.(d)},onResizeEnd:d=>{a?.(d),T?.save?.(d)},target:"panel",collapsible:!!h,snapPoints:g,snapTolerance:w??8,collapseThreshold:q,requestCollapse:()=>p.setPanelMode("collapsed"),requestToggle:()=>p.togglePane("panel")}},n.length>0?n.map((d,N)=>e.cloneElement(d,{key:d.key??N})):e.createElement(_,null)):null;return e.createElement("div",{...U,ref:t,className:J("rt-ShellPanel",s),"data-mode":p.panelMode,"data-visible":v||p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,"data-peek":p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,style:{...V,"--panel-size":`${m}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":v||void 0},$),B)});ne.displayName="Shell.Panel",ne.Handle=pe;const de=e.forwardRef(({className:s,presentation:b={initial:"overlay",md:"fixed"},mode:r,defaultMode:m="expanded",onModeChange:x,expandedSize:c=288,minSize:E=200,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:C,onCollapse:H,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:q,snapTolerance:j,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,thinSize:p=64,toggleModes:u,...t},f)=>{const n=Z(),$=ie(b),R=$==="overlay",T=$==="stacked",v=e.useRef(null),B=e.useCallback(i=>{v.current=i,typeof f=="function"?f(i):f&&(f.current=i)},[f]),d=e.Children.toArray(U),N=d.filter(i=>e.isValidElement(i)&&i.type===ue),D=d.filter(i=>!(e.isValidElement(i)&&i.type===ue)),F=e.useId();e.useEffect(()=>(n.setHasSidebar(!0),()=>{n.setHasSidebar(!1)}),[n,F]);const L=e.useRef(!1);e.useEffect(()=>{L.current||(L.current=!0,r===void 0&&n.sidebarMode!==m&&n.setSidebarMode(m))},[]),e.useEffect(()=>{r!==void 0&&n.sidebarMode!==r&&n.setSidebarMode(r)},[r,n]),e.useEffect(()=>{r===void 0&&x?.(n.sidebarMode)},[n.sidebarMode,r,x]),e.useEffect(()=>{n.sidebarMode==="expanded"?C?.():H?.()},[n.sidebarMode,C,H]);const M=n.sidebarMode!=="collapsed",o=e.useMemo(()=>{if(!I||V)return V;const i=`kookie-ui:shell:sidebar:${I}`;return{load:()=>{if(typeof window>"u")return;const A=window.localStorage.getItem(i);return A?Number(A):void 0},save:A=>{typeof window>"u"||window.localStorage.setItem(i,String(A))}}},[I,V]);e.useEffect(()=>{let i=!0;return(async()=>{if(!P||!o?.load||R)return;const O=await o.load();i&&typeof O=="number"&&v.current&&(v.current.style.setProperty("--sidebar-size",`${O}px`),a?.(O))})(),()=>{i=!1}},[P,o,a,R]);const k=Z();e.useEffect(()=>{if(!k.setSidebarToggleComputer)return;const i=u&&u.length>0?u:["thin","expanded"],O=A=>A==="collapsed"?i[0]??"expanded":A==="thin"?i.includes("thin")&&i.includes("expanded")?"expanded":"collapsed":i.length===2&&i.includes("thin")&&i.includes("expanded")?"collapsed":i.includes("thin")&&!i.includes("expanded")?"thin":"collapsed";return k.setSidebarToggleComputer(O),()=>{k.setSidebarToggleComputer?.(A=>A==="collapsed"?"thin":A==="thin"?"expanded":"collapsed")}},[k,u]);const z=e.useRef(c),Q=e.useRef("expanded");e.useEffect(()=>{n.sidebarMode!=="collapsed"&&(Q.current=n.sidebarMode,z.current=n.sidebarMode==="thin"?p:c)},[n.sidebarMode,p,c]);const X=e.useCallback(()=>{if(typeof m=="string")return m;const i=m;if(i&&i[n.currentBreakpoint])return i[n.currentBreakpoint];const A=[...Object.keys(se)].reverse().concat("initial"),ae=A.indexOf(n.currentBreakpoint);for(let ee=ae+1;ee<A.length;ee++){const l=A[ee];if(i&&i[l])return i[l]}return"collapsed"},[m,n.currentBreakpoint]),te=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!n.currentBreakpointReady||te.current===n.currentBreakpoint)return;te.current=n.currentBreakpoint;const i=X();i!==n.sidebarMode&&n.setSidebarMode(i)},[r,n.currentBreakpoint,n.currentBreakpointReady,X,n.sidebarMode,n.setSidebarMode]);const ve=P&&!R&&n.sidebarMode==="expanded"?e.createElement(le.Provider,{value:{containerRef:v,cssVarName:"--sidebar-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"end",computeNext:(i,O,A)=>{const ae=getComputedStyle(v.current).direction==="rtl",ee=i-O;return A+(ae?-ee:ee)},onResize:a,onResizeStart:g,onResizeEnd:i=>{w?.(i),o?.save?.(i)},target:"sidebar",collapsible:y,snapPoints:q,snapTolerance:j??8,collapseThreshold:K,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},N.length>0?N.map((i,O)=>e.cloneElement(i,{key:i.key??O})):e.createElement(_,null)):null;if(R){const i=n.sidebarMode!=="collapsed";return e.createElement(G.Root,{open:i,onOpenChange:O=>n.setSidebarMode(O?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${i?n.sidebarMode==="thin"?p:c:z.current}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Sidebar")),U))}return e.createElement("div",{...t,ref:B,className:J("rt-ShellSidebar",s),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":$,style:{...S,"--sidebar-size":`${c}px`,"--sidebar-thin-size":`${p}px`,"--sidebar-min-size":`${E}px`,"--sidebar-max-size":`${h}px`,...n.peekTarget==="sidebar"&&!R?(()=>{const i=u&&u.length>0?u:["thin","expanded"],O=n.sidebarMode;let A="collapsed";return O==="collapsed"?A=i[0]??"expanded":O==="thin"?A=i.includes("expanded")?"expanded":"collapsed":A=i.includes("thin")?"thin":"collapsed",{"--peek-sidebar-width":`${A==="thin"?p:c}px`}})():{}}},e.createElement("div",{className:"rt-ShellSidebarContent","data-visible":M||void 0},D),ve)});de.displayName="Shell.Sidebar",de.Handle=ue;const Pe=e.forwardRef(({className:s,...b},r)=>e.createElement("main",{...b,ref:r,className:J("rt-ShellContent",s)}));Pe.displayName="Shell.Content";const ye=e.forwardRef(({className:s,presentation:b={initial:"overlay",lg:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=320,minSize:E=200,maxSize:h=500,resizable:P=!1,collapsible:y=!0,onExpand:C,onCollapse:H,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:q,snapTolerance:j,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=ie(b),n=f==="overlay",$=f==="stacked",R=e.useRef(null),T=e.useCallback(o=>{R.current=o,typeof u=="function"?u(o):u&&(u.current=o)},[u]),v=e.Children.toArray(U),B=v.filter(o=>e.isValidElement(o)&&o.type===fe),d=v.filter(o=>!(e.isValidElement(o)&&o.type===fe)),N=e.useCallback(()=>{if(typeof m=="string")return m;const o=m;if(o&&o[t.currentBreakpoint])return o[t.currentBreakpoint];const z=[...Object.keys(se)].reverse().concat("initial"),Q=z.indexOf(t.currentBreakpoint);for(let X=Q+1;X<z.length;X++){const te=z[X];if(o&&o[te])return o[te]}return"collapsed"},[m,t.currentBreakpoint]),D=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!t.currentBreakpointReady||D.current===t.currentBreakpoint)return;D.current=t.currentBreakpoint;const o=N();o!==t.inspectorMode&&t.setInspectorMode(o)},[r,t.currentBreakpoint,t.currentBreakpointReady,N,t.inspectorMode,t.setInspectorMode]),e.useEffect(()=>{r!==void 0&&t.inspectorMode!==r&&t.setInspectorMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.inspectorMode)},[t.inspectorMode,r,x]),e.useEffect(()=>{t.inspectorMode==="expanded"?C?.():H?.()},[t.inspectorMode,C,H]);const F=t.inspectorMode==="expanded",L=e.useMemo(()=>{if(!I||V)return V;const o=`kookie-ui:shell:inspector:${I}`;return{load:()=>{if(typeof window>"u")return;const z=window.localStorage.getItem(o);return z?Number(z):void 0},save:z=>{typeof window>"u"||window.localStorage.setItem(o,String(z))}}},[I,V]);e.useEffect(()=>{let o=!0;return(async()=>{if(!P||!L?.load||n)return;const k=await L.load();o&&typeof k=="number"&&R.current&&(R.current.style.setProperty("--inspector-size",`${k}px`),a?.(k))})(),()=>{o=!1}},[P,L,a,n]);const M=P&&!n&&F?e.createElement(le.Provider,{value:{containerRef:R,cssVarName:"--inspector-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"start",computeNext:(o,k,z)=>{const Q=getComputedStyle(R.current).direction==="rtl",X=o-k;return z+(Q?X:-X)},onResize:a,onResizeStart:g,onResizeEnd:o=>{w?.(o),L?.save?.(o)},target:"inspector",collapsible:y,snapPoints:q,snapTolerance:j??8,collapseThreshold:K,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},B.length>0?B.map((o,k)=>e.cloneElement(o,{key:o.key??k})):e.createElement(_,null)):null;if(n){const o=t.inspectorMode==="expanded";return e.createElement(G.Root,{open:o,onOpenChange:k=>t.setInspectorMode(k?"expanded":"collapsed")},e.createElement(G.Content,{side:"end",style:{padding:0},width:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Inspector")),U))}return e.createElement("div",{...p,ref:T,className:J("rt-ShellInspector",s),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":f,"data-open":$&&F||void 0,style:{...S,"--inspector-size":`${c}px`,"--inspector-min-size":`${E}px`,"--inspector-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellInspectorContent","data-visible":F||void 0},d),M)});ye.displayName="Shell.Inspector",ye.Handle=fe;const be=e.forwardRef(({className:s,presentation:b="fixed",mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=200,minSize:E=100,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:C,onCollapse:H,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:q,snapTolerance:j,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=ie(b),n=f==="overlay",$=f==="stacked",R=e.useRef(null),T=e.useCallback(M=>{R.current=M,typeof u=="function"?u(M):u&&(u.current=M)},[u]),v=e.Children.toArray(U),B=v.filter(M=>e.isValidElement(M)&&M.type===me),d=v.filter(M=>!(e.isValidElement(M)&&M.type===me)),N=e.useRef(!1);e.useEffect(()=>{N.current||(N.current=!0,r===void 0&&t.bottomMode!==m&&t.setBottomMode(m))},[]),e.useEffect(()=>{r!==void 0&&t.bottomMode!==r&&t.setBottomMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.bottomMode)},[t.bottomMode,r,x]),e.useEffect(()=>{t.bottomMode==="expanded"?C?.():H?.()},[t.bottomMode,C,H]);const D=t.bottomMode==="expanded",F=e.useMemo(()=>{if(!I||V)return V;const M=`kookie-ui:shell:bottom:${I}`;return{load:()=>{if(typeof window>"u")return;const k=window.localStorage.getItem(M);return k?Number(k):void 0},save:k=>{typeof window>"u"||window.localStorage.setItem(M,String(k))}}},[I,V]);e.useEffect(()=>{let M=!0;return(async()=>{if(!P||!F?.load||n)return;const o=await F.load();M&&typeof o=="number"&&R.current&&(R.current.style.setProperty("--bottom-size",`${o}px`),a?.(o))})(),()=>{M=!1}},[P,F,a,n]);const L=P&&!n&&D?e.createElement(le.Provider,{value:{containerRef:R,cssVarName:"--bottom-size",minSize:E,maxSize:h,defaultSize:c,orientation:"horizontal",edge:"start",computeNext:(M,o,k)=>{const z=M-o;return k-z},onResize:a,onResizeStart:g,onResizeEnd:M=>{w?.(M),F?.save?.(M)},target:"bottom",collapsible:y,snapPoints:q,snapTolerance:j??8,collapseThreshold:K,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},B.length>0?B.map((M,o)=>e.cloneElement(M,{key:M.key??o})):e.createElement(_,null)):null;if(n){const M=t.bottomMode==="expanded";return e.createElement(G.Root,{open:M,onOpenChange:o=>t.setBottomMode(o?"expanded":"collapsed")},e.createElement(G.Content,{side:"bottom",style:{padding:0},height:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Bottom panel")),U))}return e.createElement("div",{...p,ref:T,className:J("rt-ShellBottom",s),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":f,"data-open":$&&D||void 0,style:{...S,"--bottom-size":`${c}px`,"--bottom-min-size":`${E}px`,"--bottom-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellBottomContent","data-visible":D||void 0},d),L)});be.displayName="Shell.Bottom",be.Handle=me;const ke=e.forwardRef(({target:s,action:b="toggle",peekOnHover:r,onClick:m,onMouseEnter:x,onMouseLeave:c,children:E,...h},P)=>{const y=Z(),C=e.useCallback(w=>{switch(m?.(w),b){case"toggle":y.togglePane(s);break;case"expand":y.expandPane(s);break;case"collapse":y.collapsePane(s);break}},[y,s,b,m]),H=(()=>{switch(s){case"left":case"rail":return y.leftMode==="collapsed";case"panel":return y.leftMode==="collapsed"||y.panelMode==="collapsed";case"sidebar":return y.sidebarMode==="collapsed";case"inspector":return y.inspectorMode==="collapsed";case"bottom":return y.bottomMode==="collapsed"}})(),a=e.useCallback(w=>{if(x?.(w),!r)return;(r==="collapsed"?H:!0)&&y.peekPane(s)},[x,r,H,y,s]),g=e.useCallback(w=>{c?.(w),r&&y.peekTarget===s&&y.clearPeek()},[c,r,y,s]);return e.createElement("button",{...h,ref:P,onClick:C,onMouseEnter:a,onMouseLeave:g,"data-shell-trigger":s,"data-shell-action":b},E)});ke.displayName="Shell.Trigger";export{be as Bottom,Pe as Content,Me as Header,ye as Inspector,he as Left,ne as Panel,oe as Rail,Se as Root,de as Sidebar,ke as Trigger,ie as useResponsivePresentation,Z as useShell};
1
+ "use client";import*as e from"react";import J from"classnames";import*as G from"./sheet.js";import"./inset.js";import{VisuallyHidden as ce}from"./visually-hidden.js";const se={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},Re=e.createContext(null);function Z(){const s=e.useContext(Re);if(!s)throw new Error("Shell components must be used within <Shell.Root>");return s}const ie=e.createContext(null);function Ee(){const s=e.useContext(ie);if(!s)throw new Error("Shell.Handle must be used within a resizable pane");return s}const _=e.forwardRef(({className:s,children:v,...r},m)=>{const{containerRef:x,cssVarName:c,minSize:E,maxSize:h,defaultSize:P,orientation:y,edge:T,computeNext:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,collapsible:I,target:V,requestCollapse:U,requestToggle:S}=Ee(),p=e.useRef(null);e.useEffect(()=>()=>{try{p.current?.()}catch{}p.current=null},[]);const u=y;return e.createElement("div",{...r,ref:m,className:J("rt-ShellResizer",s),"data-orientation":y,"data-edge":T,role:"slider","aria-orientation":u,"aria-valuemin":E,"aria-valuemax":h,"aria-valuenow":P,tabIndex:0,onPointerDown:t=>{if(!x.current)return;t.preventDefault();const f=x.current,n=t.currentTarget,$=t.pointerId;try{p.current?.()}catch{}f.setAttribute("data-resizing","");try{n.setPointerCapture($)}catch{}const R=y==="vertical"?t.clientX:t.clientY,C=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),M=o=>Math.min(Math.max(o,E),h),B=document.body,d=B.style.cursor,N=B.style.userSelect;B.style.cursor=y==="vertical"?"col-resize":"row-resize",B.style.userSelect="none",g?.(C);const z=o=>{const k=y==="vertical"?o.clientX:o.clientY,D=M(L(k,R,C));f.style.setProperty(c,`${D}px`),n.setAttribute("aria-valuenow",String(D)),a?.(D)},j=()=>{try{n.releasePointerCapture($)}catch{}window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H),window.removeEventListener("keydown",b),n.removeEventListener("lostpointercapture",H),f.removeAttribute("data-resizing"),B.style.cursor=d,B.style.userSelect=N,p.current=null},H=()=>{const o=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`);let k=o;if(F&&F.length){const D=F.reduce((Q,X)=>Math.abs(X-o)<Math.abs(Q-o)?X:Q,F[0]);Math.abs(D-o)<=(q??8)&&(k=D,f.style.setProperty(c,`${k}px`),n.setAttribute("aria-valuenow",String(k)),a?.(k))}I&&typeof K=="number"&&o<=K&&U?.(),w?.(k),j()},b=o=>{o.key==="Escape"&&(f.style.setProperty(c,`${C}px`),n.setAttribute("aria-valuenow",String(C)),w?.(C),j())};window.addEventListener("pointermove",z),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H),window.addEventListener("keydown",b),n.addEventListener("lostpointercapture",H),p.current=j},onDoubleClick:()=>{I&&S?.()},onKeyDown:t=>{if(!x.current)return;const f=x.current,n=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),$=M=>Math.min(Math.max(M,E),h),R=t.shiftKey?32:8;let C=0;if(y==="vertical"?t.key==="ArrowRight"?C=R:t.key==="ArrowLeft"&&(C=-R):t.key==="ArrowDown"?C=R:t.key==="ArrowUp"&&(C=-R),t.key==="Home"){t.preventDefault(),g?.(n);const M=$(E);f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M);return}if(t.key==="End"){t.preventDefault(),g?.(n);const M=$(h);f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M);return}if(C!==0){t.preventDefault(),g?.(n);const M=$(n+(T==="start"&&y==="vertical"?-C:C));f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M)}}},v)});_.displayName="Shell.Handle";const pe=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));pe.displayName="Shell.Panel.Handle";const ue=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));ue.displayName="Shell.Sidebar.Handle";const fe=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));fe.displayName="Shell.Inspector.Handle";const me=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));me.displayName="Shell.Bottom.Handle";function le(s){const{currentBreakpoint:v}=Z();return e.useMemo(()=>{if(typeof s=="string")return s;if(s[v])return s[v];const m=[...Object.keys(se)].reverse().concat("initial"),x=m.indexOf(v);for(let c=x+1;c<m.length;c++){const E=m[c];if(s[E])return s[E]}return"fixed"},[s,v])}function ge(){const[s,v]=e.useState("initial"),[r,m]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const c=Object.entries(se).map(([h,P])=>[h,window.matchMedia(P)]),E=()=>{const h=c.filter(([,y])=>y.matches).map(([y])=>y),P=h[h.length-1]??"initial";v(P),m(!0)};return E(),c.forEach(([,h])=>h.addEventListener("change",E)),()=>{c.forEach(([,h])=>h.removeEventListener("change",E))}},[]),{bp:s,ready:r}}const Se=e.forwardRef(({className:s,children:v,height:r="full",...m},x)=>{const{bp:c,ready:E}=ge(),[h,P]=e.useState("collapsed"),[y,T]=e.useState("collapsed"),[L,a]=e.useState("expanded"),[g,w]=e.useState("collapsed"),[F,q]=e.useState("collapsed"),[K,I]=e.useState(!1),[V,U]=e.useState(!1),S=e.useRef(i=>i==="collapsed"?"thin":i==="thin"?"expanded":"collapsed"),p=e.useCallback(i=>{S.current=i},[]);e.useEffect(()=>{h==="collapsed"&&T("collapsed")},[h]),e.useEffect(()=>{V&&K&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[V,K]);const[u,t]=e.useState(void 0),f=e.useCallback(i=>t(i),[]),n=e.useRef(64),$=e.useRef(288),R=e.useCallback(i=>{n.current=i},[]),C=e.useCallback(i=>{$.current=i},[]),M=e.useMemo(()=>{const i=e.Children.toArray(v),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return i.some(Y=>W(Y,oe)||W(Y,ne))},[v]),B=e.useMemo(()=>{const i=e.Children.toArray(v),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return i.some(Y=>W(Y,de))},[v]),d=e.useCallback(i=>{switch(i){case"left":case"rail":P(W=>W==="expanded"?"collapsed":"expanded");break;case"panel":h==="collapsed"?(P("expanded"),T("expanded")):T(W=>W==="expanded"?"collapsed":"expanded");break;case"sidebar":a(W=>S.current(W));break;case"inspector":w(W=>W==="expanded"?"collapsed":"expanded");break;case"bottom":q(W=>W==="expanded"?"collapsed":"expanded");break}},[h]),N=e.useCallback(i=>{switch(i){case"left":case"rail":P("expanded");break;case"panel":P("expanded"),T("expanded");break;case"sidebar":a("expanded");break;case"inspector":w("expanded");break;case"bottom":q("expanded");break}},[]),z=e.useCallback(i=>{switch(i){case"left":case"rail":P("collapsed");break;case"panel":T("collapsed");break;case"sidebar":a("collapsed");break;case"inspector":w("collapsed");break;case"bottom":q("collapsed");break}},[]),j=e.useMemo(()=>({leftMode:h,setLeftMode:P,panelMode:y,setPanelMode:T,sidebarMode:L,setSidebarMode:a,inspectorMode:g,setInspectorMode:w,bottomMode:F,setBottomMode:q,hasLeft:K,setHasLeft:I,hasSidebar:V,setHasSidebar:U,currentBreakpoint:c,currentBreakpointReady:E,leftResolvedPresentation:u,togglePane:d,expandPane:N,collapsePane:z,setSidebarToggleComputer:p,onLeftPres:f,onRailDefaults:R,onPanelDefaults:C}),[h,y,L,g,F,K,V,c,E,u,d,N,z,p,f,R,C]),H=e.Children.toArray(v),b=(i,W)=>e.isValidElement(i)&&(i.type===W||i.type?.displayName===W.displayName),o=H.filter(i=>b(i,Me)),k=H.filter(i=>b(i,oe)),D=H.filter(i=>b(i,ne)),Q=H.filter(i=>b(i,de)),X=H.filter(i=>b(i,Pe)),te=H.filter(i=>b(i,ye)),ve=H.filter(i=>b(i,be)),l=e.useMemo(()=>r==="full"?{height:"100vh"}:r==="auto"?{height:"auto"}:typeof r=="string"?{height:r}:typeof r=="number"?{height:`${r}px`}:{},[r]),[O,A]=e.useState(null),ae=e.useCallback(i=>A(i),[]),ee=e.useCallback(()=>A(null),[]);return e.createElement("div",{...m,ref:x,className:J("rt-ShellRoot",s),style:{...l,...m.style}},e.createElement(Re.Provider,{value:{...j,peekTarget:O,setPeekTarget:A,peekPane:ae,clearPeek:ee}},o,e.createElement("div",{className:"rt-ShellBody","data-peek-target":O??void 0,style:O==="rail"||O==="panel"?{"--peek-rail-width":`${n.current}px`}:void 0},M&&!B?(()=>{const i=k[0],W=i?{mode:i.props?.mode,defaultMode:i.props?.defaultMode,onModeChange:i.props?.onModeChange,presentation:i.props?.presentation,collapsible:i.props?.collapsible,onExpand:i.props?.onExpand,onCollapse:i.props?.onCollapse}:{};return e.createElement(he,{...W},k,D)})():Q,X,te),ve))});Se.displayName="Shell.Root";const Me=e.forwardRef(({className:s,height:v=64,style:r,...m},x)=>e.createElement("header",{...m,ref:x,className:J("rt-ShellHeader",s),style:{...r,"--shell-header-height":`${v}px`}}));Me.displayName="Shell.Header";const he=e.forwardRef(({className:s,presentation:v={initial:"overlay",sm:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,collapsible:c=!0,onExpand:E,onCollapse:h,children:P,style:y,...T},L)=>{const a=Z(),g=le(v),w=g==="overlay",F=g==="stacked",q=e.useRef(null);e.useEffect(()=>{a.onLeftPres?.(g)},[a,g]);const K=e.useCallback(S=>{q.current=S,typeof L=="function"?L(S):L&&(L.current=S)},[L]);e.useEffect(()=>(a.setHasLeft(!0),()=>a.setHasLeft(!1)),[a]);const I=e.useCallback(()=>{if(typeof m=="string")return m;const S=m;if(S&&S[a.currentBreakpoint])return S[a.currentBreakpoint];const u=[...Object.keys(se)].reverse().concat("initial"),t=u.indexOf(a.currentBreakpoint);for(let f=t+1;f<u.length;f++){const n=u[f];if(S&&S[n])return S[n]}return"collapsed"},[m,a.currentBreakpoint]),V=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!a.currentBreakpointReady||V.current===a.currentBreakpoint)return;V.current=a.currentBreakpoint;const S=I();S!==a.leftMode&&a.setLeftMode(S)},[r,a.currentBreakpoint,a.currentBreakpointReady,I,a.leftMode,a.setLeftMode]),e.useEffect(()=>{r!==void 0&&a.leftMode!==r&&a.setLeftMode(r)},[r,a]),e.useEffect(()=>{r===void 0&&x?.(a.leftMode)},[a.leftMode,r,x]),e.useEffect(()=>{a.leftMode==="expanded"?E?.():h?.()},[a.leftMode,E,h]);const U=a.leftMode==="expanded";if(w){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(B,d)=>e.isValidElement(B)&&B.type===d,t=p.find(B=>u(B,oe)),f=p.find(B=>u(B,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,C=!!f,M=(R?n:0)+(a.panelMode==="expanded"&&C?$:0);return e.createElement(G.Root,{open:S,onOpenChange:B=>a.setLeftMode(B?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${M}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},P)))}if(F){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(d,N)=>e.isValidElement(d)&&d.type===N,t=p.find(d=>u(d,oe)),f=p.find(d=>u(d,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,M=!!f&&(a.panelMode==="expanded"||a.peekTarget==="panel"),B=(R?n:0)+(M?$:0);return e.createElement("div",{...T,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y},"data-open":S||void 0},P)}return e.createElement("div",{...T,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y}},P)});he.displayName="Shell.Left";const oe=e.forwardRef(({className:s,presentation:v,mode:r,defaultMode:m,onModeChange:x,expandedSize:c=64,collapsible:E,onExpand:h,onCollapse:P,children:y,style:T,...L},a)=>{const g=Z();e.useEffect(()=>{g.onRailDefaults?.(c)},[g,c]);const w=g.leftMode==="expanded";return e.createElement("div",{...L,ref:a,className:J("rt-ShellRail",s),"data-mode":g.leftMode,"data-peek":g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0,style:{...T,"--rail-size":`${c}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":w||g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0},y))});oe.displayName="Shell.Rail";const ne=e.forwardRef(({className:s,mode:v,onModeChange:r,expandedSize:m=288,minSize:x,maxSize:c,resizable:E,collapsible:h=!0,onExpand:P,onCollapse:y,onResize:T,onResizeStart:L,onResizeEnd:a,snapPoints:g,snapTolerance:w,collapseThreshold:F,paneId:q,persistence:K,children:I,style:V,...U},S)=>{const p=Z();e.useEffect(()=>{p.onPanelDefaults?.(m)},[p,m]);const u=e.useRef(null),t=e.useCallback(d=>{u.current=d,typeof S=="function"?S(d):S&&(S.current=d)},[S]),f=e.Children.toArray(I),n=f.filter(d=>e.isValidElement(d)&&d.type===pe),$=f.filter(d=>!(e.isValidElement(d)&&d.type===pe)),R=p.leftResolvedPresentation==="overlay",C=e.useMemo(()=>{if(!q||K)return K;const d=`kookie-ui:shell:panel:${q}`;return{load:()=>{if(typeof window>"u")return;const z=window.localStorage.getItem(d);return z?Number(z):void 0},save:z=>{typeof window>"u"||window.localStorage.setItem(d,String(z))}}},[q,K]);e.useEffect(()=>{let d=!0;return(async()=>{if(!E||!C?.load||R)return;const N=await C.load();d&&typeof N=="number"&&u.current&&(u.current.style.setProperty("--panel-size",`${N}px`),T?.(N))})(),()=>{d=!1}},[E,C,T,R]),e.useEffect(()=>{u.current&&R&&u.current.style.setProperty("--panel-size",`${m}px`)},[R,m]),e.useEffect(()=>{if(u.current&&p.leftResolvedPresentation!=="overlay"&&p.leftMode==="expanded"&&p.panelMode==="expanded"){const d=u.current.parentElement||null;try{d?.style.removeProperty("width")}catch{}}},[p.leftResolvedPresentation,p.leftMode,p.panelMode]);const M=p.leftMode==="expanded"&&p.panelMode==="expanded",B=E&&p.leftResolvedPresentation!=="overlay"&&M?e.createElement(ie.Provider,{value:{containerRef:u,cssVarName:"--panel-size",minSize:typeof x=="number"?x:100,maxSize:typeof c=="number"?c:800,defaultSize:m,orientation:"vertical",edge:"end",computeNext:(d,N,z)=>{const j=getComputedStyle(u.current).direction==="rtl",H=d-N;return z+(j?-H:H)},onResize:T,onResizeStart:d=>{const z=u.current?.parentElement;try{z?.style.removeProperty("width")}catch{}L?.(d)},onResizeEnd:d=>{a?.(d),C?.save?.(d)},target:"panel",collapsible:!!h,snapPoints:g,snapTolerance:w??8,collapseThreshold:F,requestCollapse:()=>p.setPanelMode("collapsed"),requestToggle:()=>p.togglePane("panel")}},n.length>0?n.map((d,N)=>e.cloneElement(d,{key:d.key??N})):e.createElement(_,null)):null;return e.createElement("div",{...U,ref:t,className:J("rt-ShellPanel",s),"data-mode":p.panelMode,"data-visible":M||p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,"data-peek":p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,style:{...V,"--panel-size":`${m}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":M||void 0},$),B)});ne.displayName="Shell.Panel",ne.Handle=pe;const de=e.forwardRef(({className:s,presentation:v={initial:"overlay",md:"fixed"},mode:r,defaultMode:m="expanded",onModeChange:x,expandedSize:c=288,minSize:E=200,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,thinSize:p=64,toggleModes:u,...t},f)=>{const n=Z(),$=le(v),R=$==="overlay",C=$==="stacked",M=e.useRef(null),B=e.useCallback(l=>{M.current=l,typeof f=="function"?f(l):f&&(f.current=l)},[f]),d=e.Children.toArray(U),N=d.filter(l=>e.isValidElement(l)&&l.type===ue),z=d.filter(l=>!(e.isValidElement(l)&&l.type===ue)),j=e.useId();e.useEffect(()=>(n.setHasSidebar(!0),()=>{n.setHasSidebar(!1)}),[n,j]);const H=e.useRef(!1);e.useEffect(()=>{H.current||(H.current=!0,r===void 0&&n.sidebarMode!==m&&n.setSidebarMode(m))},[]),e.useEffect(()=>{r!==void 0&&n.sidebarMode!==r&&n.setSidebarMode(r)},[r,n]),e.useEffect(()=>{r===void 0&&x?.(n.sidebarMode)},[n.sidebarMode,r,x]),e.useEffect(()=>{n.sidebarMode==="expanded"?T?.():L?.()},[n.sidebarMode,T,L]);const b=n.sidebarMode!=="collapsed",o=e.useMemo(()=>{if(!I||V)return V;const l=`kookie-ui:shell:sidebar:${I}`;return{load:()=>{if(typeof window>"u")return;const A=window.localStorage.getItem(l);return A?Number(A):void 0},save:A=>{typeof window>"u"||window.localStorage.setItem(l,String(A))}}},[I,V]);e.useEffect(()=>{let l=!0;return(async()=>{if(!P||!o?.load||R)return;const O=await o.load();l&&typeof O=="number"&&M.current&&(M.current.style.setProperty("--sidebar-size",`${O}px`),a?.(O))})(),()=>{l=!1}},[P,o,a,R]);const k=Z();e.useEffect(()=>{if(!k.setSidebarToggleComputer)return;const l=u&&u.length>0?u:["thin","expanded"],O=A=>A==="collapsed"?l[0]??"expanded":A==="thin"?l.includes("thin")&&l.includes("expanded")?"expanded":"collapsed":l.length===2&&l.includes("thin")&&l.includes("expanded")?"collapsed":l.includes("thin")&&!l.includes("expanded")?"thin":"collapsed";return k.setSidebarToggleComputer(O),()=>{k.setSidebarToggleComputer?.(A=>A==="collapsed"?"thin":A==="thin"?"expanded":"collapsed")}},[k,u]);const D=e.useRef(c),Q=e.useRef("expanded");e.useEffect(()=>{n.sidebarMode!=="collapsed"&&(Q.current=n.sidebarMode,D.current=n.sidebarMode==="thin"?p:c)},[n.sidebarMode,p,c]);const X=e.useCallback(()=>{if(typeof m=="string")return m;const l=m;if(l&&l[n.currentBreakpoint])return l[n.currentBreakpoint];const A=[...Object.keys(se)].reverse().concat("initial"),ae=A.indexOf(n.currentBreakpoint);for(let ee=ae+1;ee<A.length;ee++){const i=A[ee];if(l&&l[i])return l[i]}return"collapsed"},[m,n.currentBreakpoint]),te=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!n.currentBreakpointReady||te.current===n.currentBreakpoint)return;te.current=n.currentBreakpoint;const l=X();l!==n.sidebarMode&&n.setSidebarMode(l)},[r,n.currentBreakpoint,n.currentBreakpointReady,X,n.sidebarMode,n.setSidebarMode]);const ve=P&&!R&&n.sidebarMode==="expanded"?e.createElement(ie.Provider,{value:{containerRef:M,cssVarName:"--sidebar-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"end",computeNext:(l,O,A)=>{const ae=getComputedStyle(M.current).direction==="rtl",ee=l-O;return A+(ae?-ee:ee)},onResize:a,onResizeStart:g,onResizeEnd:l=>{w?.(l),o?.save?.(l)},target:"sidebar",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},N.length>0?N.map((l,O)=>e.cloneElement(l,{key:l.key??O})):e.createElement(_,null)):null;if(R){const l=n.sidebarMode!=="collapsed";return e.createElement(G.Root,{open:l,onOpenChange:O=>n.setSidebarMode(O?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${l?n.sidebarMode==="thin"?p:c:D.current}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Sidebar")),z))}return e.createElement("div",{...t,ref:B,className:J("rt-ShellSidebar",s),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":$,"data-open":C&&b||void 0,style:{...S,"--sidebar-size":`${c}px`,"--sidebar-thin-size":`${p}px`,"--sidebar-min-size":`${E}px`,"--sidebar-max-size":`${h}px`,...n.peekTarget==="sidebar"&&!R?(()=>{const l=u&&u.length>0?u:["thin","expanded"],O=n.sidebarMode;let A="collapsed";return O==="collapsed"?A=l[0]??"expanded":O==="thin"?A=l.includes("expanded")?"expanded":"collapsed":A=l.includes("thin")?"thin":"collapsed",{"--peek-sidebar-width":`${A==="thin"?p:c}px`}})():{}}},e.createElement("div",{className:"rt-ShellSidebarContent","data-visible":b||void 0},z),ve)});de.displayName="Shell.Sidebar",de.Handle=ue;const Pe=e.forwardRef(({className:s,...v},r)=>e.createElement("main",{...v,ref:r,className:J("rt-ShellContent",s)}));Pe.displayName="Shell.Content";const ye=e.forwardRef(({className:s,presentation:v={initial:"overlay",lg:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=320,minSize:E=200,maxSize:h=500,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=le(v),n=f==="overlay",$=f==="stacked",R=e.useRef(null),C=e.useCallback(o=>{R.current=o,typeof u=="function"?u(o):u&&(u.current=o)},[u]),M=e.Children.toArray(U),B=M.filter(o=>e.isValidElement(o)&&o.type===fe),d=M.filter(o=>!(e.isValidElement(o)&&o.type===fe)),N=e.useCallback(()=>{if(typeof m=="string")return m;const o=m;if(o&&o[t.currentBreakpoint])return o[t.currentBreakpoint];const D=[...Object.keys(se)].reverse().concat("initial"),Q=D.indexOf(t.currentBreakpoint);for(let X=Q+1;X<D.length;X++){const te=D[X];if(o&&o[te])return o[te]}return"collapsed"},[m,t.currentBreakpoint]),z=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!t.currentBreakpointReady||z.current===t.currentBreakpoint)return;z.current=t.currentBreakpoint;const o=N();o!==t.inspectorMode&&t.setInspectorMode(o)},[r,t.currentBreakpoint,t.currentBreakpointReady,N,t.inspectorMode,t.setInspectorMode]),e.useEffect(()=>{r!==void 0&&t.inspectorMode!==r&&t.setInspectorMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.inspectorMode)},[t.inspectorMode,r,x]),e.useEffect(()=>{t.inspectorMode==="expanded"?T?.():L?.()},[t.inspectorMode,T,L]);const j=t.inspectorMode==="expanded",H=e.useMemo(()=>{if(!I||V)return V;const o=`kookie-ui:shell:inspector:${I}`;return{load:()=>{if(typeof window>"u")return;const D=window.localStorage.getItem(o);return D?Number(D):void 0},save:D=>{typeof window>"u"||window.localStorage.setItem(o,String(D))}}},[I,V]);e.useEffect(()=>{let o=!0;return(async()=>{if(!P||!H?.load||n)return;const k=await H.load();o&&typeof k=="number"&&R.current&&(R.current.style.setProperty("--inspector-size",`${k}px`),a?.(k))})(),()=>{o=!1}},[P,H,a,n]);const b=P&&!n&&j?e.createElement(ie.Provider,{value:{containerRef:R,cssVarName:"--inspector-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"start",computeNext:(o,k,D)=>{const Q=getComputedStyle(R.current).direction==="rtl",X=o-k;return D+(Q?X:-X)},onResize:a,onResizeStart:g,onResizeEnd:o=>{w?.(o),H?.save?.(o)},target:"inspector",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},B.length>0?B.map((o,k)=>e.cloneElement(o,{key:o.key??k})):e.createElement(_,null)):null;if(n){const o=t.inspectorMode==="expanded";return e.createElement(G.Root,{open:o,onOpenChange:k=>t.setInspectorMode(k?"expanded":"collapsed")},e.createElement(G.Content,{side:"end",style:{padding:0},width:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Inspector")),U))}return e.createElement("div",{...p,ref:C,className:J("rt-ShellInspector",s),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":f,"data-open":$&&j||void 0,style:{...S,"--inspector-size":`${c}px`,"--inspector-min-size":`${E}px`,"--inspector-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellInspectorContent","data-visible":j||void 0},d),b)});ye.displayName="Shell.Inspector",ye.Handle=fe;const be=e.forwardRef(({className:s,presentation:v="fixed",mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=200,minSize:E=100,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=le(v),n=f==="overlay",$=f==="stacked",R=e.useRef(null),C=e.useCallback(b=>{R.current=b,typeof u=="function"?u(b):u&&(u.current=b)},[u]),M=e.Children.toArray(U),B=M.filter(b=>e.isValidElement(b)&&b.type===me),d=M.filter(b=>!(e.isValidElement(b)&&b.type===me)),N=e.useRef(!1);e.useEffect(()=>{N.current||(N.current=!0,r===void 0&&t.bottomMode!==m&&t.setBottomMode(m))},[]),e.useEffect(()=>{r!==void 0&&t.bottomMode!==r&&t.setBottomMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.bottomMode)},[t.bottomMode,r,x]),e.useEffect(()=>{t.bottomMode==="expanded"?T?.():L?.()},[t.bottomMode,T,L]);const z=t.bottomMode==="expanded",j=e.useMemo(()=>{if(!I||V)return V;const b=`kookie-ui:shell:bottom:${I}`;return{load:()=>{if(typeof window>"u")return;const k=window.localStorage.getItem(b);return k?Number(k):void 0},save:k=>{typeof window>"u"||window.localStorage.setItem(b,String(k))}}},[I,V]);e.useEffect(()=>{let b=!0;return(async()=>{if(!P||!j?.load||n)return;const o=await j.load();b&&typeof o=="number"&&R.current&&(R.current.style.setProperty("--bottom-size",`${o}px`),a?.(o))})(),()=>{b=!1}},[P,j,a,n]);const H=P&&!n&&z?e.createElement(ie.Provider,{value:{containerRef:R,cssVarName:"--bottom-size",minSize:E,maxSize:h,defaultSize:c,orientation:"horizontal",edge:"start",computeNext:(b,o,k)=>{const D=b-o;return k-D},onResize:a,onResizeStart:g,onResizeEnd:b=>{w?.(b),j?.save?.(b)},target:"bottom",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},B.length>0?B.map((b,o)=>e.cloneElement(b,{key:b.key??o})):e.createElement(_,null)):null;if(n){const b=t.bottomMode==="expanded";return e.createElement(G.Root,{open:b,onOpenChange:o=>t.setBottomMode(o?"expanded":"collapsed")},e.createElement(G.Content,{side:"bottom",style:{padding:0},height:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Bottom panel")),U))}return e.createElement("div",{...p,ref:C,className:J("rt-ShellBottom",s),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":f,"data-open":$&&z||void 0,style:{...S,"--bottom-size":`${c}px`,"--bottom-min-size":`${E}px`,"--bottom-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellBottomContent","data-visible":z||void 0},d),H)});be.displayName="Shell.Bottom",be.Handle=me;const ke=e.forwardRef(({target:s,action:v="toggle",peekOnHover:r,onClick:m,onMouseEnter:x,onMouseLeave:c,children:E,...h},P)=>{const y=Z(),T=e.useCallback(w=>{switch(m?.(w),v){case"toggle":y.togglePane(s);break;case"expand":y.expandPane(s);break;case"collapse":y.collapsePane(s);break}},[y,s,v,m]),L=(()=>{switch(s){case"left":case"rail":return y.leftMode==="collapsed";case"panel":return y.leftMode==="collapsed"||y.panelMode==="collapsed";case"sidebar":return y.sidebarMode==="collapsed";case"inspector":return y.inspectorMode==="collapsed";case"bottom":return y.bottomMode==="collapsed"}})(),a=e.useCallback(w=>{x?.(w),!(!r||!L)&&y.peekPane(s)},[x,r,L,y,s]),g=e.useCallback(w=>{c?.(w),r&&y.peekTarget===s&&y.clearPeek()},[c,r,y,s]);return e.createElement("button",{...h,ref:P,onClick:T,onMouseEnter:a,onMouseLeave:g,"data-shell-trigger":s,"data-shell-action":v},E)});ke.displayName="Shell.Trigger";export{be as Bottom,Pe as Content,Me as Header,ye as Inspector,he as Left,ne as Panel,oe as Rail,Se as Root,de as Sidebar,ke as Trigger,le as useResponsivePresentation,Z as useShell};
2
2
  //# sourceMappingURL=shell.js.map