@kushagradhawan/kookie-ui 0.1.108 → 0.1.110
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 +187 -133
- package/dist/cjs/components/_internal/shell-bottom.d.ts +2 -0
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts +2 -0
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +2 -0
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/shell.context.d.ts +13 -0
- package/dist/cjs/components/shell.context.d.ts.map +1 -1
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +3 -3
- package/dist/cjs/components/shell.d.ts +14 -6
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/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 +1 -1
- package/dist/cjs/components/sidebar.props.js +1 -1
- package/dist/cjs/components/sidebar.props.js.map +2 -2
- package/dist/esm/components/_internal/shell-bottom.d.ts +2 -0
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
- package/dist/esm/components/_internal/shell-inspector.d.ts +2 -0
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
- package/dist/esm/components/_internal/shell-sidebar.d.ts +2 -0
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/esm/components/shell.context.d.ts +13 -0
- package/dist/esm/components/shell.context.d.ts.map +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.context.js.map +3 -3
- package/dist/esm/components/shell.d.ts +14 -6
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/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 +1 -1
- package/dist/esm/components/sidebar.props.js +1 -1
- package/dist/esm/components/sidebar.props.js.map +2 -2
- package/package.json +1 -1
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/base-button.css +6 -32
- package/src/components/_internal/base-card.css +0 -3
- package/src/components/_internal/base-checkbox.css +0 -2
- package/src/components/_internal/base-radio.css +0 -2
- package/src/components/_internal/shell-bottom.tsx +15 -1
- package/src/components/_internal/shell-inspector.tsx +15 -1
- package/src/components/_internal/shell-sidebar.tsx +15 -1
- package/src/components/avatar.css +0 -1
- package/src/components/segmented-control.css +37 -37
- package/src/components/select.css +0 -2
- package/src/components/shell.context.tsx +14 -0
- package/src/components/shell.css +51 -28
- package/src/components/shell.tsx +150 -81
- package/src/components/sidebar.css +110 -6
- package/src/components/sidebar.props.tsx +1 -1
- package/src/components/sidebar.tsx +45 -2
- package/src/components/text-area.css +0 -1
- package/src/components/text-field.css +0 -1
- package/styles.css +187 -133
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import*as e from"react";import l from"classnames";import{Slot as
|
|
1
|
+
"use client";import*as e from"react";import l from"classnames";import{Slot as G}from"./slot.js";import*as x from"@radix-ui/react-accordion";import*as h from"./dropdown-menu.js";import{sidebarPropDefs as P}from"./sidebar.props.js";import{useThemeContext as re}from"./theme.js";import{ScrollArea as te}from"./scroll-area.js";import{Separator as ne}from"./separator.js";import{ThickChevronRightIcon as oe}from"./icons.js";import{extractProps as ae}from"../helpers/extract-props.js";import{Kbd as V}from"./kbd.js";import{Badge as R}from"./badge.js";const A=e.createContext(null);function N(){return e.useContext(A)}const k=e.forwardRef((n,a)=>{const t=re(),{size:r=P.size.default,variant:d=P.variant.default,menuVariant:c=P.menuVariant.default,layout:u=P.layout.default,presentation:m,panelBackground:f,color:s,highContrast:p=P.highContrast.default}=n,{className:S,children:v,...E}=ae(n,P),{asChild:M,panelBackground:H,presentation:I,...B}=E,T=s||t.accentColor,w=m==="thin"?"rail":m==="expanded"?"panel":u||"panel",g=typeof r=="object"?r.initial||"2":r;return e.createElement("div",{...B,ref:a,"data-accent-color":T,className:l("rt-SidebarRoot",S)},e.createElement(A.Provider,{value:{size:g,menuVariant:c,presentation:m,color:T}},e.createElement("div",{className:l("rt-SidebarContainer",`rt-variant-${d}`,`rt-r-size-${g}`,`rt-menu-variant-${c}`,w&&`rt-layout-${w}`),"data-accent-color":T,"data-high-contrast":p||void 0,"data-panel-background":f,"data-presentation":m,"data-layout":w},v)))});k.displayName="Sidebar.Root";const W=e.forwardRef(({className:n,children:a,role:t="navigation","aria-label":r="Main navigation",id:d,...c},u)=>{const m=N(),f=m?.size??"2",s=m?.menuVariant??"soft";return e.createElement(te,{type:"hover"},e.createElement("div",{...c,ref:u,id:d,role:t,"aria-label":r,className:l("rt-BaseMenuContent","rt-SidebarContent",`rt-r-size-${f}`,`rt-menu-variant-${s}`,n)},e.createElement("div",{className:"rt-BaseMenuViewport"},a)))});W.displayName="Sidebar.Content";const F=e.forwardRef(({className:n,asContainer:a=!0,...t},r)=>{const d=N(),c=d?.size??"2",u=d?.menuVariant??"soft";return e.createElement("div",{...t,ref:r,className:l("rt-SidebarHeader",`rt-r-size-${c}`,`rt-menu-variant-${u}`,{"rt-SidebarHeader--container":a},n)})});F.displayName="Sidebar.Header";const $=e.forwardRef(({className:n,asContainer:a=!0,...t},r)=>{const d=N(),c=d?.size??"2",u=d?.menuVariant??"soft";return e.createElement("div",{...t,ref:r,className:l("rt-SidebarFooter",`rt-r-size-${c}`,`rt-menu-variant-${u}`,{"rt-SidebarFooter--container":a},n)})});$.displayName="Sidebar.Footer";const _=e.forwardRef(({className:n,...a},t)=>e.createElement(ne,{...a,ref:t,className:l("rt-SidebarSeparator",n)}));_.displayName="Sidebar.Separator";const K=e.forwardRef(({className:n,...a},t)=>e.createElement("ul",{...a,ref:t,role:"menu",className:l("rt-SidebarMenu",n)}));K.displayName="Sidebar.Menu";const j=e.forwardRef(({className:n,...a},t)=>e.createElement("li",{...a,ref:t,className:l("rt-SidebarMenuItem",n)}));j.displayName="Sidebar.MenuItem";const O=e.forwardRef(({asChild:n=!1,isActive:a=!1,shortcut:t,badge:r,className:d,children:c,onMouseEnter:u,onMouseLeave:m,onKeyDown:f,...s},p)=>{const[S,v]=e.useState(!1),E=N(),M=E?.size??"2",H=E?.presentation==="thin",I=n?G:"button",{onClick:B}=s,T=e.useCallback(o=>{switch(o.key){case"Enter":case" ":o.preventDefault(),B&&B(o);break;case"ArrowDown":{o.preventDefault();const i=o.currentTarget.nextElementSibling?.querySelector('[role="menuitem"]');i&&i.focus();break}case"ArrowUp":{o.preventDefault();const i=o.currentTarget.previousElementSibling?.querySelector('[role="menuitem"]');i&&i.focus();break}}f?.(o)},[B,f]),w=o=>{const i=[],b=[];return e.Children.forEach(o,y=>{if(typeof y=="string"||typeof y=="number")b.push(e.createElement("span",{key:b.length,className:"rt-SidebarMenuLabel"},y));else if(e.isValidElement(y)){const C=y;C.type==="svg"||C.props&&C.props.icon||typeof C.type=="function"&&(C.type.displayName?.includes("Icon")||C.type.name?.includes("Icon"))?i.push(y):b.push(y)}else y&&b.push(y)}),{icons:i,labels:b}},g=o=>{if(typeof o=="string"||typeof o=="number")return e.createElement("span",{className:"rt-SidebarMenuLabel"},o);if(Array.isArray(o))return o.map((i,b)=>e.createElement(e.Fragment,{key:b},g(i)));if(e.isValidElement(o)){const i=o,b=i.props&&i.props.className||"";if(typeof i.type=="string"&&b.split(" ").includes("rt-SidebarMenuLabel"))return i;const C=g(i.props?.children);return e.cloneElement(i,{...i.props},C)}return o},L=g(c),{icons:D,labels:Z}=H?w(c):{icons:[],labels:[]},ee=e.useMemo(()=>{if(!n)return null;try{const o=e.Children.only(L),i=o.props?.children,b=e.createElement(e.Fragment,null,i,r&&e.createElement("div",{className:"rt-SidebarMenuBadge"},typeof r=="string"?e.createElement(R,{size:M,variant:"soft"},r):e.createElement(R,{size:r.size||M,variant:r.variant||"soft",color:r.color,highContrast:r.highContrast,radius:r.radius},r.content)),t&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-SidebarMenuShortcut"},e.createElement(V,{size:M},t)));return e.cloneElement(o,{...o.props},b)}catch{return L}},[n,L,r,t,M]);return e.createElement(I,{...s,ref:p,role:"menuitem","aria-current":a?"page":void 0,className:l("rt-reset","rt-BaseMenuItem","rt-SidebarMenuButton",d),"data-active":a||void 0,"data-highlighted":S||void 0,onKeyDown:T,onMouseEnter:o=>{v(!0),u?.(o)},onMouseLeave:o=>{v(!1),m?.(o)}},n?ee:H&&D.length>0?e.createElement(e.Fragment,null,e.createElement("span",{className:"rt-SidebarMenuIconWrapper"},D),Z.map((o,i)=>e.createElement(e.Fragment,{key:i},typeof o=="string"||typeof o=="number"?e.createElement("span",{className:"rt-SidebarMenuLabel"},o):o))):e.createElement(e.Fragment,null,L,r&&e.createElement("div",{className:"rt-SidebarMenuBadge"},typeof r=="string"?e.createElement(R,{size:M,variant:"soft"},r):e.createElement(R,{size:r.size||M,variant:r.variant||"soft",color:r.color,highContrast:r.highContrast,radius:r.radius},r.content)),t&&e.createElement("div",{className:"rt-BaseMenuShortcut rt-SidebarMenuShortcut"},e.createElement(V,{size:M},t))))});O.displayName="Sidebar.MenuButton";const z=e.createContext("accordion"),q=e.forwardRef(({defaultOpen:n=!1,children:a,...t},r)=>(N()?.presentation==="thin"?"dropdown":"accordion")==="dropdown"?e.createElement("div",{...t,ref:r},e.createElement(h.Root,null,e.createElement(z.Provider,{value:"dropdown"},a))):e.createElement("div",{...t,ref:r},e.createElement(z.Provider,{value:"accordion"},e.createElement(x.Root,{type:"single",collapsible:!0,defaultValue:n?"item":void 0},e.createElement(x.Item,{value:"item"},a)))));q.displayName="Sidebar.MenuSub";const U=e.forwardRef(({asChild:n=!1,className:a,children:t,onMouseEnter:r,onMouseLeave:d,...c},u)=>{const[m,f]=e.useState(!1);return e.useContext(z)==="dropdown"?e.createElement(h.Trigger,null,e.createElement("button",{...c,ref:u,type:"button",role:"menuitem","aria-haspopup":"menu",className:l("rt-reset","rt-BaseMenuItem","rt-SidebarMenuButton","rt-SidebarMenuSubTrigger",a),"data-highlighted":m||void 0,onMouseEnter:p=>{f(!0),r?.(p)},onMouseLeave:p=>{f(!1),d?.(p)}},t)):e.createElement(x.Header,{asChild:!0},e.createElement("div",null,e.createElement(x.Trigger,{...c,ref:u,asChild:n,role:"menuitem","aria-haspopup":"true",className:l("rt-reset","rt-BaseMenuItem","rt-SidebarMenuButton","rt-SidebarMenuSubTrigger",a),"data-highlighted":m||void 0,onMouseEnter:p=>{f(!0),r?.(p)},onMouseLeave:p=>{f(!1),d?.(p)}},n?t:e.createElement(e.Fragment,null,t,e.createElement(oe,{className:l("rt-BaseMenuSubTriggerIcon","rt-SidebarMenuSubTriggerIcon")})))))});U.displayName="Sidebar.MenuSubTrigger";const J=e.forwardRef(({className:n,children:a,...t},r)=>{const d=N();if(e.useContext(z)==="dropdown"){const u=s=>{if(Array.isArray(s))return s.map((p,S)=>e.createElement(e.Fragment,{key:S},u(p)));if(e.isValidElement(s)){if(s.type?.displayName==="Sidebar.MenuButton")return s.props?.children;const S=s.props?.children;if(S!==void 0)return e.cloneElement(s,{...s.props,children:u(S)})}return s},m=e.Children.map(a,(s,p)=>{if(e.isValidElement(s)&&s.type?.displayName==="Sidebar.MenuItem"){const S=s.props?.children,v=u(S);return e.createElement(h.Item,{key:p,asChild:!0},v)}return e.createElement(h.Item,{key:p,asChild:!0},u(s))}),f=d?.size==="3"?"2":d?.size;return e.createElement(h.Content,{size:f,variant:d?.menuVariant,className:l(n)},e.createElement(h.Group,null,m))}return e.createElement(x.Content,{...t,ref:r,className:l("rt-SidebarMenuSubContent",n)},e.createElement("div",{className:"rt-SidebarMenuSubList"},a))});J.displayName="Sidebar.MenuSubContent";const Q=e.forwardRef(({className:n,...a},t)=>e.createElement("div",{...a,ref:t,className:l("rt-BaseMenuGroup","rt-SidebarGroup",n)}));Q.displayName="Sidebar.Group";const X=e.forwardRef(({asChild:n=!1,className:a,...t},r)=>e.createElement(n?G:"div",{...t,ref:r,role:"group",className:l("rt-BaseMenuLabel","rt-SidebarGroupLabel",a)}));X.displayName="Sidebar.GroupLabel";const Y=e.forwardRef(({className:n,...a},t)=>e.createElement("div",{...a,ref:t,className:l("rt-SidebarGroupContent",n)}));Y.displayName="Sidebar.GroupContent";export{W as Content,$ as Footer,Q as Group,Y as GroupContent,X as GroupLabel,F as Header,K as Menu,O as MenuButton,j as MenuItem,q as MenuSub,J as MenuSubContent,U as MenuSubTrigger,k as Root,_ as Separator};
|
|
2
2
|
//# sourceMappingURL=sidebar.js.map
|
|
@@ -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 * as Accordion from '@radix-ui/react-accordion';\nimport * as DropdownMenu from './dropdown-menu.js';\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 presentation?: 'thin' | 'expanded';\n color?: string;\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 /**\n * Presentational mode independent of Shell.\n * 'thin' renders a rail-style sidebar, 'expanded' renders a panel-style sidebar.\n * If both `presentation` and `layout` are provided, `presentation` takes precedence.\n */\n presentation?: 'thin' | 'expanded';\n}\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 presentation,\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 // Remove internal-only props from DOM\n const { asChild: _, panelBackground: __, presentation: ___, ...safeRootProps } = rootProps;\n const resolvedColor = color || themeContext.accentColor;\n\n // Resolve layout (default to 'panel'). `presentation` takes precedence over `layout`.\n const resolvedLayout = presentation === 'thin' ? 'rail' : presentation === 'expanded' ? 'panel' : 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 {...safeRootProps} ref={forwardedRef} data-accent-color={resolvedColor} className={classNames('rt-SidebarRoot', className)}>\n <SidebarVisualContext.Provider value={{ size: resolvedSize, menuVariant, presentation, color: resolvedColor }}>\n <div\n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`, `rt-r-size-${resolvedSize}`, `rt-menu-variant-${menuVariant}`, resolvedLayout && `rt-layout-${resolvedLayout}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-panel-background={panelBackground}\n data-presentation={presentation}\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 ({ className, children, role = 'navigation', 'aria-label': ariaLabel = 'Main navigation', id, ...props }, forwardedRef) => {\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('rt-BaseMenuContent', 'rt-SidebarContent', `rt-r-size-${size}`, `rt-menu-variant-${menuVariant}`, className)}\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>(({ 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});\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>(({ 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});\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<React.ComponentRef<typeof Separator>, SidebarSeparatorProps>(({ className, ...props }, forwardedRef) => (\n <Separator {...props} ref={forwardedRef} className={classNames('rt-SidebarSeparator', className)} />\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>(({ className, ...props }, forwardedRef) => (\n <ul {...props} ref={forwardedRef} role=\"menu\" className={classNames('rt-SidebarMenu', className)} />\n));\nSidebarMenu.displayName = 'Sidebar.Menu';\n\ninterface SidebarMenuItemProps extends React.ComponentPropsWithoutRef<'li'> {}\n\nconst SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(({ className, ...props }, forwardedRef) => (\n <li {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuItem', className)} />\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 ({ asChild = false, isActive = false, shortcut, badge, className, children, onMouseEnter, onMouseLeave, onKeyDown, ...props }, forwardedRef) => {\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('[role=\"menuitem\"]') as HTMLElement;\n if (nextItem) nextItem.focus();\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n // Focus previous menu item\n const prevItem = (event.currentTarget as HTMLElement).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 // Wrap bare text nodes so CSS can target labels (e.g., for truncation in thin mode)\n const wrapTextNodes = (node: React.ReactNode): React.ReactNode => {\n if (typeof node === 'string' || typeof node === 'number') {\n return <span className=\"rt-SidebarMenuLabel\">{node}</span>;\n }\n if (Array.isArray(node)) {\n return node.map((child, index) => <React.Fragment key={index}>{wrapTextNodes(child)}</React.Fragment>);\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<any>;\n const className: string = (el.props && (el.props as any).className) || '';\n const isAlreadyLabel = typeof el.type === 'string' && className.split(' ').includes('rt-SidebarMenuLabel');\n if (isAlreadyLabel) return el;\n const newChildren = wrapTextNodes((el.props as any)?.children);\n return React.cloneElement(el, { ...(el.props as any) }, newChildren);\n }\n return node;\n };\n\n const processedChildren = wrapTextNodes(children);\n\n // When rendering asChild, Slot expects a single child element. We still want to\n // append optional badge/shortcut inside that element so they render with Link.\n const slottedChildren = React.useMemo(() => {\n if (!asChild) return null;\n try {\n const onlyChild = React.Children.only(processedChildren as React.ReactElement<any>) as React.ReactElement<any>;\n const originalInnerChildren = (onlyChild.props as any)?.children;\n const enhancedInnerChildren = (\n <>\n {originalInnerChildren}\n {badge && (\n <div className=\"rt-SidebarMenuBadge\">\n {typeof badge === 'string' ? (\n <Badge size={sidebarSize} variant=\"soft\">\n {badge}\n </Badge>\n ) : (\n <Badge size={badge.size || sidebarSize} variant={badge.variant || 'soft'} color={badge.color} highContrast={badge.highContrast} radius={badge.radius}>\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 return React.cloneElement(onlyChild, { ...(onlyChild.props as any) }, enhancedInnerChildren);\n } catch {\n // Fallback: if multiple children were passed incorrectly, just return processedChildren\n return processedChildren as React.ReactNode;\n }\n }, [asChild, processedChildren, badge, shortcut, sidebarSize]);\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 slottedChildren\n ) : (\n <>\n {processedChildren}\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 size={badge.size || sidebarSize} variant={badge.variant || 'soft'} color={badge.color} highContrast={badge.highContrast} radius={badge.radius}>\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: Accordion in expanded, Dropdown in thin\nconst SidebarSubMenuModeContext = React.createContext<'accordion' | 'dropdown'>('accordion');\ninterface SidebarMenuSubProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n}\n\nconst SidebarMenuSub = React.forwardRef<HTMLDivElement, SidebarMenuSubProps>(({ defaultOpen = false, children, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const mode: 'accordion' | 'dropdown' = visual?.presentation === 'thin' ? 'dropdown' : 'accordion';\n\n if (mode === 'dropdown') {\n return (\n <div {...props} ref={forwardedRef}>\n <DropdownMenu.Root>\n <SidebarSubMenuModeContext.Provider value=\"dropdown\">{children}</SidebarSubMenuModeContext.Provider>\n </DropdownMenu.Root>\n </div>\n );\n }\n\n return (\n <div {...props} ref={forwardedRef}>\n <SidebarSubMenuModeContext.Provider value=\"accordion\">\n <Accordion.Root type=\"single\" collapsible defaultValue={defaultOpen ? 'item' : undefined}>\n <Accordion.Item value=\"item\">{children}</Accordion.Item>\n </Accordion.Root>\n </SidebarSubMenuModeContext.Provider>\n </div>\n );\n});\nSidebarMenuSub.displayName = 'Sidebar.MenuSub';\n\ninterface SidebarMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof Accordion.Trigger> {\n asChild?: boolean;\n}\n\nconst SidebarMenuSubTrigger = React.forwardRef<React.ElementRef<typeof Accordion.Trigger>, SidebarMenuSubTriggerProps>(\n ({ asChild = false, className, children, onMouseEnter, onMouseLeave, ...props }, forwardedRef) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const mode = React.useContext(SidebarSubMenuModeContext);\n\n if (mode === 'dropdown') {\n return (\n <DropdownMenu.Trigger>\n <button\n {...(props as any)}\n ref={forwardedRef as any}\n type=\"button\"\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', 'rt-SidebarMenuSubTrigger', className)}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event as any);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event as any);\n }}\n >\n {children}\n </button>\n </DropdownMenu.Trigger>\n );\n }\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('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', 'rt-SidebarMenuSubTrigger', className)}\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 className={classNames('rt-BaseMenuSubTriggerIcon', 'rt-SidebarMenuSubTriggerIcon')} />\n </>\n )}\n </Accordion.Trigger>\n </div>\n </Accordion.Header>\n );\n },\n);\nSidebarMenuSubTrigger.displayName = 'Sidebar.MenuSubTrigger';\n\ninterface SidebarMenuSubContentProps extends React.ComponentPropsWithoutRef<typeof Accordion.Content> {}\n\nconst SidebarMenuSubContent = React.forwardRef<React.ElementRef<typeof Accordion.Content>, SidebarMenuSubContentProps>(({ className, children, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const mode = React.useContext(SidebarSubMenuModeContext);\n\n if (mode === 'dropdown') {\n const unwrapMenuButton = (node: React.ReactNode): React.ReactNode => {\n if (Array.isArray(node)) {\n return node.map((n, i) => <React.Fragment key={i}>{unwrapMenuButton(n)}</React.Fragment>);\n }\n if (React.isValidElement(node)) {\n const typeDisplay = (node.type as any)?.displayName;\n if (typeDisplay === 'Sidebar.MenuButton') {\n return (node.props as any)?.children;\n }\n const child = (node.props as any)?.children;\n if (child !== undefined) {\n return React.cloneElement(node as any, { ...(node.props as any), children: unwrapMenuButton(child) });\n }\n }\n return node;\n };\n\n const normalized = React.Children.map(children as React.ReactNode, (child, index) => {\n if (React.isValidElement(child) && (child.type as any)?.displayName === 'Sidebar.MenuItem') {\n const itemChildren = (child.props as any)?.children;\n const content = unwrapMenuButton(itemChildren);\n return (\n <DropdownMenu.Item key={index} asChild>\n {content as any}\n </DropdownMenu.Item>\n );\n }\n // Fallback: wrap raw nodes too for consistent menu styling\n return (\n <DropdownMenu.Item key={index} asChild>\n {unwrapMenuButton(child) as any}\n </DropdownMenu.Item>\n );\n });\n\n return (\n <DropdownMenu.Content size={visual?.size} variant={visual?.menuVariant} className={classNames(className)}>\n <DropdownMenu.Group>{normalized}</DropdownMenu.Group>\n </DropdownMenu.Content>\n );\n }\n\n return (\n <Accordion.Content {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuSubContent', className)}>\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>(({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('rt-BaseMenuGroup', 'rt-SidebarGroup', className)} />\n));\nSidebarGroup.displayName = 'Sidebar.Group';\n\ninterface SidebarGroupLabelProps extends React.ComponentPropsWithoutRef<'div'> {\n asChild?: boolean;\n}\n\nconst SidebarGroupLabel = React.forwardRef<HTMLDivElement, SidebarGroupLabelProps>(({ asChild = false, className, ...props }, forwardedRef) => {\n const Comp = asChild ? Slot : 'div';\n\n return <Comp {...props} ref={forwardedRef} role=\"group\" className={classNames('rt-BaseMenuLabel', 'rt-SidebarGroupLabel', className)} />;\n});\nSidebarGroupLabel.displayName = 'Sidebar.GroupLabel';\n\ninterface SidebarGroupContentProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, SidebarGroupContentProps>(({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('rt-SidebarGroupContent', className)} />\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 { SidebarProps as RootProps, SidebarContentProps as ContentProps, SidebarHeaderProps as HeaderProps, SidebarFooterProps as FooterProps, BadgeConfig };\n"],
|
|
5
|
-
"mappings": "aAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,YACrB,UAAYC,MAAe,4BAC3B,UAAYC,MAAkB,qBAE9B,OAAS,mBAAAC,MAAuB,qBAChC,OAAS,mBAAAC,
|
|
6
|
-
"names": ["React", "classNames", "Slot", "Accordion", "DropdownMenu", "sidebarPropDefs", "useThemeContext", "ScrollArea", "Separator", "ThickChevronRightIcon", "extractProps", "Kbd", "Badge", "SidebarVisualContext", "useSidebarVisual", "Sidebar", "props", "forwardedRef", "themeContext", "size", "variant", "menuVariant", "layout", "presentation", "panelBackground", "color", "highContrast", "className", "children", "rootProps", "_", "__", "___", "safeRootProps", "resolvedColor", "resolvedLayout", "resolvedSize", "SidebarContent", "role", "ariaLabel", "id", "visual", "SidebarHeader", "asContainer", "SidebarFooter", "SidebarSeparator", "SidebarMenu", "SidebarMenuItem", "SidebarMenuButton", "asChild", "isActive", "shortcut", "badge", "onMouseEnter", "onMouseLeave", "onKeyDown", "isHighlighted", "setIsHighlighted", "sidebarSize", "Comp", "onClick", "handleKeyDown", "event", "nextItem", "prevItem", "
|
|
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';\nimport * as DropdownMenu from './dropdown-menu.js';\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' | '3';\n menuVariant: 'solid' | 'soft';\n presentation?: 'thin' | 'expanded';\n color?: string;\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 /**\n * Presentational mode independent of Shell.\n * 'thin' renders a rail-style sidebar, 'expanded' renders a panel-style sidebar.\n * If both `presentation` and `layout` are provided, `presentation` takes precedence.\n */\n presentation?: 'thin' | 'expanded';\n}\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 presentation,\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 // Remove internal-only props from DOM\n const { asChild: _, panelBackground: __, presentation: ___, ...safeRootProps } = rootProps;\n const resolvedColor = color || themeContext.accentColor;\n\n // Resolve layout (default to 'panel'). `presentation` takes precedence over `layout`.\n const resolvedLayout = presentation === 'thin' ? 'rail' : presentation === 'expanded' ? 'panel' : 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 {...safeRootProps} ref={forwardedRef} data-accent-color={resolvedColor} className={classNames('rt-SidebarRoot', className)}>\n <SidebarVisualContext.Provider value={{ size: resolvedSize, menuVariant, presentation, color: resolvedColor }}>\n <div\n className={classNames('rt-SidebarContainer', `rt-variant-${variant}`, `rt-r-size-${resolvedSize}`, `rt-menu-variant-${menuVariant}`, resolvedLayout && `rt-layout-${resolvedLayout}`)}\n data-accent-color={resolvedColor}\n data-high-contrast={highContrast || undefined}\n data-panel-background={panelBackground}\n data-presentation={presentation}\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 ({ className, children, role = 'navigation', 'aria-label': ariaLabel = 'Main navigation', id, ...props }, forwardedRef) => {\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('rt-BaseMenuContent', 'rt-SidebarContent', `rt-r-size-${size}`, `rt-menu-variant-${menuVariant}`, className)}\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>(({ 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});\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>(({ 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});\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<React.ComponentRef<typeof Separator>, SidebarSeparatorProps>(({ className, ...props }, forwardedRef) => (\n <Separator {...props} ref={forwardedRef} className={classNames('rt-SidebarSeparator', className)} />\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>(({ className, ...props }, forwardedRef) => (\n <ul {...props} ref={forwardedRef} role=\"menu\" className={classNames('rt-SidebarMenu', className)} />\n));\nSidebarMenu.displayName = 'Sidebar.Menu';\n\ninterface SidebarMenuItemProps extends React.ComponentPropsWithoutRef<'li'> {}\n\nconst SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(({ className, ...props }, forwardedRef) => (\n <li {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuItem', className)} />\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 ({ asChild = false, isActive = false, shortcut, badge, className, children, onMouseEnter, onMouseLeave, onKeyDown, ...props }, forwardedRef) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const visual = useSidebarVisual();\n const sidebarSize = visual?.size ?? '2';\n const isThinMode = visual?.presentation === 'thin';\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('[role=\"menuitem\"]') as HTMLElement;\n if (nextItem) nextItem.focus();\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n // Focus previous menu item\n const prevItem = (event.currentTarget as HTMLElement).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 // Separate icons and labels for thin mode styling\n const separateIconsAndLabels = (node: React.ReactNode): { icons: React.ReactNode[]; labels: React.ReactNode[] } => {\n const icons: React.ReactNode[] = [];\n const labels: React.ReactNode[] = [];\n\n React.Children.forEach(node, (child) => {\n if (typeof child === 'string' || typeof child === 'number') {\n labels.push(<span key={labels.length} className=\"rt-SidebarMenuLabel\">{child}</span>);\n } else if (React.isValidElement(child)) {\n const el = child as React.ReactElement<any>;\n // Check if it's an SVG or icon component\n if (el.type === 'svg' || (el.props && el.props.icon) || (typeof el.type === 'function' && ((el.type as any).displayName?.includes('Icon') || (el.type as any).name?.includes('Icon')))) {\n icons.push(child);\n } else {\n labels.push(child);\n }\n } else if (child) {\n labels.push(child);\n }\n });\n\n return { icons, labels };\n };\n\n // Wrap bare text nodes so CSS can target labels (e.g., for truncation in thin mode)\n const wrapTextNodes = (node: React.ReactNode): React.ReactNode => {\n if (typeof node === 'string' || typeof node === 'number') {\n return <span className=\"rt-SidebarMenuLabel\">{node}</span>;\n }\n if (Array.isArray(node)) {\n return node.map((child, index) => <React.Fragment key={index}>{wrapTextNodes(child)}</React.Fragment>);\n }\n if (React.isValidElement(node)) {\n const el = node as React.ReactElement<any>;\n const className: string = (el.props && (el.props as any).className) || '';\n const isAlreadyLabel = typeof el.type === 'string' && className.split(' ').includes('rt-SidebarMenuLabel');\n if (isAlreadyLabel) return el;\n const newChildren = wrapTextNodes((el.props as any)?.children);\n return React.cloneElement(el, { ...(el.props as any) }, newChildren);\n }\n return node;\n };\n\n const processedChildren = wrapTextNodes(children);\n\n // For thin mode, separate icons into a wrapper for targeted background styling\n const { icons, labels } = isThinMode ? separateIconsAndLabels(children) : { icons: [], labels: [] };\n\n // When rendering asChild, Slot expects a single child element. We still want to\n // append optional badge/shortcut inside that element so they render with Link.\n const slottedChildren = React.useMemo(() => {\n if (!asChild) return null;\n try {\n const onlyChild = React.Children.only(processedChildren as React.ReactElement<any>) as React.ReactElement<any>;\n const originalInnerChildren = (onlyChild.props as any)?.children;\n const enhancedInnerChildren = (\n <>\n {originalInnerChildren}\n {badge && (\n <div className=\"rt-SidebarMenuBadge\">\n {typeof badge === 'string' ? (\n <Badge size={sidebarSize} variant=\"soft\">\n {badge}\n </Badge>\n ) : (\n <Badge size={badge.size || sidebarSize} variant={badge.variant || 'soft'} color={badge.color} highContrast={badge.highContrast} radius={badge.radius}>\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 return React.cloneElement(onlyChild, { ...(onlyChild.props as any) }, enhancedInnerChildren);\n } catch {\n // Fallback: if multiple children were passed incorrectly, just return processedChildren\n return processedChildren as React.ReactNode;\n }\n }, [asChild, processedChildren, badge, shortcut, sidebarSize]);\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 slottedChildren\n ) : isThinMode && icons.length > 0 ? (\n <>\n <span className=\"rt-SidebarMenuIconWrapper\">{icons}</span>\n {labels.map((label, index) => (\n <React.Fragment key={index}>\n {typeof label === 'string' || typeof label === 'number' ? (\n <span className=\"rt-SidebarMenuLabel\">{label}</span>\n ) : (\n label\n )}\n </React.Fragment>\n ))}\n </>\n ) : (\n <>\n {processedChildren}\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 size={badge.size || sidebarSize} variant={badge.variant || 'soft'} color={badge.color} highContrast={badge.highContrast} radius={badge.radius}>\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: Accordion in expanded, Dropdown in thin\nconst SidebarSubMenuModeContext = React.createContext<'accordion' | 'dropdown'>('accordion');\ninterface SidebarMenuSubProps extends React.ComponentPropsWithoutRef<'div'> {\n defaultOpen?: boolean;\n}\n\nconst SidebarMenuSub = React.forwardRef<HTMLDivElement, SidebarMenuSubProps>(({ defaultOpen = false, children, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const mode: 'accordion' | 'dropdown' = visual?.presentation === 'thin' ? 'dropdown' : 'accordion';\n\n if (mode === 'dropdown') {\n return (\n <div {...props} ref={forwardedRef}>\n <DropdownMenu.Root>\n <SidebarSubMenuModeContext.Provider value=\"dropdown\">{children}</SidebarSubMenuModeContext.Provider>\n </DropdownMenu.Root>\n </div>\n );\n }\n\n return (\n <div {...props} ref={forwardedRef}>\n <SidebarSubMenuModeContext.Provider value=\"accordion\">\n <Accordion.Root type=\"single\" collapsible defaultValue={defaultOpen ? 'item' : undefined}>\n <Accordion.Item value=\"item\">{children}</Accordion.Item>\n </Accordion.Root>\n </SidebarSubMenuModeContext.Provider>\n </div>\n );\n});\nSidebarMenuSub.displayName = 'Sidebar.MenuSub';\n\ninterface SidebarMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof Accordion.Trigger> {\n asChild?: boolean;\n}\n\nconst SidebarMenuSubTrigger = React.forwardRef<React.ElementRef<typeof Accordion.Trigger>, SidebarMenuSubTriggerProps>(\n ({ asChild = false, className, children, onMouseEnter, onMouseLeave, ...props }, forwardedRef) => {\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n const mode = React.useContext(SidebarSubMenuModeContext);\n\n if (mode === 'dropdown') {\n return (\n <DropdownMenu.Trigger>\n <button\n {...(props as any)}\n ref={forwardedRef as any}\n type=\"button\"\n role=\"menuitem\"\n aria-haspopup=\"menu\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', 'rt-SidebarMenuSubTrigger', className)}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={(event) => {\n setIsHighlighted(true);\n onMouseEnter?.(event as any);\n }}\n onMouseLeave={(event) => {\n setIsHighlighted(false);\n onMouseLeave?.(event as any);\n }}\n >\n {children}\n </button>\n </DropdownMenu.Trigger>\n );\n }\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('rt-reset', 'rt-BaseMenuItem', 'rt-SidebarMenuButton', 'rt-SidebarMenuSubTrigger', className)}\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 className={classNames('rt-BaseMenuSubTriggerIcon', 'rt-SidebarMenuSubTriggerIcon')} />\n </>\n )}\n </Accordion.Trigger>\n </div>\n </Accordion.Header>\n );\n },\n);\nSidebarMenuSubTrigger.displayName = 'Sidebar.MenuSubTrigger';\n\ninterface SidebarMenuSubContentProps extends React.ComponentPropsWithoutRef<typeof Accordion.Content> {}\n\nconst SidebarMenuSubContent = React.forwardRef<React.ElementRef<typeof Accordion.Content>, SidebarMenuSubContentProps>(({ className, children, ...props }, forwardedRef) => {\n const visual = useSidebarVisual();\n const mode = React.useContext(SidebarSubMenuModeContext);\n\n if (mode === 'dropdown') {\n const unwrapMenuButton = (node: React.ReactNode): React.ReactNode => {\n if (Array.isArray(node)) {\n return node.map((n, i) => <React.Fragment key={i}>{unwrapMenuButton(n)}</React.Fragment>);\n }\n if (React.isValidElement(node)) {\n const typeDisplay = (node.type as any)?.displayName;\n if (typeDisplay === 'Sidebar.MenuButton') {\n return (node.props as any)?.children;\n }\n const child = (node.props as any)?.children;\n if (child !== undefined) {\n return React.cloneElement(node as any, { ...(node.props as any), children: unwrapMenuButton(child) });\n }\n }\n return node;\n };\n\n const normalized = React.Children.map(children as React.ReactNode, (child, index) => {\n if (React.isValidElement(child) && (child.type as any)?.displayName === 'Sidebar.MenuItem') {\n const itemChildren = (child.props as any)?.children;\n const content = unwrapMenuButton(itemChildren);\n return (\n <DropdownMenu.Item key={index} asChild>\n {content as any}\n </DropdownMenu.Item>\n );\n }\n // Fallback: wrap raw nodes too for consistent menu styling\n return (\n <DropdownMenu.Item key={index} asChild>\n {unwrapMenuButton(child) as any}\n </DropdownMenu.Item>\n );\n });\n\n // DropdownMenu only supports sizes 1 and 2, so map size 3 to 2\n const dropdownSize = visual?.size === '3' ? '2' : visual?.size;\n return (\n <DropdownMenu.Content size={dropdownSize} variant={visual?.menuVariant} className={classNames(className)}>\n <DropdownMenu.Group>{normalized}</DropdownMenu.Group>\n </DropdownMenu.Content>\n );\n }\n\n return (\n <Accordion.Content {...props} ref={forwardedRef} className={classNames('rt-SidebarMenuSubContent', className)}>\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>(({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('rt-BaseMenuGroup', 'rt-SidebarGroup', className)} />\n));\nSidebarGroup.displayName = 'Sidebar.Group';\n\ninterface SidebarGroupLabelProps extends React.ComponentPropsWithoutRef<'div'> {\n asChild?: boolean;\n}\n\nconst SidebarGroupLabel = React.forwardRef<HTMLDivElement, SidebarGroupLabelProps>(({ asChild = false, className, ...props }, forwardedRef) => {\n const Comp = asChild ? Slot : 'div';\n\n return <Comp {...props} ref={forwardedRef} role=\"group\" className={classNames('rt-BaseMenuLabel', 'rt-SidebarGroupLabel', className)} />;\n});\nSidebarGroupLabel.displayName = 'Sidebar.GroupLabel';\n\ninterface SidebarGroupContentProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst SidebarGroupContent = React.forwardRef<HTMLDivElement, SidebarGroupContentProps>(({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('rt-SidebarGroupContent', className)} />\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 { SidebarProps as RootProps, SidebarContentProps as ContentProps, SidebarHeaderProps as HeaderProps, SidebarFooterProps as FooterProps, BadgeConfig };\n"],
|
|
5
|
+
"mappings": "aAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,YACrB,UAAYC,MAAe,4BAC3B,UAAYC,MAAkB,qBAE9B,OAAS,mBAAAC,MAAuB,qBAChC,OAAS,mBAAAC,OAAuB,aAEhC,OAAS,cAAAC,OAAkB,mBAC3B,OAAS,aAAAC,OAAiB,iBAC1B,OAAS,yBAAAC,OAA6B,aACtC,OAAS,gBAAAC,OAAoB,8BAC7B,OAAS,OAAAC,MAAW,WACpB,OAAS,SAAAC,MAAa,aAuBtB,MAAMC,EAAuBb,EAAM,cAAgD,IAAI,EACvF,SAASc,GAAmB,CAC1B,OAAOd,EAAM,WAAWa,CAAoB,CAC9C,CAeA,MAAME,EAAUf,EAAM,WAAyC,CAACgB,EAAOC,IAAiB,CACtF,MAAMC,EAAeZ,GAAgB,EAE/B,CACJ,KAAAa,EAAOd,EAAgB,KAAK,QAC5B,QAAAe,EAAUf,EAAgB,QAAQ,QAClC,YAAAgB,EAAchB,EAAgB,YAAY,QAC1C,OAAAiB,EAASjB,EAAgB,OAAO,QAChC,aAAAkB,EAIA,gBAAAC,EACA,MAAAC,EACA,aAAAC,EAAerB,EAAgB,aAAa,OAC9C,EAAIW,EAEE,CAAE,UAAAW,EAAW,SAAAC,EAAU,GAAGC,CAAU,EAAInB,GAAaM,EAAOX,CAAe,EAE3E,CAAE,QAASyB,EAAG,gBAAiBC,EAAI,aAAcC,EAAK,GAAGC,CAAc,EAAIJ,EAC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,UAAWhB,EAAW,2BAA4B0B,CAAS,GAC1G3B,EAAA,cAAC,OAAI,UAAU,yBAAyB4B,CAAS,CACnD,CAEJ,CAAC,EACDyD,EAAsB,YAAc,yBAKpC,MAAMQ,EAAe7F,EAAM,WAA8C,CAAC,CAAE,UAAA2B,EAAW,GAAGX,CAAM,EAAGC,IACjGjB,EAAA,cAAC,OAAK,GAAGgB,EAAO,IAAKC,EAAc,UAAWhB,EAAW,mBAAoB,kBAAmB0B,CAAS,EAAG,CAC7G,EACDkE,EAAa,YAAc,gBAM3B,MAAMC,EAAoB9F,EAAM,WAAmD,CAAC,CAAE,QAAAiD,EAAU,GAAO,UAAAtB,EAAW,GAAGX,CAAM,EAAGC,IAGrHjB,EAAA,cAFMiD,EAAU/C,EAAO,MAEtB,CAAM,GAAGc,EAAO,IAAKC,EAAc,KAAK,QAAQ,UAAWhB,EAAW,mBAAoB,uBAAwB0B,CAAS,EAAG,CACvI,EACDmE,EAAkB,YAAc,qBAIhC,MAAMC,EAAsB/F,EAAM,WAAqD,CAAC,CAAE,UAAA2B,EAAW,GAAGX,CAAM,EAAGC,IAC/GjB,EAAA,cAAC,OAAK,GAAGgB,EAAO,IAAKC,EAAc,UAAWhB,EAAW,yBAA0B0B,CAAS,EAAG,CAChG,EACDoE,EAAoB,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "Slot", "Accordion", "DropdownMenu", "sidebarPropDefs", "useThemeContext", "ScrollArea", "Separator", "ThickChevronRightIcon", "extractProps", "Kbd", "Badge", "SidebarVisualContext", "useSidebarVisual", "Sidebar", "props", "forwardedRef", "themeContext", "size", "variant", "menuVariant", "layout", "presentation", "panelBackground", "color", "highContrast", "className", "children", "rootProps", "_", "__", "___", "safeRootProps", "resolvedColor", "resolvedLayout", "resolvedSize", "SidebarContent", "role", "ariaLabel", "id", "visual", "SidebarHeader", "asContainer", "SidebarFooter", "SidebarSeparator", "SidebarMenu", "SidebarMenuItem", "SidebarMenuButton", "asChild", "isActive", "shortcut", "badge", "onMouseEnter", "onMouseLeave", "onKeyDown", "isHighlighted", "setIsHighlighted", "sidebarSize", "isThinMode", "Comp", "onClick", "handleKeyDown", "event", "nextItem", "prevItem", "separateIconsAndLabels", "node", "icons", "labels", "child", "el", "wrapTextNodes", "index", "newChildren", "processedChildren", "slottedChildren", "onlyChild", "originalInnerChildren", "enhancedInnerChildren", "label", "SidebarSubMenuModeContext", "SidebarMenuSub", "defaultOpen", "SidebarMenuSubTrigger", "SidebarMenuSubContent", "unwrapMenuButton", "n", "i", "normalized", "itemChildren", "content", "dropdownSize", "SidebarGroup", "SidebarGroupLabel", "SidebarGroupContent"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{asChildPropDef as e}from"../props/as-child.prop.js";import{colorPropDef as s}from"../props/color.prop.js";import{highContrastPropDef as a}from"../props/high-contrast.prop.js";import{baseMenuContentPropDefs as b,baseMenuItemPropDefs as D,baseMenuCheckboxItemPropDefs as P,baseMenuRadioItemPropDefs as v}from"./_internal/base-menu.props.js";const t=["1","2"],o=["soft","outline","surface","ghost"],r=["solid","soft"],n=["sidebar"],p=["left","right"],l=["offcanvas","icon","none"],f=["rail","panel"],u={...e,size:{type:"enum",className:"rt-r-size",values:t,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:o,default:"outline"},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:l,default:"offcanvas"},layout:{type:"enum",className:"rt-layout",values:f,default:void 0},panelBackground:{type:"enum",values:["solid","translucent"],default:void 0},...s,...a};export{P as sidebarCheckboxItemPropDefs,b as sidebarContentPropDefs,D as sidebarItemPropDefs,u as sidebarPropDefs,v as sidebarRadioItemPropDefs};
|
|
1
|
+
import{asChildPropDef as e}from"../props/as-child.prop.js";import{colorPropDef as s}from"../props/color.prop.js";import{highContrastPropDef as a}from"../props/high-contrast.prop.js";import{baseMenuContentPropDefs as b,baseMenuItemPropDefs as D,baseMenuCheckboxItemPropDefs as P,baseMenuRadioItemPropDefs as v}from"./_internal/base-menu.props.js";const t=["1","2","3"],o=["soft","outline","surface","ghost"],r=["solid","soft"],n=["sidebar"],p=["left","right"],l=["offcanvas","icon","none"],f=["rail","panel"],u={...e,size:{type:"enum",className:"rt-r-size",values:t,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:o,default:"outline"},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:l,default:"offcanvas"},layout:{type:"enum",className:"rt-layout",values:f,default:void 0},panelBackground:{type:"enum",values:["solid","translucent"],default:void 0},...s,...a};export{P as sidebarCheckboxItemPropDefs,b as sidebarContentPropDefs,D as sidebarItemPropDefs,u as sidebarPropDefs,v 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.js';\nimport { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\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', 'outline', 'surface', 'ghost'] as const;\nconst menuVariants = ['solid', 'soft'] as const;\nconst types = ['sidebar'] as const;\nconst sides = ['left', 'right'] as const;\nconst collapsibleModes = ['offcanvas', 'icon', 'none'] as const;\nconst layouts = ['rail', 'panel'] 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: 'outline' },\n menuVariant: {\n type: 'enum',\n className: 'rt-menu-variant',\n values: menuVariants,\n default: 'soft',\n },\n type: { type: 'enum', className: 'rt-type', values: types, default: 'sidebar' },\n side: { type: 'enum', className: 'rt-side', values: sides, default: 'left' },\n collapsible: {\n type: 'enum',\n className: 'rt-collapsible',\n values: collapsibleModes,\n default: 'offcanvas',\n },\n layout: { type: 'enum', className: 'rt-layout', values: layouts, default: undefined },\n panelBackground: { type: 'enum', values: ['solid', 'translucent'], default: undefined },\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 layout: PropDef<(typeof layouts)[number]>;\n panelBackground: PropDef<'solid' | 'translucent'>;\n};\n\nexport { sidebarPropDefs };\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,kBAAAA,MAAsB,4BAC/B,OAAS,gBAAAC,MAAoB,yBAC7B,OAAS,uBAAAC,MAA2B,iCAKpC,OAC6B,2BAA3BC,EACwB,wBAAxBC,EACgC,gCAAhCC,EAC6B,6BAA7BC,MACK,iCAGP,MAAMC,EAAQ,CAAC,IAAK,GAAG,
|
|
4
|
+
"sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop.js';\nimport { colorPropDef } from '../props/color.prop.js';\nimport { highContrastPropDef } from '../props/high-contrast.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\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', '3'] as const;\nconst variants = ['soft', 'outline', 'surface', 'ghost'] as const;\nconst menuVariants = ['solid', 'soft'] as const;\nconst types = ['sidebar'] as const;\nconst sides = ['left', 'right'] as const;\nconst collapsibleModes = ['offcanvas', 'icon', 'none'] as const;\nconst layouts = ['rail', 'panel'] 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: 'outline' },\n menuVariant: {\n type: 'enum',\n className: 'rt-menu-variant',\n values: menuVariants,\n default: 'soft',\n },\n type: { type: 'enum', className: 'rt-type', values: types, default: 'sidebar' },\n side: { type: 'enum', className: 'rt-side', values: sides, default: 'left' },\n collapsible: {\n type: 'enum',\n className: 'rt-collapsible',\n values: collapsibleModes,\n default: 'offcanvas',\n },\n layout: { type: 'enum', className: 'rt-layout', values: layouts, default: undefined },\n panelBackground: { type: 'enum', values: ['solid', 'translucent'], default: undefined },\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 layout: PropDef<(typeof layouts)[number]>;\n panelBackground: PropDef<'solid' | 'translucent'>;\n};\n\nexport { sidebarPropDefs };\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,kBAAAA,MAAsB,4BAC/B,OAAS,gBAAAC,MAAoB,yBAC7B,OAAS,uBAAAC,MAA2B,iCAKpC,OAC6B,2BAA3BC,EACwB,wBAAxBC,EACgC,gCAAhCC,EAC6B,6BAA7BC,MACK,iCAGP,MAAMC,EAAQ,CAAC,IAAK,IAAK,GAAG,EACtBC,EAAW,CAAC,OAAQ,UAAW,UAAW,OAAO,EACjDC,EAAe,CAAC,QAAS,MAAM,EAC/BC,EAAQ,CAAC,SAAS,EAClBC,EAAQ,CAAC,OAAQ,OAAO,EACxBC,EAAmB,CAAC,YAAa,OAAQ,MAAM,EAC/CC,EAAU,CAAC,OAAQ,OAAO,EAE1BC,EAAkB,CACtB,GAAGd,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,CACX,KAAM,OACN,UAAW,kBACX,OAAQC,EACR,QAAS,MACX,EACA,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,SAAU,EAC9E,KAAM,CAAE,KAAM,OAAQ,UAAW,UAAW,OAAQC,EAAO,QAAS,MAAO,EAC3E,YAAa,CACX,KAAM,OACN,UAAW,iBACX,OAAQC,EACR,QAAS,WACX,EACA,OAAQ,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQC,EAAS,QAAS,MAAU,EACpF,gBAAiB,CAAE,KAAM,OAAQ,OAAQ,CAAC,QAAS,aAAa,EAAG,QAAS,MAAU,EACtF,GAAGZ,EACH,GAAGC,CACL",
|
|
6
6
|
"names": ["asChildPropDef", "colorPropDef", "highContrastPropDef", "baseMenuContentPropDefs", "baseMenuItemPropDefs", "baseMenuCheckboxItemPropDefs", "baseMenuRadioItemPropDefs", "sizes", "variants", "menuVariants", "types", "sides", "collapsibleModes", "layouts", "sidebarPropDefs"]
|
|
7
7
|
}
|
package/package.json
CHANGED
package/schemas/base-button.json
CHANGED
|
@@ -279,6 +279,6 @@
|
|
|
279
279
|
"title": "Base-button Component Props",
|
|
280
280
|
"description": "Props schema for the base-button component in Kookie UI",
|
|
281
281
|
"version": "1.0.0",
|
|
282
|
-
"generatedAt": "2026-01-
|
|
282
|
+
"generatedAt": "2026-01-07T05:55:02.780Z",
|
|
283
283
|
"source": "Zod schema"
|
|
284
284
|
}
|
package/schemas/button.json
CHANGED
|
@@ -530,6 +530,6 @@
|
|
|
530
530
|
"title": "Button Component Props",
|
|
531
531
|
"description": "Props schema for the button component in Kookie UI",
|
|
532
532
|
"version": "1.0.0",
|
|
533
|
-
"generatedAt": "2026-01-
|
|
533
|
+
"generatedAt": "2026-01-07T05:55:02.786Z",
|
|
534
534
|
"source": "Zod schema"
|
|
535
535
|
}
|
package/schemas/icon-button.json
CHANGED
|
@@ -313,6 +313,6 @@
|
|
|
313
313
|
"title": "Icon-button Component Props",
|
|
314
314
|
"description": "Props schema for the icon-button component in Kookie UI",
|
|
315
315
|
"version": "1.0.0",
|
|
316
|
-
"generatedAt": "2026-01-
|
|
316
|
+
"generatedAt": "2026-01-07T05:55:02.787Z",
|
|
317
317
|
"source": "Zod schema"
|
|
318
318
|
}
|
package/schemas/index.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"title": "Kookie UI Button Components",
|
|
4
4
|
"description": "Complete JSON Schema collection for all button components in Kookie UI",
|
|
5
5
|
"version": "1.0.0",
|
|
6
|
-
"generatedAt": "2026-01-
|
|
6
|
+
"generatedAt": "2026-01-07T05:55:02.790Z",
|
|
7
7
|
"source": "Zod schemas",
|
|
8
8
|
"components": {
|
|
9
9
|
"base-button": {
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"title": "Base-button Component Props",
|
|
288
288
|
"description": "Props schema for the base-button component in Kookie UI",
|
|
289
289
|
"version": "1.0.0",
|
|
290
|
-
"generatedAt": "2026-01-
|
|
290
|
+
"generatedAt": "2026-01-07T05:55:02.780Z",
|
|
291
291
|
"source": "Zod schema"
|
|
292
292
|
},
|
|
293
293
|
"button": {
|
|
@@ -822,7 +822,7 @@
|
|
|
822
822
|
"title": "Button Component Props",
|
|
823
823
|
"description": "Props schema for the button component in Kookie UI",
|
|
824
824
|
"version": "1.0.0",
|
|
825
|
-
"generatedAt": "2026-01-
|
|
825
|
+
"generatedAt": "2026-01-07T05:55:02.786Z",
|
|
826
826
|
"source": "Zod schema"
|
|
827
827
|
},
|
|
828
828
|
"icon-button": {
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
"title": "Icon-button Component Props",
|
|
1141
1141
|
"description": "Props schema for the icon-button component in Kookie UI",
|
|
1142
1142
|
"version": "1.0.0",
|
|
1143
|
-
"generatedAt": "2026-01-
|
|
1143
|
+
"generatedAt": "2026-01-07T05:55:02.787Z",
|
|
1144
1144
|
"source": "Zod schema"
|
|
1145
1145
|
},
|
|
1146
1146
|
"toggle-button": {
|
|
@@ -1683,7 +1683,7 @@
|
|
|
1683
1683
|
"title": "Toggle-button Component Props",
|
|
1684
1684
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
1685
1685
|
"version": "1.0.0",
|
|
1686
|
-
"generatedAt": "2026-01-
|
|
1686
|
+
"generatedAt": "2026-01-07T05:55:02.789Z",
|
|
1687
1687
|
"source": "Zod schema"
|
|
1688
1688
|
},
|
|
1689
1689
|
"toggle-icon-button": {
|
|
@@ -2009,7 +2009,7 @@
|
|
|
2009
2009
|
"title": "Toggle-icon-button Component Props",
|
|
2010
2010
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
2011
2011
|
"version": "1.0.0",
|
|
2012
|
-
"generatedAt": "2026-01-
|
|
2012
|
+
"generatedAt": "2026-01-07T05:55:02.790Z",
|
|
2013
2013
|
"source": "Zod schema"
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
@@ -538,6 +538,6 @@
|
|
|
538
538
|
"title": "Toggle-button Component Props",
|
|
539
539
|
"description": "Props schema for the toggle-button component in Kookie UI",
|
|
540
540
|
"version": "1.0.0",
|
|
541
|
-
"generatedAt": "2026-01-
|
|
541
|
+
"generatedAt": "2026-01-07T05:55:02.789Z",
|
|
542
542
|
"source": "Zod schema"
|
|
543
543
|
}
|
|
@@ -321,6 +321,6 @@
|
|
|
321
321
|
"title": "Toggle-icon-button Component Props",
|
|
322
322
|
"description": "Props schema for the toggle-icon-button component in Kookie UI",
|
|
323
323
|
"version": "1.0.0",
|
|
324
|
-
"generatedAt": "2026-01-
|
|
324
|
+
"generatedAt": "2026-01-07T05:55:02.790Z",
|
|
325
325
|
"source": "Zod schema"
|
|
326
326
|
}
|
|
@@ -230,12 +230,10 @@
|
|
|
230
230
|
|
|
231
231
|
&:where([data-state='open']) {
|
|
232
232
|
background-color: color-mix(in srgb, var(--gray-a3) calc(var(--material-alpha) * 100%), var(--gray-3) var(--material-blend));
|
|
233
|
-
box-shadow: var(--shadow-1);
|
|
234
233
|
}
|
|
235
234
|
|
|
236
235
|
&:where(:active:not([data-state='open'], [data-disabled]), [data-state='on']:not([data-disabled])) {
|
|
237
236
|
background-color: color-mix(in srgb, var(--gray-a3) calc(var(--material-alpha) * 100%), var(--gray-3) var(--material-blend));
|
|
238
|
-
box-shadow: var(--shadow-1);
|
|
239
237
|
}
|
|
240
238
|
|
|
241
239
|
@media (pointer: coarse) {
|
|
@@ -361,12 +359,10 @@
|
|
|
361
359
|
&:where([data-state='open']) {
|
|
362
360
|
background-color: color-mix(in srgb, var(--accent-a10) calc(var(--material-alpha) * 100%), var(--accent-10) var(--solid-blend));
|
|
363
361
|
filter: var(--base-button-solid-open-filter);
|
|
364
|
-
box-shadow: var(--shadow-1);
|
|
365
362
|
}
|
|
366
363
|
|
|
367
364
|
&:where(:active:not([data-state='open'])) {
|
|
368
365
|
filter: var(--base-button-solid-active-filter);
|
|
369
|
-
box-shadow: var(--shadow-1);
|
|
370
366
|
}
|
|
371
367
|
|
|
372
368
|
@media (pointer: coarse) {
|
|
@@ -396,12 +392,10 @@
|
|
|
396
392
|
&:where([data-state='open']) {
|
|
397
393
|
background-color: color-mix(in srgb, var(--accent-a12) calc(var(--material-alpha) * 100%), var(--accent-12) var(--solid-blend));
|
|
398
394
|
filter: var(--base-button-solid-high-contrast-open-filter);
|
|
399
|
-
box-shadow: var(--shadow-1);
|
|
400
395
|
}
|
|
401
396
|
|
|
402
397
|
&:where(:active:not([data-state='open'])) {
|
|
403
398
|
filter: var(--base-button-solid-high-contrast-active-filter);
|
|
404
|
-
box-shadow: var(--shadow-1);
|
|
405
399
|
}
|
|
406
400
|
}
|
|
407
401
|
|
|
@@ -453,12 +447,10 @@
|
|
|
453
447
|
|
|
454
448
|
&:where([data-state='open']) {
|
|
455
449
|
background-color: color-mix(in srgb, var(--accent-a4) calc(var(--material-alpha) * 100%), var(--accent-4) var(--material-blend));
|
|
456
|
-
box-shadow: var(--shadow-1);
|
|
457
450
|
}
|
|
458
451
|
|
|
459
452
|
&:where(:active:not([data-state='open'])) {
|
|
460
453
|
background-color: color-mix(in srgb, var(--accent-a5) calc(var(--material-alpha) * 100%), var(--accent-5) var(--material-blend));
|
|
461
|
-
box-shadow: var(--shadow-1);
|
|
462
454
|
}
|
|
463
455
|
|
|
464
456
|
&:where([data-disabled]) {
|
|
@@ -514,12 +506,10 @@
|
|
|
514
506
|
|
|
515
507
|
&:where([data-state='open']) {
|
|
516
508
|
background-color: color-mix(in srgb, var(--accent-a3) calc(var(--material-alpha) * 100%), var(--accent-3) var(--material-blend));
|
|
517
|
-
box-shadow: var(--shadow-1);
|
|
518
509
|
}
|
|
519
510
|
|
|
520
511
|
&:where(:active:not([data-state='open'])) {
|
|
521
512
|
background-color: color-mix(in srgb, var(--accent-a4) calc(var(--material-alpha) * 100%), var(--accent-4) var(--material-blend));
|
|
522
|
-
box-shadow: var(--shadow-1);
|
|
523
513
|
}
|
|
524
514
|
|
|
525
515
|
&:where([data-disabled]) {
|
|
@@ -554,16 +544,12 @@
|
|
|
554
544
|
|
|
555
545
|
&:where([data-state='open']) {
|
|
556
546
|
background-color: color-mix(in srgb, var(--accent-a2) calc(var(--material-alpha) * 100%), var(--accent-2) var(--material-blend));
|
|
557
|
-
box-shadow:
|
|
558
|
-
inset 0 0 0 1px var(--outline-border-7),
|
|
559
|
-
var(--shadow-1);
|
|
547
|
+
box-shadow: inset 0 0 0 1px var(--outline-border-7);
|
|
560
548
|
}
|
|
561
549
|
|
|
562
550
|
&:where(:active:not([data-state='open'])) {
|
|
563
551
|
background-color: color-mix(in srgb, var(--accent-a3) calc(var(--material-alpha) * 100%), var(--accent-3) var(--material-blend));
|
|
564
|
-
box-shadow:
|
|
565
|
-
inset 0 0 0 1px var(--outline-border-8),
|
|
566
|
-
var(--shadow-1);
|
|
552
|
+
box-shadow: inset 0 0 0 1px var(--outline-border-8);
|
|
567
553
|
}
|
|
568
554
|
|
|
569
555
|
&:where(:focus-visible) {
|
|
@@ -608,16 +594,12 @@
|
|
|
608
594
|
|
|
609
595
|
&:where([data-state='open']) {
|
|
610
596
|
background-color: color-mix(in srgb, var(--accent-a3) calc(var(--material-alpha) * 100%), var(--accent-3) var(--material-blend));
|
|
611
|
-
box-shadow:
|
|
612
|
-
inset 0 0 0 1px var(--surface-border-8),
|
|
613
|
-
var(--shadow-1);
|
|
597
|
+
box-shadow: inset 0 0 0 1px var(--surface-border-8);
|
|
614
598
|
}
|
|
615
599
|
|
|
616
600
|
&:where(:active:not([data-state='open'])) {
|
|
617
601
|
background-color: color-mix(in srgb, var(--accent-a4) calc(var(--material-alpha) * 100%), var(--accent-4) var(--material-blend));
|
|
618
|
-
box-shadow:
|
|
619
|
-
inset 0 0 0 1px var(--surface-border-8),
|
|
620
|
-
var(--shadow-1);
|
|
602
|
+
box-shadow: inset 0 0 0 1px var(--surface-border-8);
|
|
621
603
|
}
|
|
622
604
|
|
|
623
605
|
&:where(:focus-visible) {
|
|
@@ -649,7 +631,6 @@
|
|
|
649
631
|
/* Classic variant pressed */
|
|
650
632
|
&:where(.rt-variant-classic) {
|
|
651
633
|
background-color: color-mix(in srgb, var(--gray-a3) calc(var(--material-alpha) * 100%), var(--gray-3) var(--material-blend));
|
|
652
|
-
box-shadow: var(--shadow-1);
|
|
653
634
|
}
|
|
654
635
|
|
|
655
636
|
/* Solid variant pressed - uses solid-blend from variant definition */
|
|
@@ -657,7 +638,6 @@
|
|
|
657
638
|
--solid-blend: calc(100% - (var(--material-alpha) * 90%));
|
|
658
639
|
background-color: color-mix(in srgb, var(--accent-a10) calc(var(--material-alpha) * 100%), var(--accent-10) var(--solid-blend));
|
|
659
640
|
opacity: 0.9;
|
|
660
|
-
box-shadow: var(--shadow-1);
|
|
661
641
|
|
|
662
642
|
&:where(.rt-high-contrast) {
|
|
663
643
|
background-color: var(--accent-12);
|
|
@@ -668,31 +648,25 @@
|
|
|
668
648
|
/* Soft variant pressed */
|
|
669
649
|
&:where(.rt-variant-soft) {
|
|
670
650
|
background-color: color-mix(in srgb, var(--accent-a5) calc(var(--material-alpha) * 100%), var(--accent-5) var(--material-blend));
|
|
671
|
-
box-shadow: var(--shadow-1);
|
|
672
651
|
}
|
|
673
652
|
|
|
674
653
|
/* Ghost variant pressed */
|
|
675
654
|
&:where(.rt-variant-ghost) {
|
|
676
655
|
background-color: color-mix(in srgb, var(--accent-a4) calc(var(--material-alpha) * 100%), var(--accent-4) var(--material-blend));
|
|
677
|
-
box-shadow: var(--shadow-1);
|
|
678
656
|
}
|
|
679
657
|
|
|
680
658
|
/* Outline variant pressed */
|
|
681
659
|
&:where(.rt-variant-outline) {
|
|
682
660
|
--outline-border-8: color-mix(in srgb, var(--accent-a8) calc(var(--material-alpha) * 100%), var(--accent-8) var(--material-blend));
|
|
683
661
|
background-color: color-mix(in srgb, var(--accent-a3) calc(var(--material-alpha) * 100%), var(--accent-3) var(--material-blend));
|
|
684
|
-
box-shadow:
|
|
685
|
-
inset 0 0 0 1px var(--outline-border-8),
|
|
686
|
-
var(--shadow-1);
|
|
662
|
+
box-shadow: inset 0 0 0 1px var(--outline-border-8);
|
|
687
663
|
}
|
|
688
664
|
|
|
689
665
|
/* Surface variant pressed */
|
|
690
666
|
&:where(.rt-variant-surface) {
|
|
691
667
|
--surface-border-8: color-mix(in srgb, var(--accent-a8) calc(var(--material-alpha) * 100%), var(--accent-8) var(--material-blend));
|
|
692
668
|
background-color: color-mix(in srgb, var(--accent-a4) calc(var(--material-alpha) * 100%), var(--accent-4) var(--material-blend));
|
|
693
|
-
box-shadow:
|
|
694
|
-
inset 0 0 0 1px var(--surface-border-8),
|
|
695
|
-
var(--shadow-1);
|
|
669
|
+
box-shadow: inset 0 0 0 1px var(--surface-border-8);
|
|
696
670
|
}
|
|
697
671
|
}
|
|
698
672
|
|
|
@@ -329,7 +329,6 @@
|
|
|
329
329
|
|
|
330
330
|
&:where([data-state='open']) {
|
|
331
331
|
transition-duration: 40ms;
|
|
332
|
-
box-shadow: var(--shadow-1);
|
|
333
332
|
|
|
334
333
|
&::before {
|
|
335
334
|
background-color: var(--gray-3);
|
|
@@ -346,8 +345,6 @@
|
|
|
346
345
|
}
|
|
347
346
|
|
|
348
347
|
&:where(:active:not([data-state='open'])) {
|
|
349
|
-
box-shadow: var(--shadow-1);
|
|
350
|
-
|
|
351
348
|
&::before {
|
|
352
349
|
background-color: var(--gray-3);
|
|
353
350
|
|
|
@@ -170,7 +170,6 @@
|
|
|
170
170
|
&:where([data-state='checked'], [data-state='indeterminate']) {
|
|
171
171
|
&::before {
|
|
172
172
|
background-color: var(--accent-3);
|
|
173
|
-
box-shadow: var(--shadow-1);
|
|
174
173
|
|
|
175
174
|
/* Theme-level translucent override */
|
|
176
175
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|
|
@@ -219,7 +218,6 @@
|
|
|
219
218
|
|
|
220
219
|
&::before {
|
|
221
220
|
background-color: var(--accent-3);
|
|
222
|
-
box-shadow: var(--shadow-1);
|
|
223
221
|
|
|
224
222
|
/* Theme-level translucent override for active */
|
|
225
223
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|