@kushagradhawan/kookie-ui 0.1.46 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import*as e from"react";import H from"classnames";import{AlertDialog as i}from"radix-ui";import{alertDialogContentPropDefs as L}from"./alert-dialog.props.js";import{Heading as O}from"./heading.js";import{Text as S}from"./text.js";import{Theme as K}from"./theme.js";import{extractProps as s}from"../helpers/extract-props.js";import{requireReactElement as m}from"../helpers/require-react-element.js";const P=t=>e.createElement(i.Root,{...t});P.displayName="AlertDialog.Root";const u=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Trigger,{...o,ref:r,asChild:!0},m(t)));u.displayName="AlertDialog.Trigger";const C=e.forwardRef(({align:t,...o},r)=>{const{align:h,panelBackground:R,material:x,...N}=L,{className:b}=s({align:t},{align:h}),{panelBackground:c}=s({panelBackground:o.panelBackground},{panelBackground:R}),{material:p}=s({material:o.material},{material:x}),D=e.useMemo(()=>(p!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead."),p??c),[p,c]),{className:k,forceMount:B,container:w,panelBackground:_,material:j,...M}=s(o,N),A=e.useRef(null),W=e.useMemo(()=>l=>{A.current=l,typeof r=="function"?r(l):r&&(r.current=l)},[r]);return e.useEffect(()=>{if(typeof window>"u")return;const l=A.current;if(!l)return;const a=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(a.length===0)return;const g=a[0],f=a[a.length-1],d=n=>{n.key==="Tab"&&(n.shiftKey?document.activeElement===g&&(n.preventDefault(),f.focus()):document.activeElement===f&&(n.preventDefault(),g.focus()))};return l.addEventListener("keydown",d),g.focus(),()=>{l.removeEventListener("keydown",d)}},[]),e.createElement(i.Portal,{container:w,forceMount:B},e.createElement(K,{asChild:!0},e.createElement(i.Overlay,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},e.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},e.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${b}`},e.createElement(i.Content,{...M,ref:W,className:H("rt-BaseDialogContent","rt-AlertDialogContent",k),"data-material":D,"data-panel-background":D,tabIndex:-1,role:"alertdialog","aria-modal":"true","aria-describedby":"alert-dialog-description"}),e.createElement("div",{"aria-live":"assertive","aria-atomic":"true",className:"rt-sr-only",id:"alert-dialog-announcement"}))))))});C.displayName="AlertDialog.Content";const y=e.forwardRef((t,o)=>e.createElement(i.Title,{asChild:!0},e.createElement(O,{size:"5",mb:"3",trim:"start",...t,asChild:!1,ref:o})));y.displayName="AlertDialog.Title";const v=e.forwardRef((t,o)=>e.createElement(i.Description,{asChild:!0},e.createElement(S,{as:"p",size:"3",...t,asChild:!1,ref:o})));v.displayName="AlertDialog.Description";const T=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Action,{...o,ref:r,asChild:!0},m(t)));T.displayName="AlertDialog.Action";const E=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Cancel,{...o,ref:r,asChild:!0},m(t)));E.displayName="AlertDialog.Cancel";export{T as Action,E as Cancel,C as Content,v as Description,P as Root,y as Title,u as Trigger};
1
+ import*as e from"react";import H from"classnames";import{AlertDialog as l}from"radix-ui";import{alertDialogContentPropDefs as L}from"./alert-dialog.props.js";import{Heading as O}from"./heading.js";import{Text as S}from"./text.js";import{Theme as K}from"./theme.js";import{extractProps as s}from"../helpers/extract-props.js";import{requireReactElement as m}from"../helpers/require-react-element.js";const P=t=>e.createElement(l.Root,{...t});P.displayName="AlertDialog.Root";const u=e.forwardRef(({children:t,...o},r)=>e.createElement(l.Trigger,{...o,ref:r,asChild:!0},m(t)));u.displayName="AlertDialog.Trigger";const C=e.forwardRef(({align:t,...o},r)=>{const{align:h,panelBackground:R,material:x,...N}=L,{className:b}=s({align:t},{align:h}),{panelBackground:c}=s({panelBackground:o.panelBackground},{panelBackground:R}),{material:p}=s({material:o.material},{material:x}),D=e.useMemo(()=>(p!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead."),p??c),[p,c]),{className:k,forceMount:B,container:w,panelBackground:_,material:j,...M}=s(o,N),A=e.useRef(null),W=e.useMemo(()=>i=>{A.current=i,typeof r=="function"?r(i):r&&(r.current=i)},[r]);return e.useEffect(()=>{if(typeof window>"u")return;const i=A.current;if(!i)return;const a=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(a.length===0)return;const g=a[0],f=a[a.length-1],d=n=>{n.key==="Tab"&&(n.shiftKey?document.activeElement===g&&(n.preventDefault(),f.focus()):document.activeElement===f&&(n.preventDefault(),g.focus()))};return i.addEventListener("keydown",d),g.focus(),()=>{i.removeEventListener("keydown",d)}},[]),e.createElement(l.Portal,{container:w,forceMount:B},e.createElement(K,{asChild:!0},e.createElement(l.Overlay,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},e.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},e.createElement("div",{className:`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${b}`},e.createElement(l.Content,{...M,ref:W,className:H("rt-BaseDialogContent","rt-AlertDialogContent",k),"data-material":D,"data-panel-background":D,tabIndex:-1,role:"alertdialog","aria-modal":"true","aria-describedby":"alert-dialog-description",onCloseAutoFocus:i=>{i.preventDefault(),document.body.style.pointerEvents=""}}),e.createElement("div",{"aria-live":"assertive","aria-atomic":"true",className:"rt-sr-only",id:"alert-dialog-announcement"}))))))});C.displayName="AlertDialog.Content";const y=e.forwardRef((t,o)=>e.createElement(l.Title,{asChild:!0},e.createElement(O,{size:"5",mb:"3",trim:"start",...t,asChild:!1,ref:o})));y.displayName="AlertDialog.Title";const v=e.forwardRef((t,o)=>e.createElement(l.Description,{asChild:!0},e.createElement(S,{as:"p",size:"3",...t,asChild:!1,ref:o})));v.displayName="AlertDialog.Description";const T=e.forwardRef(({children:t,...o},r)=>e.createElement(l.Action,{...o,ref:r,asChild:!0},m(t)));T.displayName="AlertDialog.Action";const E=e.forwardRef(({children:t,...o},r)=>e.createElement(l.Cancel,{...o,ref:r,asChild:!0},m(t)));E.displayName="AlertDialog.Cancel";export{T as Action,E as Cancel,C as Content,v as Description,P as Root,y as Title,u as Trigger};
2
2
  //# sourceMappingURL=alert-dialog.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/alert-dialog.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\n\nimport { alertDialogContentPropDefs } from './alert-dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\n\nimport type { AlertDialogContentOwnProps } from './alert-dialog.props.js';\nimport type {\n ComponentPropsWithout,\n RemovedProps,\n ComponentPropsAs,\n} from '../helpers/component-props.js';\n\ninterface AlertDialogRootProps\n extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root> {}\nconst AlertDialogRoot: React.FC<AlertDialogRootProps> = (props) => (\n <AlertDialogPrimitive.Root {...props} />\n);\nAlertDialogRoot.displayName = 'AlertDialog.Root';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof AlertDialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Trigger, RemovedProps> {}\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Trigger>\n ),\n);\nAlertDialogTrigger.displayName = 'AlertDialog.Trigger';\n\ntype AlertDialogContentElement = React.ElementRef<typeof AlertDialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Content, RemovedProps>,\n AlertDialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Portal>['container'];\n}\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n ({ align, ...props }, forwardedRef) => {\n const {\n align: alignPropDef,\n panelBackground: panelBackgroundPropDef,\n material: materialPropDef,\n ...propDefs\n } = alertDialogContentPropDefs;\n\n const { className: alignClassName } = extractProps({ align }, { align: alignPropDef });\n\n // Extract panelBackground and material from props\n const { panelBackground: extractedPanelBackground } = extractProps(\n { panelBackground: props.panelBackground },\n { panelBackground: panelBackgroundPropDef },\n );\n\n const { material: extractedMaterial } = extractProps(\n { material: props.material },\n { material: materialPropDef },\n );\n\n // Handle material prop with panelBackground fallback\n const materialValue = React.useMemo(() => {\n if (extractedMaterial !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n return extractedMaterial ?? extractedPanelBackground;\n }, [extractedMaterial, extractedPanelBackground]);\n\n const {\n className,\n forceMount,\n container,\n panelBackground: _,\n material: __,\n ...contentProps\n } = extractProps(props, propDefs);\n\n // Focus management\n const contentRef = React.useRef<HTMLDivElement>(null);\n const combinedRef = React.useMemo(\n () => (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n // Focus trap effect\n React.useEffect(() => {\n // SSR safety - only run on client\n if (typeof window === 'undefined') return;\n\n const content = contentRef.current;\n if (!content) return;\n\n const focusableElements = content.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0] as HTMLElement;\n const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n }\n } else {\n if (document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n };\n\n content.addEventListener('keydown', handleKeyDown);\n\n // Focus first element when dialog opens\n firstElement.focus();\n\n return () => {\n content.removeEventListener('keydown', handleKeyDown);\n };\n }, []);\n\n return (\n <AlertDialogPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <AlertDialogPrimitive.Overlay className=\"rt-BaseDialogOverlay rt-AlertDialogOverlay\">\n <div className=\"rt-BaseDialogScroll rt-AlertDialogScroll\">\n <div\n className={`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${alignClassName}`}\n >\n <AlertDialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('rt-BaseDialogContent', 'rt-AlertDialogContent', className)}\n data-material={materialValue}\n data-panel-background={materialValue}\n tabIndex={-1}\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-describedby=\"alert-dialog-description\"\n />\n {/* ARIA live region for screen reader announcements */}\n <div\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n className=\"rt-sr-only\"\n id=\"alert-dialog-announcement\"\n />\n </div>\n </div>\n </AlertDialogPrimitive.Overlay>\n </Theme>\n </AlertDialogPrimitive.Portal>\n );\n },\n);\nAlertDialogContent.displayName = 'AlertDialog.Content';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof Heading>;\ntype AlertDialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props, forwardedRef) => (\n <AlertDialogPrimitive.Title asChild>\n <Heading size=\"5\" mb=\"3\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </AlertDialogPrimitive.Title>\n ),\n);\nAlertDialogTitle.displayName = 'AlertDialog.Title';\n\ntype AlertDialogDescriptionElement = HTMLParagraphElement;\ntype AlertDialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props, forwardedRef) => (\n <AlertDialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </AlertDialogPrimitive.Description>\n));\nAlertDialogDescription.displayName = 'AlertDialog.Description';\n\ntype AlertDialogActionElement = React.ElementRef<typeof AlertDialogPrimitive.Action>;\ninterface AlertDialogActionProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Action, RemovedProps> {}\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Action {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Action>\n ),\n);\nAlertDialogAction.displayName = 'AlertDialog.Action';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof AlertDialogPrimitive.Cancel>;\ninterface AlertDialogCancelProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Cancel, RemovedProps> {}\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Cancel {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Cancel>\n ),\n);\nAlertDialogCancel.displayName = 'AlertDialog.Cancel';\n\nexport {\n AlertDialogRoot as Root,\n AlertDialogTrigger as Trigger,\n AlertDialogContent as Content,\n AlertDialogTitle as Title,\n AlertDialogDescription as Description,\n AlertDialogAction as Action,\n AlertDialogCancel as Cancel,\n};\n\nexport type {\n AlertDialogRootProps as RootProps,\n AlertDialogTriggerProps as TriggerProps,\n AlertDialogContentProps as ContentProps,\n AlertDialogTitleProps as TitleProps,\n AlertDialogDescriptionProps as DescriptionProps,\n AlertDialogActionProps as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vB,SAAU,GACV,KAAK,cACL,aAAW,OACX,mBAAiB,2BACnB,EAEAvB,EAAA,cAAC,OACC,YAAU,YACV,cAAY,OACZ,UAAU,aACV,GAAG,4BACL,CACF,CACF,CACF,CACF,CACF,CAEJ,CACF,EACAc,EAAmB,YAAc,sBAIjC,MAAMwB,EAAmBtC,EAAM,WAC7B,CAACU,EAAOG,IACNb,EAAA,cAACE,EAAqB,MAArB,CAA2B,QAAO,IACjCF,EAAA,cAACI,EAAA,CAAQ,KAAK,IAAI,GAAG,IAAI,KAAK,QAAS,GAAGM,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtF,CAEJ,EACAyB,EAAiB,YAAc,oBAI/B,MAAMC,EAAyBvC,EAAM,WAGnC,CAACU,EAAOG,IACRb,EAAA,cAACE,EAAqB,YAArB,CAAiC,QAAO,IACvCF,EAAA,cAACK,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAGK,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtE,CACD,EACD0B,EAAuB,YAAc,0BAKrC,MAAMC,EAAoBxC,EAAM,WAC9B,CAAC,CAAE,SAAAY,EAAU,GAAGF,CAAM,EAAGG,IACvBb,EAAA,cAACE,EAAqB,OAArB,CAA6B,GAAGQ,EAAO,IAAKG,EAAc,QAAO,IAC/DL,EAAoBI,CAAQ,CAC/B,CAEJ,EACA4B,EAAkB,YAAc,qBAKhC,MAAMC,EAAoBzC,EAAM,WAC9B,CAAC,CAAE,SAAAY,EAAU,GAAGF,CAAM,EAAGG,IACvBb,EAAA,cAACE,EAAqB,OAArB,CAA6B,GAAGQ,EAAO,IAAKG,EAAc,QAAO,IAC/DL,EAAoBI,CAAQ,CAC/B,CAEJ,EACA6B,EAAkB,YAAc",
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { AlertDialog as AlertDialogPrimitive } from 'radix-ui';\n\nimport { alertDialogContentPropDefs } from './alert-dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\n\nimport type { AlertDialogContentOwnProps } from './alert-dialog.props.js';\nimport type {\n ComponentPropsWithout,\n RemovedProps,\n ComponentPropsAs,\n} from '../helpers/component-props.js';\n\ninterface AlertDialogRootProps\n extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root> {}\nconst AlertDialogRoot: React.FC<AlertDialogRootProps> = (props) => (\n <AlertDialogPrimitive.Root {...props} />\n);\nAlertDialogRoot.displayName = 'AlertDialog.Root';\n\ntype AlertDialogTriggerElement = React.ElementRef<typeof AlertDialogPrimitive.Trigger>;\ninterface AlertDialogTriggerProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Trigger, RemovedProps> {}\nconst AlertDialogTrigger = React.forwardRef<AlertDialogTriggerElement, AlertDialogTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Trigger>\n ),\n);\nAlertDialogTrigger.displayName = 'AlertDialog.Trigger';\n\ntype AlertDialogContentElement = React.ElementRef<typeof AlertDialogPrimitive.Content>;\ninterface AlertDialogContentProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Content, RemovedProps>,\n AlertDialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Portal>['container'];\n}\nconst AlertDialogContent = React.forwardRef<AlertDialogContentElement, AlertDialogContentProps>(\n ({ align, ...props }, forwardedRef) => {\n const {\n align: alignPropDef,\n panelBackground: panelBackgroundPropDef,\n material: materialPropDef,\n ...propDefs\n } = alertDialogContentPropDefs;\n\n const { className: alignClassName } = extractProps({ align }, { align: alignPropDef });\n\n // Extract panelBackground and material from props\n const { panelBackground: extractedPanelBackground } = extractProps(\n { panelBackground: props.panelBackground },\n { panelBackground: panelBackgroundPropDef },\n );\n\n const { material: extractedMaterial } = extractProps(\n { material: props.material },\n { material: materialPropDef },\n );\n\n // Handle material prop with panelBackground fallback\n const materialValue = React.useMemo(() => {\n if (extractedMaterial !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n return extractedMaterial ?? extractedPanelBackground;\n }, [extractedMaterial, extractedPanelBackground]);\n\n const {\n className,\n forceMount,\n container,\n panelBackground: _,\n material: __,\n ...contentProps\n } = extractProps(props, propDefs);\n\n // Focus management\n const contentRef = React.useRef<HTMLDivElement>(null);\n const combinedRef = React.useMemo(\n () => (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n // Focus trap effect\n React.useEffect(() => {\n // SSR safety - only run on client\n if (typeof window === 'undefined') return;\n\n const content = contentRef.current;\n if (!content) return;\n\n const focusableElements = content.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0] as HTMLElement;\n const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n }\n } else {\n if (document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n };\n\n content.addEventListener('keydown', handleKeyDown);\n\n // Focus first element when dialog opens\n firstElement.focus();\n\n return () => {\n content.removeEventListener('keydown', handleKeyDown);\n };\n }, []);\n\n return (\n <AlertDialogPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <AlertDialogPrimitive.Overlay className=\"rt-BaseDialogOverlay rt-AlertDialogOverlay\">\n <div className=\"rt-BaseDialogScroll rt-AlertDialogScroll\">\n <div\n className={`rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ${alignClassName}`}\n >\n <AlertDialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('rt-BaseDialogContent', 'rt-AlertDialogContent', className)}\n data-material={materialValue}\n data-panel-background={materialValue}\n tabIndex={-1}\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-describedby=\"alert-dialog-description\"\n onCloseAutoFocus={(event) => {\n // Prevent default focus behavior\n event.preventDefault();\n // Restore pointer-events to body (Radix UI fix for issue #1241)\n document.body.style.pointerEvents = '';\n }}\n />\n {/* ARIA live region for screen reader announcements */}\n <div\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n className=\"rt-sr-only\"\n id=\"alert-dialog-announcement\"\n />\n </div>\n </div>\n </AlertDialogPrimitive.Overlay>\n </Theme>\n </AlertDialogPrimitive.Portal>\n );\n },\n);\nAlertDialogContent.displayName = 'AlertDialog.Content';\n\ntype AlertDialogTitleElement = React.ElementRef<typeof Heading>;\ntype AlertDialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst AlertDialogTitle = React.forwardRef<AlertDialogTitleElement, AlertDialogTitleProps>(\n (props, forwardedRef) => (\n <AlertDialogPrimitive.Title asChild>\n <Heading size=\"5\" mb=\"3\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </AlertDialogPrimitive.Title>\n ),\n);\nAlertDialogTitle.displayName = 'AlertDialog.Title';\n\ntype AlertDialogDescriptionElement = HTMLParagraphElement;\ntype AlertDialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst AlertDialogDescription = React.forwardRef<\n AlertDialogDescriptionElement,\n AlertDialogDescriptionProps\n>((props, forwardedRef) => (\n <AlertDialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </AlertDialogPrimitive.Description>\n));\nAlertDialogDescription.displayName = 'AlertDialog.Description';\n\ntype AlertDialogActionElement = React.ElementRef<typeof AlertDialogPrimitive.Action>;\ninterface AlertDialogActionProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Action, RemovedProps> {}\nconst AlertDialogAction = React.forwardRef<AlertDialogActionElement, AlertDialogActionProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Action {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Action>\n ),\n);\nAlertDialogAction.displayName = 'AlertDialog.Action';\n\ntype AlertDialogCancelElement = React.ElementRef<typeof AlertDialogPrimitive.Cancel>;\ninterface AlertDialogCancelProps\n extends ComponentPropsWithout<typeof AlertDialogPrimitive.Cancel, RemovedProps> {}\nconst AlertDialogCancel = React.forwardRef<AlertDialogCancelElement, AlertDialogCancelProps>(\n ({ children, ...props }, forwardedRef) => (\n <AlertDialogPrimitive.Cancel {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </AlertDialogPrimitive.Cancel>\n ),\n);\nAlertDialogCancel.displayName = 'AlertDialog.Cancel';\n\nexport {\n AlertDialogRoot as Root,\n AlertDialogTrigger as Trigger,\n AlertDialogContent as Content,\n AlertDialogTitle as Title,\n AlertDialogDescription as Description,\n AlertDialogAction as Action,\n AlertDialogCancel as Cancel,\n};\n\nexport type {\n AlertDialogRootProps as RootProps,\n AlertDialogTriggerProps as TriggerProps,\n AlertDialogContentProps as ContentProps,\n AlertDialogTitleProps as TitleProps,\n AlertDialogDescriptionProps as DescriptionProps,\n AlertDialogActionProps as ActionProps,\n AlertDialogCancelProps as CancelProps,\n};\n"],
5
+ "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,eAAeC,MAA4B,WAEpD,OAAS,8BAAAC,MAAkC,0BAC3C,OAAS,WAAAC,MAAe,eACxB,OAAS,QAAAC,MAAY,YACrB,OAAS,SAAAC,MAAa,aACtB,OAAS,gBAAAC,MAAoB,8BAC7B,OAAS,uBAAAC,MAA2B,sCAWpC,MAAMC,EAAmDC,GACvDV,EAAA,cAACE,EAAqB,KAArB,CAA2B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,QAAO,IACjCF,EAAA,cAACI,EAAA,CAAQ,KAAK,IAAI,GAAG,IAAI,KAAK,QAAS,GAAGM,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtF,CAEJ,EACAyB,EAAiB,YAAc,oBAI/B,MAAMC,EAAyBvC,EAAM,WAGnC,CAACU,EAAOG,IACRb,EAAA,cAACE,EAAqB,YAArB,CAAiC,QAAO,IACvCF,EAAA,cAACK,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAGK,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtE,CACD,EACD0B,EAAuB,YAAc,0BAKrC,MAAMC,EAAoBxC,EAAM,WAC9B,CAAC,CAAE,SAAAY,EAAU,GAAGF,CAAM,EAAGG,IACvBb,EAAA,cAACE,EAAqB,OAArB,CAA6B,GAAGQ,EAAO,IAAKG,EAAc,QAAO,IAC/DL,EAAoBI,CAAQ,CAC/B,CAEJ,EACA4B,EAAkB,YAAc,qBAKhC,MAAMC,EAAoBzC,EAAM,WAC9B,CAAC,CAAE,SAAAY,EAAU,GAAGF,CAAM,EAAGG,IACvBb,EAAA,cAACE,EAAqB,OAArB,CAA6B,GAAGQ,EAAO,IAAKG,EAAc,QAAO,IAC/DL,EAAoBI,CAAQ,CAC/B,CAEJ,EACA6B,EAAkB,YAAc",
6
6
  "names": ["React", "classNames", "AlertDialogPrimitive", "alertDialogContentPropDefs", "Heading", "Text", "Theme", "extractProps", "requireReactElement", "AlertDialogRoot", "props", "AlertDialogTrigger", "children", "forwardedRef", "AlertDialogContent", "align", "alignPropDef", "panelBackgroundPropDef", "materialPropDef", "propDefs", "alignClassName", "extractedPanelBackground", "extractedMaterial", "materialValue", "className", "forceMount", "container", "__", "contentProps", "contentRef", "combinedRef", "node", "content", "focusableElements", "firstElement", "lastElement", "handleKeyDown", "event", "AlertDialogTitle", "AlertDialogDescription", "AlertDialogAction", "AlertDialogCancel"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","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,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;CACxF;AACD,QAAA,MAAM,aAAa,2FA2IlB,CAAC;AAIF,KAAK,gBAAgB,GAAG,qBAAqB,CAAC,OAAO,OAAO,EAAE,SAAS,CAAC,CAAC;AACzE,QAAA,MAAM,WAAW,6FAMhB,CAAC;AAIF,KAAK,sBAAsB,GAAG,gBAAgB,CAAC,OAAO,IAAI,EAAE,GAAG,CAAC,CAAC;AACjE,QAAA,MAAM,iBAAiB,qGAMtB,CAAC;AAIF,UAAU,gBACR,SAAQ,qBAAqB,CAAC,OAAO,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC;CAAG;AAC9E,QAAA,MAAM,WAAW,4FAMhB,CAAC;AAGF,OAAO,EACL,UAAU,IAAI,IAAI,EAClB,aAAa,IAAI,OAAO,EACxB,aAAa,IAAI,OAAO,EACxB,WAAW,IAAI,KAAK,EACpB,iBAAiB,IAAI,WAAW,EAChC,WAAW,IAAI,KAAK,GACrB,CAAC;AAEF,YAAY,EACV,eAAe,IAAI,SAAS,EAC5B,kBAAkB,IAAI,YAAY,EAClC,kBAAkB,IAAI,YAAY,EAClC,gBAAgB,IAAI,UAAU,EAC9B,sBAAsB,IAAI,gBAAgB,EAC1C,gBAAgB,IAAI,UAAU,GAC/B,CAAC"}
@@ -1,2 +1,2 @@
1
- import*as e from"react";import W from"classnames";import{Dialog as r}from"radix-ui";import{dialogContentPropDefs as L}from"./dialog.props.js";import{Heading as O}from"./heading.js";import{Text as S}from"./text.js";import{Theme as A}from"./theme.js";import{extractProps as s}from"../helpers/extract-props.js";import{requireReactElement as P}from"../helpers/require-react-element.js";import{useBodyPointerEventsCleanup as K}from"../hooks/use-body-pointer-events-cleanup.js";const u=o=>e.createElement(r.Root,{...o,modal:!0});u.displayName="Dialog.Root";const C=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Trigger,{...t,ref:i,asChild:!0},P(o)));C.displayName="Dialog.Trigger";const y=e.forwardRef(({align:o,...t},i)=>{const{align:h,panelBackground:R,material:x,...N}=L,{className:B}=s({align:o},{align:h}),{panelBackground:m}=s({panelBackground:t.panelBackground},{panelBackground:R}),{material:p}=s({material:t.material},{material:x}),D=e.useMemo(()=>(p!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead."),p??m),[p,m]),{className:k,forceMount:b,container:w,panelBackground:_,material:j,...M}=s(t,N),c=e.useRef(null),H=e.useMemo(()=>a=>{c.current=a,typeof i=="function"?i(a):i&&(i.current=a)},[i]);return K(),e.useEffect(()=>{if(typeof window>"u")return;const a=c.current;if(!a)return;const n=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(n.length===0)return;const g=n[0],f=n[n.length-1],d=l=>{l.key==="Tab"&&(l.shiftKey?document.activeElement===g&&(l.preventDefault(),f.focus()):document.activeElement===f&&(l.preventDefault(),g.focus()))};return a.addEventListener("keydown",d),g.focus(),()=>{a.removeEventListener("keydown",d)}},[]),e.createElement(r.Portal,{container:w,forceMount:b},e.createElement(A,{asChild:!0},e.createElement(r.Overlay,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},e.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},e.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${B}`},e.createElement(r.Content,{...M,ref:H,className:W("rt-BaseDialogContent","rt-DialogContent",k),"data-material":D,"data-panel-background":D,tabIndex:-1,role:"dialog","aria-modal":"true"}),e.createElement("div",{"aria-live":"polite","aria-atomic":"true",className:"rt-sr-only",id:"dialog-announcement"}))))))});y.displayName="Dialog.Content";const v=e.forwardRef((o,t)=>e.createElement(r.Title,{asChild:!0},e.createElement(O,{size:"5",mb:"3",trim:"start",...o,asChild:!1,ref:t})));v.displayName="Dialog.Title";const T=e.forwardRef((o,t)=>e.createElement(r.Description,{asChild:!0},e.createElement(S,{as:"p",size:"3",...o,asChild:!1,ref:t})));T.displayName="Dialog.Description";const E=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Close,{...t,ref:i,asChild:!0},P(o)));E.displayName="Dialog.Close";export{E as Close,y as Content,T as Description,u as Root,v as Title,C as Trigger};
1
+ import*as e from"react";import W from"classnames";import{Dialog as a}from"radix-ui";import{dialogContentPropDefs as L}from"./dialog.props.js";import{Heading as O}from"./heading.js";import{Text as S}from"./text.js";import{Theme as A}from"./theme.js";import{extractProps as s}from"../helpers/extract-props.js";import{requireReactElement as P}from"../helpers/require-react-element.js";import{useBodyPointerEventsCleanup as K}from"../hooks/use-body-pointer-events-cleanup.js";const u=o=>e.createElement(a.Root,{...o,modal:!0});u.displayName="Dialog.Root";const C=e.forwardRef(({children:o,...t},r)=>e.createElement(a.Trigger,{...t,ref:r,asChild:!0},P(o)));C.displayName="Dialog.Trigger";const y=e.forwardRef(({align:o,...t},r)=>{const{align:h,panelBackground:R,material:x,...N}=L,{className:B}=s({align:o},{align:h}),{panelBackground:g}=s({panelBackground:t.panelBackground},{panelBackground:R}),{material:p}=s({material:t.material},{material:x}),D=e.useMemo(()=>(p!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead."),p??g),[p,g]),{className:k,forceMount:b,container:w,panelBackground:_,material:j,...M}=s(t,N),c=e.useRef(null),H=e.useMemo(()=>i=>{c.current=i,typeof r=="function"?r(i):r&&(r.current=i)},[r]);return K(),e.useEffect(()=>{if(typeof window>"u")return;const i=c.current;if(!i)return;const n=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(n.length===0)return;const m=n[0],f=n[n.length-1],d=l=>{l.key==="Tab"&&(l.shiftKey?document.activeElement===m&&(l.preventDefault(),f.focus()):document.activeElement===f&&(l.preventDefault(),m.focus()))};return i.addEventListener("keydown",d),m.focus(),()=>{i.removeEventListener("keydown",d)}},[]),e.createElement(a.Portal,{container:w,forceMount:b},e.createElement(A,{asChild:!0},e.createElement(a.Overlay,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},e.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},e.createElement("div",{className:`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${B}`},e.createElement(a.Content,{...M,ref:H,className:W("rt-BaseDialogContent","rt-DialogContent",k),"data-material":D,"data-panel-background":D,tabIndex:-1,role:"dialog","aria-modal":"true",onCloseAutoFocus:i=>{i.preventDefault(),document.body.style.pointerEvents=""}}),e.createElement("div",{"aria-live":"polite","aria-atomic":"true",className:"rt-sr-only",id:"dialog-announcement"}))))))});y.displayName="Dialog.Content";const v=e.forwardRef((o,t)=>e.createElement(a.Title,{asChild:!0},e.createElement(O,{size:"5",mb:"3",trim:"start",...o,asChild:!1,ref:t})));v.displayName="Dialog.Title";const T=e.forwardRef((o,t)=>e.createElement(a.Description,{asChild:!0},e.createElement(S,{as:"p",size:"3",...o,asChild:!1,ref:t})));T.displayName="Dialog.Description";const E=e.forwardRef(({children:o,...t},r)=>e.createElement(a.Close,{...t,ref:r,asChild:!0},P(o)));E.displayName="Dialog.Close";export{E as Close,y as Content,T as Description,u as Root,v as Title,C as Trigger};
2
2
  //# sourceMappingURL=dialog.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/dialog.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport type {\n ComponentPropsWithout,\n RemovedProps,\n ComponentPropsAs,\n} from '../helpers/component-props.js';\n\ninterface DialogRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst DialogRoot: React.FC<DialogRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nDialogRoot.displayName = 'Dialog.Root';\n\ntype DialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ninterface DialogTriggerProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n ),\n);\nDialogTrigger.displayName = 'Dialog.Trigger';\n\ntype DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface DialogContentProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>,\n DialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n ({ align, ...props }, forwardedRef) => {\n const {\n align: alignPropDef,\n panelBackground: panelBackgroundPropDef,\n material: materialPropDef,\n ...propDefs\n } = dialogContentPropDefs;\n\n const { className: alignClassName } = extractProps({ align }, { align: alignPropDef });\n\n // Extract panelBackground and material from props\n const { panelBackground: extractedPanelBackground } = extractProps(\n { panelBackground: props.panelBackground },\n { panelBackground: panelBackgroundPropDef },\n );\n\n const { material: extractedMaterial } = extractProps(\n { material: props.material },\n { material: materialPropDef },\n );\n\n // Handle material prop with panelBackground fallback\n const materialValue = React.useMemo(() => {\n if (extractedMaterial !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n return extractedMaterial ?? extractedPanelBackground;\n }, [extractedMaterial, extractedPanelBackground]);\n\n const {\n className,\n forceMount,\n container,\n panelBackground: _,\n material: __,\n ...contentProps\n } = extractProps(props, propDefs);\n\n // Focus management\n const contentRef = React.useRef<HTMLDivElement>(null);\n const combinedRef = React.useMemo(\n () => (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n // Cleanup stuck pointer-events on body\n useBodyPointerEventsCleanup();\n\n // Focus trap effect\n React.useEffect(() => {\n // SSR safety - only run on client\n if (typeof window === 'undefined') return;\n\n const content = contentRef.current;\n if (!content) return;\n\n const focusableElements = content.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0] as HTMLElement;\n const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n }\n } else {\n if (document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n };\n\n content.addEventListener('keydown', handleKeyDown);\n\n // Focus first element when dialog opens\n firstElement.focus();\n\n return () => {\n content.removeEventListener('keydown', handleKeyDown);\n };\n }, []);\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DialogPrimitive.Overlay className=\"rt-BaseDialogOverlay rt-DialogOverlay\">\n <div className=\"rt-BaseDialogScroll rt-DialogScroll\">\n <div\n className={`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${alignClassName}`}\n >\n <DialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('rt-BaseDialogContent', 'rt-DialogContent', className)}\n data-material={materialValue}\n data-panel-background={materialValue}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n />\n {/* ARIA live region for screen reader announcements */}\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"rt-sr-only\"\n id=\"dialog-announcement\"\n />\n </div>\n </div>\n </DialogPrimitive.Overlay>\n </Theme>\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = 'Dialog.Content';\n\ntype DialogTitleElement = React.ElementRef<typeof Heading>;\ntype DialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props, forwardedRef) => (\n <DialogPrimitive.Title asChild>\n <Heading size=\"5\" mb=\"3\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Title>\n ),\n);\nDialogTitle.displayName = 'Dialog.Title';\n\ntype DialogDescriptionElement = HTMLParagraphElement;\ntype DialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props, forwardedRef) => (\n <DialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Description>\n ),\n);\nDialogDescription.displayName = 'Dialog.Description';\n\ntype DialogCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface DialogCloseProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n ({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n ),\n);\nDialogClose.displayName = 'Dialog.Close';\n\nexport {\n DialogRoot as Root,\n DialogTrigger as Trigger,\n DialogContent as Content,\n DialogTitle as Title,\n DialogDescription as Description,\n DialogClose as Close,\n};\n\nexport type {\n DialogRootProps as RootProps,\n DialogTriggerProps as TriggerProps,\n DialogContentProps as ContentProps,\n DialogTitleProps as TitleProps,\n DialogDescriptionProps as DescriptionProps,\n DialogCloseProps as CloseProps,\n};\n"],
5
- "mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,a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b,EAEAxB,EAAA,cAAC,OACC,YAAU,SACV,cAAY,OACZ,UAAU,aACV,GAAG,sBACL,CACF,CACF,CACF,CACF,CACF,CAEJ,CACF,EACAe,EAAc,YAAc,iBAI5B,MAAMwB,EAAcvC,EAAM,WACxB,CAACW,EAAOG,IACNd,EAAA,cAACE,EAAgB,MAAhB,CAAsB,QAAO,IAC5BF,EAAA,cAACI,EAAA,CAAQ,KAAK,IAAI,GAAG,IAAI,KAAK,QAAS,GAAGO,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtF,CAEJ,EACAyB,EAAY,YAAc,eAI1B,MAAMC,EAAoBxC,EAAM,WAC9B,CAACW,EAAOG,IACNd,EAAA,cAACE,EAAgB,YAAhB,CAA4B,QAAO,IAClCF,EAAA,cAACK,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAGM,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtE,CAEJ,EACA0B,EAAkB,YAAc,qBAKhC,MAAMC,EAAczC,EAAM,WACxB,CAAC,CAAE,SAAAa,EAAU,GAAGF,CAAM,EAAGG,IACvBd,EAAA,cAACE,EAAgB,MAAhB,CAAuB,GAAGS,EAAO,IAAKG,EAAc,QAAO,IACzDN,EAAoBK,CAAQ,CAC/B,CAEJ,EACA4B,EAAY,YAAc",
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport type {\n ComponentPropsWithout,\n RemovedProps,\n ComponentPropsAs,\n} from '../helpers/component-props.js';\n\ninterface DialogRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst DialogRoot: React.FC<DialogRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nDialogRoot.displayName = 'Dialog.Root';\n\ntype DialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ninterface DialogTriggerProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n ),\n);\nDialogTrigger.displayName = 'Dialog.Trigger';\n\ntype DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface DialogContentProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>,\n DialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(\n ({ align, ...props }, forwardedRef) => {\n const {\n align: alignPropDef,\n panelBackground: panelBackgroundPropDef,\n material: materialPropDef,\n ...propDefs\n } = dialogContentPropDefs;\n\n const { className: alignClassName } = extractProps({ align }, { align: alignPropDef });\n\n // Extract panelBackground and material from props\n const { panelBackground: extractedPanelBackground } = extractProps(\n { panelBackground: props.panelBackground },\n { panelBackground: panelBackgroundPropDef },\n );\n\n const { material: extractedMaterial } = extractProps(\n { material: props.material },\n { material: materialPropDef },\n );\n\n // Handle material prop with panelBackground fallback\n const materialValue = React.useMemo(() => {\n if (extractedMaterial !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n return extractedMaterial ?? extractedPanelBackground;\n }, [extractedMaterial, extractedPanelBackground]);\n\n const {\n className,\n forceMount,\n container,\n panelBackground: _,\n material: __,\n ...contentProps\n } = extractProps(props, propDefs);\n\n // Focus management\n const contentRef = React.useRef<HTMLDivElement>(null);\n const combinedRef = React.useMemo(\n () => (node: HTMLDivElement | null) => {\n contentRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n },\n [forwardedRef],\n );\n\n // Cleanup stuck pointer-events on body\n useBodyPointerEventsCleanup();\n\n // Focus trap effect\n React.useEffect(() => {\n // SSR safety - only run on client\n if (typeof window === 'undefined') return;\n\n const content = contentRef.current;\n if (!content) return;\n\n const focusableElements = content.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0] as HTMLElement;\n const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n event.preventDefault();\n lastElement.focus();\n }\n } else {\n if (document.activeElement === lastElement) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n };\n\n content.addEventListener('keydown', handleKeyDown);\n\n // Focus first element when dialog opens\n firstElement.focus();\n\n return () => {\n content.removeEventListener('keydown', handleKeyDown);\n };\n }, []);\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DialogPrimitive.Overlay className=\"rt-BaseDialogOverlay rt-DialogOverlay\">\n <div className=\"rt-BaseDialogScroll rt-DialogScroll\">\n <div\n className={`rt-BaseDialogScrollPadding rt-DialogScrollPadding ${alignClassName}`}\n >\n <DialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('rt-BaseDialogContent', 'rt-DialogContent', className)}\n data-material={materialValue}\n data-panel-background={materialValue}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n onCloseAutoFocus={(event) => {\n // Prevent default focus behavior\n event.preventDefault();\n // Restore pointer-events to body (Radix UI fix for issue #1241)\n document.body.style.pointerEvents = '';\n }}\n />\n {/* ARIA live region for screen reader announcements */}\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"rt-sr-only\"\n id=\"dialog-announcement\"\n />\n </div>\n </div>\n </DialogPrimitive.Overlay>\n </Theme>\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = 'Dialog.Content';\n\ntype DialogTitleElement = React.ElementRef<typeof Heading>;\ntype DialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(\n (props, forwardedRef) => (\n <DialogPrimitive.Title asChild>\n <Heading size=\"5\" mb=\"3\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Title>\n ),\n);\nDialogTitle.displayName = 'Dialog.Title';\n\ntype DialogDescriptionElement = HTMLParagraphElement;\ntype DialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(\n (props, forwardedRef) => (\n <DialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Description>\n ),\n);\nDialogDescription.displayName = 'Dialog.Description';\n\ntype DialogCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface DialogCloseProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(\n ({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n ),\n);\nDialogClose.displayName = 'Dialog.Close';\n\nexport {\n DialogRoot as Root,\n DialogTrigger as Trigger,\n DialogContent as Content,\n DialogTitle as Title,\n DialogDescription as Description,\n DialogClose as Close,\n};\n\nexport type {\n DialogRootProps as RootProps,\n DialogTriggerProps as TriggerProps,\n DialogContentProps as ContentProps,\n DialogTitleProps as TitleProps,\n DialogDescriptionProps as D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uBAAwB,mBAAoBwB,CAAS,EAC3E,gBAAeD,EACf,wBAAuBA,EACvB,SAAU,GACV,KAAK,SACL,aAAW,OACX,iBAAmBc,GAAU,CAE3BA,EAAM,eAAe,EAErB,SAAS,KAAK,MAAM,cAAgB,EACtC,EACF,EAEAtC,EAAA,cAAC,OACC,YAAU,SACV,cAAY,OACZ,UAAU,aACV,GAAG,sBACL,CACF,CACF,CACF,CACF,CACF,CAEJ,CACF,EACAe,EAAc,YAAc,iBAI5B,MAAMwB,EAAcvC,EAAM,WACxB,CAACW,EAAOG,IACNd,EAAA,cAACE,EAAgB,MAAhB,CAAsB,QAAO,IAC5BF,EAAA,cAACI,EAAA,CAAQ,KAAK,IAAI,GAAG,IAAI,KAAK,QAAS,GAAGO,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtF,CAEJ,EACAyB,EAAY,YAAc,eAI1B,MAAMC,EAAoBxC,EAAM,WAC9B,CAACW,EAAOG,IACNd,EAAA,cAACE,EAAgB,YAAhB,CAA4B,QAAO,IAClCF,EAAA,cAACK,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAGM,EAAO,QAAS,GAAO,IAAKG,EAAc,CACtE,CAEJ,EACA0B,EAAkB,YAAc,qBAKhC,MAAMC,EAAczC,EAAM,WACxB,CAAC,CAAE,SAAAa,EAAU,GAAGF,CAAM,EAAGG,IACvBd,EAAA,cAACE,EAAgB,MAAhB,CAAuB,GAAGS,EAAO,IAAKG,EAAc,QAAO,IACzDN,EAAoBK,CAAQ,CAC/B,CAEJ,EACA4B,EAAY,YAAc",
6
6
  "names": ["React", "classNames", "DialogPrimitive", "dialogContentPropDefs", "Heading", "Text", "Theme", "extractProps", "requireReactElement", "useBodyPointerEventsCleanup", "DialogRoot", "props", "DialogTrigger", "children", "forwardedRef", "DialogContent", "align", "alignPropDef", "panelBackgroundPropDef", "materialPropDef", "propDefs", "alignClassName", "extractedPanelBackground", "extractedMaterial", "materialValue", "className", "forceMount", "container", "__", "contentProps", "contentRef", "combinedRef", "node", "content", "focusableElements", "firstElement", "lastElement", "handleKeyDown", "event", "DialogTitle", "DialogDescription", "DialogClose"]
7
7
  }
@@ -110,7 +110,7 @@ type SidebarComponent = React.ForwardRefExoticComponent<(Omit<PaneProps, 'mode'
110
110
  defaultMode?: ResponsiveSidebarMode;
111
111
  onModeChange?: (mode: SidebarMode) => void;
112
112
  thinSize?: number;
113
- toggleModes?: Array<'thin' | 'expanded'>;
113
+ toggleModes?: 'both' | 'single';
114
114
  }) & React.RefAttributes<HTMLDivElement>> & {
115
115
  Handle: HandleComponent;
116
116
  };
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,KAAK,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACzD,KAAK,sBAAsB,GACvB,iBAAiB,GACjB,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACrF,KAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AACzC,KAAK,WAAW,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AACrD,KAAK,cAAc,GACf,QAAQ,GACR,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAG5E,KAAK,qBAAqB,GACtB,WAAW,GACX,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;AAG/E,KAAK,mBAAmB,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAA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GAAG,WAAW,GAAG,QAAQ,CAAC;AACjF,KAAK,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtD,UAAU,YAAa,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;IACrE,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,OAAO,wFA2FZ,CAAC;AAIF,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,yBAAyB,EACzB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";import*as e from"react";import J from"classnames";import*as G from"./sheet.js";import"./inset.js";import{VisuallyHidden as ce}from"./visually-hidden.js";const se={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},Re=e.createContext(null);function Z(){const s=e.useContext(Re);if(!s)throw new Error("Shell components must be used within <Shell.Root>");return s}const ie=e.createContext(null);function Ee(){const s=e.useContext(ie);if(!s)throw new Error("Shell.Handle must be used within a resizable pane");return s}const _=e.forwardRef(({className:s,children:v,...r},m)=>{const{containerRef:x,cssVarName:c,minSize:E,maxSize:h,defaultSize:P,orientation:y,edge:T,computeNext:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,collapsible:I,target:V,requestCollapse:U,requestToggle:S}=Ee(),p=e.useRef(null);e.useEffect(()=>()=>{try{p.current?.()}catch{}p.current=null},[]);const u=y;return e.createElement("div",{...r,ref:m,className:J("rt-ShellResizer",s),"data-orientation":y,"data-edge":T,role:"slider","aria-orientation":u,"aria-valuemin":E,"aria-valuemax":h,"aria-valuenow":P,tabIndex:0,onPointerDown:t=>{if(!x.current)return;t.preventDefault();const f=x.current,n=t.currentTarget,$=t.pointerId;try{p.current?.()}catch{}f.setAttribute("data-resizing","");try{n.setPointerCapture($)}catch{}const R=y==="vertical"?t.clientX:t.clientY,C=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),M=o=>Math.min(Math.max(o,E),h),B=document.body,d=B.style.cursor,N=B.style.userSelect;B.style.cursor=y==="vertical"?"col-resize":"row-resize",B.style.userSelect="none",g?.(C);const z=o=>{const k=y==="vertical"?o.clientX:o.clientY,D=M(L(k,R,C));f.style.setProperty(c,`${D}px`),n.setAttribute("aria-valuenow",String(D)),a?.(D)},j=()=>{try{n.releasePointerCapture($)}catch{}window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H),window.removeEventListener("keydown",b),n.removeEventListener("lostpointercapture",H),f.removeAttribute("data-resizing"),B.style.cursor=d,B.style.userSelect=N,p.current=null},H=()=>{const o=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`);let k=o;if(F&&F.length){const D=F.reduce((Q,X)=>Math.abs(X-o)<Math.abs(Q-o)?X:Q,F[0]);Math.abs(D-o)<=(q??8)&&(k=D,f.style.setProperty(c,`${k}px`),n.setAttribute("aria-valuenow",String(k)),a?.(k))}I&&typeof K=="number"&&o<=K&&U?.(),w?.(k),j()},b=o=>{o.key==="Escape"&&(f.style.setProperty(c,`${C}px`),n.setAttribute("aria-valuenow",String(C)),w?.(C),j())};window.addEventListener("pointermove",z),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H),window.addEventListener("keydown",b),n.addEventListener("lostpointercapture",H),p.current=j},onDoubleClick:()=>{I&&S?.()},onKeyDown:t=>{if(!x.current)return;const f=x.current,n=parseFloat(getComputedStyle(f).getPropertyValue(c)||`${P}`),$=M=>Math.min(Math.max(M,E),h),R=t.shiftKey?32:8;let C=0;if(y==="vertical"?t.key==="ArrowRight"?C=R:t.key==="ArrowLeft"&&(C=-R):t.key==="ArrowDown"?C=R:t.key==="ArrowUp"&&(C=-R),t.key==="Home"){t.preventDefault(),g?.(n);const M=$(E);f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M);return}if(t.key==="End"){t.preventDefault(),g?.(n);const M=$(h);f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M);return}if(C!==0){t.preventDefault(),g?.(n);const M=$(n+(T==="start"&&y==="vertical"?-C:C));f.style.setProperty(c,`${M}px`),t.currentTarget.setAttribute("aria-valuenow",String(M)),a?.(M),w?.(M)}}},v)});_.displayName="Shell.Handle";const pe=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));pe.displayName="Shell.Panel.Handle";const ue=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));ue.displayName="Shell.Sidebar.Handle";const fe=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));fe.displayName="Shell.Inspector.Handle";const me=e.forwardRef((s,v)=>e.createElement(_,{...s,ref:v}));me.displayName="Shell.Bottom.Handle";function le(s){const{currentBreakpoint:v}=Z();return e.useMemo(()=>{if(typeof s=="string")return s;if(s[v])return s[v];const m=[...Object.keys(se)].reverse().concat("initial"),x=m.indexOf(v);for(let c=x+1;c<m.length;c++){const E=m[c];if(s[E])return s[E]}return"fixed"},[s,v])}function ge(){const[s,v]=e.useState("initial"),[r,m]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const c=Object.entries(se).map(([h,P])=>[h,window.matchMedia(P)]),E=()=>{const h=c.filter(([,y])=>y.matches).map(([y])=>y),P=h[h.length-1]??"initial";v(P),m(!0)};return E(),c.forEach(([,h])=>h.addEventListener("change",E)),()=>{c.forEach(([,h])=>h.removeEventListener("change",E))}},[]),{bp:s,ready:r}}const Se=e.forwardRef(({className:s,children:v,height:r="full",...m},x)=>{const{bp:c,ready:E}=ge(),[h,P]=e.useState("collapsed"),[y,T]=e.useState("collapsed"),[L,a]=e.useState("expanded"),[g,w]=e.useState("collapsed"),[F,q]=e.useState("collapsed"),[K,I]=e.useState(!1),[V,U]=e.useState(!1),S=e.useRef(i=>i==="collapsed"?"thin":i==="thin"?"expanded":"collapsed"),p=e.useCallback(i=>{S.current=i},[]);e.useEffect(()=>{h==="collapsed"&&T("collapsed")},[h]),e.useEffect(()=>{V&&K&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[V,K]);const[u,t]=e.useState(void 0),f=e.useCallback(i=>t(i),[]),n=e.useRef(64),$=e.useRef(288),R=e.useCallback(i=>{n.current=i},[]),C=e.useCallback(i=>{$.current=i},[]),M=e.useMemo(()=>{const i=e.Children.toArray(v),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return i.some(Y=>W(Y,oe)||W(Y,ne))},[v]),B=e.useMemo(()=>{const i=e.Children.toArray(v),W=(Y,re)=>e.isValidElement(Y)&&(Y.type===re||Y.type?.displayName===re.displayName);return i.some(Y=>W(Y,de))},[v]),d=e.useCallback(i=>{switch(i){case"left":case"rail":P(W=>W==="expanded"?"collapsed":"expanded");break;case"panel":h==="collapsed"?(P("expanded"),T("expanded")):T(W=>W==="expanded"?"collapsed":"expanded");break;case"sidebar":a(W=>S.current(W));break;case"inspector":w(W=>W==="expanded"?"collapsed":"expanded");break;case"bottom":q(W=>W==="expanded"?"collapsed":"expanded");break}},[h]),N=e.useCallback(i=>{switch(i){case"left":case"rail":P("expanded");break;case"panel":P("expanded"),T("expanded");break;case"sidebar":a("expanded");break;case"inspector":w("expanded");break;case"bottom":q("expanded");break}},[]),z=e.useCallback(i=>{switch(i){case"left":case"rail":P("collapsed");break;case"panel":T("collapsed");break;case"sidebar":a("collapsed");break;case"inspector":w("collapsed");break;case"bottom":q("collapsed");break}},[]),j=e.useMemo(()=>({leftMode:h,setLeftMode:P,panelMode:y,setPanelMode:T,sidebarMode:L,setSidebarMode:a,inspectorMode:g,setInspectorMode:w,bottomMode:F,setBottomMode:q,hasLeft:K,setHasLeft:I,hasSidebar:V,setHasSidebar:U,currentBreakpoint:c,currentBreakpointReady:E,leftResolvedPresentation:u,togglePane:d,expandPane:N,collapsePane:z,setSidebarToggleComputer:p,onLeftPres:f,onRailDefaults:R,onPanelDefaults:C}),[h,y,L,g,F,K,V,c,E,u,d,N,z,p,f,R,C]),H=e.Children.toArray(v),b=(i,W)=>e.isValidElement(i)&&(i.type===W||i.type?.displayName===W.displayName),o=H.filter(i=>b(i,Me)),k=H.filter(i=>b(i,oe)),D=H.filter(i=>b(i,ne)),Q=H.filter(i=>b(i,de)),X=H.filter(i=>b(i,Pe)),te=H.filter(i=>b(i,ye)),ve=H.filter(i=>b(i,be)),l=e.useMemo(()=>r==="full"?{height:"100vh"}:r==="auto"?{height:"auto"}:typeof r=="string"?{height:r}:typeof r=="number"?{height:`${r}px`}:{},[r]),[O,A]=e.useState(null),ae=e.useCallback(i=>A(i),[]),ee=e.useCallback(()=>A(null),[]);return e.createElement("div",{...m,ref:x,className:J("rt-ShellRoot",s),style:{...l,...m.style}},e.createElement(Re.Provider,{value:{...j,peekTarget:O,setPeekTarget:A,peekPane:ae,clearPeek:ee}},o,e.createElement("div",{className:"rt-ShellBody","data-peek-target":O??void 0,style:O==="rail"||O==="panel"?{"--peek-rail-width":`${n.current}px`}:void 0},M&&!B?(()=>{const i=k[0],W=i?{mode:i.props?.mode,defaultMode:i.props?.defaultMode,onModeChange:i.props?.onModeChange,presentation:i.props?.presentation,collapsible:i.props?.collapsible,onExpand:i.props?.onExpand,onCollapse:i.props?.onCollapse}:{};return e.createElement(he,{...W},k,D)})():Q,X,te),ve))});Se.displayName="Shell.Root";const Me=e.forwardRef(({className:s,height:v=64,style:r,...m},x)=>e.createElement("header",{...m,ref:x,className:J("rt-ShellHeader",s),style:{...r,"--shell-header-height":`${v}px`}}));Me.displayName="Shell.Header";const he=e.forwardRef(({className:s,presentation:v={initial:"overlay",sm:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,collapsible:c=!0,onExpand:E,onCollapse:h,children:P,style:y,...T},L)=>{const a=Z(),g=le(v),w=g==="overlay",F=g==="stacked",q=e.useRef(null);e.useEffect(()=>{a.onLeftPres?.(g)},[a,g]);const K=e.useCallback(S=>{q.current=S,typeof L=="function"?L(S):L&&(L.current=S)},[L]);e.useEffect(()=>(a.setHasLeft(!0),()=>a.setHasLeft(!1)),[a]);const I=e.useCallback(()=>{if(typeof m=="string")return m;const S=m;if(S&&S[a.currentBreakpoint])return S[a.currentBreakpoint];const u=[...Object.keys(se)].reverse().concat("initial"),t=u.indexOf(a.currentBreakpoint);for(let f=t+1;f<u.length;f++){const n=u[f];if(S&&S[n])return S[n]}return"collapsed"},[m,a.currentBreakpoint]),V=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!a.currentBreakpointReady||V.current===a.currentBreakpoint)return;V.current=a.currentBreakpoint;const S=I();S!==a.leftMode&&a.setLeftMode(S)},[r,a.currentBreakpoint,a.currentBreakpointReady,I,a.leftMode,a.setLeftMode]),e.useEffect(()=>{r!==void 0&&a.leftMode!==r&&a.setLeftMode(r)},[r,a]),e.useEffect(()=>{r===void 0&&x?.(a.leftMode)},[a.leftMode,r,x]),e.useEffect(()=>{a.leftMode==="expanded"?E?.():h?.()},[a.leftMode,E,h]);const U=a.leftMode==="expanded";if(w){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(B,d)=>e.isValidElement(B)&&B.type===d,t=p.find(B=>u(B,oe)),f=p.find(B=>u(B,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,C=!!f,M=(R?n:0)+(a.panelMode==="expanded"&&C?$:0);return e.createElement(G.Root,{open:S,onOpenChange:B=>a.setLeftMode(B?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${M}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},P)))}if(F){const S=a.leftMode==="expanded",p=e.Children.toArray(P),u=(d,N)=>e.isValidElement(d)&&d.type===N,t=p.find(d=>u(d,oe)),f=p.find(d=>u(d,ne)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,$=typeof f?.props?.expandedSize=="number"?f.props.expandedSize:288,R=!!t,M=!!f&&(a.panelMode==="expanded"||a.peekTarget==="panel"),B=(R?n:0)+(M?$:0);return e.createElement("div",{...T,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y},"data-open":S||void 0},P)}return e.createElement("div",{...T,ref:K,className:J("rt-ShellLeft",s),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...y}},P)});he.displayName="Shell.Left";const oe=e.forwardRef(({className:s,presentation:v,mode:r,defaultMode:m,onModeChange:x,expandedSize:c=64,collapsible:E,onExpand:h,onCollapse:P,children:y,style:T,...L},a)=>{const g=Z();e.useEffect(()=>{g.onRailDefaults?.(c)},[g,c]);const w=g.leftMode==="expanded";return e.createElement("div",{...L,ref:a,className:J("rt-ShellRail",s),"data-mode":g.leftMode,"data-peek":g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0,style:{...T,"--rail-size":`${c}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":w||g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0},y))});oe.displayName="Shell.Rail";const ne=e.forwardRef(({className:s,mode:v,onModeChange:r,expandedSize:m=288,minSize:x,maxSize:c,resizable:E,collapsible:h=!0,onExpand:P,onCollapse:y,onResize:T,onResizeStart:L,onResizeEnd:a,snapPoints:g,snapTolerance:w,collapseThreshold:F,paneId:q,persistence:K,children:I,style:V,...U},S)=>{const p=Z();e.useEffect(()=>{p.onPanelDefaults?.(m)},[p,m]);const u=e.useRef(null),t=e.useCallback(d=>{u.current=d,typeof S=="function"?S(d):S&&(S.current=d)},[S]),f=e.Children.toArray(I),n=f.filter(d=>e.isValidElement(d)&&d.type===pe),$=f.filter(d=>!(e.isValidElement(d)&&d.type===pe)),R=p.leftResolvedPresentation==="overlay",C=e.useMemo(()=>{if(!q||K)return K;const d=`kookie-ui:shell:panel:${q}`;return{load:()=>{if(typeof window>"u")return;const z=window.localStorage.getItem(d);return z?Number(z):void 0},save:z=>{typeof window>"u"||window.localStorage.setItem(d,String(z))}}},[q,K]);e.useEffect(()=>{let d=!0;return(async()=>{if(!E||!C?.load||R)return;const N=await C.load();d&&typeof N=="number"&&u.current&&(u.current.style.setProperty("--panel-size",`${N}px`),T?.(N))})(),()=>{d=!1}},[E,C,T,R]),e.useEffect(()=>{u.current&&R&&u.current.style.setProperty("--panel-size",`${m}px`)},[R,m]),e.useEffect(()=>{if(u.current&&p.leftResolvedPresentation!=="overlay"&&p.leftMode==="expanded"&&p.panelMode==="expanded"){const d=u.current.parentElement||null;try{d?.style.removeProperty("width")}catch{}}},[p.leftResolvedPresentation,p.leftMode,p.panelMode]);const M=p.leftMode==="expanded"&&p.panelMode==="expanded",B=E&&p.leftResolvedPresentation!=="overlay"&&M?e.createElement(ie.Provider,{value:{containerRef:u,cssVarName:"--panel-size",minSize:typeof x=="number"?x:100,maxSize:typeof c=="number"?c:800,defaultSize:m,orientation:"vertical",edge:"end",computeNext:(d,N,z)=>{const j=getComputedStyle(u.current).direction==="rtl",H=d-N;return z+(j?-H:H)},onResize:T,onResizeStart:d=>{const z=u.current?.parentElement;try{z?.style.removeProperty("width")}catch{}L?.(d)},onResizeEnd:d=>{a?.(d),C?.save?.(d)},target:"panel",collapsible:!!h,snapPoints:g,snapTolerance:w??8,collapseThreshold:F,requestCollapse:()=>p.setPanelMode("collapsed"),requestToggle:()=>p.togglePane("panel")}},n.length>0?n.map((d,N)=>e.cloneElement(d,{key:d.key??N})):e.createElement(_,null)):null;return e.createElement("div",{...U,ref:t,className:J("rt-ShellPanel",s),"data-mode":p.panelMode,"data-visible":M||p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,"data-peek":p.leftResolvedPresentation!=="overlay"&&p.peekTarget==="panel"||void 0,style:{...V,"--panel-size":`${m}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":M||void 0},$),B)});ne.displayName="Shell.Panel",ne.Handle=pe;const de=e.forwardRef(({className:s,presentation:v={initial:"overlay",md:"fixed"},mode:r,defaultMode:m="expanded",onModeChange:x,expandedSize:c=288,minSize:E=200,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,thinSize:p=64,toggleModes:u,...t},f)=>{const n=Z(),$=le(v),R=$==="overlay",C=$==="stacked",M=e.useRef(null),B=e.useCallback(l=>{M.current=l,typeof f=="function"?f(l):f&&(f.current=l)},[f]),d=e.Children.toArray(U),N=d.filter(l=>e.isValidElement(l)&&l.type===ue),z=d.filter(l=>!(e.isValidElement(l)&&l.type===ue)),j=e.useId();e.useEffect(()=>(n.setHasSidebar(!0),()=>{n.setHasSidebar(!1)}),[n,j]);const H=e.useRef(!1);e.useEffect(()=>{H.current||(H.current=!0,r===void 0&&n.sidebarMode!==m&&n.setSidebarMode(m))},[]),e.useEffect(()=>{r!==void 0&&n.sidebarMode!==r&&n.setSidebarMode(r)},[r,n]),e.useEffect(()=>{r===void 0&&x?.(n.sidebarMode)},[n.sidebarMode,r,x]),e.useEffect(()=>{n.sidebarMode==="expanded"?T?.():L?.()},[n.sidebarMode,T,L]);const b=n.sidebarMode!=="collapsed",o=e.useMemo(()=>{if(!I||V)return V;const l=`kookie-ui:shell:sidebar:${I}`;return{load:()=>{if(typeof window>"u")return;const A=window.localStorage.getItem(l);return A?Number(A):void 0},save:A=>{typeof window>"u"||window.localStorage.setItem(l,String(A))}}},[I,V]);e.useEffect(()=>{let l=!0;return(async()=>{if(!P||!o?.load||R)return;const O=await o.load();l&&typeof O=="number"&&M.current&&(M.current.style.setProperty("--sidebar-size",`${O}px`),a?.(O))})(),()=>{l=!1}},[P,o,a,R]);const k=Z();e.useEffect(()=>{if(!k.setSidebarToggleComputer)return;const l=u&&u.length>0?u:["thin","expanded"],O=A=>A==="collapsed"?l[0]??"expanded":A==="thin"?l.includes("thin")&&l.includes("expanded")?"expanded":"collapsed":l.length===2&&l.includes("thin")&&l.includes("expanded")?"collapsed":l.includes("thin")&&!l.includes("expanded")?"thin":"collapsed";return k.setSidebarToggleComputer(O),()=>{k.setSidebarToggleComputer?.(A=>A==="collapsed"?"thin":A==="thin"?"expanded":"collapsed")}},[k,u]);const D=e.useRef(c),Q=e.useRef("expanded");e.useEffect(()=>{n.sidebarMode!=="collapsed"&&(Q.current=n.sidebarMode,D.current=n.sidebarMode==="thin"?p:c)},[n.sidebarMode,p,c]);const X=e.useCallback(()=>{if(typeof m=="string")return m;const l=m;if(l&&l[n.currentBreakpoint])return l[n.currentBreakpoint];const A=[...Object.keys(se)].reverse().concat("initial"),ae=A.indexOf(n.currentBreakpoint);for(let ee=ae+1;ee<A.length;ee++){const i=A[ee];if(l&&l[i])return l[i]}return"collapsed"},[m,n.currentBreakpoint]),te=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!n.currentBreakpointReady||te.current===n.currentBreakpoint)return;te.current=n.currentBreakpoint;const l=X();l!==n.sidebarMode&&n.setSidebarMode(l)},[r,n.currentBreakpoint,n.currentBreakpointReady,X,n.sidebarMode,n.setSidebarMode]);const ve=P&&!R&&n.sidebarMode==="expanded"?e.createElement(ie.Provider,{value:{containerRef:M,cssVarName:"--sidebar-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"end",computeNext:(l,O,A)=>{const ae=getComputedStyle(M.current).direction==="rtl",ee=l-O;return A+(ae?-ee:ee)},onResize:a,onResizeStart:g,onResizeEnd:l=>{w?.(l),o?.save?.(l)},target:"sidebar",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},N.length>0?N.map((l,O)=>e.cloneElement(l,{key:l.key??O})):e.createElement(_,null)):null;if(R){const l=n.sidebarMode!=="collapsed";return e.createElement(G.Root,{open:l,onOpenChange:O=>n.setSidebarMode(O?"expanded":"collapsed")},e.createElement(G.Content,{side:"start",style:{padding:0},width:{initial:`${l?n.sidebarMode==="thin"?p:c:D.current}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Sidebar")),z))}return e.createElement("div",{...t,ref:B,className:J("rt-ShellSidebar",s),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":$,"data-open":C&&b||void 0,style:{...S,"--sidebar-size":`${c}px`,"--sidebar-thin-size":`${p}px`,"--sidebar-min-size":`${E}px`,"--sidebar-max-size":`${h}px`,...n.peekTarget==="sidebar"&&!R?(()=>{const l=u&&u.length>0?u:["thin","expanded"],O=n.sidebarMode;let A="collapsed";return O==="collapsed"?A=l[0]??"expanded":O==="thin"?A=l.includes("expanded")?"expanded":"collapsed":A=l.includes("thin")?"thin":"collapsed",{"--peek-sidebar-width":`${A==="thin"?p:c}px`}})():{}}},e.createElement("div",{className:"rt-ShellSidebarContent","data-visible":b||void 0},z),ve)});de.displayName="Shell.Sidebar",de.Handle=ue;const Pe=e.forwardRef(({className:s,...v},r)=>e.createElement("main",{...v,ref:r,className:J("rt-ShellContent",s)}));Pe.displayName="Shell.Content";const ye=e.forwardRef(({className:s,presentation:v={initial:"overlay",lg:"fixed"},mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=320,minSize:E=200,maxSize:h=500,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=le(v),n=f==="overlay",$=f==="stacked",R=e.useRef(null),C=e.useCallback(o=>{R.current=o,typeof u=="function"?u(o):u&&(u.current=o)},[u]),M=e.Children.toArray(U),B=M.filter(o=>e.isValidElement(o)&&o.type===fe),d=M.filter(o=>!(e.isValidElement(o)&&o.type===fe)),N=e.useCallback(()=>{if(typeof m=="string")return m;const o=m;if(o&&o[t.currentBreakpoint])return o[t.currentBreakpoint];const D=[...Object.keys(se)].reverse().concat("initial"),Q=D.indexOf(t.currentBreakpoint);for(let X=Q+1;X<D.length;X++){const te=D[X];if(o&&o[te])return o[te]}return"collapsed"},[m,t.currentBreakpoint]),z=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!t.currentBreakpointReady||z.current===t.currentBreakpoint)return;z.current=t.currentBreakpoint;const o=N();o!==t.inspectorMode&&t.setInspectorMode(o)},[r,t.currentBreakpoint,t.currentBreakpointReady,N,t.inspectorMode,t.setInspectorMode]),e.useEffect(()=>{r!==void 0&&t.inspectorMode!==r&&t.setInspectorMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.inspectorMode)},[t.inspectorMode,r,x]),e.useEffect(()=>{t.inspectorMode==="expanded"?T?.():L?.()},[t.inspectorMode,T,L]);const j=t.inspectorMode==="expanded",H=e.useMemo(()=>{if(!I||V)return V;const o=`kookie-ui:shell:inspector:${I}`;return{load:()=>{if(typeof window>"u")return;const D=window.localStorage.getItem(o);return D?Number(D):void 0},save:D=>{typeof window>"u"||window.localStorage.setItem(o,String(D))}}},[I,V]);e.useEffect(()=>{let o=!0;return(async()=>{if(!P||!H?.load||n)return;const k=await H.load();o&&typeof k=="number"&&R.current&&(R.current.style.setProperty("--inspector-size",`${k}px`),a?.(k))})(),()=>{o=!1}},[P,H,a,n]);const b=P&&!n&&j?e.createElement(ie.Provider,{value:{containerRef:R,cssVarName:"--inspector-size",minSize:E,maxSize:h,defaultSize:c,orientation:"vertical",edge:"start",computeNext:(o,k,D)=>{const Q=getComputedStyle(R.current).direction==="rtl",X=o-k;return D+(Q?X:-X)},onResize:a,onResizeStart:g,onResizeEnd:o=>{w?.(o),H?.save?.(o)},target:"inspector",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},B.length>0?B.map((o,k)=>e.cloneElement(o,{key:o.key??k})):e.createElement(_,null)):null;if(n){const o=t.inspectorMode==="expanded";return e.createElement(G.Root,{open:o,onOpenChange:k=>t.setInspectorMode(k?"expanded":"collapsed")},e.createElement(G.Content,{side:"end",style:{padding:0},width:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Inspector")),U))}return e.createElement("div",{...p,ref:C,className:J("rt-ShellInspector",s),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":f,"data-open":$&&j||void 0,style:{...S,"--inspector-size":`${c}px`,"--inspector-min-size":`${E}px`,"--inspector-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellInspectorContent","data-visible":j||void 0},d),b)});ye.displayName="Shell.Inspector",ye.Handle=fe;const be=e.forwardRef(({className:s,presentation:v="fixed",mode:r,defaultMode:m="collapsed",onModeChange:x,expandedSize:c=200,minSize:E=100,maxSize:h=400,resizable:P=!1,collapsible:y=!0,onExpand:T,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:w,snapPoints:F,snapTolerance:q,collapseThreshold:K,paneId:I,persistence:V,children:U,style:S,...p},u)=>{const t=Z(),f=le(v),n=f==="overlay",$=f==="stacked",R=e.useRef(null),C=e.useCallback(b=>{R.current=b,typeof u=="function"?u(b):u&&(u.current=b)},[u]),M=e.Children.toArray(U),B=M.filter(b=>e.isValidElement(b)&&b.type===me),d=M.filter(b=>!(e.isValidElement(b)&&b.type===me)),N=e.useRef(!1);e.useEffect(()=>{N.current||(N.current=!0,r===void 0&&t.bottomMode!==m&&t.setBottomMode(m))},[]),e.useEffect(()=>{r!==void 0&&t.bottomMode!==r&&t.setBottomMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&x?.(t.bottomMode)},[t.bottomMode,r,x]),e.useEffect(()=>{t.bottomMode==="expanded"?T?.():L?.()},[t.bottomMode,T,L]);const z=t.bottomMode==="expanded",j=e.useMemo(()=>{if(!I||V)return V;const b=`kookie-ui:shell:bottom:${I}`;return{load:()=>{if(typeof window>"u")return;const k=window.localStorage.getItem(b);return k?Number(k):void 0},save:k=>{typeof window>"u"||window.localStorage.setItem(b,String(k))}}},[I,V]);e.useEffect(()=>{let b=!0;return(async()=>{if(!P||!j?.load||n)return;const o=await j.load();b&&typeof o=="number"&&R.current&&(R.current.style.setProperty("--bottom-size",`${o}px`),a?.(o))})(),()=>{b=!1}},[P,j,a,n]);const H=P&&!n&&z?e.createElement(ie.Provider,{value:{containerRef:R,cssVarName:"--bottom-size",minSize:E,maxSize:h,defaultSize:c,orientation:"horizontal",edge:"start",computeNext:(b,o,k)=>{const D=b-o;return k-D},onResize:a,onResizeStart:g,onResizeEnd:b=>{w?.(b),j?.save?.(b)},target:"bottom",collapsible:y,snapPoints:F,snapTolerance:q??8,collapseThreshold:K,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},B.length>0?B.map((b,o)=>e.cloneElement(b,{key:b.key??o})):e.createElement(_,null)):null;if(n){const b=t.bottomMode==="expanded";return e.createElement(G.Root,{open:b,onOpenChange:o=>t.setBottomMode(o?"expanded":"collapsed")},e.createElement(G.Content,{side:"bottom",style:{padding:0},height:{initial:`${c}px`}},e.createElement(ce,null,e.createElement(G.Title,null,"Bottom panel")),U))}return e.createElement("div",{...p,ref:C,className:J("rt-ShellBottom",s),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":f,"data-open":$&&z||void 0,style:{...S,"--bottom-size":`${c}px`,"--bottom-min-size":`${E}px`,"--bottom-max-size":`${h}px`}},e.createElement("div",{className:"rt-ShellBottomContent","data-visible":z||void 0},d),H)});be.displayName="Shell.Bottom",be.Handle=me;const ke=e.forwardRef(({target:s,action:v="toggle",peekOnHover:r,onClick:m,onMouseEnter:x,onMouseLeave:c,children:E,...h},P)=>{const y=Z(),T=e.useCallback(w=>{switch(m?.(w),v){case"toggle":y.togglePane(s);break;case"expand":y.expandPane(s);break;case"collapse":y.collapsePane(s);break}},[y,s,v,m]),L=(()=>{switch(s){case"left":case"rail":return y.leftMode==="collapsed";case"panel":return y.leftMode==="collapsed"||y.panelMode==="collapsed";case"sidebar":return y.sidebarMode==="collapsed";case"inspector":return y.inspectorMode==="collapsed";case"bottom":return y.bottomMode==="collapsed"}})(),a=e.useCallback(w=>{x?.(w),!(!r||!L)&&y.peekPane(s)},[x,r,L,y,s]),g=e.useCallback(w=>{c?.(w),r&&y.peekTarget===s&&y.clearPeek()},[c,r,y,s]);return e.createElement("button",{...h,ref:P,onClick:T,onMouseEnter:a,onMouseLeave:g,"data-shell-trigger":s,"data-shell-action":v},E)});ke.displayName="Shell.Trigger";export{be as Bottom,Pe as Content,Me as Header,ye as Inspector,he as Left,ne as Panel,oe as Rail,Se as Root,de as Sidebar,ke as Trigger,le as useResponsivePresentation,Z as useShell};
1
+ "use client";import*as e from"react";import Z from"classnames";import*as J from"./sheet.js";import"./inset.js";import{VisuallyHidden as pe}from"./visually-hidden.js";const re={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},Re=e.createContext(null);function ee(){const i=e.useContext(Re);if(!i)throw new Error("Shell components must be used within <Shell.Root>");return i}const le=e.createContext(null);function ge(){const i=e.useContext(le);if(!i)throw new Error("Shell.Handle must be used within a resizable pane");return i}const te=e.forwardRef(({className:i,children:M,...r},u)=>{const{containerRef:E,cssVarName:p,minSize:S,maxSize:P,defaultSize:h,orientation:m,edge:C,computeNext:L,onResize:a,onResizeStart:g,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,collapsible:K,target:O,requestCollapse:Y,requestToggle:k}=ge(),f=e.useRef(null);e.useEffect(()=>()=>{try{f.current?.()}catch{}f.current=null},[]);const b=m;return e.createElement("div",{...r,ref:u,className:Z("rt-ShellResizer",i),"data-orientation":m,"data-edge":C,role:"slider","aria-orientation":b,"aria-valuemin":S,"aria-valuemax":P,"aria-valuenow":h,tabIndex:0,onPointerDown:t=>{if(!E.current)return;t.preventDefault();const y=E.current,n=t.currentTarget,I=t.pointerId;try{f.current?.()}catch{}y.setAttribute("data-resizing","");try{n.setPointerCapture(I)}catch{}const R=m==="vertical"?t.clientX:t.clientY,x=parseFloat(getComputedStyle(y).getPropertyValue(p)||`${h}`),v=s=>Math.min(Math.max(s,S),P),w=document.body,d=w.style.cursor,N=w.style.userSelect;w.style.cursor=m==="vertical"?"col-resize":"row-resize",w.style.userSelect="none",g?.(x);const V=s=>{const T=m==="vertical"?s.clientX:s.clientY,o=v(L(T,R,x));y.style.setProperty(p,`${o}px`),n.setAttribute("aria-valuenow",String(o)),a?.(o)},X=()=>{try{n.releasePointerCapture(I)}catch{}window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H),window.removeEventListener("keydown",j),n.removeEventListener("lostpointercapture",H),y.removeAttribute("data-resizing"),w.style.cursor=d,w.style.userSelect=N,f.current=null},H=()=>{const s=parseFloat(getComputedStyle(y).getPropertyValue(p)||`${h}`);let T=s;if(U&&U.length){const o=U.reduce((z,A)=>Math.abs(A-s)<Math.abs(z-s)?A:z,U[0]);Math.abs(o-s)<=(F??8)&&(T=o,y.style.setProperty(p,`${T}px`),n.setAttribute("aria-valuenow",String(T)),a?.(T))}K&&typeof W=="number"&&s<=W&&Y?.(),B?.(T),X()},j=s=>{s.key==="Escape"&&(y.style.setProperty(p,`${x}px`),n.setAttribute("aria-valuenow",String(x)),B?.(x),X())};window.addEventListener("pointermove",V),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H),window.addEventListener("keydown",j),n.addEventListener("lostpointercapture",H),f.current=X},onDoubleClick:()=>{K&&k?.()},onKeyDown:t=>{if(!E.current)return;const y=E.current,n=parseFloat(getComputedStyle(y).getPropertyValue(p)||`${h}`),I=v=>Math.min(Math.max(v,S),P),R=t.shiftKey?32:8;let x=0;if(m==="vertical"?t.key==="ArrowRight"?x=R:t.key==="ArrowLeft"&&(x=-R):t.key==="ArrowDown"?x=R:t.key==="ArrowUp"&&(x=-R),t.key==="Home"){t.preventDefault(),g?.(n);const v=I(S);y.style.setProperty(p,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),B?.(v);return}if(t.key==="End"){t.preventDefault(),g?.(n);const v=I(P);y.style.setProperty(p,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),B?.(v);return}if(x!==0){t.preventDefault(),g?.(n);const v=I(n+(C==="start"&&m==="vertical"?-x:x));y.style.setProperty(p,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),a?.(v),B?.(v)}}},M)});te.displayName="Shell.Handle";const ue=e.forwardRef((i,M)=>e.createElement(te,{...i,ref:M}));ue.displayName="Shell.Panel.Handle";const fe=e.forwardRef((i,M)=>e.createElement(te,{...i,ref:M}));fe.displayName="Shell.Sidebar.Handle";const me=e.forwardRef((i,M)=>e.createElement(te,{...i,ref:M}));me.displayName="Shell.Inspector.Handle";const ye=e.forwardRef((i,M)=>e.createElement(te,{...i,ref:M}));ye.displayName="Shell.Bottom.Handle";function de(i){const{currentBreakpoint:M}=ee();return e.useMemo(()=>{if(typeof i=="string")return i;if(i[M])return i[M];const u=[...Object.keys(re)].reverse().concat("initial"),E=u.indexOf(M);for(let p=E+1;p<u.length;p++){const S=u[p];if(i[S])return i[S]}return"fixed"},[i,M])}function Ee(){const[i,M]=e.useState("initial"),[r,u]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const p=Object.entries(re).map(([P,h])=>[P,window.matchMedia(h)]),S=()=>{const P=p.filter(([,m])=>m.matches).map(([m])=>m),h=P[P.length-1]??"initial";M(h),u(!0)};return S(),p.forEach(([,P])=>P.addEventListener("change",S)),()=>{p.forEach(([,P])=>P.removeEventListener("change",S))}},[]),{bp:i,ready:r}}const ke=e.forwardRef(({className:i,children:M,height:r="full",...u},E)=>{const{bp:p,ready:S}=Ee(),[P,h]=e.useState("collapsed"),[m,C]=e.useState("collapsed"),[L,a]=e.useState("expanded"),[g,B]=e.useState("collapsed"),[U,F]=e.useState("collapsed"),[W,K]=e.useState(!1),[O,Y]=e.useState(!1),k=e.useRef(l=>l==="collapsed"?"thin":l==="thin"?"expanded":"collapsed"),f=e.useCallback(l=>{k.current=l},[]);e.useEffect(()=>{P==="collapsed"&&C("collapsed")},[P]),e.useEffect(()=>{O&&W&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[O,W]);const[b,t]=e.useState(void 0),y=e.useCallback(l=>t(l),[]),n=e.useRef(64),I=e.useRef(288),R=e.useCallback(l=>{n.current=l},[]),x=e.useCallback(l=>{I.current=l},[]),v=e.useMemo(()=>{const l=e.Children.toArray(M),$=(G,ie)=>e.isValidElement(G)&&(G.type===ie||G.type?.displayName===ie.displayName);return l.some(G=>$(G,se)||$(G,ae))},[M]),w=e.useMemo(()=>{const l=e.Children.toArray(M),$=(G,ie)=>e.isValidElement(G)&&(G.type===ie||G.type?.displayName===ie.displayName);return l.some(G=>$(G,ce))},[M]),d=e.useCallback(l=>{switch(l){case"left":case"rail":h($=>$==="expanded"?"collapsed":"expanded");break;case"panel":P==="collapsed"?(h("expanded"),C("expanded")):C($=>$==="expanded"?"collapsed":"expanded");break;case"sidebar":a($=>k.current($));break;case"inspector":B($=>$==="expanded"?"collapsed":"expanded");break;case"bottom":F($=>$==="expanded"?"collapsed":"expanded");break}},[P]),N=e.useCallback(l=>{switch(l){case"left":case"rail":h("expanded");break;case"panel":h("expanded"),C("expanded");break;case"sidebar":a("expanded");break;case"inspector":B("expanded");break;case"bottom":F("expanded");break}},[]),V=e.useCallback(l=>{switch(l){case"left":case"rail":h("collapsed");break;case"panel":C("collapsed");break;case"sidebar":a("collapsed");break;case"inspector":B("collapsed");break;case"bottom":F("collapsed");break}},[]),X=e.useMemo(()=>({leftMode:P,setLeftMode:h,panelMode:m,setPanelMode:C,sidebarMode:L,setSidebarMode:a,inspectorMode:g,setInspectorMode:B,bottomMode:U,setBottomMode:F,hasLeft:W,setHasLeft:K,hasSidebar:O,setHasSidebar:Y,currentBreakpoint:p,currentBreakpointReady:S,leftResolvedPresentation:b,togglePane:d,expandPane:N,collapsePane:V,setSidebarToggleComputer:f,onLeftPres:y,onRailDefaults:R,onPanelDefaults:x}),[P,m,L,g,U,W,O,p,S,b,d,N,V,f,y,R,x]),H=e.Children.toArray(M),j=(l,$)=>e.isValidElement(l)&&(l.type===$||l.type?.displayName===$.displayName),s=H.filter(l=>j(l,ve)),T=H.filter(l=>j(l,se)),o=H.filter(l=>j(l,ae)),z=H.filter(l=>j(l,ce)),A=H.filter(l=>j(l,he)),_=H.filter(l=>j(l,be)),ne=H.filter(l=>j(l,Me)),oe=e.useMemo(()=>r==="full"?{height:"100vh"}:r==="auto"?{height:"auto"}:typeof r=="string"?{height:r}:typeof r=="number"?{height:`${r}px`}:{},[r]),[c,q]=e.useState(null),D=e.useCallback(l=>q(l),[]),Q=e.useCallback(()=>q(null),[]);return e.createElement("div",{...u,ref:E,className:Z("rt-ShellRoot",i),style:{...oe,...u.style}},e.createElement(Re.Provider,{value:{...X,peekTarget:c,setPeekTarget:q,peekPane:D,clearPeek:Q}},s,e.createElement("div",{className:"rt-ShellBody","data-peek-target":c??void 0,style:c==="rail"||c==="panel"?{"--peek-rail-width":`${n.current}px`}:void 0},v&&!w?(()=>{const l=T[0],$=l?{mode:l.props?.mode,defaultMode:l.props?.defaultMode,onModeChange:l.props?.onModeChange,presentation:l.props?.presentation,collapsible:l.props?.collapsible,onExpand:l.props?.onExpand,onCollapse:l.props?.onCollapse}:{};return e.createElement(Pe,{...$},T,o)})():z,A,_),ne))});ke.displayName="Shell.Root";const ve=e.forwardRef(({className:i,height:M=64,style:r,...u},E)=>e.createElement("header",{...u,ref:E,className:Z("rt-ShellHeader",i),style:{...r,"--shell-header-height":`${M}px`}}));ve.displayName="Shell.Header";const Pe=e.forwardRef(({className:i,presentation:M={initial:"overlay",sm:"fixed"},mode:r,defaultMode:u="collapsed",onModeChange:E,collapsible:p=!0,onExpand:S,onCollapse:P,children:h,style:m,...C},L)=>{const a=ee(),g=de(M),B=g==="overlay",U=g==="stacked",F=e.useRef(null);e.useEffect(()=>{a.onLeftPres?.(g)},[a,g]);const W=e.useCallback(k=>{F.current=k,typeof L=="function"?L(k):L&&(L.current=k)},[L]);e.useEffect(()=>(a.setHasLeft(!0),()=>a.setHasLeft(!1)),[a]);const K=e.useCallback(()=>{if(typeof u=="string")return u;const k=u;if(k&&k[a.currentBreakpoint])return k[a.currentBreakpoint];const b=[...Object.keys(re)].reverse().concat("initial"),t=b.indexOf(a.currentBreakpoint);for(let y=t+1;y<b.length;y++){const n=b[y];if(k&&k[n])return k[n]}return"collapsed"},[u,a.currentBreakpoint]),O=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!a.currentBreakpointReady||O.current===a.currentBreakpoint)return;O.current=a.currentBreakpoint;const k=K();k!==a.leftMode&&a.setLeftMode(k)},[r,a.currentBreakpoint,a.currentBreakpointReady,K,a.leftMode,a.setLeftMode]),e.useEffect(()=>{r!==void 0&&a.leftMode!==r&&a.setLeftMode(r)},[r,a]),e.useEffect(()=>{r===void 0&&E?.(a.leftMode)},[a.leftMode,r,E]),e.useEffect(()=>{a.leftMode==="expanded"?S?.():P?.()},[a.leftMode,S,P]);const Y=a.leftMode==="expanded";if(B){const k=a.leftMode==="expanded",f=e.Children.toArray(h),b=(w,d)=>e.isValidElement(w)&&w.type===d,t=f.find(w=>b(w,se)),y=f.find(w=>b(w,ae)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,I=typeof y?.props?.expandedSize=="number"?y.props.expandedSize:288,R=!!t,x=!!y,v=(R?n:0)+(a.panelMode==="expanded"&&x?I:0);return e.createElement(J.Root,{open:k,onOpenChange:w=>a.setLeftMode(w?"expanded":"collapsed")},e.createElement(J.Content,{side:"start",style:{padding:0},width:{initial:`${v}px`}},e.createElement(pe,null,e.createElement(J.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},h)))}if(U){const k=a.leftMode==="expanded",f=e.Children.toArray(h),b=(d,N)=>e.isValidElement(d)&&d.type===N,t=f.find(d=>b(d,se)),y=f.find(d=>b(d,ae)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,I=typeof y?.props?.expandedSize=="number"?y.props.expandedSize:288,R=!!t,v=!!y&&(a.panelMode==="expanded"||a.peekTarget==="panel"),w=(R?n:0)+(v?I:0);return e.createElement("div",{...C,ref:W,className:Z("rt-ShellLeft",i),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...m},"data-open":k||void 0},h)}return e.createElement("div",{...C,ref:W,className:Z("rt-ShellLeft",i),"data-mode":a.leftMode,"data-peek":a.peekTarget==="left"||a.peekTarget==="rail"||a.peekTarget==="panel"||void 0,"data-presentation":g,style:{...m}},h)});Pe.displayName="Shell.Left";const se=e.forwardRef(({className:i,presentation:M,mode:r,defaultMode:u,onModeChange:E,expandedSize:p=64,collapsible:S,onExpand:P,onCollapse:h,children:m,style:C,...L},a)=>{const g=ee();e.useEffect(()=>{g.onRailDefaults?.(p)},[g,p]);const B=g.leftMode==="expanded";return e.createElement("div",{...L,ref:a,className:Z("rt-ShellRail",i),"data-mode":g.leftMode,"data-peek":g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0,style:{...C,"--rail-size":`${p}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":B||g.leftResolvedPresentation!=="overlay"&&g.peekTarget==="rail"||void 0},m))});se.displayName="Shell.Rail";const ae=e.forwardRef(({className:i,mode:M,onModeChange:r,expandedSize:u=288,minSize:E,maxSize:p,resizable:S,collapsible:P=!0,onExpand:h,onCollapse:m,onResize:C,onResizeStart:L,onResizeEnd:a,snapPoints:g,snapTolerance:B,collapseThreshold:U,paneId:F,persistence:W,children:K,style:O,...Y},k)=>{const f=ee();e.useEffect(()=>{f.onPanelDefaults?.(u)},[f,u]);const b=e.useRef(null),t=e.useCallback(d=>{b.current=d,typeof k=="function"?k(d):k&&(k.current=d)},[k]),y=e.Children.toArray(K),n=y.filter(d=>e.isValidElement(d)&&d.type===ue),I=y.filter(d=>!(e.isValidElement(d)&&d.type===ue)),R=f.leftResolvedPresentation==="overlay",x=e.useMemo(()=>{if(!F||W)return W;const d=`kookie-ui:shell:panel:${F}`;return{load:()=>{if(typeof window>"u")return;const V=window.localStorage.getItem(d);return V?Number(V):void 0},save:V=>{typeof window>"u"||window.localStorage.setItem(d,String(V))}}},[F,W]);e.useEffect(()=>{let d=!0;return(async()=>{if(!S||!x?.load||R)return;const N=await x.load();d&&typeof N=="number"&&b.current&&(b.current.style.setProperty("--panel-size",`${N}px`),C?.(N))})(),()=>{d=!1}},[S,x,C,R]),e.useEffect(()=>{b.current&&R&&b.current.style.setProperty("--panel-size",`${u}px`)},[R,u]),e.useEffect(()=>{if(b.current&&f.leftResolvedPresentation!=="overlay"&&f.leftMode==="expanded"&&f.panelMode==="expanded"){const d=b.current.parentElement||null;try{d?.style.removeProperty("width")}catch{}}},[f.leftResolvedPresentation,f.leftMode,f.panelMode]);const v=f.leftMode==="expanded"&&f.panelMode==="expanded",w=S&&f.leftResolvedPresentation!=="overlay"&&v?e.createElement(le.Provider,{value:{containerRef:b,cssVarName:"--panel-size",minSize:typeof E=="number"?E:100,maxSize:typeof p=="number"?p:800,defaultSize:u,orientation:"vertical",edge:"end",computeNext:(d,N,V)=>{const X=getComputedStyle(b.current).direction==="rtl",H=d-N;return V+(X?-H:H)},onResize:C,onResizeStart:d=>{const V=b.current?.parentElement;try{V?.style.removeProperty("width")}catch{}L?.(d)},onResizeEnd:d=>{a?.(d),x?.save?.(d)},target:"panel",collapsible:!!P,snapPoints:g,snapTolerance:B??8,collapseThreshold:U,requestCollapse:()=>f.setPanelMode("collapsed"),requestToggle:()=>f.togglePane("panel")}},n.length>0?n.map((d,N)=>e.cloneElement(d,{key:d.key??N})):e.createElement(te,null)):null;return e.createElement("div",{...Y,ref:t,className:Z("rt-ShellPanel",i),"data-mode":f.panelMode,"data-visible":v||f.leftResolvedPresentation!=="overlay"&&f.peekTarget==="panel"||void 0,"data-peek":f.leftResolvedPresentation!=="overlay"&&f.peekTarget==="panel"||void 0,style:{...O,"--panel-size":`${u}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":v||void 0},I),w)});ae.displayName="Shell.Panel",ae.Handle=ue;const ce=e.forwardRef(({className:i,presentation:M={initial:"overlay",md:"fixed"},mode:r,defaultMode:u="expanded",onModeChange:E,expandedSize:p=288,minSize:S=200,maxSize:P=400,resizable:h=!1,collapsible:m=!0,onExpand:C,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:k,thinSize:f=64,toggleModes:b,...t},y)=>{const n=ee(),I=de(M),R=I==="overlay",x=I==="stacked",v=e.useRef(null),w=e.useCallback(c=>{v.current=c,typeof y=="function"?y(c):y&&(y.current=c)},[y]),d=e.Children.toArray(Y),N=d.filter(c=>e.isValidElement(c)&&c.type===fe),V=d.filter(c=>!(e.isValidElement(c)&&c.type===fe)),X=e.useId();e.useEffect(()=>(n.setHasSidebar(!0),()=>{n.setHasSidebar(!1)}),[n,X]);const H=e.useRef(!1);e.useEffect(()=>{H.current||(H.current=!0,r===void 0&&n.sidebarMode!==u&&n.setSidebarMode(u))},[]),e.useEffect(()=>{r!==void 0&&n.sidebarMode!==r&&n.setSidebarMode(r)},[r,n]),e.useEffect(()=>{r===void 0&&E?.(n.sidebarMode)},[n.sidebarMode,r,E]),e.useEffect(()=>{n.sidebarMode==="expanded"?C?.():L?.()},[n.sidebarMode,C,L]);const j=n.sidebarMode!=="collapsed",s=e.useMemo(()=>{if(!K||O)return O;const c=`kookie-ui:shell:sidebar:${K}`;return{load:()=>{if(typeof window>"u")return;const D=window.localStorage.getItem(c);return D?Number(D):void 0},save:D=>{typeof window>"u"||window.localStorage.setItem(c,String(D))}}},[K,O]);e.useEffect(()=>{let c=!0;return(async()=>{if(!h||!s?.load||R)return;const q=await s.load();c&&typeof q=="number"&&v.current&&(v.current.style.setProperty("--sidebar-size",`${q}px`),a?.(q))})(),()=>{c=!1}},[h,s,a,R]);const T=e.useCallback(()=>{if(typeof u=="string")return u;const c=u;if(c&&c[n.currentBreakpoint])return c[n.currentBreakpoint];const D=[...Object.keys(re)].reverse().concat("initial"),Q=D.indexOf(n.currentBreakpoint);for(let l=Q+1;l<D.length;l++){const $=D[l];if(c&&c[$])return c[$]}return"collapsed"},[u,n.currentBreakpoint]),o=ee(),z=e.useCallback(()=>{const c=T();return c==="thin"||c==="expanded"?c:"expanded"},[T]);e.useEffect(()=>{if(!o.setSidebarToggleComputer)return;const c=b??"both",q=D=>{if(c==="both")return D==="collapsed"?"thin":D==="thin"?"expanded":"collapsed";const Q=z();return D==="collapsed"?Q:D===Q?"collapsed":Q};return o.setSidebarToggleComputer(q),()=>{o.setSidebarToggleComputer?.(D=>D==="collapsed"?"thin":D==="thin"?"expanded":"collapsed")}},[o,b,z]);const A=e.useRef(p),_=e.useRef("expanded");e.useEffect(()=>{n.sidebarMode!=="collapsed"&&(_.current=n.sidebarMode,A.current=n.sidebarMode==="thin"?f:p)},[n.sidebarMode,f,p]);const ne=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!n.currentBreakpointReady||ne.current===n.currentBreakpoint)return;ne.current=n.currentBreakpoint;const c=T();c!==n.sidebarMode&&n.setSidebarMode(c)},[r,n.currentBreakpoint,n.currentBreakpointReady,T,n.sidebarMode,n.setSidebarMode]);const oe=h&&!R&&n.sidebarMode==="expanded"?e.createElement(le.Provider,{value:{containerRef:v,cssVarName:"--sidebar-size",minSize:S,maxSize:P,defaultSize:p,orientation:"vertical",edge:"end",computeNext:(c,q,D)=>{const Q=getComputedStyle(v.current).direction==="rtl",l=c-q;return D+(Q?-l:l)},onResize:a,onResizeStart:g,onResizeEnd:c=>{B?.(c),s?.save?.(c)},target:"sidebar",collapsible:m,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},N.length>0?N.map((c,q)=>e.cloneElement(c,{key:c.key??q})):e.createElement(te,null)):null;if(R){const c=n.sidebarMode!=="collapsed";return e.createElement(J.Root,{open:c,onOpenChange:q=>n.setSidebarMode(q?"expanded":"collapsed")},e.createElement(J.Content,{side:"start",style:{padding:0},width:{initial:`${c?n.sidebarMode==="thin"?f:p:A.current}px`}},e.createElement(pe,null,e.createElement(J.Title,null,"Sidebar")),V))}return e.createElement("div",{...t,ref:w,className:Z("rt-ShellSidebar",i),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":I,"data-open":x&&j||void 0,style:{...k,"--sidebar-size":`${p}px`,"--sidebar-thin-size":`${f}px`,"--sidebar-min-size":`${S}px`,"--sidebar-max-size":`${P}px`,...n.peekTarget==="sidebar"&&n.sidebarMode==="collapsed"&&!R?(()=>{const c=b??"both",q=n.sidebarMode;let D;if(c==="both")D=q==="collapsed"?"thin":q==="thin"?"expanded":"collapsed";else{const Q=z();D=q==="collapsed"?Q:"collapsed"}return D==="thin"?{"--peek-sidebar-width":`${f}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${p}px)`}})():{}}},e.createElement("div",{className:"rt-ShellSidebarContent","data-visible":j||void 0},V),oe)});ce.displayName="Shell.Sidebar",ce.Handle=fe;const he=e.forwardRef(({className:i,...M},r)=>e.createElement("main",{...M,ref:r,className:Z("rt-ShellContent",i)}));he.displayName="Shell.Content";const be=e.forwardRef(({className:i,presentation:M={initial:"overlay",lg:"fixed"},mode:r,defaultMode:u="collapsed",onModeChange:E,expandedSize:p=320,minSize:S=200,maxSize:P=500,resizable:h=!1,collapsible:m=!0,onExpand:C,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:k,...f},b)=>{const t=ee(),y=de(M),n=y==="overlay",I=y==="stacked",R=e.useRef(null),x=e.useCallback(s=>{R.current=s,typeof b=="function"?b(s):b&&(b.current=s)},[b]),v=e.Children.toArray(Y),w=v.filter(s=>e.isValidElement(s)&&s.type===me),d=v.filter(s=>!(e.isValidElement(s)&&s.type===me)),N=e.useCallback(()=>{if(typeof u=="string")return u;const s=u;if(s&&s[t.currentBreakpoint])return s[t.currentBreakpoint];const o=[...Object.keys(re)].reverse().concat("initial"),z=o.indexOf(t.currentBreakpoint);for(let A=z+1;A<o.length;A++){const _=o[A];if(s&&s[_])return s[_]}return"collapsed"},[u,t.currentBreakpoint]),V=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!t.currentBreakpointReady||V.current===t.currentBreakpoint)return;V.current=t.currentBreakpoint;const s=N();s!==t.inspectorMode&&t.setInspectorMode(s)},[r,t.currentBreakpoint,t.currentBreakpointReady,N,t.inspectorMode,t.setInspectorMode]),e.useEffect(()=>{r!==void 0&&t.inspectorMode!==r&&t.setInspectorMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&E?.(t.inspectorMode)},[t.inspectorMode,r,E]),e.useEffect(()=>{t.inspectorMode==="expanded"?C?.():L?.()},[t.inspectorMode,C,L]);const X=t.inspectorMode==="expanded",H=e.useMemo(()=>{if(!K||O)return O;const s=`kookie-ui:shell:inspector:${K}`;return{load:()=>{if(typeof window>"u")return;const o=window.localStorage.getItem(s);return o?Number(o):void 0},save:o=>{typeof window>"u"||window.localStorage.setItem(s,String(o))}}},[K,O]);e.useEffect(()=>{let s=!0;return(async()=>{if(!h||!H?.load||n)return;const T=await H.load();s&&typeof T=="number"&&R.current&&(R.current.style.setProperty("--inspector-size",`${T}px`),a?.(T))})(),()=>{s=!1}},[h,H,a,n]);const j=h&&!n&&X?e.createElement(le.Provider,{value:{containerRef:R,cssVarName:"--inspector-size",minSize:S,maxSize:P,defaultSize:p,orientation:"vertical",edge:"start",computeNext:(s,T,o)=>{const z=getComputedStyle(R.current).direction==="rtl",A=s-T;return o+(z?A:-A)},onResize:a,onResizeStart:g,onResizeEnd:s=>{B?.(s),H?.save?.(s)},target:"inspector",collapsible:m,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},w.length>0?w.map((s,T)=>e.cloneElement(s,{key:s.key??T})):e.createElement(te,null)):null;if(n){const s=t.inspectorMode==="expanded";return e.createElement(J.Root,{open:s,onOpenChange:T=>t.setInspectorMode(T?"expanded":"collapsed")},e.createElement(J.Content,{side:"end",style:{padding:0},width:{initial:`${p}px`}},e.createElement(pe,null,e.createElement(J.Title,null,"Inspector")),d))}return e.createElement("div",{...f,ref:x,className:Z("rt-ShellInspector",i),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":y,"data-open":I&&X||void 0,style:{...k,"--inspector-size":`${p}px`,"--inspector-min-size":`${S}px`,"--inspector-max-size":`${P}px`}},e.createElement("div",{className:"rt-ShellInspectorContent","data-visible":X||void 0},d),j)});be.displayName="Shell.Inspector",be.Handle=me;const Me=e.forwardRef(({className:i,presentation:M="fixed",mode:r,defaultMode:u="collapsed",onModeChange:E,expandedSize:p=200,minSize:S=100,maxSize:P=400,resizable:h=!1,collapsible:m=!0,onExpand:C,onCollapse:L,onResize:a,onResizeStart:g,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:k,...f},b)=>{const t=ee(),y=de(M),n=y==="overlay",I=y==="stacked",R=e.useRef(null),x=e.useCallback(o=>{R.current=o,typeof b=="function"?b(o):b&&(b.current=o)},[b]),v=e.Children.toArray(Y),w=v.filter(o=>e.isValidElement(o)&&o.type===ye),d=v.filter(o=>!(e.isValidElement(o)&&o.type===ye)),N=e.useCallback(()=>{if(typeof u=="string")return u;const o=u;if(o&&o[t.currentBreakpoint])return o[t.currentBreakpoint];const A=[...Object.keys(re)].reverse().concat("initial"),_=A.indexOf(t.currentBreakpoint);for(let ne=_+1;ne<A.length;ne++){const oe=A[ne];if(o&&o[oe])return o[oe]}return"collapsed"},[u,t.currentBreakpoint]),V=e.useRef(!1);e.useEffect(()=>{if(!V.current&&(V.current=!0,r===void 0)){const o=N();t.bottomMode!==o&&t.setBottomMode(o)}},[]);const X=e.useRef(null),H=e.useRef(null);e.useEffect(()=>{if(r!==void 0||!t.currentBreakpointReady||X.current===t.currentBreakpoint)return;X.current=t.currentBreakpoint;const o=N();H.current!==o&&(H.current=o,o!==t.bottomMode&&t.setBottomMode(o))},[r,t.currentBreakpoint,t.currentBreakpointReady,N,t.bottomMode,t.setBottomMode]),e.useEffect(()=>{r!==void 0&&t.bottomMode!==r&&t.setBottomMode(r)},[r,t]),e.useEffect(()=>{r===void 0&&E?.(t.bottomMode)},[t.bottomMode,r,E]),e.useEffect(()=>{t.bottomMode==="expanded"?C?.():L?.()},[t.bottomMode,C,L]);const j=t.bottomMode==="expanded",s=e.useMemo(()=>{if(!K||O)return O;const o=`kookie-ui:shell:bottom:${K}`;return{load:()=>{if(typeof window>"u")return;const A=window.localStorage.getItem(o);return A?Number(A):void 0},save:A=>{typeof window>"u"||window.localStorage.setItem(o,String(A))}}},[K,O]);e.useEffect(()=>{let o=!0;return(async()=>{if(!h||!s?.load||n)return;const z=await s.load();o&&typeof z=="number"&&R.current&&(R.current.style.setProperty("--bottom-size",`${z}px`),a?.(z))})(),()=>{o=!1}},[h,s,a,n]);const T=h&&!n&&j?e.createElement(le.Provider,{value:{containerRef:R,cssVarName:"--bottom-size",minSize:S,maxSize:P,defaultSize:p,orientation:"horizontal",edge:"start",computeNext:(o,z,A)=>{const _=o-z;return A-_},onResize:a,onResizeStart:g,onResizeEnd:o=>{B?.(o),s?.save?.(o)},target:"bottom",collapsible:m,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},w.length>0?w.map((o,z)=>e.cloneElement(o,{key:o.key??z})):e.createElement(te,null)):null;if(n){const o=t.bottomMode==="expanded";return e.createElement(J.Root,{open:o,onOpenChange:z=>t.setBottomMode(z?"expanded":"collapsed")},e.createElement(J.Content,{side:"bottom",style:{padding:0},height:{initial:`${p}px`}},e.createElement(pe,null,e.createElement(J.Title,null,"Bottom panel")),d))}return e.createElement("div",{...f,ref:x,className:Z("rt-ShellBottom",i),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":y,"data-open":I&&j||void 0,style:{...k,"--bottom-size":`${p}px`,"--bottom-min-size":`${S}px`,"--bottom-max-size":`${P}px`}},e.createElement("div",{className:"rt-ShellBottomContent","data-visible":j||void 0},d),T)});Me.displayName="Shell.Bottom",Me.Handle=ye;const Se=e.forwardRef(({target:i,action:M="toggle",peekOnHover:r,onClick:u,onMouseEnter:E,onMouseLeave:p,children:S,...P},h)=>{const m=ee(),C=e.useCallback(B=>{switch(u?.(B),m.peekTarget===i&&m.clearPeek(),M){case"toggle":m.togglePane(i);break;case"expand":m.expandPane(i);break;case"collapse":m.collapsePane(i);break}},[m,i,M,u]),L=(()=>{switch(i){case"left":case"rail":return m.leftMode==="collapsed";case"panel":return m.leftMode==="collapsed"||m.panelMode==="collapsed";case"sidebar":return m.sidebarMode==="collapsed";case"inspector":return m.inspectorMode==="collapsed";case"bottom":return m.bottomMode==="collapsed"}})(),a=e.useCallback(B=>{E?.(B),!(!r||!L)&&m.peekPane(i)},[E,r,L,m,i]),g=e.useCallback(B=>{p?.(B),r&&m.peekTarget===i&&m.clearPeek()},[p,r,m,i]);return e.createElement("button",{...P,ref:h,onClick:C,onMouseEnter:a,onMouseLeave:g,"data-shell-trigger":i,"data-shell-action":M},S)});Se.displayName="Shell.Trigger";export{Me as Bottom,he as Content,ve as Header,be as Inspector,Pe as Left,ae as Panel,se as Rail,ke as Root,ce as Sidebar,Se as Trigger,de as useResponsivePresentation,ee as useShell};
2
2
  //# sourceMappingURL=shell.js.map