@kushagradhawan/kookie-ui 0.1.48 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.css +858 -30
- package/dist/cjs/components/_internal/shell-bottom.d.ts +31 -0
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -0
- package/dist/cjs/components/_internal/shell-bottom.js +2 -0
- package/dist/cjs/components/_internal/shell-bottom.js.map +7 -0
- package/dist/cjs/components/_internal/shell-handles.d.ts +7 -0
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -0
- package/dist/cjs/components/_internal/shell-handles.js +2 -0
- package/dist/cjs/components/_internal/shell-handles.js.map +7 -0
- package/dist/cjs/components/_internal/shell-inspector.d.ts +31 -0
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -0
- package/dist/cjs/components/_internal/shell-inspector.js +2 -0
- package/dist/cjs/components/_internal/shell-inspector.js.map +7 -0
- package/dist/cjs/components/_internal/shell-resize.d.ts +24 -0
- package/dist/cjs/components/_internal/shell-resize.d.ts.map +1 -0
- package/dist/cjs/components/_internal/shell-resize.js +2 -0
- package/dist/cjs/components/_internal/shell-resize.js.map +7 -0
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +37 -0
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -0
- package/dist/cjs/components/_internal/shell-sidebar.js +2 -0
- package/dist/cjs/components/_internal/shell-sidebar.js.map +7 -0
- package/dist/cjs/components/schemas/index.d.ts +2 -0
- package/dist/cjs/components/schemas/index.d.ts.map +1 -1
- package/dist/cjs/components/schemas/index.js +1 -1
- package/dist/cjs/components/schemas/index.js.map +3 -3
- package/dist/cjs/components/schemas/shell.schema.d.ts +1025 -0
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -0
- package/dist/cjs/components/schemas/shell.schema.js +2 -0
- package/dist/cjs/components/schemas/shell.schema.js.map +7 -0
- package/dist/cjs/components/shell.context.d.ts +37 -0
- package/dist/cjs/components/shell.context.d.ts.map +1 -0
- package/dist/cjs/components/shell.context.js +2 -0
- package/dist/cjs/components/shell.context.js.map +7 -0
- package/dist/cjs/components/shell.d.ts +6 -68
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.d.ts +3 -0
- package/dist/cjs/components/shell.hooks.d.ts.map +1 -0
- package/dist/cjs/components/shell.hooks.js +2 -0
- package/dist/cjs/components/shell.hooks.js.map +7 -0
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/shell.types.d.ts +20 -0
- package/dist/cjs/components/shell.types.d.ts.map +1 -0
- package/dist/cjs/components/shell.types.js +2 -0
- package/dist/cjs/components/shell.types.js.map +7 -0
- package/dist/cjs/components/sidebar.d.ts +1 -1
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +3 -3
- package/dist/esm/components/_internal/shell-bottom.d.ts +31 -0
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -0
- package/dist/esm/components/_internal/shell-bottom.js +2 -0
- package/dist/esm/components/_internal/shell-bottom.js.map +7 -0
- package/dist/esm/components/_internal/shell-handles.d.ts +7 -0
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -0
- package/dist/esm/components/_internal/shell-handles.js +2 -0
- package/dist/esm/components/_internal/shell-handles.js.map +7 -0
- package/dist/esm/components/_internal/shell-inspector.d.ts +31 -0
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -0
- package/dist/esm/components/_internal/shell-inspector.js +2 -0
- package/dist/esm/components/_internal/shell-inspector.js.map +7 -0
- package/dist/esm/components/_internal/shell-resize.d.ts +24 -0
- package/dist/esm/components/_internal/shell-resize.d.ts.map +1 -0
- package/dist/esm/components/_internal/shell-resize.js +2 -0
- package/dist/esm/components/_internal/shell-resize.js.map +7 -0
- package/dist/esm/components/_internal/shell-sidebar.d.ts +37 -0
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -0
- package/dist/esm/components/_internal/shell-sidebar.js +2 -0
- package/dist/esm/components/_internal/shell-sidebar.js.map +7 -0
- package/dist/esm/components/schemas/index.d.ts +2 -0
- package/dist/esm/components/schemas/index.d.ts.map +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/index.js.map +3 -3
- package/dist/esm/components/schemas/shell.schema.d.ts +1025 -0
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -0
- package/dist/esm/components/schemas/shell.schema.js +2 -0
- package/dist/esm/components/schemas/shell.schema.js.map +7 -0
- package/dist/esm/components/shell.context.d.ts +37 -0
- package/dist/esm/components/shell.context.d.ts.map +1 -0
- package/dist/esm/components/shell.context.js +2 -0
- package/dist/esm/components/shell.context.js.map +7 -0
- package/dist/esm/components/shell.d.ts +6 -68
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.d.ts +3 -0
- package/dist/esm/components/shell.hooks.d.ts.map +1 -0
- package/dist/esm/components/shell.hooks.js +2 -0
- package/dist/esm/components/shell.hooks.js.map +7 -0
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/dist/esm/components/shell.types.d.ts +20 -0
- package/dist/esm/components/shell.types.d.ts.map +1 -0
- package/dist/esm/components/shell.types.js +2 -0
- package/dist/esm/components/shell.types.js.map +7 -0
- package/dist/esm/components/sidebar.d.ts +1 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/sidebar.js.map +2 -2
- package/layout/utilities.css +168 -84
- package/layout.css +168 -84
- package/package.json +2 -1
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/shell-bottom.json +168 -0
- package/schemas/shell-content.json +34 -0
- package/schemas/shell-handle.json +34 -0
- package/schemas/shell-header.json +42 -0
- package/schemas/shell-inspector.json +171 -0
- package/schemas/shell-panel.json +167 -0
- package/schemas/shell-rail.json +132 -0
- package/schemas/shell-root.json +54 -0
- package/schemas/shell-sidebar.json +182 -0
- package/schemas/shell-trigger.json +76 -0
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/shell-bottom.tsx +251 -0
- package/src/components/_internal/shell-handles.tsx +193 -0
- package/src/components/_internal/shell-inspector.tsx +242 -0
- package/src/components/_internal/shell-resize.tsx +30 -0
- package/src/components/_internal/shell-sidebar.tsx +347 -0
- package/src/components/schemas/index.ts +46 -0
- package/src/components/schemas/shell.schema.ts +403 -0
- package/src/components/shell.context.tsx +56 -0
- package/src/components/shell.css +5 -17
- package/src/components/shell.hooks.ts +31 -0
- package/src/components/shell.tsx +368 -1684
- package/src/components/shell.types.ts +27 -0
- package/src/components/sidebar.tsx +1 -1
- package/src/styles/tokens/blur.css +2 -2
- package/src/styles/tokens/color.css +2 -2
- package/styles.css +1031 -116
- package/tokens/base.css +5 -2
- package/tokens.css +5 -2
- package/utilities.css +168 -84
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.schema.d.ts","sourceRoot":"","sources":["../../../../src/components/schemas/shell.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AAGH,QAAA,MAAM,cAAc,sCAAgE,CAAC;AACrF,QAAA,MAAM,iBAAiB,8CAA2E,CAAC;AACnG,QAAA,MAAM,uBAAuB,4CAEG,CAAC;AACjC,QAAA,MAAM,gBAAgB,sDAEc,CAAC;AACrC,QAAA,MAAM,gBAAgB,wEAEI,CAAC;AAC3B,QAAA,MAAM,mBAAmB,6CAAsE,CAAC;AAGhG,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;IAYuB,CAAC;AAElD,QAAA,MAAM,2BAA2B;;;;;;;;;;;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OAAO,GAAG,iBAAiB,CAKxE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAK5E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAKtE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAKxE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAKtE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var S=(n,t)=>{for(var a in t)c(n,a,{get:t[a],enumerable:!0})},f=(n,t,a,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of m(t))!b.call(n,l)&&l!==a&&c(n,l,{get:()=>t[l],enumerable:!(d=u(t,l))||d.enumerable});return n};var g=n=>f(c({},"__esModule",{value:!0}),n);var L={};S(L,{ShellBottomSchema:()=>C,ShellContentSchema:()=>E,ShellHandleSchema:()=>I,ShellHeaderSchema:()=>R,ShellInspectorSchema:()=>k,ShellPanelSchema:()=>M,ShellRailSchema:()=>w,ShellRootSchema:()=>v,ShellSidebarSchema:()=>N,ShellTriggerSchema:()=>H,parseShellBottomProps:()=>B,parseShellContentProps:()=>O,parseShellHandleProps:()=>q,parseShellHeaderProps:()=>T,parseShellInspectorProps:()=>W,parseShellPanelProps:()=>V,parseShellRailProps:()=>D,parseShellRootProps:()=>A,parseShellSidebarProps:()=>j,parseShellTriggerProps:()=>_});module.exports=g(L);var e=require("zod");const o=e.z.enum(["expanded","collapsed"]).describe("Pane state mode"),r=e.z.enum(["collapsed","thin","expanded"]).describe("Sidebar state mode"),i=e.z.enum(["fixed","overlay","stacked"]).describe("Presentation mode"),G=e.z.enum(["initial","xs","sm","md","lg","xl"]).describe("Responsive breakpoint"),x=e.z.enum(["left","rail","panel","sidebar","inspector","bottom"]).describe("Pane target"),P=e.z.enum(["toggle","expand","collapse"]).describe("Trigger action"),h=e.z.union([o,e.z.object({initial:o.optional(),xs:o.optional(),sm:o.optional(),md:o.optional(),lg:o.optional(),xl:o.optional()})]).describe("Responsive pane mode configuration"),y=e.z.union([r,e.z.object({initial:r.optional(),xs:r.optional(),sm:r.optional(),md:r.optional(),lg:r.optional(),xl:r.optional()})]).describe("Responsive sidebar mode configuration"),s=e.z.union([i,e.z.object({initial:i.optional(),xs:i.optional(),sm:i.optional(),md:i.optional(),lg:i.optional(),xl:i.optional()})]).describe("Responsive presentation configuration"),z=e.z.object({load:e.z.function().returns(e.z.union([e.z.number(),e.z.promise(e.z.number()),e.z.undefined()])).optional(),save:e.z.function().args(e.z.number()).returns(e.z.union([e.z.void(),e.z.promise(e.z.void())])).optional()}).describe("Size persistence adapter"),p=e.z.object({presentation:s.optional(),mode:o.optional(),defaultMode:h.optional(),onModeChange:e.z.function().args(o).returns(e.z.void()).optional(),expandedSize:e.z.number().optional(),minSize:e.z.number().optional(),maxSize:e.z.number().optional(),resizable:e.z.boolean().optional(),collapsible:e.z.boolean().optional(),onExpand:e.z.function().returns(e.z.void()).optional(),onCollapse:e.z.function().returns(e.z.void()).optional(),onResize:e.z.function().args(e.z.number()).returns(e.z.void()).optional(),resizer:e.z.any().optional(),onResizeStart:e.z.function().args(e.z.number()).returns(e.z.void()).optional(),onResizeEnd:e.z.function().args(e.z.number()).returns(e.z.void()).optional(),snapPoints:e.z.array(e.z.number()).optional(),snapTolerance:e.z.number().optional(),collapseThreshold:e.z.number().optional(),paneId:e.z.string().optional(),persistence:z.optional(),className:e.z.string().optional(),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional(),children:e.z.any().optional()}).strict(),v=e.z.object({height:e.z.union([e.z.literal("full"),e.z.literal("auto"),e.z.string(),e.z.number()]).default("full").describe("Height of the shell container"),className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Shell components")}).strict(),R=e.z.object({height:e.z.union([e.z.string(),e.z.number()]).default(64).describe("Height of the header"),className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Header content")}).strict(),w=e.z.object({presentation:s.optional(),mode:o.optional(),defaultMode:h.optional(),onModeChange:e.z.function().args(o).returns(e.z.void()).optional(),expandedSize:e.z.number().default(64).describe("Default width in pixels"),collapsible:e.z.boolean().optional(),onExpand:e.z.function().returns(e.z.void()).optional(),onCollapse:e.z.function().returns(e.z.void()).optional(),className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Rail content")}).strict(),M=p.extend({expandedSize:e.z.number().default(288).describe("Default width in pixels"),minSize:e.z.number().default(200).describe("Minimum width when resizing"),maxSize:e.z.number().default(800).describe("Maximum width when resizing"),resizable:e.z.boolean().default(!1).describe("Whether the panel can be resized"),collapsible:e.z.boolean().default(!0).describe("Whether the panel can be collapsed via resize handle")}).strict(),N=p.extend({mode:r.optional(),defaultMode:y.default("expanded").describe("Initial sidebar mode"),expandedSize:e.z.number().default(288).describe("Default width in pixels"),minSize:e.z.number().default(200).describe("Minimum width when resizing"),maxSize:e.z.number().default(400).describe("Maximum width when resizing"),thinSize:e.z.number().default(64).describe("Width in thin mode"),toggleModes:e.z.enum(["both","single"]).optional().describe("Available modes in toggle sequence"),resizable:e.z.boolean().default(!1).describe("Whether the sidebar can be resized"),collapsible:e.z.boolean().default(!0).describe("Whether the sidebar can be collapsed via resize handle")}).strict(),E=e.z.object({className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Main content")}).strict(),k=p.extend({presentation:s.default({initial:"overlay",lg:"fixed"}).describe("Presentation mode"),expandedSize:e.z.number().default(320).describe("Default width in pixels"),minSize:e.z.number().default(200).describe("Minimum width when resizing"),maxSize:e.z.number().default(500).describe("Maximum width when resizing"),resizable:e.z.boolean().default(!1).describe("Whether the inspector can be resized"),collapsible:e.z.boolean().default(!0).describe("Whether the inspector can be collapsed via resize handle")}).strict(),C=p.extend({presentation:s.default("fixed").describe("Presentation mode"),expandedSize:e.z.number().default(200).describe("Default height in pixels"),minSize:e.z.number().default(100).describe("Minimum height when resizing"),maxSize:e.z.number().default(400).describe("Maximum height when resizing"),resizable:e.z.boolean().default(!1).describe("Whether the bottom panel can be resized"),collapsible:e.z.boolean().default(!0).describe("Whether the bottom panel can be collapsed via resize handle")}).strict(),H=e.z.object({target:x.describe("Which pane to control"),action:P.default("toggle").describe("Action to perform"),peekOnHover:e.z.boolean().default(!1).describe("Whether to show peek preview on hover when collapsed"),className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Trigger content"),onClick:e.z.function().optional().describe("Click handler"),onMouseEnter:e.z.function().optional().describe("Mouse enter handler"),onMouseLeave:e.z.function().optional().describe("Mouse leave handler"),"aria-label":e.z.string().optional().describe("ARIA label for accessibility"),"aria-labelledby":e.z.string().optional().describe("ARIA labelled by reference"),"aria-describedby":e.z.string().optional().describe("ARIA described by reference")}).strict(),I=e.z.object({className:e.z.string().optional().describe("Additional CSS class name"),style:e.z.record(e.z.string(),e.z.union([e.z.string(),e.z.number()])).optional().describe("Inline styles"),children:e.z.any().optional().describe("Handle content")}).strict();function A(n){return n}function T(n){return n}function D(n){return n}function V(n){return n}function j(n){return n}function O(n){return n}function W(n){return n}function B(n){return n}function _(n){return n}function q(n){return n}
|
|
2
|
+
//# sourceMappingURL=shell.schema.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/schemas/shell.schema.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\n\n/**\n * Shell Zod schema - Single source of truth for Shell component props\n *\n * The Shell component is a layout engine that provides structural patterns for building\n * application interfaces. It manages layout state, composition rules, and responsive\n * behavior across seven core slots.\n *\n * @example\n * ```tsx\n * // Basic shell validation\n * const props = ShellRootSchema.parse({ height: 'full' });\n *\n * // Shell with responsive sidebar\n * const sidebarProps = ShellSidebarSchema.parse({\n * defaultMode: { initial: 'collapsed', md: 'expanded' },\n * presentation: { initial: 'overlay', lg: 'fixed' }\n * });\n * ```\n */\n\n// Common types\nconst PaneModeSchema = z.enum(['expanded', 'collapsed']).describe('Pane state mode');\nconst SidebarModeSchema = z.enum(['collapsed', 'thin', 'expanded']).describe('Sidebar state mode');\nconst PresentationValueSchema = z\n .enum(['fixed', 'overlay', 'stacked'])\n .describe('Presentation mode');\nconst BreakpointSchema = z\n .enum(['initial', 'xs', 'sm', 'md', 'lg', 'xl'])\n .describe('Responsive breakpoint');\nconst PaneTargetSchema = z\n .enum(['left', 'rail', 'panel', 'sidebar', 'inspector', 'bottom'])\n .describe('Pane target');\nconst TriggerActionSchema = z.enum(['toggle', 'expand', 'collapse']).describe('Trigger action');\n\n// Responsive schemas\nconst ResponsiveModeSchema = z\n .union([\n PaneModeSchema,\n z.object({\n initial: PaneModeSchema.optional(),\n xs: PaneModeSchema.optional(),\n sm: PaneModeSchema.optional(),\n md: PaneModeSchema.optional(),\n lg: PaneModeSchema.optional(),\n xl: PaneModeSchema.optional(),\n }),\n ])\n .describe('Responsive pane mode configuration');\n\nconst ResponsiveSidebarModeSchema = z\n .union([\n SidebarModeSchema,\n z.object({\n initial: SidebarModeSchema.optional(),\n xs: SidebarModeSchema.optional(),\n sm: SidebarModeSchema.optional(),\n md: SidebarModeSchema.optional(),\n lg: SidebarModeSchema.optional(),\n xl: SidebarModeSchema.optional(),\n }),\n ])\n .describe('Responsive sidebar mode configuration');\n\nconst ResponsivePresentationSchema = z\n .union([\n PresentationValueSchema,\n z.object({\n initial: PresentationValueSchema.optional(),\n xs: PresentationValueSchema.optional(),\n sm: PresentationValueSchema.optional(),\n md: PresentationValueSchema.optional(),\n lg: PresentationValueSchema.optional(),\n xl: PresentationValueSchema.optional(),\n }),\n ])\n .describe('Responsive presentation configuration');\n\n// Size persistence adapter\nconst PaneSizePersistenceSchema = z\n .object({\n load: z\n .function()\n .returns(z.union([z.number(), z.promise(z.number()), z.undefined()]))\n .optional(),\n save: z\n .function()\n .args(z.number())\n .returns(z.union([z.void(), z.promise(z.void())]))\n .optional(),\n })\n .describe('Size persistence adapter');\n\n// Common pane props\nconst PanePropsSchema = z\n .object({\n presentation: ResponsivePresentationSchema.optional(),\n mode: PaneModeSchema.optional(),\n defaultMode: ResponsiveModeSchema.optional(),\n onModeChange: z.function().args(PaneModeSchema).returns(z.void()).optional(),\n expandedSize: z.number().optional(),\n minSize: z.number().optional(),\n maxSize: z.number().optional(),\n resizable: z.boolean().optional(),\n collapsible: z.boolean().optional(),\n onExpand: z.function().returns(z.void()).optional(),\n onCollapse: z.function().returns(z.void()).optional(),\n onResize: z.function().args(z.number()).returns(z.void()).optional(),\n resizer: z.any().optional(),\n onResizeStart: z.function().args(z.number()).returns(z.void()).optional(),\n onResizeEnd: z.function().args(z.number()).returns(z.void()).optional(),\n snapPoints: z.array(z.number()).optional(),\n snapTolerance: z.number().optional(),\n collapseThreshold: z.number().optional(),\n paneId: z.string().optional(),\n persistence: PaneSizePersistenceSchema.optional(),\n className: z.string().optional(),\n style: z.record(z.string(), z.union([z.string(), z.number()])).optional(),\n children: z.any().optional(),\n })\n .strict();\n\n/**\n * Shell.Root component schema\n */\nexport const ShellRootSchema = z\n .object({\n height: z\n .union([z.literal('full'), z.literal('auto'), z.string(), z.number()])\n .default('full')\n .describe('Height of the shell container'),\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Shell components'),\n })\n .strict();\n\n/**\n * Shell.Header component schema\n */\nexport const ShellHeaderSchema = z\n .object({\n height: z.union([z.string(), z.number()]).default(64).describe('Height of the header'),\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Header content'),\n })\n .strict();\n\n/**\n * Shell.Rail component schema\n */\nexport const ShellRailSchema = z\n .object({\n presentation: ResponsivePresentationSchema.optional(),\n mode: PaneModeSchema.optional(),\n defaultMode: ResponsiveModeSchema.optional(),\n onModeChange: z.function().args(PaneModeSchema).returns(z.void()).optional(),\n expandedSize: z.number().default(64).describe('Default width in pixels'),\n collapsible: z.boolean().optional(),\n onExpand: z.function().returns(z.void()).optional(),\n onCollapse: z.function().returns(z.void()).optional(),\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Rail content'),\n })\n .strict();\n\n/**\n * Shell.Panel component schema\n */\nexport const ShellPanelSchema = PanePropsSchema.extend({\n expandedSize: z.number().default(288).describe('Default width in pixels'),\n minSize: z.number().default(200).describe('Minimum width when resizing'),\n maxSize: z.number().default(800).describe('Maximum width when resizing'),\n resizable: z.boolean().default(false).describe('Whether the panel can be resized'),\n collapsible: z\n .boolean()\n .default(true)\n .describe('Whether the panel can be collapsed via resize handle'),\n}).strict();\n\n/**\n * Shell.Sidebar component schema\n */\nexport const ShellSidebarSchema = PanePropsSchema.extend({\n mode: SidebarModeSchema.optional(),\n defaultMode: ResponsiveSidebarModeSchema.default('expanded').describe('Initial sidebar mode'),\n expandedSize: z.number().default(288).describe('Default width in pixels'),\n minSize: z.number().default(200).describe('Minimum width when resizing'),\n maxSize: z.number().default(400).describe('Maximum width when resizing'),\n thinSize: z.number().default(64).describe('Width in thin mode'),\n toggleModes: z.enum(['both', 'single']).optional().describe('Available modes in toggle sequence'),\n resizable: z.boolean().default(false).describe('Whether the sidebar can be resized'),\n collapsible: z\n .boolean()\n .default(true)\n .describe('Whether the sidebar can be collapsed via resize handle'),\n}).strict();\n\n/**\n * Shell.Content component schema\n */\nexport const ShellContentSchema = z\n .object({\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Main content'),\n })\n .strict();\n\n/**\n * Shell.Inspector component schema\n */\nexport const ShellInspectorSchema = PanePropsSchema.extend({\n presentation: ResponsivePresentationSchema.default({ initial: 'overlay', lg: 'fixed' }).describe(\n 'Presentation mode',\n ),\n expandedSize: z.number().default(320).describe('Default width in pixels'),\n minSize: z.number().default(200).describe('Minimum width when resizing'),\n maxSize: z.number().default(500).describe('Maximum width when resizing'),\n resizable: z.boolean().default(false).describe('Whether the inspector can be resized'),\n collapsible: z\n .boolean()\n .default(true)\n .describe('Whether the inspector can be collapsed via resize handle'),\n}).strict();\n\n/**\n * Shell.Bottom component schema\n */\nexport const ShellBottomSchema = PanePropsSchema.extend({\n presentation: ResponsivePresentationSchema.default('fixed').describe('Presentation mode'),\n expandedSize: z.number().default(200).describe('Default height in pixels'),\n minSize: z.number().default(100).describe('Minimum height when resizing'),\n maxSize: z.number().default(400).describe('Maximum height when resizing'),\n resizable: z.boolean().default(false).describe('Whether the bottom panel can be resized'),\n collapsible: z\n .boolean()\n .default(true)\n .describe('Whether the bottom panel can be collapsed via resize handle'),\n}).strict();\n\n/**\n * Shell.Trigger component schema\n */\nexport const ShellTriggerSchema = z\n .object({\n target: PaneTargetSchema.describe('Which pane to control'),\n action: TriggerActionSchema.default('toggle').describe('Action to perform'),\n peekOnHover: z\n .boolean()\n .default(false)\n .describe('Whether to show peek preview on hover when collapsed'),\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Trigger content'),\n onClick: z.function().optional().describe('Click handler'),\n onMouseEnter: z.function().optional().describe('Mouse enter handler'),\n onMouseLeave: z.function().optional().describe('Mouse leave handler'),\n 'aria-label': z.string().optional().describe('ARIA label for accessibility'),\n 'aria-labelledby': z.string().optional().describe('ARIA labelled by reference'),\n 'aria-describedby': z.string().optional().describe('ARIA described by reference'),\n })\n .strict();\n\n/**\n * Shell.Handle component schema (for resize handles)\n */\nexport const ShellHandleSchema = z\n .object({\n className: z.string().optional().describe('Additional CSS class name'),\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n children: z.any().optional().describe('Handle content'),\n })\n .strict();\n\n// Type exports\nexport type ShellRootProps = z.infer<typeof ShellRootSchema>;\nexport type ShellHeaderProps = z.infer<typeof ShellHeaderSchema>;\nexport type ShellRailProps = z.infer<typeof ShellRailSchema>;\nexport type ShellPanelProps = z.infer<typeof ShellPanelSchema>;\nexport type ShellSidebarProps = z.infer<typeof ShellSidebarSchema>;\nexport type ShellContentProps = z.infer<typeof ShellContentSchema>;\nexport type ShellInspectorProps = z.infer<typeof ShellInspectorSchema>;\nexport type ShellBottomProps = z.infer<typeof ShellBottomSchema>;\nexport type ShellTriggerProps = z.infer<typeof ShellTriggerSchema>;\nexport type ShellHandleProps = z.infer<typeof ShellHandleSchema>;\n\n// Common type exports\nexport type PaneMode = z.infer<typeof PaneModeSchema>;\nexport type SidebarMode = z.infer<typeof SidebarModeSchema>;\nexport type PresentationValue = z.infer<typeof PresentationValueSchema>;\nexport type Breakpoint = z.infer<typeof BreakpointSchema>;\nexport type PaneTarget = z.infer<typeof PaneTargetSchema>;\nexport type TriggerAction = z.infer<typeof TriggerActionSchema>;\nexport type ResponsiveMode = z.infer<typeof ResponsiveModeSchema>;\nexport type ResponsiveSidebarMode = z.infer<typeof ResponsiveSidebarModeSchema>;\nexport type ResponsivePresentation = z.infer<typeof ResponsivePresentationSchema>;\nexport type PaneSizePersistence = z.infer<typeof PaneSizePersistenceSchema>;\n\n/**\n * Development-only helper to validate and normalize Shell props\n * This function should only be used in development mode\n *\n * @param props - Props to validate and normalize\n * @returns Validated and normalized props\n *\n * @example\n * ```tsx\n * // In development, this will validate props and show helpful errors\n * const validatedProps = parseShellRootProps({ height: 'invalid' });\n * // Throws validation errors for invalid values\n * ```\n */\nexport function parseShellRootProps(props: unknown): ShellRootProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellRootSchema.parse(props);\n }\n return props as ShellRootProps;\n}\n\nexport function parseShellHeaderProps(props: unknown): ShellHeaderProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellHeaderSchema.parse(props);\n }\n return props as ShellHeaderProps;\n}\n\nexport function parseShellRailProps(props: unknown): ShellRailProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellRailSchema.parse(props);\n }\n return props as ShellRailProps;\n}\n\nexport function parseShellPanelProps(props: unknown): ShellPanelProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellPanelSchema.parse(props);\n }\n return props as ShellPanelProps;\n}\n\nexport function parseShellSidebarProps(props: unknown): ShellSidebarProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellSidebarSchema.parse(props);\n }\n return props as ShellSidebarProps;\n}\n\nexport function parseShellContentProps(props: unknown): ShellContentProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellContentSchema.parse(props);\n }\n return props as ShellContentProps;\n}\n\nexport function parseShellInspectorProps(props: unknown): ShellInspectorProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellInspectorSchema.parse(props);\n }\n return props as ShellInspectorProps;\n}\n\nexport function parseShellBottomProps(props: unknown): ShellBottomProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellBottomSchema.parse(props);\n }\n return props as ShellBottomProps;\n}\n\nexport function parseShellTriggerProps(props: unknown): ShellTriggerProps {\n if (process.env.NODE_ENV === 'development') {\n return ShellTriggerSchema.parse(props);\n }\n return props as ShellTriggerProps;\n}\n\nexport function parseShellHandleProps(props: unknown): ShellHandleProps {\n if (process.env.NODE_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EO,SAASrB,EAAsBqB,EAAkC,CAItE,OAAOA,CACT",
|
|
6
|
+
"names": ["shell_schema_exports", "__export", "ShellBottomSchema", "ShellContentSchema", "ShellHandleSchema", "ShellHeaderSchema", "ShellInspectorSchema", "ShellPanelSchema", "ShellRailSchema", "ShellRootSchema", "ShellSidebarSchema", "ShellTriggerSchema", "parseShellBottomProps", "parseShellContentProps", "parseShellHandleProps", "parseShellHeaderProps", "parseShellInspectorProps", "parseShellPanelProps", "parseShellRailProps", "parseShellRootProps", "parseShellSidebarProps", "parseShellTriggerProps", "__toCommonJS", "import_zod", "PaneModeSchema", "SidebarModeSchema", "PresentationValueSchema", "BreakpointSchema", "PaneTargetSchema", "TriggerActionSchema", "ResponsiveModeSchema", "ResponsiveSidebarModeSchema", "ResponsivePresentationSchema", "PaneSizePersistenceSchema", "PanePropsSchema", "props"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Breakpoint, PresentationValue, SidebarMode, PaneMode, PaneTarget } from './shell.types.js';
|
|
3
|
+
export interface ShellContextValue {
|
|
4
|
+
leftMode: PaneMode;
|
|
5
|
+
setLeftMode: (mode: PaneMode) => void;
|
|
6
|
+
panelMode: PaneMode;
|
|
7
|
+
setPanelMode: (mode: PaneMode) => void;
|
|
8
|
+
sidebarMode: SidebarMode;
|
|
9
|
+
setSidebarMode: (mode: SidebarMode) => void;
|
|
10
|
+
inspectorMode: PaneMode;
|
|
11
|
+
setInspectorMode: (mode: PaneMode) => void;
|
|
12
|
+
bottomMode: PaneMode;
|
|
13
|
+
setBottomMode: (mode: PaneMode) => void;
|
|
14
|
+
peekTarget: PaneTarget | null;
|
|
15
|
+
setPeekTarget: (target: PaneTarget | null) => void;
|
|
16
|
+
peekPane: (target: PaneTarget) => void;
|
|
17
|
+
clearPeek: () => void;
|
|
18
|
+
hasLeft: boolean;
|
|
19
|
+
setHasLeft: (has: boolean) => void;
|
|
20
|
+
hasSidebar: boolean;
|
|
21
|
+
setHasSidebar: (has: boolean) => void;
|
|
22
|
+
currentBreakpoint: Breakpoint;
|
|
23
|
+
currentBreakpointReady: boolean;
|
|
24
|
+
leftResolvedPresentation?: PresentationValue;
|
|
25
|
+
togglePane: (target: PaneTarget) => void;
|
|
26
|
+
expandPane: (target: PaneTarget) => void;
|
|
27
|
+
collapsePane: (target: PaneTarget) => void;
|
|
28
|
+
setSidebarToggleComputer?: (fn: (current: SidebarMode) => SidebarMode) => void;
|
|
29
|
+
onLeftPres?: (p: PresentationValue) => void;
|
|
30
|
+
onLeftDefaults?: (size: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function useShell(): ShellContextValue;
|
|
33
|
+
export declare function ShellProvider({ value, children }: {
|
|
34
|
+
value: ShellContextValue;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
//# sourceMappingURL=shell.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.context.d.ts","sourceRoot":"","sources":["../../../src/components/shell.context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzG,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvC,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,QAAQ,CAAC;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IA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1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.create;var n=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var p=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},l=(e,o,t,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of u(o))!v.call(e,a)&&a!==t&&n(e,a,{get:()=>o[a],enumerable:!(d=P(o,a))||d.enumerable});return e};var b=(e,o,t)=>(t=e!=null?s(M(e)):{},l(o||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),c=e=>l(n({},"__esModule",{value:!0}),e);var h={};p(h,{ShellProvider:()=>S,useShell:()=>g});module.exports=c(h);var r=b(require("react"));const i=r.createContext(null);function g(){const e=r.useContext(i);if(!e)throw new Error("Shell components must be used within <Shell.Root>");return e}function S({value:e,children:o}){return r.createElement(i.Provider,{value:e},o)}
|
|
2
|
+
//# sourceMappingURL=shell.context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/shell.context.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport type { Breakpoint, PresentationValue, SidebarMode, PaneMode, PaneTarget } from './shell.types.js';\n\nexport interface ShellContextValue {\n // Pane states\n leftMode: PaneMode;\n setLeftMode: (mode: PaneMode) => void;\n panelMode: PaneMode; // Panel state within left container\n setPanelMode: (mode: PaneMode) => void;\n sidebarMode: SidebarMode;\n setSidebarMode: (mode: SidebarMode) => void;\n inspectorMode: PaneMode;\n setInspectorMode: (mode: PaneMode) => void;\n bottomMode: PaneMode;\n setBottomMode: (mode: PaneMode) => void;\n\n // Peek state (layout-only, ephemeral)\n peekTarget: PaneTarget | null;\n setPeekTarget: (target: PaneTarget | null) => void;\n peekPane: (target: PaneTarget) => void;\n clearPeek: () => void;\n\n // Composition detection\n hasLeft: boolean;\n setHasLeft: (has: boolean) => void;\n hasSidebar: boolean;\n setHasSidebar: (has: boolean) => void;\n\n // Presentation resolution\n currentBreakpoint: Breakpoint;\n currentBreakpointReady: boolean;\n leftResolvedPresentation?: PresentationValue;\n\n // Actions\n togglePane: (target: PaneTarget) => void;\n expandPane: (target: PaneTarget) => void;\n collapsePane: (target: PaneTarget) => void;\n // Toggle customization\n setSidebarToggleComputer?: (fn: (current: SidebarMode) => SidebarMode) => void;\n // Dev-only hooks for presentation warnings\n onLeftPres?: (p: PresentationValue) => void;\n // Sizing info for overlay grouping\n onLeftDefaults?: (size: number) => void;\n}\n\nconst ShellContext = React.createContext<ShellContextValue | null>(null);\n\nexport function useShell() {\n const ctx = React.useContext(ShellContext);\n if (!ctx) throw new Error('Shell components must be used within <Shell.Root>');\n return ctx;\n}\n\nexport function ShellProvider({ value, children }: { value: ShellContextValue; children: React.ReactNode }) {\n return <ShellContext.Provider value={value}>{children}</ShellContext.Provider>;\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,aAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAuB,oBA6CvB,MAAMC,EAAeD,EAAM,cAAwC,IAAI,EAEhE,SAASF,GAAW,CACzB,MAAMI,EAAMF,EAAM,WAAWC,CAAY,EACzC,GAAI,CAACC,EAAK,MAAM,IAAI,MAAM,mDAAmD,EAC7E,OAAOA,CACT,CAEO,SAASL,EAAc,CAAE,MAAAM,EAAO,SAAAC,CAAS,EAA4D,CAC1G,OAAOJ,EAAA,cAACC,EAAa,SAAb,CAAsB,MAAOE,GAAQC,CAAS,CACxD",
|
|
6
|
+
"names": ["shell_context_exports", "__export", "ShellProvider", "useShell", "__toCommonJS", "React", "ShellContext", "ctx", "value", "children"]
|
|
7
|
+
}
|
|
@@ -1,53 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
type PaneSizePersistence = {
|
|
9
|
-
load?: () => number | Promise<number | undefined> | undefined;
|
|
10
|
-
save?: (size: number) => void | Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
declare const BREAKPOINTS: {
|
|
13
|
-
readonly xs: "(min-width: 520px)";
|
|
14
|
-
readonly sm: "(min-width: 768px)";
|
|
15
|
-
readonly md: "(min-width: 1024px)";
|
|
16
|
-
readonly lg: "(min-width: 1280px)";
|
|
17
|
-
readonly xl: "(min-width: 1640px)";
|
|
18
|
-
};
|
|
19
|
-
type Breakpoint = 'initial' | keyof typeof BREAKPOINTS;
|
|
20
|
-
interface ShellContextValue {
|
|
21
|
-
leftMode: PaneMode;
|
|
22
|
-
setLeftMode: (mode: PaneMode) => void;
|
|
23
|
-
panelMode: PaneMode;
|
|
24
|
-
setPanelMode: (mode: PaneMode) => void;
|
|
25
|
-
sidebarMode: SidebarMode;
|
|
26
|
-
setSidebarMode: (mode: SidebarMode) => void;
|
|
27
|
-
inspectorMode: PaneMode;
|
|
28
|
-
setInspectorMode: (mode: PaneMode) => void;
|
|
29
|
-
bottomMode: PaneMode;
|
|
30
|
-
setBottomMode: (mode: PaneMode) => void;
|
|
31
|
-
peekTarget: PaneTarget | null;
|
|
32
|
-
setPeekTarget: (target: PaneTarget | null) => void;
|
|
33
|
-
peekPane: (target: PaneTarget) => void;
|
|
34
|
-
clearPeek: () => void;
|
|
35
|
-
hasLeft: boolean;
|
|
36
|
-
setHasLeft: (has: boolean) => void;
|
|
37
|
-
hasSidebar: boolean;
|
|
38
|
-
setHasSidebar: (has: boolean) => void;
|
|
39
|
-
currentBreakpoint: Breakpoint;
|
|
40
|
-
currentBreakpointReady: boolean;
|
|
41
|
-
leftResolvedPresentation?: PresentationValue;
|
|
42
|
-
togglePane: (target: PaneTarget) => void;
|
|
43
|
-
expandPane: (target: PaneTarget) => void;
|
|
44
|
-
collapsePane: (target: PaneTarget) => void;
|
|
45
|
-
setSidebarToggleComputer?: (fn: (current: SidebarMode) => SidebarMode) => void;
|
|
46
|
-
onLeftPres?: (p: PresentationValue) => void;
|
|
47
|
-
onLeftDefaults?: (size: number) => void;
|
|
48
|
-
}
|
|
49
|
-
declare function useShell(): ShellContextValue;
|
|
50
|
-
declare function useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue;
|
|
2
|
+
import { useResponsivePresentation } from './shell.hooks.js';
|
|
3
|
+
import { Sidebar } from './_internal/shell-sidebar.js';
|
|
4
|
+
import { Bottom } from './_internal/shell-bottom.js';
|
|
5
|
+
import { Inspector } from './_internal/shell-inspector.js';
|
|
6
|
+
import type { ResponsivePresentation, PaneMode, SidebarMode, ResponsiveMode, PaneSizePersistence, PaneTarget } from './shell.types.js';
|
|
7
|
+
import { useShell } from './shell.context.js';
|
|
51
8
|
interface ShellRootProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
52
9
|
children: React.ReactNode;
|
|
53
10
|
height?: 'full' | 'auto' | string | number;
|
|
@@ -105,29 +62,10 @@ type HandleComponent = React.ForwardRefExoticComponent<React.ComponentPropsWitho
|
|
|
105
62
|
type PanelComponent = React.ForwardRefExoticComponent<Omit<PaneProps, 'defaultMode'> & React.RefAttributes<HTMLDivElement>> & {
|
|
106
63
|
Handle: HandleComponent;
|
|
107
64
|
};
|
|
108
|
-
type SidebarComponent = React.ForwardRefExoticComponent<(Omit<PaneProps, 'mode' | 'defaultMode' | 'onModeChange'> & {
|
|
109
|
-
mode?: SidebarMode;
|
|
110
|
-
defaultMode?: ResponsiveSidebarMode;
|
|
111
|
-
onModeChange?: (mode: SidebarMode) => void;
|
|
112
|
-
thinSize?: number;
|
|
113
|
-
toggleModes?: 'both' | 'single';
|
|
114
|
-
}) & React.RefAttributes<HTMLDivElement>> & {
|
|
115
|
-
Handle: HandleComponent;
|
|
116
|
-
};
|
|
117
|
-
type InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & {
|
|
118
|
-
Handle: HandleComponent;
|
|
119
|
-
};
|
|
120
|
-
type BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & {
|
|
121
|
-
Handle: HandleComponent;
|
|
122
|
-
};
|
|
123
65
|
declare const Panel: PanelComponent;
|
|
124
|
-
declare const Sidebar: SidebarComponent;
|
|
125
66
|
interface ShellContentProps extends React.ComponentPropsWithoutRef<'main'> {
|
|
126
67
|
}
|
|
127
68
|
declare const Content: React.ForwardRefExoticComponent<ShellContentProps & React.RefAttributes<HTMLElement>>;
|
|
128
|
-
declare const Inspector: InspectorComponent;
|
|
129
|
-
declare const Bottom: BottomComponent;
|
|
130
|
-
type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';
|
|
131
69
|
type TriggerAction = 'toggle' | 'expand' | 'collapse';
|
|
132
70
|
interface TriggerProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
133
71
|
target: PaneTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,KAAK,EAAqB,sBAAsB,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAyB,mBAAmB,EAAc,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7L,OAAO,EAAiB,QAAQ,EAAE,MAAM,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AAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAiB1J,QAAA,MAAM,KAAK,EAqKN,cAAc,CAAC;AAOpB,UAAU,iBAAkB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC;CAAG;AAE7E,QAAA,MAAM,OAAO,uFAAyK,CAAC;AAWvL,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,wFAqEX,CAAC;AAIH,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.hooks.d.ts","sourceRoot":"","sources":["../../../src/components/shell.hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI9F,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,sBAAsB,GAAG,iBAAiB,CAyBjG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.create;var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var B=(e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})},p=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of m(r))!k.call(e,o)&&o!==t&&n(e,o,{get:()=>r[o],enumerable:!(s=l(r,o))||s.enumerable});return e};var P=(e,r,t)=>(t=e!=null?c(y(e)):{},p(r||!e||!e.__esModule?n(t,"default",{value:e,enumerable:!0}):t,e)),R=e=>p(n({},"__esModule",{value:!0}),e);var v={};B(v,{useResponsivePresentation:()=>d});module.exports=R(v);var b=P(require("react")),f=require("./shell.types.js"),u=require("./shell.context.js");function d(e){const{currentBreakpoint:r}=(0,u.useShell)();return b.useMemo(()=>{if(typeof e=="string")return e;if(e[r])return e[r];const s=[...Object.keys(f.BREAKPOINTS)].reverse().concat("initial"),o=s.indexOf(r);for(let i=o+1;i<s.length;i++){const a=s[i];if(e[a])return e[a]}return"fixed"},[e,r])}
|
|
2
|
+
//# sourceMappingURL=shell.hooks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/shell.hooks.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport type { Breakpoint, PresentationValue, ResponsivePresentation } from './shell.types.js';\nimport { BREAKPOINTS } from './shell.types.js';\nimport { useShell } from './shell.context.js';\n\nexport function useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue {\n const { currentBreakpoint } = useShell();\n\n return React.useMemo(() => {\n if (typeof presentation === 'string') {\n return presentation;\n }\n\n if (presentation[currentBreakpoint]) {\n return presentation[currentBreakpoint]!;\n }\n\n const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;\n const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);\n const startIdx = order.indexOf(currentBreakpoint as Breakpoint);\n\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (presentation[bp]) {\n return presentation[bp]!;\n }\n }\n\n return 'fixed';\n }, [presentation, currentBreakpoint]);\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBAEvBC,EAA4B,4BAC5BC,EAAyB,8BAElB,SAASJ,EAA0BK,EAAyD,CACjG,KAAM,CAAE,kBAAAC,CAAkB,KAAI,YAAS,EAEvC,OAAOJ,EAAM,QAAQ,IAAM,CACzB,GAAI,OAAOG,GAAiB,SAC1B,OAAOA,EAGT,GAAIA,EAAaC,CAAiB,EAChC,OAAOD,EAAaC,CAAiB,EAIvC,MAAMC,EAAuB,CAAC,GADf,OAAO,KAAK,aAAW,CACC,EAAE,QAAQ,EAAmB,OAAO,SAAuB,EAC5FC,EAAWD,EAAM,QAAQD,CAA+B,EAE9D,QAAS,EAAIE,EAAW,EAAG,EAAID,EAAM,OAAQ,IAAK,CAChD,MAAME,EAAKF,EAAM,CAAC,EAClB,GAAIF,EAAaI,CAAE,EACjB,OAAOJ,EAAaI,CAAE,CAE1B,CAEA,MAAO,OACT,EAAG,CAACJ,EAAcC,CAAiB,CAAC,CACtC",
|
|
6
|
+
"names": ["shell_hooks_exports", "__export", "useResponsivePresentation", "__toCommonJS", "React", "import_shell_types", "import_shell_context", "presentation", "currentBreakpoint", "order", "startIdx", "bp"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var Ce=Object.create;var me=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty;var Le=(a,d)=>{for(var o in d)me(a,o,{get:d[o],enumerable:!0})},Ee=(a,d,o,u)=>{if(d&&typeof d=="object"||typeof d=="function")for(let R of Be(d))!He.call(a,R)&&R!==o&&me(a,R,{get:()=>d[R],enumerable:!(u=Te(d,R))||u.enumerable});return a};var ke=(a,d,o)=>(o=a!=null?Ce(we(a)):{},Ee(d||!a||!a.__esModule?me(o,"default",{value:a,enumerable:!0}):o,a)),Ne=a=>Ee(me({},"__esModule",{value:!0}),a);var De={};Le(De,{Bottom:()=>fe,Content:()=>Re,Header:()=>Pe,Inspector:()=>ue,Left:()=>he,Panel:()=>ae,Rail:()=>oe,Root:()=>Se,Sidebar:()=>le,Trigger:()=>ge,useResponsivePresentation:()=>ie,useShell:()=>_});module.exports=Ne(De);var e=ke(require("react")),Q=ke(require("classnames")),J=ke(require("./sheet.js")),Oe=require("./inset.js"),pe=require("./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)"},xe=e.createContext(null);function _(){const a=e.useContext(xe);if(!a)throw new Error("Shell components must be used within <Shell.Root>");return a}const ce=e.createContext(null);function Ae(){const a=e.useContext(ce);if(!a)throw new Error("Shell.Handle must be used within a resizable pane");return a}const te=e.forwardRef(({className:a,children:d,...o},u)=>{const{containerRef:R,cssVarName:f,minSize:g,maxSize:P,defaultSize:h,orientation:y,edge:C,computeNext:L,onResize:r,onResizeStart:E,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,collapsible:K,target:O,requestCollapse:Y,requestToggle:S}=Ae(),m=e.useRef(null);e.useEffect(()=>()=>{try{m.current?.()}catch{}m.current=null},[]);const M=y;return e.createElement("div",{...o,ref:u,className:(0,Q.default)("rt-ShellResizer",a),"data-orientation":y,"data-edge":C,role:"slider","aria-orientation":M,"aria-valuemin":g,"aria-valuemax":P,"aria-valuenow":h,tabIndex:0,onPointerDown:t=>{if(!R.current)return;t.preventDefault();const b=R.current,n=t.currentTarget,I=t.pointerId;try{m.current?.()}catch{}b.setAttribute("data-resizing","");try{n.setPointerCapture(I)}catch{}const k=y==="vertical"?t.clientX:t.clientY,x=parseFloat(getComputedStyle(b).getPropertyValue(f)||`${h}`),v=i=>Math.min(Math.max(i,g),P),w=document.body,c=w.style.cursor,N=w.style.userSelect;w.style.cursor=y==="vertical"?"col-resize":"row-resize",w.style.userSelect="none",E?.(x);const V=i=>{const T=y==="vertical"?i.clientX:i.clientY,s=v(L(T,k,x));b.style.setProperty(f,`${s}px`),n.setAttribute("aria-valuenow",String(s)),r?.(s)},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),b.removeAttribute("data-resizing"),w.style.cursor=c,w.style.userSelect=N,m.current=null},H=()=>{const i=parseFloat(getComputedStyle(b).getPropertyValue(f)||`${h}`);let T=i;if(U&&U.length){const s=U.reduce((z,A)=>Math.abs(A-i)<Math.abs(z-i)?A:z,U[0]);Math.abs(s-i)<=(F??8)&&(T=s,b.style.setProperty(f,`${T}px`),n.setAttribute("aria-valuenow",String(T)),r?.(T))}K&&typeof W=="number"&&i<=W&&Y?.(),B?.(T),X()},j=i=>{i.key==="Escape"&&(b.style.setProperty(f,`${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),m.current=X},onDoubleClick:()=>{K&&S?.()},onKeyDown:t=>{if(!R.current)return;const b=R.current,n=parseFloat(getComputedStyle(b).getPropertyValue(f)||`${h}`),I=v=>Math.min(Math.max(v,g),P),k=t.shiftKey?32:8;let x=0;if(y==="vertical"?t.key==="ArrowRight"?x=k:t.key==="ArrowLeft"&&(x=-k):t.key==="ArrowDown"?x=k:t.key==="ArrowUp"&&(x=-k),t.key==="Home"){t.preventDefault(),E?.(n);const v=I(g);b.style.setProperty(f,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),r?.(v),B?.(v);return}if(t.key==="End"){t.preventDefault(),E?.(n);const v=I(P);b.style.setProperty(f,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),r?.(v),B?.(v);return}if(x!==0){t.preventDefault(),E?.(n);const v=I(n+(C==="start"&&y==="vertical"?-x:x));b.style.setProperty(f,`${v}px`),t.currentTarget.setAttribute("aria-valuenow",String(v)),r?.(v),B?.(v)}}},d)});te.displayName="Shell.Handle";const ye=e.forwardRef((a,d)=>e.createElement(te,{...a,ref:d}));ye.displayName="Shell.Panel.Handle";const be=e.forwardRef((a,d)=>e.createElement(te,{...a,ref:d}));be.displayName="Shell.Sidebar.Handle";const Me=e.forwardRef((a,d)=>e.createElement(te,{...a,ref:d}));Me.displayName="Shell.Inspector.Handle";const ve=e.forwardRef((a,d)=>e.createElement(te,{...a,ref:d}));ve.displayName="Shell.Bottom.Handle";function ie(a){const{currentBreakpoint:d}=_();return e.useMemo(()=>{if(typeof a=="string")return a;if(a[d])return a[d];const u=[...Object.keys(se)].reverse().concat("initial"),R=u.indexOf(d);for(let f=R+1;f<u.length;f++){const g=u[f];if(a[g])return a[g]}return"fixed"},[a,d])}function ze(){const[a,d]=e.useState("initial"),[o,u]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const f=Object.entries(se).map(([P,h])=>[P,window.matchMedia(h)]),g=()=>{const P=f.filter(([,y])=>y.matches).map(([y])=>y),h=P[P.length-1]??"initial";d(h),u(!0)};return g(),f.forEach(([,P])=>P.addEventListener("change",g)),()=>{f.forEach(([,P])=>P.removeEventListener("change",g))}},[]),{bp:a,ready:o}}const Se=e.forwardRef(({className:a,children:d,height:o="full",...u},R)=>{const{bp:f,ready:g}=ze(),[P,h]=e.useState("collapsed"),[y,C]=e.useState("collapsed"),[L,r]=e.useState("expanded"),[E,B]=e.useState("collapsed"),[U,F]=e.useState("collapsed"),[W,K]=e.useState(!1),[O,Y]=e.useState(!1),S=e.useRef(l=>l==="collapsed"?"thin":l==="thin"?"expanded":"collapsed"),m=e.useCallback(l=>{S.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[M,t]=e.useState(void 0),b=e.useCallback(l=>t(l),[]),n=e.useRef(64),I=e.useRef(288),k=e.useCallback(l=>{n.current=l},[]),x=e.useCallback(l=>{I.current=l},[]),v=e.useMemo(()=>{const l=e.Children.toArray(d),$=(G,de)=>e.isValidElement(G)&&(G.type===de||G.type?.displayName===de.displayName);return l.some(G=>$(G,oe)||$(G,ae))},[d]),w=e.useMemo(()=>{const l=e.Children.toArray(d),$=(G,de)=>e.isValidElement(G)&&(G.type===de||G.type?.displayName===de.displayName);return l.some(G=>$(G,le))},[d]),c=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":r($=>S.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":r("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":r("collapsed");break;case"inspector":B("collapsed");break;case"bottom":F("collapsed");break}},[]),X=e.useMemo(()=>({leftMode:P,setLeftMode:h,panelMode:y,setPanelMode:C,sidebarMode:L,setSidebarMode:r,inspectorMode:E,setInspectorMode:B,bottomMode:U,setBottomMode:F,hasLeft:W,setHasLeft:K,hasSidebar:O,setHasSidebar:Y,currentBreakpoint:f,currentBreakpointReady:g,leftResolvedPresentation:M,togglePane:c,expandPane:N,collapsePane:V,setSidebarToggleComputer:m,onLeftPres:b,onRailDefaults:k,onPanelDefaults:x}),[P,y,L,E,U,W,O,f,g,M,c,N,V,m,b,k,x]),H=e.Children.toArray(d),j=(l,$)=>e.isValidElement(l)&&(l.type===$||l.type?.displayName===$.displayName),i=H.filter(l=>j(l,Pe)),T=H.filter(l=>j(l,oe)),s=H.filter(l=>j(l,ae)),z=H.filter(l=>j(l,le)),A=H.filter(l=>j(l,Re)),ee=H.filter(l=>j(l,ue)),ne=H.filter(l=>j(l,fe)),re=e.useMemo(()=>o==="full"?{height:"100vh"}:o==="auto"?{height:"auto"}:typeof o=="string"?{height:o}:typeof o=="number"?{height:`${o}px`}:{},[o]),[p,q]=e.useState(null),D=e.useCallback(l=>q(l),[]),Z=e.useCallback(()=>q(null),[]);return e.createElement("div",{...u,ref:R,className:(0,Q.default)("rt-ShellRoot",a),style:{...re,...u.style}},e.createElement(xe.Provider,{value:{...X,peekTarget:p,setPeekTarget:q,peekPane:D,clearPeek:Z}},i,e.createElement("div",{className:"rt-ShellBody","data-peek-target":p??void 0,style:p==="rail"||p==="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(he,{...$},T,s)})():z,A,ee),ne))});Se.displayName="Shell.Root";const Pe=e.forwardRef(({className:a,height:d=64,style:o,...u},R)=>e.createElement("header",{...u,ref:R,className:(0,Q.default)("rt-ShellHeader",a),style:{...o,"--shell-header-height":`${d}px`}}));Pe.displayName="Shell.Header";const he=e.forwardRef(({className:a,presentation:d={initial:"overlay",sm:"fixed"},mode:o,defaultMode:u="collapsed",onModeChange:R,collapsible:f=!0,onExpand:g,onCollapse:P,children:h,style:y,...C},L)=>{const r=_(),E=ie(d),B=E==="overlay",U=E==="stacked",F=e.useRef(null);e.useEffect(()=>{r.onLeftPres?.(E)},[r,E]);const W=e.useCallback(S=>{F.current=S,typeof L=="function"?L(S):L&&(L.current=S)},[L]);e.useEffect(()=>(r.setHasLeft(!0),()=>r.setHasLeft(!1)),[r]);const K=e.useCallback(()=>{if(typeof u=="string")return u;const S=u;if(S&&S[r.currentBreakpoint])return S[r.currentBreakpoint];const M=[...Object.keys(se)].reverse().concat("initial"),t=M.indexOf(r.currentBreakpoint);for(let b=t+1;b<M.length;b++){const n=M[b];if(S&&S[n])return S[n]}return"collapsed"},[u,r.currentBreakpoint]),O=e.useRef(null);e.useEffect(()=>{if(o!==void 0||!r.currentBreakpointReady||O.current===r.currentBreakpoint)return;O.current=r.currentBreakpoint;const S=K();S!==r.leftMode&&r.setLeftMode(S)},[o,r.currentBreakpoint,r.currentBreakpointReady,K,r.leftMode,r.setLeftMode]),e.useEffect(()=>{o!==void 0&&r.leftMode!==o&&r.setLeftMode(o)},[o,r]),e.useEffect(()=>{o===void 0&&R?.(r.leftMode)},[r.leftMode,o,R]),e.useEffect(()=>{r.leftMode==="expanded"?g?.():P?.()},[r.leftMode,g,P]);const Y=r.leftMode==="expanded";if(B){const S=r.leftMode==="expanded",m=e.Children.toArray(h),M=(w,c)=>e.isValidElement(w)&&w.type===c,t=m.find(w=>M(w,oe)),b=m.find(w=>M(w,ae)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,I=typeof b?.props?.expandedSize=="number"?b.props.expandedSize:288,k=!!t,x=!!b,v=(k?n:0)+(r.panelMode==="expanded"&&x?I:0);return e.createElement(J.Root,{open:S,onOpenChange:w=>r.setLeftMode(w?"expanded":"collapsed")},e.createElement(J.Content,{side:"start",style:{padding:0},width:{initial:`${v}px`}},e.createElement(pe.VisuallyHidden,null,e.createElement(J.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},h)))}if(U){const S=r.leftMode==="expanded",m=e.Children.toArray(h),M=(c,N)=>e.isValidElement(c)&&c.type===N,t=m.find(c=>M(c,oe)),b=m.find(c=>M(c,ae)),n=typeof t?.props?.expandedSize=="number"?t.props.expandedSize:64,I=typeof b?.props?.expandedSize=="number"?b.props.expandedSize:288,k=!!t,v=!!b&&(r.panelMode==="expanded"||r.peekTarget==="panel"),w=(k?n:0)+(v?I:0);return e.createElement("div",{...C,ref:W,className:(0,Q.default)("rt-ShellLeft",a),"data-mode":r.leftMode,"data-peek":r.peekTarget==="left"||r.peekTarget==="rail"||r.peekTarget==="panel"||void 0,"data-presentation":E,style:{...y},"data-open":S||void 0},h)}return e.createElement("div",{...C,ref:W,className:(0,Q.default)("rt-ShellLeft",a),"data-mode":r.leftMode,"data-peek":r.peekTarget==="left"||r.peekTarget==="rail"||r.peekTarget==="panel"||void 0,"data-presentation":E,style:{...y}},h)});he.displayName="Shell.Left";const oe=e.forwardRef(({className:a,presentation:d,mode:o,defaultMode:u,onModeChange:R,expandedSize:f=64,collapsible:g,onExpand:P,onCollapse:h,children:y,style:C,...L},r)=>{const E=_();e.useEffect(()=>{E.onRailDefaults?.(f)},[E,f]);const B=E.leftMode==="expanded";return e.createElement("div",{...L,ref:r,className:(0,Q.default)("rt-ShellRail",a),"data-mode":E.leftMode,"data-peek":E.leftResolvedPresentation!=="overlay"&&E.peekTarget==="rail"||void 0,style:{...C,"--rail-size":`${f}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":B||E.leftResolvedPresentation!=="overlay"&&E.peekTarget==="rail"||void 0},y))});oe.displayName="Shell.Rail";const ae=e.forwardRef(({className:a,mode:d,onModeChange:o,expandedSize:u=288,minSize:R,maxSize:f,resizable:g,collapsible:P=!0,onExpand:h,onCollapse:y,onResize:C,onResizeStart:L,onResizeEnd:r,snapPoints:E,snapTolerance:B,collapseThreshold:U,paneId:F,persistence:W,children:K,style:O,...Y},S)=>{const m=_();e.useEffect(()=>{m.onPanelDefaults?.(u)},[m,u]);const M=e.useRef(null),t=e.useCallback(c=>{M.current=c,typeof S=="function"?S(c):S&&(S.current=c)},[S]),b=e.Children.toArray(K),n=b.filter(c=>e.isValidElement(c)&&c.type===ye),I=b.filter(c=>!(e.isValidElement(c)&&c.type===ye)),k=m.leftResolvedPresentation==="overlay",x=e.useMemo(()=>{if(!F||W)return W;const c=`kookie-ui:shell:panel:${F}`;return{load:()=>{if(typeof window>"u")return;const V=window.localStorage.getItem(c);return V?Number(V):void 0},save:V=>{typeof window>"u"||window.localStorage.setItem(c,String(V))}}},[F,W]);e.useEffect(()=>{let c=!0;return(async()=>{if(!g||!x?.load||k)return;const N=await x.load();c&&typeof N=="number"&&M.current&&(M.current.style.setProperty("--panel-size",`${N}px`),C?.(N))})(),()=>{c=!1}},[g,x,C,k]),e.useEffect(()=>{M.current&&k&&M.current.style.setProperty("--panel-size",`${u}px`)},[k,u]),e.useEffect(()=>{if(M.current&&m.leftResolvedPresentation!=="overlay"&&m.leftMode==="expanded"&&m.panelMode==="expanded"){const c=M.current.parentElement||null;try{c?.style.removeProperty("width")}catch{}}},[m.leftResolvedPresentation,m.leftMode,m.panelMode]);const v=m.leftMode==="expanded"&&m.panelMode==="expanded",w=g&&m.leftResolvedPresentation!=="overlay"&&v?e.createElement(ce.Provider,{value:{containerRef:M,cssVarName:"--panel-size",minSize:typeof R=="number"?R:100,maxSize:typeof f=="number"?f:800,defaultSize:u,orientation:"vertical",edge:"end",computeNext:(c,N,V)=>{const X=getComputedStyle(M.current).direction==="rtl",H=c-N;return V+(X?-H:H)},onResize:C,onResizeStart:c=>{const V=M.current?.parentElement;try{V?.style.removeProperty("width")}catch{}L?.(c)},onResizeEnd:c=>{r?.(c),x?.save?.(c)},target:"panel",collapsible:!!P,snapPoints:E,snapTolerance:B??8,collapseThreshold:U,requestCollapse:()=>m.setPanelMode("collapsed"),requestToggle:()=>m.togglePane("panel")}},n.length>0?n.map((c,N)=>e.cloneElement(c,{key:c.key??N})):e.createElement(te,null)):null;return e.createElement("div",{...Y,ref:t,className:(0,Q.default)("rt-ShellPanel",a),"data-mode":m.panelMode,"data-visible":v||m.leftResolvedPresentation!=="overlay"&&m.peekTarget==="panel"||void 0,"data-peek":m.leftResolvedPresentation!=="overlay"&&m.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=ye;const le=e.forwardRef(({className:a,presentation:d={initial:"overlay",md:"fixed"},mode:o,defaultMode:u="expanded",onModeChange:R,expandedSize:f=288,minSize:g=200,maxSize:P=400,resizable:h=!1,collapsible:y=!0,onExpand:C,onCollapse:L,onResize:r,onResizeStart:E,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:S,thinSize:m=64,toggleModes:M,...t},b)=>{const n=_(),I=ie(d),k=I==="overlay",x=I==="stacked",v=e.useRef(null),w=e.useCallback(p=>{v.current=p,typeof b=="function"?b(p):b&&(b.current=p)},[b]),c=e.Children.toArray(Y),N=c.filter(p=>e.isValidElement(p)&&p.type===be),V=c.filter(p=>!(e.isValidElement(p)&&p.type===be)),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,o===void 0&&n.sidebarMode!==u&&n.setSidebarMode(u))},[]),e.useEffect(()=>{o!==void 0&&n.sidebarMode!==o&&n.setSidebarMode(o)},[o,n]),e.useEffect(()=>{o===void 0&&R?.(n.sidebarMode)},[n.sidebarMode,o,R]),e.useEffect(()=>{n.sidebarMode==="expanded"?C?.():L?.()},[n.sidebarMode,C,L]);const j=n.sidebarMode!=="collapsed",i=e.useMemo(()=>{if(!K||O)return O;const p=`kookie-ui:shell:sidebar:${K}`;return{load:()=>{if(typeof window>"u")return;const D=window.localStorage.getItem(p);return D?Number(D):void 0},save:D=>{typeof window>"u"||window.localStorage.setItem(p,String(D))}}},[K,O]);e.useEffect(()=>{let p=!0;return(async()=>{if(!h||!i?.load||k)return;const q=await i.load();p&&typeof q=="number"&&v.current&&(v.current.style.setProperty("--sidebar-size",`${q}px`),r?.(q))})(),()=>{p=!1}},[h,i,r,k]);const T=e.useCallback(()=>{if(typeof u=="string")return u;const p=u;if(p&&p[n.currentBreakpoint])return p[n.currentBreakpoint];const D=[...Object.keys(se)].reverse().concat("initial"),Z=D.indexOf(n.currentBreakpoint);for(let l=Z+1;l<D.length;l++){const $=D[l];if(p&&p[$])return p[$]}return"collapsed"},[u,n.currentBreakpoint]),s=_(),z=e.useCallback(()=>{const p=T();return p==="thin"||p==="expanded"?p:"expanded"},[T]);e.useEffect(()=>{if(!s.setSidebarToggleComputer)return;const p=M??"both",q=D=>{if(p==="both")return D==="collapsed"?"thin":D==="thin"?"expanded":"collapsed";const Z=z();return D==="collapsed"?Z:D===Z?"collapsed":Z};return s.setSidebarToggleComputer(q),()=>{s.setSidebarToggleComputer?.(D=>D==="collapsed"?"thin":D==="thin"?"expanded":"collapsed")}},[s,M,z]);const A=e.useRef(f),ee=e.useRef("expanded");e.useEffect(()=>{n.sidebarMode!=="collapsed"&&(ee.current=n.sidebarMode,A.current=n.sidebarMode==="thin"?m:f)},[n.sidebarMode,m,f]);const ne=e.useRef(null);e.useEffect(()=>{if(o!==void 0||!n.currentBreakpointReady||ne.current===n.currentBreakpoint)return;ne.current=n.currentBreakpoint;const p=T();p!==n.sidebarMode&&n.setSidebarMode(p)},[o,n.currentBreakpoint,n.currentBreakpointReady,T,n.sidebarMode,n.setSidebarMode]);const re=h&&!k&&n.sidebarMode==="expanded"?e.createElement(ce.Provider,{value:{containerRef:v,cssVarName:"--sidebar-size",minSize:g,maxSize:P,defaultSize:f,orientation:"vertical",edge:"end",computeNext:(p,q,D)=>{const Z=getComputedStyle(v.current).direction==="rtl",l=p-q;return D+(Z?-l:l)},onResize:r,onResizeStart:E,onResizeEnd:p=>{B?.(p),i?.save?.(p)},target:"sidebar",collapsible:y,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>n.setSidebarMode("collapsed"),requestToggle:()=>n.togglePane("sidebar")}},N.length>0?N.map((p,q)=>e.cloneElement(p,{key:p.key??q})):e.createElement(te,null)):null;if(k){const p=n.sidebarMode!=="collapsed";return e.createElement(J.Root,{open:p,onOpenChange:q=>n.setSidebarMode(q?"expanded":"collapsed")},e.createElement(J.Content,{side:"start",style:{padding:0},width:{initial:`${p?n.sidebarMode==="thin"?m:f:A.current}px`}},e.createElement(pe.VisuallyHidden,null,e.createElement(J.Title,null,"Sidebar")),V))}return e.createElement("div",{...t,ref:w,className:(0,Q.default)("rt-ShellSidebar",a),"data-mode":n.sidebarMode,"data-peek":n.peekTarget==="sidebar"||void 0,"data-presentation":I,"data-open":x&&j||void 0,style:{...S,"--sidebar-size":`${f}px`,"--sidebar-thin-size":`${m}px`,"--sidebar-min-size":`${g}px`,"--sidebar-max-size":`${P}px`,...n.peekTarget==="sidebar"&&n.sidebarMode==="collapsed"&&!k?(()=>{const p=M??"both",q=n.sidebarMode;let D;if(p==="both")D=q==="collapsed"?"thin":q==="thin"?"expanded":"collapsed";else{const Z=z();D=q==="collapsed"?Z:"collapsed"}return D==="thin"?{"--peek-sidebar-width":`${m}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${f}px)`}})():{}}},e.createElement("div",{className:"rt-ShellSidebarContent","data-visible":j||void 0},V),re)});le.displayName="Shell.Sidebar",le.Handle=be;const Re=e.forwardRef(({className:a,...d},o)=>e.createElement("main",{...d,ref:o,className:(0,Q.default)("rt-ShellContent",a)}));Re.displayName="Shell.Content";const ue=e.forwardRef(({className:a,presentation:d={initial:"overlay",lg:"fixed"},mode:o,defaultMode:u="collapsed",onModeChange:R,expandedSize:f=320,minSize:g=200,maxSize:P=500,resizable:h=!1,collapsible:y=!0,onExpand:C,onCollapse:L,onResize:r,onResizeStart:E,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:S,...m},M)=>{const t=_(),b=ie(d),n=b==="overlay",I=b==="stacked",k=e.useRef(null),x=e.useCallback(i=>{k.current=i,typeof M=="function"?M(i):M&&(M.current=i)},[M]),v=e.Children.toArray(Y),w=v.filter(i=>e.isValidElement(i)&&i.type===Me),c=v.filter(i=>!(e.isValidElement(i)&&i.type===Me)),N=e.useCallback(()=>{if(typeof u=="string")return u;const i=u;if(i&&i[t.currentBreakpoint])return i[t.currentBreakpoint];const s=[...Object.keys(se)].reverse().concat("initial"),z=s.indexOf(t.currentBreakpoint);for(let A=z+1;A<s.length;A++){const ee=s[A];if(i&&i[ee])return i[ee]}return"collapsed"},[u,t.currentBreakpoint]),V=e.useRef(null);e.useEffect(()=>{if(o!==void 0||!t.currentBreakpointReady||V.current===t.currentBreakpoint)return;V.current=t.currentBreakpoint;const i=N();i!==t.inspectorMode&&t.setInspectorMode(i)},[o,t.currentBreakpoint,t.currentBreakpointReady,N,t.inspectorMode,t.setInspectorMode]),e.useEffect(()=>{o!==void 0&&t.inspectorMode!==o&&t.setInspectorMode(o)},[o,t]),e.useEffect(()=>{o===void 0&&R?.(t.inspectorMode)},[t.inspectorMode,o,R]),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 i=`kookie-ui:shell:inspector:${K}`;return{load:()=>{if(typeof window>"u")return;const s=window.localStorage.getItem(i);return s?Number(s):void 0},save:s=>{typeof window>"u"||window.localStorage.setItem(i,String(s))}}},[K,O]);e.useEffect(()=>{let i=!0;return(async()=>{if(!h||!H?.load||n)return;const T=await H.load();i&&typeof T=="number"&&k.current&&(k.current.style.setProperty("--inspector-size",`${T}px`),r?.(T))})(),()=>{i=!1}},[h,H,r,n]);const j=h&&!n&&X?e.createElement(ce.Provider,{value:{containerRef:k,cssVarName:"--inspector-size",minSize:g,maxSize:P,defaultSize:f,orientation:"vertical",edge:"start",computeNext:(i,T,s)=>{const z=getComputedStyle(k.current).direction==="rtl",A=i-T;return s+(z?A:-A)},onResize:r,onResizeStart:E,onResizeEnd:i=>{B?.(i),H?.save?.(i)},target:"inspector",collapsible:y,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},w.length>0?w.map((i,T)=>e.cloneElement(i,{key:i.key??T})):e.createElement(te,null)):null;if(n){const i=t.inspectorMode==="expanded";return e.createElement(J.Root,{open:i,onOpenChange:T=>t.setInspectorMode(T?"expanded":"collapsed")},e.createElement(J.Content,{side:"end",style:{padding:0},width:{initial:`${f}px`}},e.createElement(pe.VisuallyHidden,null,e.createElement(J.Title,null,"Inspector")),c))}return e.createElement("div",{...m,ref:x,className:(0,Q.default)("rt-ShellInspector",a),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":b,"data-open":I&&X||void 0,style:{...S,"--inspector-size":`${f}px`,"--inspector-min-size":`${g}px`,"--inspector-max-size":`${P}px`}},e.createElement("div",{className:"rt-ShellInspectorContent","data-visible":X||void 0},c),j)});ue.displayName="Shell.Inspector",ue.Handle=Me;const fe=e.forwardRef(({className:a,presentation:d="fixed",mode:o,defaultMode:u="collapsed",onModeChange:R,expandedSize:f=200,minSize:g=100,maxSize:P=400,resizable:h=!1,collapsible:y=!0,onExpand:C,onCollapse:L,onResize:r,onResizeStart:E,onResizeEnd:B,snapPoints:U,snapTolerance:F,collapseThreshold:W,paneId:K,persistence:O,children:Y,style:S,...m},M)=>{const t=_(),b=ie(d),n=b==="overlay",I=b==="stacked",k=e.useRef(null),x=e.useCallback(s=>{k.current=s,typeof M=="function"?M(s):M&&(M.current=s)},[M]),v=e.Children.toArray(Y),w=v.filter(s=>e.isValidElement(s)&&s.type===ve),c=v.filter(s=>!(e.isValidElement(s)&&s.type===ve)),N=e.useCallback(()=>{if(typeof u=="string")return u;const s=u;if(s&&s[t.currentBreakpoint])return s[t.currentBreakpoint];const A=[...Object.keys(se)].reverse().concat("initial"),ee=A.indexOf(t.currentBreakpoint);for(let ne=ee+1;ne<A.length;ne++){const re=A[ne];if(s&&s[re])return s[re]}return"collapsed"},[u,t.currentBreakpoint]),V=e.useRef(!1);e.useEffect(()=>{if(!V.current&&(V.current=!0,o===void 0)){const s=N();t.bottomMode!==s&&t.setBottomMode(s)}},[]);const X=e.useRef(null),H=e.useRef(null);e.useEffect(()=>{if(o!==void 0||!t.currentBreakpointReady||X.current===t.currentBreakpoint)return;X.current=t.currentBreakpoint;const s=N();H.current!==s&&(H.current=s,s!==t.bottomMode&&t.setBottomMode(s))},[o,t.currentBreakpoint,t.currentBreakpointReady,N,t.bottomMode,t.setBottomMode]),e.useEffect(()=>{o!==void 0&&t.bottomMode!==o&&t.setBottomMode(o)},[o,t]),e.useEffect(()=>{o===void 0&&R?.(t.bottomMode)},[t.bottomMode,o,R]),e.useEffect(()=>{t.bottomMode==="expanded"?C?.():L?.()},[t.bottomMode,C,L]);const j=t.bottomMode==="expanded",i=e.useMemo(()=>{if(!K||O)return O;const s=`kookie-ui:shell:bottom:${K}`;return{load:()=>{if(typeof window>"u")return;const A=window.localStorage.getItem(s);return A?Number(A):void 0},save:A=>{typeof window>"u"||window.localStorage.setItem(s,String(A))}}},[K,O]);e.useEffect(()=>{let s=!0;return(async()=>{if(!h||!i?.load||n)return;const z=await i.load();s&&typeof z=="number"&&k.current&&(k.current.style.setProperty("--bottom-size",`${z}px`),r?.(z))})(),()=>{s=!1}},[h,i,r,n]);const T=h&&!n&&j?e.createElement(ce.Provider,{value:{containerRef:k,cssVarName:"--bottom-size",minSize:g,maxSize:P,defaultSize:f,orientation:"horizontal",edge:"start",computeNext:(s,z,A)=>{const ee=s-z;return A-ee},onResize:r,onResizeStart:E,onResizeEnd:s=>{B?.(s),i?.save?.(s)},target:"bottom",collapsible:y,snapPoints:U,snapTolerance:F??8,collapseThreshold:W,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},w.length>0?w.map((s,z)=>e.cloneElement(s,{key:s.key??z})):e.createElement(te,null)):null;if(n){const s=t.bottomMode==="expanded";return e.createElement(J.Root,{open:s,onOpenChange:z=>t.setBottomMode(z?"expanded":"collapsed")},e.createElement(J.Content,{side:"bottom",style:{padding:0},height:{initial:`${f}px`}},e.createElement(pe.VisuallyHidden,null,e.createElement(J.Title,null,"Bottom panel")),c))}return e.createElement("div",{...m,ref:x,className:(0,Q.default)("rt-ShellBottom",a),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":b,"data-open":I&&j||void 0,style:{...S,"--bottom-size":`${f}px`,"--bottom-min-size":`${g}px`,"--bottom-max-size":`${P}px`}},e.createElement("div",{className:"rt-ShellBottomContent","data-visible":j||void 0},c),T)});fe.displayName="Shell.Bottom",fe.Handle=ve;const ge=e.forwardRef(({target:a,action:d="toggle",peekOnHover:o,onClick:u,onMouseEnter:R,onMouseLeave:f,children:g,...P},h)=>{const y=_(),C=e.useCallback(B=>{switch(u?.(B),y.peekTarget===a&&y.clearPeek(),d){case"toggle":y.togglePane(a);break;case"expand":y.expandPane(a);break;case"collapse":y.collapsePane(a);break}},[y,a,d,u]),L=(()=>{switch(a){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"}})(),r=e.useCallback(B=>{R?.(B),!(!o||!L)&&y.peekPane(a)},[R,o,L,y,a]),E=e.useCallback(B=>{f?.(B),o&&y.peekTarget===a&&y.clearPeek()},[f,o,y,a]);return e.createElement("button",{...P,ref:h,onClick:C,onMouseEnter:r,onMouseLeave:E,"data-shell-trigger":a,"data-shell-action":d},g)});ge.displayName="Shell.Trigger";
|
|
1
|
+
"use strict";"use client";var Ee=Object.create;var Q=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var xe=(a,l)=>{for(var s in l)Q(a,s,{get:l[s],enumerable:!0})},pe=(a,l,s,p)=>{if(l&&typeof l=="object"||typeof l=="function")for(let m of Se(l))!Ce.call(a,m)&&m!==s&&Q(a,m,{get:()=>l[m],enumerable:!(p=ke(l,m))||p.enumerable});return a};var oe=(a,l,s)=>(s=a!=null?Ee(ge(a)):{},pe(l||!a||!a.__esModule?Q(s,"default",{value:a,enumerable:!0}):s,a)),Te=a=>pe(Q({},"__esModule",{value:!0}),a);var He={};xe(He,{Bottom:()=>ee.Bottom,Content:()=>Z,Header:()=>X,Inspector:()=>te.Inspector,Left:()=>Y,Panel:()=>O,Rail:()=>$,Root:()=>re,Sidebar:()=>U.Sidebar,Trigger:()=>de,useResponsivePresentation:()=>_.useResponsivePresentation,useShell:()=>D.useShell});module.exports=Te(He);var e=oe(require("react")),V=oe(require("classnames")),se=oe(require("./sheet.js")),we=require("./inset.js"),ce=require("./visually-hidden.js"),_=require("./shell.hooks.js"),fe=require("./_internal/shell-resize.js"),F=require("./_internal/shell-handles.js"),U=require("./_internal/shell-sidebar.js"),ee=require("./_internal/shell-bottom.js"),te=require("./_internal/shell-inspector.js"),le=require("./shell.types.js"),D=require("./shell.context.js");function Le(){const[a,l]=e.useState("initial"),[s,p]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const b=Object.entries(le.BREAKPOINTS).map(([c,y])=>[c,window.matchMedia(y)]),h=()=>{const c=b.filter(([,r])=>r.matches).map(([r])=>r),y=c[c.length-1]??"initial";l(y),p(!0)};return h(),b.forEach(([,c])=>c.addEventListener("change",h)),()=>{b.forEach(([,c])=>c.removeEventListener("change",h))}},[]),{bp:a,ready:s}}const re=e.forwardRef(({className:a,children:l,height:s="full",...p},m)=>{const{bp:b,ready:h}=Le(),[c,y]=e.useState("collapsed"),[r,R]=e.useState("collapsed"),[E,t]=e.useState("expanded"),[u,v]=e.useState("collapsed"),[q,B]=e.useState("collapsed"),[T,j]=e.useState(!1),[z,G]=e.useState(!1),i=e.useRef(n=>n==="collapsed"?"thin":n==="thin"?"expanded":"collapsed"),d=e.useCallback(n=>{i.current=n},[]);e.useEffect(()=>{c==="collapsed"&&R("collapsed")},[c]),e.useEffect(()=>{z&&T&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[z,T]);const[f,S]=e.useState(void 0),M=e.useCallback(n=>S(n),[]),C=e.useRef(64),I=e.useRef(288),L=e.useCallback(n=>{C.current=n},[]),w=e.useCallback(n=>{I.current=n},[]),A=e.useMemo(()=>{const n=e.Children.toArray(l),P=(x,K)=>e.isValidElement(x)&&(x.type===K||x.type?.displayName===K.displayName);return n.some(x=>P(x,$)||P(x,O))},[l]),g=e.useMemo(()=>{const n=e.Children.toArray(l),P=(x,K)=>e.isValidElement(x)&&(x.type===K||x.type?.displayName===K.displayName);return n.some(x=>P(x,U.Sidebar))},[l]),o=e.useCallback(n=>{switch(n){case"left":case"rail":y(P=>P==="expanded"?"collapsed":"expanded");break;case"panel":c==="collapsed"?(y("expanded"),R("expanded")):R(P=>P==="expanded"?"collapsed":"expanded");break;case"sidebar":t(P=>i.current(P));break;case"inspector":v(P=>P==="expanded"?"collapsed":"expanded");break;case"bottom":B(P=>P==="expanded"?"collapsed":"expanded");break}},[c]),k=e.useCallback(n=>{switch(n){case"left":case"rail":y("expanded");break;case"panel":y("expanded"),R("expanded");break;case"sidebar":t("expanded");break;case"inspector":v("expanded");break;case"bottom":B("expanded");break}},[]),H=e.useCallback(n=>{switch(n){case"left":case"rail":y("collapsed");break;case"panel":R("collapsed");break;case"sidebar":t("collapsed");break;case"inspector":v("collapsed");break;case"bottom":B("collapsed");break}},[]),ne=e.useMemo(()=>({leftMode:c,setLeftMode:y,panelMode:r,setPanelMode:R,sidebarMode:E,setSidebarMode:t,inspectorMode:u,setInspectorMode:v,bottomMode:q,setBottomMode:B,hasLeft:T,setHasLeft:j,hasSidebar:z,setHasSidebar:G,currentBreakpoint:b,currentBreakpointReady:h,leftResolvedPresentation:f,togglePane:o,expandPane:k,collapsePane:H,setSidebarToggleComputer:d,onLeftPres:M,onRailDefaults:L,onPanelDefaults:w}),[c,r,E,u,q,T,z,b,h,f,o,k,H,d,M,L,w]),N=e.Children.toArray(l),W=(n,P)=>e.isValidElement(n)&&(n.type===P||n.type?.displayName===P.displayName),ue=N.filter(n=>W(n,X)),ie=N.filter(n=>W(n,$)),me=N.filter(n=>W(n,O)),ye=N.filter(n=>W(n,U.Sidebar)),Pe=N.filter(n=>W(n,Z)),be=N.filter(n=>W(n,te.Inspector)),Re=N.filter(n=>W(n,ee.Bottom)),Me=e.useMemo(()=>s==="full"?{height:"100vh"}:s==="auto"?{height:"auto"}:typeof s=="string"?{height:s}:typeof s=="number"?{height:`${s}px`}:{},[s]),[J,ae]=e.useState(null),he=e.useCallback(n=>ae(n),[]),ve=e.useCallback(()=>ae(null),[]);return e.createElement("div",{...p,ref:m,className:(0,V.default)("rt-ShellRoot",a),style:{...Me,...p.style}},e.createElement(D.ShellProvider,{value:{...ne,peekTarget:J,setPeekTarget:ae,peekPane:he,clearPeek:ve}},ue,e.createElement("div",{className:"rt-ShellBody","data-peek-target":J??void 0,style:J==="rail"||J==="panel"?{"--peek-rail-width":`${C.current}px`}:void 0},A&&!g?(()=>{const n=ie[0],P=n?{mode:n.props?.mode,defaultMode:n.props?.defaultMode,onModeChange:n.props?.onModeChange,presentation:n.props?.presentation,collapsible:n.props?.collapsible,onExpand:n.props?.onExpand,onCollapse:n.props?.onCollapse}:{};return e.createElement(Y,{...P},ie,me)})():ye,Pe,be),Re))});re.displayName="Shell.Root";const X=e.forwardRef(({className:a,height:l=64,style:s,...p},m)=>e.createElement("header",{...p,ref:m,className:(0,V.default)("rt-ShellHeader",a),style:{...s,"--shell-header-height":`${l}px`}}));X.displayName="Shell.Header";const Y=e.forwardRef(({className:a,presentation:l={initial:"overlay",sm:"fixed"},mode:s,defaultMode:p="collapsed",onModeChange:m,collapsible:b=!0,onExpand:h,onCollapse:c,children:y,style:r,...R},E)=>{const t=(0,D.useShell)(),u=(0,_.useResponsivePresentation)(l),v=u==="overlay",q=u==="stacked",B=e.useRef(null);e.useEffect(()=>{t.onLeftPres?.(u)},[t,u]);const T=e.useCallback(i=>{B.current=i,typeof E=="function"?E(i):E&&(E.current=i)},[E]);e.useEffect(()=>(t.setHasLeft(!0),()=>t.setHasLeft(!1)),[t]);const j=e.useCallback(()=>{if(typeof p=="string")return p;const i=p;if(i&&i[t.currentBreakpoint])return i[t.currentBreakpoint];const f=[...Object.keys(le.BREAKPOINTS)].reverse().concat("initial"),S=f.indexOf(t.currentBreakpoint);for(let M=S+1;M<f.length;M++){const C=f[M];if(i&&i[C])return i[C]}return"collapsed"},[p,t.currentBreakpoint]),z=e.useRef(null);e.useEffect(()=>{if(s!==void 0||!t.currentBreakpointReady||z.current===t.currentBreakpoint)return;z.current=t.currentBreakpoint;const i=j();i!==t.leftMode&&t.setLeftMode(i)},[s,t.currentBreakpoint,t.currentBreakpointReady,j,t.leftMode,t.setLeftMode]),e.useEffect(()=>{s!==void 0&&t.leftMode!==s&&t.setLeftMode(s)},[s,t]),e.useEffect(()=>{s===void 0&&m?.(t.leftMode)},[t.leftMode,s,m]),e.useEffect(()=>{t.leftMode==="expanded"?h?.():c?.()},[t.leftMode,h,c]);const G=t.leftMode==="expanded";if(v){const i=t.leftMode==="expanded",d=e.Children.toArray(y),f=(g,o)=>e.isValidElement(g)&&g.type===o,S=d.find(g=>f(g,$)),M=d.find(g=>f(g,O)),C=typeof S?.props?.expandedSize=="number"?S.props.expandedSize:64,I=typeof M?.props?.expandedSize=="number"?M.props.expandedSize:288,L=!!S,w=!!M,A=(L?C:0)+(t.panelMode==="expanded"&&w?I:0);return e.createElement(se.Root,{open:i,onOpenChange:g=>t.setLeftMode(g?"expanded":"collapsed")},e.createElement(se.Content,{side:"start",style:{padding:0},width:{initial:`${A}px`}},e.createElement(ce.VisuallyHidden,null,e.createElement(se.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},y)))}if(q){const i=t.leftMode==="expanded",d=e.Children.toArray(y),f=(o,k)=>e.isValidElement(o)&&o.type===k,S=d.find(o=>f(o,$)),M=d.find(o=>f(o,O)),C=typeof S?.props?.expandedSize=="number"?S.props.expandedSize:64,I=typeof M?.props?.expandedSize=="number"?M.props.expandedSize:288,L=!!S,A=!!M&&(t.panelMode==="expanded"||t.peekTarget==="panel"),g=(L?C:0)+(A?I:0);return e.createElement("div",{...R,ref:T,className:(0,V.default)("rt-ShellLeft",a),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":u,style:{...r},"data-open":i||void 0},y)}return e.createElement("div",{...R,ref:T,className:(0,V.default)("rt-ShellLeft",a),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":u,style:{...r}},y)});Y.displayName="Shell.Left";const $=e.forwardRef(({className:a,presentation:l,mode:s,defaultMode:p,onModeChange:m,expandedSize:b=64,collapsible:h,onExpand:c,onCollapse:y,children:r,style:R,...E},t)=>{const u=(0,D.useShell)();e.useEffect(()=>{u.onRailDefaults?.(b)},[u,b]);const v=u.leftMode==="expanded";return e.createElement("div",{...E,ref:t,className:(0,V.default)("rt-ShellRail",a),"data-mode":u.leftMode,"data-peek":u.leftResolvedPresentation!=="overlay"&&u.peekTarget==="rail"||void 0,style:{...R,"--rail-size":`${b}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":v||u.leftResolvedPresentation!=="overlay"&&u.peekTarget==="rail"||void 0},r))});$.displayName="Shell.Rail";const O=e.forwardRef(({className:a,mode:l,onModeChange:s,expandedSize:p=288,minSize:m,maxSize:b,resizable:h,collapsible:c=!0,onExpand:y,onCollapse:r,onResize:R,onResizeStart:E,onResizeEnd:t,snapPoints:u,snapTolerance:v,collapseThreshold:q,paneId:B,persistence:T,children:j,style:z,...G},i)=>{const d=(0,D.useShell)();e.useEffect(()=>{d.onPanelDefaults?.(p)},[d,p]);const f=e.useRef(null),S=e.useCallback(o=>{f.current=o,typeof i=="function"?i(o):i&&(i.current=o)},[i]),M=e.Children.toArray(j),C=M.filter(o=>e.isValidElement(o)&&o.type===F.PanelHandle),I=M.filter(o=>!(e.isValidElement(o)&&o.type===F.PanelHandle)),L=d.leftResolvedPresentation==="overlay",w=e.useMemo(()=>{if(!B||T)return T;const o=`kookie-ui:shell:panel:${B}`;return{load:()=>{if(typeof window>"u")return;const H=window.localStorage.getItem(o);return H?Number(H):void 0},save:H=>{typeof window>"u"||window.localStorage.setItem(o,String(H))}}},[B,T]);e.useEffect(()=>{let o=!0;return(async()=>{if(!h||!w?.load||L)return;const k=await w.load();o&&typeof k=="number"&&f.current&&(f.current.style.setProperty("--panel-size",`${k}px`),R?.(k))})(),()=>{o=!1}},[h,w,R,L]),e.useEffect(()=>{f.current&&L&&f.current.style.setProperty("--panel-size",`${p}px`)},[L,p]),e.useEffect(()=>{if(f.current&&d.leftResolvedPresentation!=="overlay"&&d.leftMode==="expanded"&&d.panelMode==="expanded"){const o=f.current.parentElement||null;try{o?.style.removeProperty("width")}catch{}}},[d.leftResolvedPresentation,d.leftMode,d.panelMode]);const A=d.leftMode==="expanded"&&d.panelMode==="expanded",g=h&&d.leftResolvedPresentation!=="overlay"&&A?e.createElement(fe.PaneResizeContext.Provider,{value:{containerRef:f,cssVarName:"--panel-size",minSize:typeof m=="number"?m:100,maxSize:typeof b=="number"?b:800,defaultSize:p,orientation:"vertical",edge:"end",computeNext:(o,k,H)=>{const ne=getComputedStyle(f.current).direction==="rtl",N=o-k;return H+(ne?-N:N)},onResize:R,onResizeStart:o=>{const H=f.current?.parentElement;try{H?.style.removeProperty("width")}catch{}E?.(o)},onResizeEnd:o=>{t?.(o),w?.save?.(o)},target:"panel",collapsible:!!c,snapPoints:u,snapTolerance:v??8,collapseThreshold:q,requestCollapse:()=>d.setPanelMode("collapsed"),requestToggle:()=>d.togglePane("panel")}},C.length>0?C.map((o,k)=>e.cloneElement(o,{key:o.key??k})):e.createElement(F.PaneHandle,null)):null;return e.createElement("div",{...G,ref:S,className:(0,V.default)("rt-ShellPanel",a),"data-mode":d.panelMode,"data-visible":A||d.leftResolvedPresentation!=="overlay"&&d.peekTarget==="panel"||void 0,"data-peek":d.leftResolvedPresentation!=="overlay"&&d.peekTarget==="panel"||void 0,style:{...z,"--panel-size":`${p}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":A||void 0},I),g)});O.displayName="Shell.Panel",O.Handle=F.PanelHandle;const Z=e.forwardRef(({className:a,...l},s)=>e.createElement("main",{...l,ref:s,className:(0,V.default)("rt-ShellContent",a)}));Z.displayName="Shell.Content";const de=e.forwardRef(({target:a,action:l="toggle",peekOnHover:s,onClick:p,onMouseEnter:m,onMouseLeave:b,children:h,...c},y)=>{const r=(0,D.useShell)(),R=e.useCallback(v=>{switch(p?.(v),r.peekTarget===a&&r.clearPeek(),l){case"toggle":r.togglePane(a);break;case"expand":r.expandPane(a);break;case"collapse":r.collapsePane(a);break}},[r,a,l,p]),E=(()=>{switch(a){case"left":case"rail":return r.leftMode==="collapsed";case"panel":return r.leftMode==="collapsed"||r.panelMode==="collapsed";case"sidebar":return r.sidebarMode==="collapsed";case"inspector":return r.inspectorMode==="collapsed";case"bottom":return r.bottomMode==="collapsed"}})(),t=e.useCallback(v=>{m?.(v),!(!s||!E)&&r.peekPane(a)},[m,s,E,r,a]),u=e.useCallback(v=>{b?.(v),s&&r.peekTarget===a&&r.clearPeek()},[b,s,r,a]);return e.createElement("button",{...c,ref:y,onClick:R,onMouseEnter:t,onMouseLeave:u,"data-shell-trigger":a,"data-shell-action":l},h)});de.displayName="Shell.Trigger";
|
|
2
2
|
//# sourceMappingURL=shell.js.map
|