@kushagradhawan/kookie-ui 0.1.57 → 0.1.59
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 +33 -33
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js.map +2 -2
- package/dist/cjs/components/icons.d.ts +1 -1
- package/dist/cjs/components/icons.d.ts.map +1 -1
- package/dist/cjs/components/icons.js.map +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/shell.schema.js +1 -1
- package/dist/cjs/components/schemas/shell.schema.js.map +3 -3
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js.map +2 -2
- package/dist/esm/components/icons.d.ts +1 -1
- package/dist/esm/components/icons.d.ts.map +1 -1
- package/dist/esm/components/icons.js.map +2 -2
- package/dist/esm/components/schemas/shell.schema.d.ts +2 -2
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/shell.schema.js.map +3 -3
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/package.json +1 -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/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/shell-bottom.tsx +14 -13
- package/src/components/_internal/shell-inspector.tsx +13 -11
- package/src/components/_internal/shell-sidebar.tsx +12 -12
- package/src/components/callout.css +5 -5
- package/src/components/chatbar.css +3 -3
- package/src/components/chatbar.tsx +0 -1
- package/src/components/icons.tsx +19 -87
- package/src/components/schemas/shell.schema.ts +10 -33
- package/src/components/shell.tsx +32 -24
- package/styles.css +33 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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_ENV === 'development') {\n return ShellHandleSchema.parse(props);\n }\n return props as ShellHandleProps;\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,uBAAAC,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,yBAAAC,EAAA,qBAAAC,EAAA,oBAAAC,EAAA,oBAAAC,EAAA,uBAAAC,EAAA,uBAAAC,EAAA,0BAAAC,EAAA,2BAAAC,EAAA,0BAAAC,EAAA,0BAAAC,EAAA,6BAAAC,EAAA,yBAAAC,EAAA,wBAAAC,EAAA,wBAAAC,EAAA,2BAAAC,EAAA,2BAAAC,IAAA,eAAAC,EAAAtB,GAAA,IAAAuB,EAAkB,eAuBlB,MAAMC,EAAiB,IAAE,KAAK,CAAC,WAAY,WAAW,CAAC,EAAE,SAAS,iBAAiB,EAC7EC,EAAoB,IAAE,KAAK,CAAC,YAAa,OAAQ,UAAU,CAAC,EAAE,SAAS,oBAAoB,EAC3FC,EAA0B,
|
|
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", "
|
|
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.enum(['fixed', 'overlay', 'stacked']).describe('Presentation mode');\nconst _BreakpointSchema = z.enum(['initial', 'xs', 'sm', 'md', 'lg', 'xl']).describe('Responsive breakpoint');\nconst PaneTargetSchema = z.enum(['left', 'rail', 'panel', 'sidebar', 'inspector', 'bottom']).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.boolean().default(true).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.boolean().default(true).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('Presentation mode'),\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.boolean().default(true).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.boolean().default(true).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.boolean().default(false).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_ENV === 'development') {\n return ShellHandleSchema.parse(props);\n }\n return props as ShellHandleProps;\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,uBAAAC,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,yBAAAC,EAAA,qBAAAC,EAAA,oBAAAC,EAAA,oBAAAC,EAAA,uBAAAC,EAAA,uBAAAC,EAAA,0BAAAC,EAAA,2BAAAC,EAAA,0BAAAC,EAAA,0BAAAC,EAAA,6BAAAC,EAAA,yBAAAC,EAAA,wBAAAC,EAAA,wBAAAC,EAAA,2BAAAC,EAAA,2BAAAC,IAAA,eAAAC,EAAAtB,GAAA,IAAAuB,EAAkB,eAuBlB,MAAMC,EAAiB,IAAE,KAAK,CAAC,WAAY,WAAW,CAAC,EAAE,SAAS,iBAAiB,EAC7EC,EAAoB,IAAE,KAAK,CAAC,YAAa,OAAQ,UAAU,CAAC,EAAE,SAAS,oBAAoB,EAC3FC,EAA0B,IAAE,KAAK,CAAC,QAAS,UAAW,SAAS,CAAC,EAAE,SAAS,mBAAmB,EAC9FC,EAAoB,IAAE,KAAK,CAAC,UAAW,KAAM,KAAM,KAAM,KAAM,IAAI,CAAC,EAAE,SAAS,uBAAuB,EACtGC,EAAmB,IAAE,KAAK,CAAC,OAAQ,OAAQ,QAAS,UAAW,YAAa,QA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AAOA,CACT,CAEO,SAASpB,EAAsBoB,EAAkC,CAItE,OAAOA,CACT,CAEO,SAASjB,EAAoBiB,EAAgC,CAIlE,OAAOA,CACT,CAEO,SAASlB,EAAqBkB,EAAiC,CAIpE,OAAOA,CACT,CAEO,SAASf,EAAuBe,EAAmC,CAIxE,OAAOA,CACT,CAEO,SAAStB,EAAuBsB,EAAmC,CAIxE,OAAOA,CACT,CAEO,SAASnB,EAAyBmB,EAAqC,CAI5E,OAAOA,CACT,CAEO,SAASvB,EAAsBuB,EAAkC,CAItE,OAAOA,CACT,CAEO,SAASd,EAAuBc,EAAmC,CAIxE,OAAOA,CACT,CAEO,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
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,yBAAyB,EAAsB,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,M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AC,cAAc,CAAC,CAAC,GAAG;IAC9G,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAiBF,QAAA,MAAM,KAAK,EA+UN,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var Ne=Object.create;var pe=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var He=(n,d)=>{for(var s in d)pe(n,s,{get:d[s],enumerable:!0})},Ce=(n,d,s,b)=>{if(d&&typeof d=="object"||typeof d=="function")for(let m of we(d))!Be.call(n,m)&&m!==s&&pe(n,m,{get:()=>d[m],enumerable:!(b=De(d,m))||b.enumerable});return n};var ye=(n,d,s)=>(s=n!=null?Ne(Ae(n)):{},Ce(d||!n||!n.__esModule?pe(s,"default",{value:n,enumerable:!0}):s,n)),ze=n=>Ce(pe({},"__esModule",{value:!0}),n);var Fe={};He(Fe,{Bottom:()=>me.Bottom,Content:()=>fe,Header:()=>ue,Inspector:()=>Me.Inspector,Left:()=>ce,Panel:()=>N,Rail:()=>Z,Root:()=>be,Sidebar:()=>de.Sidebar,Trigger:()=>Ee,useResponsivePresentation:()=>oe.useResponsivePresentation,useShell:()=>c.useShell});module.exports=ze(Fe);var e=ye(require("react")),q=ye(require("classnames")),Pe=ye(require("./sheet.js")),Re=require("./visually-hidden.js"),oe=require("./shell.hooks.js"),ge=require("./_internal/shell-resize.js"),te=require("./_internal/shell-handles.js"),de=require("./_internal/shell-sidebar.js"),me=require("./_internal/shell-bottom.js"),Me=require("./_internal/shell-inspector.js"),xe=require("./shell.types.js"),c=require("./shell.context.js");function Ie(){const[n,d]=e.useState("initial"),[s,b]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const E=Object.entries(xe._BREAKPOINTS).map(([p,t])=>[p,window.matchMedia(t)]),f=()=>{const p=E.filter(([,r])=>r.matches).map(([r])=>r),t=p[p.length-1]??"initial";d(t),b(!0)};f();const i=[];return E.forEach(([,p])=>{const t=p;typeof t.addEventListener=="function"&&typeof t.removeEventListener=="function"?(t.addEventListener("change",f),i.push(()=>t.removeEventListener?.("change",f))):typeof t.addListener=="function"&&typeof t.removeListener=="function"&&(t.addListener(f),i.push(()=>t.removeListener?.(f)))}),()=>{i.forEach(p=>{try{p()}catch{}})}},[]),{bp:n,ready:s}}function Ve(n,d){switch(d.type){case"SET_LEFT_MODE":return d.mode==="collapsed"?{...n,leftMode:"collapsed",panelMode:"collapsed"}:{...n,leftMode:d.mode};case"SET_PANEL_MODE":return d.mode==="expanded"&&n.leftMode!=="expanded"?{...n,leftMode:"expanded",panelMode:"expanded"}:{...n,panelMode:d.mode};case"SET_SIDEBAR_MODE":return{...n,sidebarMode:d.mode};case"SET_INSPECTOR_MODE":return{...n,inspectorMode:d.mode};case"SET_BOTTOM_MODE":return{...n,bottomMode:d.mode};case"TOGGLE_PANE":{switch(d.target){case"left":case"rail":return{...n,leftMode:n.leftMode==="expanded"?"collapsed":"expanded",panelMode:n.leftMode==="expanded"?"collapsed":n.panelMode};case"panel":return n.leftMode==="collapsed"?{...n,leftMode:"expanded",panelMode:"expanded"}:{...n,panelMode:n.panelMode==="expanded"?"collapsed":"expanded"};case"sidebar":{const s=n.sidebarMode==="collapsed"?"expanded":n.sidebarMode==="expanded"?"collapsed":"expanded";return{...n,sidebarMode:s}}case"inspector":return{...n,inspectorMode:n.inspectorMode==="expanded"?"collapsed":"expanded"};case"bottom":return{...n,bottomMode:n.bottomMode==="expanded"?"collapsed":"expanded"};default:return n}return n}case"EXPAND_PANE":{switch(d.target){case"left":case"rail":return{...n,leftMode:"expanded"};case"panel":return{...n,leftMode:"expanded",panelMode:"expanded"};case"sidebar":return{...n,sidebarMode:"expanded"};case"inspector":return{...n,inspectorMode:"expanded"};case"bottom":return{...n,bottomMode:"expanded"};default:return n}return n}case"COLLAPSE_PANE":{switch(d.target){case"left":case"rail":return{...n,leftMode:"collapsed",panelMode:"collapsed"};case"panel":return{...n,panelMode:"collapsed"};case"sidebar":return{...n,sidebarMode:"collapsed"};case"inspector":return{...n,inspectorMode:"collapsed"};case"bottom":return{...n,bottomMode:"collapsed"};default:return n}return n}}return n}const be=e.forwardRef(({className:n,children:d,height:s="full",...b},m)=>{const{bp:E,ready:f}=Ie(),i=e.Children.toArray(d),p=i.some(o=>e.isValidElement(o)&&o.type?.displayName==="Shell.Panel"&&!!o.props?.defaultOpen),t=i.some(o=>e.isValidElement(o)&&o.type?.displayName==="Shell.Rail"&&!!o.props?.defaultOpen),[r,h]=e.useReducer(Ve,{leftMode:p||t?"expanded":"collapsed",panelMode:p?"expanded":"collapsed",sidebarMode:"expanded",inspectorMode:"collapsed",bottomMode:"collapsed"}),D=e.useCallback(o=>h({type:"SET_LEFT_MODE",mode:o}),[]),O=e.useCallback(o=>h({type:"SET_PANEL_MODE",mode:o}),[]),C=e.useCallback(o=>h({type:"SET_SIDEBAR_MODE",mode:o}),[]),G=e.useCallback(o=>h({type:"SET_INSPECTOR_MODE",mode:o}),[]),w=e.useCallback(o=>h({type:"SET_BOTTOM_MODE",mode:o}),[]),[g,H]=e.useState(!1),[S,$]=e.useState(!1),ae=e.useRef(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed"),Q=e.useCallback(o=>{ae.current=o},[]);e.useEffect(()=>{S&&g&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[S,g]);const[A,ee]=e.useState(void 0),U=e.useCallback(o=>ee(o),[]),le=e.useRef(64),F=e.useRef(288),v=e.useCallback(o=>{le.current=o},[]),l=e.useCallback(o=>{F.current=o},[]),z=e.useMemo(()=>{const o=e.Children.toArray(d),B=(k,re)=>e.isValidElement(k)&&(k.type===re||k.type?.displayName===re.displayName);return o.some(k=>B(k,Z)||B(k,N))},[d]),L=e.useMemo(()=>{const o=e.Children.toArray(d),B=(k,re)=>e.isValidElement(k)&&(k.type===re||k.type?.displayName===re.displayName);return o.some(k=>B(k,de.Sidebar))},[d]),x=e.useCallback(o=>{if(o==="sidebar"){const B=ae.current(r.sidebarMode);C(B);return}h({type:"TOGGLE_PANE",target:o})},[r.sidebarMode]),M=e.useCallback(o=>{if(o==="sidebar")return C("expanded");h({type:"EXPAND_PANE",target:o})},[]),W=e.useCallback(o=>{if(o==="sidebar")return C("collapsed");h({type:"COLLAPSE_PANE",target:o})},[]),j=e.useMemo(()=>({leftMode:r.leftMode,setLeftMode:D,panelMode:r.panelMode,setPanelMode:O,sidebarMode:r.sidebarMode,setSidebarMode:C,inspectorMode:r.inspectorMode,setInspectorMode:G,bottomMode:r.bottomMode,setBottomMode:w,hasLeft:g,setHasLeft:H,hasSidebar:S,setHasSidebar:$,currentBreakpoint:E,currentBreakpointReady:f,leftResolvedPresentation:A,togglePane:x,expandPane:M,collapsePane:W,setSidebarToggleComputer:Q,onLeftPres:U,onRailDefaults:v,onPanelDefaults:l}),[r.leftMode,r.panelMode,r.sidebarMode,r.inspectorMode,r.bottomMode,g,S,E,f,A,x,M,W,Q,U,v,l]),T=e.Children.toArray(d),_=(o,B)=>e.isValidElement(o)&&(o.type===B||o.type?.displayName===B.displayName),R=T.filter(o=>_(o,ue)),I=T.filter(o=>_(o,Z)),X=T.filter(o=>_(o,N)),K=T.filter(o=>_(o,de.Sidebar)),V=T.filter(o=>_(o,fe)),se=T.filter(o=>_(o,Me.Inspector)),he=T.filter(o=>_(o,me.Bottom)),ie=I[0]?.props?.open;e.useEffect(()=>{if(typeof ie>"u")return;D(!!ie?"expanded":"collapsed")},[ie]);const ve=e.useMemo(()=>s==="full"?{height:"100vh"}:s==="auto"?{height:"auto"}:typeof s=="string"?{height:s}:typeof s=="number"?{height:`${s}px`}:{},[s]),[J,Y]=e.useState(null),a=e.useCallback(o=>Y(o),[]),u=e.useCallback(()=>Y(null),[]),y=e.useMemo(()=>({currentBreakpoint:E,currentBreakpointReady:f,leftResolvedPresentation:A}),[E,f,A]),P=e.useMemo(()=>({leftMode:r.leftMode,setLeftMode:D}),[r.leftMode,D]),ne=e.useMemo(()=>({panelMode:r.panelMode,setPanelMode:O}),[r.panelMode,O]),Se=e.useMemo(()=>({sidebarMode:r.sidebarMode,setSidebarMode:C}),[r.sidebarMode,C]),Te=e.useMemo(()=>({inspectorMode:r.inspectorMode,setInspectorMode:G}),[r.inspectorMode,G]),Oe=e.useMemo(()=>({bottomMode:r.bottomMode,setBottomMode:w}),[r.bottomMode,w]),Le=e.useMemo(()=>({hasLeft:g,setHasLeft:H,hasSidebar:S,setHasSidebar:$}),[g,H,S,$]),_e=e.useMemo(()=>({peekTarget:J,setPeekTarget:Y,peekPane:a,clearPeek:u}),[J,Y,a,u]),ke=e.useMemo(()=>({togglePane:x,expandPane:M,collapsePane:W,setSidebarToggleComputer:Q}),[x,M,W,Q]);return e.createElement("div",{...b,ref:m,className:(0,q.default)("rt-ShellRoot",n),style:{...ve,...b.style}},e.createElement(c.ShellProvider,{value:{...j,peekTarget:J,setPeekTarget:Y,peekPane:a,clearPeek:u}},e.createElement(c.PresentationContext.Provider,{value:y},e.createElement(c.LeftModeContext.Provider,{value:P},e.createElement(c.PanelModeContext.Provider,{value:ne},e.createElement(c.SidebarModeContext.Provider,{value:Se},e.createElement(c.InspectorModeContext.Provider,{value:Te},e.createElement(c.BottomModeContext.Provider,{value:Oe},e.createElement(c.CompositionContext.Provider,{value:Le},e.createElement(c.PeekContext.Provider,{value:_e},e.createElement(c.ActionsContext.Provider,{value:ke},R,e.createElement("div",{className:"rt-ShellBody","data-peek-target":J??void 0,style:J==="rail"||J==="panel"?{"--peek-rail-width":`${le.current}px`}:void 0},z&&!L?(()=>{const o=I[0],B=o?{onOpenChange:o.props?.onOpenChange,open:o.props?.open,defaultOpen:o.props?.defaultOpen,presentation:o.props?.presentation,collapsible:o.props?.collapsible,onExpand:o.props?.onExpand,onCollapse:o.props?.onCollapse}:{defaultOpen:p?!0:void 0};return e.createElement(ce,{...B},I,X)})():K,V,se),he)))))))))))});be.displayName="Shell.Root";const ue=e.forwardRef(({className:n,height:d=64,style:s,...b},m)=>e.createElement("header",{...b,ref:m,className:(0,q.default)("rt-ShellHeader",n),style:{...s,"--shell-header-height":`${d}px`}}));ue.displayName="Shell.Header";const ce=e.forwardRef(({className:n,presentation:d={initial:"fixed",sm:"fixed"},collapsible:s=!0,onExpand:b,onCollapse:m,children:E,style:f,...i},p)=>{const t=(0,c.useShell)(),r=(0,oe.useResponsivePresentation)(d),h=r==="overlay",D=r==="stacked",O=e.useRef(null);e.useEffect(()=>{t.onLeftPres?.(r)},[t,r]);const C=e.useCallback(v=>{O.current=v,typeof p=="function"?p(v):p&&(p.current=v)},[p]);e.useEffect(()=>(t.setHasLeft(!0),()=>t.setHasLeft(!1)),[t]);const G=e.useRef(null),w=e.useRef(null),g=e.useRef(!1),H=(0,oe.useResponsiveValue)(i.defaultOpen),S=e.useRef(!1);e.useEffect(()=>{if(S.current||!t.currentBreakpointReady||typeof i.open<"u"||typeof i.defaultOpen>"u")return;S.current=!0;const v=!!H;t.setLeftMode(v?"expanded":"collapsed"),i.onOpenChange?.(v,{reason:"init"})},[t.currentBreakpointReady,i.open,i.defaultOpen,H]),e.useEffect(()=>{if(typeof i.open<"u"){const v=!!i.open;t.setLeftMode(v?"expanded":"collapsed");return}},[t,i.open]),e.useEffect(()=>{typeof i.open<"u"||(!g.current&&H&&t.leftMode==="expanded"&&(i.onOpenChange?.(!0,{reason:"init"}),g.current=!0),w.current!==null&&w.current!==t.leftMode&&i.onOpenChange?.(t.leftMode==="expanded",{reason:"toggle"}),w.current=t.leftMode)},[t.leftMode,H]),e.useEffect(()=>{t.leftMode==="expanded"?b?.():m?.()},[t.leftMode,b,m]);const $=t.leftMode==="expanded";if(h){const v=t.leftMode==="expanded",l=e.Children.toArray(E),z=(R,I)=>e.isValidElement(R)&&R.type===I,L=l.find(R=>z(R,Z)),x=l.find(R=>z(R,N)),M=typeof L?.props?.expandedSize=="number"?L.props.expandedSize:64,W=typeof x?.props?.expandedSize=="number"?x.props.expandedSize:288,j=!!L,T=!!x,_=(j?M:0)+(t.panelMode==="expanded"&&T?W:0);return e.createElement(Pe.Root,{open:v,onOpenChange:R=>t.setLeftMode(R?"expanded":"collapsed")},e.createElement(Pe.Content,{side:"start",style:{padding:0},width:{initial:`${_}px`}},e.createElement(Re.VisuallyHidden,null,e.createElement(Pe.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},E)))}if(D){const v=t.leftMode==="expanded",l=e.Children.toArray(E),z=(V,se)=>e.isValidElement(V)&&V.type===se,L=l.find(V=>z(V,Z)),x=l.find(V=>z(V,N)),M=typeof L?.props?.expandedSize=="number"?L.props.expandedSize:64,W=typeof x?.props?.expandedSize=="number"?x.props.expandedSize:288,j=!!L,_=!!x&&(t.panelMode==="expanded"||t.peekTarget==="panel"),{open:R,defaultOpen:I,onOpenChange:X,...K}=i;return e.createElement("div",{...K,ref:C,className:(0,q.default)("rt-ShellLeft",n),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":r,style:{...f},"data-open":v||void 0},E)}const{open:ae,defaultOpen:Q,onOpenChange:A,mode:ee,defaultMode:U,onModeChange:le,...F}=i;return e.createElement("div",{...F,ref:C,className:(0,q.default)("rt-ShellLeft",n),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":r,style:{...f}},E)});ce.displayName="Shell.Left";const Z=e.forwardRef(({className:n,presentation:d,expandedSize:s=64,collapsible:b,onExpand:m,onCollapse:E,children:f,style:i,...p},t)=>{const r=(0,c.useShell)(),h=e.useRef(null);e.useEffect(()=>{const g=typeof p.open<"u";if(h.current===null){h.current=g;return}h.current!==g&&(console.warn("Shell.Rail: Switching between controlled and uncontrolled `open` is not supported."),h.current=g)},[p.open]),e.useEffect(()=>{r.onRailDefaults?.(s)},[r,s]);const D=r.leftMode==="expanded",{defaultOpen:O,open:C,onOpenChange:G,...w}=p;return e.createElement("div",{...w,ref:t,className:(0,q.default)("rt-ShellRail",n),"data-mode":r.leftMode,"data-peek":r.currentBreakpointReady&&r.leftResolvedPresentation!=="overlay"&&r.peekTarget==="rail"||void 0,style:{...i,"--rail-size":`${s}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":r.currentBreakpointReady&&(D||r.leftResolvedPresentation!=="overlay"&&r.peekTarget==="rail")||void 0},f))});Z.displayName="Shell.Rail";const N=e.forwardRef(({className:n,defaultOpen:d,open:s,onOpenChange:b,size:m,defaultSize:E,expandedSize:f=288,minSize:i,maxSize:p,resizable:t,collapsible:r=!0,onExpand:h,onCollapse:D,onResize:O,onResizeStart:C,onResizeEnd:G,snapPoints:w,snapTolerance:g,collapseThreshold:H,paneId:S,persistence:$,children:ae,style:Q,onSizeChange:A,sizeUpdate:ee,sizeUpdateMs:U=50,...le},F)=>{const v=e.useMemo(()=>{if(!A)return()=>{};if(ee==="debounce"){let a=null;return(y,P)=>{a&&clearTimeout(a),a=setTimeout(()=>{A?.(y,P)},U)}}if(ee==="throttle"){let a=0;return(u,y)=>{const P=Date.now();P-a>=U&&(a=P,A?.(u,y))}}return(a,u)=>A?.(a,u)},[A,ee,U]),l=(0,c.useShell)(),z=e.useRef(null),L=e.useRef(null),x=e.useRef(!1);e.useEffect(()=>{typeof s>"u"&&typeof d=="boolean"&&(d?(l.setLeftMode("expanded"),l.setPanelMode("expanded")):l.setPanelMode("collapsed"))},[]),e.useEffect(()=>{typeof s>"u"||(s?(l.leftMode!=="expanded"&&l.setLeftMode("expanded"),l.panelMode!=="expanded"&&l.setPanelMode("expanded")):l.panelMode!=="collapsed"&&l.setPanelMode("collapsed"))},[s,l.leftMode,l.panelMode]),e.useEffect(()=>{const a=typeof s<"u";N._wasControlled=N._wasControlled??a,N._wasControlled!==a&&(console.warn("Shell.Panel: Switching between controlled and uncontrolled `open` is not supported."),N._wasControlled=a)},[s]),e.useEffect(()=>{x.current||typeof s>"u"&&d&&l.panelMode==="expanded"&&(b?.(!0,{reason:"init"}),x.current=!0)},[]),e.useEffect(()=>{l.onPanelDefaults?.(f)},[l,f]);const M=e.useRef(null),W=e.useCallback(a=>{M.current=a,typeof F=="function"?F(a):F&&(F.current=a)},[F]),j=e.Children.toArray(ae),T=j.filter(a=>e.isValidElement(a)&&a.type===te.PanelHandle),_=j.filter(a=>!(e.isValidElement(a)&&a.type===te.PanelHandle)),R=l.leftResolvedPresentation==="overlay",I=e.useCallback(a=>{if(a==null)return;if(typeof a=="number"&&Number.isFinite(a))return a;const u=String(a).trim();if(!u)return;if(u.endsWith("px"))return Number.parseFloat(u);if(u.endsWith("rem")){const P=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(u)*P}if(u.endsWith("%")){const P=Number.parseFloat(u),ne=document.documentElement.clientWidth||window.innerWidth||0;return P/100*ne}const y=Number.parseFloat(u);return Number.isFinite(y)?y:void 0},[]),X=e.useMemo(()=>{if(!S||$)return $;const a=`kookie-ui:shell:panel:${S}`;return{load:()=>{if(typeof window>"u")return;const y=window.localStorage.getItem(a);return y?Number(y):void 0},save:y=>{typeof window>"u"||window.localStorage.setItem(a,String(y))}}},[S,$]);e.useEffect(()=>{let a=!0;return(async()=>{if(!t||!X?.load||R)return;const u=await X.load();a&&typeof u=="number"&&M.current&&(M.current.style.setProperty("--panel-size",`${u}px`),O?.(u))})(),()=>{a=!1}},[t,X,O,R]),e.useEffect(()=>{M.current&&R&&M.current.style.setProperty("--panel-size",`${f}px`)},[R,f]),e.useEffect(()=>{if(M.current&&typeof m>"u"&&typeof E<"u"){const a=I(E);if(typeof a=="number"&&Number.isFinite(a)){const P=Math.min((typeof p=="number"?p:void 0)??a,Math.max((typeof i=="number"?i:void 0)??a,a));M.current.style.setProperty("--panel-size",`${P}px`),v(P,{reason:"init"})}}},[]),e.useEffect(()=>{if(!M.current||typeof m>"u")return;const a=I(m);if(typeof a=="number"&&Number.isFinite(a)){const P=Math.min((typeof p=="number"?p:void 0)??a,Math.max((typeof i=="number"?i:void 0)??a,a));M.current.style.setProperty("--panel-size",`${P}px`),v(P,{reason:"controlled"})}},[m,i,p,I]),e.useEffect(()=>{if(M.current&&l.leftResolvedPresentation!=="overlay"&&l.leftMode==="expanded"&&l.panelMode==="expanded"){const a=M.current.parentElement||null;try{a?.style.removeProperty("width")}catch{}}},[l.leftResolvedPresentation,l.leftMode,l.panelMode]);const K=l.leftMode==="expanded"&&l.panelMode==="expanded";e.useEffect(()=>{const a=z.current,u=L.current;if(a!==null&&a!==l.panelMode){const y=l.panelMode==="expanded";let P="toggle";u!==l.leftMode&&l.leftMode==="collapsed"&&!y&&(P="left"),b?.(y,{reason:P})}z.current=l.panelMode,L.current=l.leftMode},[l.panelMode,l.leftMode,b]);const V=t&&l.leftResolvedPresentation!=="overlay"&&K?e.createElement(ge.PaneResizeContext.Provider,{value:{containerRef:M,cssVarName:"--panel-size",minSize:typeof i=="number"?i:100,maxSize:typeof p=="number"?p:800,defaultSize:f,orientation:"vertical",edge:"end",computeNext:(a,u,y)=>{const P=getComputedStyle(M.current).direction==="rtl",ne=a-u;return y+(P?-ne:ne)},onResize:O,onResizeStart:a=>{const y=M.current?.parentElement;try{y?.style.removeProperty("width")}catch{}C?.(a)},onResizeEnd:a=>{G?.(a),v(a,{reason:"resize"}),X?.save?.(a)},target:"panel",collapsible:!!r,snapPoints:w,snapTolerance:g??8,collapseThreshold:H,requestCollapse:()=>l.setPanelMode("collapsed"),requestToggle:()=>l.togglePane("panel")}},T.length>0?T.map((a,u)=>e.cloneElement(a,{key:a.key??u})):e.createElement(te.PaneHandle,null)):null,{defaultOpen:se,open:he,onOpenChange:ie,size:ve,defaultSize:J,...Y}=le;return e.createElement("div",{...Y,ref:W,className:(0,q.default)("rt-ShellPanel",n),"data-mode":l.panelMode,"data-visible":l.currentBreakpointReady&&(K||l.leftResolvedPresentation!=="overlay"&&l.peekTarget==="panel")||void 0,"data-peek":l.currentBreakpointReady&&l.leftResolvedPresentation!=="overlay"&&l.peekTarget==="panel"||void 0,style:{...Q,"--panel-size":`${f}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":K||void 0},_),V)});N.displayName="Shell.Panel",N.Handle=te.PanelHandle;const fe=e.forwardRef(({className:n,...d},s)=>e.createElement("main",{...d,ref:s,className:(0,q.default)("rt-ShellContent",n)}));fe.displayName="Shell.Content";const Ee=e.forwardRef(({target:n,action:d="toggle",peekOnHover:s,onClick:b,onMouseEnter:m,onMouseLeave:E,children:f,...i},p)=>{const t=(0,c.useShell)(),r=e.useCallback(C=>{switch(b?.(C),t.peekTarget===n&&t.clearPeek(),d){case"toggle":t.togglePane(n);break;case"expand":t.expandPane(n);break;case"collapse":t.collapsePane(n);break}},[t,n,d,b]),h=(()=>{switch(n){case"left":case"rail":return t.leftMode==="collapsed";case"panel":return t.leftMode==="collapsed"||t.panelMode==="collapsed";case"sidebar":return t.sidebarMode==="collapsed";case"inspector":return t.inspectorMode==="collapsed";case"bottom":return t.bottomMode==="collapsed"}})(),D=e.useCallback(C=>{m?.(C),!(!s||!h)&&t.peekPane(n)},[m,s,h,t,n]),O=e.useCallback(C=>{E?.(C),s&&t.peekTarget===n&&t.clearPeek()},[E,s,t,n]);return e.createElement("button",{...i,ref:p,onClick:r,onMouseEnter:D,onMouseLeave:O,"data-shell-trigger":n,"data-shell-action":d},f)});Ee.displayName="Shell.Trigger";
|
|
1
|
+
"use strict";"use client";var Ne=Object.create;var ce=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var He=(n,r)=>{for(var d in r)ce(n,d,{get:r[d],enumerable:!0})},Ce=(n,r,d,E)=>{if(r&&typeof r=="object"||typeof r=="function")for(let M of we(r))!Be.call(n,M)&&M!==d&&ce(n,M,{get:()=>r[M],enumerable:!(E=De(r,M))||E.enumerable});return n};var Pe=(n,r,d)=>(d=n!=null?Ne(Ae(n)):{},Ce(r||!n||!n.__esModule?ce(d,"default",{value:n,enumerable:!0}):d,n)),ze=n=>Ce(ce({},"__esModule",{value:!0}),n);var Fe={};He(Fe,{Bottom:()=>Me.Bottom,Content:()=>me,Header:()=>ue,Inspector:()=>ye.Inspector,Left:()=>fe,Panel:()=>A,Rail:()=>ee,Root:()=>Ee,Sidebar:()=>de.Sidebar,Trigger:()=>he,useResponsivePresentation:()=>le.useResponsivePresentation,useShell:()=>f.useShell});module.exports=ze(Fe);var e=Pe(require("react")),U=Pe(require("classnames")),be=Pe(require("./sheet.js")),Re=require("./visually-hidden.js"),le=require("./shell.hooks.js"),ge=require("./_internal/shell-resize.js"),ae=require("./_internal/shell-handles.js"),de=require("./_internal/shell-sidebar.js"),Me=require("./_internal/shell-bottom.js"),ye=require("./_internal/shell-inspector.js"),xe=require("./shell.types.js"),f=require("./shell.context.js");function Ie(){const[n,r]=e.useState("initial"),[d,E]=e.useState(!1);return e.useEffect(()=>{if(typeof window>"u")return;const h=Object.entries(xe._BREAKPOINTS).map(([i,t])=>[i,window.matchMedia(t)]),m=()=>{const i=h.filter(([,l])=>l.matches).map(([l])=>l),t=i[i.length-1]??"initial";r(t),E(!0)};m();const c=[];return h.forEach(([,i])=>{const t=i;typeof t.addEventListener=="function"&&typeof t.removeEventListener=="function"?(t.addEventListener("change",m),c.push(()=>t.removeEventListener?.("change",m))):typeof t.addListener=="function"&&typeof t.removeListener=="function"&&(t.addListener(m),c.push(()=>t.removeListener?.(m)))}),()=>{c.forEach(i=>{try{i()}catch{}})}},[]),{bp:n,ready:d}}function Ve(n,r){switch(r.type){case"SET_LEFT_MODE":return r.mode==="collapsed"?{...n,leftMode:"collapsed",panelMode:"collapsed"}:{...n,leftMode:r.mode};case"SET_PANEL_MODE":return r.mode==="expanded"&&n.leftMode!=="expanded"?{...n,leftMode:"expanded",panelMode:"expanded"}:{...n,panelMode:r.mode};case"SET_SIDEBAR_MODE":return{...n,sidebarMode:r.mode};case"SET_INSPECTOR_MODE":return{...n,inspectorMode:r.mode};case"SET_BOTTOM_MODE":return{...n,bottomMode:r.mode};case"TOGGLE_PANE":{switch(r.target){case"left":case"rail":return{...n,leftMode:n.leftMode==="expanded"?"collapsed":"expanded",panelMode:n.leftMode==="expanded"?"collapsed":n.panelMode};case"panel":return n.leftMode==="collapsed"?{...n,leftMode:"expanded",panelMode:"expanded"}:{...n,panelMode:n.panelMode==="expanded"?"collapsed":"expanded"};case"sidebar":{const d=n.sidebarMode==="collapsed"?"expanded":n.sidebarMode==="expanded"?"collapsed":"expanded";return{...n,sidebarMode:d}}case"inspector":return{...n,inspectorMode:n.inspectorMode==="expanded"?"collapsed":"expanded"};case"bottom":return{...n,bottomMode:n.bottomMode==="expanded"?"collapsed":"expanded"};default:return n}return n}case"EXPAND_PANE":{switch(r.target){case"left":case"rail":return{...n,leftMode:"expanded"};case"panel":return{...n,leftMode:"expanded",panelMode:"expanded"};case"sidebar":return{...n,sidebarMode:"expanded"};case"inspector":return{...n,inspectorMode:"expanded"};case"bottom":return{...n,bottomMode:"expanded"};default:return n}return n}case"COLLAPSE_PANE":{switch(r.target){case"left":case"rail":return{...n,leftMode:"collapsed",panelMode:"collapsed"};case"panel":return{...n,panelMode:"collapsed"};case"sidebar":return{...n,sidebarMode:"collapsed"};case"inspector":return{...n,inspectorMode:"collapsed"};case"bottom":return{...n,bottomMode:"collapsed"};default:return n}return n}}return n}const Ee=e.forwardRef(({className:n,children:r,height:d="full",...E},M)=>{const{bp:h,ready:m}=Ie(),c=e.Children.toArray(r),i=c.some(o=>e.isValidElement(o)&&o.type?.displayName==="Shell.Panel"&&!!o.props?.defaultOpen),t=c.some(o=>e.isValidElement(o)&&o.type?.displayName==="Shell.Rail"&&!!o.props?.defaultOpen),[l,v]=e.useReducer(Ve,{leftMode:i||t?"expanded":"collapsed",panelMode:i?"expanded":"collapsed",sidebarMode:"expanded",inspectorMode:"collapsed",bottomMode:"collapsed"}),S=e.useCallback(o=>v({type:"SET_LEFT_MODE",mode:o}),[]),T=e.useCallback(o=>v({type:"SET_PANEL_MODE",mode:o}),[]),y=e.useCallback(o=>v({type:"SET_SIDEBAR_MODE",mode:o}),[]),$=e.useCallback(o=>v({type:"SET_INSPECTOR_MODE",mode:o}),[]),N=e.useCallback(o=>v({type:"SET_BOTTOM_MODE",mode:o}),[]),[g,z]=e.useState(!1),[O,L]=e.useState(!1),j=e.useRef(o=>o==="collapsed"?"thin":o==="thin"?"expanded":"collapsed"),X=e.useCallback(o=>{j.current=o},[]);e.useEffect(()=>{O&&g&&console.warn("Shell: Sidebar cannot coexist with Rail or Panel. Use either Rail+Panel OR Sidebar.")},[O,g]);const[B,ne]=e.useState(void 0),K=e.useCallback(o=>ne(o),[]),re=e.useRef(64),q=e.useRef(288),G=e.useCallback(o=>{re.current=o},[]),s=e.useCallback(o=>{q.current=o},[]),C=e.useMemo(()=>{const o=e.Children.toArray(r),H=(w,se)=>e.isValidElement(w)&&(w.type===se||w.type?.displayName===se.displayName);return o.some(w=>H(w,ee)||H(w,A))},[r]),I=e.useMemo(()=>{const o=e.Children.toArray(r),H=(w,se)=>e.isValidElement(w)&&(w.type===se||w.type?.displayName===se.displayName);return o.some(w=>H(w,de.Sidebar))},[r]),_=e.useCallback(o=>{if(o==="sidebar"){const H=j.current(l.sidebarMode);y(H);return}v({type:"TOGGLE_PANE",target:o})},[l.sidebarMode,y]),u=e.useCallback(o=>{if(o==="sidebar")return y("expanded");v({type:"EXPAND_PANE",target:o})},[y]),x=e.useCallback(o=>{if(o==="sidebar")return y("collapsed");v({type:"COLLAPSE_PANE",target:o})},[y]),J=e.useMemo(()=>({leftMode:l.leftMode,setLeftMode:S,panelMode:l.panelMode,setPanelMode:T,sidebarMode:l.sidebarMode,setSidebarMode:y,inspectorMode:l.inspectorMode,setInspectorMode:$,bottomMode:l.bottomMode,setBottomMode:N,hasLeft:g,setHasLeft:z,hasSidebar:O,setHasSidebar:L,currentBreakpoint:h,currentBreakpointReady:m,leftResolvedPresentation:B,togglePane:_,expandPane:u,collapsePane:x,setSidebarToggleComputer:X,onLeftPres:K,onRailDefaults:G,onPanelDefaults:s}),[l.leftMode,S,l.panelMode,T,l.sidebarMode,y,l.inspectorMode,$,l.bottomMode,N,g,O,h,m,B,_,u,x,X,K,G,s]),k=e.Children.toArray(r),D=(o,H)=>e.isValidElement(o)&&(o.type===H||o.type?.displayName===H.displayName),F=k.filter(o=>D(o,ue)),V=k.filter(o=>D(o,ee)),R=k.filter(o=>D(o,A)),Q=k.filter(o=>D(o,de.Sidebar)),ie=k.filter(o=>D(o,me)),pe=k.filter(o=>D(o,ye.Inspector)),W=k.filter(o=>D(o,Me.Bottom)),te=V[0]?.props?.open;e.useEffect(()=>{if(typeof te>"u")return;S(!!te?"expanded":"collapsed")},[te,S]);const ve=e.useMemo(()=>d==="full"?{height:"100vh"}:d==="auto"?{height:"auto"}:typeof d=="string"?{height:d}:typeof d=="number"?{height:`${d}px`}:{},[d]),[Y,Z]=e.useState(null),a=e.useCallback(o=>Z(o),[]),p=e.useCallback(()=>Z(null),[]),P=e.useMemo(()=>({currentBreakpoint:h,currentBreakpointReady:m,leftResolvedPresentation:B}),[h,m,B]),b=e.useMemo(()=>({leftMode:l.leftMode,setLeftMode:S}),[l.leftMode,S]),oe=e.useMemo(()=>({panelMode:l.panelMode,setPanelMode:T}),[l.panelMode,T]),Se=e.useMemo(()=>({sidebarMode:l.sidebarMode,setSidebarMode:y}),[l.sidebarMode,y]),Te=e.useMemo(()=>({inspectorMode:l.inspectorMode,setInspectorMode:$}),[l.inspectorMode,$]),Oe=e.useMemo(()=>({bottomMode:l.bottomMode,setBottomMode:N}),[l.bottomMode,N]),Le=e.useMemo(()=>({hasLeft:g,setHasLeft:z,hasSidebar:O,setHasSidebar:L}),[g,z,O,L]),_e=e.useMemo(()=>({peekTarget:Y,setPeekTarget:Z,peekPane:a,clearPeek:p}),[Y,Z,a,p]),ke=e.useMemo(()=>({togglePane:_,expandPane:u,collapsePane:x,setSidebarToggleComputer:X}),[_,u,x,X]);return e.createElement("div",{...E,ref:M,className:(0,U.default)("rt-ShellRoot",n),style:{...ve,...E.style}},e.createElement(f.ShellProvider,{value:{...J,peekTarget:Y,setPeekTarget:Z,peekPane:a,clearPeek:p}},e.createElement(f.PresentationContext.Provider,{value:P},e.createElement(f.LeftModeContext.Provider,{value:b},e.createElement(f.PanelModeContext.Provider,{value:oe},e.createElement(f.SidebarModeContext.Provider,{value:Se},e.createElement(f.InspectorModeContext.Provider,{value:Te},e.createElement(f.BottomModeContext.Provider,{value:Oe},e.createElement(f.CompositionContext.Provider,{value:Le},e.createElement(f.PeekContext.Provider,{value:_e},e.createElement(f.ActionsContext.Provider,{value:ke},F,e.createElement("div",{className:"rt-ShellBody","data-peek-target":Y??void 0,style:Y==="rail"||Y==="panel"?{"--peek-rail-width":`${re.current}px`}:void 0},C&&!I?(()=>{const o=V[0],H=o?{onOpenChange:o.props?.onOpenChange,open:o.props?.open,defaultOpen:o.props?.defaultOpen,presentation:o.props?.presentation,collapsible:o.props?.collapsible,onExpand:o.props?.onExpand,onCollapse:o.props?.onCollapse}:{defaultOpen:i?!0:void 0};return e.createElement(fe,{...H},V,R)})():Q,ie,pe),W)))))))))))});Ee.displayName="Shell.Root";const ue=e.forwardRef(({className:n,height:r=64,style:d,...E},M)=>e.createElement("header",{...E,ref:M,className:(0,U.default)("rt-ShellHeader",n),style:{...d,"--shell-header-height":`${r}px`}}));ue.displayName="Shell.Header";const fe=e.forwardRef(({className:n,presentation:r={initial:"fixed",sm:"fixed"},collapsible:d=!0,onExpand:E,onCollapse:M,children:h,style:m,...c},i)=>{const t=(0,f.useShell)(),l=(0,le.useResponsivePresentation)(r),v=l==="overlay",S=l==="stacked",T=e.useRef(null);e.useEffect(()=>{t.onLeftPres?.(l)},[t,l]);const y=e.useCallback(C=>{T.current=C,typeof i=="function"?i(C):i&&(i.current=C)},[i]);e.useEffect(()=>(t.setHasLeft(!0),()=>t.setHasLeft(!1)),[t]);const $=e.useRef(null),N=e.useRef(null),g=e.useRef(!1),z=(0,le.useResponsiveValue)(c.defaultOpen),O=e.useRef(!1),L=c.open,j=c.defaultOpen;e.useEffect(()=>{if(O.current||!t.currentBreakpointReady||typeof L<"u"||typeof j>"u")return;O.current=!0;const C=!!z;t.setLeftMode(C?"expanded":"collapsed"),c.onOpenChange?.(C,{reason:"init"})},[t,L,j,z,c]),e.useEffect(()=>{if(typeof L<"u"){const C=!!L;t.setLeftMode(C?"expanded":"collapsed");return}},[t,L]),e.useEffect(()=>{typeof c.open<"u"||(!g.current&&z&&t.leftMode==="expanded"&&(c.onOpenChange?.(!0,{reason:"init"}),g.current=!0),N.current!==null&&N.current!==t.leftMode&&c.onOpenChange?.(t.leftMode==="expanded",{reason:"toggle"}),N.current=t.leftMode)},[t,z,c]),e.useEffect(()=>{t.leftMode==="expanded"?E?.():M?.()},[t.leftMode,E,M]);const X=t.leftMode==="expanded";if(v){const C=t.leftMode==="expanded",I=e.Children.toArray(h),_=(R,Q)=>e.isValidElement(R)&&R.type===Q,u=I.find(R=>_(R,ee)),x=I.find(R=>_(R,A)),J=typeof u?.props?.expandedSize=="number"?u.props.expandedSize:64,k=typeof x?.props?.expandedSize=="number"?x.props.expandedSize:288,D=!!u,F=!!x,V=(D?J:0)+(t.panelMode==="expanded"&&F?k:0);return e.createElement(be.Root,{open:C,onOpenChange:R=>t.setLeftMode(R?"expanded":"collapsed")},e.createElement(be.Content,{side:"start",style:{padding:0},width:{initial:`${V}px`}},e.createElement(Re.VisuallyHidden,null,e.createElement(be.Title,null,"Navigation")),e.createElement("div",{className:"rt-ShellLeft"},h)))}if(S){const C=t.leftMode==="expanded",I=e.Children.toArray(h),_=(W,te)=>e.isValidElement(W)&&W.type===te,u=I.find(W=>_(W,ee)),x=I.find(W=>_(W,A)),J=typeof u?.props?.expandedSize=="number"?u.props.expandedSize:64,k=typeof x?.props?.expandedSize=="number"?x.props.expandedSize:288,D=!!u,V=!!x&&(t.panelMode==="expanded"||t.peekTarget==="panel"),{open:R,defaultOpen:Q,onOpenChange:ie,...pe}=c;return e.createElement("div",{...pe,ref:y,className:(0,U.default)("rt-ShellLeft",n),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":l,style:{...m},"data-open":C||void 0},h)}const{open:B,defaultOpen:ne,onOpenChange:K,mode:re,defaultMode:q,onModeChange:G,...s}=c;return e.createElement("div",{...s,ref:y,className:(0,U.default)("rt-ShellLeft",n),"data-mode":t.leftMode,"data-peek":t.peekTarget==="left"||t.peekTarget==="rail"||t.peekTarget==="panel"||void 0,"data-presentation":l,style:{...m}},h)});fe.displayName="Shell.Left";const ee=e.forwardRef(({className:n,presentation:r,expandedSize:d=64,collapsible:E,onExpand:M,onCollapse:h,children:m,style:c,...i},t)=>{const l=(0,f.useShell)(),v=e.useRef(null);e.useEffect(()=>{const g=typeof i.open<"u";if(v.current===null){v.current=g;return}v.current!==g&&(console.warn("Shell.Rail: Switching between controlled and uncontrolled `open` is not supported."),v.current=g)},[i.open]),e.useEffect(()=>{l.onRailDefaults?.(d)},[l,d]);const S=l.leftMode==="expanded",{defaultOpen:T,open:y,onOpenChange:$,...N}=i;return e.createElement("div",{...N,ref:t,className:(0,U.default)("rt-ShellRail",n),"data-mode":l.leftMode,"data-peek":l.currentBreakpointReady&&l.leftResolvedPresentation!=="overlay"&&l.peekTarget==="rail"||void 0,style:{...c,"--rail-size":`${d}px`}},e.createElement("div",{className:"rt-ShellRailContent","data-visible":l.currentBreakpointReady&&(S||l.leftResolvedPresentation!=="overlay"&&l.peekTarget==="rail")||void 0},m))});ee.displayName="Shell.Rail";const A=e.forwardRef(({className:n,defaultOpen:r,open:d,onOpenChange:E,size:M,defaultSize:h,expandedSize:m=288,minSize:c,maxSize:i,resizable:t,collapsible:l=!0,onExpand:v,onCollapse:S,onResize:T,onResizeStart:y,onResizeEnd:$,snapPoints:N,snapTolerance:g,collapseThreshold:z,paneId:O,persistence:L,children:j,style:X,onSizeChange:B,sizeUpdate:ne,sizeUpdateMs:K=50,...re},q)=>{const G=e.useMemo(()=>{if(!B)return()=>{};if(ne==="debounce"){let a=null;return(P,b)=>{a&&clearTimeout(a),a=setTimeout(()=>{B?.(P,b)},K)}}if(ne==="throttle"){let a=0;return(p,P)=>{const b=Date.now();b-a>=K&&(a=b,B?.(p,P))}}return(a,p)=>B?.(a,p)},[B,ne,K]),s=(0,f.useShell)(),C=e.useRef(null),I=e.useRef(null),_=e.useRef(!1);e.useEffect(()=>{typeof d>"u"&&typeof r=="boolean"&&(r?(s.setLeftMode("expanded"),s.setPanelMode("expanded")):s.setPanelMode("collapsed"))},[]),e.useEffect(()=>{typeof d>"u"||(d?(s.leftMode!=="expanded"&&s.setLeftMode("expanded"),s.panelMode!=="expanded"&&s.setPanelMode("expanded")):s.panelMode!=="collapsed"&&s.setPanelMode("collapsed"))},[s,d]),e.useEffect(()=>{const a=typeof d<"u";A._wasControlled=A._wasControlled??a,A._wasControlled!==a&&(console.warn("Shell.Panel: Switching between controlled and uncontrolled `open` is not supported."),A._wasControlled=a)},[d]),e.useEffect(()=>{_.current||typeof d>"u"&&r&&s.panelMode==="expanded"&&(E?.(!0,{reason:"init"}),_.current=!0)},[]),e.useEffect(()=>{s.onPanelDefaults?.(m)},[s,m]);const u=e.useRef(null),x=e.useCallback(a=>{u.current=a,typeof q=="function"?q(a):q&&(q.current=a)},[q]),J=e.Children.toArray(j),k=J.filter(a=>e.isValidElement(a)&&a.type===ae.PanelHandle),D=J.filter(a=>!(e.isValidElement(a)&&a.type===ae.PanelHandle)),F=s.leftResolvedPresentation==="overlay",V=e.useCallback(a=>{if(a==null)return;if(typeof a=="number"&&Number.isFinite(a))return a;const p=String(a).trim();if(!p)return;if(p.endsWith("px"))return Number.parseFloat(p);if(p.endsWith("rem")){const b=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(p)*b}if(p.endsWith("%")){const b=Number.parseFloat(p),oe=document.documentElement.clientWidth||window.innerWidth||0;return b/100*oe}const P=Number.parseFloat(p);return Number.isFinite(P)?P:void 0},[]),R=e.useMemo(()=>{if(!O||L)return L;const a=`kookie-ui:shell:panel:${O}`;return{load:()=>{if(typeof window>"u")return;const P=window.localStorage.getItem(a);return P?Number(P):void 0},save:P=>{typeof window>"u"||window.localStorage.setItem(a,String(P))}}},[O,L]);e.useEffect(()=>{let a=!0;return(async()=>{if(!t||!R?.load||F)return;const p=await R.load();a&&typeof p=="number"&&u.current&&(u.current.style.setProperty("--panel-size",`${p}px`),T?.(p))})(),()=>{a=!1}},[t,R,T,F]),e.useEffect(()=>{u.current&&F&&u.current.style.setProperty("--panel-size",`${m}px`)},[F,m]),e.useEffect(()=>{if(u.current&&typeof M>"u"&&typeof h<"u"){const a=V(h);if(typeof a=="number"&&Number.isFinite(a)){const b=Math.min((typeof i=="number"?i:void 0)??a,Math.max((typeof c=="number"?c:void 0)??a,a));u.current.style.setProperty("--panel-size",`${b}px`),G(b,{reason:"init"})}}},[]),e.useEffect(()=>{if(!u.current||typeof M>"u")return;const a=V(M);if(typeof a=="number"&&Number.isFinite(a)){const b=Math.min((typeof i=="number"?i:void 0)??a,Math.max((typeof c=="number"?c:void 0)??a,a));u.current.style.setProperty("--panel-size",`${b}px`),G(b,{reason:"controlled"})}},[M,c,i,V,G]),e.useEffect(()=>{if(u.current&&s.leftResolvedPresentation!=="overlay"&&s.leftMode==="expanded"&&s.panelMode==="expanded"){const a=u.current.parentElement||null;try{a?.style.removeProperty("width")}catch{}}},[s.leftResolvedPresentation,s.leftMode,s.panelMode]);const Q=s.leftMode==="expanded"&&s.panelMode==="expanded";e.useEffect(()=>{const a=C.current,p=I.current;if(a!==null&&a!==s.panelMode){const P=s.panelMode==="expanded";let b="toggle";p!==s.leftMode&&s.leftMode==="collapsed"&&!P&&(b="left"),E?.(P,{reason:b})}C.current=s.panelMode,I.current=s.leftMode},[s.panelMode,s.leftMode,E]);const ie=t&&s.leftResolvedPresentation!=="overlay"&&Q?e.createElement(ge.PaneResizeContext.Provider,{value:{containerRef:u,cssVarName:"--panel-size",minSize:typeof c=="number"?c:100,maxSize:typeof i=="number"?i:800,defaultSize:m,orientation:"vertical",edge:"end",computeNext:(a,p,P)=>{const b=getComputedStyle(u.current).direction==="rtl",oe=a-p;return P+(b?-oe:oe)},onResize:T,onResizeStart:a=>{const P=u.current?.parentElement;try{P?.style.removeProperty("width")}catch{}y?.(a)},onResizeEnd:a=>{$?.(a),G(a,{reason:"resize"}),R?.save?.(a)},target:"panel",collapsible:!!l,snapPoints:N,snapTolerance:g??8,collapseThreshold:z,requestCollapse:()=>s.setPanelMode("collapsed"),requestToggle:()=>s.togglePane("panel")}},k.length>0?k.map((a,p)=>e.cloneElement(a,{key:a.key??p})):e.createElement(ae.PaneHandle,null)):null,{defaultOpen:pe,open:W,onOpenChange:te,size:ve,defaultSize:Y,...Z}=re;return e.createElement("div",{...Z,ref:x,className:(0,U.default)("rt-ShellPanel",n),"data-mode":s.panelMode,"data-visible":s.currentBreakpointReady&&(Q||s.leftResolvedPresentation!=="overlay"&&s.peekTarget==="panel")||void 0,"data-peek":s.currentBreakpointReady&&s.leftResolvedPresentation!=="overlay"&&s.peekTarget==="panel"||void 0,style:{...X,"--panel-size":`${m}px`}},e.createElement("div",{className:"rt-ShellPanelContent","data-visible":Q||void 0},D),ie)});A.displayName="Shell.Panel",A.Handle=ae.PanelHandle;const me=e.forwardRef(({className:n,...r},d)=>e.createElement("main",{...r,ref:d,className:(0,U.default)("rt-ShellContent",n)}));me.displayName="Shell.Content";const he=e.forwardRef(({target:n,action:r="toggle",peekOnHover:d,onClick:E,onMouseEnter:M,onMouseLeave:h,children:m,...c},i)=>{const t=(0,f.useShell)(),l=e.useCallback(y=>{switch(E?.(y),t.peekTarget===n&&t.clearPeek(),r){case"toggle":t.togglePane(n);break;case"expand":t.expandPane(n);break;case"collapse":t.collapsePane(n);break}},[t,n,r,E]),v=(()=>{switch(n){case"left":case"rail":return t.leftMode==="collapsed";case"panel":return t.leftMode==="collapsed"||t.panelMode==="collapsed";case"sidebar":return t.sidebarMode==="collapsed";case"inspector":return t.inspectorMode==="collapsed";case"bottom":return t.bottomMode==="collapsed"}})(),S=e.useCallback(y=>{M?.(y),!(!d||!v)&&t.peekPane(n)},[M,d,v,t,n]),T=e.useCallback(y=>{h?.(y),d&&t.peekTarget===n&&t.clearPeek()},[h,d,t,n]);return e.createElement("button",{...c,ref:i,onClick:l,onMouseEnter:S,onMouseLeave:T,"data-shell-trigger":n,"data-shell-action":r},m)});he.displayName="Shell.Trigger";
|
|
2
2
|
//# sourceMappingURL=shell.js.map
|