@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from './slot.js';\nimport { Accordion } from 'radix-ui';\n\nimport { sidebarPropDefs } from './sidebar.props.js';\nimport { useThemeContext } from './theme.js';\n// import { IconButton } from './icon-button.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Separator } from './separator.js';\nimport { ThickChevronRightIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { Kbd } from './kbd.js';\nimport { Badge } from './badge.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { BadgeProps } from './badge.js';\n\n// Badge configuration type for sidebar menu buttons\ntype BadgeConfig = {\n content: React.ReactNode;\n variant?: BadgeProps['variant'];\n size?: BadgeProps['size'];\n color?: BadgeProps['color'];\n highContrast?: BadgeProps['highContrast'];\n radius?: BadgeProps['radius'];\n};\n\n// Internal presentational context (not exported) for size/menu variant\ntype SidebarVisualContextValue = {\n size: '1' | '2';\n menuVariant: 'solid' | 'soft';\n};\nconst SidebarVisualContext = React.createContext<SidebarVisualContextValue | null>(null);\nfunction useSidebarVisual() {\n return React.useContext(SidebarVisualContext);\n}\n\n// Sidebar is now independent of Shell - no integration needed\n\n// Main Sidebar component\ntype SidebarOwnProps = GetPropDefTypes<typeof sidebarPropDefs>;\ninterface SidebarProps extends ComponentPropsWithout<'div', RemovedProps>, SidebarOwnProps {}\n\nconst Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>((props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n const {\n size = sidebarPropDefs.size.default,\n variant = sidebarPropDefs.variant.default,\n menuVariant = sidebarPropDefs.menuVariant.default,\n layout = sidebarPropDefs.layout.default,\n // type = sidebarPropDefs.type.default,\n // side = sidebarPropDefs.side.default,\n // collapsible = sidebarPropDefs.collapsible.default,\n panelBackground,\n color,\n highContrast = sidebarPropDefs.highContrast.default,\n } = props;\n\n const { className, children, ...rootProps } = extractProps(props, sidebarPropDefs);\n const { asChild: _, panelBackground: __, ...safeRootProps } = rootProps; // Remove asChild and panelBackground from DOM props\n const resolvedColor = color || themeContext.accentColor;\n\n // Resolve layout (default to 'panel')\n const resolvedLayout = layout || 'panel';\n\n // Update context with current props - we'll pass the resolved values\n const resolvedSize = typeof size === 'object' ? size.initial || '2' : size;\n return (\n <div\n {...safeRootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n className={classNames('rt-SidebarRoot', className)}\n >\n <SidebarVisualContext.Provider value={{ size: resolvedSize, menuVariant }}>\n <div\n className={classNames(\n 'rt-SidebarContainer',\n `rt-variant-${variant}`,\n `rt-r-size-${resolvedSize}`,\n `rt-menu-variant-${menuVariant}`,\n resolvedLayout && `rt-layout-${resolvedLayout}`,\n )}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-panel-background={panelBackground}\n data-layout={resolvedLayout}\n >\n {children}\n </div>\n </SidebarVisualContext.Provider>\n </div>\n );\n});\nSidebar.displayName = 'Sidebar.Root';\n\n// Sidebar content area\ninterface SidebarContentProps extends React.ComponentPropsWithoutRef<'div'> {\n id?: string;\n role?: 'navigation' | 'none';\n 'aria-label'?: string;\n}\n\nconst SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(\n (\n {\n className,\n children,\n role = 'navigation',\n 'aria-label': ariaLabel = 'Main navigation',\n id,\n ...props\n },\n forwardedRef,\n ) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <ScrollArea type=\"hover\">\n <div\n {...props}\n ref={forwardedRef}\n id={id}\n role={role}\n aria-label={ariaLabel}\n className={classNames(\n 'rt-BaseMenuContent',\n 'rt-SidebarContent',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n className,\n )}\n >\n <div className=\"rt-BaseMenuViewport\">{children}</div>\n </div>\n </ScrollArea>\n );\n },\n);\nSidebarContent.displayName = 'Sidebar.Content';\n\n// Sidebar header\ninterface SidebarHeaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Whether to use the default flex container layout.\n * @default true\n */\n asContainer?: boolean;\n}\n\nconst SidebarHeader = React.forwardRef<HTMLDivElement, SidebarHeaderProps>(\n ({ className, asContainer = true, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-SidebarHeader',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n {\n 'rt-SidebarHeader--container': asContainer,\n },\n className,\n )}\n />\n );\n },\n);\nSidebarHeader.displayName = 'Sidebar.Header';\n\n// Sidebar footer\ninterface SidebarFooterProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Whether to use the default flex container layout.\n * @default true\n */\n asContainer?: boolean;\n}\n\nconst SidebarFooter = React.forwardRef<HTMLDivElement, SidebarFooterProps>(\n ({ className, asContainer = true, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-SidebarFooter',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n {\n 'rt-SidebarFooter--container': asContainer,\n },\n className,\n )}\n />\n );\n },\n);\nSidebarFooter.displayName = 'Sidebar.Footer';\n\n// Sidebar trigger button\n// removed Trigger in presentational-only Sidebar\n\n// Removed SidebarInset - not needed\n\n// Sidebar separator\ninterface SidebarSeparatorProps extends ComponentPropsWithout<typeof Separator, RemovedProps> {}\n\nconst SidebarSeparator = React.forwardRef<\n React.ComponentRef<typeof Separator>,\n SidebarSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <Separator\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarSeparator', className)}\n />\n));\nSidebarSeparator.displayName = 'Sidebar.Separator';\n\n// Menu components - reusing dropdown menu structure\ninterface SidebarMenuProps extends React.ComponentPropsWithoutRef<'ul'> {}\n\nconst SidebarMenu = React.forwardRef<HTMLUListElement, SidebarMenuProps>(\n ({ className, ...props }, forwardedRef) => (\n <ul\n {...props}\n ref={forwardedRef}\n role=\"menu\"\n className={classNames('rt-SidebarMenu', className)}\n />\n ),\n);\nSidebarMenu.displayName = 'Sidebar.Menu';\n\ninterface SidebarMenuItemProps extends React.ComponentPropsWithoutRef<'li'> {}\n\nconst SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(\n ({ className, ...props }, forwardedRef) => (\n <li {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuItem', className)} />\n ),\n);\nSidebarMenuItem.displayName = 'Sidebar.MenuItem';\n\ninterface SidebarMenuButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n isActive?: boolean;\n shortcut?: React.ReactNode;\n badge?: string | BadgeConfig;\n}\n\nconst SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(\n (\n {\n asChild = false,\n isActive = false,\n shortcut,\n badge,\n className,\n children,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n ...props\n },\n forwardedRef,\n ) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const visual = useSidebarVisual();\n const sidebarSize = visual?.size ?? '2';\n\n const Comp = asChild ? Slot : 'button';\n\n const { onClick } = props;\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (event.key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n if (onClick) onClick(event as any);\n break;\n case 'ArrowDown': {\n event.preventDefault();\n // Focus next menu item\n const nextItem = (event.currentTarget as HTMLElement).nextElementSibling?.querySelector(\n '[role=\"menuitem\"]',\n ) as HTMLElement;\n if (nextItem) nextItem.focus();\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n // Focus previous menu item\n const prevItem = (\n event.currentTarget as HTMLElement\n ).previousElementSibling?.querySelector('[role=\"menuitem\"]') as HTMLElement;\n if (prevItem) prevItem.focus();\n break;\n }\n }\n onKeyDown?.(event);\n },\n [onClick, onKeyDown],\n );\n\n return (\n <Comp\n {...props}\n ref={forwardedRef}\n role=\"menuitem\"\n aria-current={isActive ? 'page' : undefined}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', className)}\n data-active={isActive || undefined}\n data-highlighted={isHighlighted || undefined}\n onKeyDown={handleKeyDown}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event);\n }}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n {/* Badge with soft variant default and size mapping to sidebar size */}\n {badge && (\n <div className=\"rt-SidebarMenuBadge\">\n {typeof badge === 'string' ? (\n <Badge size={sidebarSize} variant=\"soft\">\n {badge}\n </Badge>\n ) : (\n <Badge\n size={badge.size || sidebarSize}\n variant={badge.variant || 'soft'}\n color={badge.color}\n highContrast={badge.highContrast}\n radius={badge.radius}\n >\n {badge.content}\n </Badge>\n )}\n </div>\n )}\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-SidebarMenuShortcut\">\n <Kbd size={sidebarSize}>{shortcut}</Kbd>\n </div>\n )}\n </>\n )}\n </Comp>\n );\n },\n);\nSidebarMenuButton.displayName = 'Sidebar.MenuButton';\n\n// Sub-menu components using Radix Accordion\ninterface SidebarMenuSubProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n}\n\nconst SidebarMenuSub = React.forwardRef<HTMLDivElement, SidebarMenuSubProps>(\n ({ defaultOpen = false, children, ...props }, forwardedRef) => {\n return (\n <div {...props} ref={forwardedRef}>\n <Accordion.Root type=\"single\" collapsible defaultValue={defaultOpen ? 'item' : undefined}>\n <Accordion.Item value=\"item\">{children}</Accordion.Item>\n </Accordion.Root>\n </div>\n );\n },\n);\nSidebarMenuSub.displayName = 'Sidebar.MenuSub';\n\ninterface SidebarMenuSubTriggerProps\n extends React.ComponentPropsWithoutRef<typeof Accordion.Trigger> {\n asChild?: boolean;\n}\n\nconst SidebarMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof Accordion.Trigger>,\n SidebarMenuSubTriggerProps\n>(\n (\n { asChild = false, className, children, onMouseEnter, onMouseLeave, ...props },\n forwardedRef,\n ) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n\n return (\n <Accordion.Header asChild>\n <div>\n <Accordion.Trigger\n {...props}\n ref={forwardedRef}\n asChild={asChild}\n role=\"menuitem\"\n aria-haspopup=\"true\"\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-SidebarMenuButton',\n 'rt-SidebarMenuSubTrigger',\n className,\n )}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event);\n }}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n <ThickChevronRightIcon\n className={classNames(\n 'rt-BaseMenuSubTriggerIcon',\n 'rt-SidebarMenuSubTriggerIcon',\n )}\n />\n </>\n )}\n </Accordion.Trigger>\n </div>\n </Accordion.Header>\n );\n },\n);\nSidebarMenuSubTrigger.displayName = 'Sidebar.MenuSubTrigger';\n\ninterface SidebarMenuSubContentProps\n extends React.ComponentPropsWithoutRef<typeof Accordion.Content> {}\n\nconst SidebarMenuSubContent = React.forwardRef<\n React.ElementRef<typeof Accordion.Content>,\n SidebarMenuSubContentProps\n>(({ className, children, ...props }, forwardedRef) => {\n return (\n <Accordion.Content\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarMenuSubContent', className)}\n >\n <div className=\"rt-SidebarMenuSubList\">{children}</div>\n </Accordion.Content>\n );\n});\nSidebarMenuSubContent.displayName = 'Sidebar.MenuSubContent';\n\n// Group components\ninterface SidebarGroupProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-SidebarGroup', className)}\n />\n ),\n);\nSidebarGroup.displayName = 'Sidebar.Group';\n\ninterface SidebarGroupLabelProps extends React.ComponentPropsWithoutRef<'div'> {\n asChild?: boolean;\n}\n\nconst SidebarGroupLabel = React.forwardRef<HTMLDivElement, SidebarGroupLabelProps>(\n ({ asChild = false, className, ...props }, forwardedRef) => {\n const Comp = asChild ? Slot : 'div';\n\n return (\n <Comp\n {...props}\n ref={forwardedRef}\n role=\"group\"\n className={classNames('rt-BaseMenuLabel', 'rt-SidebarGroupLabel', className)}\n />\n );\n },\n);\nSidebarGroupLabel.displayName = 'Sidebar.GroupLabel';\n\ninterface SidebarGroupContentProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, SidebarGroupContentProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarGroupContent', className)}\n />\n ),\n);\nSidebarGroupContent.displayName = 'Sidebar.GroupContent';\n\n// Export all components following shadcn's pattern\nexport {\n Sidebar as Root,\n SidebarContent as Content,\n SidebarHeader as Header,\n SidebarFooter as Footer,\n SidebarSeparator as Separator,\n SidebarMenu as Menu,\n SidebarMenuItem as MenuItem,\n SidebarMenuButton as MenuButton,\n SidebarMenuSub as MenuSub,\n SidebarMenuSubTrigger as MenuSubTrigger,\n SidebarMenuSubContent as MenuSubContent,\n SidebarGroup as Group,\n SidebarGroupLabel as GroupLabel,\n SidebarGroupContent as GroupContent,\n};\n\n/**\n * Enhanced Sidebar Header and Footer Usage Examples:\n *\n * 1. Simple default container (backwards compatible):\n * <Sidebar.Header>\n * <Logo />\n * <span>App Name</span>\n * </Sidebar.Header>\n *\n * 2. Custom flex layout:\n * <Sidebar.Header className=\"rt-justify-between rt-gap-3\">\n * <Logo />\n * <Sidebar.MenuButton>\n * <SettingsIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Header>\n *\n * 3. Column layout for multiple rows:\n * <Sidebar.Header className=\"rt-flex-col rt-gap-2\" asContainer={false}>\n * <div className=\"rt-flex rt-items-center rt-gap-2\">\n * <Logo />\n * <span>App Name</span>\n * </div>\n * <Sidebar.MenuButton>\n * <UserAvatar />\n * <span>John Doe</span>\n * </Sidebar.MenuButton>\n * </Sidebar.Header>\n *\n * 4. Interactive footer with menu button:\n * <Sidebar.Footer>\n * <Sidebar.MenuButton>\n * <UserIcon />\n * <span>Settings</span>\n * <ChevronUpIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Footer>\n *\n * 5. Custom footer layout:\n * <Sidebar.Footer className=\"rt-justify-between\">\n * <span>v1.0.0</span>\n * <Sidebar.MenuButton>\n * <HelpIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Footer>\n *\n * Available utility classes:\n * - Layout: rt-flex-row, rt-flex-col\n * - Alignment: rt-items-center, rt-items-start, rt-items-end\n * - Justification: rt-justify-between, rt-justify-center, rt-justify-start, rt-justify-end\n * - Gap: rt-gap-1, rt-gap-2, rt-gap-3, rt-gap-4\n */\n\nexport type {\n SidebarProps as RootProps,\n SidebarContentProps as ContentProps,\n SidebarHeaderProps as HeaderProps,\n SidebarFooterProps as FooterProps,\n BadgeConfig,\n};\n"],
|
|
5
|
-
"mappings": "6kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,EAAA,WAAAC,EAAA,UAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,WAAAC,EAAA,SAAAC,EAAA,eAAAC,EAAA,aAAAC,EAAA,YAAAC,EAAA,mBAAAC,EAAA,mBAAAC,EAAA,SAAAC,EAAA,cAAAC,IAAA,eAAAC,GAAAhB,IAEA,IAAAiB,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAqB,qBACrBC,
|
|
6
|
-
"names": ["sidebar_exports", "__export", "SidebarContent", "SidebarFooter", "SidebarGroup", "SidebarGroupContent", "SidebarGroupLabel", "SidebarHeader", "SidebarMenu", "SidebarMenuButton", "SidebarMenuItem", "SidebarMenuSub", "SidebarMenuSubContent", "SidebarMenuSubTrigger", "Sidebar", "SidebarSeparator", "__toCommonJS", "React", "import_classnames", "import_slot", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from './slot.js';\nimport * as Accordion from '@radix-ui/react-accordion';\n\nimport { sidebarPropDefs } from './sidebar.props.js';\nimport { useThemeContext } from './theme.js';\n// import { IconButton } from './icon-button.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Separator } from './separator.js';\nimport { ThickChevronRightIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { Kbd } from './kbd.js';\nimport { Badge } from './badge.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { BadgeProps } from './badge.js';\n\n// Badge configuration type for sidebar menu buttons\ntype BadgeConfig = {\n content: React.ReactNode;\n variant?: BadgeProps['variant'];\n size?: BadgeProps['size'];\n color?: BadgeProps['color'];\n highContrast?: BadgeProps['highContrast'];\n radius?: BadgeProps['radius'];\n};\n\n// Internal presentational context (not exported) for size/menu variant\ntype SidebarVisualContextValue = {\n size: '1' | '2';\n menuVariant: 'solid' | 'soft';\n};\nconst SidebarVisualContext = React.createContext<SidebarVisualContextValue | null>(null);\nfunction useSidebarVisual() {\n return React.useContext(SidebarVisualContext);\n}\n\n// Sidebar is now independent of Shell - no integration needed\n\n// Main Sidebar component\ntype SidebarOwnProps = GetPropDefTypes<typeof sidebarPropDefs>;\ninterface SidebarProps extends ComponentPropsWithout<'div', RemovedProps>, SidebarOwnProps {}\n\nconst Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>((props, forwardedRef) => {\n const themeContext = useThemeContext();\n\n const {\n size = sidebarPropDefs.size.default,\n variant = sidebarPropDefs.variant.default,\n menuVariant = sidebarPropDefs.menuVariant.default,\n layout = sidebarPropDefs.layout.default,\n // type = sidebarPropDefs.type.default,\n // side = sidebarPropDefs.side.default,\n // collapsible = sidebarPropDefs.collapsible.default,\n panelBackground,\n color,\n highContrast = sidebarPropDefs.highContrast.default,\n } = props;\n\n const { className, children, ...rootProps } = extractProps(props, sidebarPropDefs);\n const { asChild: _, panelBackground: __, ...safeRootProps } = rootProps; // Remove asChild and panelBackground from DOM props\n const resolvedColor = color || themeContext.accentColor;\n\n // Resolve layout (default to 'panel')\n const resolvedLayout = layout || 'panel';\n\n // Update context with current props - we'll pass the resolved values\n const resolvedSize = typeof size === 'object' ? size.initial || '2' : size;\n return (\n <div\n {...safeRootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n className={classNames('rt-SidebarRoot', className)}\n >\n <SidebarVisualContext.Provider value={{ size: resolvedSize, menuVariant }}>\n <div\n className={classNames(\n 'rt-SidebarContainer',\n `rt-variant-${variant}`,\n `rt-r-size-${resolvedSize}`,\n `rt-menu-variant-${menuVariant}`,\n resolvedLayout && `rt-layout-${resolvedLayout}`,\n )}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-panel-background={panelBackground}\n data-layout={resolvedLayout}\n >\n {children}\n </div>\n </SidebarVisualContext.Provider>\n </div>\n );\n});\nSidebar.displayName = 'Sidebar.Root';\n\n// Sidebar content area\ninterface SidebarContentProps extends React.ComponentPropsWithoutRef<'div'> {\n id?: string;\n role?: 'navigation' | 'none';\n 'aria-label'?: string;\n}\n\nconst SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(\n (\n {\n className,\n children,\n role = 'navigation',\n 'aria-label': ariaLabel = 'Main navigation',\n id,\n ...props\n },\n forwardedRef,\n ) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <ScrollArea type=\"hover\">\n <div\n {...props}\n ref={forwardedRef}\n id={id}\n role={role}\n aria-label={ariaLabel}\n className={classNames(\n 'rt-BaseMenuContent',\n 'rt-SidebarContent',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n className,\n )}\n >\n <div className=\"rt-BaseMenuViewport\">{children}</div>\n </div>\n </ScrollArea>\n );\n },\n);\nSidebarContent.displayName = 'Sidebar.Content';\n\n// Sidebar header\ninterface SidebarHeaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Whether to use the default flex container layout.\n * @default true\n */\n asContainer?: boolean;\n}\n\nconst SidebarHeader = React.forwardRef<HTMLDivElement, SidebarHeaderProps>(\n ({ className, asContainer = true, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-SidebarHeader',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n {\n 'rt-SidebarHeader--container': asContainer,\n },\n className,\n )}\n />\n );\n },\n);\nSidebarHeader.displayName = 'Sidebar.Header';\n\n// Sidebar footer\ninterface SidebarFooterProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Whether to use the default flex container layout.\n * @default true\n */\n asContainer?: boolean;\n}\n\nconst SidebarFooter = React.forwardRef<HTMLDivElement, SidebarFooterProps>(\n ({ className, asContainer = true, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const size = visual?.size ?? '2';\n const menuVariant = visual?.menuVariant ?? 'soft';\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-SidebarFooter',\n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n {\n 'rt-SidebarFooter--container': asContainer,\n },\n className,\n )}\n />\n );\n },\n);\nSidebarFooter.displayName = 'Sidebar.Footer';\n\n// Sidebar trigger button\n// removed Trigger in presentational-only Sidebar\n\n// Removed SidebarInset - not needed\n\n// Sidebar separator\ninterface SidebarSeparatorProps extends ComponentPropsWithout<typeof Separator, RemovedProps> {}\n\nconst SidebarSeparator = React.forwardRef<\n React.ComponentRef<typeof Separator>,\n SidebarSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <Separator\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarSeparator', className)}\n />\n));\nSidebarSeparator.displayName = 'Sidebar.Separator';\n\n// Menu components - reusing dropdown menu structure\ninterface SidebarMenuProps extends React.ComponentPropsWithoutRef<'ul'> {}\n\nconst SidebarMenu = React.forwardRef<HTMLUListElement, SidebarMenuProps>(\n ({ className, ...props }, forwardedRef) => (\n <ul\n {...props}\n ref={forwardedRef}\n role=\"menu\"\n className={classNames('rt-SidebarMenu', className)}\n />\n ),\n);\nSidebarMenu.displayName = 'Sidebar.Menu';\n\ninterface SidebarMenuItemProps extends React.ComponentPropsWithoutRef<'li'> {}\n\nconst SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(\n ({ className, ...props }, forwardedRef) => (\n <li {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuItem', className)} />\n ),\n);\nSidebarMenuItem.displayName = 'Sidebar.MenuItem';\n\ninterface SidebarMenuButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n isActive?: boolean;\n shortcut?: React.ReactNode;\n badge?: string | BadgeConfig;\n}\n\nconst SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(\n (\n {\n asChild = false,\n isActive = false,\n shortcut,\n badge,\n className,\n children,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n ...props\n },\n forwardedRef,\n ) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const visual = useSidebarVisual();\n const sidebarSize = visual?.size ?? '2';\n\n const Comp = asChild ? Slot : 'button';\n\n const { onClick } = props;\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n switch (event.key) {\n case 'Enter':\n case ' ':\n event.preventDefault();\n if (onClick) onClick(event as any);\n break;\n case 'ArrowDown': {\n event.preventDefault();\n // Focus next menu item\n const nextItem = (event.currentTarget as HTMLElement).nextElementSibling?.querySelector(\n '[role=\"menuitem\"]',\n ) as HTMLElement;\n if (nextItem) nextItem.focus();\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n // Focus previous menu item\n const prevItem = (\n event.currentTarget as HTMLElement\n ).previousElementSibling?.querySelector('[role=\"menuitem\"]') as HTMLElement;\n if (prevItem) prevItem.focus();\n break;\n }\n }\n onKeyDown?.(event);\n },\n [onClick, onKeyDown],\n );\n\n return (\n <Comp\n {...props}\n ref={forwardedRef}\n role=\"menuitem\"\n aria-current={isActive ? 'page' : undefined}\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', className)}\n data-active={isActive || undefined}\n data-highlighted={isHighlighted || undefined}\n onKeyDown={handleKeyDown}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event);\n }}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n {/* Badge with soft variant default and size mapping to sidebar size */}\n {badge && (\n <div className=\"rt-SidebarMenuBadge\">\n {typeof badge === 'string' ? (\n <Badge size={sidebarSize} variant=\"soft\">\n {badge}\n </Badge>\n ) : (\n <Badge\n size={badge.size || sidebarSize}\n variant={badge.variant || 'soft'}\n color={badge.color}\n highContrast={badge.highContrast}\n radius={badge.radius}\n >\n {badge.content}\n </Badge>\n )}\n </div>\n )}\n {shortcut && (\n <div className=\"rt-BaseMenuShortcut rt-SidebarMenuShortcut\">\n <Kbd size={sidebarSize}>{shortcut}</Kbd>\n </div>\n )}\n </>\n )}\n </Comp>\n );\n },\n);\nSidebarMenuButton.displayName = 'Sidebar.MenuButton';\n\n// Sub-menu components using Radix Accordion\ninterface SidebarMenuSubProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n}\n\nconst SidebarMenuSub = React.forwardRef<HTMLDivElement, SidebarMenuSubProps>(\n ({ defaultOpen = false, children, ...props }, forwardedRef) => {\n return (\n <div {...props} ref={forwardedRef}>\n <Accordion.Root type=\"single\" collapsible defaultValue={defaultOpen ? 'item' : undefined}>\n <Accordion.Item value=\"item\">{children}</Accordion.Item>\n </Accordion.Root>\n </div>\n );\n },\n);\nSidebarMenuSub.displayName = 'Sidebar.MenuSub';\n\ninterface SidebarMenuSubTriggerProps\n extends React.ComponentPropsWithoutRef<typeof Accordion.Trigger> {\n asChild?: boolean;\n}\n\nconst SidebarMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof Accordion.Trigger>,\n SidebarMenuSubTriggerProps\n>(\n (\n { asChild = false, className, children, onMouseEnter, onMouseLeave, ...props },\n forwardedRef,\n ) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n\n return (\n <Accordion.Header asChild>\n <div>\n <Accordion.Trigger\n {...props}\n ref={forwardedRef}\n asChild={asChild}\n role=\"menuitem\"\n aria-haspopup=\"true\"\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-SidebarMenuButton',\n 'rt-SidebarMenuSubTrigger',\n className,\n )}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event);\n }}\n >\n {asChild ? (\n children\n ) : (\n <>\n {children}\n <ThickChevronRightIcon\n className={classNames(\n 'rt-BaseMenuSubTriggerIcon',\n 'rt-SidebarMenuSubTriggerIcon',\n )}\n />\n </>\n )}\n </Accordion.Trigger>\n </div>\n </Accordion.Header>\n );\n },\n);\nSidebarMenuSubTrigger.displayName = 'Sidebar.MenuSubTrigger';\n\ninterface SidebarMenuSubContentProps\n extends React.ComponentPropsWithoutRef<typeof Accordion.Content> {}\n\nconst SidebarMenuSubContent = React.forwardRef<\n React.ElementRef<typeof Accordion.Content>,\n SidebarMenuSubContentProps\n>(({ className, children, ...props }, forwardedRef) => {\n return (\n <Accordion.Content\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarMenuSubContent', className)}\n >\n <div className=\"rt-SidebarMenuSubList\">{children}</div>\n </Accordion.Content>\n );\n});\nSidebarMenuSubContent.displayName = 'Sidebar.MenuSubContent';\n\n// Group components\ninterface SidebarGroupProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-BaseMenuGroup', 'rt-SidebarGroup', className)}\n />\n ),\n);\nSidebarGroup.displayName = 'Sidebar.Group';\n\ninterface SidebarGroupLabelProps extends React.ComponentPropsWithoutRef<'div'> {\n asChild?: boolean;\n}\n\nconst SidebarGroupLabel = React.forwardRef<HTMLDivElement, SidebarGroupLabelProps>(\n ({ asChild = false, className, ...props }, forwardedRef) => {\n const Comp = asChild ? Slot : 'div';\n\n return (\n <Comp\n {...props}\n ref={forwardedRef}\n role=\"group\"\n className={classNames('rt-BaseMenuLabel', 'rt-SidebarGroupLabel', className)}\n />\n );\n },\n);\nSidebarGroupLabel.displayName = 'Sidebar.GroupLabel';\n\ninterface SidebarGroupContentProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, SidebarGroupContentProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarGroupContent', className)}\n />\n ),\n);\nSidebarGroupContent.displayName = 'Sidebar.GroupContent';\n\n// Export all components following shadcn's pattern\nexport {\n Sidebar as Root,\n SidebarContent as Content,\n SidebarHeader as Header,\n SidebarFooter as Footer,\n SidebarSeparator as Separator,\n SidebarMenu as Menu,\n SidebarMenuItem as MenuItem,\n SidebarMenuButton as MenuButton,\n SidebarMenuSub as MenuSub,\n SidebarMenuSubTrigger as MenuSubTrigger,\n SidebarMenuSubContent as MenuSubContent,\n SidebarGroup as Group,\n SidebarGroupLabel as GroupLabel,\n SidebarGroupContent as GroupContent,\n};\n\n/**\n * Enhanced Sidebar Header and Footer Usage Examples:\n *\n * 1. Simple default container (backwards compatible):\n * <Sidebar.Header>\n * <Logo />\n * <span>App Name</span>\n * </Sidebar.Header>\n *\n * 2. Custom flex layout:\n * <Sidebar.Header className=\"rt-justify-between rt-gap-3\">\n * <Logo />\n * <Sidebar.MenuButton>\n * <SettingsIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Header>\n *\n * 3. Column layout for multiple rows:\n * <Sidebar.Header className=\"rt-flex-col rt-gap-2\" asContainer={false}>\n * <div className=\"rt-flex rt-items-center rt-gap-2\">\n * <Logo />\n * <span>App Name</span>\n * </div>\n * <Sidebar.MenuButton>\n * <UserAvatar />\n * <span>John Doe</span>\n * </Sidebar.MenuButton>\n * </Sidebar.Header>\n *\n * 4. Interactive footer with menu button:\n * <Sidebar.Footer>\n * <Sidebar.MenuButton>\n * <UserIcon />\n * <span>Settings</span>\n * <ChevronUpIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Footer>\n *\n * 5. Custom footer layout:\n * <Sidebar.Footer className=\"rt-justify-between\">\n * <span>v1.0.0</span>\n * <Sidebar.MenuButton>\n * <HelpIcon />\n * </Sidebar.MenuButton>\n * </Sidebar.Footer>\n *\n * Available utility classes:\n * - Layout: rt-flex-row, rt-flex-col\n * - Alignment: rt-items-center, rt-items-start, rt-items-end\n * - Justification: rt-justify-between, rt-justify-center, rt-justify-start, rt-justify-end\n * - Gap: rt-gap-1, rt-gap-2, rt-gap-3, rt-gap-4\n */\n\nexport type {\n SidebarProps as RootProps,\n SidebarContentProps as ContentProps,\n SidebarHeaderProps as HeaderProps,\n SidebarFooterProps as FooterProps,\n BadgeConfig,\n};\n"],
|
|
5
|
+
"mappings": "6kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,EAAA,WAAAC,EAAA,UAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,WAAAC,EAAA,SAAAC,EAAA,eAAAC,EAAA,aAAAC,EAAA,YAAAC,EAAA,mBAAAC,EAAA,mBAAAC,EAAA,SAAAC,EAAA,cAAAC,IAAA,eAAAC,GAAAhB,IAEA,IAAAiB,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAqB,qBACrBC,EAA2B,wCAE3BC,EAAgC,8BAChCC,EAAgC,sBAEhCC,EAA2B,4BAC3BC,EAA0B,0BAC1BC,EAAsC,sBACtCC,EAA6B,uCAC7BC,EAAoB,oBACpBC,EAAsB,sBAqB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xE,CAEJ,EACArC,EAAa,YAAc,gBAM3B,MAAME,EAAoBW,EAAM,WAC9B,CAAC,CAAE,QAAAuC,EAAU,GAAO,UAAAf,EAAW,GAAGV,CAAM,EAAGC,IAIvCf,EAAA,cAHWuC,EAAU,OAAO,MAG3B,CACE,GAAGzB,EACJ,IAAKC,EACL,KAAK,QACL,aAAW,EAAAkB,SAAW,mBAAoB,uBAAwBT,CAAS,EAC7E,CAGN,EACAnC,EAAkB,YAAc,qBAIhC,MAAMD,EAAsBY,EAAM,WAChC,CAAC,CAAE,UAAAwB,EAAW,GAAGV,CAAM,EAAGC,IACxBf,EAAA,cAAC,OACE,GAAGc,EACJ,IAAKC,EACL,aAAW,EAAAkB,SAAW,yBAA0BT,CAAS,EAC3D,CAEJ,EACApC,EAAoB,YAAc",
|
|
6
|
+
"names": ["sidebar_exports", "__export", "SidebarContent", "SidebarFooter", "SidebarGroup", "SidebarGroupContent", "SidebarGroupLabel", "SidebarHeader", "SidebarMenu", "SidebarMenuButton", "SidebarMenuItem", "SidebarMenuSub", "SidebarMenuSubContent", "SidebarMenuSubTrigger", "Sidebar", "SidebarSeparator", "__toCommonJS", "React", "import_classnames", "import_slot", "Accordion", "import_sidebar_props", "import_theme", "import_scroll_area", "import_separator", "import_icons", "import_extract_props", "import_kbd", "import_badge", "SidebarVisualContext", "useSidebarVisual", "props", "forwardedRef", "themeContext", "size", "variant", "menuVariant", "layout", "panelBackground", "color", "highContrast", "className", "children", "rootProps", "_", "__", "safeRootProps", "resolvedColor", "resolvedLayout", "resolvedSize", "classNames", "role", "ariaLabel", "id", "visual", "asContainer", "asChild", "isActive", "shortcut", "badge", "onMouseEnter", "onMouseLeave", "onKeyDown", "isHighlighted", "setIsHighlighted", "sidebarSize", "Comp", "onClick", "handleKeyDown", "event", "nextItem", "prevItem", "defaultOpen"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BottomHandle } from './shell-handles.js';
|
|
3
|
+
import type { PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';
|
|
4
|
+
interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
presentation?: ResponsivePresentation;
|
|
6
|
+
mode?: PaneMode;
|
|
7
|
+
defaultMode?: any;
|
|
8
|
+
onModeChange?: (mode: PaneMode) => void;
|
|
9
|
+
expandedSize?: number;
|
|
10
|
+
minSize?: number;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
resizable?: boolean;
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
onExpand?: () => void;
|
|
15
|
+
onCollapse?: () => void;
|
|
16
|
+
onResize?: (size: number) => void;
|
|
17
|
+
resizer?: React.ReactNode;
|
|
18
|
+
onResizeStart?: (size: number) => void;
|
|
19
|
+
onResizeEnd?: (size: number) => void;
|
|
20
|
+
snapPoints?: number[];
|
|
21
|
+
snapTolerance?: number;
|
|
22
|
+
collapseThreshold?: number;
|
|
23
|
+
paneId?: string;
|
|
24
|
+
persistence?: PaneSizePersistence;
|
|
25
|
+
}
|
|
26
|
+
type BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & {
|
|
27
|
+
Handle: typeof BottomHandle;
|
|
28
|
+
};
|
|
29
|
+
export declare const Bottom: BottomComponent;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=shell-bottom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-bottom.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAc,QAAQ,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,KAAK,eAAe,GAAG,KAAK,CAAC,yBAAyB,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAE1I,eAAO,MAAM,MAAM,EAoNd,eAAe,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as o from"react";import X from"classnames";import*as k from"../sheet.js";import{VisuallyHidden as Y}from"../visually-hidden.js";import{useShell as Z}from"../shell.context.js";import{useResponsivePresentation as _}from"../shell.hooks.js";import{PaneResizeContext as ee}from"./shell-resize.js";import{BottomHandle as M,PaneHandle as te}from"./shell-handles.js";import{BREAKPOINTS as oe}from"../shell.types.js";const O=o.forwardRef(({className:$,presentation:D="fixed",mode:a,defaultMode:i="collapsed",onModeChange:h,expandedSize:c=200,minSize:E=100,maxSize:x=400,resizable:m=!1,collapsible:I=!0,onExpand:g,onCollapse:S,onResize:p,onResizeStart:L,onResizeEnd:V,snapPoints:K,snapTolerance:j,collapseThreshold:q,paneId:f,persistence:b,children:F,style:W,...G},s)=>{const t=Z(),B=_(D),l=B==="overlay",J=B==="stacked",d=o.useRef(null),Q=o.useCallback(e=>{d.current=e,typeof s=="function"?s(e):s&&(s.current=e)},[s]),C=o.Children.toArray(F),z=C.filter(e=>o.isValidElement(e)&&e.type===M),T=C.filter(e=>!(o.isValidElement(e)&&e.type===M)),y=o.useCallback(()=>{if(typeof i=="string")return i;const e=i;if(e&&e[t.currentBreakpoint])return e[t.currentBreakpoint];const r=[...Object.keys(oe)].reverse().concat("initial"),R=r.indexOf(t.currentBreakpoint);for(let v=R+1;v<r.length;v++){const A=r[v];if(e&&e[A])return e[A]}return"collapsed"},[i,t.currentBreakpoint]),H=o.useRef(!1);o.useEffect(()=>{if(!H.current&&(H.current=!0,a===void 0)){const e=y();t.bottomMode!==e&&t.setBottomMode(e)}},[]);const w=o.useRef(null),N=o.useRef(null);o.useEffect(()=>{if(a!==void 0||!t.currentBreakpointReady||w.current===t.currentBreakpoint)return;w.current=t.currentBreakpoint;const e=y();N.current!==e&&(N.current=e,e!==t.bottomMode&&t.setBottomMode(e))},[a,t.currentBreakpoint,t.currentBreakpointReady,y,t.bottomMode,t.setBottomMode]),o.useEffect(()=>{a!==void 0&&t.bottomMode!==a&&t.setBottomMode(a)},[a,t]),o.useEffect(()=>{a===void 0&&h?.(t.bottomMode)},[t.bottomMode,a,h]),o.useEffect(()=>{t.bottomMode==="expanded"?g?.():S?.()},[t.bottomMode,g,S]);const P=t.bottomMode==="expanded",u=o.useMemo(()=>{if(!f||b)return b;const e=`kookie-ui:shell:bottom:${f}`;return{load:()=>{if(typeof window>"u")return;const r=window.localStorage.getItem(e);return r?Number(r):void 0},save:r=>{typeof window>"u"||window.localStorage.setItem(e,String(r))}}},[f,b]);o.useEffect(()=>{let e=!0;return(async()=>{if(!m||!u?.load||l)return;const n=await u.load();e&&typeof n=="number"&&d.current&&(d.current.style.setProperty("--bottom-size",`${n}px`),p?.(n))})(),()=>{e=!1}},[m,u,p,l]);const U=m&&!l&&P?o.createElement(ee.Provider,{value:{containerRef:d,cssVarName:"--bottom-size",minSize:E,maxSize:x,defaultSize:c,orientation:"horizontal",edge:"start",computeNext:(e,n,r)=>{const R=e-n;return r-R},onResize:p,onResizeStart:L,onResizeEnd:e=>{V?.(e),u?.save?.(e)},target:"bottom",collapsible:I,snapPoints:K,snapTolerance:j??8,collapseThreshold:q,requestCollapse:()=>t.setBottomMode("collapsed"),requestToggle:()=>t.togglePane("bottom")}},z.length>0?z.map((e,n)=>o.cloneElement(e,{key:e.key??n})):o.createElement(te,null)):null;if(l){const e=t.bottomMode==="expanded";return o.createElement(k.Root,{open:e,onOpenChange:n=>t.setBottomMode(n?"expanded":"collapsed")},o.createElement(k.Content,{side:"bottom",style:{padding:0},height:{initial:`${c}px`}},o.createElement(Y,null,o.createElement(k.Title,null,"Bottom panel")),T))}return o.createElement("div",{...G,ref:Q,className:X("rt-ShellBottom",$),"data-mode":t.bottomMode,"data-peek":t.peekTarget==="bottom"||void 0,"data-presentation":B,"data-open":J&&P||void 0,style:{...W,"--bottom-size":`${c}px`,"--bottom-min-size":`${E}px`,"--bottom-max-size":`${x}px`}},o.createElement("div",{className:"rt-ShellBottomContent","data-visible":P||void 0},T),U)});O.displayName="Shell.Bottom",O.Handle=M;export{O as Bottom};
|
|
2
|
+
//# sourceMappingURL=shell-bottom.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/shell-bottom.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { BottomHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n mode?: PaneMode;\n defaultMode?: any;\n onModeChange?: (mode: PaneMode) => void;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof BottomHandle };\n\nexport const Bottom = React.forwardRef<HTMLDivElement, PaneProps>(\n (\n {\n className,\n presentation = 'fixed',\n mode,\n defaultMode = 'collapsed',\n onModeChange,\n expandedSize = 200,\n minSize = 100,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === BottomHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));\n\n const resolveResponsiveMode = React.useCallback((): PaneMode => {\n if (typeof defaultMode === 'string') return defaultMode as PaneMode;\n const dm = defaultMode as Partial<Record<Breakpoint, PaneMode>> | undefined;\n if (dm && dm[shell.currentBreakpoint as Breakpoint]) {\n return dm[shell.currentBreakpoint as Breakpoint] as PaneMode;\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(shell.currentBreakpoint as Breakpoint);\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (dm && dm[bp]) {\n return dm[bp] as PaneMode;\n }\n }\n return 'collapsed';\n }, [defaultMode, shell.currentBreakpoint]);\n\n const didInitRef = React.useRef(false);\n React.useEffect(() => {\n if (didInitRef.current) return;\n didInitRef.current = true;\n if (mode === undefined) {\n const initial = resolveResponsiveMode();\n if (shell.bottomMode !== initial) shell.setBottomMode(initial);\n }\n }, []);\n\n const lastBottomBpRef = React.useRef<Breakpoint | null>(null);\n const lastResolvedBottomRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n if (mode !== undefined) return;\n if (!shell.currentBreakpointReady) return;\n if (lastBottomBpRef.current === shell.currentBreakpoint) return;\n lastBottomBpRef.current = shell.currentBreakpoint as Breakpoint;\n const next = resolveResponsiveMode();\n if (lastResolvedBottomRef.current === next) return;\n lastResolvedBottomRef.current = next;\n if (next !== shell.bottomMode) shell.setBottomMode(next);\n }, [mode, shell.currentBreakpoint, shell.currentBreakpointReady, resolveResponsiveMode, shell.bottomMode, shell.setBottomMode]);\n\n React.useEffect(() => {\n if (mode !== undefined && shell.bottomMode !== mode) {\n shell.setBottomMode(mode);\n }\n }, [mode, shell]);\n\n React.useEffect(() => {\n if (mode === undefined) {\n onModeChange?.(shell.bottomMode);\n }\n }, [shell.bottomMode, mode, onModeChange]);\n\n React.useEffect(() => {\n if (shell.bottomMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.bottomMode, onExpand, onCollapse]);\n\n const isExpanded = shell.bottomMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:bottom:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--bottom-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--bottom-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'horizontal',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const delta = client - startClient;\n return startSize - delta;\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n persistenceAdapter?.save?.(size);\n },\n target: 'bottom',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setBottomMode('collapsed'),\n requestToggle: () => shell.togglePane('bottom'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n if (isOverlay) {\n const open = shell.bottomMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setBottomMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"bottom\" style={{ padding: 0 }} height={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Bottom panel</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...props}\n ref={setRef}\n className={classNames('rt-ShellBottom', className)}\n data-mode={shell.bottomMode}\n data-peek={shell.peekTarget === 'bottom' || undefined}\n data-presentation={resolvedPresentation}\n data-open={(isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--bottom-size' as any]: `${expandedSize}px`,\n ['--bottom-min-size' as any]: `${minSize}px`,\n ['--bottom-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellBottomContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,YAAAC,MAAgB,sBACzB,OAAS,6BAAAC,MAAiC,oBAC1C,OAAS,qBAAAC,OAAyB,oBAClC,OAAS,gBAAAC,EAAc,cAAAC,OAAkB,qBACzC,OAAS,eAAAC,OAAmB,oBA4BrB,MAAMC,EAASV,EAAM,WAC1B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe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WAAW,EACtD,cAAe,IAAMA,EAAM,WAAW,QAAQ,CAChD,GAECQ,EAAe,OAAS,EAAIA,EAAe,IAAI,CAACC,EAAIM,IAAMlD,EAAM,aAAa4C,EAAI,CAAE,IAAKA,EAAG,KAAOM,CAAE,CAAC,CAAC,EAAIlD,EAAA,cAACQ,GAAA,IAAW,CACzH,EACE,KAEN,GAAI6B,EAAW,CACb,MAAMgC,EAAOlC,EAAM,aAAe,WAClC,OACEnC,EAAA,cAACE,EAAM,KAAN,CAAW,KAAMmE,EAAM,aAAeC,GAAMnC,EAAM,cAAcmC,EAAI,WAAa,WAAW,GAC3FtE,EAAA,cAACE,EAAM,QAAN,CAAc,KAAK,SAAS,MAAO,CAAE,QAAS,CAAE,EAAG,OAAQ,CAAE,QAAS,GAAGc,CAAY,IAAK,GACzFhB,EAAA,cAACG,EAAA,KACCH,EAAA,cAACE,EAAM,MAAN,KAAY,cAAY,CAC3B,EACC2C,CACH,CACF,CAEJ,CAEA,OACE7C,EAAA,cAAC,OACE,GAAGiC,EACJ,IAAKO,EACL,UAAWvC,EAAW,iBAAkBU,CAAS,EACjD,YAAWwB,EAAM,WACjB,YAAWA,EAAM,aAAe,UAAY,OAC5C,oBAAmBC,EACnB,YAAYE,GAAamB,GAAe,OACxC,MAAO,CACL,GAAGzB,EACF,gBAAyB,GAAGhB,CAAY,KACxC,oBAA6B,GAAGC,CAAO,KACvC,oBAA6B,GAAGC,CAAO,IAC1C,GAEAlB,EAAA,cAAC,OAAI,UAAU,wBAAwB,eAAcyD,GAAc,QAChEZ,CACH,EACCmB,CACH,CAEJ,CACF,EACAtD,EAAO,YAAc,eACrBA,EAAO,OAASH",
|
|
6
|
+
"names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "PaneResizeContext", "BottomHandle", "PaneHandle", "BREAKPOINTS", "Bottom", "className", "presentation", "mode", "defaultMode", "onModeChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "resolveResponsiveMode", "dm", "order", "startIdx", "i", "bp", "didInitRef", "initial", "lastBottomBpRef", "lastResolvedBottomRef", "next", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "delta", "open", "o"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const PaneHandle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const PanelHandle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const SidebarHandle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export declare const InspectorHandle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const BottomHandle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
//# sourceMappingURL=shell-handles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-handles.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-handles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,UAAU,mKA+KrB,CAAC;AAGH,eAAO,MAAM,WAAW,mKAA+H,CAAC;AAGxJ,eAAO,MAAM,aAAa,mKAA+H,CAAC;AAG1J,eAAO,MAAM,eAAe,mKAA+H,CAAC;AAG5J,eAAO,MAAM,YAAY,mKAA+H,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as s from"react";import B from"classnames";import{usePaneResize as X}from"./shell-resize.js";const E=s.forwardRef(({className:i,children:l,...N},$)=>{const{containerRef:g,cssVarName:c,minSize:P,maxSize:b,defaultSize:x,orientation:p,edge:M,computeNext:I,onResize:w,onResizeStart:H,onResizeEnd:h,snapPoints:L,snapTolerance:W,collapseThreshold:T,collapsible:C,target:J,requestCollapse:K,requestToggle:V}=X(),S=s.useRef(null);s.useEffect(()=>()=>{try{S.current?.()}catch{}S.current=null},[]);const F=p;return s.createElement("div",{...N,ref:$,className:B("rt-ShellResizer",i),"data-orientation":p,"data-edge":M,role:"slider","aria-orientation":F,"aria-valuemin":P,"aria-valuemax":b,"aria-valuenow":x,tabIndex:0,onPointerDown:e=>{if(!g.current)return;e.preventDefault();const r=g.current,a=e.currentTarget,d=e.pointerId;try{S.current?.()}catch{}r.setAttribute("data-resizing","");try{a.setPointerCapture(d)}catch{}const y=p==="vertical"?e.clientX:e.clientY,n=parseFloat(getComputedStyle(r).getPropertyValue(c)||`${x}`),t=o=>Math.min(Math.max(o,P),b),m=document.body,U=m.style.cursor,q=m.style.userSelect;m.style.cursor=p==="vertical"?"col-resize":"row-resize",m.style.userSelect="none",H?.(n);const z=o=>{const u=p==="vertical"?o.clientX:o.clientY,f=t(I(u,y,n));r.style.setProperty(c,`${f}px`),a.setAttribute("aria-valuenow",String(f)),w?.(f)},R=()=>{try{a.releasePointerCapture(d)}catch{}window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),window.removeEventListener("keydown",D),a.removeEventListener("lostpointercapture",v),r.removeAttribute("data-resizing"),m.style.cursor=U,m.style.userSelect=q,S.current=null},v=()=>{const o=parseFloat(getComputedStyle(r).getPropertyValue(c)||`${x}`);let u=o;if(L&&L.length){const f=L.reduce((A,k)=>Math.abs(k-o)<Math.abs(A-o)?k:A,L[0]);Math.abs(f-o)<=(W??8)&&(u=f,r.style.setProperty(c,`${u}px`),a.setAttribute("aria-valuenow",String(u)),w?.(u))}C&&typeof T=="number"&&o<=T&&K?.(),h?.(u),R()},D=o=>{o.key==="Escape"&&(r.style.setProperty(c,`${n}px`),a.setAttribute("aria-valuenow",String(n)),h?.(n),R())};window.addEventListener("pointermove",z),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),window.addEventListener("keydown",D),a.addEventListener("lostpointercapture",v),S.current=R},onDoubleClick:()=>{C&&V?.()},onKeyDown:e=>{if(!g.current)return;const r=g.current,a=parseFloat(getComputedStyle(r).getPropertyValue(c)||`${x}`),d=t=>Math.min(Math.max(t,P),b),y=e.shiftKey?32:8;let n=0;if(p==="vertical"?e.key==="ArrowRight"?n=y:e.key==="ArrowLeft"&&(n=-y):e.key==="ArrowDown"?n=y:e.key==="ArrowUp"&&(n=-y),e.key==="Home"){e.preventDefault(),H?.(a);const t=d(P);r.style.setProperty(c,`${t}px`),e.currentTarget.setAttribute("aria-valuenow",String(t)),w?.(t),h?.(t);return}if(e.key==="End"){e.preventDefault(),H?.(a);const t=d(b);r.style.setProperty(c,`${t}px`),e.currentTarget.setAttribute("aria-valuenow",String(t)),w?.(t),h?.(t);return}if(n!==0){e.preventDefault(),H?.(a);const t=d(a+(M==="start"&&p==="vertical"?-n:n));r.style.setProperty(c,`${t}px`),e.currentTarget.setAttribute("aria-valuenow",String(t)),w?.(t),h?.(t)}}},l)});E.displayName="Shell.Handle";const Y=s.forwardRef((i,l)=>s.createElement(E,{...i,ref:l}));Y.displayName="Shell.Panel.Handle";const O=s.forwardRef((i,l)=>s.createElement(E,{...i,ref:l}));O.displayName="Shell.Sidebar.Handle";const j=s.forwardRef((i,l)=>s.createElement(E,{...i,ref:l}));j.displayName="Shell.Inspector.Handle";const G=s.forwardRef((i,l)=>s.createElement(E,{...i,ref:l}));G.displayName="Shell.Bottom.Handle";export{G as BottomHandle,j as InspectorHandle,E as PaneHandle,Y as PanelHandle,O as SidebarHandle};
|
|
2
|
+
//# sourceMappingURL=shell-handles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/shell-handles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { usePaneResize } from './shell-resize.js';\n\nexport const PaneHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(({ className, children, ...props }, ref) => {\n const {\n containerRef,\n cssVarName,\n minSize,\n maxSize,\n defaultSize,\n orientation,\n edge,\n computeNext,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n collapsible,\n target,\n requestCollapse,\n requestToggle,\n } = usePaneResize();\n\n const activeCleanupRef = React.useRef<(() => void) | null>(null);\n React.useEffect(\n () => () => {\n try {\n activeCleanupRef.current?.();\n } catch {}\n activeCleanupRef.current = null;\n },\n [],\n );\n\n const ariaOrientation = orientation;\n\n return (\n <div\n {...props}\n ref={ref}\n className={classNames('rt-ShellResizer', className)}\n data-orientation={orientation}\n data-edge={edge}\n role=\"slider\"\n aria-orientation={ariaOrientation}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={defaultSize}\n tabIndex={0}\n onPointerDown={(e) => {\n if (!containerRef.current) return;\n e.preventDefault();\n const container = containerRef.current;\n const handleEl = e.currentTarget as HTMLElement;\n const pointerId = e.pointerId;\n try {\n activeCleanupRef.current?.();\n } catch {}\n container.setAttribute('data-resizing', '');\n try {\n handleEl.setPointerCapture(pointerId);\n } catch {}\n const startClient = orientation === 'vertical' ? e.clientX : e.clientY;\n const startSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n const clamp = (v: number) => Math.min(Math.max(v, minSize), maxSize);\n const body = document.body;\n const prevCursor = body.style.cursor;\n const prevUserSelect = body.style.userSelect;\n body.style.cursor = orientation === 'vertical' ? 'col-resize' : 'row-resize';\n body.style.userSelect = 'none';\n onResizeStart?.(startSize);\n const handleMove = (ev: PointerEvent) => {\n const client = orientation === 'vertical' ? ev.clientX : ev.clientY;\n const next = clamp(computeNext(client, startClient, startSize));\n container.style.setProperty(cssVarName, `${next}px`);\n handleEl.setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n };\n const cleanup = () => {\n try {\n handleEl.releasePointerCapture(pointerId);\n } catch {}\n window.removeEventListener('pointermove', handleMove as any);\n window.removeEventListener('pointerup', handleUp as any);\n window.removeEventListener('pointercancel', handleUp as any);\n window.removeEventListener('keydown', handleKey as any);\n handleEl.removeEventListener('lostpointercapture', handleUp as any);\n container.removeAttribute('data-resizing');\n body.style.cursor = prevCursor;\n body.style.userSelect = prevUserSelect;\n activeCleanupRef.current = null;\n };\n const handleUp = () => {\n const finalSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n let snapped = finalSize;\n if (snapPoints && snapPoints.length) {\n const nearest = snapPoints.reduce((acc, p) => (Math.abs(p - finalSize) < Math.abs(acc - finalSize) ? p : acc), snapPoints[0]);\n if (Math.abs(nearest - finalSize) <= (snapTolerance ?? 8)) {\n snapped = nearest;\n container.style.setProperty(cssVarName, `${snapped}px`);\n handleEl.setAttribute('aria-valuenow', String(snapped));\n onResize?.(snapped);\n }\n }\n if (collapsible && typeof collapseThreshold === 'number' && finalSize <= collapseThreshold) {\n requestCollapse?.();\n }\n onResizeEnd?.(snapped);\n cleanup();\n };\n const handleKey = (kev: KeyboardEvent) => {\n if (kev.key === 'Escape') {\n container.style.setProperty(cssVarName, `${startSize}px`);\n handleEl.setAttribute('aria-valuenow', String(startSize));\n onResizeEnd?.(startSize);\n cleanup();\n }\n };\n window.addEventListener('pointermove', handleMove as any);\n window.addEventListener('pointerup', handleUp as any);\n window.addEventListener('pointercancel', handleUp as any);\n window.addEventListener('keydown', handleKey as any);\n handleEl.addEventListener('lostpointercapture', handleUp as any);\n activeCleanupRef.current = cleanup;\n }}\n onDoubleClick={() => {\n if (collapsible) requestToggle?.();\n }}\n onKeyDown={(e) => {\n if (!containerRef.current) return;\n const container = containerRef.current;\n const current = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n const clamp = (v: number) => Math.min(Math.max(v, minSize), maxSize);\n const step = e.shiftKey ? 32 : 8;\n let delta = 0;\n if (orientation === 'vertical') {\n if (e.key === 'ArrowRight') delta = step;\n else if (e.key === 'ArrowLeft') delta = -step;\n } else {\n if (e.key === 'ArrowDown') delta = step;\n else if (e.key === 'ArrowUp') delta = -step;\n }\n if (e.key === 'Home') {\n e.preventDefault();\n onResizeStart?.(current);\n const next = clamp(minSize);\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n return;\n }\n if (e.key === 'End') {\n e.preventDefault();\n onResizeStart?.(current);\n const next = clamp(maxSize);\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n return;\n }\n if (delta !== 0) {\n e.preventDefault();\n onResizeStart?.(current);\n const next = clamp(current + (edge === 'start' && orientation === 'vertical' ? -delta : delta));\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n }\n }}\n >\n {children}\n </div>\n );\n});\nPaneHandle.displayName = 'Shell.Handle';\n\nexport const PanelHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nPanelHandle.displayName = 'Shell.Panel.Handle';\n\nexport const SidebarHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nSidebarHandle.displayName = 'Shell.Sidebar.Handle';\n\nexport const InspectorHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nInspectorHandle.displayName = 'Shell.Inspector.Handle';\n\nexport const BottomHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nBottomHandle.displayName = 'Shell.Bottom.Handle';\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,iBAAAC,MAAqB,oBAEvB,MAAMC,EAAaH,EAAM,WAAkE,CAAC,CAAE,UAAAI,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAAQ,CAC5I,KAAM,CACJ,aAAAC,EACA,WAAAC,EACA,QAAAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,cAAAC,CACF,EAAIvB,EAAc,EAEZwB,EAAmB1B,EAAM,OAA4B,IAAI,EAC/DA,EAAM,UACJ,IAAM,IAAM,CACV,GAAI,CACF0B,EAAiB,UAAU,CAC7B,MAAQ,CAAC,CACTA,EAAiB,QAAU,IAC7B,EACA,CAAC,CACH,EAEA,MAAMC,EAAkBd,EAExB,OACEb,EAAA,cAAC,OACE,GAAGM,EACJ,IAAKC,EACL,UAAWN,EAAW,kBAAmBG,CAAS,EAClD,mBAAkBS,EAClB,YAAWC,EACX,KAAK,SACL,mBAAkBa,EAClB,gBAAejB,EACf,gBAAeC,EACf,g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F,GAECpC,CACH,CAEJ,CAAC,EACDF,EAAW,YAAc,eAElB,MAAMmD,EAActD,EAAM,WAAkE,CAACM,EAAOC,IAAQP,EAAA,cAACG,EAAA,CAAY,GAAGG,EAAO,IAAKC,EAAK,CAAE,EACtJ+C,EAAY,YAAc,qBAEnB,MAAMC,EAAgBvD,EAAM,WAAkE,CAACM,EAAOC,IAAQP,EAAA,cAACG,EAAA,CAAY,GAAGG,EAAO,IAAKC,EAAK,CAAE,EACxJgD,EAAc,YAAc,uBAErB,MAAMC,EAAkBxD,EAAM,WAAkE,CAACM,EAAOC,IAAQP,EAAA,cAACG,EAAA,CAAY,GAAGG,EAAO,IAAKC,EAAK,CAAE,EAC1JiD,EAAgB,YAAc,yBAEvB,MAAMC,EAAezD,EAAM,WAAkE,CAACM,EAAOC,IAAQP,EAAA,cAACG,EAAA,CAAY,GAAGG,EAAO,IAAKC,EAAK,CAAE,EACvJkD,EAAa,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "usePaneResize", "PaneHandle", "className", "children", "props", "ref", "containerRef", "cssVarName", "minSize", "maxSize", "defaultSize", "orientation", "edge", "computeNext", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "collapsible", "target", "requestCollapse", "requestToggle", "activeCleanupRef", "ariaOrientation", "container", "handleEl", "pointerId", "startClient", "startSize", "clamp", "v", "body", "prevCursor", "prevUserSelect", "handleMove", "ev", "client", "next", "cleanup", "handleUp", "handleKey", "finalSize", "snapped", "nearest", "acc", "p", "kev", "current", "step", "delta", "PanelHandle", "SidebarHandle", "InspectorHandle", "BottomHandle"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InspectorHandle } from './shell-handles.js';
|
|
3
|
+
import type { PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';
|
|
4
|
+
interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
presentation?: ResponsivePresentation;
|
|
6
|
+
mode?: PaneMode;
|
|
7
|
+
defaultMode?: any;
|
|
8
|
+
onModeChange?: (mode: PaneMode) => void;
|
|
9
|
+
expandedSize?: number;
|
|
10
|
+
minSize?: number;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
resizable?: boolean;
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
onExpand?: () => void;
|
|
15
|
+
onCollapse?: () => void;
|
|
16
|
+
onResize?: (size: number) => void;
|
|
17
|
+
resizer?: React.ReactNode;
|
|
18
|
+
onResizeStart?: (size: number) => void;
|
|
19
|
+
onResizeEnd?: (size: number) => void;
|
|
20
|
+
snapPoints?: number[];
|
|
21
|
+
snapTolerance?: number;
|
|
22
|
+
collapseThreshold?: number;
|
|
23
|
+
paneId?: string;
|
|
24
|
+
persistence?: PaneSizePersistence;
|
|
25
|
+
}
|
|
26
|
+
type InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & {
|
|
27
|
+
Handle: typeof InspectorHandle;
|
|
28
|
+
};
|
|
29
|
+
export declare const Inspector: InspectorComponent;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=shell-inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-inspector.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,eAAe,EAAc,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAc,QAAQ,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,KAAK,kBAAkB,GAAG,KAAK,CAAC,yBAAyB,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,eAAe,CAAA;CAAE,CAAC;AAEhJ,eAAO,MAAM,SAAS,EA0MjB,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as t from"react";import Q from"classnames";import*as M from"../sheet.js";import{VisuallyHidden as U}from"../visually-hidden.js";import{useShell as X}from"../shell.context.js";import{useResponsivePresentation as Y}from"../shell.hooks.js";import{PaneResizeContext as Z}from"./shell-resize.js";import{InspectorHandle as b,PaneHandle as _}from"./shell-handles.js";import{BREAKPOINTS as ee}from"../shell.types.js";const H=t.forwardRef(({className:N,presentation:A={initial:"overlay",lg:"fixed"},mode:s,defaultMode:p="collapsed",onModeChange:h,expandedSize:u=320,minSize:E=200,maxSize:B=500,resizable:f=!1,collapsible:O=!0,onExpand:x,onCollapse:g,onResize:m,onResizeStart:$,onResizeEnd:D,snapPoints:L,snapTolerance:V,collapseThreshold:K,paneId:y,persistence:P,children:j,style:q,...F},a)=>{const n=X(),v=Y(A),c=v==="overlay",W=v==="stacked",l=t.useRef(null),G=t.useCallback(e=>{l.current=e,typeof a=="function"?a(e):a&&(a.current=e)},[a]),I=t.Children.toArray(j),S=I.filter(e=>t.isValidElement(e)&&e.type===b),C=I.filter(e=>!(t.isValidElement(e)&&e.type===b)),z=t.useCallback(()=>{if(typeof p=="string")return p;const e=p;if(e&&e[n.currentBreakpoint])return e[n.currentBreakpoint];const r=[...Object.keys(ee)].reverse().concat("initial"),R=r.indexOf(n.currentBreakpoint);for(let i=R+1;i<r.length;i++){const w=r[i];if(e&&e[w])return e[w]}return"collapsed"},[p,n.currentBreakpoint]),T=t.useRef(null);t.useEffect(()=>{if(s!==void 0||!n.currentBreakpointReady||T.current===n.currentBreakpoint)return;T.current=n.currentBreakpoint;const e=z();e!==n.inspectorMode&&n.setInspectorMode(e)},[s,n.currentBreakpoint,n.currentBreakpointReady,z,n.inspectorMode,n.setInspectorMode]),t.useEffect(()=>{s!==void 0&&n.inspectorMode!==s&&n.setInspectorMode(s)},[s,n]),t.useEffect(()=>{s===void 0&&h?.(n.inspectorMode)},[n.inspectorMode,s,h]),t.useEffect(()=>{n.inspectorMode==="expanded"?x?.():g?.()},[n.inspectorMode,x,g]);const k=n.inspectorMode==="expanded",d=t.useMemo(()=>{if(!y||P)return P;const e=`kookie-ui:shell:inspector:${y}`;return{load:()=>{if(typeof window>"u")return;const r=window.localStorage.getItem(e);return r?Number(r):void 0},save:r=>{typeof window>"u"||window.localStorage.setItem(e,String(r))}}},[y,P]);t.useEffect(()=>{let e=!0;return(async()=>{if(!f||!d?.load||c)return;const o=await d.load();e&&typeof o=="number"&&l.current&&(l.current.style.setProperty("--inspector-size",`${o}px`),m?.(o))})(),()=>{e=!1}},[f,d,m,c]);const J=f&&!c&&k?t.createElement(Z.Provider,{value:{containerRef:l,cssVarName:"--inspector-size",minSize:E,maxSize:B,defaultSize:u,orientation:"vertical",edge:"start",computeNext:(e,o,r)=>{const R=getComputedStyle(l.current).direction==="rtl",i=e-o;return r+(R?i:-i)},onResize:m,onResizeStart:$,onResizeEnd:e=>{D?.(e),d?.save?.(e)},target:"inspector",collapsible:O,snapPoints:L,snapTolerance:V??8,collapseThreshold:K,requestCollapse:()=>n.setInspectorMode("collapsed"),requestToggle:()=>n.togglePane("inspector")}},S.length>0?S.map((e,o)=>t.cloneElement(e,{key:e.key??o})):t.createElement(_,null)):null;if(c){const e=n.inspectorMode==="expanded";return t.createElement(M.Root,{open:e,onOpenChange:o=>n.setInspectorMode(o?"expanded":"collapsed")},t.createElement(M.Content,{side:"end",style:{padding:0},width:{initial:`${u}px`}},t.createElement(U,null,t.createElement(M.Title,null,"Inspector")),C))}return t.createElement("div",{...F,ref:G,className:Q("rt-ShellInspector",N),"data-mode":n.inspectorMode,"data-peek":n.peekTarget==="inspector"||void 0,"data-presentation":v,"data-open":W&&k||void 0,style:{...q,"--inspector-size":`${u}px`,"--inspector-min-size":`${E}px`,"--inspector-max-size":`${B}px`}},t.createElement("div",{className:"rt-ShellInspectorContent","data-visible":k||void 0},C),J)});H.displayName="Shell.Inspector",H.Handle=b;export{H as Inspector};
|
|
2
|
+
//# sourceMappingURL=shell-inspector.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/shell-inspector.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n mode?: PaneMode;\n defaultMode?: any;\n onModeChange?: (mode: PaneMode) => void;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nexport const Inspector = React.forwardRef<HTMLDivElement, PaneProps>(\n (\n {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n mode,\n defaultMode = 'collapsed',\n onModeChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === InspectorHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));\n\n const resolveResponsiveMode = React.useCallback((): PaneMode => {\n if (typeof defaultMode === 'string') return defaultMode as PaneMode;\n const dm = defaultMode as Partial<Record<Breakpoint, PaneMode>> | undefined;\n if (dm && dm[shell.currentBreakpoint as Breakpoint]) {\n return dm[shell.currentBreakpoint as Breakpoint] as PaneMode;\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(shell.currentBreakpoint as Breakpoint);\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (dm && dm[bp]) {\n return dm[bp] as PaneMode;\n }\n }\n return 'collapsed';\n }, [defaultMode, shell.currentBreakpoint]);\n\n const lastInspectorBpRef = React.useRef<Breakpoint | null>(null);\n React.useEffect(() => {\n if (mode !== undefined) return;\n if (!shell.currentBreakpointReady) return;\n if (lastInspectorBpRef.current === shell.currentBreakpoint) return;\n lastInspectorBpRef.current = shell.currentBreakpoint as Breakpoint;\n const next = resolveResponsiveMode();\n if (next !== shell.inspectorMode) {\n shell.setInspectorMode(next);\n }\n }, [mode, shell.currentBreakpoint, shell.currentBreakpointReady, resolveResponsiveMode, shell.inspectorMode, shell.setInspectorMode]);\n\n React.useEffect(() => {\n if (mode !== undefined && shell.inspectorMode !== mode) {\n shell.setInspectorMode(mode);\n }\n }, [mode, shell]);\n\n React.useEffect(() => {\n if (mode === undefined) {\n onModeChange?.(shell.inspectorMode);\n }\n }, [shell.inspectorMode, mode, onModeChange]);\n\n React.useEffect(() => {\n if (shell.inspectorMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.inspectorMode, onExpand, onCollapse]);\n\n const isExpanded = shell.inspectorMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:inspector:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--inspector-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--inspector-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? delta : -delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n persistenceAdapter?.save?.(size);\n },\n target: 'inspector',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setInspectorMode('collapsed'),\n requestToggle: () => shell.togglePane('inspector'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n if (isOverlay) {\n const open = shell.inspectorMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setInspectorMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"end\" style={{ padding: 0 }} width={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Inspector</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...props}\n ref={setRef}\n className={classNames('rt-ShellInspector', className)}\n data-mode={shell.inspectorMode}\n data-peek={shell.peekTarget === 'inspector' || undefined}\n data-presentation={resolvedPresentation}\n data-open={(isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--inspector-size' as any]: `${expandedSize}px`,\n ['--inspector-min-size' as any]: `${minSize}px`,\n ['--inspector-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellInspectorContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,MAAsB,wBAC/B,OAAS,YAAAC,MAAgB,sBACzB,OAAS,6BAAAC,MAAiC,oBAC1C,OAAS,qBAAAC,MAAyB,oBAClC,OAAS,mBAAAC,EAAiB,cAAAC,MAAkB,qBAC5C,OAAS,eAAAC,OAAmB,oBA4BrB,MAAMC,EAAYV,EAAM,WAC7B,CACE,CACE,UAAAW,EACA,aAAAC,EAAe,CAAE,QAAS,UAAW,GAAI,OAAQ,EACjD,KAAAC,EACA,YAAAC,EAAc,YACd,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,YAAAC,EACA,SAAAC,EACA,MAAAC,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,EAAA,cAACG,EAAA,KACCH,EAAA,cAACE,EAAM,MAAN,KAAY,WAAS,CACxB,EACC2C,CACH,CACF,CAEJ,CAEA,OACE7C,EAAA,cAAC,OACE,GAAGiC,EACJ,IAAKO,EACL,UAAWvC,EAAW,oBAAqBU,CAAS,EACpD,YAAWwB,EAAM,cACjB,YAAWA,EAAM,aAAe,aAAe,OAC/C,oBAAmBC,EACnB,YAAYE,GAAae,GAAe,OACxC,MAAO,CACL,GAAGrB,EACF,mBAA4B,GAAGhB,CAAY,KAC3C,uBAAgC,GAAGC,CAAO,KAC1C,uBAAgC,GAAGC,CAAO,IAC7C,GAEAlB,EAAA,cAAC,OAAI,UAAU,2BAA2B,eAAcqD,GAAc,QACnER,CACH,EACCe,CACH,CAEJ,CACF,EAEAlD,EAAU,YAAc,kBACxBA,EAAU,OAASH",
|
|
6
|
+
"names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "PaneResizeContext", "InspectorHandle", "PaneHandle", "BREAKPOINTS", "Inspector", "className", "presentation", "mode", "defaultMode", "onModeChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "resolveResponsiveMode", "dm", "order", "startIdx", "bp", "lastInspectorBpRef", "next", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "open"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PaneResizeContextValue {
|
|
3
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
4
|
+
cssVarName: string;
|
|
5
|
+
minSize: number;
|
|
6
|
+
maxSize: number;
|
|
7
|
+
defaultSize: number;
|
|
8
|
+
orientation: 'vertical' | 'horizontal';
|
|
9
|
+
edge: 'start' | 'end';
|
|
10
|
+
computeNext: (clientPos: number, startClientPos: number, startSize: number) => number;
|
|
11
|
+
onResize?: (size: number) => void;
|
|
12
|
+
onResizeStart?: (size: number) => void;
|
|
13
|
+
onResizeEnd?: (size: number) => void;
|
|
14
|
+
target: 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';
|
|
15
|
+
collapsible: boolean;
|
|
16
|
+
snapPoints?: number[];
|
|
17
|
+
snapTolerance: number;
|
|
18
|
+
collapseThreshold?: number;
|
|
19
|
+
requestCollapse?: () => void;
|
|
20
|
+
requestToggle?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const PaneResizeContext: React.Context<PaneResizeContextValue | null>;
|
|
23
|
+
export declare function usePaneResize(): PaneResizeContextValue;
|
|
24
|
+
//# sourceMappingURL=shell-resize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-resize.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-resize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACtF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvE,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,8CAA2D,CAAC;AAE1F,wBAAgB,aAAa,2BAI5B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/shell-resize.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\n\nexport interface PaneResizeContextValue {\n containerRef: React.RefObject<HTMLDivElement | null>;\n cssVarName: string;\n minSize: number;\n maxSize: number;\n defaultSize: number;\n orientation: 'vertical' | 'horizontal';\n edge: 'start' | 'end';\n computeNext: (clientPos: number, startClientPos: number, startSize: number) => number;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n target: 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n collapsible: boolean;\n snapPoints?: number[];\n snapTolerance: number;\n collapseThreshold?: number;\n requestCollapse?: () => void;\n requestToggle?: () => void;\n}\n\nexport const PaneResizeContext = React.createContext<PaneResizeContextValue | null>(null);\n\nexport function usePaneResize() {\n const ctx = React.useContext(PaneResizeContext);\n if (!ctx) throw new Error('Shell.Handle must be used within a resizable pane');\n return ctx;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QAuBhB,MAAMC,EAAoBD,EAAM,cAA6C,IAAI,EAEjF,SAASE,GAAgB,CAC9B,MAAMC,EAAMH,EAAM,WAAWC,CAAiB,EAC9C,GAAI,CAACE,EAAK,MAAM,IAAI,MAAM,mDAAmD,EAC7E,OAAOA,CACT",
|
|
6
|
+
"names": ["React", "PaneResizeContext", "usePaneResize", "ctx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SidebarHandle } from './shell-handles.js';
|
|
3
|
+
import type { PaneMode, PaneSizePersistence, ResponsivePresentation, ResponsiveSidebarMode, SidebarMode } from '../shell.types.js';
|
|
4
|
+
interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
presentation?: ResponsivePresentation;
|
|
6
|
+
mode?: PaneMode;
|
|
7
|
+
defaultMode?: any;
|
|
8
|
+
onModeChange?: (mode: PaneMode | SidebarMode) => void;
|
|
9
|
+
expandedSize?: number;
|
|
10
|
+
minSize?: number;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
resizable?: boolean;
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
onExpand?: () => void;
|
|
15
|
+
onCollapse?: () => void;
|
|
16
|
+
onResize?: (size: number) => void;
|
|
17
|
+
resizer?: React.ReactNode;
|
|
18
|
+
onResizeStart?: (size: number) => void;
|
|
19
|
+
onResizeEnd?: (size: number) => void;
|
|
20
|
+
snapPoints?: number[];
|
|
21
|
+
snapTolerance?: number;
|
|
22
|
+
collapseThreshold?: number;
|
|
23
|
+
paneId?: string;
|
|
24
|
+
persistence?: PaneSizePersistence;
|
|
25
|
+
}
|
|
26
|
+
type SidebarComponent = React.ForwardRefExoticComponent<Omit<PaneProps, 'mode' | 'defaultMode' | 'onModeChange'> & {
|
|
27
|
+
mode?: SidebarMode;
|
|
28
|
+
defaultMode?: ResponsiveSidebarMode;
|
|
29
|
+
onModeChange?: (mode: SidebarMode) => void;
|
|
30
|
+
thinSize?: number;
|
|
31
|
+
toggleModes?: 'both' | 'single';
|
|
32
|
+
} & React.RefAttributes<HTMLDivElement>> & {
|
|
33
|
+
Handle: typeof SidebarHandle;
|
|
34
|
+
};
|
|
35
|
+
export declare const Sidebar: SidebarComponent;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=shell-sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAc,QAAQ,EAAE,mBAAmB,EAAqB,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGlK,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,KAAK,gBAAgB,GAAG,KAAK,CAAC,yBAAyB,CACrD,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACjC,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CACxC,GAAG;IAAE,MAAM,EAAE,OAAO,aAAa,CAAA;CAAE,CAAC;AAErC,eAAO,MAAM,OAAO,EA2Sf,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from"react";import ne from"classnames";import*as P from"../sheet.js";import{VisuallyHidden as ae}from"../visually-hidden.js";import{useShell as D}from"../shell.context.js";import{useResponsivePresentation as oe}from"../shell.hooks.js";import{PaneResizeContext as ie}from"./shell-resize.js";import{SidebarHandle as C,PaneHandle as se}from"./shell-handles.js";import{BREAKPOINTS as de}from"../shell.types.js";const L=r.forwardRef(({className:K,presentation:j={initial:"overlay",md:"fixed"},mode:o,defaultMode:d="expanded",onModeChange:E,expandedSize:s=288,minSize:x=200,maxSize:B=400,resizable:S=!1,collapsible:q=!0,onExpand:T,onCollapse:w,onResize:h,onResizeStart:F,onResizeEnd:W,snapPoints:G,snapTolerance:J,collapseThreshold:Q,paneId:y,persistence:v,children:U,style:X,thinSize:c=64,toggleModes:R,...Y},u)=>{const t=D(),g=oe(j),p=g==="overlay",Z=g==="stacked",b=r.useRef(null),_=r.useCallback(e=>{b.current=e,typeof u=="function"?u(e):u&&(u.current=e)},[u]),H=r.Children.toArray(U),O=H.filter(e=>r.isValidElement(e)&&e.type===C),z=H.filter(e=>!(r.isValidElement(e)&&e.type===C)),ee=r.useId();r.useEffect(()=>(t.setHasSidebar(!0),()=>{t.setHasSidebar(!1)}),[t,ee]);const N=r.useRef(!1);r.useEffect(()=>{N.current||(N.current=!0,o===void 0&&t.sidebarMode!==d&&t.setSidebarMode(d))},[]),r.useEffect(()=>{o!==void 0&&t.sidebarMode!==o&&t.setSidebarMode(o)},[o,t]),r.useEffect(()=>{o===void 0&&E?.(t.sidebarMode)},[t.sidebarMode,o,E]),r.useEffect(()=>{t.sidebarMode==="expanded"?T?.():w?.()},[t.sidebarMode,T,w]);const $=t.sidebarMode!=="collapsed",f=r.useMemo(()=>{if(!y||v)return v;const e=`kookie-ui:shell:sidebar:${y}`;return{load:()=>{if(typeof window>"u")return;const n=window.localStorage.getItem(e);return n?Number(n):void 0},save:n=>{typeof window>"u"||window.localStorage.setItem(e,String(n))}}},[y,v]);r.useEffect(()=>{let e=!0;return(async()=>{if(!S||!f?.load||p)return;const a=await f.load();e&&typeof a=="number"&&b.current&&(b.current.style.setProperty("--sidebar-size",`${a}px`),h?.(a))})(),()=>{e=!1}},[S,f,h,p]);const m=r.useCallback(()=>{if(typeof d=="string")return d;const e=d;if(e&&e[t.currentBreakpoint])return e[t.currentBreakpoint];const n=[...Object.keys(de)].reverse().concat("initial"),i=n.indexOf(t.currentBreakpoint);for(let l=i+1;l<n.length;l++){const V=n[l];if(e&&e[V])return e[V]}return"collapsed"},[d,t.currentBreakpoint]),M=D(),k=r.useCallback(()=>{const e=m();return e==="thin"||e==="expanded"?e:"expanded"},[m]);r.useEffect(()=>{if(!M.setSidebarToggleComputer)return;const e=R??"both",a=n=>{if(e==="both")return n==="collapsed"?"thin":n==="thin"?"expanded":"collapsed";const i=k();return n==="collapsed"?i:n===i?"collapsed":i};return M.setSidebarToggleComputer(a),()=>{M.setSidebarToggleComputer?.(n=>n==="collapsed"?"thin":n==="thin"?"expanded":"collapsed")}},[M,R,k]);const A=r.useRef(s),te=r.useRef("expanded");r.useEffect(()=>{t.sidebarMode!=="collapsed"&&(te.current=t.sidebarMode,A.current=t.sidebarMode==="thin"?c:s)},[t.sidebarMode,c,s]);const I=r.useRef(null);r.useEffect(()=>{if(o!==void 0||!t.currentBreakpointReady||I.current===t.currentBreakpoint)return;I.current=t.currentBreakpoint;const e=m();e!==t.sidebarMode&&t.setSidebarMode(e)},[o,t.currentBreakpoint,t.currentBreakpointReady,m,t.sidebarMode,t.setSidebarMode]);const re=S&&!p&&t.sidebarMode==="expanded"?r.createElement(ie.Provider,{value:{containerRef:b,cssVarName:"--sidebar-size",minSize:x,maxSize:B,defaultSize:s,orientation:"vertical",edge:"end",computeNext:(e,a,n)=>{const i=getComputedStyle(b.current).direction==="rtl",l=e-a;return n+(i?-l:l)},onResize:h,onResizeStart:F,onResizeEnd:e=>{W?.(e),f?.save?.(e)},target:"sidebar",collapsible:q,snapPoints:G,snapTolerance:J??8,collapseThreshold:Q,requestCollapse:()=>t.setSidebarMode("collapsed"),requestToggle:()=>t.togglePane("sidebar")}},O.length>0?O.map((e,a)=>r.cloneElement(e,{key:e.key??a})):r.createElement(se,null)):null;if(p){const e=t.sidebarMode!=="collapsed";return r.createElement(P.Root,{open:e,onOpenChange:a=>t.setSidebarMode(a?"expanded":"collapsed")},r.createElement(P.Content,{side:"start",style:{padding:0},width:{initial:`${e?t.sidebarMode==="thin"?c:s:A.current}px`}},r.createElement(ae,null,r.createElement(P.Title,null,"Sidebar")),z))}return r.createElement("div",{...Y,ref:_,className:ne("rt-ShellSidebar",K),"data-mode":t.sidebarMode,"data-peek":t.peekTarget==="sidebar"||void 0,"data-presentation":g,"data-open":Z&&$||void 0,style:{...X,"--sidebar-size":`${s}px`,"--sidebar-thin-size":`${c}px`,"--sidebar-min-size":`${x}px`,"--sidebar-max-size":`${B}px`,...t.peekTarget==="sidebar"&&t.sidebarMode==="collapsed"&&!p?(()=>{const e=R??"both",a=t.sidebarMode;let n;if(e==="both")n=a==="collapsed"?"thin":a==="thin"?"expanded":"collapsed";else{const i=k();n=a==="collapsed"?i:"collapsed"}return n==="thin"?{"--peek-sidebar-width":`${c}px`}:{"--peek-sidebar-width":`var(--sidebar-size, ${s}px)`}})():{}}},r.createElement("div",{className:"rt-ShellSidebarContent","data-visible":$||void 0},z),re)});L.displayName="Shell.Sidebar",L.Handle=C;export{L as Sidebar};
|
|
2
|
+
//# sourceMappingURL=shell-sidebar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/_internal/shell-sidebar.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { SidebarHandle, PaneHandle } from './shell-handles.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, PresentationValue, ResponsivePresentation, ResponsiveSidebarMode, SidebarMode } from '../shell.types.js';\nimport { BREAKPOINTS } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n mode?: PaneMode;\n defaultMode?: any;\n onModeChange?: (mode: PaneMode | SidebarMode) => void;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype SidebarComponent = React.ForwardRefExoticComponent<\n Omit<PaneProps, 'mode' | 'defaultMode' | 'onModeChange'> & {\n mode?: SidebarMode;\n defaultMode?: ResponsiveSidebarMode;\n onModeChange?: (mode: SidebarMode) => void;\n thinSize?: number;\n toggleModes?: 'both' | 'single';\n } & React.RefAttributes<HTMLDivElement>\n> & { Handle: typeof SidebarHandle };\n\nexport const Sidebar = React.forwardRef<\n HTMLDivElement,\n Omit<PaneProps, 'mode' | 'defaultMode' | 'onModeChange'> & {\n mode?: SidebarMode;\n defaultMode?: ResponsiveSidebarMode;\n onModeChange?: (mode: SidebarMode) => void;\n thinSize?: number;\n toggleModes?: 'both' | 'single';\n }\n>(\n (\n {\n className,\n presentation = { initial: 'overlay', md: 'fixed' },\n mode,\n defaultMode = 'expanded',\n onModeChange,\n expandedSize = 288,\n minSize = 200,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n thinSize = 64,\n toggleModes,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === SidebarHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === SidebarHandle));\n\n // Register with shell\n const sidebarId = React.useId();\n React.useEffect(() => {\n shell.setHasSidebar(true);\n return () => {\n shell.setHasSidebar(false);\n };\n }, [shell, sidebarId]);\n\n // Honor defaultMode on mount when uncontrolled\n const didInitRef = React.useRef(false);\n React.useEffect(() => {\n if (didInitRef.current) return;\n didInitRef.current = true;\n if (mode === undefined && shell.sidebarMode !== (defaultMode as SidebarMode)) {\n shell.setSidebarMode(defaultMode as SidebarMode);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Sync controlled mode\n React.useEffect(() => {\n if (mode !== undefined && shell.sidebarMode !== mode) {\n shell.setSidebarMode(mode);\n }\n }, [mode, shell]);\n\n // Emit mode changes\n React.useEffect(() => {\n if (mode === undefined) {\n onModeChange?.(shell.sidebarMode);\n }\n }, [shell.sidebarMode, mode, onModeChange]);\n\n // Emit expand/collapse events\n React.useEffect(() => {\n if (shell.sidebarMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.sidebarMode, onExpand, onCollapse]);\n\n // Option A: thin is width-only; content remains visible whenever not collapsed\n const isContentVisible = shell.sidebarMode !== 'collapsed';\n\n // Default persistence if paneId provided and none supplied (fixed only)\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:sidebar:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--sidebar-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n // Always-follow responsive defaultMode for uncontrolled Sidebar (on breakpoint change only)\n const resolveResponsiveMode = React.useCallback((): SidebarMode => {\n if (typeof defaultMode === 'string') return defaultMode as SidebarMode;\n const dm = defaultMode as Partial<Record<Breakpoint, SidebarMode>> | undefined;\n if (dm && dm[shell.currentBreakpoint as Breakpoint]) {\n return dm[shell.currentBreakpoint as Breakpoint] as SidebarMode;\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(shell.currentBreakpoint as Breakpoint);\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (dm && dm[bp]) return dm[bp] as SidebarMode;\n }\n return 'collapsed';\n }, [defaultMode, shell.currentBreakpoint]);\n\n // Register custom toggle behavior based on toggleModes (both|single)\n const shellForToggle = useShell();\n const resolveDefaultSidebarMode = React.useCallback((): SidebarMode => {\n const resolved = resolveResponsiveMode();\n return resolved === 'thin' || resolved === 'expanded' ? resolved : 'expanded';\n }, [resolveResponsiveMode]);\n\n React.useEffect(() => {\n if (!shellForToggle.setSidebarToggleComputer) return;\n const strategy: 'both' | 'single' = toggleModes ?? 'both';\n const compute = (current: SidebarMode): SidebarMode => {\n if (strategy === 'both') {\n if (current === 'collapsed') return 'thin';\n if (current === 'thin') return 'expanded';\n return 'collapsed';\n }\n const target = resolveDefaultSidebarMode();\n if (current === 'collapsed') return target;\n if (current === target) return 'collapsed';\n return target;\n };\n shellForToggle.setSidebarToggleComputer(compute);\n return () => {\n shellForToggle.setSidebarToggleComputer?.((cur) => (cur === 'collapsed' ? 'thin' : cur === 'thin' ? 'expanded' : 'collapsed'));\n };\n }, [shellForToggle, toggleModes, resolveDefaultSidebarMode]);\n\n const lastOverlayWidthRef = React.useRef<number>(expandedSize);\n const lastOverlayModeRef = React.useRef<SidebarMode>('expanded');\n React.useEffect(() => {\n if (shell.sidebarMode !== 'collapsed') {\n lastOverlayModeRef.current = shell.sidebarMode as SidebarMode;\n lastOverlayWidthRef.current = shell.sidebarMode === 'thin' ? thinSize : expandedSize;\n }\n }, [shell.sidebarMode, thinSize, expandedSize]);\n\n const lastSidebarBpRef = React.useRef<Breakpoint | null>(null);\n React.useEffect(() => {\n if (mode !== undefined) return;\n if (!shell.currentBreakpointReady) return;\n if (lastSidebarBpRef.current === shell.currentBreakpoint) return;\n lastSidebarBpRef.current = shell.currentBreakpoint as Breakpoint;\n const next = resolveResponsiveMode();\n if (next !== shell.sidebarMode) shell.setSidebarMode(next);\n }, [mode, shell.currentBreakpoint, shell.currentBreakpointReady, resolveResponsiveMode, shell.sidebarMode, shell.setSidebarMode]);\n\n const handleEl =\n resizable && !isOverlay && shell.sidebarMode === 'expanded' ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--sidebar-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'end',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? -delta : delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n persistenceAdapter?.save?.(size);\n },\n target: 'sidebar',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setSidebarMode('collapsed'),\n requestToggle: () => shell.togglePane('sidebar'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n if (isOverlay) {\n const open = shell.sidebarMode !== 'collapsed';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setSidebarMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content\n side=\"start\"\n style={{ padding: 0 }}\n width={{\n initial: `${open ? (shell.sidebarMode === 'thin' ? thinSize : expandedSize) : lastOverlayWidthRef.current}px`,\n }}\n >\n <VisuallyHidden>\n <Sheet.Title>Sidebar</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...props}\n ref={setRef}\n className={classNames('rt-ShellSidebar', className)}\n data-mode={shell.sidebarMode}\n data-peek={shell.peekTarget === 'sidebar' || undefined}\n data-presentation={resolvedPresentation}\n data-open={(isStacked && isContentVisible) || undefined}\n style={{\n ...style,\n ['--sidebar-size' as any]: `${expandedSize}px`,\n ['--sidebar-thin-size' as any]: `${thinSize}px`,\n ['--sidebar-min-size' as any]: `${minSize}px`,\n ['--sidebar-max-size' as any]: `${maxSize}px`,\n ...(shell.peekTarget === 'sidebar' && shell.sidebarMode === 'collapsed' && !isOverlay\n ? (() => {\n const strategy: 'both' | 'single' = toggleModes ?? 'both';\n const current = shell.sidebarMode as SidebarMode;\n let next: SidebarMode;\n if (strategy === 'both') {\n next = current === 'collapsed' ? 'thin' : current === 'thin' ? 'expanded' : 'collapsed';\n } else {\n const target = resolveDefaultSidebarMode();\n next = current === 'collapsed' ? target : 'collapsed';\n }\n if (next === 'thin') {\n return {\n ['--peek-sidebar-width' as any]: `${thinSize}px`,\n } as React.CSSProperties;\n }\n return {\n ['--peek-sidebar-width' as any]: `var(--sidebar-size, ${expandedSize}px)`,\n } as React.CSSProperties;\n })()\n : {}),\n }}\n >\n <div className=\"rt-ShellSidebarContent\" data-visible={isContentVisible || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as SidebarComponent;\n\nSidebar.displayName = 'Shell.Sidebar';\nSidebar.Handle = SidebarHandle;\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,UAAYC,MAAW,cACvB,OAAS,kBAAAC,OAAsB,wBAC/B,OAAS,YAAAC,MAAgB,sBACzB,OA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E,CACL,MAAMC,EAASL,EAA0B,EACzCU,EAAON,IAAY,YAAcC,EAAS,WAC5C,CACA,OAAIK,IAAS,OACJ,CACJ,uBAAgC,GAAGzC,CAAQ,IAC9C,EAEK,CACJ,uBAAgC,uBAAuBjB,CAAY,KACtE,CACF,GAAG,EACH,CAAC,CACP,GAEAhB,EAAA,cAAC,OAAI,UAAU,yBAAyB,eAAckD,GAAoB,QACvEH,CACH,EACC4B,EACH,CAEJ,CACF,EAEAjE,EAAQ,YAAc,gBACtBA,EAAQ,OAASH",
|
|
6
|
+
"names": ["React", "classNames", "Sheet", "VisuallyHidden", "useShell", "useResponsivePresentation", "PaneResizeContext", "SidebarHandle", "PaneHandle", "BREAKPOINTS", "Sidebar", "className", "presentation", "mode", "defaultMode", "onModeChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "thinSize", "toggleModes", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "sidebarId", "didInitRef", "isContentVisible", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "resolveResponsiveMode", "dm", "order", "startIdx", "i", "bp", "shellForToggle", "resolveDefaultSidebarMode", "resolved", "strategy", "compute", "current", "target", "cur", "lastOverlayWidthRef", "lastOverlayModeRef", "lastSidebarBpRef", "next", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "open", "o"]
|
|
7
|
+
}
|
|
@@ -28,6 +28,8 @@ export { ToggleButtonSchema, parseToggleButtonProps } from './toggle-button.sche
|
|
|
28
28
|
export type { ToggleButtonProps } from './toggle-button.schema.js';
|
|
29
29
|
export { ToggleIconButtonSchema, parseToggleIconButtonProps } from './toggle-icon-button.schema.js';
|
|
30
30
|
export type { ToggleIconButtonProps } from './toggle-icon-button.schema.js';
|
|
31
|
+
export { ShellRootSchema, ShellHeaderSchema, ShellRailSchema, ShellPanelSchema, ShellSidebarSchema, ShellContentSchema, ShellInspectorSchema, ShellBottomSchema, ShellTriggerSchema, ShellHandleSchema, parseShellRootProps, parseShellHeaderProps, parseShellRailProps, parseShellPanelProps, parseShellSidebarProps, parseShellContentProps, parseShellInspectorProps, parseShellBottomProps, parseShellTriggerProps, parseShellHandleProps, } from './shell.schema.js';
|
|
32
|
+
export type { ShellRootProps, ShellHeaderProps, ShellRailProps, ShellPanelProps, ShellSidebarProps, ShellContentProps, ShellInspectorProps, ShellBottomProps, ShellTriggerProps, ShellHandleProps, PaneMode, SidebarMode, PresentationValue, Breakpoint, PaneTarget, TriggerAction, ResponsiveMode, ResponsiveSidebarMode, ResponsivePresentation, PaneSizePersistence, } from './shell.schema.js';
|
|
31
33
|
/**
|
|
32
34
|
* Generic parseProps helper for development-time validation
|
|
33
35
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACpG,YAAY,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACpG,YAAY,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAG5E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EA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