@kushagradhawan/kookie-ui 0.1.15 → 0.1.17
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 +1321 -131
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +2 -2
- package/dist/cjs/components/icons.d.ts +2 -1
- package/dist/cjs/components/icons.d.ts.map +1 -1
- package/dist/cjs/components/icons.js +1 -1
- package/dist/cjs/components/icons.js.map +3 -3
- package/dist/cjs/components/image.d.ts +4 -0
- package/dist/cjs/components/image.d.ts.map +1 -1
- package/dist/cjs/components/image.js +1 -1
- package/dist/cjs/components/image.js.map +3 -3
- package/dist/cjs/components/sidebar.d.ts +117 -42
- 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/cjs/components/sidebar.props.d.ts +17 -10
- package/dist/cjs/components/sidebar.props.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.props.js +1 -1
- package/dist/cjs/components/sidebar.props.js.map +3 -3
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.js.map +3 -3
- package/dist/esm/components/icons.d.ts +2 -1
- package/dist/esm/components/icons.d.ts.map +1 -1
- package/dist/esm/components/icons.js +1 -1
- package/dist/esm/components/icons.js.map +3 -3
- package/dist/esm/components/image.d.ts +4 -0
- package/dist/esm/components/image.d.ts.map +1 -1
- package/dist/esm/components/image.js +1 -1
- package/dist/esm/components/image.js.map +3 -3
- package/dist/esm/components/sidebar.d.ts +117 -42
- 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 +3 -3
- package/dist/esm/components/sidebar.props.d.ts +17 -10
- package/dist/esm/components/sidebar.props.d.ts.map +1 -1
- package/dist/esm/components/sidebar.props.js +1 -1
- package/dist/esm/components/sidebar.props.js.map +3 -3
- package/package.json +1 -1
- package/src/components/_internal/base-button.css +2 -9
- package/src/components/_internal/base-menu.css +2 -2
- package/src/components/button.css +2 -2
- package/src/components/dropdown-menu.tsx +2 -2
- package/src/components/icon-button.css +2 -2
- package/src/components/icons.tsx +18 -1
- package/src/components/image.tsx +48 -9
- package/src/components/sidebar.css +850 -54
- package/src/components/sidebar.props.tsx +15 -11
- package/src/components/sidebar.tsx +500 -367
- package/styles.css +1321 -131
|
@@ -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';\n\nimport { sidebarPropDefs } from './sidebar.props.js';\n\nimport { IconButton } from './icon-button.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Separator } from './separator.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\n\n\n// Import base menu styling and components\nimport { baseMenuItemPropDefs } from './_internal/base-menu.props.js';\nimport { Slot } from 'radix-ui';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\n// Context for sidebar state\ntype SidebarContextProps = {\n open: boolean;\n setOpen: (open: boolean) => void;\n collapsible: 'icon' | 'offcanvas' | 'none';\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a Sidebar.Provider');\n }\n return context;\n}\n\n// Provider component\ninterface SidebarProviderProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(\n ({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, children, ...props }, forwardedRef) => {\n // Internal state for uncontrolled mode\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n \n // Use controlled state if provided, otherwise internal state\n const open = openProp ?? internalOpen;\n \n const setOpen = React.useCallback((value: boolean) => {\n if (setOpenProp) {\n setOpenProp(value); // Controlled mode\n } else {\n setInternalOpen(value); // Uncontrolled mode\n }\n }, [setOpenProp]);\n\n return (\n <div {...props} ref={forwardedRef}>\n <SidebarContext.Provider value={{ open, setOpen, collapsible: 'icon' }}>\n {children}\n </SidebarContext.Provider>\n </div>\n );\n }\n);\nSidebarProvider.displayName = 'Sidebar.Provider';\n\n// Root sidebar container\ntype SidebarRootOwnProps = GetPropDefTypes<typeof sidebarPropDefs>;\ntype SidebarRootElement = HTMLDivElement;\ninterface SidebarRootProps\n extends ComponentPropsWithout<'div', RemovedProps>,\n SidebarRootOwnProps {}\n\nconst SidebarRoot = React.forwardRef<SidebarRootElement, SidebarRootProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n const { open } = useSidebar();\n \n const {\n size = sidebarPropDefs.size.default,\n variant = sidebarPropDefs.variant.default,\n side = sidebarPropDefs.side.default,\n collapsible = sidebarPropDefs.collapsible.default,\n floating: _floating = sidebarPropDefs.floating.default,\n color,\n highContrast = sidebarPropDefs.highContrast.default,\n } = props;\n\n const { className, children, ...rootProps } = extractProps(props, sidebarPropDefs);\n const resolvedColor = color || themeContext.accentColor;\n\n return (\n <div\n {...rootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n data-state={open ? 'expanded' : 'collapsed'}\n data-side={side}\n data-collapsible={collapsible}\n className={classNames(\n 'rt-SidebarRoot',\n className\n )}\n >\n <Theme asChild>\n <div \n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`, `rt-r-size-${size}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n >\n {children}\n </div>\n </Theme>\n </div>\n );\n }\n);\nSidebarRoot.displayName = 'Sidebar.Root';\n\n// Sidebar content area\ntype SidebarContentElement = HTMLDivElement;\ninterface SidebarContentProps extends ComponentPropsWithout<'div', RemovedProps> {}\n\nconst SidebarContent = React.forwardRef<SidebarContentElement, SidebarContentProps>(\n ({ className, children, ...props }, forwardedRef) => (\n <ScrollArea type=\"auto\">\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarContent', 'rt-BaseMenuContent', className)}\n >\n {children}\n </div>\n </ScrollArea>\n )\n);\nSidebarContent.displayName = 'Sidebar.Content';\n\n// Sidebar header\ntype SidebarHeaderElement = HTMLDivElement;\ninterface SidebarHeaderProps extends ComponentPropsWithout<'div', RemovedProps> {}\n\nconst SidebarHeader = React.forwardRef<SidebarHeaderElement, SidebarHeaderProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarHeader', 'rt-BaseMenuContent', className)}\n />\n )\n);\nSidebarHeader.displayName = 'Sidebar.Header';\n\n// Sidebar footer\ntype SidebarFooterElement = HTMLDivElement;\ninterface SidebarFooterProps extends ComponentPropsWithout<'div', RemovedProps> {}\n\nconst SidebarFooter = React.forwardRef<SidebarFooterElement, SidebarFooterProps>(\n ({ className, ...props }, forwardedRef) => (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarFooter', 'rt-BaseMenuContent', className)}\n />\n )\n);\nSidebarFooter.displayName = 'Sidebar.Footer';\n\n// Sidebar trigger button\ntype SidebarTriggerElement = React.ElementRef<typeof IconButton>;\ninterface SidebarTriggerProps extends ComponentPropsWithout<typeof IconButton, RemovedProps> {}\n\nconst SidebarTrigger = React.forwardRef<SidebarTriggerElement, SidebarTriggerProps>(\n ({ onClick, ...props }, forwardedRef) => {\n const { setOpen, open } = useSidebar();\n \n return (\n <IconButton\n {...props}\n ref={forwardedRef}\n variant=\"ghost\"\n onClick={(event) => {\n onClick?.(event);\n setOpen(!open);\n }}\n >\n <ChevronDownIcon />\n </IconButton>\n );\n }\n);\nSidebarTrigger.displayName = 'Sidebar.Trigger';\n\n// Main content area (pushes to make room for sidebar)\ntype SidebarInsetElement = HTMLDivElement;\ninterface SidebarInsetProps extends ComponentPropsWithout<'main', RemovedProps> {}\n\nconst SidebarInset = React.forwardRef<SidebarInsetElement, SidebarInsetProps>(\n ({ className, ...props }, forwardedRef) => (\n <main\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarInset', className)}\n />\n )\n);\nSidebarInset.displayName = 'Sidebar.Inset';\n\n// Create sidebar-specific menu components that don't require DropdownMenu context\ninterface SidebarLabelProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarLabel = React.forwardRef<HTMLDivElement, SidebarLabelProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={classNames('rt-BaseMenuLabel', className)}\n {...props}\n />\n )\n);\nSidebarLabel.displayName = 'Sidebar.Label';\n\ntype SidebarItemOwnProps = GetPropDefTypes<typeof baseMenuItemPropDefs>;\ninterface SidebarItemProps \n extends ComponentPropsWithout<'div', RemovedProps>,\n SidebarItemOwnProps {}\n\nconst SidebarItem = React.forwardRef<HTMLDivElement, SidebarItemProps>(\n (props, ref) => {\n const {\n className,\n children,\n color = baseMenuItemPropDefs.color.default,\n shortcut,\n asChild = false,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...itemProps\n } = props;\n \n const [highlighted, setHighlighted] = React.useState(false);\n \n const handleMouseEnter = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onMouseEnter?.(e);\n }, [onMouseEnter]);\n \n const handleMouseLeave = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onMouseLeave?.(e);\n }, [onMouseLeave]);\n \n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onFocus?.(e);\n }, [onFocus]);\n \n const handleBlur = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onBlur?.(e);\n }, [onBlur]);\n \n if (asChild) {\n return (\n <Slot.Root\n ref={ref}\n data-accent-color={color}\n data-highlighted={highlighted || undefined}\n className={classNames('rt-reset', 'rt-BaseMenuItem', className)}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...itemProps}\n >\n {children}\n </Slot.Root>\n );\n }\n \n return (\n <div\n ref={ref}\n data-accent-color={color}\n data-highlighted={highlighted || undefined}\n className={classNames('rt-reset', 'rt-BaseMenuItem', className)}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n tabIndex={0}\n role=\"menuitem\"\n {...itemProps}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <div className=\"rt-BaseMenuShortcut\">{shortcut}</div>}\n </div>\n );\n }\n);\nSidebarItem.displayName = 'Sidebar.Item';\n\ninterface SidebarGroupProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroup = React.forwardRef<HTMLDivElement, SidebarGroupProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={classNames('rt-BaseMenuGroup', className)}\n {...props}\n />\n )\n);\nSidebarGroup.displayName = 'Sidebar.Group';\n\ninterface SidebarSeparatorProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarSeparator = React.forwardRef<HTMLDivElement, SidebarSeparatorProps>(\n ({ className, ..._props }, ref) => (\n <Separator\n ref={ref}\n className={classNames('rt-BaseMenuSeparator', className)}\n />\n )\n);\nSidebarSeparator.displayName = 'Sidebar.Separator';\n\n// Sidebar checkbox item with proper prop filtering\ninterface SidebarCheckboxItemProps extends React.ComponentPropsWithoutRef<'div'> {\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n color?: string;\n shortcut?: string;\n}\n\nconst SidebarCheckboxItem = React.forwardRef<HTMLDivElement, SidebarCheckboxItemProps>(\n ({ \n className, \n checked, \n onCheckedChange, \n children, \n color, \n shortcut, \n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onClick,\n ...props \n }, ref) => {\n const [highlighted, setHighlighted] = React.useState(false);\n \n const handleMouseEnter = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onMouseEnter?.(e);\n }, [onMouseEnter]);\n \n const handleMouseLeave = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onMouseLeave?.(e);\n }, [onMouseLeave]);\n \n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onFocus?.(e);\n }, [onFocus]);\n \n const handleBlur = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onBlur?.(e);\n }, [onBlur]);\n \n const handleClick = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n onCheckedChange?.(!checked);\n onClick?.(e);\n }, [checked, onCheckedChange, onClick]);\n \n return (\n <div\n ref={ref}\n data-accent-color={color}\n data-highlighted={highlighted || undefined}\n className={classNames(\n 'rt-reset',\n 'rt-BaseMenuItem',\n 'rt-BaseMenuCheckboxItem',\n className\n )}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleClick(e as any);\n }\n }}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n tabIndex={0}\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n {...props}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {checked && <div className=\"rt-BaseMenuItemIndicator\">\u2713</div>}\n {shortcut && <div className=\"rt-BaseMenuShortcut\">{shortcut}</div>}\n </div>\n );\n }\n);\nSidebarCheckboxItem.displayName = 'Sidebar.CheckboxItem';\n\n// Sidebar radio group with proper prop filtering \ninterface SidebarRadioGroupProps extends React.ComponentPropsWithoutRef<'div'> {\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst SidebarRadioGroup = React.forwardRef<HTMLDivElement, SidebarRadioGroupProps>(\n ({ className, value, onValueChange, children, ...props }, ref) => (\n <div\n ref={ref}\n className={classNames('rt-BaseMenuGroup', className)}\n {...props}\n >\n {children}\n </div>\n )\n);\nSidebarRadioGroup.displayName = 'Sidebar.RadioGroup';\n\n// Sidebar radio item with proper prop filtering\ninterface SidebarRadioItemProps extends React.ComponentPropsWithoutRef<'div'> {\n value?: string;\n color?: string;\n shortcut?: string;\n}\n\nconst SidebarRadioItem = React.forwardRef<HTMLDivElement, SidebarRadioItemProps>(\n ({ \n className, \n value, \n children, \n color, \n shortcut, \n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props \n }, ref) => {\n const [highlighted, setHighlighted] = React.useState(false);\n \n const handleMouseEnter = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onMouseEnter?.(e);\n }, [onMouseEnter]);\n \n const handleMouseLeave = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onMouseLeave?.(e);\n }, [onMouseLeave]);\n \n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(true);\n onFocus?.(e);\n }, [onFocus]);\n \n const handleBlur = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n setHighlighted(false);\n onBlur?.(e);\n }, [onBlur]);\n \n return (\n <div\n ref={ref}\n data-accent-color={color}\n data-highlighted={highlighted || undefined}\n className={classNames('rt-reset', 'rt-BaseMenuItem', className)}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n tabIndex={0}\n role=\"menuitemradio\"\n aria-checked={false}\n {...props}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <div className=\"rt-BaseMenuShortcut\">{shortcut}</div>}\n </div>\n );\n }\n);\nSidebarRadioItem.displayName = 'Sidebar.RadioItem';\n\n// Export all components\nexport {\n SidebarProvider as Provider,\n SidebarRoot as Root,\n SidebarContent as Content,\n SidebarHeader as Header,\n SidebarFooter as Footer,\n SidebarTrigger as Trigger,\n SidebarInset as Inset,\n // Re-export DropdownMenu components as sidebar menu components\n SidebarLabel as Label,\n SidebarItem as Item,\n SidebarGroup as Group,\n SidebarSeparator as Separator,\n SidebarCheckboxItem as CheckboxItem,\n SidebarRadioGroup as RadioGroup,\n SidebarRadioItem as RadioItem,\n // Export hook\n useSidebar,\n};\n\nexport type {\n SidebarProviderProps as ProviderProps,\n SidebarRootProps as RootProps,\n SidebarContentProps as ContentProps,\n SidebarHeaderProps as HeaderProps,\n SidebarFooterProps as FooterProps,\n SidebarTriggerProps as TriggerProps,\n SidebarInsetProps as InsetProps,\n}; "],
|
|
5
|
-
"mappings": "aAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,
|
|
6
|
-
"names": ["React", "classNames", "sidebarPropDefs", "IconButton", "ScrollArea", "Separator", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from './slot';\nimport { Accordion } from 'radix-ui';\n\nimport { sidebarPropDefs } from './sidebar.props';\nimport { Theme, useThemeContext } from './theme';\nimport { IconButton } from './icon-button';\nimport { ScrollArea } from './scroll-area';\nimport { Separator } from './separator';\nimport { ChevronDownIcon, ThickChevronRightIcon } from './icons';\nimport { extractProps } from '../helpers/extract-props';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props';\nimport type { GetPropDefTypes } from '../props/prop-def';\n\n// Sidebar context for state management\ntype SidebarContextProps = {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n side: 'left' | 'right';\n type: 'sidebar' | 'floating';\n variant: 'soft' | 'surface' | 'ghost';\n menuVariant: 'solid' | 'soft';\n collapsible: 'offcanvas' | 'icon' | 'none';\n size: '1' | '2';\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n return context;\n}\n\n// Hook to detect mobile (simplified version)\nfunction useIsMobile() {\n const [isMobile, setIsMobile] = React.useState(false);\n \n React.useEffect(() => {\n const checkIsMobile = () => {\n setIsMobile(window.innerWidth < 768);\n };\n \n checkIsMobile();\n window.addEventListener('resize', checkIsMobile);\n return () => window.removeEventListener('resize', checkIsMobile);\n }, []);\n \n return isMobile;\n}\n\n// Provider component\ninterface SidebarProviderProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n side?: 'left' | 'right';\n}\n\nconst SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(\n ({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, side = 'left', className, children, ...props }, forwardedRef) => {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n \n // Internal state for uncontrolled mode\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n \n // Use controlled state if provided, otherwise internal state\n const open = openProp ?? internalOpen;\n \n const setOpen = React.useCallback((value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === 'function' ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n setInternalOpen(openState);\n }\n }, [setOpenProp, open]);\n\n // Helper to toggle the sidebar\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // State for data attributes\n const state = open ? 'expanded' : 'collapsed';\n \n const contextValue = React.useMemo<Partial<SidebarContextProps>>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n side,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar, side]\n );\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarProvider', className)}\n data-state={state}\n data-side={side}\n >\n <SidebarContext.Provider value={contextValue as SidebarContextProps}>\n {children}\n </SidebarContext.Provider>\n </div>\n );\n }\n);\nSidebarProvider.displayName = 'Sidebar.Provider';\n\n// Main Sidebar component\ntype SidebarOwnProps = GetPropDefTypes<typeof sidebarPropDefs>;\ninterface SidebarProps extends ComponentPropsWithout<'div', RemovedProps>, SidebarOwnProps {}\n\nconst Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(\n (props, forwardedRef) => {\n const themeContext = useThemeContext();\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n const {\n size = sidebarPropDefs.size.default,\n variant = sidebarPropDefs.variant.default,\n menuVariant = sidebarPropDefs.menuVariant.default,\n type = sidebarPropDefs.type.default,\n side = sidebarPropDefs.side.default,\n collapsible = sidebarPropDefs.collapsible.default,\n color,\n highContrast = sidebarPropDefs.highContrast.default,\n asChild,\n } = props;\n\n const { className, children, ...rootProps } = extractProps(props, sidebarPropDefs);\n const { asChild: _, ...safeRootProps } = rootProps; // Remove asChild from DOM props\n const resolvedColor = color || themeContext.accentColor;\n\n // Update context with current props - we'll pass the resolved values\n const resolvedSize = typeof size === 'object' ? size.initial || '2' : size;\n const context = React.useContext(SidebarContext);\n if (context) {\n context.side = side;\n context.type = type;\n context.variant = variant;\n context.menuVariant = menuVariant;\n context.collapsible = collapsible;\n context.size = resolvedSize;\n }\n\n if (collapsible === 'none') {\n return (\n <div\n {...safeRootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n data-state={state}\n data-side={side}\n data-type={type}\n data-collapsible={collapsible}\n className={classNames('rt-SidebarRoot', `rt-r-size-${size}`, className)}\n >\n <Theme>\n <div \n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-side={side}\n >\n {children}\n </div>\n </Theme>\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <div\n {...safeRootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n data-state={openMobile ? 'open' : 'closed'}\n data-side={side}\n data-type={type}\n data-collapsible={collapsible}\n className={classNames('rt-SidebarRoot', 'rt-SidebarRoot--mobile', className)}\n >\n <Theme>\n <div \n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`, `rt-r-size-${size}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-side={side}\n >\n {children}\n </div>\n </Theme>\n </div>\n );\n }\n\n return (\n <div\n {...safeRootProps}\n ref={forwardedRef}\n data-accent-color={resolvedColor}\n data-state={state}\n data-side={side}\n data-type={type}\n data-collapsible={collapsible}\n className={classNames('rt-SidebarRoot', className)}\n >\n <Theme>\n <div \n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`, `rt-r-size-${size}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-side={side}\n >\n {children}\n </div>\n </Theme>\n </div>\n );\n }\n);\nSidebar.displayName = 'Sidebar.Root';\n\n// Sidebar content area\ninterface SidebarContentProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(\n ({ className, children, ...props }, forwardedRef) => {\n const context = React.useContext(SidebarContext);\n const { size = '2', menuVariant = 'soft' } = context || {};\n \n return (\n <ScrollArea type=\"auto\">\n <div\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-SidebarContent', \n `rt-r-size-${size}`,\n `rt-menu-variant-${menuVariant}`,\n className\n )}\n >\n {children}\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 context = React.useContext(SidebarContext);\n const { size = '2', menuVariant = 'soft' } = context || {};\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 context = React.useContext(SidebarContext);\n const { size = '2', menuVariant = 'soft' } = context || {};\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\ninterface SidebarTriggerProps extends ComponentPropsWithout<typeof IconButton, RemovedProps> {}\n\nconst SidebarTrigger = React.forwardRef<\n React.ElementRef<typeof IconButton>,\n SidebarTriggerProps\n>(({ onClick, children, ...props }, forwardedRef) => {\n const { toggleSidebar } = useSidebar();\n \n return (\n <IconButton\n {...props}\n ref={forwardedRef}\n variant=\"ghost\"\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n >\n {children || <ChevronDownIcon />}\n </IconButton>\n );\n});\nSidebarTrigger.displayName = 'Sidebar.Trigger';\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 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\n {...props}\n ref={forwardedRef}\n className={classNames('rt-SidebarMenuItem', className)}\n />\n )\n);\nSidebarMenuItem.displayName = 'Sidebar.MenuItem';\n\ninterface SidebarMenuButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n isActive?: boolean;\n}\n\nconst SidebarMenuButton = React.forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(\n ({ asChild = false, isActive = false, className, onMouseEnter, onMouseLeave, ...props }, forwardedRef) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const Comp = asChild ? Slot : 'button';\n \n return (\n <Comp\n {...props}\n ref={forwardedRef}\n className={classNames(\n 'rt-reset',\n 'rt-SidebarMenuButton',\n className\n )}\n data-active={isActive || undefined}\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 );\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\n type=\"single\"\n collapsible\n defaultValue={defaultOpen ? 'item' : undefined}\n >\n <Accordion.Item value=\"item\">\n {children}\n </Accordion.Item>\n </Accordion.Root>\n </div>\n );\n }\n);\nSidebarMenuSub.displayName = 'Sidebar.MenuSub';\n\ninterface SidebarMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof Accordion.Trigger> {\n asChild?: boolean;\n}\n\nconst SidebarMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof Accordion.Trigger>,\n SidebarMenuSubTriggerProps\n>(({ asChild = false, className, children, onMouseEnter, onMouseLeave, ...props }, forwardedRef) => {\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 className={classNames(\n 'rt-reset',\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});\nSidebarMenuSubTrigger.displayName = 'Sidebar.MenuSubTrigger';\n\ninterface SidebarMenuSubContentProps 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\">\n {children}\n </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-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 className={classNames('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 SidebarProvider as Provider,\n Sidebar as Root,\n SidebarContent as Content,\n SidebarHeader as Header,\n SidebarFooter as Footer,\n SidebarTrigger as Trigger,\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 // Export hook\n useSidebar,\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 SidebarProviderProps as ProviderProps,\n SidebarProps as RootProps,\n SidebarContentProps as ContentProps,\n SidebarHeaderProps as HeaderProps,\n SidebarFooterProps as FooterProps,\n SidebarTriggerProps as TriggerProps,\n}; "],
|
|
5
|
+
"mappings": "aAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,SACrB,OAAS,aAAAC,MAAiB,WAE1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,IAAeP,CAAK,CACtB,GAECZ,EACCvB,EAEA1B,EAAA,cAAAA,EAAA,cACG0B,EACD1B,EAAA,cAACW,EAAA,CACC,UAAWV,EACT,4BACA,8BACF,EACF,CACF,CAEJ,CACF,CACF,CAEJ,CAAC,EACDuE,EAAsB,YAAc,yBAIpC,MAAMC,EAAwBzE,EAAM,WAGlC,CAAC,CAAE,UAAAyB,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAElC5B,EAAA,cAACG,EAAU,QAAV,CACE,GAAGwB,EACJ,IAAKC,EACL,UAAW3B,EAAW,2BAA4BwB,CAAS,GAE3DzB,EAAA,cAAC,OAAI,UAAU,yBACZ0B,CACH,CACF,CAEH,EACD+C,EAAsB,YAAc,yBAKpC,MAAMC,EAAe1E,EAAM,WACzB,CAAC,CAAE,UAAAyB,EAAW,GAAGE,CAAM,EAAGC,IACxB5B,EAAA,cAAC,OACE,GAAG2B,EACJ,IAAKC,EACL,UAAW3B,EAAW,kBAAmBwB,CAAS,EACpD,CAEJ,EACAiD,EAAa,YAAc,gBAM3B,MAAMC,EAAoB3E,EAAM,WAC9B,CAAC,CAAE,QAAAiD,EAAU,GAAO,UAAAxB,EAAW,GAAGE,CAAM,EAAGC,IAIvC5B,EAAA,cAHWiD,EAAU/C,EAAO,MAG3B,CACE,GAAGyB,EACJ,IAAKC,EACL,UAAW3B,EAAW,uBAAwBwB,CAAS,EACzD,CAGN,EACAkD,EAAkB,YAAc,qBAIhC,MAAMC,EAAsB5E,EAAM,WAChC,CAAC,CAAE,UAAAyB,EAAW,GAAGE,CAAM,EAAGC,IACxB5B,EAAA,cAAC,OACE,GAAG2B,EACJ,IAAKC,EACL,UAAW3B,EAAW,yBAA0BwB,CAAS,EAC3D,CAEJ,EACAmD,EAAoB,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "Slot", "Accordion", "sidebarPropDefs", "Theme", "useThemeContext", "IconButton", "ScrollArea", "Separator", "ChevronDownIcon", "ThickChevronRightIcon", "extractProps", "SidebarContext", "useSidebar", "context", "useIsMobile", "isMobile", "setIsMobile", "checkIsMobile", "SidebarProvider", "defaultOpen", "openProp", "setOpenProp", "side", "className", "children", "props", "forwardedRef", "openMobile", "setOpenMobile", "internalOpen", "setInternalOpen", "open", "setOpen", "value", "openState", "toggleSidebar", "state", "contextValue", "Sidebar", "themeContext", "size", "variant", "menuVariant", "type", "collapsible", "color", "highContrast", "asChild", "rootProps", "_", "safeRootProps", "resolvedColor", "resolvedSize", "SidebarContent", "SidebarHeader", "asContainer", "SidebarFooter", "SidebarTrigger", "onClick", "event", "SidebarSeparator", "SidebarMenu", "SidebarMenuItem", "SidebarMenuButton", "isActive", "onMouseEnter", "onMouseLeave", "isHighlighted", "setIsHighlighted", "SidebarMenuSub", "SidebarMenuSubTrigger", "SidebarMenuSubContent", "SidebarGroup", "SidebarGroupLabel", "SidebarGroupContent"]
|
|
7
7
|
}
|
|
@@ -8,21 +8,33 @@ declare const sidebarPropDefs: {
|
|
|
8
8
|
color: {
|
|
9
9
|
type: "enum";
|
|
10
10
|
values: readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky"];
|
|
11
|
-
default: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky";
|
|
11
|
+
default: ("gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky") | undefined;
|
|
12
12
|
};
|
|
13
13
|
size: {
|
|
14
14
|
type: "enum";
|
|
15
15
|
className: string;
|
|
16
|
-
values: readonly ["1", "2"
|
|
16
|
+
values: readonly ["1", "2"];
|
|
17
17
|
default: "2";
|
|
18
18
|
responsive: true;
|
|
19
19
|
};
|
|
20
20
|
variant: {
|
|
21
21
|
type: "enum";
|
|
22
22
|
className: string;
|
|
23
|
-
values: readonly ["
|
|
23
|
+
values: readonly ["soft", "surface", "ghost"];
|
|
24
24
|
default: "surface";
|
|
25
25
|
};
|
|
26
|
+
menuVariant: {
|
|
27
|
+
type: "enum";
|
|
28
|
+
className: string;
|
|
29
|
+
values: readonly ["solid", "soft"];
|
|
30
|
+
default: "soft";
|
|
31
|
+
};
|
|
32
|
+
type: {
|
|
33
|
+
type: "enum";
|
|
34
|
+
className: string;
|
|
35
|
+
values: readonly ["sidebar", "floating"];
|
|
36
|
+
default: "sidebar";
|
|
37
|
+
};
|
|
26
38
|
side: {
|
|
27
39
|
type: "enum";
|
|
28
40
|
className: string;
|
|
@@ -32,13 +44,8 @@ declare const sidebarPropDefs: {
|
|
|
32
44
|
collapsible: {
|
|
33
45
|
type: "enum";
|
|
34
46
|
className: string;
|
|
35
|
-
values: readonly ["
|
|
36
|
-
default: "
|
|
37
|
-
};
|
|
38
|
-
floating: {
|
|
39
|
-
type: "boolean";
|
|
40
|
-
className: string;
|
|
41
|
-
default: false;
|
|
47
|
+
values: readonly ["offcanvas", "icon", "none"];
|
|
48
|
+
default: "offcanvas";
|
|
42
49
|
};
|
|
43
50
|
asChild: {
|
|
44
51
|
type: "boolean";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.props.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar.props.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,IAAI,sBAAsB,EACjD,oBAAoB,IAAI,mBAAmB,EAC3C,4BAA4B,IAAI,2BAA2B,EAC3D,yBAAyB,IAAI,wBAAwB,GACtD,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.props.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar.props.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,IAAI,sBAAsB,EACjD,oBAAoB,IAAI,mBAAmB,EAC3C,4BAA4B,IAAI,2BAA2B,EAC3D,yBAAyB,IAAI,wBAAwB,GACtD,MAAM,gCAAgC,CAAC;AAUxC,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBpB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{asChildPropDef as e}from"../props/as-child.prop
|
|
1
|
+
import{asChildPropDef as e}from"../props/as-child.prop";import{colorPropDef as s}from"../props/color.prop";import{highContrastPropDef as a}from"../props/high-contrast.prop";import{baseMenuContentPropDefs as b,baseMenuItemPropDefs as D,baseMenuCheckboxItemPropDefs as P,baseMenuRadioItemPropDefs as y}from"./_internal/base-menu.props.js";const t=["1","2"],o=["soft","surface","ghost"],r=["solid","soft"],n=["sidebar","floating"],p=["left","right"],f=["offcanvas","icon","none"],i={...e,size:{type:"enum",className:"rt-r-size",values:t,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:o,default:"surface"},menuVariant:{type:"enum",className:"rt-menu-variant",values:r,default:"soft"},type:{type:"enum",className:"rt-type",values:n,default:"sidebar"},side:{type:"enum",className:"rt-side",values:p,default:"left"},collapsible:{type:"enum",className:"rt-collapsible",values:f,default:"offcanvas"},...s,...a};export{P as sidebarCheckboxItemPropDefs,b as sidebarContentPropDefs,D as sidebarItemPropDefs,i as sidebarPropDefs,y as sidebarRadioItemPropDefs};
|
|
2
2
|
//# sourceMappingURL=sidebar.props.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar.props.tsx"],
|
|
4
|
-
"sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop
|
|
5
|
-
"mappings": "AAAA,OAAS,kBAAAA,MAAsB,
|
|
6
|
-
"names": ["asChildPropDef", "
|
|
4
|
+
"sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop';\nimport { colorPropDef } from '../props/color.prop';\nimport { highContrastPropDef } from '../props/high-contrast.prop';\n\nimport type { PropDef } from '../props/prop-def';\n\n// Re-export base menu props for sidebar menu components\nexport {\n baseMenuContentPropDefs as sidebarContentPropDefs,\n baseMenuItemPropDefs as sidebarItemPropDefs,\n baseMenuCheckboxItemPropDefs as sidebarCheckboxItemPropDefs,\n baseMenuRadioItemPropDefs as sidebarRadioItemPropDefs,\n} from './_internal/base-menu.props.js';\n\n// Sidebar container props\nconst sizes = ['1', '2'] as const;\nconst variants = ['soft', 'surface', 'ghost'] as const;\nconst menuVariants = ['solid', 'soft'] as const;\nconst types = ['sidebar', 'floating'] as const;\nconst sides = ['left', 'right'] as const;\nconst collapsibleModes = ['offcanvas', 'icon', 'none'] as const;\n\nconst sidebarPropDefs = {\n ...asChildPropDef,\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'rt-variant', values: variants, default: 'surface' },\n menuVariant: { type: 'enum', className: 'rt-menu-variant', values: menuVariants, default: 'soft' },\n type: { type: 'enum', className: 'rt-type', values: types, default: 'sidebar' },\n side: { type: 'enum', className: 'rt-side', values: sides, default: 'left' },\n collapsible: { type: 'enum', className: 'rt-collapsible', values: collapsibleModes, default: 'offcanvas' },\n ...colorPropDef,\n ...highContrastPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n menuVariant: PropDef<(typeof menuVariants)[number]>;\n type: PropDef<(typeof types)[number]>;\n side: PropDef<(typeof sides)[number]>;\n collapsible: PropDef<(typeof collapsibleModes)[number]>;\n};\n\nexport { sidebarPropDefs }; "],
|
|
5
|
+
"mappings": "AAAA,OAAS,kBAAAA,MAAsB,yBAC/B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,uBAAAC,MAA2B,8BAKpC,OAC6B,2BAA3BC,EACwB,wBAAxBC,EACgC,gCAAhCC,EAC6B,6BAA7BC,MACK,iCAGP,MAAMC,EAAQ,CAAC,IAAK,GAAG,EACjBC,EAAW,CAAC,OAAQ,UAAW,OAAO,EACtCC,EAAe,CAAC,QAAS,MAAM,EAC/BC,EAAQ,CAAC,UAAW,UAAU,EAC9BC,EAAQ,CAAC,OAAQ,OAAO,EACxBC,EAAmB,CAAC,YAAa,OAAQ,MAAM,EAE/CC,EAAkB,CACtB,GAAGb,EACH,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQO,EAAO,QAAS,IAAK,WAAY,EAAK,EAC5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQC,EAAU,QAAS,SAAU,EACvF,YAAa,CAAE,KAAM,OAAQ,UAAW,kBAAmB,OAAQC,EAAc,QAAS,MAAO,EACjG,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,SAAU,EAC9E,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,MAAO,EAC3E,YAAa,CAAE,KAAM,OAAQ,UAAW,iBAAkB,OAAQC,EAAkB,QAAS,WAAY,EACzG,GAAGX,EACH,GAAGC,CACL",
|
|
6
|
+
"names": ["asChildPropDef", "colorPropDef", "highContrastPropDef", "baseMenuContentPropDefs", "baseMenuItemPropDefs", "baseMenuCheckboxItemPropDefs", "baseMenuRadioItemPropDefs", "sizes", "variants", "menuVariants", "types", "sides", "collapsibleModes", "sidebarPropDefs"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -27,18 +27,11 @@
|
|
|
27
27
|
cursor: wait;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/*
|
|
31
|
-
&:where(:active:not([data-disabled], [data-state='open'])) {
|
|
32
|
-
transform: scale(0.98);
|
|
33
|
-
}
|
|
30
|
+
/* Removed scale animation on press - keeping transition for other effects */
|
|
34
31
|
|
|
35
|
-
/* Reduced motion support
|
|
32
|
+
/* Reduced motion support */
|
|
36
33
|
@media (prefers-reduced-motion: reduce) {
|
|
37
34
|
transition: none;
|
|
38
|
-
|
|
39
|
-
&:where(:active:not([data-disabled], [data-state='open'])) {
|
|
40
|
-
transform: none;
|
|
41
|
-
}
|
|
42
35
|
}
|
|
43
36
|
|
|
44
37
|
height: var(--base-button-height);
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
|
|
124
124
|
/* stylelint-disable-next-line selector-max-type */
|
|
125
125
|
& :where(svg) {
|
|
126
|
-
width: var(--space-
|
|
127
|
-
height: var(--space-
|
|
126
|
+
width: calc(var(--space-3) * 1.175);
|
|
127
|
+
height: calc(var(--space-3) * 1.175);
|
|
128
128
|
flex-shrink: 0;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
|
|
32
32
|
/* stylelint-disable-next-line selector-max-type */
|
|
33
33
|
& :where(svg) {
|
|
34
|
-
width: var(--space-
|
|
35
|
-
height: var(--space-
|
|
34
|
+
width: calc(var(--space-3) * 1.175);
|
|
35
|
+
height: calc(var(--space-3) * 1.175);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&:where(:not(.rt-variant-ghost)) {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
dropdownMenuRadioItemPropDefs,
|
|
13
13
|
} from './dropdown-menu.props.js';
|
|
14
14
|
import { Theme, useThemeContext } from './theme.js';
|
|
15
|
-
import { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon } from './icons.js';
|
|
15
|
+
import { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';
|
|
16
16
|
import { extractProps } from '../helpers/extract-props.js';
|
|
17
17
|
import { requireReactElement } from '../helpers/require-react-element.js';
|
|
18
18
|
|
|
@@ -205,7 +205,7 @@ const DropdownMenuRadioItem = React.forwardRef<
|
|
|
205
205
|
>
|
|
206
206
|
{children}
|
|
207
207
|
<DropdownMenuPrimitive.ItemIndicator className="rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator">
|
|
208
|
-
<
|
|
208
|
+
<ThickDotIcon className="rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon" />
|
|
209
209
|
</DropdownMenuPrimitive.ItemIndicator>
|
|
210
210
|
</DropdownMenuPrimitive.RadioItem>
|
|
211
211
|
);
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
&:where(.rt-r-size-1) {
|
|
17
17
|
/* stylelint-disable-next-line selector-max-type */
|
|
18
18
|
& :where(svg) {
|
|
19
|
-
width: var(--space-
|
|
20
|
-
height: var(--space-
|
|
19
|
+
width: calc(var(--space-3) * 1.175);
|
|
20
|
+
height: calc(var(--space-3) * 1.175);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
&:where(.rt-r-size-2) {
|
package/src/components/icons.tsx
CHANGED
|
@@ -88,5 +88,22 @@ const ThickChevronRightIcon = React.forwardRef<IconElement, IconProps>((props, f
|
|
|
88
88
|
});
|
|
89
89
|
ThickChevronRightIcon.displayName = 'ThickChevronRightIcon';
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
const ThickDotIcon = React.forwardRef<IconElement, IconProps>((props, forwardedRef) => {
|
|
92
|
+
return (
|
|
93
|
+
<svg
|
|
94
|
+
width="9"
|
|
95
|
+
height="9"
|
|
96
|
+
viewBox="0 0 9 9"
|
|
97
|
+
fill="currentcolor"
|
|
98
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
99
|
+
{...props}
|
|
100
|
+
ref={forwardedRef}
|
|
101
|
+
>
|
|
102
|
+
<circle cx="4.5" cy="4.5" r="2" />
|
|
103
|
+
</svg>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
ThickDotIcon.displayName = 'ThickDotIcon';
|
|
107
|
+
|
|
108
|
+
export { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon, ThickDividerHorizontalIcon, ThickDotIcon };
|
|
92
109
|
export type { IconProps };
|
package/src/components/image.tsx
CHANGED
|
@@ -28,6 +28,10 @@ type ImageOwnProps = GetPropDefTypes<typeof imagePropDefs> & {
|
|
|
28
28
|
* Shows a skeleton placeholder while loading instead of a blank space.
|
|
29
29
|
*/
|
|
30
30
|
showSkeleton?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the image should fade in when loaded. Set to false for background images or when you want immediate visibility.
|
|
33
|
+
*/
|
|
34
|
+
fadeIn?: boolean;
|
|
31
35
|
/**
|
|
32
36
|
* Callback fired when the image successfully loads.
|
|
33
37
|
*/
|
|
@@ -63,6 +67,7 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
63
67
|
src,
|
|
64
68
|
placeholder,
|
|
65
69
|
showSkeleton = false,
|
|
70
|
+
fadeIn = true,
|
|
66
71
|
onLoad: userOnLoad,
|
|
67
72
|
onError: userOnError,
|
|
68
73
|
children: _children, // Extract children to exclude from imgProps
|
|
@@ -73,6 +78,9 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
73
78
|
const [imageLoaded, setImageLoaded] = React.useState(false);
|
|
74
79
|
const [imageError, setImageError] = React.useState(false);
|
|
75
80
|
const [showPlaceholder, setShowPlaceholder] = React.useState(!!placeholder);
|
|
81
|
+
|
|
82
|
+
// Ref to check if image is already loaded (for cached images)
|
|
83
|
+
const imgRef = React.useRef<HTMLImageElement>(null);
|
|
76
84
|
|
|
77
85
|
// Handle image load - moved to top to avoid conditional hook call
|
|
78
86
|
const handleLoad = React.useCallback((event: React.SyntheticEvent<HTMLImageElement>) => {
|
|
@@ -90,6 +98,16 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
90
98
|
userOnError?.(event);
|
|
91
99
|
}, [userOnError]);
|
|
92
100
|
|
|
101
|
+
// Check if image is already loaded (for cached images)
|
|
102
|
+
React.useEffect(() => {
|
|
103
|
+
const img = imgRef.current;
|
|
104
|
+
if (img && img.complete && img.naturalWidth > 0) {
|
|
105
|
+
setImageLoaded(true);
|
|
106
|
+
setImageError(false);
|
|
107
|
+
setShowPlaceholder(false);
|
|
108
|
+
}
|
|
109
|
+
}, [src]);
|
|
110
|
+
|
|
93
111
|
// Validate required props
|
|
94
112
|
if (!src) {
|
|
95
113
|
console.warn('Image component: src prop is required');
|
|
@@ -146,8 +164,8 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
146
164
|
loading={loading}
|
|
147
165
|
style={{
|
|
148
166
|
...style,
|
|
149
|
-
opacity: imageLoaded ? 1 : 0,
|
|
150
|
-
transition: 'opacity 0.3s ease-out',
|
|
167
|
+
opacity: fadeIn ? (imageLoaded ? 1 : 0) : 1,
|
|
168
|
+
transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
|
|
151
169
|
}}
|
|
152
170
|
className={classNames(
|
|
153
171
|
'rt-reset',
|
|
@@ -160,7 +178,14 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
160
178
|
onLoad={handleLoad}
|
|
161
179
|
onError={handleError}
|
|
162
180
|
{...imgProps}
|
|
163
|
-
ref={
|
|
181
|
+
ref={(node) => {
|
|
182
|
+
imgRef.current = node;
|
|
183
|
+
if (typeof forwardedRef === 'function') {
|
|
184
|
+
forwardedRef(node);
|
|
185
|
+
} else if (forwardedRef) {
|
|
186
|
+
forwardedRef.current = node;
|
|
187
|
+
}
|
|
188
|
+
}}
|
|
164
189
|
/>
|
|
165
190
|
);
|
|
166
191
|
|
|
@@ -224,8 +249,8 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
224
249
|
...style,
|
|
225
250
|
position: 'relative',
|
|
226
251
|
zIndex: 1,
|
|
227
|
-
opacity: imageLoaded ? 1 : 0,
|
|
228
|
-
transition: 'opacity 0.3s ease-out',
|
|
252
|
+
opacity: fadeIn ? (imageLoaded ? 1 : 0) : 1,
|
|
253
|
+
transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
|
|
229
254
|
}}
|
|
230
255
|
className={classNames('rt-reset', 'rt-Image', 'rt-Image--blur', className)}
|
|
231
256
|
alt={alt}
|
|
@@ -233,7 +258,14 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
233
258
|
onLoad={handleLoad}
|
|
234
259
|
onError={handleError}
|
|
235
260
|
{...imgProps}
|
|
236
|
-
ref={
|
|
261
|
+
ref={(node) => {
|
|
262
|
+
imgRef.current = node;
|
|
263
|
+
if (typeof forwardedRef === 'function') {
|
|
264
|
+
forwardedRef(node);
|
|
265
|
+
} else if (forwardedRef) {
|
|
266
|
+
forwardedRef.current = node;
|
|
267
|
+
}
|
|
268
|
+
}}
|
|
237
269
|
/>
|
|
238
270
|
</>
|
|
239
271
|
),
|
|
@@ -290,8 +322,8 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
290
322
|
...style,
|
|
291
323
|
position: 'relative',
|
|
292
324
|
zIndex: 1,
|
|
293
|
-
opacity: imageLoaded ? 1 : 0,
|
|
294
|
-
transition: 'opacity 0.3s ease-out',
|
|
325
|
+
opacity: fadeIn ? (imageLoaded ? 1 : 0) : 1,
|
|
326
|
+
transition: fadeIn ? 'opacity 0.3s ease-out' : 'none',
|
|
295
327
|
}}
|
|
296
328
|
className={classNames('rt-reset', 'rt-Image', 'rt-Image--blur', className)}
|
|
297
329
|
alt={alt}
|
|
@@ -299,7 +331,14 @@ const Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) =
|
|
|
299
331
|
onLoad={handleLoad}
|
|
300
332
|
onError={handleError}
|
|
301
333
|
{...imgProps}
|
|
302
|
-
ref={
|
|
334
|
+
ref={(node) => {
|
|
335
|
+
imgRef.current = node;
|
|
336
|
+
if (typeof forwardedRef === 'function') {
|
|
337
|
+
forwardedRef(node);
|
|
338
|
+
} else if (forwardedRef) {
|
|
339
|
+
forwardedRef.current = node;
|
|
340
|
+
}
|
|
341
|
+
}}
|
|
303
342
|
/>
|
|
304
343
|
</div>
|
|
305
344
|
);
|