@kushagradhawan/kookie-ui 0.1.56 → 0.1.58

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 (78) hide show
  1. package/components.css +166 -41
  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.js +1 -1
  9. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  10. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  11. package/dist/cjs/components/chatbar.js.map +2 -2
  12. package/dist/cjs/components/icons.d.ts +1 -1
  13. package/dist/cjs/components/icons.d.ts.map +1 -1
  14. package/dist/cjs/components/icons.js.map +2 -2
  15. package/dist/cjs/components/schemas/shell.schema.d.ts +2 -2
  16. package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
  17. package/dist/cjs/components/schemas/shell.schema.js +1 -1
  18. package/dist/cjs/components/schemas/shell.schema.js.map +3 -3
  19. package/dist/cjs/components/shell.d.ts.map +1 -1
  20. package/dist/cjs/components/shell.js +1 -1
  21. package/dist/cjs/components/shell.js.map +3 -3
  22. package/dist/cjs/components/theme.props.d.ts +1 -1
  23. package/dist/cjs/components/theme.props.js +1 -1
  24. package/dist/cjs/components/theme.props.js.map +2 -2
  25. package/dist/cjs/helpers/font-config.d.ts +10 -0
  26. package/dist/cjs/helpers/font-config.d.ts.map +1 -1
  27. package/dist/cjs/helpers/font-config.js +2 -2
  28. package/dist/cjs/helpers/font-config.js.map +2 -2
  29. package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
  30. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  31. package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
  32. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  33. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  34. package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
  35. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  36. package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
  37. package/dist/esm/components/chatbar.d.ts.map +1 -1
  38. package/dist/esm/components/chatbar.js.map +2 -2
  39. package/dist/esm/components/icons.d.ts +1 -1
  40. package/dist/esm/components/icons.d.ts.map +1 -1
  41. package/dist/esm/components/icons.js.map +2 -2
  42. package/dist/esm/components/schemas/shell.schema.d.ts +2 -2
  43. package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
  44. package/dist/esm/components/schemas/shell.schema.js.map +3 -3
  45. package/dist/esm/components/shell.d.ts.map +1 -1
  46. package/dist/esm/components/shell.js +1 -1
  47. package/dist/esm/components/shell.js.map +3 -3
  48. package/dist/esm/components/theme.props.d.ts +1 -1
  49. package/dist/esm/components/theme.props.js +1 -1
  50. package/dist/esm/components/theme.props.js.map +2 -2
  51. package/dist/esm/helpers/font-config.d.ts +10 -0
  52. package/dist/esm/helpers/font-config.d.ts.map +1 -1
  53. package/dist/esm/helpers/font-config.js +2 -2
  54. package/dist/esm/helpers/font-config.js.map +2 -2
  55. package/package.json +1 -1
  56. package/schemas/base-button.json +1 -1
  57. package/schemas/button.json +1 -1
  58. package/schemas/icon-button.json +1 -1
  59. package/schemas/index.json +6 -6
  60. package/schemas/toggle-button.json +1 -1
  61. package/schemas/toggle-icon-button.json +1 -1
  62. package/src/components/_internal/base-sidebar-menu.css +19 -4
  63. package/src/components/_internal/shell-bottom.tsx +14 -13
  64. package/src/components/_internal/shell-inspector.tsx +13 -11
  65. package/src/components/_internal/shell-sidebar.tsx +12 -12
  66. package/src/components/chatbar.tsx +0 -1
  67. package/src/components/icons.tsx +19 -87
  68. package/src/components/schemas/shell.schema.ts +10 -33
  69. package/src/components/separator.css +1 -1
  70. package/src/components/shell.tsx +32 -24
  71. package/src/components/sidebar.css +32 -6
  72. package/src/components/theme.props.tsx +1 -1
  73. package/src/helpers/font-config.ts +35 -8
  74. package/src/styles/fonts.css +11 -15
  75. package/src/styles/tokens/typography.css +17 -7
  76. package/styles.css +182 -47
  77. package/tokens/base.css +12 -3
  78. package/tokens.css +12 -3
