@sdxc/kit 2026.11.26 → 2026.11.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.jsonl +193 -0
- package/dist/pkg/catalog.js +1 -0
- package/dist/scaffold/render.js +2 -2
- package/package.json +2 -2
- package/registry/ui/anchor-heading.json +19 -0
- package/registry/ui/autocomplete.json +3 -3
- package/registry/ui/banner.json +3 -3
- package/registry/ui/button.json +3 -3
- package/registry/ui/callout.json +16 -0
- package/registry/ui/checkbox.json +2 -2
- package/registry/ui/code-block.json +18 -0
- package/registry/ui/confirm.json +3 -3
- package/registry/ui/copy-button.json +14 -0
- package/registry/ui/date-field.json +4 -7
- package/registry/ui/date-picker.json +3 -5
- package/registry/ui/date-range-picker.json +2 -3
- package/registry/ui/dialog-dismiss.json +2 -2
- package/registry/ui/field-parts.json +30 -0
- package/registry/ui/filter-links.json +16 -0
- package/registry/ui/form.json +3 -3
- package/registry/ui/lightbox.json +3 -3
- package/registry/ui/listbox.json +2 -2
- package/registry/ui/media-grid.json +3 -3
- package/registry/ui/pager.json +16 -0
- package/registry/ui/property-list.json +3 -3
- package/registry/ui/radio-group.json +2 -2
- package/registry/ui/range-calendar.json +2 -2
- package/registry/ui/range-months.json +3 -3
- package/registry/ui/rating-input.json +3 -3
- package/registry/ui/rating.json +3 -3
- package/registry/ui/review-card.json +3 -3
- package/registry/ui/search-field.json +6 -3
- package/registry/ui/section-bar.json +3 -3
- package/registry/ui/sidebar.json +2 -2
- package/registry/ui/table-of-contents.json +17 -0
- package/registry/ui/text-field.json +5 -9
- package/registry/ui/time-field.json +4 -7
- package/registry/ui/timeline.json +3 -3
- package/registry/ui/typeset.json +2 -2
package/registry/ui/sidebar.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sidebar",
|
|
3
|
-
"changedIn": "2026.11.
|
|
3
|
+
"changedIn": "2026.11.29",
|
|
4
4
|
"dependencies": [
|
|
5
5
|
"dialog",
|
|
6
6
|
"scroll-area",
|
|
@@ -11,7 +11,7 @@
|
|
|
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, mergeMix } 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\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\t\"transparent\",\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\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\t\"transparent\",\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\t\twhen(`[data-slot=\"provider\"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\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\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\t/**\n\t\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\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\t\tfixed(),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tm(\"0\"),\n\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\tp(\"0\"),\n\t\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\t\teasing: easings.decelerate,\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\t/**\n\t\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\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tborderEdge(\"block-end\", {\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: 80 },\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\tgap(\"0.5rem\"),\n\t\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\t\tpbe(\"0.5rem\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"1rem\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\titems(\"center\"),\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: 80 },\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\tgap(\"0.5rem\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\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 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={mergeMix(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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\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 {@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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\t\tweight(600),\n\t\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\t],\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 (\n\t\t\t<div {...rest} data-slot=\"group-content\" mix={mergeMix(vstack({ gap: \"0.125rem\" }), mix)} />\n\t\t);\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={mergeMix([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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t/**\n\t\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\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\t\topacity(100),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuRowMixins(),\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 `<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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuRowMixins(),\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\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\t],\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\t\tweight(600),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral\"),\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 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={mergeMix(\n\t\t\t\t\t[flex(), items(\"center\"), bs(\"2.25rem\"), gap(\"0.75rem\"), pi(\"0.5rem\"), rounded(\"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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\t\tborder(\"neutral\"),\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 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 (\n\t\t\t<li {...rest} data-slot=\"menu-sub-item\" mix={mergeMix([flex(), items(\"center\")], mix)} />\n\t\t);\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuSubRowMixins(),\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 `<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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuSubRowMixins(),\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\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\t\tz(20),\n\t\t\t\t\t\thidden(),\n\t\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\t\tafter([\n\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\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 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={mergeMix(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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\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 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={mergeMix(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, raw, userSelect, willChange, mergeMix } 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/** The current menu row's text and icon colour. */\nconst CURRENT_ROW_FG = \"var(--ui-sidebar-link-current-fg, var(--ui-neutral-fg-emphasis))\";\n\n/** The font size each menu row size falls back to when the theme sets no `--ui-text-*` step. */\nconst ROW_FONT_FALLBACKS = { xs: \"0.75rem\", sm: \"0.875rem\", base: \"1rem\" } as const;\n\n/** A menu badge's resting background. */\nconst BADGE_BG = \"var(--ui-sidebar-badge-bg, var(--ui-neutral-bg-tint-hover))\";\n\n/** A menu badge's resting text colour. */\nconst BADGE_FG = \"var(--ui-sidebar-badge-fg, var(--ui-neutral-fg))\";\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 * The custom properties menu rows and their badges read, set through `mix` or `style` on\n\t * any ancestor (the {@link Sidebar}, a {@link Sidebar.Menu}) or on one row. Each falls back\n\t * to the default look; the `link` ones style {@link Sidebar.MenuButton} rows too.\n\t */\n\texport interface CustomProperties {\n\t\t/** The current row's background. */\n\t\t\"--ui-sidebar-link-current-bg\"?: string;\n\t\t/** The current row's text and icon colour. */\n\t\t\"--ui-sidebar-link-current-fg\"?: string;\n\t\t/** A row's background under the pointer. */\n\t\t\"--ui-sidebar-link-hover-bg\"?: string;\n\t\t/** A row's minimum height at every `size`, in place of each size's own. */\n\t\t\"--ui-sidebar-link-block-size\"?: string;\n\t\t/** A row's corner radius. */\n\t\t\"--ui-sidebar-link-radius\"?: string;\n\t\t/** A row's font size at every `size`, in place of each size's own. */\n\t\t\"--ui-sidebar-link-font-size\"?: string;\n\t\t/** A badge's background. */\n\t\t\"--ui-sidebar-badge-bg\"?: string;\n\t\t/** A badge's text colour. */\n\t\t\"--ui-sidebar-badge-fg\"?: string;\n\t\t/** A badge's background in the current row; its resting background by default. */\n\t\t\"--ui-sidebar-badge-current-bg\"?: string;\n\t\t/** A badge's text colour in the current row; its resting colour by default. */\n\t\t\"--ui-sidebar-badge-current-fg\"?: string;\n\t}\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\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\t\"transparent\",\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\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\t\"transparent\",\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\t\twhen(`[data-slot=\"provider\"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\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\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\t/**\n\t\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\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\t\tfixed(),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tm(\"0\"),\n\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\tp(\"0\"),\n\t\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\t\teasing: easings.decelerate,\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\t/**\n\t\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\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tborderEdge(\"block-end\", {\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: 80 },\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\tgap(\"0.5rem\"),\n\t\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\t\tpbe(\"0.5rem\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"1rem\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\titems(\"center\"),\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: 80 },\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\tgap(\"0.5rem\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\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 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={mergeMix(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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tweight(500),\n\t\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdata(\n\t\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\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 {@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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\t\tweight(600),\n\t\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\t],\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 (\n\t\t\t<div {...rest} data-slot=\"group-content\" mix={mergeMix(vstack({ gap: \"0.125rem\" }), mix)} />\n\t\t);\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={mergeMix([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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t/**\n\t\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\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\t\topacity(100),\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 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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuRowMixins(),\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 `<a>` row for navigation inside {@link Sidebar.Menu}, visually identical to\n * {@link Sidebar.MenuButton}, followed by its `<link rel=\"prefetch\">` when `prefetch=\"render\"`.\n * `active` sets `aria-current=\"page\"`; restyle rows through {@link Sidebar.CustomProperties}.\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuRowMixins(),\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\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\traw({ fontSize: rowFontSize(\"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\traw({ minBlockSize: rowBlockSize(\"1.75rem\") }),\n\t\t\tpb(\"0.375rem\"),\n\t\t\traw({ fontSize: rowFontSize(\"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\", raw({ minBlockSize: rowBlockSize(\"2.25rem\") })),\n\t\tdata(\"size\", \"lg\", [\n\t\t\traw({ minBlockSize: rowBlockSize(\"2.75rem\") }),\n\t\t\tpb(\"0.625rem\"),\n\t\t\traw({ fontSize: rowFontSize(\"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\traw({ borderRadius: \"var(--ui-sidebar-link-radius, var(--ui-radius-lg, 0.5rem))\" }),\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([\n\t\t\traw({\n\t\t\t\tbackgroundColor: \"var(--ui-sidebar-link-hover-bg, var(--ui-neutral-bg-tint-hover))\",\n\t\t\t}),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t]),\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\traw({\n\t\t\t\tbackgroundColor: \"var(--ui-sidebar-link-current-bg, var(--ui-neutral-bg-tint-hover))\",\n\t\t\t\tcolor: CURRENT_ROW_FG,\n\t\t\t}),\n\t\t\twhen(\n\t\t\t\t\"& > svg:first-child, & > [data-slot='icon']:first-child\",\n\t\t\t\traw({ color: CURRENT_ROW_FG }),\n\t\t\t),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/** A row's font size: the caller's `--ui-sidebar-link-font-size`, else the size's own step. */\nfunction rowFontSize(step: \"xs\" | \"sm\" | \"base\"): string {\n\treturn `var(--ui-sidebar-link-font-size, var(--ui-text-${step}, ${ROW_FONT_FALLBACKS[step]}))`;\n}\n\n/** A row's minimum height: the caller's `--ui-sidebar-link-block-size`, else the size's own. */\nfunction rowBlockSize(fallback: string): string {\n\treturn `var(--ui-sidebar-link-block-size, ${fallback})`;\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\t],\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 menu row, hidden once\n * the ancestor {@link Sidebar} collapses to its icon-only rail; its colours, current row's\n * included, read the `--ui-sidebar-badge-*` {@link Sidebar.CustomProperties}.\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\t\tweight(600),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tbackgroundColor: BADGE_BG,\n\t\t\t\t\t\t\tcolor: BADGE_FG,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t':is([data-slot=\"menu-link\"], [data-slot=\"menu-button\"]):is([data-active], [aria-current]:not([aria-current=\"false\"])) > &',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tbackgroundColor: `var(--ui-sidebar-badge-current-bg, ${BADGE_BG})`,\n\t\t\t\t\t\t\t\tcolor: `var(--ui-sidebar-badge-current-fg, ${BADGE_FG})`,\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\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={mergeMix(\n\t\t\t\t\t[flex(), items(\"center\"), bs(\"2.25rem\"), gap(\"0.75rem\"), pi(\"0.5rem\"), rounded(\"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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\t\tborder(\"neutral\"),\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 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 (\n\t\t\t<li {...rest} data-slot=\"menu-sub-item\" mix={mergeMix([flex(), items(\"center\")], mix)} />\n\t\t);\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuSubRowMixins(),\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 `<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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t...menuSubRowMixins(),\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\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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\t\tz(20),\n\t\t\t\t\t\thidden(),\n\t\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\t\tafter([\n\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\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 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={mergeMix(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={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexCol(),\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\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 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={mergeMix(m(\"0.5rem\"), mix)} />;\n\t};\n};\n"
|
|
15
15
|
},
|
|
16
16
|
"test": {
|
|
17
17
|
"path": "sidebar.test.tsx",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "table-of-contents",
|
|
3
|
+
"changedIn": "2026.11.29",
|
|
4
|
+
"dependencies": [],
|
|
5
|
+
"exports": [
|
|
6
|
+
"TableOfContents",
|
|
7
|
+
"TOC_MIN_ITEMS"
|
|
8
|
+
],
|
|
9
|
+
"source": {
|
|
10
|
+
"path": "table-of-contents.tsx",
|
|
11
|
+
"content": "/**\n * Island: a docs page's own headings as an \"On this page\" list, as a rail beside the prose\n * or a sticky bar on a narrow screen. The links work as plain anchors; once it loads a\n * marker slides over every section on screen and the bar names the section being read.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { EntryComponent, Handle } from \"remix/component\";\n\nimport { ChevronDownIcon, ListIcon } from \"@sdxc/icons\";\nimport { bg, borderEdge, fg, stroke } from \"@sdxc/u/color\";\nimport { rounded, transition, transitionDuration } from \"@sdxc/u/effects\";\nimport { listStyle, raw } from \"@sdxc/u/general\";\nimport { absolute, block, hidden, hstack, insIs, relative, shrink, vstack } from \"@sdxc/u/layout\";\nimport { overflowY } from \"@sdxc/u/overflow\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { is, m, maxBs, minBs, minIs, mis, p, pi, pis } from \"@sdxc/u/size\";\nimport { hover, when } from \"@sdxc/u/state\";\nimport { rotate } from \"@sdxc/u/transform\";\nimport { text, truncate, weight } from \"@sdxc/u/typography\";\nimport { clientEntry } from \"remix/component\";\n\nimport { tocSpy } from \"@sdxc/ui/mixins\";\n\n/** The shallowest heading level the list offers, which every indent is measured from. */\nconst BASE_LEVEL = 2;\n\n/** How far each heading level below {@link BASE_LEVEL} sets an item in, in rem. */\nconst INDENT_STEP = 0.75;\n\n/**\n * Width below which the bar names only its label: beside a menu button there is room for\n * a letter or two of the section, which reads as noise rather than a name.\n */\nconst NARROW_BAR = \"(max-width: 22.4375rem)\";\n\n/** Circumference of the bar's progress ring (radius 7), which its dash pattern spans. */\nconst RING = 43.98;\n\n/** Shared easing for the marker and ring, a quick start that settles softly. */\nconst SETTLE = \"cubic-bezier(0.32, 0.72, 0, 1)\";\n\n/** Prop types for {@link TableOfContents}. */\nexport namespace TableOfContents {\n\t/** One heading the list links to; `level` 2 sits flush and each deeper level indents. */\n\texport type Item = { id: string; text: string; level: number };\n\n\t/** Plain data only, since the props cross into the browser with the island. */\n\texport type Props = {\n\t\titems: Item[];\n\t\t/** The list's visible heading and the landmark's accessible name (\"On this page\"). */\n\t\tlabel: string;\n\t\t/**\n\t\t * `rail` lists the headings under the label, for the column beside the prose; `bar`\n\t\t * folds them into a disclosure whose summary names the section being read.\n\t\t * @default \"rail\"\n\t\t */\n\t\tlayout?: \"rail\" | \"bar\";\n\t\t/**\n\t\t * Fewest headings that earn a list; a shorter page renders nothing, so a layout can\n\t\t * test the same number to drop its rail column.\n\t\t * @default 2\n\t\t */\n\t\tminItems?: number;\n\t};\n}\n\n/**\n * Renders the in-page navigation, or nothing when the page has fewer than `minItems`\n * headings. Load `@sdxc/ui/table-of-contents` in the browser entry. Headings that the\n * page's layout gives a `scroll-margin-top` set the line a section is read from.\n *\n * @example\n * <TableOfContents items={anchors} label=\"On this page\" />\n * @example\n * <TableOfContents items={anchors} label=\"On this page\" layout=\"bar\" />\n */\nexport const TableOfContents: EntryComponent<TableOfContents.Props> = clientEntry(\n\t\"@sdxc/ui/table-of-contents#TableOfContents\",\n\tfunction TableOfContents(handle: Handle<TableOfContents.Props>) {\n\t\treturn () => {\n\t\t\tlet { items, label, layout = \"rail\", minItems = TOC_MIN_ITEMS } = handle.props;\n\t\t\tif (items.length < minItems) return null;\n\n\t\t\tlet list = <TocList items={items} />;\n\n\t\t\tif (layout === \"bar\") {\n\t\t\t\treturn (\n\t\t\t\t\t<details data-toc=\"bar\" mix={[relative(), minIs(0), raw({ flex: \"1 1 auto\" })]}>\n\t\t\t\t\t\t<summary\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\thstack({ gap: 2, align: \"center\" }),\n\t\t\t\t\t\t\t\tminBs(\"2.75rem\"),\n\t\t\t\t\t\t\t\tpi(3, 0),\n\t\t\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\tlistStyle(\"none\"),\n\t\t\t\t\t\t\t\traw({ cursor: \"pointer\" }),\n\t\t\t\t\t\t\t\twhen(\"&::-webkit-details-marker\", hidden()),\n\t\t\t\t\t\t\t\twhen(\"&:focus-visible\", raw({ outlineOffset: \"-2px\" })),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ProgressRing />\n\t\t\t\t\t\t\t<span mix={[shrink(0), fg(\"neutral.emphasis\"), weight(\"medium\")]}>{label}</span>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdata-toc-reading=\"\"\n\t\t\t\t\t\t\t\taria-live=\"off\"\n\t\t\t\t\t\t\t\tmix={[minIs(0), truncate(), media(NARROW_BAR, hidden())]}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ChevronDownIcon\n\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\t\tshrink(0),\n\t\t\t\t\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t\t\t\t\ttransition(\"transform\"),\n\t\t\t\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionDuration(\"0s\")),\n\t\t\t\t\t\t\t\t\twhen(\"[open] > summary > &\", rotate(180)),\n\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</summary>\n\n\t\t\t\t\t\t<nav\n\t\t\t\t\t\t\taria-label={label}\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\t\traw({ insetInline: 0, insetBlockStart: \"100%\" }),\n\t\t\t\t\t\t\t\tmaxBs(\"min(60dvh, 28rem)\"),\n\t\t\t\t\t\t\t\toverflowY(\"auto\"),\n\t\t\t\t\t\t\t\tp(3, 4),\n\t\t\t\t\t\t\t\tbg(\"neutral.bg-tint\"),\n\t\t\t\t\t\t\t\tborderEdge(\"block-end\", { color: \"neutral.border\", width: 1, style: \"solid\" }),\n\t\t\t\t\t\t\t\traw({ boxShadow: \"var(--ui-shadow-float, none)\" }),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{list}\n\t\t\t\t\t\t</nav>\n\t\t\t\t\t</details>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<nav data-toc=\"rail\" aria-label={label} mix={[vstack({ gap: 3 })]}>\n\t\t\t\t\t<p\n\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\tm(0),\n\t\t\t\t\t\t\thstack({ gap: 2, align: \"center\" }),\n\t\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ListIcon size={14} aria-hidden=\"true\" />\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</p>\n\t\t\t\t\t{list}\n\t\t\t\t</nav>\n\t\t\t);\n\t\t};\n\t},\n);\n\n/** Fewest headings that earn a list when `minItems` is unset. */\nexport const TOC_MIN_ITEMS = 2;\n\nnamespace TocList {\n\texport interface Props {\n\t\titems: TableOfContents.Item[];\n\t}\n}\n\n/**\n * The links on a guide line, with one marker that {@link tocSpy} stretches over the\n * sections on screen. The marker stays invisible until the spy has placed it once.\n */\nfunction TocList(handle: Handle<TocList.Props>) {\n\treturn () => (\n\t\t<div mix={[relative(), tocSpy()]}>\n\t\t\t<span\n\t\t\t\tdata-toc-marker=\"\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\traw({\n\t\t\t\t\t\tinsetBlockStart: 0,\n\t\t\t\t\t\tblockSize: \"var(--toc-marker-size, 0px)\",\n\t\t\t\t\t\ttransform: \"translateY(var(--toc-marker-start, 0px))\",\n\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\ttransition: `transform 300ms ${SETTLE}, block-size 300ms ${SETTLE}, opacity 150ms ease-out`,\n\t\t\t\t\t}),\n\t\t\t\t\tinsIs(0),\n\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\twhen(\"[data-toc-ready] > &\", raw({ opacity: 1 })),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", raw({ transition: \"opacity 150ms linear\" })),\n\t\t\t\t]}\n\t\t\t/>\n\t\t\t<ul\n\t\t\t\tmix={[\n\t\t\t\t\tvstack({ gap: 0 }),\n\t\t\t\t\tm(0),\n\t\t\t\t\tp(0),\n\t\t\t\t\tlistStyle(\"none\"),\n\t\t\t\t\tborderEdge(\"inline-start\", { color: \"neutral.border\", width: 1, style: \"solid\" }),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{handle.props.items.map((item) => {\n\t\t\t\t\tlet depth = Math.max(item.level - BASE_LEVEL, 0);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={item.id}>\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref={`#${item.id}`}\n\t\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\t\tblock(),\n\t\t\t\t\t\t\t\t\traw({ textWrap: \"pretty\" }),\n\t\t\t\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\t\tp(1.5, 0),\n\t\t\t\t\t\t\t\t\tpis(`${INDENT_STEP + depth * INDENT_STEP}rem`),\n\t\t\t\t\t\t\t\t\ttransition(\"color\"),\n\t\t\t\t\t\t\t\t\thover(fg(\"neutral.emphasis\")),\n\t\t\t\t\t\t\t\t\twhen(\"&[data-active]\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t\t\t\t\twhen('&[data-active=\"lead\"]', [fg(\"brand\"), weight(\"medium\")]),\n\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{item.text}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n\n/**\n * An 18px ring in the bar that fills as the reader moves down the list, read from the\n * `--toc-progress` the spy sets on the bar; empty before it loads.\n */\nfunction ProgressRing() {\n\treturn () => (\n\t\t<svg\n\t\t\twidth=\"18\"\n\t\t\theight=\"18\"\n\t\t\tviewBox=\"0 0 18 18\"\n\t\t\taria-hidden=\"true\"\n\t\t\tmix={[shrink(0), rotate(-90)]}\n\t\t>\n\t\t\t<circle cx=\"9\" cy=\"9\" r=\"7\" fill=\"none\" stroke-width=\"2\" mix={[stroke(\"neutral.border\")]} />\n\t\t\t<circle\n\t\t\t\tcx=\"9\"\n\t\t\t\tcy=\"9\"\n\t\t\t\tr=\"7\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tmix={[\n\t\t\t\t\tstroke(\"brand.solid\"),\n\t\t\t\t\traw({\n\t\t\t\t\t\tstrokeDasharray: `${RING}px`,\n\t\t\t\t\t\tstrokeDashoffset: `calc(${RING}px * (1 - var(--toc-progress, 0)))`,\n\t\t\t\t\t\ttransition: `stroke-dashoffset 300ms ${SETTLE}`,\n\t\t\t\t\t}),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", raw({ transition: \"none\" })),\n\t\t\t\t]}\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n"
|
|
12
|
+
},
|
|
13
|
+
"test": {
|
|
14
|
+
"path": "table-of-contents.browser.test.tsx",
|
|
15
|
+
"content": "/**\n * Tests for {@link TableOfContents} in a real browser: the marker reaches the last section\n * at the bottom of the page, follows a jump, stays inside a short scrolling rail, and the\n * bar names the section being read and closes once one of its links is followed.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { RenderResult } from \"remix/component/test\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\n\nimport { sectionsInView } from \"@sdxc/ui/mixins\";\n\nimport { TableOfContents } from \"@sdxc/ui/table-of-contents\";\n\nlet mounted: RenderResult | undefined;\n\nafterEach(() => {\n\tmounted?.cleanup();\n\tmounted = undefined;\n\tdocument.body.innerHTML = \"\";\n\tscrollTo(0, 0);\n});\n\n/** Twelve sections, the last one short, so its heading never reaches the top of the screen. */\nconst ITEMS: TableOfContents.Item[] = Array.from({ length: 12 }, (_, index) => ({\n\tid: `section-${index + 1}`,\n\ttext: `Section ${index + 1}`,\n\tlevel: index % 3 === 2 ? 3 : 2,\n}));\n\n/** Waits two frames, so a scroll's recount has run. */\nfunction settle(): Promise<void> {\n\treturn new Promise((resolve) =>\n\t\trequestAnimationFrame(() => requestAnimationFrame(() => resolve())),\n\t);\n}\n\n/** Mounts a long article with the list beside it, the rail capped at `railHeight`. */\nfunction mountPage(layout: \"rail\" | \"bar\" = \"rail\", railHeight = \"auto\") {\n\tmounted = render(\n\t\t<div>\n\t\t\t<div\n\t\t\t\tid=\"rail\"\n\t\t\t\tstyle={`position: fixed; inset-block-start: 0; inset-inline-end: 0; inline-size: 200px; max-block-size: ${railHeight}; overflow-y: auto`}\n\t\t\t>\n\t\t\t\t<TableOfContents items={ITEMS} label=\"On this page\" layout={layout} />\n\t\t\t</div>\n\t\t\t<article style=\"inline-size: 400px\">\n\t\t\t\t{ITEMS.map((item, index) => (\n\t\t\t\t\t<section key={item.id}>\n\t\t\t\t\t\t<h2 id={item.id} style=\"margin: 0\">\n\t\t\t\t\t\t\t{item.text}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t<p style={`margin: 0; block-size: ${index === ITEMS.length - 1 ? 80 : 600}px`}>Body</p>\n\t\t\t\t\t</section>\n\t\t\t\t))}\n\t\t\t</article>\n\t\t</div>,\n\t);\n}\n\n/** The list's links by `data-active` value. */\nfunction marks() {\n\tlet links = [...document.querySelectorAll<HTMLAnchorElement>(\"[data-toc] a\")];\n\treturn {\n\t\tlead: links.find((link) => link.dataset.active === \"lead\")?.textContent,\n\t\tactive: links\n\t\t\t.filter((link) => link.dataset.active !== undefined)\n\t\t\t.map((link) => link.textContent),\n\t};\n}\n\ndescribe(\"TableOfContents\", () => {\n\ttest(\"renders nothing under minItems\", () => {\n\t\tmounted = render(<TableOfContents items={ITEMS.slice(0, 1)} label=\"On this page\" />);\n\t\texpect(document.querySelector(\"nav\")).toBeNull();\n\t});\n\n\ttest(\"names its landmark and keeps plain anchors\", () => {\n\t\tmountPage();\n\t\tlet nav = document.querySelector('nav[aria-label=\"On this page\"]');\n\t\texpect(nav).not.toBeNull();\n\t\texpect(nav!.querySelectorAll('a[href^=\"#section-\"]')).toHaveLength(ITEMS.length);\n\t});\n\n\ttest(\"marks the first section at the top and every section on screen\", async () => {\n\t\tmountPage();\n\t\tawait settle();\n\t\tlet { lead, active } = marks();\n\t\texpect(lead).toBe(\"Section 1\");\n\t\texpect(active.length).toBeGreaterThanOrEqual(1);\n\t\texpect(active[0]).toBe(\"Section 1\");\n\t});\n\n\ttest(\"marks the last section at the bottom of the page\", async () => {\n\t\tmountPage();\n\t\tscrollTo(0, document.documentElement.scrollHeight);\n\t\tawait settle();\n\t\texpect(marks().active).toContain(`Section ${ITEMS.length}`);\n\t});\n\n\ttest(\"follows a jump to a heading\", async () => {\n\t\tmountPage();\n\t\tdocument.getElementById(\"section-6\")!.scrollIntoView();\n\t\tawait settle();\n\t\texpect(marks().lead).toBe(\"Section 6\");\n\t});\n\n\ttest(\"stretches the marker over the marked links once placed\", async () => {\n\t\tmountPage();\n\t\tdocument.getElementById(\"section-4\")!.scrollIntoView();\n\t\tawait settle();\n\t\tlet marker = document.querySelector<HTMLElement>(\"[data-toc-marker]\")!;\n\t\tlet lead = document.querySelector<HTMLElement>('[data-active=\"lead\"]')!;\n\t\tawait new Promise((resolve) => setTimeout(resolve, 350));\n\t\tlet markerBox = marker.getBoundingClientRect();\n\t\texpect(getComputedStyle(marker).opacity).toBe(\"1\");\n\t\texpect(markerBox.height).toBeGreaterThan(0);\n\t\texpect(Math.abs(markerBox.top - lead.getBoundingClientRect().top)).toBeLessThan(1);\n\t});\n\n\ttest(\"keeps the lead link inside a rail shorter than the list\", async () => {\n\t\tmountPage(\"rail\", \"120px\");\n\t\tscrollTo(0, document.documentElement.scrollHeight);\n\t\tawait settle();\n\t\tlet rail = document.getElementById(\"rail\")!.getBoundingClientRect();\n\t\tlet lead = document.querySelector<HTMLElement>('[data-active=\"lead\"]')!.getBoundingClientRect();\n\t\texpect(lead.top).toBeGreaterThanOrEqual(rail.top);\n\t\texpect(lead.bottom).toBeLessThanOrEqual(rail.bottom);\n\t});\n\n\ttest(\"bar names the section being read and fills its ring\", async () => {\n\t\tmountPage(\"bar\");\n\t\tdocument.getElementById(\"section-3\")!.scrollIntoView();\n\t\tawait settle();\n\t\tlet bar = document.querySelector<HTMLDetailsElement>('[data-toc=\"bar\"]')!;\n\t\texpect(bar.querySelector(\"[data-toc-reading]\")!.textContent).toBe(\"Section 3\");\n\t\texpect(Number(bar.style.getPropertyValue(\"--toc-progress\"))).toBeCloseTo(3 / ITEMS.length);\n\t});\n\n\ttest(\"bar closes once a link inside it is followed\", async () => {\n\t\tmountPage(\"bar\");\n\t\tlet bar = document.querySelector<HTMLDetailsElement>('[data-toc=\"bar\"]')!;\n\t\tbar.open = true;\n\t\tbar.querySelector<HTMLAnchorElement>('a[href=\"#section-5\"]')!.click();\n\t\texpect(bar.open).toBe(false);\n\t});\n});\n\n/**\n * Replaces the article the way a client-side navigation does: new heading elements under\n * the same ids, the list kept in place with one link pointing somewhere new.\n */\nfunction navigate() {\n\tlet article = document.querySelector(\"article\")!;\n\tarticle.innerHTML = ITEMS.map(\n\t\t(item, index) =>\n\t\t\t`<section><h2 id=\"${index === 1 ? \"renamed\" : item.id}\" style=\"margin: 0\">${item.text}</h2><p style=\"margin: 0; block-size: 600px\">New body</p></section>`,\n\t).join(\"\");\n\tfor (let link of document.querySelectorAll<HTMLAnchorElement>(\n\t\t'[data-toc] a[href=\"#section-2\"]',\n\t)) {\n\t\tlink.setAttribute(\"href\", \"#renamed\");\n\t\tlink.textContent = \"Renamed\";\n\t}\n}\n\ndescribe(\"TableOfContents after a client-side navigation\", () => {\n\ttest(\"marks the new page's sections and keeps the marker drawn\", async () => {\n\t\tmountPage();\n\t\tdocument.getElementById(\"section-4\")!.scrollIntoView();\n\t\tawait settle();\n\t\texpect(marks().lead).toBe(\"Section 4\");\n\n\t\tnavigate();\n\t\tdocument.getElementById(\"renamed\")!.scrollIntoView();\n\t\tawait settle();\n\t\texpect(marks().lead).toBe(\"Renamed\");\n\t\tlet marker = document.querySelector<HTMLElement>(\"[data-toc-marker]\")!;\n\t\texpect(Number.parseFloat(marker.style.getPropertyValue(\"--toc-marker-size\"))).toBeGreaterThan(\n\t\t\t0,\n\t\t);\n\t});\n\n\ttest(\"refills the bar's ring and names the new page's section\", async () => {\n\t\tmountPage(\"bar\");\n\t\tscrollTo(0, document.documentElement.scrollHeight);\n\t\tawait settle();\n\t\tlet bar = document.querySelector<HTMLDetailsElement>('[data-toc=\"bar\"]')!;\n\t\tlet atBottom = Number(bar.style.getPropertyValue(\"--toc-progress\"));\n\t\texpect(atBottom).toBeGreaterThan(0.5);\n\n\t\tnavigate();\n\t\tscrollTo(0, 0);\n\t\tawait settle();\n\t\texpect(Number(bar.style.getPropertyValue(\"--toc-progress\"))).toBeLessThan(atBottom);\n\t\texpect(bar.querySelector(\"[data-toc-reading]\")!.textContent).toBe(\"Section 1\");\n\t});\n});\n\ndescribe(\"sectionsInView\", () => {\n\ttest(\"counts a section whose heading has scrolled past while its body fills the screen\", () => {\n\t\texpect(sectionsInView([-500, 900], { top: 0, bottom: 800 }, false)).toEqual([0]);\n\t});\n\n\ttest(\"credits the last section at the bottom even below the fold\", () => {\n\t\texpect(sectionsInView([-900, -100, 820], { top: 0, bottom: 800 }, true)).toEqual([1, 2]);\n\t});\n});\n"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "text-field",
|
|
3
|
-
"changedIn": "2026.11.
|
|
3
|
+
"changedIn": "2026.11.29",
|
|
4
4
|
"dependencies": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"form",
|
|
8
|
-
"group",
|
|
9
|
-
"input",
|
|
10
|
-
"label"
|
|
5
|
+
"field-parts",
|
|
6
|
+
"input"
|
|
11
7
|
],
|
|
12
8
|
"exports": [
|
|
13
9
|
"TextField"
|
|
14
10
|
],
|
|
15
11
|
"source": {
|
|
16
12
|
"path": "text-field.tsx",
|
|
17
|
-
"content": "/**\n * A
|
|
13
|
+
"content": "/**\n * A labeled, described and validated single-line text field: the root renders the\n * control from its native attributes, and the caller writes the caption, description,\n * error and addons as parts. Every id and `aria-describedby` link between them comes\n * from this instance's own identifier, leaving no id bookkeeping to the caller.\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 {\n\tFieldDescription,\n\tFieldErrorMessage,\n\tFieldLabel,\n\tFieldPrefix,\n\tFieldScope,\n\tFieldSuffix,\n\twireField,\n} from \"@sdxc/ui/field-parts\";\nimport { Input } from \"@sdxc/ui/input\";\n\n/** Native `<input>` `type` {@link TextField} falls back to when `type` is omitted. */\nconst DEFAULT_TYPE: TextField.Type = \"text\";\n\n/**\n * Prop types for {@link TextField} and its parts.\n */\nexport namespace TextField {\n\t/**\n\t * Semantic color role for the control's keyboard focus ring, each mapped\n\t * to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Native `<input>` `type` this field renders a single-line, text-like\n\t * control for. A checkbox, radio, or file control each has its own\n\t * dedicated component instead of a `type` value here.\n\t */\n\texport type Type = \"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\";\n\n\t/**\n\t * Props accepted by {@link TextField}. `mix` and the remaining native attributes\n\t * style the root element; the control's own native attributes are listed below,\n\t * and `children` holds the field's parts.\n\t */\n\texport interface Props extends Omit<TagProps<\"div\">, \"prefix\"> {\n\t\t/** Semantic color role for the control's focus ring. Defaults to `\"neutral\"` when omitted. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Native `autofocus`. Defaults to `true` for the first invalid field of\n\t\t * an enclosing {@link Form}'s `issues`, landing keyboard focus on the\n\t\t * problem with no client JavaScript; pass explicitly to override.\n\t\t */\n\t\tautoFocus?: boolean;\n\t\t/** Native `<input>` `type`. Defaults to {@link DEFAULT_TYPE}. */\n\t\ttype?: Type;\n\t\t/** Native `name`; it also finds the enclosing {@link Form}'s issue for this field. */\n\t\tname?: string;\n\t\tvalue?: string;\n\t\tdefaultValue?: string;\n\t\tplaceholder?: string;\n\t\trequired?: boolean;\n\t\tdisabled?: boolean;\n\t\treadOnly?: boolean;\n\t\tautoComplete?: string;\n\t\tpattern?: string;\n\t\tminLength?: number;\n\t\tmaxLength?: number;\n\t\t/**\n\t\t * The field's parts: `.Label`, `.Description`, `.Error`, `.Prefix` and `.Suffix`.\n\t\t * The control follows the caption, the addons join it, and the rest keep their order.\n\t\t */\n\t\tchildren?: RemixNode;\n\t}\n\n\t/** Props accepted by {@link TextField.Label}: a native `<label>` pointing at the control. */\n\texport interface LabelProps extends FieldScope.LabelProps {}\n\t/** Props accepted by {@link TextField.Description}: a native `<p>` the control describes itself by. */\n\texport interface DescriptionProps extends FieldScope.DescriptionProps {}\n\t/** Props accepted by {@link TextField.Error}: a native `<span>` holding the message. */\n\texport interface ErrorProps extends FieldScope.ErrorProps {}\n\t/** Props accepted by {@link TextField.Prefix}: a native `<label>` joined to the control's leading edge. */\n\texport interface PrefixProps extends FieldScope.AddonProps {}\n\t/** Props accepted by {@link TextField.Suffix}: a native `<label>` joined to the control's trailing edge. */\n\texport interface SuffixProps extends FieldScope.AddonProps {}\n}\n\n/**\n * Renders a text field: the control from the native attributes, laid out with the parts\n * the caller writes. A `.Prefix` or `.Suffix` joins the control as one bordered field; an\n * enclosing {@link Form}'s issue for `name` shows as the error when no `.Error` is written.\n *\n * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.\n * @returns The render function producing the field's markup.\n * @example\n * <TextField type=\"email\" name=\"email\" required>\n * \t<TextField.Label>{t(\"form.email.label\")}</TextField.Label>\n * </TextField>\n * @example\n * <TextField name=\"slug\">\n * \t<TextField.Label>{t(\"settings.slug.label\")}</TextField.Label>\n * \t<TextField.Prefix>pulse.dev/</TextField.Prefix>\n * \t<TextField.Description>{t(\"settings.slug.hint\")}</TextField.Description>\n * </TextField>\n * @example\n * <TextField name=\"username\" defaultValue=\"ab\">\n * \t<TextField.Label>{t(\"form.username.label\")}</TextField.Label>\n * \t<TextField.Error>{t(\"form.username.tooShort\")}</TextField.Error>\n * </TextField>\n */\nexport function TextField(handle: Handle<TextField.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tautoFocus,\n\t\t\ttype,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\tpattern,\n\t\t\tminLength,\n\t\t\tmaxLength,\n\t\t\t\"aria-invalid\": ariaInvalid,\n\t\t\tchildren,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet field = wireField(handle, {\n\t\t\tslot: \"text-field\",\n\t\t\tchildren,\n\t\t\tname,\n\t\t\tcolor,\n\t\t\tautoFocus,\n\t\t\tariaInvalid,\n\t\t});\n\n\t\treturn (\n\t\t\t<FieldScope {...rest} context={field.context}>\n\t\t\t\t{field.arrange(\n\t\t\t\t\t<Input\n\t\t\t\t\t\t{...field.control}\n\t\t\t\t\t\ttype={(type ?? DEFAULT_TYPE) as never}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\tpattern={pattern}\n\t\t\t\t\t\tminLength={minLength}\n\t\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t\t/>,\n\t\t\t\t)}\n\t\t\t</FieldScope>\n\t\t);\n\t};\n}\n\nTextField.Label = FieldLabel;\nTextField.Description = FieldDescription;\nTextField.Error = FieldErrorMessage;\nTextField.Prefix = FieldPrefix;\nTextField.Suffix = FieldSuffix;\n"
|
|
18
14
|
},
|
|
19
15
|
"test": {
|
|
20
16
|
"path": "text-field.browser.test.tsx",
|
|
21
|
-
"content": "/**\n * Lays a text field with a prefix or suffix out in a real browser: the addon and the\n * input share one border with rounding on the outer corners only, the addon describes\n * the input and focuses it when clicked, and the field's rings wrap the whole group.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\nimport type { RenderResult } from \"remix/component/test\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { page, userEvent } from \"vitest/browser\";\n\nimport { Group } from \"@sdxc/ui/group\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { TextField } from \"@sdxc/ui/text-field\";\n\nimport \"@sdxc/ui/reset.css\";\nimport \"@sdxc/ui/theme.css\";\n\nlet mounted: RenderResult | undefined;\n\nafterEach(async () => {\n\tmounted?.cleanup();\n\tmounted = undefined;\n\tdocument.body.replaceChildren();\n\tawait page.viewport(1280, 800);\n});\n\n/** Mounts `node` in a host `width` pixels wide and returns the host. */\nfunction mount(node: JSX.Element, width = 480): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = `${width}px`;\n\thost.style.padding = \"8px\";\n\tdocument.body.appendChild(host);\n\tmounted = render(node, { container: host });\n\treturn host;\n}\n\n/** The parts of the one field rendered in `host`. */\nfunction parts(host: HTMLElement) {\n\tlet input = host.querySelector<HTMLInputElement>(\"input\")!;\n\tlet addons = [...host.querySelectorAll<HTMLElement>('[data-slot=\"group-text\"]')];\n\tlet group = input.parentElement!;\n\treturn { input, addons, group };\n}\n\n/** Whether an element's computed outline is drawn. */\nfunction hasOutline(element: Element): boolean {\n\tlet style = getComputedStyle(element);\n\treturn style.outlineStyle !== \"none\" && Number.parseFloat(style.outlineWidth) > 0;\n}\n\ndescribe(\"TextField with a prefix or suffix\", () => {\n\ttest(\"joins the prefix to the input as one bordered field, rounded on the outer corners only\", () => {\n\t\tlet host = mount(<TextField
|
|
17
|
+
"content": "/**\n * Lays a text field with a prefix or suffix out in a real browser: the addon and the\n * input share one border with rounding on the outer corners only, the addon describes\n * the input and focuses it when clicked, and the field's rings wrap the whole group.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\nimport type { RenderResult } from \"remix/component/test\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { page, userEvent } from \"vitest/browser\";\n\nimport { Group } from \"@sdxc/ui/group\";\nimport { Input } from \"@sdxc/ui/input\";\nimport { TextField } from \"@sdxc/ui/text-field\";\n\nimport \"@sdxc/ui/reset.css\";\nimport \"@sdxc/ui/theme.css\";\n\nlet mounted: RenderResult | undefined;\n\nafterEach(async () => {\n\tmounted?.cleanup();\n\tmounted = undefined;\n\tdocument.body.replaceChildren();\n\tawait page.viewport(1280, 800);\n});\n\n/** Mounts `node` in a host `width` pixels wide and returns the host. */\nfunction mount(node: JSX.Element, width = 480): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = `${width}px`;\n\thost.style.padding = \"8px\";\n\tdocument.body.appendChild(host);\n\tmounted = render(node, { container: host });\n\treturn host;\n}\n\n/** The parts of the one field rendered in `host`. */\nfunction parts(host: HTMLElement) {\n\tlet input = host.querySelector<HTMLInputElement>(\"input\")!;\n\tlet addons = [...host.querySelectorAll<HTMLElement>('[data-slot=\"group-text\"]')];\n\tlet group = input.parentElement!;\n\treturn { input, addons, group };\n}\n\n/** Whether an element's computed outline is drawn. */\nfunction hasOutline(element: Element): boolean {\n\tlet style = getComputedStyle(element);\n\treturn style.outlineStyle !== \"none\" && Number.parseFloat(style.outlineWidth) > 0;\n}\n\ndescribe(\"TextField with a prefix or suffix\", () => {\n\ttest(\"joins the prefix to the input as one bordered field, rounded on the outer corners only\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"slug\">\n\t\t\t\t<TextField.Label>Workspace URL</TextField.Label>\n\t\t\t\t<TextField.Prefix>pulse.dev/</TextField.Prefix>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, addons } = parts(host);\n\t\tlet [prefix] = addons;\n\t\tlet prefixStyle = getComputedStyle(prefix!);\n\t\tlet inputStyle = getComputedStyle(input);\n\n\t\texpect(addons).toHaveLength(1);\n\t\texpect(prefix!.textContent).toBe(\"pulse.dev/\");\n\t\texpect(prefixStyle.borderTopWidth).toBe(\"1px\");\n\t\texpect(\n\t\t\tMath.abs(prefix!.getBoundingClientRect().right - input.getBoundingClientRect().left),\n\t\t).toBeLessThanOrEqual(1);\n\t\texpect(prefix!.getBoundingClientRect().height).toBeCloseTo(\n\t\t\tinput.getBoundingClientRect().height,\n\t\t\t0,\n\t\t);\n\n\t\texpect(Number.parseFloat(prefixStyle.borderStartStartRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(prefixStyle.borderEndStartRadius)).toBeGreaterThan(0);\n\t\texpect(prefixStyle.borderStartEndRadius).toBe(\"0px\");\n\t\texpect(prefixStyle.borderEndEndRadius).toBe(\"0px\");\n\t\texpect(inputStyle.borderStartStartRadius).toBe(\"0px\");\n\t\texpect(inputStyle.borderEndStartRadius).toBe(\"0px\");\n\t\texpect(Number.parseFloat(inputStyle.borderStartEndRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(inputStyle.borderEndEndRadius)).toBeGreaterThan(0);\n\t});\n\n\ttest(\"rounds a suffix on its trailing corners and the input on its leading ones\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"timeout\" type=\"number\">\n\t\t\t\t<TextField.Label>Timeout</TextField.Label>\n\t\t\t\t<TextField.Suffix>ms</TextField.Suffix>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, addons } = parts(host);\n\t\tlet [suffix] = addons;\n\t\tlet suffixStyle = getComputedStyle(suffix!);\n\t\tlet inputStyle = getComputedStyle(input);\n\n\t\texpect(\n\t\t\tMath.abs(input.getBoundingClientRect().right - suffix!.getBoundingClientRect().left),\n\t\t).toBeLessThanOrEqual(1);\n\t\texpect(suffixStyle.borderStartStartRadius).toBe(\"0px\");\n\t\texpect(Number.parseFloat(suffixStyle.borderStartEndRadius)).toBeGreaterThan(0);\n\t\texpect(Number.parseFloat(inputStyle.borderStartStartRadius)).toBeGreaterThan(0);\n\t\texpect(inputStyle.borderStartEndRadius).toBe(\"0px\");\n\t});\n\n\ttest(\"describes the input with its addons and keeps its name to the label\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"price\">\n\t\t\t\t<TextField.Label>Price</TextField.Label>\n\t\t\t\t<TextField.Prefix>$</TextField.Prefix>\n\t\t\t\t<TextField.Suffix>USD</TextField.Suffix>\n\t\t\t\t<TextField.Description>Charged monthly.</TextField.Description>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, addons } = parts(host);\n\t\tlet describedBy = input.getAttribute(\"aria-describedby\")!.split(\" \");\n\n\t\tfor (let addon of addons) expect(describedBy).toContain(addon.id);\n\t\texpect(describedBy).toHaveLength(3);\n\t\tlet labelledBy = input.getAttribute(\"aria-labelledby\")!;\n\t\texpect(document.getElementById(labelledBy)!.textContent).toBe(\"Price\");\n\t\tfor (let addon of addons) expect(addon.tabIndex).toBeLessThan(0);\n\t});\n\n\ttest(\"focuses the input when the addon is clicked\", async () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"slug\">\n\t\t\t\t<TextField.Label>Workspace URL</TextField.Label>\n\t\t\t\t<TextField.Prefix>pulse.dev/</TextField.Prefix>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, addons } = parts(host);\n\n\t\tawait userEvent.click(addons[0]!);\n\n\t\texpect(document.activeElement).toBe(input);\n\t});\n\n\ttest(\"draws the focus ring around the whole group, not the input\", async () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"slug\">\n\t\t\t\t<TextField.Label>Workspace URL</TextField.Label>\n\t\t\t\t<TextField.Prefix>pulse.dev/</TextField.Prefix>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, group } = parts(host);\n\n\t\tawait userEvent.click(input);\n\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t});\n\n\ttest(\"draws the invalid ring around the whole group, not the input\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"slug\">\n\t\t\t\t<TextField.Label>Workspace URL</TextField.Label>\n\t\t\t\t<TextField.Prefix>pulse.dev/</TextField.Prefix>\n\t\t\t\t<TextField.Error>Taken.</TextField.Error>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { input, group, addons } = parts(host);\n\n\t\texpect(input.getAttribute(\"aria-invalid\")).toBe(\"true\");\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t\texpect(getComputedStyle(addons[0]!).borderTopColor).toBe(\n\t\t\tgetComputedStyle(input).borderTopColor,\n\t\t);\n\t});\n\n\ttest(\"dims the addon with a disabled field\", () => {\n\t\tlet host = mount(\n\t\t\t<TextField name=\"amount\" disabled>\n\t\t\t\t<TextField.Label>Amount</TextField.Label>\n\t\t\t\t<TextField.Prefix>$</TextField.Prefix>\n\t\t\t</TextField>,\n\t\t);\n\t\tlet { addons } = parts(host);\n\n\t\texpect(Number(getComputedStyle(addons[0]!).opacity)).toBeLessThan(1);\n\t});\n\n\ttest(\"shrinks the input and keeps a long addon on one line at 320px\", async () => {\n\t\tawait page.viewport(320, 640);\n\t\tlet host = mount(\n\t\t\t<TextField name=\"subdomain\">\n\t\t\t\t<TextField.Label>Subdomain</TextField.Label>\n\t\t\t\t<TextField.Suffix>.northwind.example.com</TextField.Suffix>\n\t\t\t</TextField>,\n\t\t\t304,\n\t\t);\n\t\tlet { input, addons, group } = parts(host);\n\t\tlet [suffix] = addons;\n\n\t\texpect(document.documentElement.scrollWidth).toBeLessThanOrEqual(320);\n\t\texpect(group.getBoundingClientRect().right).toBeLessThanOrEqual(\n\t\t\thost.getBoundingClientRect().right,\n\t\t);\n\t\texpect(suffix!.getBoundingClientRect().height).toBeCloseTo(\n\t\t\tinput.getBoundingClientRect().height,\n\t\t\t0,\n\t\t);\n\t\texpect(suffix!.scrollWidth).toBeLessThanOrEqual(suffix!.clientWidth);\n\t});\n});\n\ndescribe(\"Group.Text\", () => {\n\ttest(\"composes an addon onto an Input by hand\", async () => {\n\t\tlet host = mount(\n\t\t\t<Group>\n\t\t\t\t<Group.Text id=\"slug-prefix\" htmlFor=\"slug\">\n\t\t\t\t\tpulse.dev/\n\t\t\t\t</Group.Text>\n\t\t\t\t<Input id=\"slug\" aria-label=\"Workspace URL\" aria-describedby=\"slug-prefix\" />\n\t\t\t</Group>,\n\t\t);\n\t\tlet { input, addons, group } = parts(host);\n\n\t\tawait userEvent.click(addons[0]!);\n\n\t\texpect(document.activeElement).toBe(input);\n\t\texpect(hasOutline(group)).toBe(true);\n\t\texpect(hasOutline(input)).toBe(false);\n\t});\n});\n"
|
|
22
18
|
}
|
|
23
19
|
}
|