@sdxc/kit 2026.10.23 → 2026.10.24

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sidebar",
3
- "changedIn": "2026.10.21",
3
+ "changedIn": "2026.10.24",
4
4
  "dependencies": [
5
5
  "dialog",
6
6
  "scroll-area",
@@ -11,10 +11,10 @@
11
11
  ],
12
12
  "source": {
13
13
  "path": "sidebar.tsx",
14
- "content": "/**\n * An application shell's primary navigation rail, composed from a layout\n * root, a collapsible rail, a main-content inset, and a family of\n * group/menu/item parts for organizing links. Collapsing rides a single\n * checkbox's native `:checked` state, so the whole shell works with zero\n * library JavaScript.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { PanelLeftIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, borderEdge, colorMix, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, pseudoContent, userSelect, willChange } from \"@sdxc/u/general\";\nimport { var as varUtility } from \"@sdxc/u/general/var\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thidden,\n\tinlineFlex,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, supports } from \"@sdxc/u/responsive\";\nimport {\n\tbs,\n\tis,\n\tm,\n\tmaxBs,\n\tmaxIs,\n\tmbe,\n\tmbs,\n\tminBs,\n\tminIs,\n\tmis,\n\tp,\n\tpb,\n\tpbe,\n\tpbs,\n\tpi,\n\tpis,\n\tsafeAreaPadding,\n} from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { after, data, focusVisible, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty, translateProperty, translateX } from \"@sdxc/u/transform\";\nimport {\n\tfontSize,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttextTransform,\n\ttracking,\n\ttruncate,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\nimport { Separator } from \"@sdxc/ui/separator\";\n\n/** Visual treatment {@link Sidebar} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Sidebar.Variant = \"sidebar\";\n\n/** Collapse behavior {@link Sidebar} falls back to when `collapsible` is omitted. */\nconst DEFAULT_COLLAPSIBLE: Sidebar.Collapsible = \"offcanvas\";\n\n/**\n * Physical edge {@link Sidebar} docks against, and the edge\n * {@link Sidebar.MobileNav} slides in from, when `side` is omitted.\n */\nconst DEFAULT_SIDE: Sidebar.Side = \"left\";\n\n/** Semantic color role {@link Sidebar.Item} falls back to when `color` is omitted. */\nconst DEFAULT_ITEM_COLOR: Sidebar.Color = \"neutral\";\n\n/** Size variant {@link Sidebar.MenuButton} and {@link Sidebar.MenuLink} fall back to when `size` is omitted. */\nconst DEFAULT_MENU_BUTTON_SIZE: Sidebar.MenuButtonSize = \"md\";\n\n/** Whether {@link Sidebar.MenuAction} stays hidden until its row is hovered or focused, when `showOnHover` is omitted. */\nconst DEFAULT_SHOW_ON_HOVER = true;\n\n/** Whether {@link Sidebar.MenuSkeleton} renders a leading icon placeholder, when `showIcon` is omitted. */\nconst DEFAULT_SHOW_ICON = false;\n\n/**\n * Named container {@link Sidebar.Provider} declares on its own host, so\n * {@link Sidebar} and {@link Sidebar.Rail} can query the shell's overall\n * width for room to show a persistent rail, regardless of nesting depth.\n */\nconst PROVIDER_CONTAINER_NAME = \"ui-sidebar-provider\";\n\n/**\n * Named container {@link Sidebar.Inset} declares on its own host, so content\n * rendered inside it — a Card, a Table, anything sized by its surroundings —\n * responds to the inset's own available width as the rail expands or collapses.\n */\nconst INSET_CONTAINER_NAME = \"ui-sidebar-inset\";\n\n/**\n * Container query matching a shell wide enough to host the persistent rail\n * alongside its inset; below this width, {@link Sidebar}'s `\"icon\"` and\n * `\"offcanvas\"` collapse modes step aside for {@link Sidebar.MobileNav}.\n */\nconst WIDE_SHELL_QUERY = `@container ${PROVIDER_CONTAINER_NAME} (min-width: 48rem)`;\n\n/**\n * Selector matching {@link Sidebar.Trigger}'s own checkbox input once it\n * carries the platform's native `:checked` state — the single source of\n * truth every collapse-driven rule in {@link Sidebar} reads from.\n */\nconst TOGGLE_CHECKED_SELECTOR = '[data-slot=\"toggle\"]:checked';\n\n/**\n * Resolves the `aria-current` value an anchor-based nav part renders with:\n * an explicit `aria-current` always wins, and a `current`/`active`\n * shorthand of `true` falls back to `\"page\"` when nothing else was given.\n */\nfunction resolveAriaCurrent(\n\tcurrent: boolean | undefined,\n\tariaCurrent: TagProps<\"a\">[\"aria-current\"],\n): TagProps<\"a\">[\"aria-current\"] {\n\treturn ariaCurrent ?? (current ? \"page\" : undefined);\n}\n\n/**\n * Prop types for {@link Sidebar} and its compound parts.\n */\nexport namespace Sidebar {\n\t/**\n\t * Visual treatment the rail renders with: `\"sidebar\"` sits flush against\n\t * its edge, `\"floating\"` insets itself with a margin, a rounded, shadowed\n\t * panel, and a blurred backdrop; `\"inset\"` renders the same panel without blur.\n\t */\n\texport type Variant = \"sidebar\" | \"floating\" | \"inset\";\n\n\t/**\n\t * How the rail collapses: `\"none\"` always renders at full width, `\"icon\"`\n\t * narrows to an icon-only rail, and `\"offcanvas\"` narrows to nothing. Every\n\t * mode but `\"none\"` yields to {@link Sidebar.MobileNav} on narrow shells.\n\t */\n\texport type Collapsible = \"none\" | \"offcanvas\" | \"icon\";\n\n\t/**\n\t * Physical edge of the shell the rail docks against and, for\n\t * {@link Sidebar.MobileNav}, slides in from. `\"left\"` and `\"right\"` name\n\t * that edge regardless of `dir`, staying pinned to one physical side.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/**\n\t * Semantic color role {@link Sidebar.Item} renders its current-page\n\t * treatment in, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Size variant controlling {@link Sidebar.MenuButton}'s and\n\t * {@link Sidebar.MenuLink}'s padding, font size, and icon size.\n\t */\n\texport type MenuButtonSize = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Establishes\n\t * the shell's row layout — {@link Sidebar} beside {@link Sidebar.Inset} —\n\t * plus the {@link PROVIDER_CONTAINER_NAME} container the collapse rules query.\n\t */\n\texport interface ProviderProps extends TagProps<\"div\"> {\n\t\t/** {@link Sidebar} and {@link Sidebar.Inset}, in either order. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<aside>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"aside\"> {\n\t\t/** Visual treatment. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Collapse behavior. Defaults to {@link DEFAULT_COLLAPSIBLE}. */\n\t\tcollapsible?: Collapsible;\n\t\t/** Physical docking edge. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every prop {@link Dialog.Props} accepts, plus `side`. `id` stays the id\n\t * a trigger elsewhere on the page opens this drawer with — see\n\t * {@link Dialog.Props} for the full Invoker Commands contract.\n\t */\n\texport interface MobileNavProps extends Dialog.Props {\n\t\t/** Physical edge to dock against and slide in from. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface ContentProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every native `<footer>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface FooterProps extends TagProps<\"footer\"> {}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface NavProps extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Item}, built as an intersection because\n\t * the underlying anchor prop type is a union keyed on `href` — the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type ItemProps = TagProps<\"a\"> & {\n\t\t/** Destination the item navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role applied once the item is current. Defaults to {@link DEFAULT_ITEM_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tcurrent?: boolean;\n\t};\n\n\t/**\n\t * Every native `<section>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"section\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupLabelProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupActionProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupContentProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough. Its own\n\t * `:hover`/`:focus-within` state reveals a nested {@link Sidebar.MenuAction}\n\t * that would otherwise stay hidden.\n\t */\n\texport interface MenuItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuButton}.\n\t */\n\texport interface MenuButtonProps extends TagProps<\"button\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuLink}. Built as an intersection for\n\t * the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuAction}.\n\t */\n\texport interface MenuActionProps extends TagProps<\"button\"> {\n\t\t/**\n\t\t * Whether the control stays invisible until its ancestor\n\t\t * {@link Sidebar.MenuItem} is hovered or focused. Defaults to\n\t\t * {@link DEFAULT_SHOW_ON_HOVER}; set `false` to keep it always visible.\n\t\t */\n\t\tshowOnHover?: boolean;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuBadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSkeleton}.\n\t */\n\texport interface MenuSkeletonProps extends TagProps<\"div\"> {\n\t\t/** Whether to render a leading icon-shaped placeholder. Defaults to {@link DEFAULT_SHOW_ICON}. */\n\t\tshowIcon?: boolean;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubButton}.\n\t */\n\texport interface MenuSubButtonProps extends TagProps<\"button\"> {\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubLink}. Built as an intersection\n\t * for the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuSubLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.Rail}: every native `<label>` attribute\n\t * except `htmlFor`, narrowed to required since it names the id of\n\t * {@link Sidebar.Trigger}'s own checkbox, the control this rail mirrors.\n\t */\n\texport interface RailProps extends Omit<TagProps<\"label\">, \"htmlFor\"> {\n\t\t/** Id of the {@link Sidebar.Trigger} checkbox this rail toggles. */\n\t\thtmlFor: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Trigger}: every native `<input>`\n\t * attribute except `type` and `role`, fixed by the platform's checkbox\n\t * semantics, so `id`, `checked`, `defaultChecked`, and `disabled` all work.\n\t */\n\texport interface TriggerProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * control carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface InsetProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every prop {@link Separator.Props} accepts, unchanged.\n\t */\n\texport interface SeparatorProps extends Separator.Props {}\n}\n\n/**\n * Renders the rail itself: a native `<aside>` styled through its `data-*`\n * attributes, with collapse rules keyed off {@link Sidebar.Provider}'s `:has()`\n * state and declared after its base size, so both directions animate.\n *\n * @param handle Runtime handle carrying the host `<aside>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar variant=\"floating\" collapsible=\"icon\" side=\"right\">\n * \t\t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t\t<Sidebar.Content>{nav}</Sidebar.Content>\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nexport function Sidebar(handle: Handle<Sidebar.Props>) {\n\treturn () => {\n\t\tlet { variant, collapsible, side, mix, ...rest } = handle.props;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedCollapsible = collapsible ?? DEFAULT_COLLAPSIBLE;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<aside\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-collapsible={resolvedCollapsible}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-bg-tint)\", weight: 95 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\twhen(`[data-slot=\"provider\"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders the shell's layout root: a flex row placing {@link Sidebar} beside\n * {@link Sidebar.Inset}, whose subtree {@link Sidebar} watches for\n * {@link Sidebar.Trigger}'s checkbox reaching `:checked`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shell's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar collapsible=\"icon\">\n * \t\t<Sidebar.Header>\n * \t\t\t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t\t</Sidebar.Header>\n * \t\t<Sidebar.Content>\n * \t\t\t<Sidebar.Menu>\n * \t\t\t\t<Sidebar.MenuItem>\n * \t\t\t\t\t<Sidebar.MenuLink href=\"/dashboard\" active>\n * \t\t\t\t\t\t<HomeIcon aria-hidden />\n * \t\t\t\t\t\t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * \t\t\t\t\t</Sidebar.MenuLink>\n * \t\t\t\t</Sidebar.MenuItem>\n * \t\t\t</Sidebar.Menu>\n * \t\t</Sidebar.Content>\n * \t\t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nSidebar.Provider = function SidebarProvider(handle: Handle<Sidebar.ProviderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"provider\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the docked, edge-to-edge mobile substitute for {@link Sidebar}:\n * {@link Sidebar}'s nav content re-composed inside {@link Dialog}, docked\n * to `side` and opened via Invoker Commands, not a viewport check. A press\n * outside it closes it, which is the dismissal a touch device has.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the drawer's markup.\n * @example\n * <button commandfor=\"mobile-nav\" command=\"show-modal\" aria-label={t(\"nav.openMenu\")}>\n * \t<MenuIcon aria-hidden />\n * </button>\n * <Sidebar.MobileNav id=\"mobile-nav\" aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t<Sidebar.Content>{nav}</Sidebar.Content>\n * </Sidebar.MobileNav>\n */\nSidebar.MobileNav = function SidebarMobileNav(handle: Handle<Sidebar.MobileNavProps>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"mobile-nav\"\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * A press outside closes the drawer, the way a drawer is dismissed on a phone: a modal\n\t\t\t\t\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t */\n\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\tfixed(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tp(\"0\"),\n\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t}),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's header slot: a `<header>` laying out its children in\n * a centered row, block-sized to a fixed height with a divider border\n * below it and safe-area padding on its block-start edge.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Sidebar.Header>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * </Sidebar.Header>\n */\nSidebar.Header = function SidebarHeader(handle: Handle<Sidebar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * The slot paints the rail's background, so content scrolling behind a row held\n\t\t\t\t\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t */\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-end\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\tpbe(\"0.5rem\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's own scrollable nav region: {@link ScrollArea.Viewport}\n * laid out as a padded, gap-separated column that scrolls independently of\n * {@link Sidebar.Header} and {@link Sidebar.Footer} once it overflows.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content region's markup.\n * @example\n * <Sidebar.Content>\n * \t<Sidebar.Group>\n * \t\t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.Group>\n * </Sidebar.Content>\n */\nSidebar.Content = function SidebarContent(handle: Handle<Sidebar.ContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"1rem\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's footer slot: a `<footer>` laying out its children in\n * a centered row with a divider border above it and safe-area padding on\n * its block-end edge.\n *\n * @param handle Runtime handle carrying the host `<footer>`'s props.\n * @returns The render function producing the footer slot's markup.\n * @example\n * <Sidebar.Footer>\n * \t<Sidebar.MenuButton>{t(\"nav.account\")}</Sidebar.MenuButton>\n * </Sidebar.Footer>\n */\nSidebar.Footer = function SidebarFooter(handle: Handle<Sidebar.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<footer\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a flat navigation list: a `<nav>` stacking its {@link Sidebar.Item}\n * children in a column with a small gap, suited to a rail with a simple,\n * ungrouped set of links.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Nav aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Item href=\"/dashboard\" current>{t(\"nav.dashboard\")}</Sidebar.Item>\n * \t<Sidebar.Item href=\"/settings\">{t(\"nav.settings\")}</Sidebar.Item>\n * </Sidebar.Nav>\n */\nSidebar.Nav = function SidebarNav(handle: Handle<Sidebar.NavProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} data-slot=\"nav\" mix={[vstack({ gap: \"0.25rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Nav}: a native `<a>` colored\n * through `data-color`, tinted once `aria-current` is set, matching\n * {@link Sidebar.MenuLink}; its focus ring always reads in that same color.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.Item href=\"/dashboard\" current>\n * \t<HomeIcon aria-hidden />\n * \t{t(\"nav.dashboard\")}\n * </Sidebar.Item>\n * @example\n * <Sidebar.Item href=\"/billing/cancel\" color=\"danger\" aria-current={pathname === \"/billing/cancel\" ? \"page\" : undefined}>\n * \t<XCircleIcon aria-hidden />\n * \t{t(\"nav.cancelPlan\")}\n * </Sidebar.Item>\n */\nSidebar.Item = function SidebarItem(handle: Handle<Sidebar.ItemProps>) {\n\treturn () => {\n\t\tlet { color, current, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_ITEM_COLOR;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(current, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tflex(),\n\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tweight(500),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a related cluster of {@link Sidebar.Menu} items: a `<section>`\n * stacking its children in a column, gaining a divider border and extra\n * space above itself whenever it follows another {@link Sidebar.Group}.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Sidebar.Group>\n * \t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t<Sidebar.GroupContent>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.GroupContent>\n * </Sidebar.Group>\n */\nSidebar.Group = function SidebarGroup(handle: Handle<Sidebar.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s label: a small, muted, uppercase heading\n * row, visually clipped once the ancestor {@link Sidebar} collapses to\n * icon-only, while staying announced to assistive technology.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n */\nSidebar.GroupLabel = function SidebarGroupLabel(handle: Handle<Sidebar.GroupLabelProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-label\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small icon-only action button anchored to {@link Sidebar.GroupLabel}'s\n * trailing edge, its pointer target grown to `--ui-target-size`. In dev mode, an\n * action with no plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.GroupLabel>\n * \t{t(\"nav.workspace\")}\n * \t<Sidebar.GroupAction aria-label={t(\"nav.addWorkspace\")}>\n * \t\t<PlusIcon aria-hidden />\n * \t</Sidebar.GroupAction>\n * </Sidebar.GroupLabel>\n */\nSidebar.GroupAction = function SidebarGroupAction(handle: Handle<Sidebar.GroupActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.GroupAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-action\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s body slot: a `<div>` stacking its children\n * — typically a {@link Sidebar.Menu} — in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the body slot's markup.\n * @example\n * <Sidebar.GroupContent>\n * \t<Sidebar.Menu>...</Sidebar.Menu>\n * </Sidebar.GroupContent>\n */\nSidebar.GroupContent = function SidebarGroupContent(handle: Handle<Sidebar.GroupContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"group-content\" mix={[vstack({ gap: \"0.125rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a list of nav rows: a native `<ul>` stacking {@link Sidebar.MenuItem}\n * children in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Menu>\n * \t<Sidebar.MenuItem>\n * \t\t<Sidebar.MenuLink href=\"/dashboard\">{t(\"nav.dashboard\")}</Sidebar.MenuLink>\n * \t</Sidebar.MenuItem>\n * </Sidebar.Menu>\n */\nSidebar.Menu = function SidebarMenu(handle: Handle<Sidebar.MenuProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu\"\n\t\t\t\tmix={[is(\"full\"), minIs(\"0\"), vstack({ gap: \"0.125rem\" }), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Menu}: a relatively positioned\n * `<li>` whose own `:hover`/`:focus-within` state reveals a nested\n * {@link Sidebar.MenuAction} that stays invisible at rest.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuItem>\n * \t<Sidebar.MenuLink href=\"/inbox\">{t(\"nav.inbox\")}</Sidebar.MenuLink>\n * \t<Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t\t<SettingsIcon aria-hidden />\n * \t</Sidebar.MenuAction>\n * </Sidebar.MenuItem>\n */\nSidebar.MenuItem = function SidebarMenuItem(handle: Handle<Sidebar.MenuItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-item\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\t/**\n\t\t\t\t\t * A plain row centres what it holds and a row carrying a sub-menu stacks, putting the\n\t\t\t\t\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\topacity(100),\n\t\t\t\t\t),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.Menu}, sized through `data-size` and marked current via\n * `active`; its leading icon is muted, and a trailing label truncates.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuButton onClick={openCommandPalette}>\n * \t<SearchIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.search\")}</span>\n * </Sidebar.MenuButton>\n */\nSidebar.MenuButton = function SidebarMenuButton(handle: Handle<Sidebar.MenuButtonProps>) {\n\treturn () => {\n\t\tlet { size, active, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-button\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<a>` row for navigation inside {@link Sidebar.Menu},\n * visually identical to {@link Sidebar.MenuButton}. `active` sets\n * `aria-current=\"page\"` when unset, with styling reading that attribute directly.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuLink href=\"/dashboard\" active>\n * \t<HomeIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuLink = function SidebarMenuLink(handle: Handle<Sidebar.MenuLinkProps>) {\n\treturn () => {\n\t\tlet { size, active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-link\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuButton} and\n * {@link Sidebar.MenuLink}, factored out since the two differ only in host\n * element and how their current/active state is expressed.\n */\nfunction menuRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tis(\"full\"),\n\t\tminIs(\"0\"),\n\t\titems(\"center\"),\n\t\toverflow(\"hidden\"),\n\t\ttextAlign(\"start\"),\n\t\tweight(500),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\toutlineStyle(\"none\"),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\tis(\"1rem\"),\n\t\t\tbs(\"1rem\"),\n\t\t\tshrink(),\n\t\t]),\n\t\twhen(\"& > span\", truncate()),\n\t\tdata(\"size\", \"sm\", [\n\t\t\tminBs(\"1.75rem\"),\n\t\t\tpb(\"0.375rem\"),\n\t\t\tfontSize(\"xs\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"0.875rem\"),\n\t\t\t\tbs(\"0.875rem\"),\n\t\t\t]),\n\t\t]),\n\t\tdata(\"size\", \"md\", minBs(\"2.25rem\")),\n\t\tdata(\"size\", \"lg\", [\n\t\t\tminBs(\"2.75rem\"),\n\t\t\tpb(\"0.625rem\"),\n\t\t\tfontSize(\"base\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"1.25rem\"),\n\t\t\t\tbs(\"1.25rem\"),\n\t\t\t]),\n\t\t]),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.75rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.5rem\"),\n\t\tpb(\"0.5rem\"),\n\t\tfg(\"neutral\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.muted\")),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.emphasis\")),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s trailing\n * edge, revealed by `showOnHover`, with its pointer target grown to `--ui-target-size`.\n * In dev mode, an action with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t<SettingsIcon aria-hidden />\n * </Sidebar.MenuAction>\n * @example\n * <Sidebar.MenuAction showOnHover={false} aria-label={t(\"nav.starred\")}>\n * \t<StarIcon aria-hidden />\n * </Sidebar.MenuAction>\n */\nSidebar.MenuAction = function SidebarMenuAction(handle: Handle<Sidebar.MenuActionProps>) {\n\treturn () => {\n\t\tlet { showOnHover, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShowOnHover = showOnHover ?? DEFAULT_SHOW_ON_HOVER;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.MenuAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-action\"\n\t\t\t\tdata-show-on-hover={resolvedShowOnHover ? undefined : \"false\"}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small count or status pill pinned to the trailing edge of a\n * {@link Sidebar.MenuButton} or {@link Sidebar.MenuLink} row, hidden once\n * the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the pill's markup.\n * @example\n * <Sidebar.MenuLink href=\"/inbox\">\n * \t{t(\"nav.inbox\")}\n * \t<Sidebar.MenuBadge>24</Sidebar.MenuBadge>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuBadge = function SidebarMenuBadge(handle: Handle<Sidebar.MenuBadgeProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a static loading placeholder shaped like {@link Sidebar.MenuButton}:\n * an optional icon-shaped {@link Skeleton} block followed by a text-shaped\n * one; compose `pulse()` or `shimmer()` through `mix` for a loading cue.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <Sidebar.MenuSkeleton showIcon />\n * @example\n * <Sidebar.MenuSkeleton style={{ inlineSize: \"70%\" }} />\n */\nSidebar.MenuSkeleton = function SidebarMenuSkeleton(handle: Handle<Sidebar.MenuSkeletonProps>) {\n\treturn () => {\n\t\tlet { showIcon, mix, ...rest } = handle.props;\n\t\tlet resolvedShowIcon = showIcon ?? DEFAULT_SHOW_ICON;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-skeleton\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tbs(\"2.25rem\"),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{resolvedShowIcon && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"menu-skeleton-icon\"\n\t\t\t\t\t\tmix={[is(\"1rem\"), bs(\"1rem\"), shrink(), rounded(\"sm\"), bg(\"neutral.border\")]}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"menu-skeleton-text\"\n\t\t\t\t\tmix={[bs(\"1rem\"), grow(), is(\"60%\"), rounded(\"md\"), bg(\"neutral.border\")]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a nested list of sub-rows beneath a {@link Sidebar.MenuItem}: a\n * `<ul>` indented from and bordered against the rail's inline-start edge,\n * hidden once the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the nested list's markup.\n * @example\n * <Sidebar.MenuSub>\n * \t<Sidebar.MenuSubItem>\n * \t\t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * \t</Sidebar.MenuSubItem>\n * </Sidebar.MenuSub>\n */\nSidebar.MenuSub = function SidebarMenuSub(handle: Handle<Sidebar.MenuSubProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.MenuSub}: a plain `<li>`.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubItem>\n * \t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * </Sidebar.MenuSubItem>\n */\nSidebar.MenuSubItem = function SidebarMenuSubItem(handle: Handle<Sidebar.MenuSubItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <li {...rest} data-slot=\"menu-sub-item\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.MenuSub}, smaller and more muted than\n * {@link Sidebar.MenuButton}, marked current through `active`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubButton onClick={runQuickAction}>{t(\"nav.markAllRead\")}</Sidebar.MenuSubButton>\n */\nSidebar.MenuSubButton = function SidebarMenuSubButton(handle: Handle<Sidebar.MenuSubButtonProps>) {\n\treturn () => {\n\t\tlet { active, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub-button\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<a>` row for navigation inside {@link Sidebar.MenuSub},\n * visually identical to {@link Sidebar.MenuSubButton}. `active` sets\n * `aria-current=\"page\"` when `aria-current` is otherwise unset.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubLink href=\"/settings/profile\" active>{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n */\nSidebar.MenuSubLink = function SidebarMenuSubLink(handle: Handle<Sidebar.MenuSubLinkProps>) {\n\treturn () => {\n\t\tlet { active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-sub-link\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuSubButton} and\n * {@link Sidebar.MenuSubLink}.\n */\nfunction menuSubRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tminBs(\"2rem\"),\n\t\tis(\"full\"),\n\t\titems(\"center\"),\n\t\ttextAlign(\"start\"),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', weight(500)),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.5rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.625rem\"),\n\t\tpb(\"0.375rem\"),\n\t\tfg(\"neutral.muted\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a thin drag-styled affordance along {@link Sidebar}'s own edge,\n * toggling {@link Sidebar.Trigger}'s checkbox through a native `<label>`\n * association; marked `aria-hidden` since that checkbox is the accessible control.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar>\n * \t<Sidebar.Header>...</Sidebar.Header>\n * \t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * </Sidebar>\n */\nSidebar.Rail = function SidebarRail(handle: Handle<Sidebar.RailProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"rail\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\tz(20),\n\t\t\t\t\thidden(),\n\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\tafter([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the collapse toggle: a native, keyboard-reachable `<input type=\"checkbox\">`\n * in a button-styled `<label>` whose pointer target grows to `--ui-target-size`; its\n * `:checked` state drives every collapse rule in {@link Sidebar.Provider}.\n *\n * @param handle Runtime handle carrying the host checkbox's props.\n * @returns The render function producing the toggle's markup.\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" defaultChecked aria-label={t(\"nav.toggleSidebar\")} />\n */\nSidebar.Trigger = function SidebarTrigger(handle: Handle<Sidebar.TriggerProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"2rem\"),\n\t\t\t\t\tbs(\"2rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\twhen(\"& > svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<PanelLeftIcon />\n\t\t\t\t<input type=\"checkbox\" {...rest} data-slot=\"toggle\" mix={[visuallyHidden(), mix]} />\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders the shell's main content region: {@link ScrollArea.Viewport}\n * laid out as a growing flex column that resizes as {@link Sidebar}\n * collapses or expands, declaring {@link INSET_CONTAINER_NAME} for nested sizing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the inset's markup.\n * @example\n * <Sidebar.Inset>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t<main>{children}</main>\n * </Sidebar.Inset>\n */\nSidebar.Inset = function SidebarInset(handle: Handle<Sidebar.InsetProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"inset\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a hairline divider between two stretches of rail content:\n * identical to {@link Separator}, with the small block-axis and inline-axis\n * margins {@link Sidebar}'s own content regions expect around one.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Sidebar.Group>...</Sidebar.Group>\n * <Sidebar.Separator />\n * <Sidebar.Group>...</Sidebar.Group>\n */\nSidebar.Separator = function SidebarSeparator(handle: Handle<Sidebar.SeparatorProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Separator {...rest} data-slot=\"separator\" mix={[m(\"0.5rem\"), mix]} />;\n\t};\n};\n"
14
+ "content": "/**\n * An application shell's primary navigation rail, composed from a layout\n * root, a collapsible rail, a main-content inset, and a family of\n * group/menu/item parts for organizing links. Collapsing rides a single\n * checkbox's native `:checked` state, so the whole shell works with zero\n * library JavaScript.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { PanelLeftIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, borderEdge, colorMix, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, pseudoContent, userSelect, willChange } from \"@sdxc/u/general\";\nimport { var as varUtility } from \"@sdxc/u/general/var\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thidden,\n\tinlineFlex,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, supports } from \"@sdxc/u/responsive\";\nimport {\n\tbs,\n\tis,\n\tm,\n\tmaxBs,\n\tmaxIs,\n\tmbe,\n\tmbs,\n\tminBs,\n\tminIs,\n\tmis,\n\tp,\n\tpb,\n\tpbe,\n\tpbs,\n\tpi,\n\tpis,\n\tsafeAreaPadding,\n} from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { after, data, focusVisible, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty, translateProperty, translateX } from \"@sdxc/u/transform\";\nimport {\n\tfontSize,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttextTransform,\n\ttracking,\n\ttruncate,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\nimport { Separator } from \"@sdxc/ui/separator\";\n\n/** Visual treatment {@link Sidebar} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Sidebar.Variant = \"sidebar\";\n\n/** Collapse behavior {@link Sidebar} falls back to when `collapsible` is omitted. */\nconst DEFAULT_COLLAPSIBLE: Sidebar.Collapsible = \"offcanvas\";\n\n/**\n * Physical edge {@link Sidebar} docks against, and the edge\n * {@link Sidebar.MobileNav} slides in from, when `side` is omitted.\n */\nconst DEFAULT_SIDE: Sidebar.Side = \"left\";\n\n/** Semantic color role {@link Sidebar.Item} falls back to when `color` is omitted. */\nconst DEFAULT_ITEM_COLOR: Sidebar.Color = \"neutral\";\n\n/** Size variant {@link Sidebar.MenuButton} and {@link Sidebar.MenuLink} fall back to when `size` is omitted. */\nconst DEFAULT_MENU_BUTTON_SIZE: Sidebar.MenuButtonSize = \"md\";\n\n/** Whether {@link Sidebar.MenuAction} stays hidden until its row is hovered or focused, when `showOnHover` is omitted. */\nconst DEFAULT_SHOW_ON_HOVER = true;\n\n/** Whether {@link Sidebar.MenuSkeleton} renders a leading icon placeholder, when `showIcon` is omitted. */\nconst DEFAULT_SHOW_ICON = false;\n\n/** Prefetch mode {@link Sidebar.MenuLink} and {@link Sidebar.MenuSubLink} fall back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Sidebar.Prefetch = \"none\";\n\n/**\n * Named container {@link Sidebar.Provider} declares on its own host, so\n * {@link Sidebar} and {@link Sidebar.Rail} can query the shell's overall\n * width for room to show a persistent rail, regardless of nesting depth.\n */\nconst PROVIDER_CONTAINER_NAME = \"ui-sidebar-provider\";\n\n/**\n * Named container {@link Sidebar.Inset} declares on its own host, so content\n * rendered inside it — a Card, a Table, anything sized by its surroundings —\n * responds to the inset's own available width as the rail expands or collapses.\n */\nconst INSET_CONTAINER_NAME = \"ui-sidebar-inset\";\n\n/**\n * Container query matching a shell wide enough to host the persistent rail\n * alongside its inset; below this width, {@link Sidebar}'s `\"icon\"` and\n * `\"offcanvas\"` collapse modes step aside for {@link Sidebar.MobileNav}.\n */\nconst WIDE_SHELL_QUERY = `@container ${PROVIDER_CONTAINER_NAME} (min-width: 48rem)`;\n\n/**\n * Selector matching {@link Sidebar.Trigger}'s own checkbox input once it\n * carries the platform's native `:checked` state — the single source of\n * truth every collapse-driven rule in {@link Sidebar} reads from.\n */\nconst TOGGLE_CHECKED_SELECTOR = '[data-slot=\"toggle\"]:checked';\n\n/**\n * Resolves the `aria-current` value an anchor-based nav part renders with:\n * an explicit `aria-current` always wins, and a `current`/`active`\n * shorthand of `true` falls back to `\"page\"` when nothing else was given.\n */\nfunction resolveAriaCurrent(\n\tcurrent: boolean | undefined,\n\tariaCurrent: TagProps<\"a\">[\"aria-current\"],\n): TagProps<\"a\">[\"aria-current\"] {\n\treturn ariaCurrent ?? (current ? \"page\" : undefined);\n}\n\n/**\n * Prop types for {@link Sidebar} and its compound parts.\n */\nexport namespace Sidebar {\n\t/**\n\t * Visual treatment the rail renders with: `\"sidebar\"` sits flush against\n\t * its edge, `\"floating\"` insets itself with a margin, a rounded, shadowed\n\t * panel, and a blurred backdrop; `\"inset\"` renders the same panel without blur.\n\t */\n\texport type Variant = \"sidebar\" | \"floating\" | \"inset\";\n\n\t/**\n\t * How the rail collapses: `\"none\"` always renders at full width, `\"icon\"`\n\t * narrows to an icon-only rail, and `\"offcanvas\"` narrows to nothing. Every\n\t * mode but `\"none\"` yields to {@link Sidebar.MobileNav} on narrow shells.\n\t */\n\texport type Collapsible = \"none\" | \"offcanvas\" | \"icon\";\n\n\t/**\n\t * Physical edge of the shell the rail docks against and, for\n\t * {@link Sidebar.MobileNav}, slides in from. `\"left\"` and `\"right\"` name\n\t * that edge regardless of `dir`, staying pinned to one physical side.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/**\n\t * Semantic color role {@link Sidebar.Item} renders its current-page\n\t * treatment in, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Size variant controlling {@link Sidebar.MenuButton}'s and\n\t * {@link Sidebar.MenuLink}'s padding, font size, and icon size.\n\t */\n\texport type MenuButtonSize = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Establishes\n\t * the shell's row layout — {@link Sidebar} beside {@link Sidebar.Inset} —\n\t * plus the {@link PROVIDER_CONTAINER_NAME} container the collapse rules query.\n\t */\n\texport interface ProviderProps extends TagProps<\"div\"> {\n\t\t/** {@link Sidebar} and {@link Sidebar.Inset}, in either order. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<aside>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"aside\"> {\n\t\t/** Visual treatment. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Collapse behavior. Defaults to {@link DEFAULT_COLLAPSIBLE}. */\n\t\tcollapsible?: Collapsible;\n\t\t/** Physical docking edge. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every prop {@link Dialog.Props} accepts, plus `side`. `id` stays the id\n\t * a trigger elsewhere on the page opens this drawer with — see\n\t * {@link Dialog.Props} for the full Invoker Commands contract.\n\t */\n\texport interface MobileNavProps extends Dialog.Props {\n\t\t/** Physical edge to dock against and slide in from. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface ContentProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every native `<footer>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface FooterProps extends TagProps<\"footer\"> {}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface NavProps extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Item}, built as an intersection because\n\t * the underlying anchor prop type is a union keyed on `href` — the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type ItemProps = TagProps<\"a\"> & {\n\t\t/** Destination the item navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role applied once the item is current. Defaults to {@link DEFAULT_ITEM_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tcurrent?: boolean;\n\t};\n\n\t/**\n\t * Every native `<section>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"section\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupLabelProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupActionProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupContentProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough. Its own\n\t * `:hover`/`:focus-within` state reveals a nested {@link Sidebar.MenuAction}\n\t * that would otherwise stay hidden.\n\t */\n\texport interface MenuItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuButton}.\n\t */\n\texport interface MenuButtonProps extends TagProps<\"button\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuLink}. Built as an intersection for\n\t * the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t\t/**\n\t\t * `\"intent\"`/`\"viewport\"` write `data-rmx-prefetch`; `\"render\"` adds a `<link rel=\"prefetch\">`\n\t\t * that also serves full-document navigations, so keep it to the first few links, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n\n\t/**\n\t * When a {@link Sidebar.MenuLink} or {@link Sidebar.MenuSubLink} destination\n\t * starts loading, the same modes every link component in this library accepts.\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuAction}.\n\t */\n\texport interface MenuActionProps extends TagProps<\"button\"> {\n\t\t/**\n\t\t * Whether the control stays invisible until its ancestor\n\t\t * {@link Sidebar.MenuItem} is hovered or focused. Defaults to\n\t\t * {@link DEFAULT_SHOW_ON_HOVER}; set `false` to keep it always visible.\n\t\t */\n\t\tshowOnHover?: boolean;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuBadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSkeleton}.\n\t */\n\texport interface MenuSkeletonProps extends TagProps<\"div\"> {\n\t\t/** Whether to render a leading icon-shaped placeholder. Defaults to {@link DEFAULT_SHOW_ICON}. */\n\t\tshowIcon?: boolean;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubButton}.\n\t */\n\texport interface MenuSubButtonProps extends TagProps<\"button\"> {\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubLink}. Built as an intersection\n\t * for the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuSubLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t\t/**\n\t\t * `\"intent\"`/`\"viewport\"` write `data-rmx-prefetch`; `\"render\"` adds a `<link rel=\"prefetch\">`\n\t\t * that also serves full-document navigations, so keep it to the first few links, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.Rail}: every native `<label>` attribute\n\t * except `htmlFor`, narrowed to required since it names the id of\n\t * {@link Sidebar.Trigger}'s own checkbox, the control this rail mirrors.\n\t */\n\texport interface RailProps extends Omit<TagProps<\"label\">, \"htmlFor\"> {\n\t\t/** Id of the {@link Sidebar.Trigger} checkbox this rail toggles. */\n\t\thtmlFor: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Trigger}: every native `<input>`\n\t * attribute except `type` and `role`, fixed by the platform's checkbox\n\t * semantics, so `id`, `checked`, `defaultChecked`, and `disabled` all work.\n\t */\n\texport interface TriggerProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * control carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface InsetProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every prop {@link Separator.Props} accepts, unchanged.\n\t */\n\texport interface SeparatorProps extends Separator.Props {}\n}\n\n/**\n * Renders the rail itself: a native `<aside>` styled through its `data-*`\n * attributes, with collapse rules keyed off {@link Sidebar.Provider}'s `:has()`\n * state and declared after its base size, so both directions animate.\n *\n * @param handle Runtime handle carrying the host `<aside>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar variant=\"floating\" collapsible=\"icon\" side=\"right\">\n * \t\t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t\t<Sidebar.Content>{nav}</Sidebar.Content>\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nexport function Sidebar(handle: Handle<Sidebar.Props>) {\n\treturn () => {\n\t\tlet { variant, collapsible, side, mix, ...rest } = handle.props;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedCollapsible = collapsible ?? DEFAULT_COLLAPSIBLE;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<aside\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-collapsible={resolvedCollapsible}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-bg-tint)\", weight: 95 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\twhen(`[data-slot=\"provider\"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders the shell's layout root: a flex row placing {@link Sidebar} beside\n * {@link Sidebar.Inset}, whose subtree {@link Sidebar} watches for\n * {@link Sidebar.Trigger}'s checkbox reaching `:checked`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shell's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar collapsible=\"icon\">\n * \t\t<Sidebar.Header>\n * \t\t\t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t\t</Sidebar.Header>\n * \t\t<Sidebar.Content>\n * \t\t\t<Sidebar.Menu>\n * \t\t\t\t<Sidebar.MenuItem>\n * \t\t\t\t\t<Sidebar.MenuLink href=\"/dashboard\" active>\n * \t\t\t\t\t\t<HomeIcon aria-hidden />\n * \t\t\t\t\t\t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * \t\t\t\t\t</Sidebar.MenuLink>\n * \t\t\t\t</Sidebar.MenuItem>\n * \t\t\t</Sidebar.Menu>\n * \t\t</Sidebar.Content>\n * \t\t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nSidebar.Provider = function SidebarProvider(handle: Handle<Sidebar.ProviderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"provider\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the docked, edge-to-edge mobile substitute for {@link Sidebar}:\n * {@link Sidebar}'s nav content re-composed inside {@link Dialog}, docked\n * to `side` and opened via Invoker Commands, not a viewport check. A press\n * outside it closes it, which is the dismissal a touch device has.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the drawer's markup.\n * @example\n * <button commandfor=\"mobile-nav\" command=\"show-modal\" aria-label={t(\"nav.openMenu\")}>\n * \t<MenuIcon aria-hidden />\n * </button>\n * <Sidebar.MobileNav id=\"mobile-nav\" aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t<Sidebar.Content>{nav}</Sidebar.Content>\n * </Sidebar.MobileNav>\n */\nSidebar.MobileNav = function SidebarMobileNav(handle: Handle<Sidebar.MobileNavProps>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"mobile-nav\"\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * A press outside closes the drawer, the way a drawer is dismissed on a phone: a modal\n\t\t\t\t\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t */\n\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\tfixed(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tp(\"0\"),\n\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t}),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's header slot: a `<header>` laying out its children in\n * a centered row, block-sized to a fixed height with a divider border\n * below it and safe-area padding on its block-start edge.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Sidebar.Header>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * </Sidebar.Header>\n */\nSidebar.Header = function SidebarHeader(handle: Handle<Sidebar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * The slot paints the rail's background, so content scrolling behind a row held\n\t\t\t\t\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t */\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-end\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\tpbe(\"0.5rem\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's own scrollable nav region: {@link ScrollArea.Viewport}\n * laid out as a padded, gap-separated column that scrolls independently of\n * {@link Sidebar.Header} and {@link Sidebar.Footer} once it overflows.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content region's markup.\n * @example\n * <Sidebar.Content>\n * \t<Sidebar.Group>\n * \t\t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.Group>\n * </Sidebar.Content>\n */\nSidebar.Content = function SidebarContent(handle: Handle<Sidebar.ContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"1rem\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the rail's footer slot: a `<footer>` laying out its children in\n * a centered row with a divider border above it and safe-area padding on\n * its block-end edge.\n *\n * @param handle Runtime handle carrying the host `<footer>`'s props.\n * @returns The render function producing the footer slot's markup.\n * @example\n * <Sidebar.Footer>\n * \t<Sidebar.MenuButton>{t(\"nav.account\")}</Sidebar.MenuButton>\n * </Sidebar.Footer>\n */\nSidebar.Footer = function SidebarFooter(handle: Handle<Sidebar.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<footer\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a flat navigation list: a `<nav>` stacking its {@link Sidebar.Item}\n * children in a column with a small gap, suited to a rail with a simple,\n * ungrouped set of links.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Nav aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Item href=\"/dashboard\" current>{t(\"nav.dashboard\")}</Sidebar.Item>\n * \t<Sidebar.Item href=\"/settings\">{t(\"nav.settings\")}</Sidebar.Item>\n * </Sidebar.Nav>\n */\nSidebar.Nav = function SidebarNav(handle: Handle<Sidebar.NavProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} data-slot=\"nav\" mix={[vstack({ gap: \"0.25rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Nav}: a native `<a>` colored\n * through `data-color`, tinted once `aria-current` is set, matching\n * {@link Sidebar.MenuLink}; its focus ring always reads in that same color.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.Item href=\"/dashboard\" current>\n * \t<HomeIcon aria-hidden />\n * \t{t(\"nav.dashboard\")}\n * </Sidebar.Item>\n * @example\n * <Sidebar.Item href=\"/billing/cancel\" color=\"danger\" aria-current={pathname === \"/billing/cancel\" ? \"page\" : undefined}>\n * \t<XCircleIcon aria-hidden />\n * \t{t(\"nav.cancelPlan\")}\n * </Sidebar.Item>\n */\nSidebar.Item = function SidebarItem(handle: Handle<Sidebar.ItemProps>) {\n\treturn () => {\n\t\tlet { color, current, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_ITEM_COLOR;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(current, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tflex(),\n\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tweight(500),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a related cluster of {@link Sidebar.Menu} items: a `<section>`\n * stacking its children in a column, gaining a divider border and extra\n * space above itself whenever it follows another {@link Sidebar.Group}.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Sidebar.Group>\n * \t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t<Sidebar.GroupContent>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.GroupContent>\n * </Sidebar.Group>\n */\nSidebar.Group = function SidebarGroup(handle: Handle<Sidebar.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s label: a small, muted, uppercase heading\n * row, visually clipped once the ancestor {@link Sidebar} collapses to\n * icon-only, while staying announced to assistive technology.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n */\nSidebar.GroupLabel = function SidebarGroupLabel(handle: Handle<Sidebar.GroupLabelProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-label\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small icon-only action button anchored to {@link Sidebar.GroupLabel}'s\n * trailing edge, its pointer target grown to `--ui-target-size`. In dev mode, an\n * action with no plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.GroupLabel>\n * \t{t(\"nav.workspace\")}\n * \t<Sidebar.GroupAction aria-label={t(\"nav.addWorkspace\")}>\n * \t\t<PlusIcon aria-hidden />\n * \t</Sidebar.GroupAction>\n * </Sidebar.GroupLabel>\n */\nSidebar.GroupAction = function SidebarGroupAction(handle: Handle<Sidebar.GroupActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.GroupAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-action\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s body slot: a `<div>` stacking its children\n * — typically a {@link Sidebar.Menu} — in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the body slot's markup.\n * @example\n * <Sidebar.GroupContent>\n * \t<Sidebar.Menu>...</Sidebar.Menu>\n * </Sidebar.GroupContent>\n */\nSidebar.GroupContent = function SidebarGroupContent(handle: Handle<Sidebar.GroupContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"group-content\" mix={[vstack({ gap: \"0.125rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a list of nav rows: a native `<ul>` stacking {@link Sidebar.MenuItem}\n * children in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Menu>\n * \t<Sidebar.MenuItem>\n * \t\t<Sidebar.MenuLink href=\"/dashboard\">{t(\"nav.dashboard\")}</Sidebar.MenuLink>\n * \t</Sidebar.MenuItem>\n * </Sidebar.Menu>\n */\nSidebar.Menu = function SidebarMenu(handle: Handle<Sidebar.MenuProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu\"\n\t\t\t\tmix={[is(\"full\"), minIs(\"0\"), vstack({ gap: \"0.125rem\" }), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Menu}: a relatively positioned\n * `<li>` whose own `:hover`/`:focus-within` state reveals a nested\n * {@link Sidebar.MenuAction} that stays invisible at rest.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuItem>\n * \t<Sidebar.MenuLink href=\"/inbox\">{t(\"nav.inbox\")}</Sidebar.MenuLink>\n * \t<Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t\t<SettingsIcon aria-hidden />\n * \t</Sidebar.MenuAction>\n * </Sidebar.MenuItem>\n */\nSidebar.MenuItem = function SidebarMenuItem(handle: Handle<Sidebar.MenuItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-item\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\t/**\n\t\t\t\t\t * A plain row centres what it holds and a row carrying a sub-menu stacks, putting the\n\t\t\t\t\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\topacity(100),\n\t\t\t\t\t),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.Menu}, sized through `data-size` and marked current via\n * `active`; its leading icon is muted, and a trailing label truncates.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuButton onClick={openCommandPalette}>\n * \t<SearchIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.search\")}</span>\n * </Sidebar.MenuButton>\n */\nSidebar.MenuButton = function SidebarMenuButton(handle: Handle<Sidebar.MenuButtonProps>) {\n\treturn () => {\n\t\tlet { size, active, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-button\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<a>` row for navigation inside {@link Sidebar.Menu},\n * visually identical to {@link Sidebar.MenuButton} and followed by its `<link\n * rel=\"prefetch\">` when `prefetch=\"render\"`. `active` sets `aria-current=\"page\"` when unset.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuLink href=\"/dashboard\" active>\n * \t<HomeIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * </Sidebar.MenuLink>\n * @example\n * <Sidebar.MenuLink href=\"/inbox\" prefetch=\"intent\">{t(\"nav.inbox\")}</Sidebar.MenuLink>\n */\nSidebar.MenuLink = function SidebarMenuLink(handle: Handle<Sidebar.MenuLinkProps>) {\n\treturn () => {\n\t\tlet { size, active, prefetch, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\tlet anchor = (\n\t\t\t<a\n\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-link\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\n\t\tif (!rendersPrefetchHint(resolvedPrefetch, rest.href)) return anchor;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{anchor}\n\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t</>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuButton} and\n * {@link Sidebar.MenuLink}, factored out since the two differ only in host\n * element and how their current/active state is expressed.\n */\nfunction menuRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tis(\"full\"),\n\t\tminIs(\"0\"),\n\t\titems(\"center\"),\n\t\toverflow(\"hidden\"),\n\t\ttextAlign(\"start\"),\n\t\tweight(500),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\toutlineStyle(\"none\"),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\tis(\"1rem\"),\n\t\t\tbs(\"1rem\"),\n\t\t\tshrink(),\n\t\t]),\n\t\twhen(\"& > span\", truncate()),\n\t\tdata(\"size\", \"sm\", [\n\t\t\tminBs(\"1.75rem\"),\n\t\t\tpb(\"0.375rem\"),\n\t\t\tfontSize(\"xs\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"0.875rem\"),\n\t\t\t\tbs(\"0.875rem\"),\n\t\t\t]),\n\t\t]),\n\t\tdata(\"size\", \"md\", minBs(\"2.25rem\")),\n\t\tdata(\"size\", \"lg\", [\n\t\t\tminBs(\"2.75rem\"),\n\t\t\tpb(\"0.625rem\"),\n\t\t\tfontSize(\"base\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"1.25rem\"),\n\t\t\t\tbs(\"1.25rem\"),\n\t\t\t]),\n\t\t]),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.75rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.5rem\"),\n\t\tpb(\"0.5rem\"),\n\t\tfg(\"neutral\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.muted\")),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.emphasis\")),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s trailing\n * edge, revealed by `showOnHover`, with its pointer target grown to `--ui-target-size`.\n * In dev mode, an action with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t<SettingsIcon aria-hidden />\n * </Sidebar.MenuAction>\n * @example\n * <Sidebar.MenuAction showOnHover={false} aria-label={t(\"nav.starred\")}>\n * \t<StarIcon aria-hidden />\n * </Sidebar.MenuAction>\n */\nSidebar.MenuAction = function SidebarMenuAction(handle: Handle<Sidebar.MenuActionProps>) {\n\treturn () => {\n\t\tlet { showOnHover, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShowOnHover = showOnHover ?? DEFAULT_SHOW_ON_HOVER;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.MenuAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-action\"\n\t\t\t\tdata-show-on-hover={resolvedShowOnHover ? undefined : \"false\"}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small count or status pill pinned to the trailing edge of a\n * {@link Sidebar.MenuButton} or {@link Sidebar.MenuLink} row, hidden once\n * the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the pill's markup.\n * @example\n * <Sidebar.MenuLink href=\"/inbox\">\n * \t{t(\"nav.inbox\")}\n * \t<Sidebar.MenuBadge>24</Sidebar.MenuBadge>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuBadge = function SidebarMenuBadge(handle: Handle<Sidebar.MenuBadgeProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a static loading placeholder shaped like {@link Sidebar.MenuButton}:\n * an optional icon-shaped {@link Skeleton} block followed by a text-shaped\n * one; compose `pulse()` or `shimmer()` through `mix` for a loading cue.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <Sidebar.MenuSkeleton showIcon />\n * @example\n * <Sidebar.MenuSkeleton style={{ inlineSize: \"70%\" }} />\n */\nSidebar.MenuSkeleton = function SidebarMenuSkeleton(handle: Handle<Sidebar.MenuSkeletonProps>) {\n\treturn () => {\n\t\tlet { showIcon, mix, ...rest } = handle.props;\n\t\tlet resolvedShowIcon = showIcon ?? DEFAULT_SHOW_ICON;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-skeleton\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tbs(\"2.25rem\"),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{resolvedShowIcon && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"menu-skeleton-icon\"\n\t\t\t\t\t\tmix={[is(\"1rem\"), bs(\"1rem\"), shrink(), rounded(\"sm\"), bg(\"neutral.border\")]}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"menu-skeleton-text\"\n\t\t\t\t\tmix={[bs(\"1rem\"), grow(), is(\"60%\"), rounded(\"md\"), bg(\"neutral.border\")]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a nested list of sub-rows beneath a {@link Sidebar.MenuItem}: a\n * `<ul>` indented from and bordered against the rail's inline-start edge,\n * hidden once the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the nested list's markup.\n * @example\n * <Sidebar.MenuSub>\n * \t<Sidebar.MenuSubItem>\n * \t\t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * \t</Sidebar.MenuSubItem>\n * </Sidebar.MenuSub>\n */\nSidebar.MenuSub = function SidebarMenuSub(handle: Handle<Sidebar.MenuSubProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.MenuSub}: a plain `<li>`.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubItem>\n * \t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * </Sidebar.MenuSubItem>\n */\nSidebar.MenuSubItem = function SidebarMenuSubItem(handle: Handle<Sidebar.MenuSubItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <li {...rest} data-slot=\"menu-sub-item\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.MenuSub}, smaller and more muted than\n * {@link Sidebar.MenuButton}, marked current through `active`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubButton onClick={runQuickAction}>{t(\"nav.markAllRead\")}</Sidebar.MenuSubButton>\n */\nSidebar.MenuSubButton = function SidebarMenuSubButton(handle: Handle<Sidebar.MenuSubButtonProps>) {\n\treturn () => {\n\t\tlet { active, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub-button\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<a>` row for navigation inside {@link Sidebar.MenuSub},\n * visually identical to {@link Sidebar.MenuSubButton} and followed by its `<link\n * rel=\"prefetch\">` when `prefetch=\"render\"`. `active` sets `aria-current=\"page\"` when unset.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubLink href=\"/settings/profile\" active>{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n */\nSidebar.MenuSubLink = function SidebarMenuSubLink(handle: Handle<Sidebar.MenuSubLinkProps>) {\n\treturn () => {\n\t\tlet { active, prefetch, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\tlet anchor = (\n\t\t\t<a\n\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-sub-link\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\n\t\tif (!rendersPrefetchHint(resolvedPrefetch, rest.href)) return anchor;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{anchor}\n\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t</>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuSubButton} and\n * {@link Sidebar.MenuSubLink}.\n */\nfunction menuSubRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tminBs(\"2rem\"),\n\t\tis(\"full\"),\n\t\titems(\"center\"),\n\t\ttextAlign(\"start\"),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', weight(500)),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.5rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.625rem\"),\n\t\tpb(\"0.375rem\"),\n\t\tfg(\"neutral.muted\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a thin drag-styled affordance along {@link Sidebar}'s own edge,\n * toggling {@link Sidebar.Trigger}'s checkbox through a native `<label>`\n * association; marked `aria-hidden` since that checkbox is the accessible control.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar>\n * \t<Sidebar.Header>...</Sidebar.Header>\n * \t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * </Sidebar>\n */\nSidebar.Rail = function SidebarRail(handle: Handle<Sidebar.RailProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"rail\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\tz(20),\n\t\t\t\t\thidden(),\n\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\tafter([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the collapse toggle: a native, keyboard-reachable `<input type=\"checkbox\">`\n * in a button-styled `<label>` whose pointer target grows to `--ui-target-size`; its\n * `:checked` state drives every collapse rule in {@link Sidebar.Provider}.\n *\n * @param handle Runtime handle carrying the host checkbox's props.\n * @returns The render function producing the toggle's markup.\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" defaultChecked aria-label={t(\"nav.toggleSidebar\")} />\n */\nSidebar.Trigger = function SidebarTrigger(handle: Handle<Sidebar.TriggerProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"2rem\"),\n\t\t\t\t\tbs(\"2rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\twhen(\"& > svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<PanelLeftIcon />\n\t\t\t\t<input type=\"checkbox\" {...rest} data-slot=\"toggle\" mix={[visuallyHidden(), mix]} />\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders the shell's main content region: {@link ScrollArea.Viewport}\n * laid out as a growing flex column that resizes as {@link Sidebar}\n * collapses or expands, declaring {@link INSET_CONTAINER_NAME} for nested sizing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the inset's markup.\n * @example\n * <Sidebar.Inset>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t<main>{children}</main>\n * </Sidebar.Inset>\n */\nSidebar.Inset = function SidebarInset(handle: Handle<Sidebar.InsetProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"inset\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a hairline divider between two stretches of rail content:\n * identical to {@link Separator}, with the small block-axis and inline-axis\n * margins {@link Sidebar}'s own content regions expect around one.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Sidebar.Group>...</Sidebar.Group>\n * <Sidebar.Separator />\n * <Sidebar.Group>...</Sidebar.Group>\n */\nSidebar.Separator = function SidebarSeparator(handle: Handle<Sidebar.SeparatorProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Separator {...rest} data-slot=\"separator\" mix={[m(\"0.5rem\"), mix]} />;\n\t};\n};\n"
15
15
  },
16
16
  "test": {
17
17
  "path": "sidebar.test.tsx",
18
- "content": "/**\n * Tests for {@link \"./sidebar\"}, covering the rail slots a consumer holds\n * against the viewport: a header or footer that lets the rail's background\n * show through paints the scrolling nav behind it in plain sight, so each\n * slot's own paint is asserted over `renderToString`'s output, as is the drawer\n * staying hidden while closed.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Sidebar } from \"@sdxc/ui/sidebar\";\n\ndescribe(\"Sidebar.Header\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Header>sdxc</Sidebar.Header>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar.Footer\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Footer>account</Sidebar.Footer>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar\", () => {\n\ttest(\"declares its collapsed size after its open size, so collapsing wins and animates\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.Provider>\n\t\t\t\t\t<Sidebar collapsible=\"offcanvas\">nav</Sidebar>\n\t\t\t\t\t<Sidebar.Inset>page</Sidebar.Inset>\n\t\t\t\t</Sidebar.Provider>,\n\t\t\t),\n\t\t);\n\n\t\tlet open = html.indexOf(\"inline-size: var(--sidebar-width, 16rem)\");\n\t\tlet collapsed = html.search(\n\t\t\t/data-collapsible=\"offcanvas\"\\]\\[data-side=\"left\"\\][^{]*\\{[^}]*inline-size: 0/,\n\t\t);\n\n\t\texpect(open).toBeGreaterThan(-1);\n\t\texpect(collapsed).toBeGreaterThan(open);\n\t});\n});\n\ndescribe(\"Sidebar.MobileNav\", () => {\n\ttest(\"lays the drawer out only while it is open, so a closed one stays hidden\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.MobileNav id=\"mobile-nav\" aria-label=\"Main\">\n\t\t\t\t\tnav\n\t\t\t\t</Sidebar.MobileNav>,\n\t\t\t),\n\t\t);\n\t\tlet css = [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)]\n\t\t\t.map((match) => match[1])\n\t\t\t.join(\"\\n\");\n\n\t\tlet displays = css.match(/display:\\s*flex/g) ?? [];\n\t\tlet gated = css.match(/&\\[open\\]\\s*\\{\\s*display:\\s*flex/g) ?? [];\n\n\t\texpect(displays.length).toBeGreaterThan(0);\n\t\texpect(gated.length).toBe(displays.length);\n\t});\n});\n\ndescribe(\"small sidebar controls\", () => {\n\ttest.each([\n\t\t[\"Sidebar.GroupAction\", <Sidebar.GroupAction aria-label=\"Add\">+</Sidebar.GroupAction>],\n\t\t[\"Sidebar.MenuAction\", <Sidebar.MenuAction aria-label=\"Settings\">…</Sidebar.MenuAction>],\n\t\t[\"Sidebar.Trigger\", <Sidebar.Trigger id=\"toggle\" aria-label=\"Toggle sidebar\" />],\n\t])(\"%s grows its pointer target to the minimum target size\", async (_, node) => {\n\t\tlet html = String(await renderToString(node));\n\n\t\texpect(html).toContain(\"--ui-target-size\");\n\t\texpect(html).toMatch(/position:\\s*relative|position:\\s*absolute/);\n\t});\n});\n"
18
+ "content": "/**\n * Tests for {@link \"./sidebar\"}, covering the rail slots a consumer holds\n * against the viewport: a header or footer that lets the rail's background\n * show through paints the scrolling nav behind it in plain sight, so each\n * slot's own paint is asserted over `renderToString`'s output, as is the drawer\n * staying hidden while closed and the markup each link prefetch mode writes.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Sidebar } from \"@sdxc/ui/sidebar\";\n\ndescribe(\"Sidebar.Header\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Header>sdxc</Sidebar.Header>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar.Footer\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Footer>account</Sidebar.Footer>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar\", () => {\n\ttest(\"declares its collapsed size after its open size, so collapsing wins and animates\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.Provider>\n\t\t\t\t\t<Sidebar collapsible=\"offcanvas\">nav</Sidebar>\n\t\t\t\t\t<Sidebar.Inset>page</Sidebar.Inset>\n\t\t\t\t</Sidebar.Provider>,\n\t\t\t),\n\t\t);\n\n\t\tlet open = html.indexOf(\"inline-size: var(--sidebar-width, 16rem)\");\n\t\tlet collapsed = html.search(\n\t\t\t/data-collapsible=\"offcanvas\"\\]\\[data-side=\"left\"\\][^{]*\\{[^}]*inline-size: 0/,\n\t\t);\n\n\t\texpect(open).toBeGreaterThan(-1);\n\t\texpect(collapsed).toBeGreaterThan(open);\n\t});\n});\n\ndescribe(\"Sidebar.MobileNav\", () => {\n\ttest(\"lays the drawer out only while it is open, so a closed one stays hidden\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.MobileNav id=\"mobile-nav\" aria-label=\"Main\">\n\t\t\t\t\tnav\n\t\t\t\t</Sidebar.MobileNav>,\n\t\t\t),\n\t\t);\n\t\tlet css = [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)]\n\t\t\t.map((match) => match[1])\n\t\t\t.join(\"\\n\");\n\n\t\tlet displays = css.match(/display:\\s*flex/g) ?? [];\n\t\tlet gated = css.match(/&\\[open\\]\\s*\\{\\s*display:\\s*flex/g) ?? [];\n\n\t\texpect(displays.length).toBeGreaterThan(0);\n\t\texpect(gated.length).toBe(displays.length);\n\t});\n});\n\ndescribe(\"small sidebar controls\", () => {\n\ttest.each([\n\t\t[\"Sidebar.GroupAction\", <Sidebar.GroupAction aria-label=\"Add\">+</Sidebar.GroupAction>],\n\t\t[\"Sidebar.MenuAction\", <Sidebar.MenuAction aria-label=\"Settings\">…</Sidebar.MenuAction>],\n\t\t[\"Sidebar.Trigger\", <Sidebar.Trigger id=\"toggle\" aria-label=\"Toggle sidebar\" />],\n\t])(\"%s grows its pointer target to the minimum target size\", async (_, node) => {\n\t\tlet html = String(await renderToString(node));\n\n\t\texpect(html).toContain(\"--ui-target-size\");\n\t\texpect(html).toMatch(/position:\\s*relative|position:\\s*absolute/);\n\t});\n});\n\ndescribe(\"Sidebar.MenuLink prefetch\", () => {\n\ttest(\"writes neither the attribute nor a hint by default\", async () => {\n\t\tlet html = await renderToString(<Sidebar.MenuLink href=\"/next\">Inbox</Sidebar.MenuLink>);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\n\t\t'writes data-rmx-prefetch=\"%s\" on the anchor and renders no hint',\n\t\tasync (mode) => {\n\t\t\tlet html = await renderToString(\n\t\t\t\t<Sidebar.MenuLink href=\"/next\" prefetch={mode}>\n\t\t\t\t\tInbox\n\t\t\t\t</Sidebar.MenuLink>,\n\t\t\t);\n\n\t\t\texpect(html).toMatch(new RegExp(`<a[^>]*data-rmx-prefetch=\"${mode}\"`));\n\t\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t\t},\n\t);\n\n\ttest('renders a prefetch hint after the anchor, without the attribute, for \"render\"', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Sidebar.MenuLink href=\"/next\" prefetch=\"render\">\n\t\t\t\tInbox\n\t\t\t</Sidebar.MenuLink>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).toMatch(/<\\/a><link rel=\"prefetch\" href=\"\\/next\"\\s*\\/?>/);\n\t});\n\n\ttest('renders no hint for \"render\" when the anchor has no destination', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Sidebar.MenuLink href=\"\" prefetch=\"render\">\n\t\t\t\tInbox\n\t\t\t</Sidebar.MenuLink>,\n\t\t);\n\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n});\n\ndescribe(\"Sidebar.MenuSubLink prefetch\", () => {\n\ttest(\"writes neither the attribute nor a hint by default\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Sidebar.MenuSubLink href=\"/next\">Profile</Sidebar.MenuSubLink>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n\n\ttest.each([\"intent\", \"viewport\"] as const)(\n\t\t'writes data-rmx-prefetch=\"%s\" on the anchor and renders no hint',\n\t\tasync (mode) => {\n\t\t\tlet html = await renderToString(\n\t\t\t\t<Sidebar.MenuSubLink href=\"/next\" prefetch={mode}>\n\t\t\t\t\tProfile\n\t\t\t\t</Sidebar.MenuSubLink>,\n\t\t\t);\n\n\t\t\texpect(html).toMatch(new RegExp(`<a[^>]*data-rmx-prefetch=\"${mode}\"`));\n\t\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t\t},\n\t);\n\n\ttest('renders a prefetch hint after the anchor, without the attribute, for \"render\"', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Sidebar.MenuSubLink href=\"/next\" prefetch=\"render\">\n\t\t\t\tProfile\n\t\t\t</Sidebar.MenuSubLink>,\n\t\t);\n\n\t\texpect(html).not.toContain(\"data-rmx-prefetch\");\n\t\texpect(html).toMatch(/<\\/a><link rel=\"prefetch\" href=\"\\/next\"\\s*\\/?>/);\n\t});\n\n\ttest('renders no hint for \"render\" when the anchor has no destination', async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Sidebar.MenuSubLink href=\"\" prefetch=\"render\">\n\t\t\t\tProfile\n\t\t\t</Sidebar.MenuSubLink>,\n\t\t);\n\n\t\texpect(html).not.toContain('rel=\"prefetch\"');\n\t});\n});\n"
19
19
  }
20
20
  }
@@ -48,7 +48,7 @@
48
48
  "@sdxc/ui": "0.0.1",
49
49
  "@sdxc/user-agent": "0.0.1",
50
50
  "@sdxc/well-known": "0.0.1",
51
- "remix": "3.0.0"
51
+ "remix": "3.1.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@cloudflare/vite-plugin": "2.0.0-beta.sha-ad79608dd",