@sdxc/kit 2026.10.29 → 2026.11.1

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.
Files changed (113) hide show
  1. package/changelog.jsonl +93 -0
  2. package/dist/make/declare.js +32 -11
  3. package/package.json +2 -2
  4. package/registry/ui/accordion.json +2 -2
  5. package/registry/ui/alert-dialog.json +2 -2
  6. package/registry/ui/alert.json +2 -2
  7. package/registry/ui/aspect-ratio.json +2 -2
  8. package/registry/ui/avatar.json +6 -3
  9. package/registry/ui/badge.json +2 -2
  10. package/registry/ui/breadcrumbs.json +2 -2
  11. package/registry/ui/button.json +5 -3
  12. package/registry/ui/calendar.json +2 -2
  13. package/registry/ui/card.json +2 -2
  14. package/registry/ui/carousel.json +2 -2
  15. package/registry/ui/checkbox-group.json +2 -2
  16. package/registry/ui/checkbox.json +2 -2
  17. package/registry/ui/combobox.json +2 -2
  18. package/registry/ui/command.json +2 -2
  19. package/registry/ui/cta-group.json +2 -2
  20. package/registry/ui/date-field.json +2 -2
  21. package/registry/ui/date-picker.json +2 -2
  22. package/registry/ui/date-range-picker.json +2 -2
  23. package/registry/ui/description.json +2 -2
  24. package/registry/ui/dialog-dismiss.json +13 -0
  25. package/registry/ui/dialog.json +2 -2
  26. package/registry/ui/disclosure.json +2 -2
  27. package/registry/ui/drawer.json +2 -2
  28. package/registry/ui/field-error.json +2 -2
  29. package/registry/ui/form.json +2 -2
  30. package/registry/ui/group.json +2 -2
  31. package/registry/ui/header.json +2 -2
  32. package/registry/ui/heading-scope.json +2 -2
  33. package/registry/ui/heading.json +3 -3
  34. package/registry/ui/highlight.json +3 -3
  35. package/registry/ui/hover-card.json +2 -2
  36. package/registry/ui/image-placeholder.json +2 -2
  37. package/registry/ui/input.json +2 -2
  38. package/registry/ui/item.json +2 -2
  39. package/registry/ui/keyboard.json +2 -2
  40. package/registry/ui/label.json +2 -2
  41. package/registry/ui/link-button.json +5 -3
  42. package/registry/ui/link.json +2 -2
  43. package/registry/ui/listbox.json +2 -2
  44. package/registry/ui/menu.json +2 -2
  45. package/registry/ui/meter.json +2 -2
  46. package/registry/ui/modal.json +2 -2
  47. package/registry/ui/nav-link.json +2 -2
  48. package/registry/ui/navigation-menu.json +2 -2
  49. package/registry/ui/number-field.json +2 -2
  50. package/registry/ui/otp-field.json +2 -2
  51. package/registry/ui/overlay-arrow.json +2 -2
  52. package/registry/ui/pagination.json +2 -2
  53. package/registry/ui/popover.json +2 -2
  54. package/registry/ui/progress-bar.json +2 -2
  55. package/registry/ui/radio-group.json +2 -2
  56. package/registry/ui/range-calendar.json +2 -2
  57. package/registry/ui/scroll-area.json +2 -2
  58. package/registry/ui/search-field.json +2 -2
  59. package/registry/ui/section.json +2 -2
  60. package/registry/ui/select.json +2 -2
  61. package/registry/ui/selection-indicator.json +2 -2
  62. package/registry/ui/sentinel-row.json +2 -2
  63. package/registry/ui/separator.json +2 -2
  64. package/registry/ui/shared-element.json +2 -2
  65. package/registry/ui/sheet.json +2 -2
  66. package/registry/ui/sidebar.json +2 -2
  67. package/registry/ui/slider.json +2 -2
  68. package/registry/ui/spinner.json +2 -2
  69. package/registry/ui/switch.json +2 -2
  70. package/registry/ui/tabs.json +2 -2
  71. package/registry/ui/tag-group.json +2 -2
  72. package/registry/ui/text-field.json +2 -2
  73. package/registry/ui/text.json +2 -2
  74. package/registry/ui/textarea.json +2 -2
  75. package/registry/ui/time-field.json +2 -2
  76. package/registry/ui/toggle-button.json +2 -2
  77. package/registry/ui/tooltip.json +2 -2
  78. package/registry/ui/typeset.json +2 -2
  79. package/registry/ui/youtube-embed.json +2 -2
  80. package/stubs/scaffold.controller.index.stub +1 -1
  81. package/registry/ui/attachment.json +0 -15
  82. package/registry/ui/bubble.json +0 -13
  83. package/registry/ui/chart.json +0 -13
  84. package/registry/ui/color-area.json +0 -13
  85. package/registry/ui/color-field.json +0 -20
  86. package/registry/ui/color-picker.json +0 -17
  87. package/registry/ui/color-slider.json +0 -13
  88. package/registry/ui/color-swatch-picker.json +0 -15
  89. package/registry/ui/color-swatch.json +0 -13
  90. package/registry/ui/color-wheel.json +0 -13
  91. package/registry/ui/context-menu.json +0 -16
  92. package/registry/ui/drop-indicator.json +0 -13
  93. package/registry/ui/drop-zone.json +0 -13
  94. package/registry/ui/empty.json +0 -15
  95. package/registry/ui/feature.json +0 -18
  96. package/registry/ui/file-trigger.json +0 -13
  97. package/registry/ui/grid-list.json +0 -18
  98. package/registry/ui/logo-cloud.json +0 -16
  99. package/registry/ui/marker.json +0 -13
  100. package/registry/ui/marketing-header.json +0 -18
  101. package/registry/ui/marketing-section.json +0 -16
  102. package/registry/ui/menubar.json +0 -13
  103. package/registry/ui/message-scroller.json +0 -16
  104. package/registry/ui/message.json +0 -13
  105. package/registry/ui/resizable.json +0 -13
  106. package/registry/ui/shortcut-list.json +0 -18
  107. package/registry/ui/skeleton.json +0 -13
  108. package/registry/ui/split.json +0 -16
  109. package/registry/ui/stat-strip.json +0 -16
  110. package/registry/ui/table.json +0 -16
  111. package/registry/ui/toast.json +0 -16
  112. package/registry/ui/toolbar.json +0 -13
  113. package/registry/ui/tree.json +0 -18
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "hover-card",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "HoverCard"
7
7
  ],