@@ -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,EAAY,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAEtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACv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oB,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;AAElJ,eAAO,MAAM,MAAM,EAwUd,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as t from"react";import se from"classnames";import*as w from"../sheet.js";import{VisuallyHidden as ie}from"../visually-hidden.js";import{useShell as ae}from"../shell.context.js";import{useResponsivePresentation as de,useResponsiveValue as A}from"../shell.hooks.js";import{PaneResizeContext as le}from"./shell-resize.js";import{BottomHandle as O,PaneHandle as ue}from"./shell-handles.js";import"../shell.types.js";const L=t.forwardRef(({className:W,presentation:j="fixed",defaultOpen:f,open:a,onOpenChange:z,expandedSize:P=200,minSize:l=100,maxSize:u=400,resizable:g=!1,collapsible:q=!0,onExpand:k,onCollapse:T,onResize:B,onResizeStart:K,onResizeEnd:G,snapPoints:J,snapTolerance:Q,collapseThreshold:X,paneId:M,persistence:C,children:Y,style:Z,...i},c)=>{const o=ae(),R=de(j),p=R==="overlay",ee=R==="stacked",d=t.useRef(null),te=t.useCallback(e=>{d.current=e,typeof c=="function"?c(e):c&&(c.current=e)},[c]),D=t.Children.toArray(Y),H=D.filter(e=>t.isValidElement(e)&&e.type===O),U=D.filter(e=>!(t.isValidElement(e)&&e.type===O)),b=t.useMemo(()=>{const e=i.onSizeChange,n=i.sizeUpdate,s=i.sizeUpdateMs??50;if(!e)return()=>{};if(n==="debounce"){let r=null;return(m,N)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(m,N)},s)}}if(n==="throttle"){let r=0;return(m,N)=>{const V=Date.now();V-r>=s&&(r=V,e(m,N))}}return(r,m)=>e(r,m)},[i.onSizeChange,i.sizeUpdate,i.sizeUpdateMs]),F=t.useRef(!1),ne=t.useRef(!1),I=A(f);t.useEffect(()=>{if(!F.current&&o.currentBreakpointReady&&(F.current=!0,typeof a>"u"&&typeof f<"u")){const e=!!I;o.setBottomMode(e?"expanded":"collapsed"),ne.current=!0}},[o.currentBreakpointReady,a,f,I]);const y=t.useRef(null);t.useEffect(()=>{const e=typeof a<"u";if(y.current===null){y.current=e;return}y.current!==e&&(console.warn("Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported."),y.current=e)},[a]),t.useEffect(()=>{typeof a>"u"||o.setBottomMode(a?"expanded":"collapsed")},[a]);const _=t.useRef(!1),S=A(a);t.useEffect(()=>{if(typeof S>"u")return;const e=!!S;o.setBottomMode(e?"expanded":"collapsed")},[S]);const $=t.useRef(!1),v=t.useRef(null);t.useEffect(()=>{!$.current&&typeof a>"u"&&f&&o.bottomMode==="expanded"&&(z?.(!0,{reason:"init"}),$.current=!0),typeof a>"u"&&(v.current!==null&&v.current!==o.bottomMode&&(_.current||z?.(o.bottomMode==="expanded",{reason:"toggle"}),_.current=!1),v.current=o.bottomMode)},[o.bottomMode,a,f,z]),t.useEffect(()=>{o.bottomMode==="expanded"?k?.():T?.()},[o.bottomMode,k,T]);const x=o.bottomMode==="expanded",h=t.useMemo(()=>{if(!M||C)return C;const e=`kookie-ui:shell:bottom:${M}`;return{load:()=>{if(typeof window>"u")return;const s=window.localStorage.getItem(e);return s?Number(s):void 0},save:s=>{typeof window>"u"||window.localStorage.setItem(e,String(s))}}},[M,C]);t.useEffect(()=>{let e=!0;return(async()=>{if(!g||!h?.load||p)return;const n=await h.load();e&&typeof n=="number"&&d.current&&(d.current.style.setProperty("--bottom-size",`${n}px`),B?.(n))})(),()=>{e=!1}},[g,h,B,p]);const oe=g&&!p&&x?t.createElement(le.Provider,{value:{containerRef:d,cssVarName:"--bottom-size",minSize:l,maxSize:u,defaultSize:P,orientation:"horizontal",edge:"start",computeNext:(e,n,s)=>{const r=e-n;return s-r},onResize:B,onResizeStart:K,onResizeEnd:e=>{G?.(e),b(e,{reason:"resize"}),h?.save?.(e)},target:"bottom",collapsible:q,snapPoints:J,snapTolerance:Q??8,collapseThreshold:X,requestCollapse:()=>o.setBottomMode("collapsed"),requestToggle:()=>o.togglePane("bottom")}},H.length>0?H.map((e,n)=>t.cloneElement(e,{key:e.key??n})):t.createElement(ue,null)):null,{defaultOpen:me,open:fe,onOpenChange:ce,size:pe,defaultSize:be,onSizeChange:ye,sizeUpdate:he,sizeUpdateMs:ze,...re}=i,E=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 r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*r}if(n.endsWith("%")){const r=Number.parseFloat(n),m=document.documentElement.clientHeight||window.innerHeight||0;return r/100*m}const s=Number.parseFloat(n);return Number.isFinite(s)?s:void 0},[]);if(t.useEffect(()=>{if(d.current&&typeof i.size>"u"&&typeof i.defaultSize<"u"){const e=E(i.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--bottom-size",`${r}px`),b(r,{reason:"init"})}}},[]),t.useEffect(()=>{if(!d.current||typeof i.size>"u")return;const e=E(i.size);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--bottom-size",`${r}px`),b(r,{reason:"controlled"})}},[i.size,l,u,E,b]),p){const e=o.bottomMode==="expanded";return t.createElement(w.Root,{open:e,onOpenChange:n=>o.setBottomMode(n?"expanded":"collapsed")},t.createElement(w.Content,{side:"bottom",style:{padding:0},height:{initial:`${P}px`}},t.createElement(ie,null,t.createElement(w.Title,null,"Bottom panel")),U))}return t.createElement("div",{...re,ref:te,className:se("rt-ShellBottom",W),"data-mode":o.bottomMode,"data-peek":o.peekTarget==="bottom"||void 0,"data-presentation":o.currentBreakpointReady?R:void 0,"data-open":o.currentBreakpointReady&&ee&&x||void 0,style:{...Z,"--bottom-size":`${P}px`,"--bottom-min-size":`${l}px`,"--bottom-max-size":`${u}px`}},t.createElement("div",{className:"rt-ShellBottomContent","data-visible":x||void 0},U),oe)});L.displayName="Shell.Bottom",L.Handle=O;export{L as Bottom};
1
+ import*as t from"react";import le from"classnames";import*as O from"../sheet.js";import{VisuallyHidden as ue}from"../visually-hidden.js";import{useShell as me}from"../shell.context.js";import{useResponsivePresentation as fe,useResponsiveValue as q}from"../shell.hooks.js";import{PaneResizeContext as ce}from"./shell-resize.js";import{BottomHandle as k,PaneHandle as pe}from"./shell-handles.js";import"../shell.types.js";const K=t.forwardRef(({className:G,presentation:J="fixed",defaultOpen:f,open:i,onOpenChange:z,expandedSize:P=200,minSize:l=100,maxSize:u=400,resizable:g=!1,collapsible:Q=!0,onExpand:T,onCollapse:D,onResize:B,onResizeStart:X,onResizeEnd:Y,snapPoints:Z,snapTolerance:ee,collapseThreshold:te,paneId:M,persistence:C,children:oe,style:ne,...a},c)=>{const n=me(),R=fe(J),p=R==="overlay",re=R==="stacked",d=t.useRef(null),se=t.useCallback(e=>{d.current=e,typeof c=="function"?c(e):c&&(c.current=e)},[c]),H=t.Children.toArray(oe),U=H.filter(e=>t.isValidElement(e)&&e.type===k),F=H.filter(e=>!(t.isValidElement(e)&&e.type===k)),I=a.onSizeChange,_=a.sizeUpdate,$=a.sizeUpdateMs,b=t.useMemo(()=>{const e=I,o=_,s=$??50;if(!e)return()=>{};if(o==="debounce"){let r=null;return(m,w)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(m,w)},s)}}if(o==="throttle"){let r=0;return(m,w)=>{const j=Date.now();j-r>=s&&(r=j,e(m,w))}}return(r,m)=>e(r,m)},[I,_,$]),V=t.useRef(!1),ie=t.useRef(!1),A=q(f);t.useEffect(()=>{if(!V.current&&n.currentBreakpointReady&&(V.current=!0,typeof i>"u"&&typeof f<"u")){const e=!!A;n.setBottomMode(e?"expanded":"collapsed"),ie.current=!0}},[n,i,f,A]);const y=t.useRef(null);t.useEffect(()=>{const e=typeof i<"u";if(y.current===null){y.current=e;return}y.current!==e&&(console.warn("Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported."),y.current=e)},[i]),t.useEffect(()=>{typeof i>"u"||n.setBottomMode(i?"expanded":"collapsed")},[n,i]);const L=t.useRef(!1),S=q(i);t.useEffect(()=>{if(typeof S>"u")return;const e=!!S;n.setBottomMode(e?"expanded":"collapsed")},[n,S]);const W=t.useRef(!1),v=t.useRef(null);t.useEffect(()=>{!W.current&&typeof i>"u"&&f&&n.bottomMode==="expanded"&&(z?.(!0,{reason:"init"}),W.current=!0),typeof i>"u"&&(v.current!==null&&v.current!==n.bottomMode&&(L.current||z?.(n.bottomMode==="expanded",{reason:"toggle"}),L.current=!1),v.current=n.bottomMode)},[n.bottomMode,i,f,z]),t.useEffect(()=>{n.bottomMode==="expanded"?T?.():D?.()},[n.bottomMode,T,D]);const x=n.bottomMode==="expanded",h=t.useMemo(()=>{if(!M||C)return C;const e=`kookie-ui:shell:bottom:${M}`;return{load:()=>{if(typeof window>"u")return;const s=window.localStorage.getItem(e);return s?Number(s):void 0},save:s=>{typeof window>"u"||window.localStorage.setItem(e,String(s))}}},[M,C]);t.useEffect(()=>{let e=!0;return(async()=>{if(!g||!h?.load||p)return;const o=await h.load();e&&typeof o=="number"&&d.current&&(d.current.style.setProperty("--bottom-size",`${o}px`),B?.(o))})(),()=>{e=!1}},[g,h,B,p]);const ae=g&&!p&&x?t.createElement(ce.Provider,{value:{containerRef:d,cssVarName:"--bottom-size",minSize:l,maxSize:u,defaultSize:P,orientation:"horizontal",edge:"start",computeNext:(e,o,s)=>{const r=e-o;return s-r},onResize:B,onResizeStart:X,onResizeEnd:e=>{Y?.(e),b(e,{reason:"resize"}),h?.save?.(e)},target:"bottom",collapsible:Q,snapPoints:Z,snapTolerance:ee??8,collapseThreshold:te,requestCollapse:()=>n.setBottomMode("collapsed"),requestToggle:()=>n.togglePane("bottom")}},U.length>0?U.map((e,o)=>t.cloneElement(e,{key:e.key??o})):t.createElement(pe,null)):null,{defaultOpen:be,open:ye,onOpenChange:he,size:ze,defaultSize:Pe,onSizeChange:ge,sizeUpdate:Be,sizeUpdateMs:Me,...de}=a,E=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 r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*r}if(o.endsWith("%")){const r=Number.parseFloat(o),m=document.documentElement.clientHeight||window.innerHeight||0;return r/100*m}const s=Number.parseFloat(o);return Number.isFinite(s)?s:void 0},[]);t.useEffect(()=>{if(d.current&&typeof a.size>"u"&&typeof a.defaultSize<"u"){const e=E(a.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--bottom-size",`${r}px`),b(r,{reason:"init"})}}},[]);const N=a.size;if(t.useEffect(()=>{if(!d.current||typeof N>"u")return;const e=E(N);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--bottom-size",`${r}px`),b(r,{reason:"controlled"})}},[N,l,u,E,b]),p){const e=n.bottomMode==="expanded";return t.createElement(O.Root,{open:e,onOpenChange:o=>n.setBottomMode(o?"expanded":"collapsed")},t.createElement(O.Content,{side:"bottom",style:{padding:0},height:{initial:`${P}px`}},t.createElement(ue,null,t.createElement(O.Title,null,"Bottom panel")),F))}return t.createElement("div",{...de,ref:se,className:le("rt-ShellBottom",G),"data-mode":n.bottomMode,"data-peek":n.peekTarget==="bottom"||void 0,"data-presentation":n.currentBreakpointReady?R:void 0,"data-open":n.currentBreakpointReady&&re&&x||void 0,style:{...ne,"--bottom-size":`${P}px`,"--bottom-min-size":`${l}px`,"--bottom-max-size":`${u}px`}},t.createElement("div",{className:"rt-ShellBottomContent","data-visible":x||void 0},F),ae)});K.displayName="Shell.Bottom",K.Handle=k;export{K as Bottom};
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, useResponsiveValue } 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 } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\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 = PaneProps &\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\nexport const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(\n (\n {\n className,\n presentation = 'fixed',\n // removed legacy props\n // new API\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 ...props\n },\n ref,\n ) => {\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 emitSizeChange = React.useMemo(() => {\n const cb = (props as any).onSizeChange as undefined | ((s: number, meta: BottomSizeChangeMeta) => void);\n const strategy = (props as any).sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = (props as any).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 }, [(props as any).onSizeChange, (props as any).sizeUpdate, (props as any).sizeUpdateMs]);\n\n const didInitRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen as any);\n React.useEffect(() => {\n if (didInitRef.current) return;\n if (!shell.currentBreakpointReady) return;\n didInitRef.current = true;\n if (typeof open === 'undefined' && typeof defaultOpen !== 'undefined') {\n const initial = Boolean(resolvedDefaultOpen);\n shell.setBottomMode(initial ? 'expanded' : 'collapsed');\n didInitFromDefaultOpenRef.current = true;\n }\n }, [shell.currentBreakpointReady, open, defaultOpen, resolvedDefaultOpen]);\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 // eslint-disable-next-line no-console\n console.error('Shell.Bottom: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n if (typeof (props as any).size !== 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n // eslint-disable-next-line no-console\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 // eslint-disable-next-line no-console\n console.warn('Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n // Controlled sync (responsive handled below)\n React.useEffect(() => {\n if (typeof open === 'undefined') return;\n shell.setBottomMode(open ? 'expanded' : 'collapsed');\n }, [open]);\n\n const responsiveNotifiedRef = React.useRef(false);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n shell.setBottomMode(shouldExpand ? 'expanded' : 'collapsed');\n }, [resolvedOpen]);\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 if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.bottomMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\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 const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--bottom-size', `${loaded}px`);\n onResize?.(loaded);\n }\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 const {\n defaultOpen: _bottomDefaultOpenIgnored,\n open: _bottomOpenIgnored,\n onOpenChange: _bottomOnOpenChangeIgnored,\n size: _bottomSizeIgnored,\n defaultSize: _bottomDefaultSizeIgnored,\n onSizeChange: _bottomOnSizeChangeIgnored,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...bottomDomProps\n } = props as any;\n\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 (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).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 React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined') return;\n const px = normalizeToPx((props as any).size);\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 }, [(props as any).size, 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 },\n) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
5
- "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,OAAsB,wBAC/B,OAAS,YAAAC,OAAgB,sBACzB,OAAS,6BAAAC,GAA2B,sBAAAC,MAA0B,oBAC9D,OAAS,qBAAAC,OAAyB,oBAClC,OAAS,gBAAAC,EAAc,cAAAC,OAAkB,qBACzC,MAA6B,oBAwCtB,MAAMC,EAASV,EAAM,WAC1B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe,QAGf,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,YAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,EAAQ/B,GAAS,EACjBgC,EAAuB/B,GAA0BO,CAAY,EAC7DyB,EAAYD,IAAyB,UACrCE,GAAYF,IAAyB,UACrCG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KAAMY,EAAM,aAAemF,GAAM9D,EAAM,cAAc8D,EAAI,WAAa,WAAW,GAC3FjG,EAAA,cAACE,EAAM,QAAN,CAAc,KAAK,SAAS,MAAO,CAAE,QAAS,CAAE,EAAG,OAAQ,CAAE,QAAS,GAAGc,CAAY,IAAK,GACzFhB,EAAA,cAACG,GAAA,KACCH,EAAA,cAACE,EAAM,MAAN,KAAY,cAAY,CAC3B,EACC2C,CACH,CACF,CAEJ,CAEA,OACE7C,EAAA,cAAC,OACE,GAAGuF,GACJ,IAAK/C,GACL,UAAWvC,GAAW,iBAAkBU,CAAS,EACjD,YAAWwB,EAAM,WACjB,YAAWA,EAAM,aAAe,UAAY,OAC5C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa4B,GAAe,OACxE,MAAO,CACL,GAAGlC,EACF,gBAAyB,GAAGhB,CAAY,KACxC,oBAA6B,GAAGC,CAAO,KACvC,oBAA6B,GAAGC,CAAO,IAC1C,GAEAlB,EAAA,cAAC,OAAI,UAAU,wBAAwB,eAAckE,GAAc,QAChErB,CACH,EACC4B,EACH,CAEJ,CACF,EACA/D,EAAO,YAAc,eACrBA,EAAO,OAASF",
6
- "names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "useResponsiveValue", "PaneResizeContext", "BottomHandle", "PaneHandle", "Bottom", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "didInitRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initial", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastBottomModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "delta", "i", "_bottomDefaultOpenIgnored", "_bottomOpenIgnored", "_bottomOnOpenChangeIgnored", "_bottomSizeIgnored", "_bottomDefaultSizeIgnored", "_bottomOnSizeChangeIgnored", "_szu", "_szums", "bottomDomProps", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "o"]
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, useResponsiveValue } 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 } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\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 = PaneProps &\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\nexport const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(\n (\n {\n className,\n presentation = 'fixed',\n // removed legacy props\n // new API\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 ...props\n },\n ref,\n ) => {\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 onSizeChange = (props as any).onSizeChange;\n const sizeUpdate = (props as any).sizeUpdate;\n const sizeUpdateMs = (props as any).sizeUpdateMs;\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 const didInitRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen as any);\n React.useEffect(() => {\n if (didInitRef.current) return;\n if (!shell.currentBreakpointReady) return;\n didInitRef.current = true;\n if (typeof open === 'undefined' && typeof defaultOpen !== 'undefined') {\n const initial = Boolean(resolvedDefaultOpen);\n shell.setBottomMode(initial ? 'expanded' : 'collapsed');\n didInitFromDefaultOpenRef.current = true;\n }\n }, [shell, open, defaultOpen, resolvedDefaultOpen]);\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 (props as any).size !== 'undefined' && typeof (props as any).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 // Controlled sync (responsive handled below)\n React.useEffect(() => {\n if (typeof open === 'undefined') return;\n shell.setBottomMode(open ? 'expanded' : 'collapsed');\n }, [shell, open]);\n\n const responsiveNotifiedRef = React.useRef(false);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n shell.setBottomMode(shouldExpand ? 'expanded' : 'collapsed');\n }, [shell, resolvedOpen]);\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 if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.bottomMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\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 const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--bottom-size', `${loaded}px`);\n onResize?.(loaded);\n }\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 const {\n defaultOpen: _bottomDefaultOpenIgnored,\n open: _bottomOpenIgnored,\n onOpenChange: _bottomOnOpenChangeIgnored,\n size: _bottomSizeIgnored,\n defaultSize: _bottomDefaultSizeIgnored,\n onSizeChange: _bottomOnSizeChangeIgnored,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...bottomDomProps\n } = props as any;\n\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 (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).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 = (props as any).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 },\n) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
5
+ "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,OAAsB,wBAC/B,OAAS,YAAAC,OAAgB,sBACzB,OAAS,6BAAAC,GAA2B,sBAAAC,MAA0B,oBAC9D,OAAS,qBAAAC,OAAyB,oBAClC,OAAS,gBAAAC,EAAc,cAAAC,OAAkB,qBACzC,MAA6B,oBAwCtB,MAAMC,EAASV,EAAM,WAC1B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe,QAGf,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,GACA,kBAAAC,GACA,OAAAC,EACA,YAAAC,EACA,SAAAC,GACA,MAAAC,GACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,EAAQ/B,GAAS,EACjBgC,EAAuB/B,GAA0BO,CAAY,EAC7DyB,EAAYD,IAAyB,UACrCE,GAAYF,IAAyB,UACrCG,EAAWvC,EAAM,OAA8B,IAAI,EAC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,EAAM,KAAN,CAAW,KAAMY,EAAM,aAAe,GAAMqB,EAAM,cAAc,EAAI,WAAa,WAAW,GAC3FnC,EAAA,cAACE,EAAM,QAAN,CAAc,KAAK,SAAS,MAAO,CAAE,QAAS,CAAE,EAAG,OAAQ,CAAE,QAAS,GAAGc,CAAY,IAAK,GACzFhB,EAAA,cAACG,GAAA,KACCH,EAAA,cAACE,EAAM,MAAN,KAAY,cAAY,CAC3B,EACC2C,CACH,CACF,CAEJ,CAEA,OACE7C,EAAA,cAAC,OACE,GAAG0F,GACJ,IAAKlD,GACL,UAAWvC,GAAW,iBAAkBU,CAAS,EACjD,YAAWwB,EAAM,WACjB,YAAWA,EAAM,aAAe,UAAY,OAC5C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa+B,GAAe,OACxE,MAAO,CACL,GAAGrC,GACF,gBAAyB,GAAGhB,CAAY,KACxC,oBAA6B,GAAGC,CAAO,KACvC,oBAA6B,GAAGC,CAAO,IAC1C,GAEAlB,EAAA,cAAC,OAAI,UAAU,wBAAwB,eAAcqE,GAAc,QAChExB,CACH,EACC+B,EACH,CAEJ,CACF,EACAlE,EAAO,YAAc,eACrBA,EAAO,OAASF",
6
+ "names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "useResponsiveValue", "PaneResizeContext", "BottomHandle", "PaneHandle", "Bottom", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "didInitRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initial", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastBottomModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "delta", "i", "_bottomDefaultOpenIgnored", "_bottomOpenIgnored", "_bottomOnOpenChangeIgnored", "_bottomSizeIgnored", "_bottomDefaultSizeIgnored", "_bottomOnSizeChangeIgnored", "_szu", "_szums", "bottomDomProps", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize"]
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,EAAY,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAEtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAA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kBAAkB,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as n from"react";import re from"classnames";import*as w from"../sheet.js";import{VisuallyHidden as se}from"../visually-hidden.js";import{useShell as ie}from"../shell.context.js";import{useResponsivePresentation as ae,useResponsiveValue as W}from"../shell.hooks.js";import{PaneResizeContext as de}from"./shell-resize.js";import{InspectorHandle as k,PaneHandle as ce}from"./shell-handles.js";import"../shell.types.js";const A=n.forwardRef(({className:L,presentation:j={initial:"overlay",lg:"fixed"},defaultOpen:p,open:c,onOpenChange:f,expandedSize:M=320,minSize:l=200,maxSize:u=500,resizable:g=!1,collapsible:q=!0,onExpand:O,onCollapse:T,onResize:R,onResizeStart:K,onResizeEnd:G,snapPoints:J,snapTolerance:Q,collapseThreshold:X,paneId:z,persistence:I,children:Y,style:Z,...i},m)=>{const t=ie(),v=ae(j),y=v==="overlay",ee=v==="stacked",d=n.useRef(null),ne=n.useCallback(e=>{d.current=e,typeof m=="function"?m(e):m&&(m.current=e)},[m]),D=n.Children.toArray(Y),H=D.filter(e=>n.isValidElement(e)&&e.type===k),F=D.filter(e=>!(n.isValidElement(e)&&e.type===k)),b=n.useMemo(()=>{const e=i.onSizeChange,o=i.sizeUpdate,s=i.sizeUpdateMs??50;if(!e)return()=>{};if(o==="debounce"){let r=null;return(a,N)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(a,N)},s)}}if(o==="throttle"){let r=0;return(a,N)=>{const V=Date.now();V-r>=s&&(r=V,e(a,N))}}return(r,a)=>e(r,a)},[i.onSizeChange,i.sizeUpdate,i.sizeUpdateMs]),h=n.useRef(null);n.useEffect(()=>{const e=typeof c<"u";if(h.current===null){h.current=e;return}h.current!==e&&(console.warn("Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported."),h.current=e)},[c]);const B=n.useRef(!1),U=n.useRef(!1),_=W(p);n.useEffect(()=>{if(!t.currentBreakpointReady||U.current||typeof c<"u"||typeof p>"u")return;const e=!!_;t.setInspectorMode(e?"expanded":"collapsed"),e&&f?.(!0,{reason:"init"}),U.current=!0},[t.currentBreakpointReady,_,p,c,f]);const x=W(c);n.useEffect(()=>{if(typeof x>"u")return;const e=!!x;e&&t.inspectorMode!=="expanded"&&t.setInspectorMode("expanded"),!e&&t.inspectorMode!=="collapsed"&&t.setInspectorMode("collapsed")},[x,t.inspectorMode]);const $=n.useRef(!1),C=n.useRef(null);n.useEffect(()=>{!$.current&&typeof c>"u"&&p&&t.inspectorMode==="expanded"&&(f?.(!0,{reason:"init"}),$.current=!0),typeof c>"u"&&(C.current!==null&&C.current!==t.inspectorMode&&(B.current||f?.(t.inspectorMode==="expanded",{reason:"toggle"}),B.current=!1),C.current=t.inspectorMode)},[t.inspectorMode,c,p,f]),n.useEffect(()=>{t.inspectorMode==="expanded"?O?.():T?.()},[t.inspectorMode,O,T]);const E=t.inspectorMode==="expanded",P=n.useMemo(()=>{if(!z||I)return I;const e=`kookie-ui:shell:inspector:${z}`;return{load:()=>{if(typeof window>"u")return;const s=window.localStorage.getItem(e);return s?Number(s):void 0},save:s=>{typeof window>"u"||window.localStorage.setItem(e,String(s))}}},[z,I]);n.useEffect(()=>{let e=!0;return(async()=>{if(!g||!P?.load||y)return;const o=await P.load();e&&typeof o=="number"&&d.current&&(d.current.style.setProperty("--inspector-size",`${o}px`),R?.(o))})(),()=>{e=!1}},[g,P,R,y]);const te=g&&!y&&E?n.createElement(de.Provider,{value:{containerRef:d,cssVarName:"--inspector-size",minSize:l,maxSize:u,defaultSize:M,orientation:"vertical",edge:"start",computeNext:(e,o,s)=>{const r=getComputedStyle(d.current).direction==="rtl",a=e-o;return s+(r?a:-a)},onResize:R,onResizeStart:K,onResizeEnd:e=>{G?.(e),b(e,{reason:"resize"}),P?.save?.(e)},target:"inspector",collapsible:q,snapPoints:J,snapTolerance:Q??8,collapseThreshold:X,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},H.length>0?H.map((e,o)=>n.cloneElement(e,{key:e.key??o})):n.createElement(ce,null)):null,S=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 r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*r}if(o.endsWith("%")){const r=Number.parseFloat(o),a=document.documentElement.clientWidth||window.innerWidth||0;return r/100*a}const s=Number.parseFloat(o);return Number.isFinite(s)?s:void 0},[]);if(n.useEffect(()=>{if(d.current&&typeof i.size>"u"&&typeof i.defaultSize<"u"){const e=S(i.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--inspector-size",`${r}px`),b(r,{reason:"init"})}}},[]),n.useEffect(()=>{if(!d.current||typeof i.size>"u")return;const e=S(i.size);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof u=="number"?u:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));d.current.style.setProperty("--inspector-size",`${r}px`),b(r,{reason:"controlled"})}},[i.size,l,u,S,b]),y){const e=t.inspectorMode==="expanded";return n.createElement(w.Root,{open:e,onOpenChange:o=>t.setInspectorMode(o?"expanded":"collapsed")},n.createElement(w.Content,{side:"end",style:{padding:0},width:{initial:`${M}px`}},n.createElement(se,null,n.createElement(w.Title,null,"Inspector")),F))}const{defaultOpen:le,open:ue,onOpenChange:pe,size:fe,defaultSize:me,onSizeChange:ye,sizeUpdate:be,sizeUpdateMs:he,...oe}=i;return n.createElement("div",{...oe,ref:ne,className:re("rt-ShellInspector",L),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":t.currentBreakpointReady?v:void 0,"data-open":t.currentBreakpointReady&&ee&&E||void 0,style:{...Z,"--inspector-size":`${M}px`,"--inspector-min-size":`${l}px`,"--inspector-max-size":`${u}px`}},n.createElement("div",{className:"rt-ShellInspectorContent","data-visible":E||void 0},F),te)});A.displayName="Shell.Inspector",A.Handle=k;export{A as Inspector};
1
+ import*as n from"react";import de from"classnames";import*as k from"../sheet.js";import{VisuallyHidden as ce}from"../visually-hidden.js";import{useShell as le}from"../shell.context.js";import{useResponsivePresentation as pe,useResponsiveValue as q}from"../shell.hooks.js";import{PaneResizeContext as ue}from"./shell-resize.js";import{InspectorHandle as O,PaneHandle as fe}from"./shell-handles.js";import"../shell.types.js";const K=n.forwardRef(({className:G,presentation:J={initial:"overlay",lg:"fixed"},defaultOpen:u,open:d,onOpenChange:f,expandedSize:M=320,minSize:l=200,maxSize:p=500,resizable:g=!1,collapsible:Q=!0,onExpand:T,onCollapse:D,onResize:R,onResizeStart:X,onResizeEnd:Y,snapPoints:Z,snapTolerance:ee,collapseThreshold:ne,paneId:z,persistence:I,children:te,style:oe,...c},m)=>{const t=le(),v=pe(J),y=v==="overlay",re=v==="stacked",a=n.useRef(null),se=n.useCallback(e=>{a.current=e,typeof m=="function"?m(e):m&&(m.current=e)},[m]),H=n.Children.toArray(te),F=H.filter(e=>n.isValidElement(e)&&e.type===O),U=H.filter(e=>!(n.isValidElement(e)&&e.type===O)),_=c.onSizeChange,B=c.sizeUpdate,$=c.sizeUpdateMs,b=n.useMemo(()=>{const e=_,o=B,s=$??50;if(!e)return()=>{};if(o==="debounce"){let r=null;return(i,w)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(i,w)},s)}}if(o==="throttle"){let r=0;return(i,w)=>{const j=Date.now();j-r>=s&&(r=j,e(i,w))}}return(r,i)=>e(r,i)},[_,B,$]),h=n.useRef(null);n.useEffect(()=>{const e=typeof d<"u";if(h.current===null){h.current=e;return}h.current!==e&&(console.warn("Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported."),h.current=e)},[d]);const V=n.useRef(!1),W=n.useRef(!1),A=q(u);n.useEffect(()=>{if(!t.currentBreakpointReady||W.current||typeof d<"u"||typeof u>"u")return;const e=!!A;t.setInspectorMode(e?"expanded":"collapsed"),e&&f?.(!0,{reason:"init"}),W.current=!0},[t,A,u,d,f]);const x=q(d);n.useEffect(()=>{if(typeof x>"u")return;const e=!!x;e&&t.inspectorMode!=="expanded"&&t.setInspectorMode("expanded"),!e&&t.inspectorMode!=="collapsed"&&t.setInspectorMode("collapsed")},[t,x]);const L=n.useRef(!1),C=n.useRef(null);n.useEffect(()=>{!L.current&&typeof d>"u"&&u&&t.inspectorMode==="expanded"&&(f?.(!0,{reason:"init"}),L.current=!0),typeof d>"u"&&(C.current!==null&&C.current!==t.inspectorMode&&(V.current||f?.(t.inspectorMode==="expanded",{reason:"toggle"}),V.current=!1),C.current=t.inspectorMode)},[t.inspectorMode,d,u,f]),n.useEffect(()=>{t.inspectorMode==="expanded"?T?.():D?.()},[t.inspectorMode,T,D]);const E=t.inspectorMode==="expanded",P=n.useMemo(()=>{if(!z||I)return I;const e=`kookie-ui:shell:inspector:${z}`;return{load:()=>{if(typeof window>"u")return;const s=window.localStorage.getItem(e);return s?Number(s):void 0},save:s=>{typeof window>"u"||window.localStorage.setItem(e,String(s))}}},[z,I]);n.useEffect(()=>{let e=!0;return(async()=>{if(!g||!P?.load||y)return;const o=await P.load();e&&typeof o=="number"&&a.current&&(a.current.style.setProperty("--inspector-size",`${o}px`),R?.(o))})(),()=>{e=!1}},[g,P,R,y]);const ie=g&&!y&&E?n.createElement(ue.Provider,{value:{containerRef:a,cssVarName:"--inspector-size",minSize:l,maxSize:p,defaultSize:M,orientation:"vertical",edge:"start",computeNext:(e,o,s)=>{const r=getComputedStyle(a.current).direction==="rtl",i=e-o;return s+(r?i:-i)},onResize:R,onResizeStart:X,onResizeEnd:e=>{Y?.(e),b(e,{reason:"resize"}),P?.save?.(e)},target:"inspector",collapsible:Q,snapPoints:Z,snapTolerance:ee??8,collapseThreshold:ne,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},F.length>0?F.map((e,o)=>n.cloneElement(e,{key:e.key??o})):n.createElement(fe,null)):null,S=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 r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*r}if(o.endsWith("%")){const r=Number.parseFloat(o),i=document.documentElement.clientWidth||window.innerWidth||0;return r/100*i}const s=Number.parseFloat(o);return Number.isFinite(s)?s:void 0},[]);n.useEffect(()=>{if(a.current&&typeof c.size>"u"&&typeof c.defaultSize<"u"){const e=S(c.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof p=="number"?p:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));a.current.style.setProperty("--inspector-size",`${r}px`),b(r,{reason:"init"})}}},[]);const N=c.size;if(n.useEffect(()=>{if(!a.current||typeof N>"u")return;const e=S(N);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof p=="number"?p:void 0)??e,Math.max((typeof l=="number"?l:void 0)??e,e));a.current.style.setProperty("--inspector-size",`${r}px`),b(r,{reason:"controlled"})}},[N,l,p,S,b]),y){const e=t.inspectorMode==="expanded";return n.createElement(k.Root,{open:e,onOpenChange:o=>t.setInspectorMode(o?"expanded":"collapsed")},n.createElement(k.Content,{side:"end",style:{padding:0},width:{initial:`${M}px`}},n.createElement(ce,null,n.createElement(k.Title,null,"Inspector")),U))}const{defaultOpen:me,open:ye,onOpenChange:be,size:he,defaultSize:Pe,onSizeChange:Me,sizeUpdate:ge,sizeUpdateMs:Re,...ae}=c;return n.createElement("div",{...ae,ref:se,className:de("rt-ShellInspector",G),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":t.currentBreakpointReady?v:void 0,"data-open":t.currentBreakpointReady&&re&&E||void 0,style:{...oe,"--inspector-size":`${M}px`,"--inspector-min-size":`${l}px`,"--inspector-max-size":`${p}px`}},n.createElement("div",{className:"rt-ShellInspectorContent","data-visible":E||void 0},U),ie)});K.displayName="Shell.Inspector",K.Handle=O;export{K as Inspector};
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, useResponsiveValue } 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 } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\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 InspectorPublicProps = PaneProps &\n (InspectorControlledProps | InspectorUncontrolledProps) & {\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\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(\n (\n {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n // removed legacy props\n // new API\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 ...props\n },\n ref,\n ) => {\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 emitSizeChange = React.useMemo(() => {\n const cb = (props as any).onSizeChange as undefined | ((s: number, meta: InspectorSizeChangeMeta) => void);\n const strategy = (props as any).sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = (props as any).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 }, [(props as any).onSizeChange, (props as any).sizeUpdate, (props as any).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 // eslint-disable-next-line no-console\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 // eslint-disable-next-line no-console\n console.warn('Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const responsiveNotifiedRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen);\n React.useEffect(() => {\n if (!shell.currentBreakpointReady) return;\n if (didInitFromDefaultOpenRef.current) return;\n if (typeof open !== 'undefined') return; // controlled ignores default\n if (typeof defaultOpen === 'undefined') return;\n const initialOpen = Boolean(resolvedDefaultOpen);\n shell.setInspectorMode(initialOpen ? 'expanded' : 'collapsed');\n if (initialOpen) onOpenChange?.(true, { reason: 'init' });\n didInitFromDefaultOpenRef.current = true;\n }, [shell.currentBreakpointReady, resolvedDefaultOpen, defaultOpen, open, onOpenChange]);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n if (shouldExpand && shell.inspectorMode !== 'expanded') shell.setInspectorMode('expanded');\n if (!shouldExpand && shell.inspectorMode !== 'collapsed') shell.setInspectorMode('collapsed');\n }, [resolvedOpen, shell.inspectorMode]);\n\n // Removed boolean-only mount init; handled in responsive init effect above\n\n // Removed: boolean-only controlled sync. Use responsive-resolved effect below instead.\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 if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.inspectorMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\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 const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--inspector-size', `${loaded}px`);\n onResize?.(loaded);\n }\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 (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).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 React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined') return;\n const px = normalizeToPx((props as any).size);\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 }, [(props as any).size, 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 const {\n defaultOpen: _inspectorDefaultOpenIgnored,\n open: _inspectorOpenIgnored,\n onOpenChange: _inspectorOnOpenChangeIgnored,\n size: _sz,\n defaultSize: _dsz,\n onSizeChange: _osc,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...inspectorDomProps\n } = props as any;\n\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 },\n) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
5
- "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,OAAsB,wBAC/B,OAAS,YAAAC,OAAgB,sBACzB,OAAS,6BAAAC,GAA2B,sBAAAC,MAA0B,oBAC9D,OAAS,qBAAAC,OAAyB,oBAClC,OAAS,mBAAAC,EAAiB,cAAAC,OAAkB,qBAC5C,MAA6B,oBAqCtB,MAAMC,EAAYV,EAAM,WAC7B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe,CAAE,QAAS,UAAW,GAAI,OAAQ,EAGjD,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,YAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,EAAQ/B,GAAS,EACjBgC,EAAuB/B,GAA0BO,CAAY,EAC7DyB,EAAYD,IAAyB,UACrCE,GAAYF,IAAyB,UACrCG,EAAWvC,EAAM,OAA8B,IAAI,EACnDwC,GAASxC,EAAM,YAClByC,GAAgC,CAC/BF,EAAS,QAAUE,EACf,OAAOP,GAAQ,WAAYA,EAAIO,CAAI,EAC9BP,IAAMA,EAAsD,QAAUO,EACjF,EACA,CAACP,CAA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CH,EAAA,cAACE,EAAM,MAAN,KAAY,WAAS,CACxB,EACC2C,CACH,CACF,CAEJ,CAGA,KAAM,CACJ,YAAa2C,GACb,KAAMC,GACN,aAAcC,GACd,KAAMC,GACN,YAAaC,GACb,aAAcC,GACd,WAAYC,GACZ,aAAcC,GACd,GAAGC,EACL,EAAI/D,EAEJ,OACEjC,EAAA,cAAC,OACE,GAAGgG,GACJ,IAAKxD,GACL,UAAWvC,GAAW,oBAAqBU,CAAS,EACpD,YAAWwB,EAAM,cACjB,YAAWA,EAAM,aAAe,aAAe,OAC/C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa2B,GAAe,OACxE,MAAO,CACL,GAAGjC,EACF,mBAA4B,GAAGhB,CAAY,KAC3C,uBAAgC,GAAGC,CAAO,KAC1C,uBAAgC,GAAGC,CAAO,IAC7C,GAEAlB,EAAA,cAAC,OAAI,UAAU,2BAA2B,eAAciE,GAAc,QACnEpB,CACH,EACC2B,EACH,CAEJ,CACF,EAEA9D,EAAU,YAAc,kBACxBA,EAAU,OAASF",
6
- "names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "useResponsiveValue", "PaneResizeContext", "InspectorHandle", "PaneHandle", "Inspector", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initialOpen", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastInspectorModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "_inspectorDefaultOpenIgnored", "_inspectorOpenIgnored", "_inspectorOnOpenChangeIgnored", "_sz", "_dsz", "_osc", "_szu", "_szums", "inspectorDomProps"]
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, useResponsiveValue } 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 } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\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 InspectorPublicProps = PaneProps &\n (InspectorControlledProps | InspectorUncontrolledProps) & {\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\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(\n (\n {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n // removed legacy props\n // new API\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 ...props\n },\n ref,\n ) => {\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 onSizeChange = (props as any).onSizeChange;\n const sizeUpdate = (props as any).sizeUpdate;\n const sizeUpdateMs = (props as any).sizeUpdateMs;\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 responsiveNotifiedRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen);\n React.useEffect(() => {\n if (!shell.currentBreakpointReady) return;\n if (didInitFromDefaultOpenRef.current) return;\n if (typeof open !== 'undefined') return; // controlled ignores default\n if (typeof defaultOpen === 'undefined') return;\n const initialOpen = Boolean(resolvedDefaultOpen);\n shell.setInspectorMode(initialOpen ? 'expanded' : 'collapsed');\n if (initialOpen) onOpenChange?.(true, { reason: 'init' });\n didInitFromDefaultOpenRef.current = true;\n }, [shell, resolvedDefaultOpen, defaultOpen, open, onOpenChange]);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n if (shouldExpand && shell.inspectorMode !== 'expanded') shell.setInspectorMode('expanded');\n if (!shouldExpand && shell.inspectorMode !== 'collapsed') shell.setInspectorMode('collapsed');\n }, [shell, resolvedOpen]);\n\n // Removed boolean-only mount init; handled in responsive init effect above\n\n // Removed: boolean-only controlled sync. Use responsive-resolved effect below instead.\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 if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.inspectorMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\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 const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--inspector-size', `${loaded}px`);\n onResize?.(loaded);\n }\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 (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).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 = (props as any).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 const {\n defaultOpen: _inspectorDefaultOpenIgnored,\n open: _inspectorOpenIgnored,\n onOpenChange: _inspectorOnOpenChangeIgnored,\n size: _sz,\n defaultSize: _dsz,\n onSizeChange: _osc,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...inspectorDomProps\n } = props as any;\n\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 },\n) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
5
+ "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,OAAsB,wBAC/B,OAAS,YAAAC,OAAgB,sBACzB,OAAS,6BAAAC,GAA2B,sBAAAC,MAA0B,oBAC9D,OAAS,qBAAAC,OAAyB,oBAClC,OAAS,mBAAAC,EAAiB,cAAAC,OAAkB,qBAC5C,MAA6B,oBAqCtB,MAAMC,EAAYV,EAAM,WAC7B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe,CAAE,QAAS,UAAW,GAAI,OAAQ,EAGjD,YAAAC,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,GACA,kBAAAC,GACA,OAAAC,EACA,YAAAC,EACA,SAAAC,GACA,MAAAC,GACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,EAAQ/B,GAAS,EACjBgC,EAAuB/B,GAA0BO,CAAY,EAC7DyB,EAAYD,IAAyB,UACrCE,GAAYF,IAAyB,UACrCG,EAAWvC,EAAM,OAA8B,IAAI,EACnDwC,GAASxC,EAAM,YAClByC,GAAgC,CAC/BF,EAAS,QAAUE,EACf,OAAOP,GAAQ,WAAYA,EAAIO,CAAI,EAC9B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CAAE,QAAS,GAAGc,CAAY,IAAK,GACrFhB,EAAA,cAACG,GAAA,KACCH,EAAA,cAACE,EAAM,MAAN,KAAY,WAAS,CACxB,EACC2C,CACH,CACF,CAEJ,CAGA,KAAM,CACJ,YAAa+C,GACb,KAAMC,GACN,aAAcC,GACd,KAAMC,GACN,YAAaC,GACb,aAAcC,GACd,WAAYC,GACZ,aAAcC,GACd,GAAGC,EACL,EAAInE,EAEJ,OACEjC,EAAA,cAAC,OACE,GAAGoG,GACJ,IAAK5D,GACL,UAAWvC,GAAW,oBAAqBU,CAAS,EACpD,YAAWwB,EAAM,cACjB,YAAWA,EAAM,aAAe,aAAe,OAC/C,oBAAmBA,EAAM,uBAAyBC,EAAuB,OACzE,YAAYD,EAAM,wBAA0BG,IAAa8B,GAAe,OACxE,MAAO,CACL,GAAGpC,GACF,mBAA4B,GAAGhB,CAAY,KAC3C,uBAAgC,GAAGC,CAAO,KAC1C,uBAAgC,GAAGC,CAAO,IAC7C,GAEAlB,EAAA,cAAC,OAAI,UAAU,2BAA2B,eAAcoE,GAAc,QACnEvB,CACH,EACC8B,EACH,CAEJ,CACF,EAEAjE,EAAU,YAAc,kBACxBA,EAAU,OAASF",
6
+ "names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "useResponsiveValue", "PaneResizeContext", "InspectorHandle", "PaneHandle", "Inspector", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initialOpen", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastInspectorModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "controlledSize", "_inspectorDefaultOpenIgnored", "_inspectorOpenIgnored", "_inspectorOnOpenChangeIgnored", "_sz", "_dsz", "_osc", "_szu", "_szums", "inspectorDomProps"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import*as r from"react";import ue from"classnames";import*as D from"../sheet.js";import{VisuallyHidden as ce}from"../visually-hidden.js";import{useShell as j}from"../shell.context.js";import{useResponsivePresentation as fe,useResponsiveValue as q}from"../shell.hooks.js";import{PaneResizeContext as be}from"./shell-resize.js";import{SidebarHandle as F,PaneHandle as pe}from"./shell-handles.js";import"../shell.types.js";const K=r.forwardRef(({className:G,presentation:J={initial:"overlay",md:"fixed"},expandedSize:u=288,minSize:c=200,maxSize:f=400,resizable:C=!1,collapsible:Q=!0,onExpand:$,onCollapse:U,onResize:z,onResizeStart:X,onResizeEnd:Y,snapPoints:Z,snapTolerance:ee,collapseThreshold:te,paneId:x,persistence:E,children:ne,style:re,thinSize:y=64,toggleModes:w,state:b,defaultState:p,onStateChange:N,...s},S)=>{const t=j(),k=fe(J),M=k==="overlay",oe=k==="stacked",d=r.useRef(null),ae=r.useCallback(e=>{d.current=e,typeof S=="function"?S(e):S&&(S.current=e)},[S]),_=r.Children.toArray(ne),O=_.filter(e=>r.isValidElement(e)&&e.type===F),V=_.filter(e=>!(r.isValidElement(e)&&e.type===F)),h=r.useMemo(()=>{const e=s.onSizeChange,n=s.sizeUpdate,o=s.sizeUpdateMs??50;if(!e)return()=>{};if(n==="debounce"){let a=null;return(i,m)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(i,m)},o)}}if(n==="throttle"){let a=0;return(i,m)=>{const L=Date.now();L-a>=o&&(a=L,e(i,m))}}return(a,i)=>e(a,i)},[s.onSizeChange,s.sizeUpdate,s.sizeUpdateMs]),ie=r.useId();r.useEffect(()=>(t.setHasSidebar(!0),()=>{t.setHasSidebar(!1)}),[t,ie]);const g=r.useRef(null);r.useEffect(()=>{const e=typeof b<"u";if(g.current===null){g.current=e;return}g.current!==e&&(console.warn("Shell.Sidebar: Switching between controlled and uncontrolled `state` is not supported."),g.current=e)},[b]);const l=q(b),B=q(p),W=r.useRef(!1);r.useEffect(()=>{if(!W.current&&t.currentBreakpointReady){if(W.current=!0,typeof b<"u"&&l){t.sidebarMode!==l&&t.setSidebarMode(l);return}if(typeof p<"u"){const e=B??p;t.sidebarMode!==e&&t.setSidebarMode(e),N?.(e,{reason:"init"});return}}},[t.currentBreakpointReady,B,l,b,p]),r.useEffect(()=>{l!==void 0&&t.sidebarMode!==l&&t.setSidebarMode(l)},[l,t.sidebarMode]);const P=r.useRef(null);r.useEffect(()=>{typeof b>"u"&&(P.current===null?P.current=t.sidebarMode:P.current!==t.sidebarMode&&(P.current=t.sidebarMode,N?.(t.sidebarMode,{reason:"toggle"})))},[t.sidebarMode,b,N]),r.useEffect(()=>{t.sidebarMode==="expanded"?$?.():U?.()},[t.sidebarMode,$,U]);const A=t.sidebarMode!=="collapsed",v=r.useMemo(()=>{if(!x||E)return E;const e=`kookie-ui:shell:sidebar:${x}`;return{load:()=>{if(typeof window>"u")return;const o=window.localStorage.getItem(e);return o?Number(o):void 0},save:o=>{typeof window>"u"||window.localStorage.setItem(e,String(o))}}},[x,E]);r.useEffect(()=>{let e=!0;return(async()=>{if(!C||!v?.load||M)return;const n=await v.load();e&&typeof n=="number"&&d.current&&(d.current.style.setProperty("--sidebar-size",`${n}px`),z?.(n))})(),()=>{e=!1}},[C,v,z,M]);const R=j(),T=r.useCallback(()=>{const e=p??"expanded";return e==="thin"||e==="expanded"?e:"expanded"},[p]);r.useEffect(()=>{if(!R.setSidebarToggleComputer)return;const e=w??"both",n=o=>{if(e==="both")return o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed";const a=T();return o==="collapsed"?a:o===a?"collapsed":a};return R.setSidebarToggleComputer(n),()=>{R.setSidebarToggleComputer?.(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed")}},[R,w,T]);const I=r.useRef(u),se=r.useRef("expanded");r.useEffect(()=>{t.sidebarMode!=="collapsed"&&(se.current=t.sidebarMode,I.current=t.sidebarMode==="thin"?y:u)},[t.sidebarMode,y,u]);const de=C&&!M&&t.sidebarMode==="expanded"?r.createElement(be.Provider,{value:{containerRef:d,cssVarName:"--sidebar-size",minSize:c,maxSize:f,defaultSize:u,orientation:"vertical",edge:"end",computeNext:(e,n,o)=>{const a=getComputedStyle(d.current).direction==="rtl",i=e-n;return o+(a?-i:i)},onResize:z,onResizeStart:X,onResizeEnd:e=>{Y?.(e),h(e,{reason:"resize"}),v?.save?.(e)},target:"sidebar",collapsible:Q,snapPoints:Z,snapTolerance:ee??8,collapseThreshold:te,requestCollapse:()=>t.setSidebarMode("collapsed"),requestToggle:()=>t.togglePane("sidebar")}},O.length>0?O.map((e,n)=>r.cloneElement(e,{key:e.key??n})):r.createElement(pe,null)):null,{state:me,defaultState:ye,onStateChange:Se,size:Me,defaultSize:he,onSizeChange:ge,sizeUpdate:Pe,sizeUpdateMs:ve,...le}=s,H=r.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),i=document.documentElement.clientWidth||window.innerWidth||0;return a/100*i}const o=Number.parseFloat(n);return Number.isFinite(o)?o:void 0},[]);if(r.useEffect(()=>{if(!d.current)return;const{size:e,defaultSize:n}=s;if(typeof e>"u"&&typeof n<"u"){const o=H(n);if(typeof o=="number"&&Number.isFinite(o)){const m=Math.min((typeof f=="number"?f:void 0)??o,Math.max((typeof c=="number"?c:void 0)??o,o));d.current.style.setProperty("--sidebar-size",`${m}px`),h(m,{reason:"init"})}}},[]),r.useEffect(()=>{if(!d.current)return;const{size:e}=s;if(typeof e>"u")return;const n=H(e);if(typeof n=="number"&&Number.isFinite(n)){const i=Math.min((typeof f=="number"?f:void 0)??n,Math.max((typeof c=="number"?c:void 0)??n,n));d.current.style.setProperty("--sidebar-size",`${i}px`),h(i,{reason:"controlled"})}},[s.size,c,f,H,h]),M){const e=t.sidebarMode!=="collapsed";return r.createElement(D.Root,{open:e,onOpenChange:n=>t.setSidebarMode(n?"expanded":"collapsed")},r.createElement(D.Content,{side:"start",style:{padding:0},width:{initial:`${e?t.sidebarMode==="thin"?y:u:I.current}px`}},r.createElement(ce,null,r.createElement(D.Title,null,"Navigation")),V))}return r.createElement("div",{...le,ref:ae,className:ue("rt-ShellSidebar",G),"data-mode":t.sidebarMode,"data-peek":t.peekTarget==="sidebar"||void 0,"data-presentation":t.currentBreakpointReady?k:void 0,"data-open":t.currentBreakpointReady&&oe&&A||void 0,style:{...re,"--sidebar-size":`${u}px`,"--sidebar-thin-size":`${y}px`,"--sidebar-min-size":`${c}px`,"--sidebar-max-size":`${f}px`,...t.peekTarget==="sidebar"&&t.sidebarMode==="collapsed"&&!M?(()=>{const e=w??"both",n=t.sidebarMode;let o;if(e==="both")o=n==="collapsed"?"thin":n==="thin"?"expanded":"collapsed";else{const a=T();o=n==="collapsed"?a:"collapsed"}return o==="thin"?{"--peek-sidebar-width":`${y}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${u}px)`}})():{}}},r.createElement("div",{className:"rt-ShellSidebarContent","data-visible":A||void 0},V),de)});K.displayName="Shell.Sidebar",K.Handle=F;export{K as Sidebar};
1
+ import*as n from"react";import pe from"classnames";import*as F from"../sheet.js";import{VisuallyHidden as me}from"../visually-hidden.js";import{useShell as J}from"../shell.context.js";import{useResponsivePresentation as ye,useResponsiveValue as Q}from"../shell.hooks.js";import{PaneResizeContext as Se}from"./shell-resize.js";import{SidebarHandle as $,PaneHandle as he}from"./shell-handles.js";import"../shell.types.js";const X=n.forwardRef(({className:Y,presentation:Z={initial:"overlay",md:"fixed"},expandedSize:l=288,minSize:u=200,maxSize:c=400,resizable:C=!1,collapsible:ee=!0,onExpand:U,onCollapse:_,onResize:z,onResizeStart:te,onResizeEnd:ne,snapPoints:re,snapTolerance:oe,collapseThreshold:ie,paneId:x,persistence:E,children:se,style:ae,thinSize:y=64,toggleModes:w,state:f,defaultState:b,onStateChange:N,...p},S)=>{const t=J(),k=ye(Z),h=k==="overlay",de=k==="stacked",a=n.useRef(null),le=n.useCallback(e=>{a.current=e,typeof S=="function"?S(e):S&&(S.current=e)},[S]),O=n.Children.toArray(se),V=O.filter(e=>n.isValidElement(e)&&e.type===$),B=O.filter(e=>!(n.isValidElement(e)&&e.type===$)),W=p.onSizeChange,A=p.sizeUpdate,I=p.sizeUpdateMs,M=n.useMemo(()=>{const e=W,r=A,o=I??50;if(!e)return()=>{};if(r==="debounce"){let i=null;return(s,m)=>{i&&clearTimeout(i),i=setTimeout(()=>{e(s,m)},o)}}if(r==="throttle"){let i=0;return(s,m)=>{const G=Date.now();G-i>=o&&(i=G,e(s,m))}}return(i,s)=>e(i,s)},[W,A,I]),ue=n.useId();n.useEffect(()=>(t.setHasSidebar(!0),()=>{t.setHasSidebar(!1)}),[t,ue]);const g=n.useRef(null);n.useEffect(()=>{const e=typeof f<"u";if(g.current===null){g.current=e;return}g.current!==e&&(console.warn("Shell.Sidebar: Switching between controlled and uncontrolled `state` is not supported."),g.current=e)},[f]);const d=Q(f),L=Q(b),j=n.useRef(!1);n.useEffect(()=>{if(!j.current&&t.currentBreakpointReady){if(j.current=!0,typeof f<"u"&&d){t.sidebarMode!==d&&t.setSidebarMode(d);return}if(typeof b<"u"){const e=L??b;t.sidebarMode!==e&&t.setSidebarMode(e),N?.(e,{reason:"init"});return}}},[t.currentBreakpointReady,L,d,f,b]),n.useEffect(()=>{d!==void 0&&t.sidebarMode!==d&&t.setSidebarMode(d)},[t,d]);const P=n.useRef(null);n.useEffect(()=>{typeof f>"u"&&(P.current===null?P.current=t.sidebarMode:P.current!==t.sidebarMode&&(P.current=t.sidebarMode,N?.(t.sidebarMode,{reason:"toggle"})))},[t.sidebarMode,f,N]),n.useEffect(()=>{t.sidebarMode==="expanded"?U?.():_?.()},[t.sidebarMode,U,_]);const q=t.sidebarMode!=="collapsed",v=n.useMemo(()=>{if(!x||E)return E;const e=`kookie-ui:shell:sidebar:${x}`;return{load:()=>{if(typeof window>"u")return;const o=window.localStorage.getItem(e);return o?Number(o):void 0},save:o=>{typeof window>"u"||window.localStorage.setItem(e,String(o))}}},[x,E]);n.useEffect(()=>{let e=!0;return(async()=>{if(!C||!v?.load||h)return;const r=await v.load();e&&typeof r=="number"&&a.current&&(a.current.style.setProperty("--sidebar-size",`${r}px`),z?.(r))})(),()=>{e=!1}},[C,v,z,h]);const R=J(),T=n.useCallback(()=>{const e=b??"expanded";return e==="thin"||e==="expanded"?e:"expanded"},[b]);n.useEffect(()=>{if(!R.setSidebarToggleComputer)return;const e=w??"both",r=o=>{if(e==="both")return o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed";const i=T();return o==="collapsed"?i:o===i?"collapsed":i};return R.setSidebarToggleComputer(r),()=>{R.setSidebarToggleComputer?.(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed")}},[R,w,T]);const K=n.useRef(l),ce=n.useRef("expanded");n.useEffect(()=>{t.sidebarMode!=="collapsed"&&(ce.current=t.sidebarMode,K.current=t.sidebarMode==="thin"?y:l)},[t.sidebarMode,y,l]);const fe=C&&!h&&t.sidebarMode==="expanded"?n.createElement(Se.Provider,{value:{containerRef:a,cssVarName:"--sidebar-size",minSize:u,maxSize:c,defaultSize:l,orientation:"vertical",edge:"end",computeNext:(e,r,o)=>{const i=getComputedStyle(a.current).direction==="rtl",s=e-r;return o+(i?-s:s)},onResize:z,onResizeStart:te,onResizeEnd:e=>{ne?.(e),M(e,{reason:"resize"}),v?.save?.(e)},target:"sidebar",collapsible:ee,snapPoints:re,snapTolerance:oe??8,collapseThreshold:ie,requestCollapse:()=>t.setSidebarMode("collapsed"),requestToggle:()=>t.togglePane("sidebar")}},V.length>0?V.map((e,r)=>n.cloneElement(e,{key:e.key??r})):n.createElement(he,null)):null,{state:Me,defaultState:ge,onStateChange:Pe,size:ve,defaultSize:Re,onSizeChange:Ce,sizeUpdate:ze,sizeUpdateMs:xe,...be}=p,H=n.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 i=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(r)*i}if(r.endsWith("%")){const i=Number.parseFloat(r),s=document.documentElement.clientWidth||window.innerWidth||0;return i/100*s}const o=Number.parseFloat(r);return Number.isFinite(o)?o:void 0},[]);n.useEffect(()=>{if(!a.current)return;const{size:e,defaultSize:r}=p;if(typeof e>"u"&&typeof r<"u"){const o=H(r);if(typeof o=="number"&&Number.isFinite(o)){const m=Math.min((typeof c=="number"?c:void 0)??o,Math.max((typeof u=="number"?u:void 0)??o,o));a.current.style.setProperty("--sidebar-size",`${m}px`),M(m,{reason:"init"})}}},[]);const D=p.size;if(n.useEffect(()=>{if(!a.current||typeof D>"u")return;const e=H(D);if(typeof e=="number"&&Number.isFinite(e)){const i=Math.min((typeof c=="number"?c:void 0)??e,Math.max((typeof u=="number"?u:void 0)??e,e));a.current.style.setProperty("--sidebar-size",`${i}px`),M(i,{reason:"controlled"})}},[D,u,c,H,M]),h){const e=t.sidebarMode!=="collapsed";return n.createElement(F.Root,{open:e,onOpenChange:r=>t.setSidebarMode(r?"expanded":"collapsed")},n.createElement(F.Content,{side:"start",style:{padding:0},width:{initial:`${e?t.sidebarMode==="thin"?y:l:K.current}px`}},n.createElement(me,null,n.createElement(F.Title,null,"Navigation")),B))}return n.createElement("div",{...be,ref:le,className:pe("rt-ShellSidebar",Y),"data-mode":t.sidebarMode,"data-peek":t.peekTarget==="sidebar"||void 0,"data-presentation":t.currentBreakpointReady?k:void 0,"data-open":t.currentBreakpointReady&&de&&q||void 0,style:{...ae,"--sidebar-size":`${l}px`,"--sidebar-thin-size":`${y}px`,"--sidebar-min-size":`${u}px`,"--sidebar-max-size":`${c}px`,...t.peekTarget==="sidebar"&&t.sidebarMode==="collapsed"&&!h?(()=>{const e=w??"both",r=t.sidebarMode;let o;if(e==="both")o=r==="collapsed"?"thin":r==="thin"?"expanded":"collapsed";else{const i=T();o=r==="collapsed"?i:"collapsed"}return o==="thin"?{"--peek-sidebar-width":`${y}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${l}px)`}})():{}}},n.createElement("div",{className:"rt-ShellSidebarContent","data-visible":q||void 0},B),fe)});X.displayName="Shell.Sidebar",X.Handle=$;export{X as Sidebar};
2
2
  //# sourceMappingURL=shell-sidebar.js.map