@kushagradhawan/kookie-ui 0.1.72 → 0.1.73

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.
Files changed (38) hide show
  1. package/components.css +6 -2
  2. package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
  3. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  4. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  5. package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
  6. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  7. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  8. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  9. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  10. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  11. package/dist/cjs/components/shell.d.ts.map +1 -1
  12. package/dist/cjs/components/shell.js +1 -1
  13. package/dist/cjs/components/shell.js.map +3 -3
  14. package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
  15. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  16. package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
  17. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  18. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  19. package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
  20. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  21. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  22. package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
  23. package/dist/esm/components/shell.d.ts.map +1 -1
  24. package/dist/esm/components/shell.js +1 -1
  25. package/dist/esm/components/shell.js.map +3 -3
  26. package/package.json +1 -1
  27. package/schemas/base-button.json +1 -1
  28. package/schemas/button.json +1 -1
  29. package/schemas/icon-button.json +1 -1
  30. package/schemas/index.json +6 -6
  31. package/schemas/toggle-button.json +1 -1
  32. package/schemas/toggle-icon-button.json +1 -1
  33. package/src/components/_internal/shell-bottom.tsx +31 -5
  34. package/src/components/_internal/shell-inspector.tsx +31 -5
  35. package/src/components/_internal/shell-sidebar.tsx +34 -6
  36. package/src/components/shell.css +10 -11
  37. package/src/components/shell.tsx +46 -2
  38. package/styles.css +6 -2
package/components.css CHANGED
@@ -17080,10 +17080,12 @@
17080
17080
  }
17081
17081
  .rt-ShellSidebar[data-mode='collapsed'] {
17082
17082
  width: 0px;
17083
- transition-delay: var(--motion-duration-small);
17084
17083
  position: absolute;
17085
17084
  inset-block: 0;
17086
17085
  inset-inline-start: 0;
17086
+ flex-shrink: 0;
17087
+ flex-basis: 0;
17088
+ transition-delay: var(--motion-duration-small);
17087
17089
  }
17088
17090
  .rt-ShellSidebarContent {
17089
17091
  display: flex;
@@ -17151,10 +17153,12 @@
17151
17153
  }
17152
17154
  .rt-ShellInspector[data-mode='collapsed'] {
17153
17155
  width: 0px;
17154
- transition-delay: var(--motion-duration-small);
17155
17156
  position: absolute;
17156
17157
  inset-block: 0;
17157
17158
  inset-inline-end: 0;
17159
+ flex-shrink: 0;
17160
+ flex-basis: 0;
17161
+ transition-delay: var(--motion-duration-small);
17158
17162
  }