8
8
  "source": {
9
9
  "path": "hover-card.tsx",
10
- "content": "/**\n * A supplementary detail panel that appears beside a trigger on hover or\n * keyboard focus — a user card beneath an @mention, a definition beneath a\n * term. Its panel shares {@link Popover}'s rounded, bordered, shadowed\n * surface, sized narrower and padded for a compact block of text. Reveal\n * rides `:hover` and `:focus-within` on the compound root, since a\n * hover-revealed surface has no invoker to click — the hover path sits\n * behind `@media (hover: hover)` to avoid a stuck-open panel on coarse\n * pointers, while focus stays unconditional for keyboard and touch users.\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 { fg } from \"@sdxc/u/color\";\nimport { opacity, transition, transitionDuration, visibility } from \"@sdxc/u/effects\";\nimport { pointerEvents, raw } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontents,\n\tinlineBlock,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { is, mb, mbe, mbs, marginLeft, marginRight, mi, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { AnchorPlacement } from \"@sdxc/ui/utils\";\n\nimport { floatingSurface } from \"@sdxc/ui/styles\";\n\n/**\n * Side of the trigger {@link HoverCard.Content} renders against when\n * `placement` is left unset.\n */\nconst DEFAULT_PLACEMENT: HoverCard.Placement = \"bottom\";\n\n/**\n * Prop types for {@link HoverCard} and its compound parts.\n */\nexport namespace HoverCard {\n\t/**\n\t * Side of the trigger the panel renders against, and — for corner variants\n\t * — which trigger edge it aligns to on the perpendicular axis. Names a\n\t * physical viewport side, so it keeps attaching under any `dir` value.\n\t */\n\texport type Placement = AnchorPlacement;\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough. This is\n\t * the compound root every part below nests inside — its own hover and\n\t * focus-within state is what reveals {@link HoverCard.Content}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** The compound root's parts: {@link HoverCard.Trigger} followed by {@link HoverCard.Content}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"span\"> {\n\t\t/**\n\t\t * The visible trigger — a link, button, or other element. The root\n\t\t * reveals {@link HoverCard.Content} whenever focus or a hover-capable\n\t\t * pointer rests inside it, so pointer users reach the panel even without a focusable child.\n\t\t */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_PLACEMENT}. */\n\t\tplacement?: Placement;\n\t\t/** The panel's content. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the compound root: a `<span>` providing {@link HoverCard.Content}'s\n * anchor and the hover/focus-within scope that reveals it, so hovering or\n * focusing the trigger or panel keeps it open with no script-tracked state.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the compound root's markup.\n * @example\n * <HoverCard>\n * \t<HoverCard.Trigger>\n * \t\t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * \t</HoverCard.Trigger>\n * \t<HoverCard.Content aria-label={t(\"userCard.label\", { name: user.name })}>\n * \t\t<p>{user.bio}</p>\n * \t</HoverCard.Content>\n * </HoverCard>\n */\nexport function HoverCard(handle: Handle<HoverCard.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"hover-card\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineBlock(),\n\t\t\t\t\tmedia(\n\t\t\t\t\t\t\"(hover: hover)\",\n\t\t\t\t\t\twhen('&:hover [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * An open card is something the reader reaches into, so it takes the pointer.\n\t\t\t\t\t\t\t * `!important` settles it: each mix entry gets its own cascade sublayer, and the resting\n\t\t\t\t\t\t\t * state's own rule may land in a later one.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-open-delay, 0.4s)\",\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\twhen('&:focus-within [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\ttransitionDelay: \"0s\",\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\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link HoverCard.TriggerProps.children} inside a `<span>` styled\n * `display: contents`, so the trigger keeps the child's own layout and\n * hover/focus-within participation, visible straight through to the root above.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <HoverCard.Trigger>\n * \t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * </HoverCard.Trigger>\n */\nHoverCard.Trigger = function HoverCardTrigger(handle: Handle<HoverCard.TriggerProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span data-slot=\"hover-card-trigger\" {...rest} mix={[contents(), mix]}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel: a `<div>` sharing {@link Popover}'s surface and placement\n * contract, kept in normal stacking order for its CSS-driven hover/focus\n * reveal, with delays tuned for pointer and keyboard users.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <HoverCard.Content placement=\"bottom-start\">\n * \t<OverlayArrow placement=\"bottom-start\">\n * \t\t<svg width={12} height={12} viewBox=\"0 0 12 12\">\n * \t\t\t<path d=\"M0 0 L6 6 L12 0\" />\n * \t\t</svg>\n * \t</OverlayArrow>\n * \t<p>{user.bio}</p>\n * </HoverCard.Content>\n */\nHoverCard.Content = function HoverCardContent(handle: Handle<HoverCard.ContentProps>) {\n\treturn () => {\n\t\tlet { placement, children, mix, ...rest } = handle.props;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_PLACEMENT;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"hover-card-content\"\n\t\t\t\tdata-placement={resolvedPlacement}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tp(4),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tis(\"18rem\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\ttransition(\"opacity, visibility, pointer-events\"),\n\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\tpointerEvents(),\n\t\t\t\t\traw({\n\t\t\t\t\t\tzIndex: \"var(--ui-hover-card-z, 50)\",\n\t\t\t\t\t\ttransitionBehavior: \"allow-discrete\",\n\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-close-delay, 0.2s)\",\n\t\t\t\t\t}),\n\n\t\t\t\t\twhen('&[data-placement^=\"bottom\"]', [\n\t\t\t\t\t\tmbs(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\tinsBs(\"100%\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"top\"]', [\n\t\t\t\t\t\tmbe(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\tinsBe(\"100%\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"left\"]', [\n\t\t\t\t\t\tmarginRight(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\traw({ right: \"100%\" }),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"right\"]', [\n\t\t\t\t\t\tmarginLeft(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\traw({ left: \"100%\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The card rests off its trigger's edge, and a pointer travelling between the\n\t\t\t\t\t * two crosses that space, so the card's own hit area reaches back across it\n\t\t\t\t\t * and the pair reads as one surface for as long as the pointer is on either.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&::before\", raw({ content: '\"\"', position: \"absolute\" })),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"bottom\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tinsetBlockEnd: \"100%\",\n\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"top\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tinsetBlockStart: \"100%\",\n\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"left\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tleft: \"100%\",\n\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"right\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tright: \"100%\",\n\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\n\t\t\t\t\twhen('&[data-placement=\"bottom\"], &[data-placement=\"top\"]', [\n\t\t\t\t\t\tmi(\"auto\"),\n\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement=\"bottom-start\"], &[data-placement=\"top-start\"]', insIs(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"bottom-end\"], &[data-placement=\"top-end\"]', insIe(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"left\"], &[data-placement=\"right\"]', [\n\t\t\t\t\t\tmb(\"auto\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement=\"left-start\"], &[data-placement=\"right-start\"]', insBs(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"left-end\"], &[data-placement=\"right-end\"]', insBe(\"0\")),\n\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\ttransitionDuration(\"0s\"),\n\t\t\t\t\t\traw({ transitionDelay: \"0s\" }),\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</div>\n\t\t);\n\t};\n};\n"
10
+ "content": "/**\n * A supplementary detail panel that appears beside a trigger on hover or\n * keyboard focus — a user card beneath an @mention, a definition beneath a\n * term. Its panel shares {@link Popover}'s rounded, bordered, shadowed\n * surface, sized narrower and padded for a compact block of text. Reveal\n * rides `:hover` and `:focus-within` on the compound root, since a\n * hover-revealed surface has no invoker to click — the hover path sits\n * behind `@media (hover: hover)` to avoid a stuck-open panel on coarse\n * pointers, while focus stays unconditional for keyboard and touch users.\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 { fg } from \"@sdxc/u/color\";\nimport { opacity, transition, transitionDuration, visibility } from \"@sdxc/u/effects\";\nimport { pointerEvents, raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontents,\n\tinlineBlock,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { is, mb, mbe, mbs, marginLeft, marginRight, mi, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { AnchorPlacement } from \"@sdxc/ui/utils\";\n\nimport { floatingSurface } from \"@sdxc/ui/styles\";\n\n/**\n * Side of the trigger {@link HoverCard.Content} renders against when\n * `placement` is left unset.\n */\nconst DEFAULT_PLACEMENT: HoverCard.Placement = \"bottom\";\n\n/**\n * Prop types for {@link HoverCard} and its compound parts.\n */\nexport namespace HoverCard {\n\t/**\n\t * Side of the trigger the panel renders against, and — for corner variants\n\t * — which trigger edge it aligns to on the perpendicular axis. Names a\n\t * physical viewport side, so it keeps attaching under any `dir` value.\n\t */\n\texport type Placement = AnchorPlacement;\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough. This is\n\t * the compound root every part below nests inside — its own hover and\n\t * focus-within state is what reveals {@link HoverCard.Content}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** The compound root's parts: {@link HoverCard.Trigger} followed by {@link HoverCard.Content}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"span\"> {\n\t\t/**\n\t\t * The visible trigger — a link, button, or other element. The root\n\t\t * reveals {@link HoverCard.Content} whenever focus or a hover-capable\n\t\t * pointer rests inside it, so pointer users reach the panel even without a focusable child.\n\t\t */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_PLACEMENT}. */\n\t\tplacement?: Placement;\n\t\t/** The panel's content. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the compound root: a `<span>` providing {@link HoverCard.Content}'s\n * anchor and the hover/focus-within scope that reveals it, so hovering or\n * focusing the trigger or panel keeps it open with no script-tracked state.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the compound root's markup.\n * @example\n * <HoverCard>\n * \t<HoverCard.Trigger>\n * \t\t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * \t</HoverCard.Trigger>\n * \t<HoverCard.Content aria-label={t(\"userCard.label\", { name: user.name })}>\n * \t\t<p>{user.bio}</p>\n * \t</HoverCard.Content>\n * </HoverCard>\n */\nexport function HoverCard(handle: Handle<HoverCard.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"hover-card\"\n\t\t\t\t{...rest}\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\tinlineBlock(),\n\t\t\t\t\t\tmedia(\n\t\t\t\t\t\t\t\"(hover: hover)\",\n\t\t\t\t\t\t\twhen('&:hover [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * An open card is something the reader reaches into, so it takes the pointer.\n\t\t\t\t\t\t\t\t * `!important` settles it: each mix entry gets its own cascade sublayer, and the resting\n\t\t\t\t\t\t\t\t * state's own rule may land in a later one.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-open-delay, 0.4s)\",\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\twhen('&:focus-within [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\ttransitionDelay: \"0s\",\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\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link HoverCard.TriggerProps.children} inside a `<span>` styled\n * `display: contents`, so the trigger keeps the child's own layout and\n * hover/focus-within participation, visible straight through to the root above.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <HoverCard.Trigger>\n * \t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * </HoverCard.Trigger>\n */\nHoverCard.Trigger = function HoverCardTrigger(handle: Handle<HoverCard.TriggerProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span data-slot=\"hover-card-trigger\" {...rest} mix={mergeMix(contents(), mix)}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel: a `<div>` sharing {@link Popover}'s surface and placement\n * contract, kept in normal stacking order for its CSS-driven hover/focus\n * reveal, with delays tuned for pointer and keyboard users.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <HoverCard.Content placement=\"bottom-start\">\n * \t<OverlayArrow placement=\"bottom-start\">\n * \t\t<svg width={12} height={12} viewBox=\"0 0 12 12\">\n * \t\t\t<path d=\"M0 0 L6 6 L12 0\" />\n * \t\t</svg>\n * \t</OverlayArrow>\n * \t<p>{user.bio}</p>\n * </HoverCard.Content>\n */\nHoverCard.Content = function HoverCardContent(handle: Handle<HoverCard.ContentProps>) {\n\treturn () => {\n\t\tlet { placement, children, mix, ...rest } = handle.props;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_PLACEMENT;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"hover-card-content\"\n\t\t\t\tdata-placement={resolvedPlacement}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tp(4),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tis(\"18rem\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\ttransition(\"opacity, visibility, pointer-events\"),\n\t\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\t\tpointerEvents(),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tzIndex: \"var(--ui-hover-card-z, 50)\",\n\t\t\t\t\t\t\ttransitionBehavior: \"allow-discrete\",\n\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-close-delay, 0.2s)\",\n\t\t\t\t\t\t}),\n\n\t\t\t\t\t\twhen('&[data-placement^=\"bottom\"]', [\n\t\t\t\t\t\t\tmbs(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\tinsBs(\"100%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"top\"]', [\n\t\t\t\t\t\t\tmbe(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\tinsBe(\"100%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"left\"]', [\n\t\t\t\t\t\t\tmarginRight(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\traw({ right: \"100%\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"right\"]', [\n\t\t\t\t\t\t\tmarginLeft(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\traw({ left: \"100%\" }),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The card rests off its trigger's edge, and a pointer travelling between the\n\t\t\t\t\t\t * two crosses that space, so the card's own hit area reaches back across it\n\t\t\t\t\t\t * and the pair reads as one surface for as long as the pointer is on either.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&::before\", raw({ content: '\"\"', position: \"absolute\" })),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"bottom\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"100%\",\n\t\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"top\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tinsetBlockStart: \"100%\",\n\t\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"left\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tleft: \"100%\",\n\t\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"right\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tright: \"100%\",\n\t\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\twhen('&[data-placement=\"bottom\"], &[data-placement=\"top\"]', [\n\t\t\t\t\t\t\tmi(\"auto\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement=\"bottom-start\"], &[data-placement=\"top-start\"]', insIs(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"bottom-end\"], &[data-placement=\"top-end\"]', insIe(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"left\"], &[data-placement=\"right\"]', [\n\t\t\t\t\t\t\tmb(\"auto\"),\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]),\n\t\t\t\t\t\twhen('&[data-placement=\"left-start\"], &[data-placement=\"right-start\"]', insBs(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"left-end\"], &[data-placement=\"right-end\"]', insBe(\"0\")),\n\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\t\ttransitionDuration(\"0s\"),\n\t\t\t\t\t\t\traw({ transitionDelay: \"0s\" }),\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\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "image-placeholder",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "ImagePlaceholder"
7
7
  ],
8
8
  "source": {
9
9
  "path": "image-placeholder.tsx",
10
- "content": "/**\n * The shared foundation for a fixed-size image-with-fallback box — a user\n * avatar, a brand logo, or any other picture that needs a graceful stand-in\n * before it loads or when it's missing. It renders a sized, shaped host that\n * an image and a fallback layer both stack into, plus a corner status badge\n * and a group of overlapping instances with a trailing overflow count.\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 { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { ringShadow, rounded, visibility } from \"@sdxc/u/effects\";\nimport { userSelect } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcenter,\n\tflex,\n\tinlineFlex,\n\tinsBe,\n\tinsIe,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, fit, is, mis } from \"@sdxc/u/size\";\nimport { data, precededBy, when } from \"@sdxc/u/state\";\nimport { tabularNums, text, textTransform, weight } from \"@sdxc/u/typography\";\n\n/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: ImagePlaceholder.Size = \"md\";\n\n/**\n * Shape variant {@link ImagePlaceholder} and {@link ImagePlaceholder.GroupCount}\n * fall back to when `shape` is omitted.\n */\nconst DEFAULT_SHAPE: ImagePlaceholder.Shape = \"circle\";\n\n/**\n * The inset hairline {@link ImagePlaceholder.Image} draws over a picture's\n * edge, read from the theme's `--ui-image-outline`, which flips for dark mode.\n */\nconst IMAGE_OUTLINE = \"var(--ui-image-outline, rgb(0 0 0 / 0.1))\";\n\n/**\n * Prop types for {@link ImagePlaceholder} and its compound parts.\n */\nexport namespace ImagePlaceholder {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Shape variant controlling the corner rounding of the host, its image,\n\t * and its fallback layer: `\"circle\"` renders a fully rounded disc, and\n\t * `\"square\"` renders a softly rounded square.\n\t */\n\texport type Shape = \"circle\" | \"square\";\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/** Shape variant. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The host's compound parts: {@link ImagePlaceholder.Image}, {@link ImagePlaceholder.Fallback}, and an optional {@link ImagePlaceholder.Badge}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Image}.\n\t */\n\texport interface ImageProps extends Omit<\n\t\tTagProps<\"img\">,\n\t\t\"src\" | \"alt\" | \"role\" | \"aria-label\" | \"aria-labelledby\" | \"title\"\n\t> {\n\t\t/** Image source URL. */\n\t\tsrc: string;\n\t\t/**\n\t\t * Accessible text description of the image. Required, since a\n\t\t * consumer's own localized description drives what assistive\n\t\t * technology announces.\n\t\t */\n\t\talt: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Fallback}.\n\t */\n\texport interface FallbackProps extends TagProps<\"span\"> {\n\t\t/** Fallback content, typically the subject's initials. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Badge}.\n\t */\n\texport interface BadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link ImagePlaceholder} instances, optionally trailed by {@link ImagePlaceholder.GroupCount}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.GroupCount}.\n\t */\n\texport interface GroupCountProps extends TagProps<\"span\"> {\n\t\t/** Shape variant, matching the shape of the sibling placeholders it trails. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The overflow count text, e.g. `\"+3\"`. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the placeholder host: a fixed-size, centered box whose `data-shape`\n * attribute styles it, its image, and its fallback together, leaving room\n * for {@link ImagePlaceholder.Badge} to sit unclipped on the corner.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <ImagePlaceholder>\n * \t<ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n * \t<ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n * </ImagePlaceholder>\n * @example\n * <ImagePlaceholder size=\"lg\" shape=\"square\">\n * \t<ImagePlaceholder.Image src={org.logoUrl} alt={org.name} />\n * \t<ImagePlaceholder.Badge />\n * </ImagePlaceholder>\n */\nexport function ImagePlaceholder(handle: Handle<ImagePlaceholder.Props>) {\n\treturn () => {\n\t\tlet { size, shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image-placeholder\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"shape\", \"circle\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"full\")),\n\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"full\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"shape\", \"square\", [\n\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"lg\")),\n\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"lg\")),\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</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders the placeholder's image layer: an `<img>` cropped to cover, clipped to\n * {@link ImagePlaceholder}'s `data-shape`, its inset hairline holding the edge on\n * a same-tone background. Its order against {@link ImagePlaceholder.Fallback} decides what shows.\n *\n * @param handle Runtime handle carrying the host `<img>`'s props.\n * @returns The render function producing the image layer's markup.\n * @example\n * <ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n */\nImagePlaceholder.Image = function ImagePlaceholderImage(\n\thandle: Handle<ImagePlaceholder.ImageProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tfit(\"cover\"),\n\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\toutline({ color: IMAGE_OUTLINE, width: 1, offset: -1 }),\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 placeholder's fallback layer: a `<span>` centering a consumer's\n * content in uppercase text. Font size inherits {@link ImagePlaceholder}'s\n * `data-size` via CSS, keeping initials proportional at every size.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the fallback layer's markup.\n * @example\n * <ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n */\nImagePlaceholder.Fallback = function ImagePlaceholderFallback(\n\thandle: Handle<ImagePlaceholder.FallbackProps>,\n) {\n\treturn () => {\n\t\tlet { children, 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=\"fallback\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * Both layers fill the host and this one follows the image, so it hides while an unbroken\n\t\t\t\t\t * image is present and takes over once the image fails. It hides through `visibility`,\n\t\t\t\t\t * which no other rule here sets, so declaration order keeps it hidden.\n\t\t\t\t\t */\n\t\t\t\t\tprecededBy('img[data-slot=\"image\"]:not([data-image-error])', visibility(\"hidden\")),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tcenter(),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-pressed\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\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</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner, always fully rounded regardless of {@link ImagePlaceholder}'s own\n * shape, and ringed to read as cut from whatever sits beneath it.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the badge's markup.\n * @example\n * <ImagePlaceholder.Badge />\n */\nImagePlaceholder.Badge = function ImagePlaceholderBadge(\n\thandle: Handle<ImagePlaceholder.BadgeProps>,\n) {\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=\"badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tis(3),\n\t\t\t\t\tbs(3),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tborder({ color: \"neutral.tint\", width: 2 }),\n\t\t\t\t\tbg(\"neutral.strong\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tinsIe(\"0\"),\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 row of overlapping placeholders: a flex container that pulls each\n * child back over the previous one and rings each in the neutral tint background,\n * so the overlap reads as stacked cutouts.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <ImagePlaceholder.Group>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n * </ImagePlaceholder.Group>\n */\nImagePlaceholder.Group = function ImagePlaceholderGroup(\n\thandle: Handle<ImagePlaceholder.GroupProps>,\n) {\n\treturn () => {\n\t\tlet { children, 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\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\twhen(\"& > * + *\", mis(-3)),\n\t\t\t\t\twhen('& > [data-slot=\"image-placeholder\"]', ringShadow(\"neutral.tint\")),\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</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the \"+N\" overflow indicator trailing {@link ImagePlaceholder.Group}:\n * a medium box matching {@link ImagePlaceholder}'s size, ring and `shape`, its\n * tabular digits keeping a changing count the same width.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the overflow indicator's markup.\n * @example\n * <ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n */\nImagePlaceholder.GroupCount = function ImagePlaceholderGroupCount(\n\thandle: Handle<ImagePlaceholder.GroupCountProps>,\n) {\n\treturn () => {\n\t\tlet { shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-count\"\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen('&[data-shape=\"circle\"]', rounded(\"full\")),\n\t\t\t\t\twhen('&[data-shape=\"square\"]', rounded(\"lg\")),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\tringShadow(\"neutral.tint\"),\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</span>\n\t\t);\n\t};\n};\n"
10
+ "content": "/**\n * The shared foundation for a fixed-size image-with-fallback box — a user\n * avatar, a brand logo, or any other picture that needs a graceful stand-in\n * before it loads or when it's missing. It renders a sized, shaped host that\n * an image and a fallback layer both stack into, plus a corner status badge\n * and a group of overlapping instances with a trailing overflow count.\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 { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { ringShadow, rounded, visibility } from \"@sdxc/u/effects\";\nimport { userSelect, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcenter,\n\tflex,\n\tinlineFlex,\n\tinsBe,\n\tinsIe,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, fit, is, mis } from \"@sdxc/u/size\";\nimport { data, precededBy, when } from \"@sdxc/u/state\";\nimport { tabularNums, text, textTransform, weight } from \"@sdxc/u/typography\";\n\n/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: ImagePlaceholder.Size = \"md\";\n\n/**\n * Shape variant {@link ImagePlaceholder} and {@link ImagePlaceholder.GroupCount}\n * fall back to when `shape` is omitted.\n */\nconst DEFAULT_SHAPE: ImagePlaceholder.Shape = \"circle\";\n\n/**\n * The inset hairline {@link ImagePlaceholder.Image} draws over a picture's\n * edge, read from the theme's `--ui-image-outline`, which flips for dark mode.\n */\nconst IMAGE_OUTLINE = \"var(--ui-image-outline, rgb(0 0 0 / 0.1))\";\n\n/**\n * Prop types for {@link ImagePlaceholder} and its compound parts.\n */\nexport namespace ImagePlaceholder {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Shape variant controlling the corner rounding of the host, its image,\n\t * and its fallback layer: `\"circle\"` renders a fully rounded disc, and\n\t * `\"square\"` renders a softly rounded square.\n\t */\n\texport type Shape = \"circle\" | \"square\";\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/** Shape variant. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The host's compound parts: {@link ImagePlaceholder.Image}, {@link ImagePlaceholder.Fallback}, and an optional {@link ImagePlaceholder.Badge}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Image}.\n\t */\n\texport interface ImageProps extends Omit<\n\t\tTagProps<\"img\">,\n\t\t\"src\" | \"alt\" | \"role\" | \"aria-label\" | \"aria-labelledby\" | \"title\"\n\t> {\n\t\t/** Image source URL. */\n\t\tsrc: string;\n\t\t/**\n\t\t * Accessible text description of the image. Required, since a\n\t\t * consumer's own localized description drives what assistive\n\t\t * technology announces.\n\t\t */\n\t\talt: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Fallback}.\n\t */\n\texport interface FallbackProps extends TagProps<\"span\"> {\n\t\t/** Fallback content, typically the subject's initials. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Badge}.\n\t */\n\texport interface BadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link ImagePlaceholder} instances, optionally trailed by {@link ImagePlaceholder.GroupCount}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.GroupCount}.\n\t */\n\texport interface GroupCountProps extends TagProps<\"span\"> {\n\t\t/** Shape variant, matching the shape of the sibling placeholders it trails. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The overflow count text, e.g. `\"+3\"`. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the placeholder host: a fixed-size, centered box whose `data-shape`\n * attribute styles it, its image, and its fallback together, leaving room\n * for {@link ImagePlaceholder.Badge} to sit unclipped on the corner.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <ImagePlaceholder>\n * \t<ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n * \t<ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n * </ImagePlaceholder>\n * @example\n * <ImagePlaceholder size=\"lg\" shape=\"square\">\n * \t<ImagePlaceholder.Image src={org.logoUrl} alt={org.name} />\n * \t<ImagePlaceholder.Badge />\n * </ImagePlaceholder>\n */\nexport function ImagePlaceholder(handle: Handle<ImagePlaceholder.Props>) {\n\treturn () => {\n\t\tlet { size, shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image-placeholder\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-shape={resolvedShape}\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\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"shape\", \"circle\", [\n\t\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"full\")),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"full\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"shape\", \"square\", [\n\t\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"lg\")),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"lg\")),\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\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders the placeholder's image layer: an `<img>` cropped to cover, clipped to\n * {@link ImagePlaceholder}'s `data-shape`, its inset hairline holding the edge on\n * a same-tone background. Its order against {@link ImagePlaceholder.Fallback} decides what shows.\n *\n * @param handle Runtime handle carrying the host `<img>`'s props.\n * @returns The render function producing the image layer's markup.\n * @example\n * <ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n */\nImagePlaceholder.Image = function ImagePlaceholderImage(\n\thandle: Handle<ImagePlaceholder.ImageProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tfit(\"cover\"),\n\t\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\toutline({ color: IMAGE_OUTLINE, width: 1, offset: -1 }),\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 placeholder's fallback layer: a `<span>` centering a consumer's\n * content in uppercase text. Font size inherits {@link ImagePlaceholder}'s\n * `data-size` via CSS, keeping initials proportional at every size.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the fallback layer's markup.\n * @example\n * <ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n */\nImagePlaceholder.Fallback = function ImagePlaceholderFallback(\n\thandle: Handle<ImagePlaceholder.FallbackProps>,\n) {\n\treturn () => {\n\t\tlet { children, 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=\"fallback\"\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 * Both layers fill the host and this one follows the image, so it hides while an unbroken\n\t\t\t\t\t\t * image is present and takes over once the image fails. It hides through `visibility`,\n\t\t\t\t\t\t * which no other rule here sets, so declaration order keeps it hidden.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprecededBy('img[data-slot=\"image\"]:not([data-image-error])', visibility(\"hidden\")),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tcenter(),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-pressed\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\ttextTransform(\"uppercase\"),\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</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner, always fully rounded regardless of {@link ImagePlaceholder}'s own\n * shape, and ringed to read as cut from whatever sits beneath it.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the badge's markup.\n * @example\n * <ImagePlaceholder.Badge />\n */\nImagePlaceholder.Badge = function ImagePlaceholderBadge(\n\thandle: Handle<ImagePlaceholder.BadgeProps>,\n) {\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=\"badge\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(3),\n\t\t\t\t\t\tbs(3),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ color: \"neutral.tint\", width: 2 }),\n\t\t\t\t\t\tbg(\"neutral.strong\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIe(\"0\"),\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 row of overlapping placeholders: a flex container that pulls each\n * child back over the previous one and rings each in the neutral tint background,\n * so the overlap reads as stacked cutouts.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <ImagePlaceholder.Group>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n * </ImagePlaceholder.Group>\n */\nImagePlaceholder.Group = function ImagePlaceholderGroup(\n\thandle: Handle<ImagePlaceholder.GroupProps>,\n) {\n\treturn () => {\n\t\tlet { children, 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\"\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\twhen(\"& > * + *\", mis(-3)),\n\t\t\t\t\t\twhen('& > [data-slot=\"image-placeholder\"]', ringShadow(\"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\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the \"+N\" overflow indicator trailing {@link ImagePlaceholder.Group}:\n * a medium box matching {@link ImagePlaceholder}'s size, ring and `shape`, its\n * tabular digits keeping a changing count the same width.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the overflow indicator's markup.\n * @example\n * <ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n */\nImagePlaceholder.GroupCount = function ImagePlaceholderGroupCount(\n\thandle: Handle<ImagePlaceholder.GroupCountProps>,\n) {\n\treturn () => {\n\t\tlet { shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-count\"\n\t\t\t\tdata-shape={resolvedShape}\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\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\tweight(\"medium\"),\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\twhen('&[data-shape=\"circle\"]', rounded(\"full\")),\n\t\t\t\t\t\twhen('&[data-shape=\"square\"]', rounded(\"lg\")),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\tringShadow(\"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\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n"
11
11
  },
12
12
  "test": {
13
13
  "path": "image-placeholder.test.tsx",
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "input",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Input"
7
7
  ],
8
8
  "source": {
9
9
  "path": "input.tsx",
10
- "content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tblock(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t * changing shape.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\tfocusVisible([\n\t\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tinvalid([border(\"danger\"), outline({ color: \"danger.ring\", offset: 2 })]),\n\t\t\t\t\twhen(\"&:disabled\", [opacity(50), bg(\"neutral.bg-tint-hover\"), cursor(\"not-allowed\")]),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, mergeMix } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\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\tinteractiveTransition(),\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(10),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t\t * changing shape.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\t\tfocusVisible([\n\t\t\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tinvalid([border(\"danger\"), outline({ color: \"danger.ring\", offset: 2 })]),\n\t\t\t\t\t\twhen(\"&:disabled\", [opacity(50), bg(\"neutral.bg-tint-hover\"), cursor(\"not-allowed\")]),\n\t\t\t\t\t\ttext(\"sm\"),\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"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "item",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Item"
7
7
  ],
8
8
  "source": {
9
9
  "path": "item.tsx",
10
- "content": "/**\n * A single-line content row composing a leading media slot, a title and\n * description content slot, and a trailing action slot along one\n * horizontally centered line — the shape a settings row, a notification\n * list entry, or a file row all share. Every part lays out through the\n * row's own flex line rather than any part reading a semantic role from its\n * neighbors, so a row renders correctly whichever parts a given list needs:\n * media and content alone, content and actions alone, or all three.\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 { fg } from \"@sdxc/u/color\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tcenter,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tflexWrap,\n\tgap,\n\tgrow,\n\titems,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { atMax } from \"@sdxc/u/responsive\";\nimport { bs, is, mis, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { fontSize, leading, text, truncate, weight } from \"@sdxc/u/typography\";\n\n/**\n * Named container {@link Item} declares on its own host, so\n * {@link Item.Actions} can adapt to the row's own width instead of the\n * page's, keeping the same row width in a full page or a narrow panel.\n */\nconst CONTAINER_NAME = \"ui-item\";\n\n/**\n * `@container` max-width threshold below which the row can't hold\n * {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions} on one\n * line without crowding {@link Item.Content}'s text out of room.\n */\nconst NARROW_CONTAINER_SIZE = \"20rem\";\n\n/**\n * Prop types for {@link Item} and its compound parts.\n */\nexport namespace Item {\n\t/**\n\t * Props accepted by {@link Item}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The row's compound parts: {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The leading graphic — an icon, an image thumbnail, an Avatar instance, or a checkbox. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Item.Title} and, optionally, {@link Item.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"div\"> {\n\t\t/** The row's label text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail below the title — a file size, an email address, a timestamp. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of buttons, links, or a switch — whatever control the row offers. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the row's host: a `<div>` laying {@link Item.Media},\n * {@link Item.Content}, and {@link Item.Actions} on one flex line, dropping\n * {@link Item.Actions} to a second line once the row narrows past threshold.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Item>\n * \t<Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * \t<Item.Content>\n * \t\t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t\t<Item.Description>2.4 MB</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t</Item.Actions>\n * </Item>\n * @example\n * <Item>\n * \t<Item.Content>\n * \t\t<Item.Title>{t(\"settings.emailNotifications.title\")}</Item.Title>\n * \t\t<Item.Description>{t(\"settings.emailNotifications.description\")}</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Switch name=\"emailNotifications\" />\n * \t</Item.Actions>\n * </Item>\n */\nexport function Item(handle: Handle<Item.Props>) {\n\treturn () => {\n\t\tlet { children, 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=\"item\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(\"var(--ui-item-gap, 0.75rem)\"),\n\t\t\t\t\tpb(\"var(--ui-item-padding-block, 0.625rem)\"),\n\t\t\t\t\tpi(\"var(--ui-item-padding-inline, 0.75rem)\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t/**\n\t\t\t\t\t * The row wraps at every width, and {@link Item.Actions} claiming a full line once the\n\t\t\t\t\t * row is narrow decides when it does; a query on this row's own container can only\n\t\t\t\t\t * restyle its descendants, never the row itself.\n\t\t\t\t\t */\n\t\t\t\t\tflexWrap(\"wrap\"),\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</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Item.MediaProps.children} as the row's leading slot: a\n * shrink-proof, centered `<div>` colored from the neutral foreground so a\n * nested icon inherits it through `currentcolor`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media slot's markup.\n * @example\n * <Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * @example\n * <Item.Media>\n * \t<Avatar size=\"sm\">\n * \t\t<Avatar.Image src={member.avatarUrl} alt={member.name} />\n * \t\t<Avatar.Fallback>{member.initials}</Avatar.Fallback>\n * \t</Avatar>\n * </Item.Media>\n */\nItem.Media = function ItemMedia(handle: Handle<Item.MediaProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tcenter(),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tis(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\tbs(\"var(--ui-item-media-size, 2rem)\"),\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</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ContentProps.children} as the row's text column: a\n * `<div>` stacking {@link Item.Title} and {@link Item.Description} with its\n * minimum inline size collapsed to `0` so their truncation takes effect.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Item.Content>\n * \t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t<Item.Description>2.4 MB</Item.Description>\n * </Item.Content>\n */\nItem.Content = function ItemContent(handle: Handle<Item.ContentProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"content\"\n\t\t\t\tmix={[flex(), flexCol(), minIs(0), gap(0.5), grow(), shrink(1), basis(\"0%\"), mix]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.TitleProps.children} as the row's label in a plain\n * `<div>`, since a document outline gains nothing from a heading entry per\n * repeated row, truncated to one line in the foreground's emphasized tone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Item.Title>quarterly-report.pdf</Item.Title>\n */\nItem.Title = function ItemTitle(handle: Handle<Item.TitleProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"title\"\n\t\t\t\tmix={[weight(\"medium\"), fg(\"neutral.emphasis\"), truncate(), text(\"sm\"), mix]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.DescriptionProps.children} as the row's supporting\n * detail in a native `<p>`, truncated to one line to match\n * {@link Item.Title} so the pair reads as one compact two-line block.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Item.Description>2.4 MB</Item.Description>\n */\nItem.Description = function ItemDescription(handle: Handle<Item.DescriptionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\tfontSize(\"0.8125rem\"),\n\t\t\t\t\tleading(\"calc(1.125 / 0.8125)\"),\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</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ActionsProps.children} as the row's trailing slot,\n * pinned to the inline-end edge; once {@link Item} wraps narrow, it drops\n * to its own line, indented past {@link Item.Media} to read as trailing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action slot's markup.\n * @example\n * <Item.Actions>\n * \t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t<Button aria-label={t(\"files.remove\")}><XIcon /></Button>\n * </Item.Actions>\n */\nItem.Actions = function ItemActions(handle: Handle<Item.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"actions\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tgap(\"var(--ui-item-actions-gap, 0.5rem)\"),\n\t\t\t\t\tatMax(NARROW_CONTAINER_SIZE, CONTAINER_NAME, [\n\t\t\t\t\t\tbasis(\"100%\"),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tjustifyContent: \"flex-end\",\n\t\t\t\t\t\t\tmarginInlineStart:\n\t\t\t\t\t\t\t\t\"calc(var(--ui-item-media-size, 2rem) + var(--ui-item-gap, 0.75rem))\",\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\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
10
+ "content": "/**\n * A single-line content row composing a leading media slot, a title and\n * description content slot, and a trailing action slot along one\n * horizontally centered line — the shape a settings row, a notification\n * list entry, or a file row all share. Every part lays out through the\n * row's own flex line rather than any part reading a semantic role from its\n * neighbors, so a row renders correctly whichever parts a given list needs:\n * media and content alone, content and actions alone, or all three.\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 { fg } from \"@sdxc/u/color\";\nimport { raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tcenter,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tflexWrap,\n\tgap,\n\tgrow,\n\titems,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { atMax } from \"@sdxc/u/responsive\";\nimport { bs, is, mis, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { fontSize, leading, text, truncate, weight } from \"@sdxc/u/typography\";\n\n/**\n * Named container {@link Item} declares on its own host, so\n * {@link Item.Actions} can adapt to the row's own width instead of the\n * page's, keeping the same row width in a full page or a narrow panel.\n */\nconst CONTAINER_NAME = \"ui-item\";\n\n/**\n * `@container` max-width threshold below which the row can't hold\n * {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions} on one\n * line without crowding {@link Item.Content}'s text out of room.\n */\nconst NARROW_CONTAINER_SIZE = \"20rem\";\n\n/**\n * Prop types for {@link Item} and its compound parts.\n */\nexport namespace Item {\n\t/**\n\t * Props accepted by {@link Item}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The row's compound parts: {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The leading graphic — an icon, an image thumbnail, an Avatar instance, or a checkbox. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Item.Title} and, optionally, {@link Item.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"div\"> {\n\t\t/** The row's label text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail below the title — a file size, an email address, a timestamp. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of buttons, links, or a switch — whatever control the row offers. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the row's host: a `<div>` laying {@link Item.Media},\n * {@link Item.Content}, and {@link Item.Actions} on one flex line, dropping\n * {@link Item.Actions} to a second line once the row narrows past threshold.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Item>\n * \t<Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * \t<Item.Content>\n * \t\t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t\t<Item.Description>2.4 MB</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t</Item.Actions>\n * </Item>\n * @example\n * <Item>\n * \t<Item.Content>\n * \t\t<Item.Title>{t(\"settings.emailNotifications.title\")}</Item.Title>\n * \t\t<Item.Description>{t(\"settings.emailNotifications.description\")}</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Switch name=\"emailNotifications\" />\n * \t</Item.Actions>\n * </Item>\n */\nexport function Item(handle: Handle<Item.Props>) {\n\treturn () => {\n\t\tlet { children, 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=\"item\"\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\tgap(\"var(--ui-item-gap, 0.75rem)\"),\n\t\t\t\t\t\tpb(\"var(--ui-item-padding-block, 0.625rem)\"),\n\t\t\t\t\t\tpi(\"var(--ui-item-padding-inline, 0.75rem)\"),\n\t\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row wraps at every width, and {@link Item.Actions} claiming a full line once the\n\t\t\t\t\t\t * row is narrow decides when it does; a query on this row's own container can only\n\t\t\t\t\t\t * restyle its descendants, never the row itself.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tflexWrap(\"wrap\"),\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</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Item.MediaProps.children} as the row's leading slot: a\n * shrink-proof, centered `<div>` colored from the neutral foreground so a\n * nested icon inherits it through `currentcolor`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media slot's markup.\n * @example\n * <Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * @example\n * <Item.Media>\n * \t<Avatar size=\"sm\">\n * \t\t<Avatar.Image src={member.avatarUrl} alt={member.name} />\n * \t\t<Avatar.Fallback>{member.initials}</Avatar.Fallback>\n * \t</Avatar>\n * </Item.Media>\n */\nItem.Media = function ItemMedia(handle: Handle<Item.MediaProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"media\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tcenter(),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tis(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-item-media-size, 2rem)\"),\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</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ContentProps.children} as the row's text column: a\n * `<div>` stacking {@link Item.Title} and {@link Item.Description} with its\n * minimum inline size collapsed to `0` so their truncation takes effect.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Item.Content>\n * \t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t<Item.Description>2.4 MB</Item.Description>\n * </Item.Content>\n */\nItem.Content = function ItemContent(handle: Handle<Item.ContentProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"content\"\n\t\t\t\tmix={mergeMix([flex(), flexCol(), minIs(0), gap(0.5), grow(), shrink(1), basis(\"0%\")], mix)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.TitleProps.children} as the row's label in a plain\n * `<div>`, since a document outline gains nothing from a heading entry per\n * repeated row, truncated to one line in the foreground's emphasized tone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Item.Title>quarterly-report.pdf</Item.Title>\n */\nItem.Title = function ItemTitle(handle: Handle<Item.TitleProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"title\"\n\t\t\t\tmix={mergeMix([weight(\"medium\"), fg(\"neutral.emphasis\"), truncate(), text(\"sm\")], mix)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.DescriptionProps.children} as the row's supporting\n * detail in a native `<p>`, truncated to one line to match\n * {@link Item.Title} so the pair reads as one compact two-line block.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Item.Description>2.4 MB</Item.Description>\n */\nItem.Description = function ItemDescription(handle: Handle<Item.DescriptionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[fg(\"neutral.muted\"), truncate(), fontSize(\"0.8125rem\"), leading(\"calc(1.125 / 0.8125)\")],\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</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ActionsProps.children} as the row's trailing slot,\n * pinned to the inline-end edge; once {@link Item} wraps narrow, it drops\n * to its own line, indented past {@link Item.Media} to read as trailing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action slot's markup.\n * @example\n * <Item.Actions>\n * \t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t<Button aria-label={t(\"files.remove\")}><XIcon /></Button>\n * </Item.Actions>\n */\nItem.Actions = function ItemActions(handle: Handle<Item.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, 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=\"actions\"\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\tmis(\"auto\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tgap(\"var(--ui-item-actions-gap, 0.5rem)\"),\n\t\t\t\t\t\tatMax(NARROW_CONTAINER_SIZE, CONTAINER_NAME, [\n\t\t\t\t\t\t\tbasis(\"100%\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tjustifyContent: \"flex-end\",\n\t\t\t\t\t\t\t\tmarginInlineStart:\n\t\t\t\t\t\t\t\t\t\"calc(var(--ui-item-media-size, 2rem) + var(--ui-item-gap, 0.75rem))\",\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\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "keyboard",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Keyboard"
7
7
  ],
8
8
  "source": {
9
9
  "path": "keyboard.tsx",
10
- "content": "/**\n * A keyboard-shortcut hint rendered inside a native `<kbd>` element, drawn as the key\n * it names: a tinted, bordered cap sized to read beside the row's own text. Its\n * inline-start auto margin pushes it to the trailing edge of whatever row it sits in —\n * a menu item's command, a tooltip's accelerator, a button's shortcut label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { inlineFlex, items, justify } from \"@sdxc/u/layout\";\nimport { bs, minIs, mis, pi } from \"@sdxc/u/size\";\nimport { leading, tabularNums, text } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Keyboard}.\n */\nexport namespace Keyboard {\n\t/**\n\t * Every native `<kbd>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders as a small, muted, trailing-aligned annotation whose content is\n\t * whatever `children` the consumer supplies — a key, a chord, a glyph.\n\t */\n\texport interface Props extends TagProps<\"kbd\"> {}\n}\n\n/**\n * Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start\n * auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,\n * a tooltip, a button.\n *\n * @param handle Runtime handle carrying the host `<kbd>`'s props.\n * @returns The render function producing the shortcut hint's markup.\n * @example\n * <Keyboard>⌘K</Keyboard>\n */\nexport function Keyboard(handle: Handle<Keyboard.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<kbd\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The cap centers its glyph as an inline box, so a key sits inside the sentence\n\t\t\t\t\t * naming it; `center()` composes `flex()` and would put the key on a line of its own.\n\t\t\t\t\t */\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * A cap keeps its height and a minimum width whatever it holds, so a single\n\t\t\t\t\t * letter and a two-glyph chord sit on the same line as each other.\n\t\t\t\t\t */\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\tminIs(\"1.25rem\"),\n\t\t\t\t\tpi(1.5),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\tleading(\"none\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A keyboard-shortcut hint rendered inside a native `<kbd>` element, drawn as the key\n * it names: a tinted, bordered cap sized to read beside the row's own text. Its\n * inline-start auto margin pushes it to the trailing edge of whatever row it sits in —\n * a menu item's command, a tooltip's accelerator, a button's shortcut label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { inlineFlex, items, justify } from \"@sdxc/u/layout\";\nimport { bs, minIs, mis, pi } from \"@sdxc/u/size\";\nimport { leading, tabularNums, text } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Keyboard}.\n */\nexport namespace Keyboard {\n\t/**\n\t * Every native `<kbd>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders as a small, muted, trailing-aligned annotation whose content is\n\t * whatever `children` the consumer supplies — a key, a chord, a glyph.\n\t */\n\texport interface Props extends TagProps<\"kbd\"> {}\n}\n\n/**\n * Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start\n * auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,\n * a tooltip, a button.\n *\n * @param handle Runtime handle carrying the host `<kbd>`'s props.\n * @returns The render function producing the shortcut hint's markup.\n * @example\n * <Keyboard>⌘K</Keyboard>\n */\nexport function Keyboard(handle: Handle<Keyboard.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<kbd\n\t\t\t\t{...rest}\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\t/**\n\t\t\t\t\t\t * The cap centers its glyph as an inline box, so a key sits inside the sentence\n\t\t\t\t\t\t * naming it; `center()` composes `flex()` and would put the key on a line of its own.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A cap keeps its height and a minimum width whatever it holds, so a single\n\t\t\t\t\t\t * letter and a two-glyph chord sit on the same line as each other.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\t\tminIs(\"1.25rem\"),\n\t\t\t\t\t\tpi(1.5),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\tleading(\"none\"),\n\t\t\t\t\t\ttabularNums(),\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"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "label",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Label"
7
7
  ],
8
8
  "source": {
9
9
  "path": "label.tsx",
10
- "content": "/**\n * A caption for a form control, associated with its field either through\n * the native `for`/`id` relationship (set `htmlFor` to the field's `id`) or\n * by wrapping the control as a child. It renders as a single line of\n * emphasized text at the library's default label size, weight, and color.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { fontSize, leading, weight } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Label}.\n */\nexport namespace Label {\n\t/**\n\t * Every native `<label>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders at the library's default caption size, medium weight, and\n\t * emphasized neutral foreground; set `htmlFor` or nest the field as a child.\n\t */\n\texport interface Props extends TagProps<\"label\"> {}\n}\n\n/**\n * Renders its children inside a native `<label>` element, sized and colored\n * as a form field caption. Pair it with a field by setting `htmlFor` to the\n * field's `id`, or wrap the field directly so the platform associates them.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * @example\n * <Label>\n * \t{t(\"form.newsletter.label\")}\n * \t<input type=\"checkbox\" name=\"newsletter\" />\n * </Label>\n */\nexport function Label(handle: Handle<Label.Props>) {\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\tmix={[weight(\"medium\"), fg(\"neutral.emphasis\"), fontSize(\"sm\"), leading(\"none\"), mix]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A caption for a form control, associated with its field either through\n * the native `for`/`id` relationship (set `htmlFor` to the field's `id`) or\n * by wrapping the control as a child. It renders as a single line of\n * emphasized text at the library's default label size, weight, and color.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { fontSize, leading, weight } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Label}.\n */\nexport namespace Label {\n\t/**\n\t * Every native `<label>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders at the library's default caption size, medium weight, and\n\t * emphasized neutral foreground; set `htmlFor` or nest the field as a child.\n\t */\n\texport interface Props extends TagProps<\"label\"> {}\n}\n\n/**\n * Renders its children inside a native `<label>` element, sized and colored\n * as a form field caption. Pair it with a field by setting `htmlFor` to the\n * field's `id`, or wrap the field directly so the platform associates them.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * @example\n * <Label>\n * \t{t(\"form.newsletter.label\")}\n * \t<input type=\"checkbox\" name=\"newsletter\" />\n * </Label>\n */\nexport function Label(handle: Handle<Label.Props>) {\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\tmix={mergeMix(\n\t\t\t\t\t[weight(\"medium\"), fg(\"neutral.emphasis\"), fontSize(\"sm\"), leading(\"none\")],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "link-button",
3
- "changedIn": "2026.10.29",
4
- "dependencies": [],
3
+ "changedIn": "2026.11.1",
4
+ "dependencies": [
5
+ "cta-group"
6
+ ],
5
7
  "exports": [
6
8
  "LinkButton"
7
9
  ],
8
10
  "source": {
9
11
  "path": "link-button.tsx",
10
- "content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, userSelect } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text, weight } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Marketing pairing: `\"sm\"` is ~32px for nav rows, `\"lg\"` is ~48px for\n\t * hero {@link CtaGroup} actions — keep those slots on different sizes.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, 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\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={[\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\tinteractiveTransition(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
12
+ "content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { surfaceControl } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\nimport { CtaGroup } from \"@sdxc/ui/cta-group\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, a fully\n\t * transparent fill with just a colored label, or a raised `surface` fill with\n\t * the emphasis ink and a tactile edge — a secondary that reads as a control\n\t * beside a solid primary, and turns translucent inside inverse and brand bands.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\" | \"surface\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Inside a {@link CtaGroup} an omitted size takes the group's, so a hero row\n\t * sizes every action at once; `\"md\"` is the 40px landing CTA.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, 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\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet group = handle.context.get(CtaGroup) as CtaGroup.Context | undefined;\n\t\tlet resolvedSize = size ?? group?.size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-button-radius, var(--ui-radius-md, 0.375rem))\",\n\t\t\t\t\t\t\t\tfontWeight: \"var(--ui-button-weight, 500)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"surface\", surfaceControl()),\n\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmix,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
11
13
  },
12
14
  "test": {
13
15
  "path": "link-button.test.tsx",
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "link",
3
- "changedIn": "2026.10.24",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Link"
7
7
  ],
8
8
  "source": {
9
9
  "path": "link.tsx",
10
- "content": "/**\n * A native anchor for inline navigation, always underlined so its\n * affordance never rests on color alone, and colored through a semantic\n * color role that also drives its focus ring and disabled state.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { colorMix, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw, var as varUtility } from \"@sdxc/u/general\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { textDecoration } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"brand\";\n\n/** Prefetch mode {@link Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Link.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Link}.\n */\nexport namespace Link {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link Link}. A type alias rather than an interface,\n\t * since the native anchor props resolve through a conditional type that an\n\t * `interface extends` clause can't statically extend.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, 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\n/**\n * Renders a native `<a>` host, colored through the `data-color` attribute\n * contract and underlined unconditionally. `aria-disabled=\"true\"` mutes the\n * link, but only removing or neutralizing `href` actually stops navigation.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <Link href=\"/about\">{t(\"nav.about\")}</Link>\n * @example\n * <Link href=\"/products/shirt\" prefetch=\"render\">{t(\"products.shirt\")}</Link>\n * @example\n * <Link href=\"/settings\" aria-disabled=\"true\">{t(\"nav.settings\")}</Link>\n */\nexport function Link(handle: Handle<Link.Props>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={[\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\tinteractiveTransition(),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", fg(\"brand\")),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", fg(\"neutral\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", fg(\"success\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", fg(\"danger\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", fg(\"warning\")),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\ttextDecoration(\"underline\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * `color-mix()`'s color argument needs the raw CSS variable\n\t\t\t\t\t\t\t * (`var(--ui-brand-fg)`), so the property stays `raw()` while\n\t\t\t\t\t\t\t * the literal string becomes a builder call.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-brand-fg\"), 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\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-brand-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-neutral-fg\"), weight: 50 },\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\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-neutral-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-success-fg\"), 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\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-success-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-danger-fg\"), 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\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-danger-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-warning-fg\"), 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\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-warning-fg\") })),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), textDecoration(\"none\")]),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t/>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
10
+ "content": "/**\n * A native anchor for inline navigation, always underlined so its\n * affordance never rests on color alone, and colored through a semantic\n * color role that also drives its focus ring and disabled state.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { colorMix, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw, var as varUtility, mergeMix } from \"@sdxc/u/general\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { textDecoration } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"brand\";\n\n/** Prefetch mode {@link Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Link.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Link}.\n */\nexport namespace Link {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link Link}. A type alias rather than an interface,\n\t * since the native anchor props resolve through a conditional type that an\n\t * `interface extends` clause can't statically extend.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, 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\n/**\n * Renders a native `<a>` host, colored through the `data-color` attribute\n * contract and underlined unconditionally. `aria-disabled=\"true\"` mutes the\n * link, but only removing or neutralizing `href` actually stops navigation.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <Link href=\"/about\">{t(\"nav.about\")}</Link>\n * @example\n * <Link href=\"/products/shirt\" prefetch=\"render\">{t(\"products.shirt\")}</Link>\n * @example\n * <Link href=\"/settings\" aria-disabled=\"true\">{t(\"nav.settings\")}</Link>\n */\nexport function Link(handle: Handle<Link.Props>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", fg(\"brand\")),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", fg(\"neutral\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", fg(\"success\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", fg(\"danger\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", fg(\"warning\")),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\t\ttextDecoration(\"underline\"),\n\t\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * `color-mix()`'s color argument needs the raw CSS variable\n\t\t\t\t\t\t\t\t * (`var(--ui-brand-fg)`), so the property stays `raw()` while\n\t\t\t\t\t\t\t\t * the literal string becomes a builder call.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-brand-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-brand-fg\") })),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-neutral-fg\"), weight: 50 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-neutral-fg\") })),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-success-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-success-fg\") })),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-danger-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-danger-fg\") })),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\ttextDecorationColor: colorMix(\n\t\t\t\t\t\t\t\t\t\t\"srgb\",\n\t\t\t\t\t\t\t\t\t\t{ color: varUtility(\"ui-warning-fg\"), weight: 60 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", raw({ textDecorationColor: varUtility(\"ui-warning-fg\") })),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), textDecoration(\"none\")]),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmix,\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
11
11
  },
12
12
  "test": {
13
13
  "path": "link.test.tsx",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listbox",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [
5
5
  "sentinel-row"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "listbox.tsx",
12
- "content": "/**\n * A run of selectable option rows sharing one native grouping name — each\n * {@link ListBox.Item} pairs a visually hidden `<input type=\"radio\">` or\n * `<input type=\"checkbox\">` with its own visible content, so every focus,\n * keyboard, and form-submission semantic keeps coming from the platform\n * itself. The host renders as a scrollable column reading each option's\n * `:checked` and `:focus` state through a `:has()` selector to color the\n * whole row, with no selection state tracked anywhere in this module.\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 { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor } from \"@sdxc/u/general\";\nimport { flex, gap, items } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { maxBs, pb, pi } from \"@sdxc/u/size\";\nimport { active, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { surfaceInset } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { SentinelRow } from \"@sdxc/ui/sentinel-row\";\n\n/**\n * Default {@link ListBox.Props} selection cardinality, applied when\n * `multiple` is omitted, rendering every {@link ListBox.Item} as a native\n * `<input type=\"radio\">` limiting the group to one selected option.\n */\nconst DEFAULT_MULTIPLE = false;\n\n/**\n * Prop types for {@link ListBox} and its {@link ListBox.Item} compound part.\n */\nexport namespace ListBox {\n\t/**\n\t * Value {@link ListBox} stores in component context so every\n\t * {@link ListBox.Item} nested inside shares the same grouping name and\n\t * selection cardinality without repeating them on each option.\n\t */\n\texport interface Context {\n\t\t/** Shared `name` every {@link ListBox.Item} reads unless it sets its own. */\n\t\tname: string;\n\t\t/**\n\t\t * Whether an option's underlying input renders as a checkbox (`true`,\n\t\t * letting several options be selected at once) or a radio (`false`,\n\t\t * limiting the group to a single selected option).\n\t\t */\n\t\tmultiple: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Native grouping name shared by every {@link ListBox.Item} nested inside,\n\t\t * provided through component context. Defaults to the group's own\n\t\t * {@link Handle.id | stable instance id}, so options always group correctly.\n\t\t */\n\t\tname?: string;\n\t\t/**\n\t\t * Renders every option as a checkbox, allowing more than one selected\n\t\t * at once, instead of the default mutually exclusive radio behavior.\n\t\t * Defaults to {@link DEFAULT_MULTIPLE}.\n\t\t */\n\t\tmultiple?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox.Item}.\n\t */\n\texport interface ItemProps extends Omit<TagProps<\"label\">, \"children\"> {\n\t\t/** Value submitted with the enclosing form when this option is selected. */\n\t\tvalue: string;\n\t\t/**\n\t\t * Native grouping name for this option's underlying input. Defaults to\n\t\t * the name provided by the nearest ancestor {@link ListBox} — set this\n\t\t * only to opt a single option out of its group's shared name.\n\t\t */\n\t\tname?: string;\n\t\t/** Whether this option starts selected, for a form that never tracks selection itself. */\n\t\tdefaultChecked?: boolean;\n\t\t/** Whether this option is selected, for a form that tracks selection itself. */\n\t\tchecked?: boolean;\n\t\t/** Whether this option is inert and excluded from the group's tab order. */\n\t\tdisabled?: boolean;\n\t\t/**\n\t\t * Sets the underlying input's native `required` attribute. On a radio\n\t\t * input this requires at least one option in the group be selected; on\n\t\t * a checkbox input it requires this specific option be checked.\n\t\t */\n\t\trequired?: boolean;\n\t\t/** The option's visible content, associated with the input by native nesting. */\n\t\tchildren?: RemixNode;\n\t\t/**\n\t\t * Per-part styling for the option's hidden `input` element, layered\n\t\t * after its own built-in styling. Use the `mix` prop instead to style\n\t\t * the option's outer `<label>` host.\n\t\t */\n\t\tparts?: {\n\t\t\t/** Additional mixin(s) applied to the hidden native `<input>`. */\n\t\t\tinput?: TagProps<\"input\">[\"mix\"];\n\t\t};\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox.LoadMoreItem}.\n\t */\n\texport interface LoadMoreItemProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders the group host: a `<div>` laying its {@link ListBox.Item} options\n * out as a scrollable column capped at a fixed block size and rounded\n * concentric with its rows, with `role` defaulting to `\"radiogroup\"` for\n * single selection or `\"group\"` for `multiple`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ListBox.Context}.\n * @returns The render function producing the group's markup.\n * @example\n * <ListBox aria-label={t(\"settings.theme\")}>\n * \t<ListBox.Item value=\"light\" defaultChecked>{t(\"settings.themeLight\")}</ListBox.Item>\n * \t<ListBox.Item value=\"dark\">{t(\"settings.themeDark\")}</ListBox.Item>\n * \t<ListBox.Item value=\"system\">{t(\"settings.themeSystem\")}</ListBox.Item>\n * </ListBox>\n * @example\n * <ListBox aria-label={t(\"settings.notifications\")} multiple>\n * \t<Section aria-labelledby=\"notifications-heading\">\n * \t\t<Header id=\"notifications-heading\">{t(\"settings.channels\")}</Header>\n * \t\t<ListBox.Item value=\"email\" defaultChecked>{t(\"settings.email\")}</ListBox.Item>\n * \t\t<ListBox.Item value=\"sms\">{t(\"settings.sms\")}</ListBox.Item>\n * \t</Section>\n * </ListBox>\n */\nexport function ListBox(handle: Handle<ListBox.Props, ListBox.Context>) {\n\treturn () => {\n\t\tlet { name, multiple, mix, ...rest } = handle.props;\n\t\tlet resolvedName = name ?? handle.id;\n\t\tlet resolvedMultiple = multiple ?? DEFAULT_MULTIPLE;\n\n\t\thandle.context.set({ name: resolvedName, multiple: resolvedMultiple });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: resolvedMultiple ? \"group\" : \"radiogroup\" }),\n\t\t\t\t\tmaxBs(60),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\tsurfaceInset(),\n\t\t\t\t\toutline(\"none\"),\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 option: a native `<label>` pairing a visually hidden\n * radio or checkbox input with the option's content. In dev mode, an\n * option with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the option's markup.\n * @example\n * <ListBox.Item value=\"dog\">{t(\"pet.dog\")}</ListBox.Item>\n * @example\n * <ListBox.Item value=\"cat\" defaultChecked>{t(\"pet.cat\")}</ListBox.Item>\n * @example\n * <ListBox.Item value=\"hamster\" disabled>{t(\"pet.hamster\")}</ListBox.Item>\n */\nListBox.Item = function ListBoxItem(handle: Handle<ListBox.ItemProps>) {\n\treturn () => {\n\t\tlet {\n\t\t\tvalue,\n\t\t\tname,\n\t\t\tchecked,\n\t\t\tdefaultChecked,\n\t\t\tdisabled,\n\t\t\trequired,\n\t\t\tchildren,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet context = handle.context.get(ListBox);\n\t\tlet resolvedName = name ?? context.name;\n\t\tlet type: \"checkbox\" | \"radio\" = context.multiple ? \"checkbox\" : \"radio\";\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"ListBox.Item: an option with no visible text needs an `aria-label` describing it — assistive technology has no accessible name to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(2),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\twhen(\"&:has(input:focus)\", bg(\"brand.bg-tint-pressed\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * The row the keyboard is on is where the next Enter lands, so it is shown before it is\n\t\t\t\t\t * chosen. The tint stops at the selected row, which keeps its stronger fill while walked past.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&[data-highlighted=\"true\"]:not(:has(input:checked)):not([aria-selected=\"true\"])', [\n\t\t\t\t\t\tbg(\"brand.bg-tint-pressed\"),\n\t\t\t\t\t\tfg(\"brand.emphasis\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&:has(input:checked), &[aria-selected=\"true\"]', [\n\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&:has(input:disabled), &[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<input\n\t\t\t\t\ttype={type}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tname={resolvedName}\n\t\t\t\t\tchecked={checked}\n\t\t\t\t\tdefaultChecked={defaultChecked}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tmix={[visuallyHidden(), parts?.input]}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders a decorative sentinel row: a `<div>` styled as a centered, muted\n * line of small text sized to match {@link ListBox.Item}'s vertical rhythm,\n * ready to hold a loading indicator or \"load more\" trigger as `children`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the sentinel row's markup.\n * @example\n * <ListBox.LoadMoreItem>{t(\"list.loadingMore\")}</ListBox.LoadMoreItem>\n */\nListBox.LoadMoreItem = SentinelRow;\n"
12
+ "content": "/**\n * A run of selectable option rows sharing one native grouping name — each\n * {@link ListBox.Item} pairs a visually hidden `<input type=\"radio\">` or\n * `<input type=\"checkbox\">` with its own visible content, so every focus,\n * keyboard, and form-submission semantic keeps coming from the platform\n * itself. The host renders as a scrollable column reading each option's\n * `:checked` and `:focus` state through a `:has()` selector to color the\n * whole row, with no selection state tracked anywhere in this module.\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 { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, mergeMix } from \"@sdxc/u/general\";\nimport { flex, gap, items } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { maxBs, pb, pi } from \"@sdxc/u/size\";\nimport { active, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { surfaceInset } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { SentinelRow } from \"@sdxc/ui/sentinel-row\";\n\n/**\n * Default {@link ListBox.Props} selection cardinality, applied when\n * `multiple` is omitted, rendering every {@link ListBox.Item} as a native\n * `<input type=\"radio\">` limiting the group to one selected option.\n */\nconst DEFAULT_MULTIPLE = false;\n\n/**\n * Prop types for {@link ListBox} and its {@link ListBox.Item} compound part.\n */\nexport namespace ListBox {\n\t/**\n\t * Value {@link ListBox} stores in component context so every\n\t * {@link ListBox.Item} nested inside shares the same grouping name and\n\t * selection cardinality without repeating them on each option.\n\t */\n\texport interface Context {\n\t\t/** Shared `name` every {@link ListBox.Item} reads unless it sets its own. */\n\t\tname: string;\n\t\t/**\n\t\t * Whether an option's underlying input renders as a checkbox (`true`,\n\t\t * letting several options be selected at once) or a radio (`false`,\n\t\t * limiting the group to a single selected option).\n\t\t */\n\t\tmultiple: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Native grouping name shared by every {@link ListBox.Item} nested inside,\n\t\t * provided through component context. Defaults to the group's own\n\t\t * {@link Handle.id | stable instance id}, so options always group correctly.\n\t\t */\n\t\tname?: string;\n\t\t/**\n\t\t * Renders every option as a checkbox, allowing more than one selected\n\t\t * at once, instead of the default mutually exclusive radio behavior.\n\t\t * Defaults to {@link DEFAULT_MULTIPLE}.\n\t\t */\n\t\tmultiple?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox.Item}.\n\t */\n\texport interface ItemProps extends Omit<TagProps<\"label\">, \"children\"> {\n\t\t/** Value submitted with the enclosing form when this option is selected. */\n\t\tvalue: string;\n\t\t/**\n\t\t * Native grouping name for this option's underlying input. Defaults to\n\t\t * the name provided by the nearest ancestor {@link ListBox} — set this\n\t\t * only to opt a single option out of its group's shared name.\n\t\t */\n\t\tname?: string;\n\t\t/** Whether this option starts selected, for a form that never tracks selection itself. */\n\t\tdefaultChecked?: boolean;\n\t\t/** Whether this option is selected, for a form that tracks selection itself. */\n\t\tchecked?: boolean;\n\t\t/** Whether this option is inert and excluded from the group's tab order. */\n\t\tdisabled?: boolean;\n\t\t/**\n\t\t * Sets the underlying input's native `required` attribute. On a radio\n\t\t * input this requires at least one option in the group be selected; on\n\t\t * a checkbox input it requires this specific option be checked.\n\t\t */\n\t\trequired?: boolean;\n\t\t/** The option's visible content, associated with the input by native nesting. */\n\t\tchildren?: RemixNode;\n\t\t/**\n\t\t * Per-part styling for the option's hidden `input` element, layered\n\t\t * after its own built-in styling. Use the `mix` prop instead to style\n\t\t * the option's outer `<label>` host.\n\t\t */\n\t\tparts?: {\n\t\t\t/** Additional mixin(s) applied to the hidden native `<input>`. */\n\t\t\tinput?: TagProps<\"input\">[\"mix\"];\n\t\t};\n\t}\n\n\t/**\n\t * Props accepted by {@link ListBox.LoadMoreItem}.\n\t */\n\texport interface LoadMoreItemProps extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders the group host: a `<div>` laying its {@link ListBox.Item} options\n * out as a scrollable column capped at a fixed block size and rounded\n * concentric with its rows, with `role` defaulting to `\"radiogroup\"` for\n * single selection or `\"group\"` for `multiple`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ListBox.Context}.\n * @returns The render function producing the group's markup.\n * @example\n * <ListBox aria-label={t(\"settings.theme\")}>\n * \t<ListBox.Item value=\"light\" defaultChecked>{t(\"settings.themeLight\")}</ListBox.Item>\n * \t<ListBox.Item value=\"dark\">{t(\"settings.themeDark\")}</ListBox.Item>\n * \t<ListBox.Item value=\"system\">{t(\"settings.themeSystem\")}</ListBox.Item>\n * </ListBox>\n * @example\n * <ListBox aria-label={t(\"settings.notifications\")} multiple>\n * \t<Section aria-labelledby=\"notifications-heading\">\n * \t\t<Header id=\"notifications-heading\">{t(\"settings.channels\")}</Header>\n * \t\t<ListBox.Item value=\"email\" defaultChecked>{t(\"settings.email\")}</ListBox.Item>\n * \t\t<ListBox.Item value=\"sms\">{t(\"settings.sms\")}</ListBox.Item>\n * \t</Section>\n * </ListBox>\n */\nexport function ListBox(handle: Handle<ListBox.Props, ListBox.Context>) {\n\treturn () => {\n\t\tlet { name, multiple, mix, ...rest } = handle.props;\n\t\tlet resolvedName = name ?? handle.id;\n\t\tlet resolvedMultiple = multiple ?? DEFAULT_MULTIPLE;\n\n\t\thandle.context.set({ name: resolvedName, multiple: resolvedMultiple });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ role: resolvedMultiple ? \"group\" : \"radiogroup\" }),\n\t\t\t\t\t\tmaxBs(60),\n\t\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t\tsurfaceInset(),\n\t\t\t\t\t\toutline(\"none\"),\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 option: a native `<label>` pairing a visually hidden\n * radio or checkbox input with the option's content. In dev mode, an\n * option with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the option's markup.\n * @example\n * <ListBox.Item value=\"dog\">{t(\"pet.dog\")}</ListBox.Item>\n * @example\n * <ListBox.Item value=\"cat\" defaultChecked>{t(\"pet.cat\")}</ListBox.Item>\n * @example\n * <ListBox.Item value=\"hamster\" disabled>{t(\"pet.hamster\")}</ListBox.Item>\n */\nListBox.Item = function ListBoxItem(handle: Handle<ListBox.ItemProps>) {\n\treturn () => {\n\t\tlet {\n\t\t\tvalue,\n\t\t\tname,\n\t\t\tchecked,\n\t\t\tdefaultChecked,\n\t\t\tdisabled,\n\t\t\trequired,\n\t\t\tchildren,\n\t\t\tparts,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet context = handle.context.get(ListBox);\n\t\tlet resolvedName = name ?? context.name;\n\t\tlet type: \"checkbox\" | \"radio\" = context.multiple ? \"checkbox\" : \"radio\";\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"ListBox.Item: an option with no visible text needs an `aria-label` describing it — assistive technology has no accessible name to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\twhen(\"&:has(input:focus)\", bg(\"brand.bg-tint-pressed\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row the keyboard is on is where the next Enter lands, so it is shown before it is\n\t\t\t\t\t\t * chosen. The tint stops at the selected row, which keeps its stronger fill while walked past.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-highlighted=\"true\"]:not(:has(input:checked)):not([aria-selected=\"true\"])',\n\t\t\t\t\t\t\t[bg(\"brand.bg-tint-pressed\"), fg(\"brand.emphasis\")],\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen('&:has(input:checked), &[aria-selected=\"true\"]', [\n\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&:has(input:disabled), &[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\toutline(\"none\"),\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<input\n\t\t\t\t\ttype={type}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tname={resolvedName}\n\t\t\t\t\tchecked={checked}\n\t\t\t\t\tdefaultChecked={defaultChecked}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tmix={[visuallyHidden(), parts?.input]}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders a decorative sentinel row: a `<div>` styled as a centered, muted\n * line of small text sized to match {@link ListBox.Item}'s vertical rhythm,\n * ready to hold a loading indicator or \"load more\" trigger as `children`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the sentinel row's markup.\n * @example\n * <ListBox.LoadMoreItem>{t(\"list.loadingMore\")}</ListBox.LoadMoreItem>\n */\nListBox.LoadMoreItem = SentinelRow;\n"
13
13
  },
14
14
  "test": null
15
15
  }