17159
17163
  .rt-ShellInspectorContent {
17160
17164
  display: flex;
@@ -1 +1 @@
1
- {"version":3,"file":"shell-bottom.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAyD,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG1H,KAAK,oBAAoB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAA;CAAE,CAAC;AACzE,KAAK,qBAAqB,GAAG;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,O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,GAAG,2BAA2B,CAAC,GAAG;IAC1D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClE,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEJ,KAAK,eAAe,GAAG,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAgBlJ,eAAO,MAAM,MAAM,EAwVb,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var ye=Object.create;var g=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var Me=(s,a)=>{for(var l in a)g(s,l,{get:a[l],enumerable:!0})},Q=(s,a,l,z)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of Pe(a))!Be.call(s,d)&&d!==l&&g(s,d,{get:()=>a[d],enumerable:!(z=ze(a,d))||z.enumerable});return s};var V=(s,a,l)=>(l=s!=null?ye(Se(s)):{},Q(a||!s||!s.__esModule?g(l,"default",{value:s,enumerable:!0}):l,s)),ge=s=>Q(g({},"__esModule",{value:!0}),s);var Ce={};Me(Ce,{Bottom:()=>U});module.exports=ge(Ce);var t=V(require("react")),X=V(require("classnames")),F=V(require("../sheet.js")),Z=require("../visually-hidden.js"),ee=require("../shell.context.js"),x=require("../shell.hooks.js"),te=require("./shell-resize.js"),b=require("./shell-handles.js"),ve=require("../shell.types.js"),y=require("./shell-prop-helpers.js");const xe=["className","children","defaultOpen","open","onOpenChange","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],U=t.forwardRef((s,a)=>{const{className:l,presentation:z="fixed",defaultOpen:d,open:p,onOpenChange:h,expandedSize:C=200,minSize:m=100,maxSize:c=400,resizable:R=!1,collapsible:oe=!0,onExpand:I,onCollapse:_,onResize:v,onResizeStart:ne,onResizeEnd:re,snapPoints:ie,snapTolerance:se,collapseThreshold:ae,paneId:E,persistence:N,children:le,style:de,size:$,defaultSize:L,onSizeChange:A,sizeUpdate:j,sizeUpdateMs:W=50}=s,pe=(0,y.extractPaneDomProps)(s,xe),r=(0,ee.useShell)(),O=(0,x.useResponsivePresentation)(z),P=O==="overlay",ue=O==="stacked",u=t.useRef(null),me=t.useCallback(e=>{u.current=e,typeof a=="function"?a(e):a&&(a.current=e)},[a]),q=t.Children.toArray(le),K=q.filter(e=>t.isValidElement(e)&&e.type===b.BottomHandle),Y=q.filter(e=>!(t.isValidElement(e)&&e.type===b.BottomHandle)),ce=t.useMemo(()=>(0,y.mapResponsiveBooleanToPaneMode)(p),[p]),fe=t.useMemo(()=>(0,y.mapResponsiveBooleanToPaneMode)(d),[d]),be=typeof p=="object"&&p!==null;(0,x.useResponsiveInitialState)({controlledValue:ce,defaultValue:fe,currentValue:r.bottomMode,setValue:r.setBottomMode,breakpointReady:r.currentBreakpointReady,controlledIsResponsive:be,onResponsiveChange:e=>h?.(e==="expanded",{reason:"responsive"}),onInit:e=>{typeof p>"u"&&h?.(e==="expanded",{reason:"init"})}});const S=t.useMemo(()=>{const e=A,n=j,i=W??50;if(!e)return()=>{};if(n==="debounce"){let o=null;return(f,H)=>{o&&clearTimeout(o),o=setTimeout(()=>{e(f,H)},i)}}if(n==="throttle"){let o=0;return(f,H)=>{const J=Date.now();J-o>=i&&(o=J,e(f,H))}}return(o,f)=>e(o,f)},[A,j,W]),B=t.useRef(null);t.useEffect(()=>{const e=typeof p<"u";if(B.current===null){B.current=e;return}B.current!==e&&(console.warn("Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported."),B.current=e)},[p]);const G=t.useRef(!1),w=t.useRef(null);t.useEffect(()=>{!G.current&&typeof p>"u"&&d&&r.bottomMode==="expanded"&&(h?.(!0,{reason:"init"}),G.current=!0),typeof p>"u"&&(w.current!==null&&w.current!==r.bottomMode&&h?.(r.bottomMode==="expanded",{reason:"toggle"}),w.current=r.bottomMode)},[r.bottomMode,p,d,h]),t.useEffect(()=>{r.bottomMode==="expanded"?I?.():_?.()},[r.bottomMode,I,_]);const T=r.bottomMode==="expanded",M=t.useMemo(()=>{if(!E||N)return N;const e=`kookie-ui:shell:bottom:${E}`;return{load:()=>{if(!(typeof window>"u"))try{const i=window.localStorage.getItem(e);return i?Number(i):void 0}catch{return}},save:i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(i))}catch{}}}},[E,N]);t.useEffect(()=>{let e=!0;if(!R||!M?.load||P)return;const n=M.load(),i=o=>{!e||typeof o!="number"||!u.current||(u.current.style.setProperty("--bottom-size",`${o}px`),v?.(o))};return n instanceof Promise?n.then(i).catch(o=>{}):i(n),()=>{e=!1}},[R,M,v,P]);const he=R&&!P&&T?t.createElement(te.PaneResizeContext.Provider,{value:{containerRef:u,cssVarName:"--bottom-size",minSize:m,maxSize:c,defaultSize:C,orientation:"horizontal",edge:"start",computeNext:(e,n,i)=>{const o=e-n;return i-o},onResize:v,onResizeStart:ne,onResizeEnd:e=>{re?.(e),S(e,{reason:"resize"}),M?.save?.(e)},target:"bottom",collapsible:oe,snapPoints:ie,snapTolerance:se??8,collapseThreshold:ae,requestCollapse:()=>r.setBottomMode("collapsed"),requestToggle:()=>r.togglePane("bottom")}},K.length>0?K.map((e,n)=>t.cloneElement(e,{key:e.key??n})):t.createElement(b.PaneHandle,null)):null,k=t.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const n=String(e).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){const o=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*o}if(n.endsWith("%")){const o=Number.parseFloat(n),f=document.documentElement.clientHeight||window.innerHeight||0;return o/100*f}const i=Number.parseFloat(n);return Number.isFinite(i)?i:void 0},[]);t.useEffect(()=>{if(u.current&&typeof $>"u"&&typeof L<"u"){const e=k(L);if(typeof e=="number"&&Number.isFinite(e)){const o=Math.min((typeof c=="number"?c:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));u.current.style.setProperty("--bottom-size",`${o}px`),S(o,{reason:"init"})}}},[]);const D=$;if(t.useEffect(()=>{if(!u.current||typeof D>"u")return;const e=k(D);if(typeof e=="number"&&Number.isFinite(e)){const o=Math.min((typeof c=="number"?c:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));u.current.style.setProperty("--bottom-size",`${o}px`),S(o,{reason:"controlled"})}},[D,m,c,k,S]),P){const e=r.bottomMode==="expanded";return t.createElement(F.Root,{open:e,onOpenChange:n=>r.setBottomMode(n?"expanded":"collapsed")},t.createElement(F.Content,{side:"bottom",style:{padding:0},height:{initial:`${C}px`}},t.createElement(Z.VisuallyHidden,null,t.createElement(F.Title,null,"Bottom panel")),Y))}return t.createElement("div",{...pe,ref:me,className:(0,X.default)("rt-ShellBottom",l),"data-mode":r.bottomMode,"data-peek":r.peekTarget==="bottom"||void 0,"data-presentation":r.currentBreakpointReady?O:void 0,"data-open":r.currentBreakpointReady&&ue&&T||void 0,style:{...de,"--bottom-size":`${C}px`,"--bottom-min-size":`${m}px`,"--bottom-max-size":`${c}px`}},t.createElement("div",{className:"rt-ShellBottomContent","data-visible":T||void 0},Y),he)});U.displayName="Shell.Bottom",U.Handle=b.BottomHandle;
1
+ "use strict";var Pe=Object.create;var x=Object.defineProperty;var Be=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var xe=(s,a)=>{for(var l in a)x(s,l,{get:a[l],enumerable:!0})},Z=(s,a,l,z)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of Se(a))!ge.call(s,d)&&d!==l&&x(s,d,{get:()=>a[d],enumerable:!(z=Be(a,d))||z.enumerable});return s};var F=(s,a,l)=>(l=s!=null?Pe(Me(s)):{},Z(a||!s||!s.__esModule?x(l,"default",{value:s,enumerable:!0}):l,s)),Ce=s=>Z(x({},"__esModule",{value:!0}),s);var ve={};xe(ve,{Bottom:()=>I});module.exports=Ce(ve);var t=F(require("react")),ee=F(require("classnames")),U=F(require("../sheet.js")),te=require("../visually-hidden.js"),oe=require("../shell.context.js"),C=require("../shell.hooks.js"),ne=require("./shell-resize.js"),b=require("./shell-handles.js"),Ne=require("../shell.types.js"),h=require("./shell-prop-helpers.js");const Re=["className","children","defaultOpen","open","onOpenChange","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],I=t.forwardRef((s,a)=>{const{className:l,presentation:z="fixed",defaultOpen:d,open:u,onOpenChange:y,expandedSize:R=200,minSize:m=100,maxSize:c=400,resizable:v=!1,collapsible:re=!0,onExpand:_,onCollapse:$,onResize:E,onResizeStart:ie,onResizeEnd:se,snapPoints:ae,snapTolerance:le,collapseThreshold:de,paneId:N,persistence:O,children:ue,style:pe,size:L,defaultSize:A,onSizeChange:j,sizeUpdate:W,sizeUpdateMs:q=50}=s,me=(0,h.extractPaneDomProps)(s,Re),r=(0,oe.useShell)(),w=(0,C.useResponsivePresentation)(z),P=w==="overlay",ce=w==="stacked",p=t.useRef(null),fe=t.useCallback(e=>{p.current=e,typeof a=="function"?a(e):a&&(a.current=e)},[a]),K=t.Children.toArray(ue),Y=K.filter(e=>t.isValidElement(e)&&e.type===b.BottomHandle),G=K.filter(e=>!(t.isValidElement(e)&&e.type===b.BottomHandle)),be=t.useMemo(()=>(0,h.mapResponsiveBooleanToPaneMode)(u),[u]),ye=t.useMemo(()=>(0,h.mapResponsiveBooleanToPaneMode)(d),[d]),he=typeof u=="object"&&u!==null;(0,C.useResponsiveInitialState)({controlledValue:be,defaultValue:ye,currentValue:r.bottomMode,setValue:r.setBottomMode,breakpointReady:r.currentBreakpointReady,controlledIsResponsive:he,onResponsiveChange:e=>y?.(e==="expanded",{reason:"responsive"}),onInit:e=>{typeof u>"u"&&y?.(e==="expanded",{reason:"init"})}});const B=t.useMemo(()=>{const e=j,o=W,i=q??50;if(!e)return()=>{};if(o==="debounce"){let n=null;return(f,V)=>{n&&clearTimeout(n),n=setTimeout(()=>{e(f,V)},i)}}if(o==="throttle"){let n=0;return(f,V)=>{const X=Date.now();X-n>=i&&(n=X,e(f,V))}}return(n,f)=>e(n,f)},[j,W,q]),S=t.useRef(null);t.useEffect(()=>{const e=typeof u<"u";if(S.current===null){S.current=e;return}S.current!==e&&(console.warn("Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported."),S.current=e)},[u]);const J=t.useRef(!1),k=t.useRef(null);t.useEffect(()=>{!J.current&&typeof u>"u"&&d&&r.bottomMode==="expanded"&&(y?.(!0,{reason:"init"}),J.current=!0),typeof u>"u"&&(k.current!==null&&k.current!==r.bottomMode&&y?.(r.bottomMode==="expanded",{reason:"toggle"}),k.current=r.bottomMode)},[r.bottomMode,u,d,y]);const M=t.useRef(null),Q=t.useRef(!1);t.useEffect(()=>{const e=r.bottomMode;if(!r.currentBreakpointReady){M.current=e;return}if(!Q.current){Q.current=!0,M.current=e;return}const o=M.current;o!==null&&o!==e&&(e==="expanded"?_?.():e==="collapsed"&&$?.(),M.current=e)},[r.bottomMode,r.currentBreakpointReady,_,$]);const T=r.bottomMode==="expanded",g=t.useMemo(()=>{if(!N||O)return O;const e=`kookie-ui:shell:bottom:${N}`;return{load:()=>{if(!(typeof window>"u"))try{const i=window.localStorage.getItem(e);return i?Number(i):void 0}catch{return}},save:i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(i))}catch{}}}},[N,O]);t.useEffect(()=>{let e=!0;if(!v||!g?.load||P)return;const o=g.load(),i=n=>{!e||typeof n!="number"||!p.current||(p.current.style.setProperty("--bottom-size",`${n}px`),E?.(n))};return o instanceof Promise?o.then(i).catch(n=>{}):i(o),()=>{e=!1}},[v,g,E,P]);const ze=v&&!P&&T?t.createElement(ne.PaneResizeContext.Provider,{value:{containerRef:p,cssVarName:"--bottom-size",minSize:m,maxSize:c,defaultSize:R,orientation:"horizontal",edge:"start",computeNext:(e,o,i)=>{const n=e-o;return i-n},onResize:E,onResizeStart:ie,onResizeEnd:e=>{se?.(e),B(e,{reason:"resize"}),g?.save?.(e)},target:"bottom",collapsible:re,snapPoints:ae,snapTolerance:le??8,collapseThreshold:de,requestCollapse:()=>r.setBottomMode("collapsed"),requestToggle:()=>r.togglePane("bottom")}},Y.length>0?Y.map((e,o)=>t.cloneElement(e,{key:e.key??o})):t.createElement(b.PaneHandle,null)):null,D=t.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const o=String(e).trim();if(!o)return;if(o.endsWith("px"))return Number.parseFloat(o);if(o.endsWith("rem")){const n=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*n}if(o.endsWith("%")){const n=Number.parseFloat(o),f=document.documentElement.clientHeight||window.innerHeight||0;return n/100*f}const i=Number.parseFloat(o);return Number.isFinite(i)?i:void 0},[]);t.useEffect(()=>{if(p.current&&typeof L>"u"&&typeof A<"u"){const e=D(A);if(typeof e=="number"&&Number.isFinite(e)){const n=Math.min((typeof c=="number"?c:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));p.current.style.setProperty("--bottom-size",`${n}px`),B(n,{reason:"init"})}}},[]);const H=L;if(t.useEffect(()=>{if(!p.current||typeof H>"u")return;const e=D(H);if(typeof e=="number"&&Number.isFinite(e)){const n=Math.min((typeof c=="number"?c:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));p.current.style.setProperty("--bottom-size",`${n}px`),B(n,{reason:"controlled"})}},[H,m,c,D,B]),P){const e=r.bottomMode==="expanded";return t.createElement(U.Root,{open:e,onOpenChange:o=>r.setBottomMode(o?"expanded":"collapsed")},t.createElement(U.Content,{side:"bottom",style:{padding:0},height:{initial:`${R}px`}},t.createElement(te.VisuallyHidden,null,t.createElement(U.Title,null,"Bottom panel")),G))}return t.createElement("div",{...me,ref:fe,className:(0,ee.default)("rt-ShellBottom",l),"data-mode":r.bottomMode,"data-peek":r.peekTarget==="bottom"||void 0,"data-presentation":r.currentBreakpointReady?w:void 0,"data-open":r.currentBreakpointReady&&ce&&T||void 0,style:{...pe,"--bottom-size":`${R}px`,"--bottom-min-size":`${m}px`,"--bottom-max-size":`${c}px`}},t.createElement("div",{className:"rt-ShellBottomContent","data-visible":T||void 0},G),ze)});I.displayName="Shell.Bottom",I.Handle=b.BottomHandle;
2
2
  //# sourceMappingURL=shell-bottom.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/_internal/shell-bottom.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveInitialState } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { BottomHandle, PaneHandle } from './shell-handles.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation, PaneBaseProps } from '../shell.types.js';\nimport { extractPaneDomProps, mapResponsiveBooleanToPaneMode } from './shell-prop-helpers.js';\n\ntype BottomOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype BottomControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; defaultOpen?: never };\ntype BottomUncontrolledProps = { defaultOpen?: boolean; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; open?: never };\ntype BottomSizeControlledProps = { size: number | string; defaultSize?: never };\ntype BottomSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype BottomSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype BottomPublicProps = PaneBaseProps &\n (BottomControlledProps | BottomUncontrolledProps) &\n (BottomSizeControlledProps | BottomSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: BottomSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype BottomComponent = React.ForwardRefExoticComponent<BottomPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof BottomHandle };\n\nconst BOTTOM_DOM_PROP_KEYS = [\n 'className',\n 'children',\n 'defaultOpen',\n 'open',\n 'onOpenChange',\n 'size',\n 'defaultSize',\n 'onSizeChange',\n 'sizeUpdate',\n 'sizeUpdateMs',\n 'style',\n] as const satisfies readonly (keyof BottomPublicProps)[];\n\nexport const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>((initialProps, ref) => {\n const {\n className,\n presentation = 'fixed',\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 200,\n minSize = 100,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n } = initialProps;\n const bottomDomProps = extractPaneDomProps(initialProps, BOTTOM_DOM_PROP_KEYS);\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === BottomHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const normalizedControlledOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(open), [open]);\n const normalizedDefaultOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(defaultOpen), [defaultOpen]);\n const openIsResponsive = typeof open === 'object' && open !== null;\n useResponsiveInitialState<PaneMode>({\n controlledValue: normalizedControlledOpen,\n defaultValue: normalizedDefaultOpen,\n currentValue: shell.bottomMode,\n setValue: shell.setBottomMode,\n breakpointReady: shell.currentBreakpointReady,\n controlledIsResponsive: openIsResponsive,\n onResponsiveChange: (next) => onOpenChange?.(next === 'expanded', { reason: 'responsive' }),\n onInit: (initial) => {\n if (typeof open === 'undefined') {\n onOpenChange?.(initial === 'expanded', { reason: 'init' });\n }\n },\n });\n\n const emitSizeChange = React.useMemo(() => {\n const cb = onSizeChange as undefined | ((s: number, meta: BottomSizeChangeMeta) => void);\n const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: BottomSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: BottomSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: BottomSizeChangeMeta) => cb(s, meta);\n }, [onSizeChange, sizeUpdate, sizeUpdateMs]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n console.error('Shell.Bottom: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n if (typeof size !== 'undefined' && typeof defaultSize !== 'undefined') {\n console.error('Shell.Bottom: Do not pass both `size` and `defaultSize`. Choose one.');\n }\n }\n\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n console.warn('Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const initNotifiedRef = React.useRef(false);\n const lastBottomModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.bottomMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n if (typeof open === 'undefined') {\n if (lastBottomModeRef.current !== null && lastBottomModeRef.current !== shell.bottomMode) {\n onOpenChange?.(shell.bottomMode === 'expanded', { reason: 'toggle' });\n }\n lastBottomModeRef.current = shell.bottomMode;\n }\n }, [shell.bottomMode, open, defaultOpen, onOpenChange]);\n\n React.useEffect(() => {\n if (shell.bottomMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.bottomMode, onExpand, onCollapse]);\n\n const isExpanded = shell.bottomMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:bottom:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n try {\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to load persisted size', err);\n }\n return undefined;\n }\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, String(size));\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to save persisted size', err);\n }\n }\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n if (!resizable || !persistenceAdapter?.load || isOverlay) return undefined;\n const loaded = persistenceAdapter.load();\n const applyLoaded = (value?: number) => {\n if (!mounted || typeof value !== 'number' || !localRef.current) return;\n localRef.current.style.setProperty('--bottom-size', `${value}px`);\n onResize?.(value);\n };\n if (loaded instanceof Promise) {\n loaded.then(applyLoaded).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to load persisted size', err);\n }\n });\n } else {\n applyLoaded(loaded);\n }\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--bottom-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'horizontal',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const delta = client - startClient;\n return startSize - delta;\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'bottom',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setBottomMode('collapsed'),\n requestToggle: () => shell.togglePane('bottom'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Strip control/size props from DOM spread (moved above overlay return to keep hook order consistent)\n // Normalize CSS lengths to px (moved above overlay return to keep hook order consistent)\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientHeight || window.innerHeight || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled (moved above overlay return)\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof size === 'undefined' && typeof defaultSize !== 'undefined') {\n const px = normalizeToPx(defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync (moved above overlay return)\n const controlledSize = size;\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof controlledSize === 'undefined') return;\n const px = normalizeToPx(controlledSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.bottomMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setBottomMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"bottom\" style={{ padding: 0 }} height={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Bottom panel</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...bottomDomProps}\n ref={setRef}\n className={classNames('rt-ShellBottom', className)}\n data-mode={shell.bottomMode}\n data-peek={shell.peekTarget === 'bottom' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--bottom-size' as any]: `${expandedSize}px`,\n ['--bottom-min-size' as any]: `${minSize}px`,\n ['--bottom-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellBottomContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n}) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
5
- "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAuB,0BACvBC,EAA+B,iCAC/BC,GAAyB,+BACzBC,EAAqE,6BACrEC,GAAkC,6BAClCC,EAAyC,8BACzCC,GAA6B,6BAE7BC,EAAoE,mCAkBpE,MAAMC,GAAuB,CAC3B,YACA,WACA,cACA,OACA,eACA,OACA,cACA,eACA,aACA,eACA,OACF,EAEaZ,EAASE,EAAM,WAA8C,CAACW,EAAcC,IAAQ,CAC/F,KAAM,CACJ,UAAAC,EACA,aAAAC,EAAe,QACf,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,GAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,GACA,YAAAC,GACA,WAAAC,GACA,cAAAC,GACA,kBAAAC,GACA,OAAAC,EACA,YAAAC,EACA,SAAAC,GACA,MAAAC,GACA,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,aAAAC,EAAe,EACjB,EAAI5B,EACE6B,MAAiB,uBAAoB7B,EAAcD,EAAoB,EACvE+B,KAAQ,aAAS,EACjBC,KAAuB,6BAA0B5B,CAAY,EAC7D6B,EAAYD,IAAyB,UACrCE,GAA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ACF,CAEJ,CAEA,OACEnD,EAAA,cAAC,OACE,GAAGwC,GACJ,IAAKM,GACL,aAAW,EAAAiD,SAAW,iBAAkBlF,CAAS,EACjD,YAAW4B,EAAM,WACjB,YAAWA,EAAM,aAAe,UAAY,OAC5C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa0B,GAAe,OACxE,MAAO,CACL,GAAGpC,GACF,gBAAyB,GAAGhB,CAAY,KACxC,oBAA6B,GAAGC,CAAO,KACvC,oBAA6B,GAAGC,CAAO,IAC1C,GAEApB,EAAA,cAAC,OAAI,UAAU,wBAAwB,eAAcsE,GAAc,QAChEnB,CACH,EACC4B,EACH,CAEJ,CAAC,EACDjF,EAAO,YAAc,eACrBA,EAAO,OAAS",
6
- "names": ["shell_bottom_exports", "__export", "Bottom", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "import_shell_prop_helpers", "BOTTOM_DOM_PROP_KEYS", "initialProps", "ref", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "size", "defaultSize", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "bottomDomProps", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "normalizedControlledOpen", "normalizedDefaultOpen", "openIsResponsive", "next", "initial", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "initNotifiedRef", "lastBottomModeRef", "isExpanded", "persistenceAdapter", "key", "v", "mounted", "loaded", "applyLoaded", "value", "err", "handleEl", "client", "startClient", "startSize", "delta", "i", "normalizeToPx", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize", "o", "classNames"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveInitialState } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { BottomHandle, PaneHandle } from './shell-handles.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation, PaneBaseProps } from '../shell.types.js';\nimport { extractPaneDomProps, mapResponsiveBooleanToPaneMode } from './shell-prop-helpers.js';\n\ntype BottomOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype BottomControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; defaultOpen?: never };\ntype BottomUncontrolledProps = { defaultOpen?: boolean; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; open?: never };\ntype BottomSizeControlledProps = { size: number | string; defaultSize?: never };\ntype BottomSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype BottomSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype BottomPublicProps = PaneBaseProps &\n (BottomControlledProps | BottomUncontrolledProps) &\n (BottomSizeControlledProps | BottomSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: BottomSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype BottomComponent = React.ForwardRefExoticComponent<BottomPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof BottomHandle };\n\nconst BOTTOM_DOM_PROP_KEYS = [\n 'className',\n 'children',\n 'defaultOpen',\n 'open',\n 'onOpenChange',\n 'size',\n 'defaultSize',\n 'onSizeChange',\n 'sizeUpdate',\n 'sizeUpdateMs',\n 'style',\n] as const satisfies readonly (keyof BottomPublicProps)[];\n\nexport const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>((initialProps, ref) => {\n const {\n className,\n presentation = 'fixed',\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 200,\n minSize = 100,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n } = initialProps;\n const bottomDomProps = extractPaneDomProps(initialProps, BOTTOM_DOM_PROP_KEYS);\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === BottomHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const normalizedControlledOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(open), [open]);\n const normalizedDefaultOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(defaultOpen), [defaultOpen]);\n const openIsResponsive = typeof open === 'object' && open !== null;\n useResponsiveInitialState<PaneMode>({\n controlledValue: normalizedControlledOpen,\n defaultValue: normalizedDefaultOpen,\n currentValue: shell.bottomMode,\n setValue: shell.setBottomMode,\n breakpointReady: shell.currentBreakpointReady,\n controlledIsResponsive: openIsResponsive,\n onResponsiveChange: (next) => onOpenChange?.(next === 'expanded', { reason: 'responsive' }),\n onInit: (initial) => {\n if (typeof open === 'undefined') {\n onOpenChange?.(initial === 'expanded', { reason: 'init' });\n }\n },\n });\n\n const emitSizeChange = React.useMemo(() => {\n const cb = onSizeChange as undefined | ((s: number, meta: BottomSizeChangeMeta) => void);\n const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: BottomSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: BottomSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: BottomSizeChangeMeta) => cb(s, meta);\n }, [onSizeChange, sizeUpdate, sizeUpdateMs]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n console.error('Shell.Bottom: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n if (typeof size !== 'undefined' && typeof defaultSize !== 'undefined') {\n console.error('Shell.Bottom: Do not pass both `size` and `defaultSize`. Choose one.');\n }\n }\n\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n console.warn('Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const initNotifiedRef = React.useRef(false);\n const lastBottomModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.bottomMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n if (typeof open === 'undefined') {\n if (lastBottomModeRef.current !== null && lastBottomModeRef.current !== shell.bottomMode) {\n onOpenChange?.(shell.bottomMode === 'expanded', { reason: 'toggle' });\n }\n lastBottomModeRef.current = shell.bottomMode;\n }\n }, [shell.bottomMode, open, defaultOpen, onOpenChange]);\n\n // Track previous mode to only fire callbacks on actual user-initiated state transitions.\n // We wait for breakpointReady to ensure the initial state sync from useResponsiveInitialState\n // is complete before enabling callbacks. This avoids spurious callbacks during initialization.\n const prevBottomModeRef = React.useRef<PaneMode | null>(null);\n const hasInitializedRef = React.useRef(false);\n React.useEffect(() => {\n const currentMode = shell.bottomMode;\n\n // Wait for breakpoint to be ready before enabling callbacks\n if (!shell.currentBreakpointReady) {\n prevBottomModeRef.current = currentMode;\n return;\n }\n\n // Skip the first run after breakpoint is ready - this captures the post-sync state\n if (!hasInitializedRef.current) {\n hasInitializedRef.current = true;\n prevBottomModeRef.current = currentMode;\n return;\n }\n\n const prevMode = prevBottomModeRef.current;\n\n // Only fire on actual state transitions\n if (prevMode !== null && prevMode !== currentMode) {\n if (currentMode === 'expanded') {\n onExpand?.();\n } else if (currentMode === 'collapsed') {\n onCollapse?.();\n }\n prevBottomModeRef.current = currentMode;\n }\n }, [shell.bottomMode, shell.currentBreakpointReady, onExpand, onCollapse]);\n\n const isExpanded = shell.bottomMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:bottom:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n try {\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to load persisted size', err);\n }\n return undefined;\n }\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, String(size));\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to save persisted size', err);\n }\n }\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n if (!resizable || !persistenceAdapter?.load || isOverlay) return undefined;\n const loaded = persistenceAdapter.load();\n const applyLoaded = (value?: number) => {\n if (!mounted || typeof value !== 'number' || !localRef.current) return;\n localRef.current.style.setProperty('--bottom-size', `${value}px`);\n onResize?.(value);\n };\n if (loaded instanceof Promise) {\n loaded.then(applyLoaded).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Bottom: failed to load persisted size', err);\n }\n });\n } else {\n applyLoaded(loaded);\n }\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--bottom-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'horizontal',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const delta = client - startClient;\n return startSize - delta;\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'bottom',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setBottomMode('collapsed'),\n requestToggle: () => shell.togglePane('bottom'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Strip control/size props from DOM spread (moved above overlay return to keep hook order consistent)\n // Normalize CSS lengths to px (moved above overlay return to keep hook order consistent)\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientHeight || window.innerHeight || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled (moved above overlay return)\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof size === 'undefined' && typeof defaultSize !== 'undefined') {\n const px = normalizeToPx(defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync (moved above overlay return)\n const controlledSize = size;\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof controlledSize === 'undefined') return;\n const px = normalizeToPx(controlledSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.bottomMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setBottomMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"bottom\" style={{ padding: 0 }} height={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Bottom panel</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...bottomDomProps}\n ref={setRef}\n className={classNames('rt-ShellBottom', className)}\n data-mode={shell.bottomMode}\n data-peek={shell.peekTarget === 'bottom' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--bottom-size' as any]: `${expandedSize}px`,\n ['--bottom-min-size' as any]: `${minSize}px`,\n ['--bottom-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellBottomContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n}) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
5
+ "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,GAAuB,yBACvBC,EAAuB,0BACvBC,GAA+B,iCAC/BC,GAAyB,+BACzBC,EAAqE,6BACrEC,GAAkC,6BAClCC,EAAyC,8BACzCC,GAA6B,6BAE7BC,EAAoE,mCAkBpE,MAAMC,GAAuB,CAC3B,YACA,WACA,cACA,OACA,eACA,OACA,cACA,eACA,aACA,eACA,OACF,EAEaZ,EAASE,EAAM,WAA8C,CAACW,EAAcC,IAAQ,CAC/F,KAAM,CACJ,UAAAC,EACA,aAAAC,EAAe,QACf,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,GAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,GACA,YAAAC,GACA,WAAAC,GACA,cAAAC,GACA,kBAAAC,GACA,OAAAC,EACA,YAAAC,EACA,SAAAC,GACA,MAAAC,GACA,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,aAAAC,EAAe,EACjB,EAAI5B,EACE6B,MAAiB,uBAAoB7B,EA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vC,EAAeuC,EAAS,CAAE,OAAQ,YAAa,CAAC,CAClD,CACF,EAAG,CAACC,EAAgB9E,EAASC,EAASqE,EAAehC,CAAc,CAAC,EAEhEd,EAAW,CACb,MAAM3B,EAAOyB,EAAM,aAAe,WAClC,OACEzC,EAAA,cAACE,EAAM,KAAN,CAAW,KAAMc,EAAM,aAAe,GAAMyB,EAAM,cAAc,EAAI,WAAa,WAAW,GAC3FzC,EAAA,cAACE,EAAM,QAAN,CAAc,KAAK,SAAS,MAAO,CAAE,QAAS,CAAE,EAAG,OAAQ,CAAE,QAAS,GAAGgB,CAAY,IAAK,GACzFlB,EAAA,cAAC,uBACCA,EAAA,cAACE,EAAM,MAAN,KAAY,cAAY,CAC3B,EACCiD,CACH,CACF,CAEJ,CAEA,OACEnD,EAAA,cAAC,OACE,GAAGwC,GACJ,IAAKM,GACL,aAAW,GAAAoD,SAAW,iBAAkBrF,CAAS,EACjD,YAAW4B,EAAM,WACjB,YAAWA,EAAM,aAAe,UAAY,OAC5C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa8B,GAAe,OACxE,MAAO,CACL,GAAGxC,GACF,gBAAyB,GAAGhB,CAAY,KACxC,oBAA6B,GAAGC,CAAO,KACvC,oBAA6B,GAAGC,CAAO,IAC1C,GAEApB,EAAA,cAAC,OAAI,UAAU,wBAAwB,eAAc0E,GAAc,QAChEvB,CACH,EACCgC,EACH,CAEJ,CAAC,EACDrF,EAAO,YAAc,eACrBA,EAAO,OAAS",
6
+ "names": ["shell_bottom_exports", "__export", "Bottom", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "import_shell_prop_helpers", "BOTTOM_DOM_PROP_KEYS", "initialProps", "ref", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "size", "defaultSize", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "bottomDomProps", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "normalizedControlledOpen", "normalizedDefaultOpen", "openIsResponsive", "next", "initial", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "initNotifiedRef", "lastBottomModeRef", "prevBottomModeRef", "hasInitializedRef", "currentMode", "prevMode", "isExpanded", "persistenceAdapter", "key", "v", "mounted", "loaded", "applyLoaded", "value", "err", "handleEl", "client", "startClient", "startSize", "delta", "i", "normalizeToPx", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize", "classNames"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shell-inspector.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,eAAe,EAAc,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAyD,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG1H,KAAK,uBAAuB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAA;CAAE,CAAC;AAC5E,KAAK,wBAAwB,GAAG;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AACrL,KAAK,0BAA0B,GAAG;IAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UA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,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEJ,KAAK,kBAAkB,GAAG,KAAK,CAAC,yBAAyB,CAAC,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,eAAe,CAAA;CAAE,CAAC;AAgB3J,eAAO,MAAM,SAAS,EA0VhB,kBAAkB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var Pe=Object.create;var g=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Se=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var Me=(i,a)=>{for(var l in a)g(i,l,{get:a[l],enumerable:!0})},Q=(i,a,l,b)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of ze(a))!Ie.call(i,p)&&p!==l&&g(i,p,{get:()=>a[p],enumerable:!(b=be(a,p))||b.enumerable});return i};var H=(i,a,l)=>(l=i!=null?Pe(Se(i)):{},Q(a||!i||!i.__esModule?g(l,"default",{value:i,enumerable:!0}):l,i)),ge=i=>Q(g({},"__esModule",{value:!0}),i);var Ce={};Me(Ce,{Inspector:()=>F});module.exports=ge(Ce);var n=H(require("react")),X=H(require("classnames")),B=H(require("../sheet.js")),Z=require("../visually-hidden.js"),ee=require("../shell.context.js"),x=require("../shell.hooks.js"),ne=require("./shell-resize.js"),y=require("./shell-handles.js"),ve=require("../shell.types.js"),P=require("./shell-prop-helpers.js");const xe=["className","children","defaultOpen","open","onOpenChange","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],F=n.forwardRef((i,a)=>{const{className:l,presentation:b={initial:"overlay",lg:"fixed"},defaultOpen:p,open:d,onOpenChange:h,expandedSize:C=320,minSize:f=200,maxSize:m=500,resizable:R=!1,collapsible:te=!0,onExpand:U,onCollapse:_,onResize:v,onResizeStart:oe,onResizeEnd:re,snapPoints:se,snapTolerance:ie,collapseThreshold:ae,paneId:E,persistence:N,children:le,style:pe,onSizeChange:$,sizeUpdate:L,sizeUpdateMs:A=50,size:W,defaultSize:j}=i,de=(0,P.extractPaneDomProps)(i,xe),r=(0,ee.useShell)(),O=(0,x.useResponsivePresentation)(b),z=O==="overlay",ce=O==="stacked",u=n.useRef(null),ue=n.useCallback(e=>{u.current=e,typeof a=="function"?a(e):a&&(a.current=e)},[a]),q=n.Children.toArray(le),K=q.filter(e=>n.isValidElement(e)&&e.type===y.InspectorHandle),Y=q.filter(e=>!(n.isValidElement(e)&&e.type===y.InspectorHandle)),fe=n.useMemo(()=>(0,P.mapResponsiveBooleanToPaneMode)(d),[d]),me=n.useMemo(()=>(0,P.mapResponsiveBooleanToPaneMode)(p),[p]),ye=typeof d=="object"&&d!==null;(0,x.useResponsiveInitialState)({controlledValue:fe,defaultValue:me,currentValue:r.inspectorMode,setValue:r.setInspectorMode,breakpointReady:r.currentBreakpointReady,controlledIsResponsive:ye,onResponsiveChange:e=>h?.(e==="expanded",{reason:"responsive"}),onInit:e=>{typeof d>"u"&&h?.(e==="expanded",{reason:"init"})}});const S=n.useMemo(()=>{const e=$,o=L,s=A??50;if(!e)return()=>{};if(o==="debounce"){let t=null;return(c,V)=>{t&&clearTimeout(t),t=setTimeout(()=>{e(c,V)},s)}}if(o==="throttle"){let t=0;return(c,V)=>{const J=Date.now();J-t>=s&&(t=J,e(c,V))}}return(t,c)=>e(t,c)},[$,L,A]),I=n.useRef(null);n.useEffect(()=>{const e=typeof d<"u";if(I.current===null){I.current=e;return}I.current!==e&&(console.warn("Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported."),I.current=e)},[d]);const G=n.useRef(!1),w=n.useRef(null);n.useEffect(()=>{!G.current&&typeof d>"u"&&p&&r.inspectorMode==="expanded"&&(h?.(!0,{reason:"init"}),G.current=!0),typeof d>"u"&&(w.current!==null&&w.current!==r.inspectorMode&&h?.(r.inspectorMode==="expanded",{reason:"toggle"}),w.current=r.inspectorMode)},[r.inspectorMode,d,p,h]),n.useEffect(()=>{r.inspectorMode==="expanded"?U?.():_?.()},[r.inspectorMode,U,_]);const k=r.inspectorMode==="expanded",M=n.useMemo(()=>{if(!E||N)return N;const e=`kookie-ui:shell:inspector:${E}`;return{load:()=>{if(!(typeof window>"u"))try{const s=window.localStorage.getItem(e);return s?Number(s):void 0}catch{return}},save:s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(s))}catch{}}}},[E,N]);n.useEffect(()=>{let e=!0;if(!R||!M?.load||z)return;const o=M.load(),s=t=>{!e||typeof t!="number"||!u.current||(u.current.style.setProperty("--inspector-size",`${t}px`),v?.(t))};return o instanceof Promise?o.then(s).catch(t=>{}):s(o),()=>{e=!1}},[R,M,v,z]);const he=R&&!z&&k?n.createElement(ne.PaneResizeContext.Provider,{value:{containerRef:u,cssVarName:"--inspector-size",minSize:f,maxSize:m,defaultSize:C,orientation:"vertical",edge:"start",computeNext:(e,o,s)=>{const t=getComputedStyle(u.current).direction==="rtl",c=e-o;return s+(t?c:-c)},onResize:v,onResizeStart:oe,onResizeEnd:e=>{re?.(e),S(e,{reason:"resize"}),M?.save?.(e)},target:"inspector",collapsible:te,snapPoints:se,snapTolerance:ie??8,collapseThreshold:ae,requestCollapse:()=>r.setInspectorMode("collapsed"),requestToggle:()=>r.togglePane("inspector")}},K.length>0?K.map((e,o)=>n.cloneElement(e,{key:e.key??o})):n.createElement(y.PaneHandle,null)):null,T=n.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const o=String(e).trim();if(!o)return;if(o.endsWith("px"))return Number.parseFloat(o);if(o.endsWith("rem")){const t=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*t}if(o.endsWith("%")){const t=Number.parseFloat(o),c=document.documentElement.clientWidth||window.innerWidth||0;return t/100*c}const s=Number.parseFloat(o);return Number.isFinite(s)?s:void 0},[]);n.useEffect(()=>{if(u.current&&typeof W>"u"&&typeof j<"u"){const e=T(j);if(typeof e=="number"&&Number.isFinite(e)){const t=Math.min((typeof m=="number"?m:void 0)??e,Math.max((typeof f=="number"?f:void 0)??e,e));u.current.style.setProperty("--inspector-size",`${t}px`),S(t,{reason:"init"})}}},[]);const D=W;if(n.useEffect(()=>{if(!u.current||typeof D>"u")return;const e=T(D);if(typeof e=="number"&&Number.isFinite(e)){const t=Math.min((typeof m=="number"?m:void 0)??e,Math.max((typeof f=="number"?f:void 0)??e,e));u.current.style.setProperty("--inspector-size",`${t}px`),S(t,{reason:"controlled"})}},[D,f,m,T,S]),z){const e=r.inspectorMode==="expanded";return n.createElement(B.Root,{open:e,onOpenChange:o=>r.setInspectorMode(o?"expanded":"collapsed")},n.createElement(B.Content,{side:"end",style:{padding:0},width:{initial:`${C}px`}},n.createElement(Z.VisuallyHidden,null,n.createElement(B.Title,null,"Inspector")),Y))}return n.createElement("div",{...de,ref:ue,className:(0,X.default)("rt-ShellInspector",l),"data-mode":r.inspectorMode,"data-peek":r.peekTarget==="inspector"||void 0,"data-presentation":r.currentBreakpointReady?O:void 0,"data-open":r.currentBreakpointReady&&ce&&k||void 0,style:{...pe,"--inspector-size":`${C}px`,"--inspector-min-size":`${f}px`,"--inspector-max-size":`${m}px`}},n.createElement("div",{className:"rt-ShellInspectorContent","data-visible":k||void 0},Y),he)});F.displayName="Shell.Inspector",F.Handle=y.InspectorHandle;
1
+ "use strict";var ze=Object.create;var g=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var ge=(i,a)=>{for(var l in a)g(i,l,{get:a[l],enumerable:!0})},Z=(i,a,l,b)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of Ie(a))!Re.call(i,p)&&p!==l&&g(i,p,{get:()=>a[p],enumerable:!(b=Se(a,p))||b.enumerable});return i};var H=(i,a,l)=>(l=i!=null?ze(Me(i)):{},Z(a||!i||!i.__esModule?g(l,"default",{value:i,enumerable:!0}):l,i)),xe=i=>Z(g({},"__esModule",{value:!0}),i);var ve={};ge(ve,{Inspector:()=>U});module.exports=xe(ve);var n=H(require("react")),ee=H(require("classnames")),F=H(require("../sheet.js")),ne=require("../visually-hidden.js"),te=require("../shell.context.js"),x=require("../shell.hooks.js"),oe=require("./shell-resize.js"),y=require("./shell-handles.js"),Ne=require("../shell.types.js"),P=require("./shell-prop-helpers.js");const Ce=["className","children","defaultOpen","open","onOpenChange","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],U=n.forwardRef((i,a)=>{const{className:l,presentation:b={initial:"overlay",lg:"fixed"},defaultOpen:p,open:d,onOpenChange:h,expandedSize:C=320,minSize:f=200,maxSize:m=500,resizable:v=!1,collapsible:re=!0,onExpand:_,onCollapse:$,onResize:E,onResizeStart:se,onResizeEnd:ie,snapPoints:ae,snapTolerance:le,collapseThreshold:pe,paneId:N,persistence:O,children:de,style:ce,onSizeChange:L,sizeUpdate:A,sizeUpdateMs:W=50,size:j,defaultSize:q}=i,ue=(0,P.extractPaneDomProps)(i,Ce),r=(0,te.useShell)(),w=(0,x.useResponsivePresentation)(b),z=w==="overlay",fe=w==="stacked",u=n.useRef(null),me=n.useCallback(e=>{u.current=e,typeof a=="function"?a(e):a&&(a.current=e)},[a]),K=n.Children.toArray(de),Y=K.filter(e=>n.isValidElement(e)&&e.type===y.InspectorHandle),G=K.filter(e=>!(n.isValidElement(e)&&e.type===y.InspectorHandle)),ye=n.useMemo(()=>(0,P.mapResponsiveBooleanToPaneMode)(d),[d]),he=n.useMemo(()=>(0,P.mapResponsiveBooleanToPaneMode)(p),[p]),Pe=typeof d=="object"&&d!==null;(0,x.useResponsiveInitialState)({controlledValue:ye,defaultValue:he,currentValue:r.inspectorMode,setValue:r.setInspectorMode,breakpointReady:r.currentBreakpointReady,controlledIsResponsive:Pe,onResponsiveChange:e=>h?.(e==="expanded",{reason:"responsive"}),onInit:e=>{typeof d>"u"&&h?.(e==="expanded",{reason:"init"})}});const S=n.useMemo(()=>{const e=L,t=A,s=W??50;if(!e)return()=>{};if(t==="debounce"){let o=null;return(c,B)=>{o&&clearTimeout(o),o=setTimeout(()=>{e(c,B)},s)}}if(t==="throttle"){let o=0;return(c,B)=>{const X=Date.now();X-o>=s&&(o=X,e(c,B))}}return(o,c)=>e(o,c)},[L,A,W]),I=n.useRef(null);n.useEffect(()=>{const e=typeof d<"u";if(I.current===null){I.current=e;return}I.current!==e&&(console.warn("Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported."),I.current=e)},[d]);const J=n.useRef(!1),k=n.useRef(null);n.useEffect(()=>{!J.current&&typeof d>"u"&&p&&r.inspectorMode==="expanded"&&(h?.(!0,{reason:"init"}),J.current=!0),typeof d>"u"&&(k.current!==null&&k.current!==r.inspectorMode&&h?.(r.inspectorMode==="expanded",{reason:"toggle"}),k.current=r.inspectorMode)},[r.inspectorMode,d,p,h]);const M=n.useRef(null),Q=n.useRef(!1);n.useEffect(()=>{const e=r.inspectorMode;if(!r.currentBreakpointReady){M.current=e;return}if(!Q.current){Q.current=!0,M.current=e;return}const t=M.current;t!==null&&t!==e&&(e==="expanded"?_?.():e==="collapsed"&&$?.(),M.current=e)},[r.inspectorMode,r.currentBreakpointReady,_,$]);const T=r.inspectorMode==="expanded",R=n.useMemo(()=>{if(!N||O)return O;const e=`kookie-ui:shell:inspector:${N}`;return{load:()=>{if(!(typeof window>"u"))try{const s=window.localStorage.getItem(e);return s?Number(s):void 0}catch{return}},save:s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(s))}catch{}}}},[N,O]);n.useEffect(()=>{let e=!0;if(!v||!R?.load||z)return;const t=R.load(),s=o=>{!e||typeof o!="number"||!u.current||(u.current.style.setProperty("--inspector-size",`${o}px`),E?.(o))};return t instanceof Promise?t.then(s).catch(o=>{}):s(t),()=>{e=!1}},[v,R,E,z]);const be=v&&!z&&T?n.createElement(oe.PaneResizeContext.Provider,{value:{containerRef:u,cssVarName:"--inspector-size",minSize:f,maxSize:m,defaultSize:C,orientation:"vertical",edge:"start",computeNext:(e,t,s)=>{const o=getComputedStyle(u.current).direction==="rtl",c=e-t;return s+(o?c:-c)},onResize:E,onResizeStart:se,onResizeEnd:e=>{ie?.(e),S(e,{reason:"resize"}),R?.save?.(e)},target:"inspector",collapsible:re,snapPoints:ae,snapTolerance:le??8,collapseThreshold:pe,requestCollapse:()=>r.setInspectorMode("collapsed"),requestToggle:()=>r.togglePane("inspector")}},Y.length>0?Y.map((e,t)=>n.cloneElement(e,{key:e.key??t})):n.createElement(y.PaneHandle,null)):null,D=n.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const t=String(e).trim();if(!t)return;if(t.endsWith("px"))return Number.parseFloat(t);if(t.endsWith("rem")){const o=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(t)*o}if(t.endsWith("%")){const o=Number.parseFloat(t),c=document.documentElement.clientWidth||window.innerWidth||0;return o/100*c}const s=Number.parseFloat(t);return Number.isFinite(s)?s:void 0},[]);n.useEffect(()=>{if(u.current&&typeof j>"u"&&typeof q<"u"){const e=D(q);if(typeof e=="number"&&Number.isFinite(e)){const o=Math.min((typeof m=="number"?m:void 0)??e,Math.max((typeof f=="number"?f:void 0)??e,e));u.current.style.setProperty("--inspector-size",`${o}px`),S(o,{reason:"init"})}}},[]);const V=j;if(n.useEffect(()=>{if(!u.current||typeof V>"u")return;const e=D(V);if(typeof e=="number"&&Number.isFinite(e)){const o=Math.min((typeof m=="number"?m:void 0)??e,Math.max((typeof f=="number"?f:void 0)??e,e));u.current.style.setProperty("--inspector-size",`${o}px`),S(o,{reason:"controlled"})}},[V,f,m,D,S]),z){const e=r.inspectorMode==="expanded";return n.createElement(F.Root,{open:e,onOpenChange:t=>r.setInspectorMode(t?"expanded":"collapsed")},n.createElement(F.Content,{side:"end",style:{padding:0},width:{initial:`${C}px`}},n.createElement(ne.VisuallyHidden,null,n.createElement(F.Title,null,"Inspector")),G))}return n.createElement("div",{...ue,ref:me,className:(0,ee.default)("rt-ShellInspector",l),"data-mode":r.inspectorMode,"data-peek":r.peekTarget==="inspector"||void 0,"data-presentation":r.currentBreakpointReady?w:void 0,"data-open":r.currentBreakpointReady&&fe&&T||void 0,style:{...ce,"--inspector-size":`${C}px`,"--inspector-min-size":`${f}px`,"--inspector-max-size":`${m}px`}},n.createElement("div",{className:"rt-ShellInspectorContent","data-visible":T||void 0},G),be)});U.displayName="Shell.Inspector",U.Handle=y.InspectorHandle;
2
2
  //# sourceMappingURL=shell-inspector.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/_internal/shell-inspector.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveInitialState } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation, PaneBaseProps } from '../shell.types.js';\nimport { extractPaneDomProps, mapResponsiveBooleanToPaneMode } from './shell-prop-helpers.js';\n\ntype InspectorOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype InspectorControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; defaultOpen?: never };\ntype InspectorUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; open?: never };\ntype InspectorSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype InspectorSizeControlledProps = { size: number | string; defaultSize?: never };\ntype InspectorSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype InspectorPublicProps = PaneBaseProps &\n (InspectorControlledProps | InspectorUncontrolledProps) &\n (InspectorSizeControlledProps | InspectorSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: InspectorSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nconst INSPECTOR_DOM_PROP_KEYS = [\n 'className',\n 'children',\n 'defaultOpen',\n 'open',\n 'onOpenChange',\n 'size',\n 'defaultSize',\n 'onSizeChange',\n 'sizeUpdate',\n 'sizeUpdateMs',\n 'style',\n] as const satisfies readonly (keyof InspectorPublicProps)[];\n\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>((initialProps, ref) => {\n const {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n size,\n defaultSize,\n } = initialProps;\n const inspectorDomProps = extractPaneDomProps(initialProps, INSPECTOR_DOM_PROP_KEYS);\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === InspectorHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const normalizedControlledOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(open), [open]);\n const normalizedDefaultOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(defaultOpen), [defaultOpen]);\n const openIsResponsive = typeof open === 'object' && open !== null;\n useResponsiveInitialState<PaneMode>({\n controlledValue: normalizedControlledOpen,\n defaultValue: normalizedDefaultOpen,\n currentValue: shell.inspectorMode,\n setValue: shell.setInspectorMode,\n breakpointReady: shell.currentBreakpointReady,\n controlledIsResponsive: openIsResponsive,\n onResponsiveChange: (next) => onOpenChange?.(next === 'expanded', { reason: 'responsive' }),\n onInit: (initial) => {\n if (typeof open === 'undefined') {\n onOpenChange?.(initial === 'expanded', { reason: 'init' });\n }\n },\n });\n\n const emitSizeChange = React.useMemo(() => {\n const cb = onSizeChange as undefined | ((s: number, meta: InspectorSizeChangeMeta) => void);\n const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: InspectorSizeChangeMeta) => cb(s, meta);\n }, [onSizeChange, sizeUpdate, sizeUpdateMs]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n console.error('Shell.Inspector: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n }\n\n // Warn on controlled/uncontrolled mode switch\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n console.warn('Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const initNotifiedRef = React.useRef(false);\n const lastInspectorModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n // Notify init open\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.inspectorMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n\n // Notify toggles when uncontrolled (avoid double-notify after responsive change)\n if (typeof open === 'undefined') {\n if (lastInspectorModeRef.current !== null && lastInspectorModeRef.current !== shell.inspectorMode) {\n onOpenChange?.(shell.inspectorMode === 'expanded', { reason: 'toggle' });\n }\n lastInspectorModeRef.current = shell.inspectorMode;\n }\n }, [shell.inspectorMode, open, defaultOpen, onOpenChange]);\n\n React.useEffect(() => {\n if (shell.inspectorMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.inspectorMode, onExpand, onCollapse]);\n\n const isExpanded = shell.inspectorMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:inspector:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n try {\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to load persisted size', err);\n }\n return undefined;\n }\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, String(size));\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to save persisted size', err);\n }\n }\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n if (!resizable || !persistenceAdapter?.load || isOverlay) return undefined;\n const loaded = persistenceAdapter.load();\n const applyLoaded = (value?: number) => {\n if (!mounted || typeof value !== 'number' || !localRef.current) return;\n localRef.current.style.setProperty('--inspector-size', `${value}px`);\n onResize?.(value);\n };\n if (loaded instanceof Promise) {\n loaded.then(applyLoaded).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to load persisted size', err);\n }\n });\n } else {\n applyLoaded(loaded);\n }\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--inspector-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? delta : -delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'inspector',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setInspectorMode('collapsed'),\n requestToggle: () => shell.togglePane('inspector'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Normalize CSS lengths to px\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientWidth || window.innerWidth || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof size === 'undefined' && typeof defaultSize !== 'undefined') {\n const px = normalizeToPx(defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync\n const controlledSize = size;\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof controlledSize === 'undefined') return;\n const px = normalizeToPx(controlledSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.inspectorMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setInspectorMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"end\" style={{ padding: 0 }} width={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Inspector</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n // Strip control/size props from DOM spread\n return (\n <div\n {...inspectorDomProps}\n ref={setRef}\n className={classNames('rt-ShellInspector', className)}\n data-mode={shell.inspectorMode}\n data-peek={shell.peekTarget === 'inspector' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--inspector-size' as any]: `${expandedSize}px`,\n ['--inspector-min-size' as any]: `${minSize}px`,\n ['--inspector-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellInspectorContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n}) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
5
- "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAuB,0BACvBC,EAA+B,iCAC/BC,GAAyB,+BACzBC,EAAqE,6BACrEC,GAAkC,6BAClCC,EAA4C,8BAC5CC,GAA6B,6BAE7BC,EAAoE,mCAkBpE,MAAMC,GAA0B,CAC9B,YACA,WACA,cACA,OACA,eACA,OACA,cACA,eACA,aACA,eACA,OACF,EAEaZ,EAAYE,EAAM,WAAiD,CAACW,EAAcC,IAAQ,CACrG,KAAM,CACJ,UAAAC,EACA,aAAAC,EAAe,CAAE,QAAS,UAAW,GAAI,OAAQ,EACjD,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,GAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,GACA,YAAAC,GACA,WAAAC,GACA,cAAAC,GACA,kBAAAC,GACA,OAAAC,EACA,YAAAC,EACA,SAAAC,GACA,MAAAC,GACA,aAAAC,EACA,WAAAC,EACA,aAAAC,EAAe,GACf,KAAAC,EACA,YAAAC,CACF,EAAI5B,EACE6B,MAAoB,uBA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AA,cAACE,EAAM,QAAN,CAAc,KAAK,MAAM,MAAO,CAAE,QAAS,CAAE,EAAG,MAAO,CAAE,QAAS,GAAGgB,CAAY,IAAK,GACrFlB,EAAA,cAAC,sBACCA,EAAA,cAACE,EAAM,MAAN,KAAY,WAAS,CACxB,EACCiD,CACH,CACF,CAEJ,CAGA,OACEnD,EAAA,cAAC,OACE,GAAGwC,GACJ,IAAKM,GACL,aAAW,EAAAgD,SAAW,oBAAqBjF,CAAS,EACpD,YAAW4B,EAAM,cACjB,YAAWA,EAAM,aAAe,aAAe,OAC/C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAayB,GAAe,OACxE,MAAO,CACL,GAAGnC,GACF,mBAA4B,GAAGhB,CAAY,KAC3C,uBAAgC,GAAGC,CAAO,KAC1C,uBAAgC,GAAGC,CAAO,IAC7C,GAEApB,EAAA,cAAC,OAAI,UAAU,2BAA2B,eAAcqE,GAAc,QACnElB,CACH,EACC2B,EACH,CAEJ,CAAC,EAEDhF,EAAU,YAAc,kBACxBA,EAAU,OAAS",
6
- "names": ["shell_inspector_exports", "__export", "Inspector", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "import_shell_prop_helpers", "INSPECTOR_DOM_PROP_KEYS", "initialProps", "ref", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "size", "defaultSize", "inspectorDomProps", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "normalizedControlledOpen", "normalizedDefaultOpen", "openIsResponsive", "next", "initial", "emitSizeChange", "cb", "strategy", "ms", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "initNotifiedRef", "lastInspectorModeRef", "isExpanded", "persistenceAdapter", "key", "v", "mounted", "loaded", "applyLoaded", "value", "err", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "normalizeToPx", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize", "classNames"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveInitialState } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { _BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation, PaneBaseProps } from '../shell.types.js';\nimport { extractPaneDomProps, mapResponsiveBooleanToPaneMode } from './shell-prop-helpers.js';\n\ntype InspectorOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype InspectorControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; defaultOpen?: never };\ntype InspectorUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; open?: never };\ntype InspectorSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype InspectorSizeControlledProps = { size: number | string; defaultSize?: never };\ntype InspectorSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype InspectorPublicProps = PaneBaseProps &\n (InspectorControlledProps | InspectorUncontrolledProps) &\n (InspectorSizeControlledProps | InspectorSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: InspectorSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nconst INSPECTOR_DOM_PROP_KEYS = [\n 'className',\n 'children',\n 'defaultOpen',\n 'open',\n 'onOpenChange',\n 'size',\n 'defaultSize',\n 'onSizeChange',\n 'sizeUpdate',\n 'sizeUpdateMs',\n 'style',\n] as const satisfies readonly (keyof InspectorPublicProps)[];\n\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>((initialProps, ref) => {\n const {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n size,\n defaultSize,\n } = initialProps;\n const inspectorDomProps = extractPaneDomProps(initialProps, INSPECTOR_DOM_PROP_KEYS);\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === InspectorHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const normalizedControlledOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(open), [open]);\n const normalizedDefaultOpen = React.useMemo(() => mapResponsiveBooleanToPaneMode(defaultOpen), [defaultOpen]);\n const openIsResponsive = typeof open === 'object' && open !== null;\n useResponsiveInitialState<PaneMode>({\n controlledValue: normalizedControlledOpen,\n defaultValue: normalizedDefaultOpen,\n currentValue: shell.inspectorMode,\n setValue: shell.setInspectorMode,\n breakpointReady: shell.currentBreakpointReady,\n controlledIsResponsive: openIsResponsive,\n onResponsiveChange: (next) => onOpenChange?.(next === 'expanded', { reason: 'responsive' }),\n onInit: (initial) => {\n if (typeof open === 'undefined') {\n onOpenChange?.(initial === 'expanded', { reason: 'init' });\n }\n },\n });\n\n const emitSizeChange = React.useMemo(() => {\n const cb = onSizeChange as undefined | ((s: number, meta: InspectorSizeChangeMeta) => void);\n const strategy = sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: InspectorSizeChangeMeta) => cb(s, meta);\n }, [onSizeChange, sizeUpdate, sizeUpdateMs]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n console.error('Shell.Inspector: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n }\n\n // Warn on controlled/uncontrolled mode switch\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n console.warn('Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const initNotifiedRef = React.useRef(false);\n const lastInspectorModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n // Notify init open\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.inspectorMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n\n // Notify toggles when uncontrolled (avoid double-notify after responsive change)\n if (typeof open === 'undefined') {\n if (lastInspectorModeRef.current !== null && lastInspectorModeRef.current !== shell.inspectorMode) {\n onOpenChange?.(shell.inspectorMode === 'expanded', { reason: 'toggle' });\n }\n lastInspectorModeRef.current = shell.inspectorMode;\n }\n }, [shell.inspectorMode, open, defaultOpen, onOpenChange]);\n\n // Track previous mode to only fire callbacks on actual user-initiated state transitions.\n // We wait for breakpointReady to ensure the initial state sync from useResponsiveInitialState\n // is complete before enabling callbacks. This avoids spurious callbacks during initialization.\n const prevInspectorModeRef = React.useRef<PaneMode | null>(null);\n const hasInitializedRef = React.useRef(false);\n React.useEffect(() => {\n const currentMode = shell.inspectorMode;\n\n // Wait for breakpoint to be ready before enabling callbacks\n if (!shell.currentBreakpointReady) {\n prevInspectorModeRef.current = currentMode;\n return;\n }\n\n // Skip the first run after breakpoint is ready - this captures the post-sync state\n if (!hasInitializedRef.current) {\n hasInitializedRef.current = true;\n prevInspectorModeRef.current = currentMode;\n return;\n }\n\n const prevMode = prevInspectorModeRef.current;\n\n // Only fire on actual state transitions\n if (prevMode !== null && prevMode !== currentMode) {\n if (currentMode === 'expanded') {\n onExpand?.();\n } else if (currentMode === 'collapsed') {\n onCollapse?.();\n }\n prevInspectorModeRef.current = currentMode;\n }\n }, [shell.inspectorMode, shell.currentBreakpointReady, onExpand, onCollapse]);\n\n const isExpanded = shell.inspectorMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:inspector:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n try {\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to load persisted size', err);\n }\n return undefined;\n }\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, String(size));\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to save persisted size', err);\n }\n }\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n if (!resizable || !persistenceAdapter?.load || isOverlay) return undefined;\n const loaded = persistenceAdapter.load();\n const applyLoaded = (value?: number) => {\n if (!mounted || typeof value !== 'number' || !localRef.current) return;\n localRef.current.style.setProperty('--inspector-size', `${value}px`);\n onResize?.(value);\n };\n if (loaded instanceof Promise) {\n loaded.then(applyLoaded).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Shell.Inspector: failed to load persisted size', err);\n }\n });\n } else {\n applyLoaded(loaded);\n }\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--inspector-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? delta : -delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'inspector',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setInspectorMode('collapsed'),\n requestToggle: () => shell.togglePane('inspector'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Normalize CSS lengths to px\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientWidth || window.innerWidth || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof size === 'undefined' && typeof defaultSize !== 'undefined') {\n const px = normalizeToPx(defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync\n const controlledSize = size;\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof controlledSize === 'undefined') return;\n const px = normalizeToPx(controlledSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [controlledSize, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.inspectorMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setInspectorMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"end\" style={{ padding: 0 }} width={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Inspector</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n // Strip control/size props from DOM spread\n return (\n <div\n {...inspectorDomProps}\n ref={setRef}\n className={classNames('rt-ShellInspector', className)}\n data-mode={shell.inspectorMode}\n data-peek={shell.peekTarget === 'inspector' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--inspector-size' as any]: `${expandedSize}px`,\n ['--inspector-min-size' as any]: `${minSize}px`,\n ['--inspector-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellInspectorContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n}) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
5
+ "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,GAAuB,yBACvBC,EAAuB,0BACvBC,GAA+B,iCAC/BC,GAAyB,+BACzBC,EAAqE,6BACrEC,GAAkC,6BAClCC,EAA4C,8BAC5CC,GAA6B,6BAE7BC,EAAoE,mCAkBpE,MAAMC,GAA0B,CAC9B,YACA,WACA,cACA,OACA,eACA,OACA,cACA,eACA,aACA,eACA,OACF,EAEaZ,EAAYE,EAAM,WAAiD,CAACW,EAAcC,IAAQ,CACrG,KAAM,CACJ,UAAAC,EACA,aAAAC,EAAe,CAAE,QAAS,UAAW,GAAI,OAAQ,EACjD,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,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AAI,UAAU,2BAA2B,eAAc0E,GAAc,QACnEvB,CACH,EACCgC,EACH,CAEJ,CAAC,EAEDrF,EAAU,YAAc,kBACxBA,EAAU,OAAS",
6
+ "names": ["shell_inspector_exports", "__export", "Inspector", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "import_shell_prop_helpers", "INSPECTOR_DOM_PROP_KEYS", "initialProps", "ref", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "size", "defaultSize", "inspectorDomProps", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "normalizedControlledOpen", "normalizedDefaultOpen", "openIsResponsive", "next", "initial", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "initNotifiedRef", "lastInspectorModeRef", "prevInspectorModeRef", "hasInitializedRef", "currentMode", "prevMode", "isExpanded", "persistenceAdapter", "key", "v", "mounted", "loaded", "applyLoaded", "value", "err", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "normalizeToPx", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize", "o", "classNames"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shell-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAA+C,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAA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AC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AACrM,KAAK,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC,GAAG;IAE1F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEhC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1F,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,CAAC,sBAAsB,GAAG,wBAAwB,CAAC,CAAC;AAExD,KAAK,gBAAgB,GAAG,KAAK,CAAC,yBAAyB,CAAC,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,aAAa,CAAA;CAAE,CAAC;AAkBrJ,eAAO,MAAM,OAAO,EA6Zd,gBAAgB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var ze=Object.create;var R=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Ee=(i,s)=>{for(var l in s)R(i,l,{get:s[l],enumerable:!0})},ne=(i,s,l,y)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of ve(s))!Re.call(i,d)&&d!==l&&R(i,d,{get:()=>s[d],enumerable:!(y=xe(s,d))||y.enumerable});return i};var $=(i,s,l)=>(l=i!=null?ze(Ce(i)):{},ne(s||!i||!i.__esModule?R(l,"default",{value:i,enumerable:!0}):l,i)),Ne=i=>ne(R({},"__esModule",{value:!0}),i);var ke={};Ee(ke,{Sidebar:()=>_});module.exports=Ne(ke);var t=$(require("react")),re=$(require("classnames")),B=$(require("../sheet.js")),oe=require("../visually-hidden.js"),U=require("../shell.context.js"),E=require("../shell.hooks.js"),ae=require("./shell-resize.js"),ie=require("./shell-prop-helpers.js"),m=require("./shell-handles.js"),De=require("../shell.types.js");const we=["className","children","state","defaultState","onStateChange","thinSize","toggleModes","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],_=t.forwardRef((i,s)=>{const{className:l,presentation:y={initial:"overlay",md:"fixed"},expandedSize:d=288,minSize:p=200,maxSize:f=400,resizable:N=!1,collapsible:se=!0,onExpand:A,onCollapse:W,onResize:w,onResizeStart:de,onResizeEnd:le,snapPoints:ue,snapTolerance:ce,collapseThreshold:pe,paneId:k,persistence:T,children:fe,style:be,thinSize:S=64,toggleModes:D,state:b,defaultState:M,onStateChange:g,size:L,defaultSize:j,onSizeChange:q,sizeUpdate:K,sizeUpdateMs:Y=50}=i,me=(0,ie.extractPaneDomProps)(i,we),n=(0,U.useShell)(),H=(0,E.useResponsivePresentation)(y),h=H==="overlay",Se=H==="stacked",c=t.useRef(null),he=t.useCallback(e=>{c.current=e,typeof s=="function"?s(e):s&&(s.current=e)},[s]),G=t.Children.toArray(fe),J=G.filter(e=>t.isValidElement(e)&&e.type===m.SidebarHandle),Q=G.filter(e=>!(t.isValidElement(e)&&e.type===m.SidebarHandle)),P=t.useMemo(()=>{const e=q,r=K,o=Y??50;if(!e)return()=>{};if(r==="debounce"){let a=null;return(u,I)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(u,I)},o)}}if(r==="throttle"){let a=0;return(u,I)=>{const te=Date.now();te-a>=o&&(a=te,e(u,I))}}return(a,u)=>e(a,u)},[q,K,Y]),ye=t.useId();t.useEffect(()=>(n.setHasSidebar(!0),()=>{n.setHasSidebar(!1)}),[n,ye]);const z=t.useRef(null);t.useEffect(()=>{const e=typeof b<"u";if(z.current===null){z.current=e;return}z.current!==e&&(console.warn("Shell.Sidebar: Switching between controlled and uncontrolled `state` is not supported."),z.current=e)},[b]);const Me=typeof b=="object"&&b!==null,{resolvedDefault:X}=(0,E.useResponsiveInitialState)({controlledValue:b,defaultValue:M,currentValue:n.sidebarMode,setValue:n.setSidebarMode,breakpointReady:n.currentBreakpointReady,controlledIsResponsive:Me,onResponsiveChange:e=>g?.(e,{reason:"responsive"}),onInit:e=>g?.(e,{reason:"init"})}),x=t.useRef(null);t.useEffect(()=>{typeof b>"u"&&(x.current===null?x.current=n.sidebarMode:x.current!==n.sidebarMode&&(x.current=n.sidebarMode,g?.(n.sidebarMode,{reason:"toggle"})))},[n.sidebarMode,b,g]),t.useEffect(()=>{n.sidebarMode==="expanded"?A?.():W?.()},[n.sidebarMode,A,W]);const Z=n.sidebarMode!=="collapsed",v=t.useMemo(()=>{if(!k||T)return T;const e=`kookie-ui:shell:sidebar:${k}`;return{load:()=>{if(!(typeof window>"u"))try{const o=window.localStorage.getItem(e);return o?Number(o):void 0}catch{return}},save:o=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(o))}catch{}}}},[k,T]);t.useEffect(()=>{let e=!0;return(async()=>{if(!N||!v?.load||h)return;const r=await v.load();e&&typeof r=="number"&&c.current&&(c.current.style.setProperty("--sidebar-size",`${r}px`),w?.(r))})(),()=>{e=!1}},[N,v,w,h]);const C=(0,U.useShell)(),V=t.useCallback(()=>{const e=X??(typeof M=="string"?M:void 0)??"expanded";return e==="thin"||e==="expanded"?e:"expanded"},[X,M]);t.useEffect(()=>{if(!C.setSidebarToggleComputer)return;const e=D??"both",r=o=>{if(e==="both")return o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed";const a=V();return o==="collapsed"?a:o===a?"collapsed":a};return C.setSidebarToggleComputer(r),()=>{C.setSidebarToggleComputer?.(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed")}},[C,D,V]);const ee=t.useRef(d),ge=t.useRef("expanded");t.useEffect(()=>{n.sidebarMode!=="collapsed"&&(ge.current=n.sidebarMode,ee.current=n.sidebarMode==="thin"?S:d)},[n.sidebarMode,S,d]);const Pe=N&&!h&&n.sidebarMode==="expanded"?t.createElement(ae.PaneResizeContext.Provider,{value:{containerRef:c,cssVarName:"--sidebar-size",minSize:p,maxSize:f,defaultSize:d,orientation:"vertical",edge:"end",computeNext:(e,r,o)=>{const a=getComputedStyle(c.current).direction==="rtl",u=e-r;return o+(a?-u:u)},onResize:w,onResizeStart:de,onResizeEnd:e=>{le?.(e),P(e,{reason:"resize"}),v?.save?.(e)},target:"sidebar",collapsible:se,snapPoints:ue,snapTolerance:ce??8,collapseThreshold:pe,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},J.length>0?J.map((e,r)=>t.cloneElement(e,{key:e.key??r})):t.createElement(m.PaneHandle,null)):null,O=t.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const r=String(e).trim();if(!r)return;if(r.endsWith("px"))return Number.parseFloat(r);if(r.endsWith("rem")){const a=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(r)*a}if(r.endsWith("%")){const a=Number.parseFloat(r),u=document.documentElement.clientWidth||window.innerWidth||0;return a/100*u}const o=Number.parseFloat(r);return Number.isFinite(o)?o:void 0},[]);t.useEffect(()=>{if(c.current&&typeof L>"u"&&typeof j<"u"){const e=O(j);if(typeof e=="number"&&Number.isFinite(e)){const a=Math.min((typeof f=="number"?f:void 0)??e,Math.max((typeof p=="number"?p:void 0)??e,e));c.current.style.setProperty("--sidebar-size",`${a}px`),P(a,{reason:"init"})}}},[]);const F=L;if(t.useEffect(()=>{if(!c.current||typeof F>"u")return;const e=O(F);if(typeof e=="number"&&Number.isFinite(e)){const a=Math.min((typeof f=="number"?f:void 0)??e,Math.max((typeof p=="number"?p:void 0)??e,e));c.current.style.setProperty("--sidebar-size",`${a}px`),P(a,{reason:"controlled"})}},[F,p,f,O,P]),h){const e=n.sidebarMode!=="collapsed";return t.createElement(B.Root,{open:e,onOpenChange:r=>n.setSidebarMode(r?"expanded":"collapsed")},t.createElement(B.Content,{side:"start",style:{padding:0},width:{initial:`${e?n.sidebarMode==="thin"?S:d:ee.current}px`}},t.createElement(oe.VisuallyHidden,null,t.createElement(B.Title,null,"Navigation")),Q))}return t.createElement("div",{...me,ref:he,className:(0,re.default)("rt-ShellSidebar",l),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":n.currentBreakpointReady?H:void 0,"data-open":n.currentBreakpointReady&&Se&&Z||void 0,style:{...be,"--sidebar-size":`${d}px`,"--sidebar-thin-size":`${S}px`,"--sidebar-min-size":`${p}px`,"--sidebar-max-size":`${f}px`,...n.peekTarget==="sidebar"&&n.sidebarMode==="collapsed"&&!h?(()=>{const e=D??"both",r=n.sidebarMode;let o;if(e==="both")o=r==="collapsed"?"thin":r==="thin"?"expanded":"collapsed";else{const a=V();o=r==="collapsed"?a:"collapsed"}return o==="thin"?{"--peek-sidebar-width":`${S}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${d}px)`}})():{}}},t.createElement("div",{className:"rt-ShellSidebarContent","data-visible":Z||void 0},Q),Pe)});_.displayName="Shell.Sidebar",_.Handle=m.SidebarHandle;
1
+ "use strict";var xe=Object.create;var E=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var ke=(i,s)=>{for(var l in s)E(i,l,{get:s[l],enumerable:!0})},oe=(i,s,l,y)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of Ce(s))!Ne.call(i,d)&&d!==l&&E(i,d,{get:()=>s[d],enumerable:!(y=ve(s,d))||y.enumerable});return i};var $=(i,s,l)=>(l=i!=null?xe(Ee(i)):{},oe(s||!i||!i.__esModule?E(l,"default",{value:i,enumerable:!0}):l,i)),we=i=>oe(E({},"__esModule",{value:!0}),i);var De={};ke(De,{Sidebar:()=>A});module.exports=we(De);var t=$(require("react")),ae=$(require("classnames")),U=$(require("../sheet.js")),ie=require("../visually-hidden.js"),_=require("../shell.context.js"),N=require("../shell.hooks.js"),se=require("./shell-resize.js"),de=require("./shell-prop-helpers.js"),m=require("./shell-handles.js"),Ve=require("../shell.types.js");const Te=["className","children","state","defaultState","onStateChange","thinSize","toggleModes","size","defaultSize","onSizeChange","sizeUpdate","sizeUpdateMs","style"],A=t.forwardRef((i,s)=>{const{className:l,presentation:y={initial:"overlay",md:"fixed"},expandedSize:d=288,minSize:p=200,maxSize:f=400,resizable:k=!1,collapsible:le=!0,onExpand:W,onCollapse:L,onResize:w,onResizeStart:ue,onResizeEnd:ce,snapPoints:pe,snapTolerance:fe,collapseThreshold:be,paneId:T,persistence:D,children:me,style:Se,thinSize:S=64,toggleModes:H,state:b,defaultState:M,onStateChange:g,size:j,defaultSize:q,onSizeChange:K,sizeUpdate:Y,sizeUpdateMs:G=50}=i,he=(0,de.extractPaneDomProps)(i,Te),r=(0,_.useShell)(),V=(0,N.useResponsivePresentation)(y),h=V==="overlay",ye=V==="stacked",c=t.useRef(null),Me=t.useCallback(e=>{c.current=e,typeof s=="function"?s(e):s&&(s.current=e)},[s]),J=t.Children.toArray(me),Q=J.filter(e=>t.isValidElement(e)&&e.type===m.SidebarHandle),X=J.filter(e=>!(t.isValidElement(e)&&e.type===m.SidebarHandle)),P=t.useMemo(()=>{const e=K,n=Y,o=G??50;if(!e)return()=>{};if(n==="debounce"){let a=null;return(u,F)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(u,F)},o)}}if(n==="throttle"){let a=0;return(u,F)=>{const re=Date.now();re-a>=o&&(a=re,e(u,F))}}return(a,u)=>e(a,u)},[K,Y,G]),ge=t.useId();t.useEffect(()=>(r.setHasSidebar(!0),()=>{r.setHasSidebar(!1)}),[r,ge]);const z=t.useRef(null);t.useEffect(()=>{const e=typeof b<"u";if(z.current===null){z.current=e;return}z.current!==e&&(console.warn("Shell.Sidebar: Switching between controlled and uncontrolled `state` is not supported."),z.current=e)},[b]);const Pe=typeof b=="object"&&b!==null,{resolvedDefault:Z}=(0,N.useResponsiveInitialState)({controlledValue:b,defaultValue:M,currentValue:r.sidebarMode,setValue:r.setSidebarMode,breakpointReady:r.currentBreakpointReady,controlledIsResponsive:Pe,onResponsiveChange:e=>g?.(e,{reason:"responsive"}),onInit:e=>g?.(e,{reason:"init"})}),R=t.useRef(null);t.useEffect(()=>{typeof b>"u"&&(R.current===null?R.current=r.sidebarMode:R.current!==r.sidebarMode&&(R.current=r.sidebarMode,g?.(r.sidebarMode,{reason:"toggle"})))},[r.sidebarMode,b,g]);const x=t.useRef(null),ee=t.useRef(!1);t.useEffect(()=>{const e=r.sidebarMode;if(!r.currentBreakpointReady){x.current=e;return}if(!ee.current){ee.current=!0,x.current=e;return}const n=x.current;n!==null&&n!==e&&(n==="collapsed"&&e!=="collapsed"?W?.():e==="collapsed"&&L?.(),x.current=e)},[r.sidebarMode,r.currentBreakpointReady,W,L]);const te=r.sidebarMode!=="collapsed",v=t.useMemo(()=>{if(!T||D)return D;const e=`kookie-ui:shell:sidebar:${T}`;return{load:()=>{if(!(typeof window>"u"))try{const o=window.localStorage.getItem(e);return o?Number(o):void 0}catch{return}},save:o=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,String(o))}catch{}}}},[T,D]);t.useEffect(()=>{let e=!0;return(async()=>{if(!k||!v?.load||h)return;const n=await v.load();e&&typeof n=="number"&&c.current&&(c.current.style.setProperty("--sidebar-size",`${n}px`),w?.(n))})(),()=>{e=!1}},[k,v,w,h]);const C=(0,_.useShell)(),I=t.useCallback(()=>{const e=Z??(typeof M=="string"?M:void 0)??"expanded";return e==="thin"||e==="expanded"?e:"expanded"},[Z,M]);t.useEffect(()=>{if(!C.setSidebarToggleComputer)return;const e=H??"both",n=o=>{if(e==="both")return o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed";const a=I();return o==="collapsed"?a:o===a?"collapsed":a};return C.setSidebarToggleComputer(n),()=>{C.setSidebarToggleComputer?.(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed")}},[C,H,I]);const ne=t.useRef(d),ze=t.useRef("expanded");t.useEffect(()=>{r.sidebarMode!=="collapsed"&&(ze.current=r.sidebarMode,ne.current=r.sidebarMode==="thin"?S:d)},[r.sidebarMode,S,d]);const Re=k&&!h&&r.sidebarMode==="expanded"?t.createElement(se.PaneResizeContext.Provider,{value:{containerRef:c,cssVarName:"--sidebar-size",minSize:p,maxSize:f,defaultSize:d,orientation:"vertical",edge:"end",computeNext:(e,n,o)=>{const a=getComputedStyle(c.current).direction==="rtl",u=e-n;return o+(a?-u:u)},onResize:w,onResizeStart:ue,onResizeEnd:e=>{ce?.(e),P(e,{reason:"resize"}),v?.save?.(e)},target:"sidebar",collapsible:le,snapPoints:pe,snapTolerance:fe??8,collapseThreshold:be,requestCollapse:()=>r.setSidebarMode("collapsed"),requestToggle:()=>r.togglePane("sidebar")}},Q.length>0?Q.map((e,n)=>t.cloneElement(e,{key:e.key??n})):t.createElement(m.PaneHandle,null)):null,O=t.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const n=String(e).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){const a=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*a}if(n.endsWith("%")){const a=Number.parseFloat(n),u=document.documentElement.clientWidth||window.innerWidth||0;return a/100*u}const o=Number.parseFloat(n);return Number.isFinite(o)?o:void 0},[]);t.useEffect(()=>{if(c.current&&typeof j>"u"&&typeof q<"u"){const e=O(q);if(typeof e=="number"&&Number.isFinite(e)){const a=Math.min((typeof f=="number"?f:void 0)??e,Math.max((typeof p=="number"?p:void 0)??e,e));c.current.style.setProperty("--sidebar-size",`${a}px`),P(a,{reason:"init"})}}},[]);const B=j;if(t.useEffect(()=>{if(!c.current||typeof B>"u")return;const e=O(B);if(typeof e=="number"&&Number.isFinite(e)){const a=Math.min((typeof f=="number"?f:void 0)??e,Math.max((typeof p=="number"?p:void 0)??e,e));c.current.style.setProperty("--sidebar-size",`${a}px`),P(a,{reason:"controlled"})}},[B,p,f,O,P]),h){const e=r.sidebarMode!=="collapsed";return t.createElement(U.Root,{open:e,onOpenChange:n=>r.setSidebarMode(n?"expanded":"collapsed")},t.createElement(U.Content,{side:"start",style:{padding:0},width:{initial:`${e?r.sidebarMode==="thin"?S:d:ne.current}px`}},t.createElement(ie.VisuallyHidden,null,t.createElement(U.Title,null,"Navigation")),X))}return t.createElement("div",{...he,ref:Me,className:(0,ae.default)("rt-ShellSidebar",l),"data-mode":r.sidebarMode,"data-peek":r.peekTarget==="sidebar"||void 0,"data-presentation":r.currentBreakpointReady?V:void 0,"data-open":r.currentBreakpointReady&&ye&&te||void 0,style:{...Se,"--sidebar-size":`${d}px`,"--sidebar-thin-size":`${S}px`,"--sidebar-min-size":`${p}px`,"--sidebar-max-size":`${f}px`,...r.peekTarget==="sidebar"&&r.sidebarMode==="collapsed"&&!h?(()=>{const e=H??"both",n=r.sidebarMode;let o;if(e==="both")o=n==="collapsed"?"thin":n==="thin"?"expanded":"collapsed";else{const a=I();o=n==="collapsed"?a:"collapsed"}return o==="thin"?{"--peek-sidebar-width":`${S}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${d}px)`}})():{}}},t.createElement("div",{className:"rt-ShellSidebarContent","data-visible":te||void 0},X),Re)});A.displayName="Shell.Sidebar",A.Handle=m.SidebarHandle;
2
2
  //# sourceMappingURL=shell-sidebar.js.map