@sdxc/kit 2026.10.30 → 2026.11.3

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 (162) hide show
  1. package/README.md +59 -0
  2. package/changelog.jsonl +346 -0
  3. package/config.schema.json +14 -0
  4. package/dist/ci/install.d.ts +15 -0
  5. package/dist/ci/install.js +27 -0
  6. package/dist/ci/locate.d.ts +23 -0
  7. package/dist/ci/locate.js +43 -0
  8. package/dist/cli.js +5 -0
  9. package/dist/commands/ci/list.d.ts +16 -0
  10. package/dist/commands/ci/list.js +24 -0
  11. package/dist/commands/ci/run.d.ts +65 -0
  12. package/dist/commands/ci/run.js +36 -0
  13. package/dist/commands/ci/signoff.d.ts +15 -0
  14. package/dist/commands/ci/signoff.js +15 -0
  15. package/dist/commands/ci/verify.d.ts +17 -0
  16. package/dist/commands/ci/verify.js +15 -0
  17. package/dist/commands/create.js +3 -0
  18. package/dist/commands/pkg.d.ts +16 -0
  19. package/dist/commands/pkg.js +71 -0
  20. package/dist/commands/routes.d.ts +1 -1
  21. package/dist/config.d.ts +10 -4
  22. package/dist/config.js +8 -0
  23. package/dist/contract.d.ts +60 -1
  24. package/dist/contract.js +46 -0
  25. package/dist/create/workspace.d.ts +15 -0
  26. package/dist/create/workspace.js +42 -0
  27. package/dist/doctor/checks.js +4 -0
  28. package/dist/doctor/ci.d.ts +15 -0
  29. package/dist/doctor/ci.js +63 -0
  30. package/dist/doctor/translations.d.ts +19 -0
  31. package/dist/doctor/translations.js +144 -0
  32. package/dist/make/declare.js +32 -11
  33. package/dist/package-manager.d.ts +2 -0
  34. package/dist/package-manager.js +16 -2
  35. package/dist/pkg/catalog.d.ts +12 -0
  36. package/dist/pkg/catalog.js +153 -0
  37. package/dist/pkg/resolve.d.ts +67 -0
  38. package/dist/pkg/resolve.js +147 -0
  39. package/dist/upgrade/changelog.d.ts +2 -2
  40. package/dist/upgrade/project.d.ts +2 -2
  41. package/package.json +10 -8
  42. package/registry/ui/accordion.json +2 -2
  43. package/registry/ui/alert-dialog.json +2 -2
  44. package/registry/ui/alert.json +2 -2
  45. package/registry/ui/aspect-ratio.json +2 -2
  46. package/registry/ui/avatar.json +6 -3
  47. package/registry/ui/badge.json +2 -2
  48. package/registry/ui/banner.json +16 -0
  49. package/registry/ui/breadcrumbs.json +2 -2
  50. package/registry/ui/button.json +5 -3
  51. package/registry/ui/calendar.json +2 -2
  52. package/registry/ui/card.json +2 -2
  53. package/registry/ui/carousel.json +2 -2
  54. package/registry/ui/checkbox-group.json +2 -2
  55. package/registry/ui/checkbox.json +2 -2
  56. package/registry/ui/combobox.json +2 -2
  57. package/registry/ui/command.json +2 -2
  58. package/registry/ui/confirm.json +8 -4
  59. package/registry/ui/cta-group.json +2 -2
  60. package/registry/ui/date-field.json +2 -2
  61. package/registry/ui/date-picker.json +2 -2
  62. package/registry/ui/date-range-picker.json +2 -2
  63. package/registry/ui/description.json +2 -2
  64. package/registry/ui/dialog-dismiss.json +13 -0
  65. package/registry/ui/dialog.json +2 -2
  66. package/registry/ui/disclosure.json +2 -2
  67. package/registry/ui/drawer.json +2 -2
  68. package/registry/ui/field-error.json +2 -2
  69. package/registry/ui/form.json +2 -2
  70. package/registry/ui/group.json +2 -2
  71. package/registry/ui/header.json +2 -2
  72. package/registry/ui/heading-scope.json +2 -2
  73. package/registry/ui/heading.json +3 -3
  74. package/registry/ui/highlight.json +3 -3
  75. package/registry/ui/hover-card.json +2 -2
  76. package/registry/ui/image-placeholder.json +2 -2
  77. package/registry/ui/input.json +2 -2
  78. package/registry/ui/item.json +2 -2
  79. package/registry/ui/keyboard.json +2 -2
  80. package/registry/ui/label.json +2 -2
  81. package/registry/ui/link-button.json +5 -3
  82. package/registry/ui/link.json +2 -2
  83. package/registry/ui/listbox.json +2 -2
  84. package/registry/ui/menu.json +2 -2
  85. package/registry/ui/meter.json +2 -2
  86. package/registry/ui/modal.json +2 -2
  87. package/registry/ui/nav-link.json +2 -2
  88. package/registry/ui/navigation-menu.json +2 -2
  89. package/registry/ui/number-field.json +2 -2
  90. package/registry/ui/otp-field.json +2 -2
  91. package/registry/ui/overlay-arrow.json +2 -2
  92. package/registry/ui/pagination.json +2 -2
  93. package/registry/ui/popover.json +2 -2
  94. package/registry/ui/progress-bar.json +2 -2
  95. package/registry/ui/property-list.json +18 -0
  96. package/registry/ui/radio-group.json +2 -2
  97. package/registry/ui/range-calendar.json +2 -2
  98. package/registry/ui/relative-time.json +17 -0
  99. package/registry/ui/scroll-area.json +2 -2
  100. package/registry/ui/search-field.json +2 -2
  101. package/registry/ui/section.json +2 -2
  102. package/registry/ui/select.json +2 -2
  103. package/registry/ui/selection-indicator.json +2 -2
  104. package/registry/ui/sentinel-row.json +2 -2
  105. package/registry/ui/separator.json +2 -2
  106. package/registry/ui/shared-element.json +2 -2
  107. package/registry/ui/sheet.json +2 -2
  108. package/registry/ui/sidebar.json +2 -2
  109. package/registry/ui/slider.json +2 -2
  110. package/registry/ui/spinner.json +2 -2
  111. package/registry/ui/status-dot.json +16 -0
  112. package/registry/ui/switch.json +2 -2
  113. package/registry/ui/tabs.json +2 -2
  114. package/registry/ui/tag-group.json +2 -2
  115. package/registry/ui/text-field.json +7 -3
  116. package/registry/ui/text.json +2 -2
  117. package/registry/ui/textarea.json +2 -2
  118. package/registry/ui/time-field.json +2 -2
  119. package/registry/ui/timeline.json +16 -0
  120. package/registry/ui/toggle-button.json +2 -2
  121. package/registry/ui/tooltip.json +2 -2
  122. package/registry/ui/typeset.json +2 -2
  123. package/registry/ui/youtube-embed.json +2 -2
  124. package/stubs/scaffold.controller.index.stub +1 -1
  125. package/templates/app/.config/sdxc/ci.ts +26 -0
  126. package/templates/app/.github/workflows/ci.yml +46 -0
  127. package/templates/app/README.md +4 -0
  128. package/templates/app/package.json +1 -0
  129. package/templates/app/public/_headers +4 -0
  130. package/registry/ui/attachment.json +0 -15
  131. package/registry/ui/bubble.json +0 -13
  132. package/registry/ui/chart.json +0 -13
  133. package/registry/ui/color-area.json +0 -13
  134. package/registry/ui/color-field.json +0 -20
  135. package/registry/ui/color-picker.json +0 -17
  136. package/registry/ui/color-slider.json +0 -13
  137. package/registry/ui/color-swatch-picker.json +0 -15
  138. package/registry/ui/color-swatch.json +0 -13
  139. package/registry/ui/color-wheel.json +0 -13
  140. package/registry/ui/context-menu.json +0 -16
  141. package/registry/ui/drop-indicator.json +0 -13
  142. package/registry/ui/drop-zone.json +0 -13
  143. package/registry/ui/empty.json +0 -15
  144. package/registry/ui/feature.json +0 -18
  145. package/registry/ui/file-trigger.json +0 -13
  146. package/registry/ui/grid-list.json +0 -18
  147. package/registry/ui/logo-cloud.json +0 -16
  148. package/registry/ui/marker.json +0 -13
  149. package/registry/ui/marketing-header.json +0 -18
  150. package/registry/ui/marketing-section.json +0 -16
  151. package/registry/ui/menubar.json +0 -13
  152. package/registry/ui/message-scroller.json +0 -16
  153. package/registry/ui/message.json +0 -13
  154. package/registry/ui/resizable.json +0 -13
  155. package/registry/ui/shortcut-list.json +0 -18
  156. package/registry/ui/skeleton.json +0 -13
  157. package/registry/ui/split.json +0 -16
  158. package/registry/ui/stat-strip.json +0 -16
  159. package/registry/ui/table.json +0 -16
  160. package/registry/ui/toast.json +0 -16
  161. package/registry/ui/toolbar.json +0 -13
  162. package/registry/ui/tree.json +0 -18
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alert",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [
5
5
  "heading-scope"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "alert.tsx",
12
- "content": "/**\n * An inline status message rendered as a bordered, tinted panel, colored by\n * one of five semantic tones and announced to assistive technology through\n * `role=\"alert\"` plus a configurable `aria-live` politeness. Compound parts\n * cover an optional leading icon, a title/description content block, and a\n * trailing action, so a page composes only the parts a given message needs.\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 { border, colorMix, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { absolute, basis, gap, grow, inset, relative, self, shrink, vstack } from \"@sdxc/u/layout\";\nimport { bs, is, mbe, minIs, p, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { balance, fontSize, leading, pretty, tracking, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { semanticColorPanel } from \"@sdxc/ui/styles\";\nimport { DEFAULT_ICON_ARIA_HIDDEN } from \"@sdxc/ui/utils\";\n\nimport { resolveHeadingLevel, TAG_BY_LEVEL } from \"@sdxc/ui/heading-scope\";\n\n/**\n * `role=\"alert\"` applied through {@link attrs} unless a consumer supplies\n * its own `role`, keeping the panel announced as an ARIA alert by default.\n */\nconst DEFAULT_ROLE = \"alert\";\n\n/**\n * Default {@link Alert.Props.color}, rendering an alert with the neutral\n * tone when a consumer names no semantic color.\n */\nconst DEFAULT_COLOR = \"neutral\";\n\n/**\n * Default {@link Alert.Props.live}, announcing an alert's content politely so\n * assistive technology finishes its current utterance first.\n */\nconst DEFAULT_LIVE = \"polite\";\n\n/**\n * `aria-atomic=\"true\"` applied through {@link attrs} unless a consumer\n * overrides it, so assistive technology re-reads the whole alert on update.\n */\nconst DEFAULT_ARIA_ATOMIC = \"true\";\n\n/**\n * Prop types for {@link Alert} and its compound parts.\n */\nexport namespace Alert {\n\t/**\n\t * Semantic tone driving the host element's border, tint, and foreground\n\t * color through the `--ui-*` variables for that color.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * `aria-live` politeness applied to the host element. `\"off\"` omits the\n\t * `aria-live` attribute, leaving the element's implicit live-region\n\t * behavior in place.\n\t */\n\texport type Live = \"polite\" | \"assertive\" | \"off\";\n\n\t/**\n\t * Props accepted by {@link Alert}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Semantic tone of the alert. Default: `\"neutral\"`. */\n\t\tcolor?: Color;\n\t\t/** `aria-live` politeness for dynamic alerts. Default: `\"polite\"`. */\n\t\tlive?: Live;\n\t\t/** The alert's compound parts: {@link Alert.Icon}, {@link Alert.Content}, {@link Alert.Action}, or any other content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Icon}.\n\t */\n\texport interface IconProps extends TagProps<\"div\"> {\n\t\t/** The icon graphic, typically a single SVG icon. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** The alert's title, description, or other body content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Title}. Every native heading-element\n\t * attribute applies, since the rendered tag follows the nearest ambient\n\t * heading level, falling back to `<h1>`.\n\t */\n\texport interface TitleProps extends TagProps<\"h1\"> {\n\t\t/** The alert's heading text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** The alert's supporting message text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Action}.\n\t */\n\texport interface ActionProps extends TagProps<\"div\"> {\n\t\t/** A button, link, or other control the alert offers, e.g. \"Retry\" or \"Dismiss\". */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders an inline status panel tinted by {@link Alert.Props.color}, gaining\n * inline-start padding through `:has()` when a direct {@link Alert.Icon}\n * needs the room. `role`, `aria-atomic`, and `aria-live` stay overridable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the alert's markup.\n * @example\n * <Alert color=\"danger\">\n * <Alert.Icon><CircleAlertIcon /></Alert.Icon>\n * <Alert.Content>\n * <Alert.Title>{t(\"alerts.paymentFailed.title\")}</Alert.Title>\n * <Alert.Description>{t(\"alerts.paymentFailed.description\")}</Alert.Description>\n * </Alert.Content>\n * <Alert.Action>\n * <Button size=\"sm\">{t(\"alerts.paymentFailed.retry\")}</Button>\n * </Alert.Action>\n * </Alert>\n * @example\n * <Alert color=\"success\" live=\"assertive\">\n * <Alert.Content>\n * <Alert.Title>{t(\"alerts.saved.title\")}</Alert.Title>\n * </Alert.Content>\n * </Alert>\n */\nexport function Alert(handle: Handle<Alert.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor = DEFAULT_COLOR,\n\t\t\tlive = DEFAULT_LIVE,\n\t\t\t\"aria-live\": ariaLiveProp,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet ariaLive = ariaLiveProp ?? (live === \"off\" ? undefined : live);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\taria-live={ariaLive}\n\t\t\t\tdata-color={color}\n\t\t\t\tdata-slot=\"alert\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE, \"aria-atomic\": DEFAULT_ARIA_ATOMIC }),\n\t\t\t\t\tsemanticColorPanel(),\n\t\t\t\t\trelative(),\n\t\t\t\t\tvstack({ align: \"start\" }),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tgap(3),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tp(4),\n\t\t\t\t\twhen('&:has(> [data-slot=\"icon\"])', pis(10)),\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 Alert.IconProps.children} as the alert's leading icon,\n * absolutely positioned at the panel's inline/block-start corner with any\n * direct SVG sized to `1rem`. Decorative, since the text carries the meaning.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the icon's markup.\n */\nAlert.Icon = function AlertIcon(handle: Handle<Alert.IconProps>) {\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=\"icon\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinset(4, \"auto\", \"auto\", 4),\n\t\t\t\t\twhen(\"& > svg\", [is(4), bs(4)]),\n\t\t\t\t\tfg(\"currentcolor\"),\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 Alert.ContentProps.children} as the alert's body block: a\n * column flex container that shrinks to fit alongside a leading icon or\n * trailing action, holding {@link Alert.Title} and {@link Alert.Description}.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content block's markup.\n */\nAlert.Content = function AlertContent(handle: Handle<Alert.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={[vstack({ gap: 1 }), minIs(0), 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 Alert.TitleProps.children} as the alert's heading, inside\n * the native heading element matching the nearest ancestor `HeadingScope`'s\n * depth — or `<h1>` where no scope wraps it — styled as a small, tight label.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the title's markup.\n */\nAlert.Title = function AlertTitle(handle: Handle<Alert.TitleProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\t\tlet resolved = resolveHeadingLevel(handle);\n\t\tlet Tag = TAG_BY_LEVEL[resolved];\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\t{...rest}\n\t\t\t\tdata-heading-level={resolved}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={[\n\t\t\t\t\tmbe(1),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tleading(1),\n\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tbalance(),\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</Tag>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Alert.DescriptionProps.children} as the alert's supporting\n * message, slightly translucent against the alert's foreground color so it\n * reads as secondary to the title. Any nested `<p>` keeps its line height.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n */\nAlert.Description = function AlertDescription(handle: Handle<Alert.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\tleading(\"relaxed\"),\n\t\t\t\t\twhen(\"& p\", leading(\"relaxed\")),\n\t\t\t\t\tpretty(),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tfg(colorMix(\"oklab\", { color: \"currentcolor\", weight: 70 }, \"transparent\")),\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 Alert.ActionProps.children} as the alert's trailing\n * control — a button, link, or dismiss affordance — pinned to the panel's\n * block-start edge at its own natural size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action's markup.\n */\nAlert.Action = function AlertAction(handle: Handle<Alert.ActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"action\" mix={[shrink(), self(\"start\"), mix]}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
12
+ "content": "/**\n * An inline status message rendered as a bordered, tinted panel, colored by\n * one of five semantic tones and announced to assistive technology through\n * `role=\"alert\"` plus a configurable `aria-live` politeness. Compound parts\n * cover an optional leading icon, a title/description content block, and a\n * trailing action, so a page composes only the parts a given message needs.\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 { border, colorMix, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { absolute, basis, gap, grow, inset, relative, self, shrink, vstack } from \"@sdxc/u/layout\";\nimport { bs, is, mbe, minIs, p, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { balance, fontSize, leading, pretty, tracking, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { semanticColorPanel } from \"@sdxc/ui/styles\";\nimport { DEFAULT_ICON_ARIA_HIDDEN } from \"@sdxc/ui/utils\";\n\nimport { resolveHeadingLevel, TAG_BY_LEVEL } from \"@sdxc/ui/heading-scope\";\n\n/**\n * `role=\"alert\"` applied through {@link attrs} unless a consumer supplies\n * its own `role`, keeping the panel announced as an ARIA alert by default.\n */\nconst DEFAULT_ROLE = \"alert\";\n\n/**\n * Default {@link Alert.Props.color}, rendering an alert with the neutral\n * tone when a consumer names no semantic color.\n */\nconst DEFAULT_COLOR = \"neutral\";\n\n/**\n * Default {@link Alert.Props.live}, announcing an alert's content politely so\n * assistive technology finishes its current utterance first.\n */\nconst DEFAULT_LIVE = \"polite\";\n\n/**\n * `aria-atomic=\"true\"` applied through {@link attrs} unless a consumer\n * overrides it, so assistive technology re-reads the whole alert on update.\n */\nconst DEFAULT_ARIA_ATOMIC = \"true\";\n\n/**\n * Prop types for {@link Alert} and its compound parts.\n */\nexport namespace Alert {\n\t/**\n\t * Semantic tone driving the host element's border, tint, and foreground\n\t * color through the `--ui-*` variables for that color.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * `aria-live` politeness applied to the host element. `\"off\"` omits the\n\t * `aria-live` attribute, leaving the element's implicit live-region\n\t * behavior in place.\n\t */\n\texport type Live = \"polite\" | \"assertive\" | \"off\";\n\n\t/**\n\t * Props accepted by {@link Alert}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Semantic tone of the alert. Default: `\"neutral\"`. */\n\t\tcolor?: Color;\n\t\t/** `aria-live` politeness for dynamic alerts. Default: `\"polite\"`. */\n\t\tlive?: Live;\n\t\t/** The alert's compound parts: {@link Alert.Icon}, {@link Alert.Content}, {@link Alert.Action}, or any other content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Icon}.\n\t */\n\texport interface IconProps extends TagProps<\"div\"> {\n\t\t/** The icon graphic, typically a single SVG icon. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** The alert's title, description, or other body content. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Title}. Every native heading-element\n\t * attribute applies, since the rendered tag follows the nearest ambient\n\t * heading level, falling back to `<h1>`.\n\t */\n\texport interface TitleProps extends TagProps<\"h1\"> {\n\t\t/** The alert's heading text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** The alert's supporting message text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Alert.Action}.\n\t */\n\texport interface ActionProps extends TagProps<\"div\"> {\n\t\t/** A button, link, or other control the alert offers, e.g. \"Retry\" or \"Dismiss\". */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders an inline status panel tinted by {@link Alert.Props.color}, gaining\n * inline-start padding through `:has()` when a direct {@link Alert.Icon}\n * needs the room. `role`, `aria-atomic`, and `aria-live` stay overridable.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the alert's markup.\n * @example\n * <Alert color=\"danger\">\n * <Alert.Icon><CircleAlertIcon /></Alert.Icon>\n * <Alert.Content>\n * <Alert.Title>{t(\"alerts.paymentFailed.title\")}</Alert.Title>\n * <Alert.Description>{t(\"alerts.paymentFailed.description\")}</Alert.Description>\n * </Alert.Content>\n * <Alert.Action>\n * <Button size=\"sm\">{t(\"alerts.paymentFailed.retry\")}</Button>\n * </Alert.Action>\n * </Alert>\n * @example\n * <Alert color=\"success\" live=\"assertive\">\n * <Alert.Content>\n * <Alert.Title>{t(\"alerts.saved.title\")}</Alert.Title>\n * </Alert.Content>\n * </Alert>\n */\nexport function Alert(handle: Handle<Alert.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor = DEFAULT_COLOR,\n\t\t\tlive = DEFAULT_LIVE,\n\t\t\t\"aria-live\": ariaLiveProp,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet ariaLive = ariaLiveProp ?? (live === \"off\" ? undefined : live);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\taria-live={ariaLive}\n\t\t\t\tdata-color={color}\n\t\t\t\tdata-slot=\"alert\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ role: DEFAULT_ROLE, \"aria-atomic\": DEFAULT_ARIA_ATOMIC }),\n\t\t\t\t\t\tsemanticColorPanel(),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tvstack({ align: \"start\" }),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tgap(3),\n\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\tp(4),\n\t\t\t\t\t\twhen('&:has(> [data-slot=\"icon\"])', pis(10)),\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 Alert.IconProps.children} as the alert's leading icon,\n * absolutely positioned at the panel's inline/block-start corner with any\n * direct SVG sized to `1rem`. Decorative, since the text carries the meaning.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the icon's markup.\n */\nAlert.Icon = function AlertIcon(handle: Handle<Alert.IconProps>) {\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=\"icon\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(4, \"auto\", \"auto\", 4),\n\t\t\t\t\t\twhen(\"& > svg\", [is(4), bs(4)]),\n\t\t\t\t\t\tfg(\"currentcolor\"),\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 Alert.ContentProps.children} as the alert's body block: a\n * column flex container that shrinks to fit alongside a leading icon or\n * trailing action, holding {@link Alert.Title} and {@link Alert.Description}.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content block's markup.\n */\nAlert.Content = function AlertContent(handle: Handle<Alert.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([vstack({ gap: 1 }), minIs(0), 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 Alert.TitleProps.children} as the alert's heading, inside\n * the native heading element matching the nearest ancestor `HeadingScope`'s\n * depth — or `<h1>` where no scope wraps it — styled as a small, tight label.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the title's markup.\n */\nAlert.Title = function AlertTitle(handle: Handle<Alert.TitleProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\t\tlet resolved = resolveHeadingLevel(handle);\n\t\tlet Tag = TAG_BY_LEVEL[resolved];\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\t{...rest}\n\t\t\t\tdata-heading-level={resolved}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[mbe(1), weight(\"medium\"), leading(1), tracking(\"tight\"), fontSize(\"sm\"), balance()],\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</Tag>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Alert.DescriptionProps.children} as the alert's supporting\n * message, slightly translucent against the alert's foreground color so it\n * reads as secondary to the title. Any nested `<p>` keeps its line height.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n */\nAlert.Description = function AlertDescription(handle: Handle<Alert.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[\n\t\t\t\t\t\tleading(\"relaxed\"),\n\t\t\t\t\t\twhen(\"& p\", leading(\"relaxed\")),\n\t\t\t\t\t\tpretty(),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tfg(colorMix(\"oklab\", { color: \"currentcolor\", weight: 70 }, \"transparent\")),\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</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Alert.ActionProps.children} as the alert's trailing\n * control — a button, link, or dismiss affordance — pinned to the panel's\n * block-start edge at its own natural size.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action's markup.\n */\nAlert.Action = function AlertAction(handle: Handle<Alert.ActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"action\" mix={mergeMix([shrink(), self(\"start\")], mix)}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": null
15
15
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "aspect-ratio",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "AspectRatio"
7
7
  ],
8
8
  "source": {
9
9
  "path": "aspect-ratio.tsx",
10
- "content": "/**\n * A layout primitive that locks its host to a fixed width-to-height ratio,\n * clipping whatever content it wraps so the box keeps its shape regardless\n * of the content's own intrinsic size. It reserves stable space for media,\n * embeds, and other loading content ahead of time, so nothing around it\n * shifts once that content resolves its own measurements.\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 { var as varUtility, raw } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { is } from \"@sdxc/u/size\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\nconst DEFAULT_RATIO: AspectRatio.Ratio = \"1 / 1\";\n\n/**\n * Prop types for {@link AspectRatio}.\n */\nexport namespace AspectRatio {\n\t/**\n\t * A CSS `aspect-ratio` value: a bare number of width divided by height\n\t * (`1.7778` for a 16:9 box), or a ratio string CSS accepts directly\n\t * (`\"16 / 9\"`).\n\t */\n\texport type Ratio = number | string;\n\n\t/**\n\t * Props accepted by {@link AspectRatio}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Width-to-height ratio the host maintains. Defaults to a square. */\n\t\tratio?: Ratio;\n\t}\n}\n\n/**\n * Fills its container's inline axis and clips any overflow. The ratio rides on\n * the `--ui-aspect-ratio` custom property, set per instance from the `ratio`\n * prop, so an ancestor's stylesheet can override it on its own.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the ratio-locked box's markup.\n * @example\n * <AspectRatio ratio=\"16 / 9\">\n * \t<img src={coverImageUrl} alt={coverImageAlt} />\n * </AspectRatio>\n * @example\n * <AspectRatio ratio={4 / 3} />\n */\nexport function AspectRatio(handle: Handle<AspectRatio.Props>) {\n\treturn () => {\n\t\tlet { ratio, mix, style, ...rest } = handle.props;\n\t\tlet resolvedRatio = ratio ?? DEFAULT_RATIO;\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-aspect-ratio\": resolvedRatio });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={[\n\t\t\t\t\tblock(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\toverflow(),\n\t\t\t\t\traw({ aspectRatio: varUtility(\"ui-aspect-ratio\", \"1\") }),\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 layout primitive that locks its host to a fixed width-to-height ratio,\n * clipping whatever content it wraps so the box keeps its shape regardless\n * of the content's own intrinsic size. It reserves stable space for media,\n * embeds, and other loading content ahead of time, so nothing around it\n * shifts once that content resolves its own measurements.\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 { var as varUtility, raw, mergeMix } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { is } from \"@sdxc/u/size\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\nconst DEFAULT_RATIO: AspectRatio.Ratio = \"1 / 1\";\n\n/**\n * Prop types for {@link AspectRatio}.\n */\nexport namespace AspectRatio {\n\t/**\n\t * A CSS `aspect-ratio` value: a bare number of width divided by height\n\t * (`1.7778` for a 16:9 box), or a ratio string CSS accepts directly\n\t * (`\"16 / 9\"`).\n\t */\n\texport type Ratio = number | string;\n\n\t/**\n\t * Props accepted by {@link AspectRatio}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Width-to-height ratio the host maintains. Defaults to a square. */\n\t\tratio?: Ratio;\n\t}\n}\n\n/**\n * Fills its container's inline axis and clips any overflow. The ratio rides on\n * the `--ui-aspect-ratio` custom property, set per instance from the `ratio`\n * prop, so an ancestor's stylesheet can override it on its own.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the ratio-locked box's markup.\n * @example\n * <AspectRatio ratio=\"16 / 9\">\n * \t<img src={coverImageUrl} alt={coverImageAlt} />\n * </AspectRatio>\n * @example\n * <AspectRatio ratio={4 / 3} />\n */\nexport function AspectRatio(handle: Handle<AspectRatio.Props>) {\n\treturn () => {\n\t\tlet { ratio, mix, style, ...rest } = handle.props;\n\t\tlet resolvedRatio = ratio ?? DEFAULT_RATIO;\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-aspect-ratio\": resolvedRatio });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\toverflow(),\n\t\t\t\t\t\traw({ aspectRatio: varUtility(\"ui-aspect-ratio\", \"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"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "avatar",
3
- "changedIn": "2026.10.2",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [
5
5
  "image-placeholder"
6
6
  ],
@@ -9,7 +9,10 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "avatar.tsx",
12
- "content": "/**\n * A person's or entity's picture rendered as a fixed-size, fully circular\n * host stacking an image layer, an initials fallback, and an optional corner\n * status badge, plus a way to overlap several instances into one group with\n * a trailing overflow count. The circular shape stays fixed, since a profile\n * picture always renders fully rounded.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle } from \"remix/component\";\n\nimport { ImagePlaceholder } from \"@sdxc/ui/image-placeholder\";\n\n/**\n * Prop types for {@link Avatar} and its compound parts. Each part aliases\n * {@link ImagePlaceholder}'s matching part, since {@link Avatar} renders\n * straight through to it with the shape fixed to a full circle.\n */\nexport namespace Avatar {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size. Re-exports\n\t * {@link ImagePlaceholder.Size}.\n\t */\n\texport type Size = ImagePlaceholder.Size;\n\n\t/**\n\t * Props accepted by {@link Avatar}: every prop {@link ImagePlaceholder.Props}\n\t * accepts except `shape`, which stays fixed to a full circle.\n\t */\n\texport interface Props extends Omit<ImagePlaceholder.Props, \"shape\"> {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Image}, unchanged from\n\t * {@link ImagePlaceholder.ImageProps}.\n\t */\n\texport interface ImageProps extends ImagePlaceholder.ImageProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Fallback}, unchanged from\n\t * {@link ImagePlaceholder.FallbackProps}.\n\t */\n\texport interface FallbackProps extends ImagePlaceholder.FallbackProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Badge}, unchanged from\n\t * {@link ImagePlaceholder.BadgeProps}.\n\t */\n\texport interface BadgeProps extends ImagePlaceholder.BadgeProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Group}, unchanged from\n\t * {@link ImagePlaceholder.GroupProps}.\n\t */\n\texport interface GroupProps extends ImagePlaceholder.GroupProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Group.Count}: every prop\n\t * {@link ImagePlaceholder.GroupCountProps} accepts except `shape`, which\n\t * stays fixed to the same full circle the avatars it trails render with.\n\t */\n\texport interface GroupCountProps extends Omit<ImagePlaceholder.GroupCountProps, \"shape\"> {}\n}\n\n/**\n * Renders a fixed-size, fully circular picture host sized through the\n * `data-size` attribute contract (`\"sm\"`, `\"md\"`, or `\"lg\"`), stacking\n * whichever image, fallback, and badge parts a consumer composes as children.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the picture host's markup.\n * @example\n * <Avatar>\n * \t<Avatar.Image src={user.avatarUrl} alt={user.name} />\n * \t<Avatar.Fallback>{initials}</Avatar.Fallback>\n * </Avatar>\n * @example\n * <Avatar size=\"lg\">\n * \t<Avatar.Image src={user.avatarUrl} alt={user.name} />\n * \t<Avatar.Fallback>{initials}</Avatar.Fallback>\n * \t<Avatar.Badge aria-label={t(\"status.online\")} />\n * </Avatar>\n */\nexport function Avatar(handle: Handle<Avatar.Props>) {\n\treturn () => <ImagePlaceholder {...handle.props} shape=\"circle\" />;\n}\n\n/**\n * Renders the avatar's image layer: an absolutely positioned `<img>` filling\n * the host edge to edge, cropped with `object-fit: cover` and clipped to\n * {@link Avatar}'s circular shape. Stacking order decides which layer 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 * <Avatar.Image src={user.avatarUrl} alt={user.name} />\n */\nAvatar.Image = ImagePlaceholder.Image;\n\n/**\n * Renders the avatar's fallback layer: an absolutely positioned `<span>`\n * centering its content (typically initials) in uppercase, medium-weight\n * text whose size inherits from the host, staying in proportion at any 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 * <Avatar.Fallback>{initials}</Avatar.Fallback>\n */\nAvatar.Fallback = ImagePlaceholder.Fallback;\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner: always fully rounded and ringed with a border matching the\n * surrounding background, so it reads as cut out from what 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 * <Avatar.Badge aria-label={t(\"status.online\")} />\n */\nAvatar.Badge = ImagePlaceholder.Badge;\n\n/**\n * Renders {@link Avatar.GroupProps.children} as a row of overlapping\n * avatars, pulling every child but the first back over its predecessor and\n * ringing it, 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 * <Avatar.Group>\n * \t<Avatar>…</Avatar>\n * \t<Avatar>…</Avatar>\n * \t<Avatar.Group.Count>+3</Avatar.Group.Count>\n * </Avatar.Group>\n */\nfunction AvatarGroup(handle: Handle<Avatar.GroupProps>) {\n\treturn () => <ImagePlaceholder.Group {...handle.props} />;\n}\n\n/**\n * Renders the \"+N\" overflow indicator that trails {@link Avatar.Group}: a\n * fixed medium-size box matching {@link Avatar}'s default dimensions, ringed\n * the same way a grouped avatar is and fixed to the same full circle.\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 * <Avatar.Group.Count>+3</Avatar.Group.Count>\n */\nfunction AvatarGroupCount(handle: Handle<Avatar.GroupCountProps>) {\n\treturn () => <ImagePlaceholder.GroupCount {...handle.props} shape=\"circle\" />;\n}\n\nAvatarGroup.Count = AvatarGroupCount;\nAvatar.Group = AvatarGroup;\n"
12
+ "content": "/**\n * A person's or entity's picture rendered as a fixed-size, fully circular\n * host stacking an image layer, an initials fallback, and an optional corner\n * status badge, plus a way to overlap several instances into one group with\n * a trailing overflow count. The circular shape stays fixed, since a profile\n * picture always renders fully rounded.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle } from \"remix/component\";\n\nimport { bg, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { combine, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { flex, inlineFlex, items, justify, relative, shrink } from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { tabularNums, text, weight } from \"@sdxc/u/typography\";\n\nimport { ImagePlaceholder } from \"@sdxc/ui/image-placeholder\";\n\n/**\n * Ring that cuts each grouped avatar out of its predecessor, in the page surface behind\n * the group, so it reads as a gap in light and dark alike.\n */\nconst GROUP_RING = \"0 0 0 2px var(--ui-avatar-group-ring, var(--ui-bg, Canvas))\";\n\n/**\n * Prop types for {@link Avatar} and its compound parts. Each part aliases\n * {@link ImagePlaceholder}'s matching part, since {@link Avatar} renders\n * straight through to it with the shape fixed to a full circle.\n */\nexport namespace Avatar {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size. Re-exports\n\t * {@link ImagePlaceholder.Size}.\n\t */\n\texport type Size = ImagePlaceholder.Size;\n\n\t/**\n\t * Props accepted by {@link Avatar}: every prop {@link ImagePlaceholder.Props}\n\t * accepts except `shape`, which stays fixed to a full circle.\n\t */\n\texport interface Props extends Omit<ImagePlaceholder.Props, \"shape\"> {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Image}, unchanged from\n\t * {@link ImagePlaceholder.ImageProps}.\n\t */\n\texport interface ImageProps extends ImagePlaceholder.ImageProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Fallback}, unchanged from\n\t * {@link ImagePlaceholder.FallbackProps}.\n\t */\n\texport interface FallbackProps extends ImagePlaceholder.FallbackProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Badge}, unchanged from\n\t * {@link ImagePlaceholder.BadgeProps}.\n\t */\n\texport interface BadgeProps extends ImagePlaceholder.BadgeProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Group}, unchanged from\n\t * {@link ImagePlaceholder.GroupProps}.\n\t */\n\texport interface GroupProps extends ImagePlaceholder.GroupProps {}\n\n\t/**\n\t * Props accepted by {@link Avatar.Group.Count}: every prop\n\t * {@link ImagePlaceholder.GroupCountProps} accepts except `shape`, which\n\t * stays fixed to the same full circle the avatars it trails render with.\n\t */\n\texport interface GroupCountProps extends Omit<ImagePlaceholder.GroupCountProps, \"shape\"> {}\n}\n\n/**\n * Renders a fixed-size, fully circular picture host sized through the\n * `data-size` attribute contract (`\"sm\"`, `\"md\"`, or `\"lg\"`), stacking\n * whichever image, fallback, and badge parts a consumer composes as children.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the picture host's markup.\n * @example\n * <Avatar>\n * \t<Avatar.Image src={user.avatarUrl} alt={user.name} />\n * \t<Avatar.Fallback>{initials}</Avatar.Fallback>\n * </Avatar>\n * @example\n * <Avatar size=\"lg\">\n * \t<Avatar.Image src={user.avatarUrl} alt={user.name} />\n * \t<Avatar.Fallback>{initials}</Avatar.Fallback>\n * \t<Avatar.Badge aria-label={t(\"status.online\")} />\n * </Avatar>\n */\nexport function Avatar(handle: Handle<Avatar.Props>) {\n\treturn () => <ImagePlaceholder {...handle.props} shape=\"circle\" />;\n}\n\n/**\n * Renders the avatar's image layer: an absolutely positioned `<img>` filling\n * the host edge to edge, cropped with `object-fit: cover` and clipped to\n * {@link Avatar}'s circular shape. Stacking order decides which layer 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 * <Avatar.Image src={user.avatarUrl} alt={user.name} />\n */\nAvatar.Image = ImagePlaceholder.Image;\n\n/**\n * Renders the avatar's fallback layer: an absolutely positioned `<span>`\n * centering its content (typically initials) in uppercase, medium-weight\n * text whose size inherits from the host, staying in proportion at any 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 * <Avatar.Fallback>{initials}</Avatar.Fallback>\n */\nAvatar.Fallback = ImagePlaceholder.Fallback;\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner: always fully rounded and ringed with a border matching the\n * surrounding background, so it reads as cut out from what 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 * <Avatar.Badge aria-label={t(\"status.online\")} />\n */\nAvatar.Badge = ImagePlaceholder.Badge;\n\n/**\n * Renders {@link Avatar.GroupProps.children} as a row of overlapping avatars, each\n * pulled over about a fifth of its predecessor, so two-letter initials stay readable, and\n * ringed in the page surface (`--ui-avatar-group-ring` to match another fill).\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 * <Avatar.Group>\n * \t<Avatar>…</Avatar>\n * \t<Avatar>…</Avatar>\n * \t<Avatar.Group.Count>+3</Avatar.Group.Count>\n * </Avatar.Group>\n */\nfunction AvatarGroup(handle: Handle<Avatar.GroupProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div {...rest} data-slot=\"group\" mix={mergeMix([flex(), groupStack()], mix)}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Overlap and ring for every grouped child in one rule: each child after the first\n * moves back about a fifth of the avatar before it (2, 2.5 or 3rem), leaving room for\n * two letters of initials beside the 2px ring.\n */\nfunction groupStack() {\n\treturn combine([\n\t\twhen(\"& > *\", raw({ boxShadow: GROUP_RING })),\n\t\twhen(\"& > * + *\", raw({ marginInlineStart: \"-0.5rem\" })),\n\t\twhen('& > [data-size=\"sm\"] + *', raw({ marginInlineStart: \"-0.375rem\" })),\n\t\twhen('& > [data-size=\"lg\"] + *', raw({ marginInlineStart: \"-0.625rem\" })),\n\t]);\n}\n\n/**\n * Renders the \"+N\" overflow indicator that trails {@link Avatar.Group}: a fixed\n * medium-size circle matching {@link Avatar}'s default dimensions, its tabular digits\n * keeping a changing count one width; the group rings it like an avatar.\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 * <Avatar.Group.Count>+3</Avatar.Group.Count>\n */\nfunction AvatarGroupCount(handle: Handle<Avatar.GroupCountProps>) {\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=\"group-count\"\n\t\t\t\tdata-shape=\"circle\"\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\trounded(\"full\"),\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],\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\nAvatarGroup.Count = AvatarGroupCount;\nAvatar.Group = AvatarGroup;\n"
13
13
  },
14
- "test": null
14
+ "test": {
15
+ "path": "avatar.browser.test.tsx",
16
+ "content": "/**\n * Stacks avatars in a real browser and checks that each one's two-letter initials stay\n * clear of the avatar overlapping it, at every size, and that the cutout ring takes the\n * page surface behind the group.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { render } from \"remix/component/test\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Avatar } from \"@sdxc/ui/avatar\";\n\n/** Two-letter initials as wide as a stack usually carries. */\nconst INITIALS = [\"TS\", \"AG\", \"JL\", \"OV\"];\n\n/** Mounts a group of avatars at one size, trailed by an overflow count. */\nfunction mountGroup(size: Avatar.Size) {\n\tlet host = document.createElement(\"div\");\n\tdocument.body.appendChild(host);\n\tlet { container } = render(\n\t\t<Avatar.Group>\n\t\t\t{INITIALS.map((initials) => (\n\t\t\t\t<Avatar key={initials} size={size}>\n\t\t\t\t\t<Avatar.Fallback>{initials}</Avatar.Fallback>\n\t\t\t\t</Avatar>\n\t\t\t))}\n\t\t\t<Avatar.Group.Count>+3</Avatar.Group.Count>\n\t\t</Avatar.Group>,\n\t\t{ container: host },\n\t);\n\treturn container.querySelector('[data-slot=\"group\"]')!;\n}\n\ndescribe(\"Avatar.Group\", () => {\n\tfor (let size of [\"sm\", \"md\", \"lg\"] as const) {\n\t\ttest(`keeps the second letter of every ${size} avatar's initials clear of the next one`, () => {\n\t\t\tlet group = mountGroup(size);\n\t\t\tlet children = [...group.children];\n\n\t\t\tfor (let index = 0; index < INITIALS.length; index++) {\n\t\t\t\tlet fallback = children[index]!.querySelector('[data-slot=\"fallback\"]')!;\n\t\t\t\tlet range = document.createRange();\n\t\t\t\trange.selectNodeContents(fallback);\n\t\t\t\tlet text = range.getBoundingClientRect();\n\t\t\t\tlet next = children[index + 1]!.getBoundingClientRect();\n\n\t\t\t\texpect(text.right, `${INITIALS[index]} at ${size}`).toBeLessThanOrEqual(next.left);\n\t\t\t}\n\t\t});\n\t}\n\n\ttest(\"overlaps each avatar by a fifth of its size\", () => {\n\t\tlet group = mountGroup(\"md\");\n\t\tlet [first, second] = [...group.children].map((child) => child.getBoundingClientRect());\n\n\t\texpect(first!.right - second!.left).toBeCloseTo(first!.width / 5, 1);\n\t});\n\n\ttest(\"rings every avatar and the count in the surface behind the group\", () => {\n\t\tlet group = mountGroup(\"md\") as HTMLElement;\n\t\tgroup.style.setProperty(\"--ui-bg\", \"rgb(10, 20, 30)\");\n\n\t\tfor (let child of group.children) {\n\t\t\texpect(getComputedStyle(child).boxShadow).toContain(\"rgb(10, 20, 30)\");\n\t\t}\n\t});\n});\n"
17
+ }
15
18
  }
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "badge",
3
- "changedIn": "2026.10.13",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [],
5
5
  "exports": [
6
6
  "Badge"
7
7
  ],
8
8
  "source": {
9
9
  "path": "badge.tsx",
10
- "content": "/**\n * A compact pill communicating a short status, label, or count inline with\n * surrounding content. Its host renders solid, tinted, or outlined depending\n * on a variant attribute, colored through a semantic color role, and\n * composes with `Icon` and `Text` parts for glyph-plus-label badges.\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, transition } from \"@sdxc/u/effects\";\nimport { userSelect } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { fontSize, leading, nowrap, tabularNums, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { DEFAULT_ICON_ARIA_HIDDEN } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Badge} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Badge.Color = \"neutral\";\n\n/** Visual weight {@link Badge} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Badge.Variant = \"default\";\n\n/**\n * Prop types for {@link Badge} and its compound parts.\n */\nexport namespace Badge {\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 badge renders with: a solid fill, a tinted fill, or\n\t * a transparent chip with just an outline.\n\t */\n\texport type Variant = \"default\" | \"secondary\" | \"outline\";\n\n\t/**\n\t * Props accepted by {@link Badge}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\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}\n\n\t/**\n\t * Props accepted by {@link Badge.Icon}.\n\t */\n\texport interface IconProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Badge.Text}.\n\t */\n\texport interface TextProps extends TagProps<\"span\"> {}\n}\n\n/**\n * Renders a single-line pill host, colored and shaped through the\n * `data-color` and `data-variant` attribute contract: `\"default\"` fills the\n * pill solid, `\"secondary\"` tints the fill, `\"outline\"` keeps just a border.\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 * <Badge>{t(\"badge.new\")}</Badge>\n * @example\n * <Badge color=\"success\" variant=\"secondary\">\n * \t<Badge.Icon><CheckIcon /></Badge.Icon>\n * \t<Badge.Text>{t(\"badge.active\")}</Badge.Text>\n * </Badge>\n * @example\n * <Badge color=\"danger\" variant=\"outline\">{t(\"badge.failed\")}</Badge>\n */\nexport function Badge(handle: Handle<Badge.Props>) {\n\treturn () => {\n\t\tlet { color, variant, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(1),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\tpi(2.5),\n\t\t\t\t\tpb(0.5),\n\t\t\t\t\tleading(1),\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\tnowrap(),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tdata(\"variant\", \"default\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [bg(\"brand.solid\"), fg(\"brand.onSolid\"), border(\"brand.solid\")]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"secondary\", [\n\t\t\t\t\t\tdata(\"color\", \"brand\", [bg(\"brand.tint\"), fg(\"brand\"), border(\"brand\")]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [bg(\"neutral.tint\"), fg(\"neutral\"), border(\"neutral\")]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [bg(\"success.tint\"), fg(\"success\"), border(\"success\")]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [bg(\"warning.tint\"), fg(\"warning\"), border(\"warning\")]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [bg(\"danger.tint\"), fg(\"danger\"), border(\"danger\")]),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tdata(\"color\", \"brand\", [border(\"brand.strong\"), fg(\"brand\")]),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [border(\"neutral\"), fg(\"neutral\")]),\n\t\t\t\t\t\tdata(\"color\", \"success\", [border(\"success.strong\"), fg(\"success\")]),\n\t\t\t\t\t\tdata(\"color\", \"warning\", [border(\"warning.strong\"), fg(\"warning\")]),\n\t\t\t\t\t\tdata(\"color\", \"danger\", [border(\"danger.strong\"), fg(\"danger\")]),\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 badge's leading or trailing glyph slot: an inert, shrink-proof\n * `<span>` sized to hold a single small icon and hidden from assistive\n * technology, since {@link Badge.Text} carries the badge's meaning.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the icon slot's markup.\n * @example\n * <Badge.Icon><CheckIcon /></Badge.Icon>\n */\nBadge.Icon = function BadgeIcon(handle: Handle<Badge.IconProps>) {\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\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tshrink(0),\n\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3), shrink(0), fg(\"currentColor\")]),\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 badge's label slot: a `<span>` with its line height collapsed\n * to one, keeping short label text vertically centered inside the pill.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the label slot's markup.\n * @example\n * <Badge.Text>{t(\"badge.active\")}</Badge.Text>\n */\nBadge.Text = function BadgeText(handle: Handle<Badge.TextProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <span {...rest} mix={[leading(1), mix]} />;\n\t};\n};\n"
10
+ "content": "/**\n * A compact pill communicating a short status, label, or count inline with\n * surrounding content. Its host renders solid, tinted, or outlined depending\n * on a variant attribute, colored through a semantic color role, and\n * composes with `Icon` and `Text` parts for glyph-plus-label badges.\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, transition } from \"@sdxc/u/effects\";\nimport { userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { data, when } from \"@sdxc/u/state\";\nimport { fontSize, leading, nowrap, tabularNums, weight } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { DEFAULT_ICON_ARIA_HIDDEN } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Badge} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Badge.Color = \"neutral\";\n\n/** Visual weight {@link Badge} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Badge.Variant = \"default\";\n\n/**\n * Prop types for {@link Badge} and its compound parts.\n */\nexport namespace Badge {\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 badge renders with: a solid fill, a tinted fill, or\n\t * a transparent chip with just an outline.\n\t */\n\texport type Variant = \"default\" | \"secondary\" | \"outline\";\n\n\t/**\n\t * Props accepted by {@link Badge}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\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}\n\n\t/**\n\t * Props accepted by {@link Badge.Icon}.\n\t */\n\texport interface IconProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Badge.Text}.\n\t */\n\texport interface TextProps extends TagProps<\"span\"> {}\n}\n\n/**\n * Renders a single-line pill host, colored and shaped through the\n * `data-color` and `data-variant` attribute contract: `\"default\"` fills the\n * pill solid, `\"secondary\"` tints the fill, `\"outline\"` keeps just a border.\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 * <Badge>{t(\"badge.new\")}</Badge>\n * @example\n * <Badge color=\"success\" variant=\"secondary\">\n * \t<Badge.Icon><CheckIcon /></Badge.Icon>\n * \t<Badge.Text>{t(\"badge.active\")}</Badge.Text>\n * </Badge>\n * @example\n * <Badge color=\"danger\" variant=\"outline\">{t(\"badge.failed\")}</Badge>\n */\nexport function Badge(handle: Handle<Badge.Props>) {\n\treturn () => {\n\t\tlet { color, variant, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\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\tgap(1),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\tpi(2.5),\n\t\t\t\t\t\tpb(0.5),\n\t\t\t\t\t\tleading(1),\n\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\tnowrap(),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tdata(\"variant\", \"default\", [\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\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\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\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\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\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\tborder(\"success.solid\"),\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\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\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\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"secondary\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [bg(\"brand.tint\"), fg(\"brand\"), border(\"brand\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [bg(\"neutral.tint\"), fg(\"neutral\"), border(\"neutral\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [bg(\"success.tint\"), fg(\"success\"), border(\"success\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [bg(\"warning.tint\"), fg(\"warning\"), border(\"warning\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [bg(\"danger.tint\"), fg(\"danger\"), border(\"danger\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [border(\"brand.strong\"), fg(\"brand\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [border(\"neutral\"), fg(\"neutral\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [border(\"success.strong\"), fg(\"success\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [border(\"warning.strong\"), fg(\"warning\")]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [border(\"danger.strong\"), fg(\"danger\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders the badge's leading or trailing glyph slot: an inert, shrink-proof\n * `<span>` sized to hold a single small icon and hidden from assistive\n * technology, since {@link Badge.Text} carries the badge's meaning.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the icon slot's markup.\n * @example\n * <Badge.Icon><CheckIcon /></Badge.Icon>\n */\nBadge.Icon = function BadgeIcon(handle: Handle<Badge.IconProps>) {\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\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\tshrink(0),\n\t\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3), shrink(0), fg(\"currentColor\")]),\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 badge's label slot: a `<span>` with its line height collapsed\n * to one, keeping short label text vertically centered inside the pill.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the label slot's markup.\n * @example\n * <Badge.Text>{t(\"badge.active\")}</Badge.Text>\n */\nBadge.Text = function BadgeText(handle: Handle<Badge.TextProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <span {...rest} mix={mergeMix(leading(1), mix)} />;\n\t};\n};\n"
11
11
  },
12
12
  "test": null
13
13
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "banner",
3
+ "changedIn": "2026.11.3",
4
+ "dependencies": [],
5
+ "exports": [
6
+ "Banner"
7
+ ],
8
+ "source": {
9
+ "path": "banner.tsx",
10
+ "content": "/**\n * A full-width strip above a page or the whole app for state that outlives one\n * action: an overdue invoice, a failing integration, a maintenance window. It\n * sits in the flow and pushes the frame down, so it never covers what it warns about.\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 { CircleAlertIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, XIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { rounded, transition } from \"@sdxc/u/effects\";\nimport { mergeMix, raw } from \"@sdxc/u/general\";\nimport { flex, flexWrap, gap, grow, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { hover, when } from \"@sdxc/u/state\";\nimport { fontSize, leading, overflowWrap, pretty, weight } from \"@sdxc/u/typography\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { semanticColorPanel } from \"@sdxc/ui/styles\";\n\n/** Default {@link Banner.Props.color}: an informational strip. */\nconst DEFAULT_COLOR: Banner.Color = \"brand\";\n\n/** Prop types for {@link Banner}. */\nexport namespace Banner {\n\t/** Semantic tone of the strip: warning for billing, danger for a failing integration. */\n\texport type Color = SemanticColor;\n\n\t/** Props accepted by {@link Banner}. */\n\texport interface Props extends Omit<TagProps<\"section\">, \"children\"> {\n\t\t/** Accessible name of the strip's region landmark, such as \"Billing\". */\n\t\tlabel: string;\n\t\t/** Default: `\"brand\"`. */\n\t\tcolor?: Color;\n\t\t/** Leading icon in place of the tone's own, or `null` for none. */\n\t\ticon?: RemixNode;\n\t\t/** The one fixing action, such as an \"Update Payment Method\" button or link. */\n\t\taction?: RemixNode;\n\t\t/**\n\t\t * Lets the reader close the strip through a form, so the server records it\n\t\t * and stops rendering the banner. Leave it out for state that needs resolving.\n\t\t */\n\t\tdismiss?: Dismiss;\n\t\t/** The message: what is wrong and what fixing it changes, in a sentence or two. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/** How a dismissible {@link Banner} closes. */\n\texport interface Dismiss {\n\t\t/** Accessible name of the close button, such as \"Dismiss\". */\n\t\tlabel: string;\n\t\t/** URL the dismissal submits to. */\n\t\taction: string;\n\t\t/** Default: `\"post\"`. */\n\t\tmethod?: \"get\" | \"post\";\n\t\t/** Hidden fields sent with it, such as the banner's id. */\n\t\tfields?: Record<string, string>;\n\t}\n}\n\n/**\n * Renders the strip as a named region: tone icon, message, one action, and a\n * close form only when `dismiss` is given. One banner at a time; it wraps on a\n * phone and flows above the app frame, pushing it down.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the strip's markup.\n * @example\n * <Banner color=\"warning\" label={t(\"billing.region\")} action={<Button href=\"/billing\">{t(\"billing.update\")}</Button>}>\n * \t{t(\"billing.declined\")}\n * </Banner>\n * @example\n * <Banner label={t(\"maintenance.region\")} dismiss={{ label: t(\"actions.dismiss\"), action: \"/banners/dismiss\", fields: { id: \"maintenance\" } }}>\n * \t{t(\"maintenance.message\")}\n * </Banner>\n */\nexport function Banner(handle: Handle<Banner.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tlabel,\n\t\t\tcolor = DEFAULT_COLOR,\n\t\t\ticon,\n\t\t\taction,\n\t\t\tdismiss,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet toneIcon = icon === null ? null : (icon ?? <BannerToneIcon color={color} />);\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\taria-label={label}\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={color}\n\t\t\t\tdata-slot=\"banner\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tsemanticColorPanel(),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\tflexWrap(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tgap(3),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tminIs(0),\n\t\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\t\traw({ borderWidth: \"0\", borderBlockEndWidth: \"1px\", borderStyle: \"solid\" }),\n\t\t\t\t\t\tfontSize(\"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\t\t{toneIcon ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"banner-icon\"\n\t\t\t\t\t\tmix={[inlineFlex(), shrink(0), fg(\"currentcolor\")]}\n\t\t\t\t\t>\n\t\t\t\t\t\t{toneIcon}\n\t\t\t\t\t</span>\n\t\t\t\t) : null}\n\t\t\t\t<p\n\t\t\t\t\tdata-slot=\"banner-message\"\n\t\t\t\t\tmix={[\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\traw({ flexBasis: \"16rem\" }),\n\t\t\t\t\t\tminIs(0),\n\t\t\t\t\t\tleading(\"snug\"),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tpretty(),\n\t\t\t\t\t\toverflowWrap(\"anywhere\"),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</p>\n\t\t\t\t{action ? (\n\t\t\t\t\t<div data-slot=\"banner-action\" mix={[flex(), items(\"center\"), shrink(0)]}>\n\t\t\t\t\t\t{action}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t{dismiss ? <BannerDismiss dismiss={dismiss} /> : null}\n\t\t\t</section>\n\t\t);\n\t};\n}\n\n/**\n * Picks the icon a tone carries, so a warning and a failure read apart before\n * the message does.\n *\n * @param handle Runtime handle carrying the banner's tone.\n * @returns The render function producing the icon.\n */\nfunction BannerToneIcon(handle: Handle<{ color: Banner.Color }>) {\n\treturn () => {\n\t\tlet { color } = handle.props;\n\t\tif (color === \"success\") return <CircleCheckIcon size={16} />;\n\t\tif (color === \"danger\") return <CircleAlertIcon size={16} />;\n\t\tif (color === \"warning\") return <TriangleAlertIcon size={16} />;\n\t\treturn <InfoIcon size={16} />;\n\t};\n}\n\n/**\n * The close control of a dismissible {@link Banner}: an icon button that\n * submits its form, so the dismissal reaches the server with or without\n * JavaScript and the banner stays gone on the next page.\n *\n * @param handle Runtime handle carrying the dismissal form.\n * @returns The render function producing the form's markup.\n */\nfunction BannerDismiss(handle: Handle<{ dismiss: Banner.Dismiss }>) {\n\treturn () => {\n\t\tlet { dismiss } = handle.props;\n\n\t\treturn (\n\t\t\t<form\n\t\t\t\tmethod={dismiss.method ?? \"post\"}\n\t\t\t\taction={dismiss.action}\n\t\t\t\tdata-slot=\"banner-dismiss\"\n\t\t\t\tmix={[flex(), shrink(0), raw({ marginInlineStart: \"auto\" })]}\n\t\t\t>\n\t\t\t\t{Object.entries(dismiss.fields ?? {}).map(([name, value]) => (\n\t\t\t\t\t<input key={name} type=\"hidden\" name={name} value={value} />\n\t\t\t\t))}\n\t\t\t\t<button\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\taria-label={dismiss.label}\n\t\t\t\t\ttitle={dismiss.label}\n\t\t\t\t\tmix={[\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\tis(\"2rem\"),\n\t\t\t\t\t\tbs(\"2rem\"),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ width: 0 }),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tfg(\"currentcolor\"),\n\t\t\t\t\t\ttransition(\"background-color\"),\n\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", width: 2 })),\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<XIcon size={16} />\n\t\t\t\t</button>\n\t\t\t</form>\n\t\t);\n\t};\n}\n"
11
+ },
12
+ "test": {
13
+ "path": "banner.browser.test.tsx",
14
+ "content": "/**\n * Lays the banner out in a real browser: a named region in the flow that pushes the\n * app frame down instead of covering it, no close control unless dismissible, a\n * dismissal that is a real form, and a 320px phone that wraps instead of overflowing.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type {} from \"@vitest/browser-playwright\";\nimport type { RenderResult } from \"remix/component/test\";\n\nimport { render } from \"remix/component/test\";\nimport { afterEach, describe, expect, test } from \"vitest\";\nimport { page } from \"vitest/browser\";\n\nimport { Banner } from \"@sdxc/ui/banner\";\n\nimport \"@sdxc/ui/reset.css\";\n\nlet mounted: RenderResult | undefined;\n\nafterEach(async () => {\n\tmounted?.cleanup();\n\tmounted = undefined;\n\tdocument.body.replaceChildren();\n\tawait page.viewport(1280, 800);\n});\n\n/** Mounts `node` in a host `width` pixels wide and returns the host. */\nfunction mount(node: JSX.Element, width = 1024): HTMLElement {\n\tlet host = document.createElement(\"div\");\n\thost.style.width = `${width}px`;\n\tdocument.body.appendChild(host);\n\tmounted = render(node, { container: host });\n\treturn host;\n}\n\n/** The fixing action a billing banner offers. */\nfunction UpdateLink() {\n\treturn () => <a href=\"/billing\">Update Payment Method</a>;\n}\n\ndescribe(\"Banner\", () => {\n\ttest(\"is a named region in the flow that pushes the app frame down\", () => {\n\t\tlet host = mount(\n\t\t\t<>\n\t\t\t\t<Banner color=\"warning\" label=\"Billing\" action={<UpdateLink />}>\n\t\t\t\t\tYour card was declined. Update it to keep monitors running.\n\t\t\t\t</Banner>\n\t\t\t\t<main data-testid=\"frame\">Dashboard</main>\n\t\t\t</>,\n\t\t);\n\t\tlet banner = host.querySelector<HTMLElement>('[data-slot=\"banner\"]')!;\n\t\tlet frame = host.querySelector<HTMLElement>('[data-testid=\"frame\"]')!;\n\n\t\texpect(banner.tagName).toBe(\"SECTION\");\n\t\texpect(banner.getAttribute(\"aria-label\")).toBe(\"Billing\");\n\t\texpect(getComputedStyle(banner).position).toBe(\"static\");\n\t\texpect(frame.getBoundingClientRect().top).toBeCloseTo(banner.getBoundingClientRect().bottom, 1);\n\t\texpect(banner.getBoundingClientRect().width).toBe(1024);\n\t});\n\n\ttest(\"draws the tone's icon, hidden from assistive technology, unless told otherwise\", () => {\n\t\tlet host = mount(\n\t\t\t<>\n\t\t\t\t<Banner color=\"danger\" label=\"Integrations\" data-testid=\"toned\">\n\t\t\t\t\tSlack stopped accepting alerts.\n\t\t\t\t</Banner>\n\t\t\t\t<Banner color=\"danger\" label=\"Integrations\" icon={null} data-testid=\"bare\">\n\t\t\t\t\tSlack stopped accepting alerts.\n\t\t\t\t</Banner>\n\t\t\t</>,\n\t\t);\n\n\t\tlet icon = host.querySelector('[data-testid=\"toned\"] [data-slot=\"banner-icon\"]')!;\n\t\texpect(icon.getAttribute(\"aria-hidden\")).toBe(\"true\");\n\t\texpect(icon.querySelector(\"svg\")).not.toBeNull();\n\t\texpect(host.querySelector('[data-testid=\"bare\"] [data-slot=\"banner-icon\"]')).toBeNull();\n\t});\n\n\ttest(\"offers no close control while the state needs resolving\", () => {\n\t\tlet host = mount(\n\t\t\t<Banner color=\"warning\" label=\"Billing\" action={<UpdateLink />}>\n\t\t\t\tYour card was declined.\n\t\t\t</Banner>,\n\t\t);\n\n\t\texpect(host.querySelector(\"button\")).toBeNull();\n\t\texpect(host.querySelector(\"form\")).toBeNull();\n\t\texpect(host.querySelectorAll('[data-slot=\"banner-action\"] a')).toHaveLength(1);\n\t});\n\n\ttest(\"dismisses through a real form when dismissible\", () => {\n\t\tlet host = mount(\n\t\t\t<Banner\n\t\t\t\tlabel=\"Maintenance\"\n\t\t\t\tdismiss={{\n\t\t\t\t\tlabel: \"Dismiss\",\n\t\t\t\t\taction: \"/banners/dismiss\",\n\t\t\t\t\tfields: { id: \"maintenance-nov\" },\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tChecks pause for 10 minutes on Sunday at 02:00 UTC.\n\t\t\t</Banner>,\n\t\t);\n\t\tlet form = host.querySelector(\"form\")!;\n\t\tlet button = form.querySelector(\"button\")!;\n\n\t\texpect(form.getAttribute(\"method\")).toBe(\"post\");\n\t\texpect(form.getAttribute(\"action\")).toBe(\"/banners/dismiss\");\n\t\texpect(new FormData(form).get(\"id\")).toBe(\"maintenance-nov\");\n\t\texpect(button.type).toBe(\"submit\");\n\t\texpect(button.getAttribute(\"aria-label\")).toBe(\"Dismiss\");\n\t});\n\n\ttest(\"wraps on a 320px phone without scrolling sideways\", async () => {\n\t\tawait page.viewport(320, 640);\n\t\tlet host = mount(\n\t\t\t<Banner\n\t\t\t\tcolor=\"warning\"\n\t\t\t\tlabel=\"Billing\"\n\t\t\t\taction={<UpdateLink />}\n\t\t\t\tdismiss={{ label: \"Dismiss\", action: \"/banners/dismiss\" }}\n\t\t\t>\n\t\t\t\tYour card ending 4242 was declined three times. Update it to keep 48 monitors running.\n\t\t\t</Banner>,\n\t\t\t320,\n\t\t);\n\t\tlet banner = host.querySelector<HTMLElement>('[data-slot=\"banner\"]')!;\n\n\t\texpect(banner.scrollWidth).toBeLessThanOrEqual(banner.clientWidth);\n\t\texpect(document.documentElement.scrollWidth).toBeLessThanOrEqual(320);\n\t\tlet action = host.querySelector('[data-slot=\"banner-action\"]')!.getBoundingClientRect();\n\t\tlet message = host.querySelector('[data-slot=\"banner-message\"]')!.getBoundingClientRect();\n\t\texpect(action.top).toBeGreaterThanOrEqual(message.bottom);\n\t});\n});\n"
15
+ }
16
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breadcrumbs",
3
- "changedIn": "2026.10.24",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [
5
5
  "link"
6
6
  ],
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "source": {
11
11
  "path": "breadcrumbs.tsx",
12
- "content": "/**\n * A trail of links marking the page's position within a hierarchy of parent\n * sections, composing a `<nav>` root, an `<ol>` list, and `<li>` items around\n * {@link Breadcrumbs.Link}, a restyled {@link Link}. Every item but the last\n * draws its separator through a CSS `::after` pseudo-element, keeping it\n * purely presentational, and the trail's current segment reads straight from\n * the native `aria-current` attribute a consumer sets while rendering the\n * page it currently occupies.\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 { listStyle, pseudoContent } from \"@sdxc/u/general\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { m, mb, mis, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { fontSize, textDecoration, weight } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\n\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { Link } from \"@sdxc/ui/link\";\n\n/** Semantic color role {@link Breadcrumbs.Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"neutral\";\n\n/** Prefetch mode {@link Breadcrumbs.Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Breadcrumbs.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Breadcrumbs} and its compound parts.\n */\nexport namespace Breadcrumbs {\n\t/**\n\t * Every native `<nav>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Every native `<ol>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ol\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * When a segment's destination starts loading: on intent, once in the\n\t * viewport, on render through a `<link rel=\"prefetch\">` that also serves\n\t * full-document navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Every prop {@link Link.Props} accepts. A type alias rather than an\n\t * interface, since {@link Link.Props} resolves through a conditional type\n\t * that an `interface extends` clause can't statically extend.\n\t */\n\texport type LinkProps = Link.Props & {\n\t\t/**\n\t\t * Prefetch mode, for segments whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a long trail keeps it to its nearest parents, since\n\t\t * each 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 the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.\n * A root missing `aria-label` or `aria-labelledby` logs a dev-mode\n * `console.warn`, since assistive technology needs one to identify this landmark.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the trail's markup.\n * @example\n * <Breadcrumbs aria-label={t(\"breadcrumbs.label\")}>\n * \t<Breadcrumbs.List>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/projects\" aria-current=\"page\">\n * \t\t\t\t{t(\"nav.projects\")}\n * \t\t\t</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t</Breadcrumbs.List>\n * </Breadcrumbs>\n */\nexport function Breadcrumbs(handle: Handle<Breadcrumbs.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Breadcrumbs: needs an \"aria-label\" or \"aria-labelledby\" identifying this navigation landmark for assistive technology.',\n\t\t);\n\n\t\treturn <nav {...rest} data-slot=\"breadcrumbs\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n}\n\n/**\n * Renders the trail's `<ol>` list, resetting native list markers and spacing\n * and laying {@link Breadcrumbs.Item} children out in a row whose spacing\n * comes from each {@link Breadcrumbs.Link}'s padding, so the gaps stay clickable.\n *\n * @param handle Runtime handle carrying the host `<ol>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Breadcrumbs.List>\n * \t<Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t</Breadcrumbs.Item>\n * </Breadcrumbs.List>\n */\nBreadcrumbs.List = function BreadcrumbsList(handle: Handle<Breadcrumbs.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ol\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={[flex(), items(\"center\"), m(0), p(0), listStyle(), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single `<li>` wrapping one {@link Breadcrumbs.Link}. Every item\n * but the last draws a `›` separator glyph via a CSS `::after`\n * pseudo-element, keeping the divider purely presentational.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the item's markup.\n * @example\n * <Breadcrumbs.Item>\n * \t<Breadcrumbs.Link href=\"/projects\">{t(\"nav.projects\")}</Breadcrumbs.Link>\n * </Breadcrumbs.Item>\n */\nBreadcrumbs.Item = function BreadcrumbsItem(handle: Handle<Breadcrumbs.ItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\twhen(\"&:not(:last-child)::after\", [\n\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\tpseudoContent('\"›\"'),\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 one trail segment as a restyled {@link Link}: sized to `0.875rem`\n * with its underline dropped, defaulting to a quiet neutral color role that\n * brightens on hover and bolds when `aria-current=\"page\"` is set.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the segment's markup.\n * @example\n * <Breadcrumbs.Link href=\"/settings\" prefetch=\"render\">{t(\"nav.settings\")}</Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link href=\"/settings/profile\" aria-current=\"page\">\n * \t{t(\"nav.profile\")}\n * </Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link aria-disabled=\"true\">{t(\"nav.archived\")}</Breadcrumbs.Link>\n */\nBreadcrumbs.Link = function BreadcrumbsLink(handle: Handle<Breadcrumbs.LinkProps>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<Link\n\t\t\t\tcolor={resolvedColor}\n\t\t\t\tprefetch={prefetch ?? DEFAULT_PREFETCH}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\tmix={[\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The space around each separator lives in the link's own padding, so the\n\t\t\t\t\t * whole gap is clickable; the block padding reaches a 24px target and its\n\t\t\t\t\t * negative margin keeps the row at the text's height. The trail's first link\n\t\t\t\t\t * pulls back by its padding so the trail stays flush with its container.\n\t\t\t\t\t */\n\t\t\t\t\tpi(2),\n\t\t\t\t\tpb(0.5),\n\t\t\t\t\tmb(-0.5),\n\t\t\t\t\twhen('[data-slot=\"item\"]:first-child > &', mis(-2)),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\thover(textDecoration(\"none\")),\n\t\t\t\t\tdata(\"color\", \"neutral\", [fg(\"neutral.muted\"), hover(fg(\"neutral\"))]),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\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"
12
+ "content": "/**\n * A trail of links marking the page's position within a hierarchy of parent\n * sections, composing a `<nav>` root, an `<ol>` list, and `<li>` items around\n * {@link Breadcrumbs.Link}, a restyled {@link Link}. Every item but the last\n * draws its separator through a CSS `::after` pseudo-element, keeping it\n * purely presentational, and the trail's current segment reads straight from\n * the native `aria-current` attribute a consumer sets while rendering the\n * page it currently occupies.\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 { listStyle, pseudoContent, mergeMix } from \"@sdxc/u/general\";\nimport { flex, items } from \"@sdxc/u/layout\";\nimport { m, mb, mis, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { fontSize, textDecoration, weight } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\n\nimport { warnIfNoAccessibleLabel } from \"@sdxc/ui/utils\";\n\nimport { Link } from \"@sdxc/ui/link\";\n\n/** Semantic color role {@link Breadcrumbs.Link} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Link.Color = \"neutral\";\n\n/** Prefetch mode {@link Breadcrumbs.Link} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: Breadcrumbs.Prefetch = \"none\";\n\n/**\n * Prop types for {@link Breadcrumbs} and its compound parts.\n */\nexport namespace Breadcrumbs {\n\t/**\n\t * Every native `<nav>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Every native `<ol>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ListProps extends TagProps<\"ol\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface ItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * When a segment's destination starts loading: on intent, once in the\n\t * viewport, on render through a `<link rel=\"prefetch\">` that also serves\n\t * full-document navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Every prop {@link Link.Props} accepts. A type alias rather than an\n\t * interface, since {@link Link.Props} resolves through a conditional type\n\t * that an `interface extends` clause can't statically extend.\n\t */\n\texport type LinkProps = Link.Props & {\n\t\t/**\n\t\t * Prefetch mode, for segments whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a long trail keeps it to its nearest parents, since\n\t\t * each 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 the trail's `<nav>` root, laying {@link Breadcrumbs.List} as a row.\n * A root missing `aria-label` or `aria-labelledby` logs a dev-mode\n * `console.warn`, since assistive technology needs one to identify this landmark.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the trail's markup.\n * @example\n * <Breadcrumbs aria-label={t(\"breadcrumbs.label\")}>\n * \t<Breadcrumbs.List>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Item>\n * \t\t\t<Breadcrumbs.Link href=\"/projects\" aria-current=\"page\">\n * \t\t\t\t{t(\"nav.projects\")}\n * \t\t\t</Breadcrumbs.Link>\n * \t\t</Breadcrumbs.Item>\n * \t</Breadcrumbs.List>\n * </Breadcrumbs>\n */\nexport function Breadcrumbs(handle: Handle<Breadcrumbs.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Breadcrumbs: needs an \"aria-label\" or \"aria-labelledby\" identifying this navigation landmark for assistive technology.',\n\t\t);\n\n\t\treturn <nav {...rest} data-slot=\"breadcrumbs\" mix={mergeMix([flex(), items(\"center\")], mix)} />;\n\t};\n}\n\n/**\n * Renders the trail's `<ol>` list, resetting native list markers and spacing\n * and laying {@link Breadcrumbs.Item} children out in a row whose spacing\n * comes from each {@link Breadcrumbs.Link}'s padding, so the gaps stay clickable.\n *\n * @param handle Runtime handle carrying the host `<ol>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Breadcrumbs.List>\n * \t<Breadcrumbs.Item>\n * \t\t<Breadcrumbs.Link href=\"/\">{t(\"nav.home\")}</Breadcrumbs.Link>\n * \t</Breadcrumbs.Item>\n * </Breadcrumbs.List>\n */\nBreadcrumbs.List = function BreadcrumbsList(handle: Handle<Breadcrumbs.ListProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ol\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"list\"\n\t\t\t\tmix={mergeMix([flex(), items(\"center\"), m(0), p(0), listStyle()], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single `<li>` wrapping one {@link Breadcrumbs.Link}. Every item\n * but the last draws a `›` separator glyph via a CSS `::after`\n * pseudo-element, keeping the divider purely presentational.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the item's markup.\n * @example\n * <Breadcrumbs.Item>\n * \t<Breadcrumbs.Link href=\"/projects\">{t(\"nav.projects\")}</Breadcrumbs.Link>\n * </Breadcrumbs.Item>\n */\nBreadcrumbs.Item = function BreadcrumbsItem(handle: Handle<Breadcrumbs.ItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"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\twhen(\"&:not(:last-child)::after\", [\n\t\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\t\tpseudoContent('\"›\"'),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders one trail segment as a restyled {@link Link}: sized to `0.875rem`\n * with its underline dropped, defaulting to a quiet neutral color role that\n * brightens on hover and bolds when `aria-current=\"page\"` is set.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the segment's markup.\n * @example\n * <Breadcrumbs.Link href=\"/settings\" prefetch=\"render\">{t(\"nav.settings\")}</Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link href=\"/settings/profile\" aria-current=\"page\">\n * \t{t(\"nav.profile\")}\n * </Breadcrumbs.Link>\n * @example\n * <Breadcrumbs.Link aria-disabled=\"true\">{t(\"nav.archived\")}</Breadcrumbs.Link>\n */\nBreadcrumbs.Link = function BreadcrumbsLink(handle: Handle<Breadcrumbs.LinkProps>) {\n\treturn () => {\n\t\tlet { color, prefetch, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<Link\n\t\t\t\tcolor={resolvedColor}\n\t\t\t\tprefetch={prefetch ?? DEFAULT_PREFETCH}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"link\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The space around each separator lives in the link's own padding, so the\n\t\t\t\t\t\t * whole gap is clickable; the block padding reaches a 24px target and its\n\t\t\t\t\t\t * negative margin keeps the row at the text's height. The trail's first link\n\t\t\t\t\t\t * pulls back by its padding so the trail stays flush with its container.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tpi(2),\n\t\t\t\t\t\tpb(0.5),\n\t\t\t\t\t\tmb(-0.5),\n\t\t\t\t\t\twhen('[data-slot=\"item\"]:first-child > &', mis(-2)),\n\t\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\t\thover(textDecoration(\"none\")),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", [fg(\"neutral.muted\"), hover(fg(\"neutral\"))]),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
13
13
  },
14
14
  "test": {
15
15
  "path": "breadcrumbs.test.tsx",
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "button",
3
- "changedIn": "2026.10.29",
4
- "dependencies": [],
3
+ "changedIn": "2026.11.1",
4
+ "dependencies": [
5
+ "cta-group"
6
+ ],
5
7
  "exports": [
6
8
  "Button"
7
9
  ],
8
10
  "source": {
9
11
  "path": "button.tsx",
10
- "content": "/**\n * An interactive control for a single, immediate action — submitting a form,\n * triggering a command, opening a dialog. Its host renders as a native\n * `<button>` shaped by a semantic color role, a visual weight variant, and a\n * size, and holds its footprint while rendering a busy pending state.\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 { LoaderCircleIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded, visibility } from \"@sdxc/u/effects\";\nimport { cursor, userSelect } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tflex,\n\tgap,\n\tinlineFlex,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { bs, is, minBs, p, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text, weight } from \"@sdxc/u/typography\";\n\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 { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nconst DEFAULT_COLOR: Button.Color = \"neutral\";\n\nconst DEFAULT_VARIANT: Button.Variant = \"solid\";\n\nconst DEFAULT_SIZE: Button.Size = \"md\";\n\n/** Edge of a small icon-only button, matching the `sm` row height. */\nconst ICON_ONLY_SIZE_SM = \"var(--ui-button-icon-size-sm, 2rem)\";\n\n/** Edge of a medium icon-only button, matching the `md` row height. */\nconst ICON_ONLY_SIZE_MD = \"var(--ui-button-icon-size-md, 2.5rem)\";\n\n/** Edge of a large icon-only button, matching the `lg` row height. */\nconst ICON_ONLY_SIZE_LG = \"var(--ui-button-icon-size-lg, 3rem)\";\n\n/**\n * Native `type` given to a button carrying `command`/`commandfor` and no\n * `type` of its own: the platform treats a button that could also submit as an\n * ambiguous invoker and skips its command, so an invoker needs this type.\n */\nconst INVOKER_TYPE = \"button\";\n\n/**\n * Prop types for {@link Button}.\n */\nexport namespace Button {\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 button 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 button'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 * Per-part styling for the elements a pending button renders besides its\n\t * own host.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the decorative rotating glyph shown while pending. */\n\t\tspinner?: TagProps<\"span\">[\"mix\"];\n\t\t/**\n\t\t * Styling for the wrapper holding the button's own children while\n\t\t * pending; kept in the layout to preserve the button's footprint, but\n\t\t * hidden from view and from assistive technology.\n\t\t */\n\t\tcontent?: TagProps<\"span\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link Button}.\n\t */\n\texport interface Props extends TagProps<\"button\"> {\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 * Marks the button busy: merges into the native `disabled` attribute and\n\t\t * swaps the visible content for a spinner glyph while holding the rendered\n\t\t * footprint, so a page mid-request keeps its layout.\n\t\t */\n\t\tisPending?: boolean;\n\t\t/** Per-part styling for the pending state's internal elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Reports whether `children` is a lone glyph, which is what makes a button a target for\n * that glyph rather than for a label. A selector cannot answer this: `:only-child`\n * counts elements, so a button holding text beside one icon still matches it.\n *\n * @param children The button's own children.\n * @returns Whether the button renders a single element and no text of its own.\n */\nfunction holdsOnlyAGlyph(children: RemixNode): boolean {\n\treturn typeof children === \"object\" && children !== null && !Array.isArray(children);\n}\n\n/**\n * Visual state lives in `data-color`/`data-variant`/`data-size` on the host, so\n * hover, pressed, and focus-visible stay on native pseudo-classes. `type` precedes\n * the spread so the platform sees it while parsing `command`/`commandfor`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the button's markup.\n * @example\n * <Button type=\"submit\">{t(\"actions.save\")}</Button>\n * @example\n * <Button color=\"danger\" variant=\"outline\" size=\"sm\">{t(\"actions.delete\")}</Button>\n * @example\n * <Button type=\"submit\" isPending={isSubmitting}>{t(\"actions.save\")}</Button>\n * @example\n * <Button size=\"lg\" color=\"brand\" mix={[marketingCtaChrome()]}>{t(\"hero.cta\")}</Button>\n */\nexport function Button(handle: Handle<Button.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, isPending, disabled, type, parts, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isInvoker = rest.command !== undefined || rest.commandfor !== undefined;\n\t\tlet resolvedType = type ?? (isInvoker ? INVOKER_TYPE : undefined);\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedDisabled = disabled || isPending;\n\t\tlet iconOnly = holdsOnlyAGlyph(children);\n\t\tlet edges = glyphEdges(children);\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Button: an icon-only button needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={resolvedType}\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-pending={isPending || undefined}\n\t\t\t\tdata-icon-only={iconOnly || undefined}\n\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\tdisabled={resolvedDisabled}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', outline(\"neutral.ring\")),\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\tinteractiveTransition(),\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\tgap(2),\n\t\t\t\t\t/**\n\t\t\t\t\t * A glyph is measured against the label it sits beside rather than against\n\t\t\t\t\t * whatever an icon set draws at, so the row keeps the height its text and\n\t\t\t\t\t * padding ask for. It never shrinks either: squeeze the row and the default\n\t\t\t\t\t * `flex-shrink: 1` compresses the glyph rather than the words, and a squashed\n\t\t\t\t\t * icon reads as a rendering fault.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\tpi(4),\n\t\t\t\t\tpb(2),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * Every variant carries the same border width, colored to match its own\n\t\t\t\t\t * fill (transparent for ghost), so solid and ghost render the exact\n\t\t\t\t\t * footprint outline does.\n\t\t\t\t\t */\n\t\t\t\t\tborder({ width: 1, noStyleDefault: true }),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The row measure is stated rather than left to fall out of the padding and\n\t\t\t\t\t * the border, so the control lines up with a field of the same size when a\n\t\t\t\t\t * Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t */\n\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\twhen('&[data-size=\"sm\"]', [\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(1.5),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3)]),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-size=\"lg\"]', [\n\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t]),\n\n\t\t\t\t\t/**\n\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 * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\twhen('&[data-size=\"sm\"]', pis(2)),\n\t\t\t\t\t\twhen('&[data-size=\"lg\"]', pis(4)),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\twhen('&[data-size=\"sm\"]', pie(2)),\n\t\t\t\t\t\twhen('&[data-size=\"lg\"]', pie(4)),\n\t\t\t\t\t]),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * A button holding a glyph and nothing else is a target for that glyph alone, so\n\t\t\t\t\t * it takes a round footprint as tall as the row it would otherwise fill. The\n\t\t\t\t\t * measure is a custom property per size, since a box sized by its own content on\n\t\t\t\t\t * both axes has no ratio to resolve against, and an app or a composing part can\n\t\t\t\t\t * resize it without touching the rule.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&[data-icon-only]\", [\n\t\t\t\t\t\tp(0),\n\t\t\t\t\t\tis(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\tbs(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-size=\"sm\"][data-icon-only]', [\n\t\t\t\t\t\tis(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t\tbs(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-size=\"lg\"][data-icon-only]', [\n\t\t\t\t\t\tis(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t\tbs(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen('&[data-variant=\"solid\"]', [\n\t\t\t\t\t\twhen('&[data-color=\"brand\"]', [\n\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", [bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', [\n\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\tbg(\"neutral.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\tborder(\"neutral.bg-solid-pressed\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"success\"]', [\n\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\tbg(\"success.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\tborder(\"success.bg-solid-pressed\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"warning\"]', [\n\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\tbg(\"warning.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\tborder(\"warning.bg-solid-pressed\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"danger\"]', [\n\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", [bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen('&[data-variant=\"outline\"]', [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\twhen('&[data-color=\"brand\"]', [\n\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', [\n\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"success\"]', [\n\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"warning\"]', [\n\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"danger\"]', [\n\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen('&[data-variant=\"ghost\"]', [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tborder(\"transparent\"),\n\t\t\t\t\t\twhen('&[data-color=\"brand\"]', [\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"brand.tint\")),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', [\n\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"success\"]', [\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"success.tint\")),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"warning\"]', [\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"warning.tint\")),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-color=\"danger\"]', [\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"danger.tint\")),\n\t\t\t\t\t\t\twhen(\"&:active\", bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"&:disabled:not([data-pending])\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\t\twhen(\"&[data-pending]\", [relative(), cursor(\"wait\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{isPending ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tdata-slot=\"spinner\"\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\t\tinset(0),\n\t\t\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\twhen(\"& svg\", [\n\t\t\t\t\t\t\t\t\tis(\"var(--ui-spinner-icon-size-sm, 1rem)\"),\n\t\t\t\t\t\t\t\t\tbs(\"var(--ui-spinner-icon-size-sm, 1rem)\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\twhen('[data-size=\"lg\"] & svg', [\n\t\t\t\t\t\t\t\t\tis(\"var(--ui-spinner-icon-size-md, 1.25rem)\"),\n\t\t\t\t\t\t\t\t\tbs(\"var(--ui-spinner-icon-size-md, 1.25rem)\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tparts?.spinner,\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LoaderCircleIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tdata-slot=\"content\"\n\t\t\t\t\t\t\tmix={[visibility(\"hidden\"), inlineFlex(), items(\"center\"), gap(2), parts?.content]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tchildren\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t};\n}\n"
12
+ "content": "/**\n * An interactive control for a single, immediate action — submitting a form,\n * triggering a command, opening a dialog. Its host renders as a native\n * `<button>` shaped by a semantic color role, a visual weight variant, and a\n * size, and holds its footprint while rendering a busy pending state.\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 { LoaderCircleIcon } from \"@sdxc/icons\";\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, visibility } from \"@sdxc/u/effects\";\nimport { cursor, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tflex,\n\tgap,\n\tinlineFlex,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { bs, is, minBs, p, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\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 { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { CtaGroup } from \"@sdxc/ui/cta-group\";\n\nconst DEFAULT_COLOR: Button.Color = \"neutral\";\n\nconst DEFAULT_VARIANT: Button.Variant = \"solid\";\n\nconst DEFAULT_SIZE: Button.Size = \"md\";\n\n/** Edge of a small icon-only button, matching the `sm` row height. */\nconst ICON_ONLY_SIZE_SM = \"var(--ui-button-icon-size-sm, 2rem)\";\n\n/** Edge of a medium icon-only button, matching the `md` row height. */\nconst ICON_ONLY_SIZE_MD = \"var(--ui-button-icon-size-md, 2.5rem)\";\n\n/** Edge of a large icon-only button, matching the `lg` row height. */\nconst ICON_ONLY_SIZE_LG = \"var(--ui-button-icon-size-lg, 3rem)\";\n\n/**\n * Native `type` given to a button carrying `command`/`commandfor` and no\n * `type` of its own: the platform treats a button that could also submit as an\n * ambiguous invoker and skips its command, so an invoker needs this type.\n */\nconst INVOKER_TYPE = \"button\";\n\n/**\n * Prop types for {@link Button}.\n */\nexport namespace Button {\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 button 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 button'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 * Per-part styling for the elements a pending button renders besides its\n\t * own host.\n\t */\n\texport interface PartsProps {\n\t\t/** Styling for the decorative rotating glyph shown while pending. */\n\t\tspinner?: TagProps<\"span\">[\"mix\"];\n\t\t/**\n\t\t * Styling for the wrapper holding the button's own children while\n\t\t * pending; kept in the layout to preserve the button's footprint, but\n\t\t * hidden from view and from assistive technology.\n\t\t */\n\t\tcontent?: TagProps<\"span\">[\"mix\"];\n\t}\n\n\t/**\n\t * Props accepted by {@link Button}.\n\t */\n\texport interface Props extends TagProps<\"button\"> {\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 * Marks the button busy: merges into the native `disabled` attribute and\n\t\t * swaps the visible content for a spinner glyph while holding the rendered\n\t\t * footprint, so a page mid-request keeps its layout.\n\t\t */\n\t\tisPending?: boolean;\n\t\t/** Per-part styling for the pending state's internal elements. */\n\t\tparts?: PartsProps;\n\t}\n}\n\n/**\n * Reports whether `children` is a lone glyph, which is what makes a button a target for\n * that glyph rather than for a label. A selector cannot answer this: `:only-child`\n * counts elements, so a button holding text beside one icon still matches it.\n *\n * @param children The button's own children.\n * @returns Whether the button renders a single element and no text of its own.\n */\nfunction holdsOnlyAGlyph(children: RemixNode): boolean {\n\treturn typeof children === \"object\" && children !== null && !Array.isArray(children);\n}\n\n/**\n * Visual state lives in `data-color`/`data-variant`/`data-size` on the host, so\n * hover, pressed, and focus-visible stay on native pseudo-classes. `type` precedes\n * the spread so the platform sees it while parsing `command`/`commandfor`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the button's markup.\n * @example\n * <Button type=\"submit\">{t(\"actions.save\")}</Button>\n * @example\n * <Button color=\"danger\" variant=\"outline\" size=\"sm\">{t(\"actions.delete\")}</Button>\n * @example\n * <Button type=\"submit\" isPending={isSubmitting}>{t(\"actions.save\")}</Button>\n * @example\n * <Button size=\"lg\" color=\"brand\" mix={[landingCtaChrome()]}>{t(\"hero.cta\")}</Button>\n */\nexport function Button(handle: Handle<Button.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, isPending, disabled, type, parts, children, mix, ...rest } =\n\t\t\thandle.props;\n\t\tlet isInvoker = rest.command !== undefined || rest.commandfor !== undefined;\n\t\tlet resolvedType = type ?? (isInvoker ? INVOKER_TYPE : undefined);\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 resolvedDisabled = disabled || isPending;\n\t\tlet iconOnly = holdsOnlyAGlyph(children);\n\t\tlet edges = glyphEdges(children);\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Button: an icon-only button needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={resolvedType}\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-pending={isPending || undefined}\n\t\t\t\tdata-icon-only={iconOnly || undefined}\n\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\tdisabled={resolvedDisabled}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', outline(\"neutral.ring\")),\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\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 is measured against the label it sits beside rather than against\n\t\t\t\t\t\t * whatever an icon set draws at, so the row keeps the height its text and\n\t\t\t\t\t\t * padding ask for. It never shrinks either: squeeze the row and the default\n\t\t\t\t\t\t * `flex-shrink: 1` compresses the glyph rather than the words, and a squashed\n\t\t\t\t\t\t * 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\traw({\n\t\t\t\t\t\t\tborderRadius: \"var(--ui-button-radius, var(--ui-radius-md, 0.375rem))\",\n\t\t\t\t\t\t\tfontWeight: \"var(--ui-button-weight, 500)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tcursor(\"default\"),\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\tuserSelect(),\n\n\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\ttext(\"sm\"),\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 own\n\t\t\t\t\t\t * fill (transparent for ghost), so solid and ghost render the exact\n\t\t\t\t\t\t * footprint outline does.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tborder({ width: 1, noStyleDefault: true }),\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row measure is stated rather than left to fall out of the padding and\n\t\t\t\t\t\t * the border, so the control lines up with a field of the same size when a\n\t\t\t\t\t\t * 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\twhen('&[data-size=\"sm\"]', [\n\t\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\t\tpb(1.5),\n\t\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\t\tminBs(\"2rem\"),\n\t\t\t\t\t\t\twhen(\"& > svg\", [is(3), bs(3)]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-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\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\twhen('&[data-size=\"sm\"]', pis(2)),\n\t\t\t\t\t\t\twhen('&[data-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\twhen('&[data-size=\"sm\"]', pie(2)),\n\t\t\t\t\t\t\twhen('&[data-size=\"lg\"]', pie(4)),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A button holding a glyph and nothing else is a target for that glyph alone, so\n\t\t\t\t\t\t * it takes a round footprint as tall as the row it would otherwise fill. The\n\t\t\t\t\t\t * measure is a custom property per size, since a box sized by its own content on\n\t\t\t\t\t\t * both axes has no ratio to resolve against, and an app or a composing part can\n\t\t\t\t\t\t * resize it without touching the rule.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&[data-icon-only]\", [\n\t\t\t\t\t\t\tp(0),\n\t\t\t\t\t\t\tis(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\t\tbs(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_MD),\n\t\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\t\traw({ \"--ui-button-radius\": \"9999px\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-size=\"sm\"][data-icon-only]', [\n\t\t\t\t\t\t\tis(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t\t\tbs(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_SM),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-size=\"lg\"][data-icon-only]', [\n\t\t\t\t\t\t\tis(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t\t\tbs(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t\t\tminBs(ICON_ONLY_SIZE_LG),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen('&[data-variant=\"solid\"]', [\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", [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\twhen('&[data-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\twhen(\"&:hover\", [bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\t\tbg(\"neutral.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t\tborder(\"neutral.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\t\tbg(\"success.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t\tborder(\"success.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\t\tbg(\"warning.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t\tborder(\"warning.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", [\n\t\t\t\t\t\t\t\t\tbg(\"danger.bg-solid-pressed\"),\n\t\t\t\t\t\t\t\t\tborder(\"danger.bg-solid-pressed\"),\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\n\t\t\t\t\t\twhen('&[data-variant=\"outline\"]', [\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', [\n\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-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\twhen(\"&:hover\", [bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen('&[data-variant=\"ghost\"]', [\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tborder(\"transparent\"),\n\t\t\t\t\t\t\twhen('&[data-color=\"brand\"]', [\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-color=\"neutral\"]', [\n\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', [\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"success.tint\")),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', [\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', [\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\twhen(\"&:hover\", bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\twhen(\"&:active\", bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\twhen('&[data-variant=\"surface\"]', [surfaceControl()]),\n\n\t\t\t\t\t\twhen(\"&:disabled:not([data-pending])\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\t\t\twhen(\"&[data-pending]\", [relative(), cursor(\"wait\")]),\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{isPending ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tdata-slot=\"spinner\"\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\t\t\tinset(0),\n\t\t\t\t\t\t\t\tflex(),\n\t\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\twhen(\"& svg\", [\n\t\t\t\t\t\t\t\t\tis(\"var(--ui-spinner-icon-size-sm, 1rem)\"),\n\t\t\t\t\t\t\t\t\tbs(\"var(--ui-spinner-icon-size-sm, 1rem)\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\twhen('[data-size=\"lg\"] & svg', [\n\t\t\t\t\t\t\t\t\tis(\"var(--ui-spinner-icon-size-md, 1.25rem)\"),\n\t\t\t\t\t\t\t\t\tbs(\"var(--ui-spinner-icon-size-md, 1.25rem)\"),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tparts?.spinner,\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LoaderCircleIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tdata-slot=\"content\"\n\t\t\t\t\t\t\tmix={[visibility(\"hidden\"), inlineFlex(), items(\"center\"), gap(2), parts?.content]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tchildren\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t};\n}\n"
11
13
  },
12
14
  "test": {
13
15
  "path": "button.test.tsx",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calendar",
3
- "changedIn": "2026.10.20",
3
+ "changedIn": "2026.11.1",
4
4
  "dependencies": [
5
5
  "heading",
6
6
  "input"
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "source": {
12
12
  "path": "calendar.tsx",
13
- "content": "/**\n * A month-grid calendar surface composed from a navigable header and a native\n * `<table>` of day cells, styled through the platform's own semantics. Used\n * bare, it renders a native `<input type=\"date\">` — a complete,\n * keyboard-operable date control on its own.\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 { ChevronLeftIcon, ChevronRightIcon } from \"@sdxc/icons\";\nimport { bg, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tborderCollapse,\n\tborderSpacing,\n\tflex,\n\tgrow,\n\tinlineBlock,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { bs, is, mbe, p, pbe } from \"@sdxc/u/size\";\nimport { hover, when } from \"@sdxc/u/state\";\nimport { scaleX } from \"@sdxc/u/transform\";\nimport {\n\ttabularNums,\n\ttext,\n\ttextAlign,\n\ttextDecoration,\n\tverticalAlign,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport {\n\twarnIfNoAccessibleLabel,\n\twarnIfNoAccessibleName,\n} from \"@sdxc/ui/utils\";\n\nimport { Heading } from \"@sdxc/ui/heading\";\nimport { Input } from \"@sdxc/ui/input\";\n\nconst DEFAULT_COLOR: Calendar.Color = \"neutral\";\n\n/**\n * `type` for {@link Calendar.PreviousButton} and {@link Calendar.NextButton}\n * when a consumer supplies none, keeping a click on either control a plain\n * month change inside a surrounding `<form>`.\n */\nconst DEFAULT_NAV_BUTTON_TYPE: NonNullable<Calendar.PreviousButtonProps[\"type\"]> = \"button\";\n\n/**\n * Prop types for {@link Calendar} and its compound parts.\n */\nexport namespace Calendar {\n\t/**\n\t * Semantic color role for the bare `<input type=\"date\">` fallback's keyboard\n\t * focus ring, each mapped to its matching `--ui-*` variables. The composed\n\t * grid reads fixed semantic roles, identical across every rendered month.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Props accepted by {@link Calendar}. Composing {@link Calendar.Header} and\n\t * {@link Calendar.Grid} as `children` renders the visual month surface;\n\t * `children` left unset renders the native `<input type=\"date\">` fallback.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Semantic color role for the bare fallback control's focus ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Native `name` submitted with an enclosing form, read only by the bare fallback control. */\n\t\tname?: string;\n\t\t/** Current value, in `YYYY-MM-DD` form, for a bare fallback control a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, in `YYYY-MM-DD` form, for a bare fallback control left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read only by the bare fallback control. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read only by the bare fallback control. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, the bare fallback control's value must fall on. */\n\t\tstep?: number;\n\t\t/** Marks the bare fallback control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the bare fallback control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the bare fallback control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for the bare fallback control, e.g. `\"bday\"`. */\n\t\tautoComplete?: string;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_NAV_BUTTON_TYPE}. Needs an `aria-label`\n\t * (e.g. `\"Previous month\"`) as the control's only accessible name.\n\t */\n\texport interface PreviousButtonProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix`\n\t * passthrough, mirroring {@link Calendar.PreviousButton} for the following\n\t * month instead.\n\t */\n\texport interface NextButtonProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every prop {@link Heading} accepts, unchanged. `level` still chooses\n\t * which native heading element renders, defaulting the same way\n\t * {@link Heading} does.\n\t */\n\texport interface HeadingProps extends Heading.Props {}\n\n\t/**\n\t * Every native `<table>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridProps extends TagProps<\"table\"> {}\n\n\t/**\n\t * Every native `<thead>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridHeaderProps extends TagProps<\"thead\"> {}\n\n\t/**\n\t * Every native `<tr>` attribute, unchanged, plus the `mix` passthrough. Holds\n\t * one row of {@link Calendar.HeaderCell} in {@link Calendar.GridHeader}, or\n\t * one week of {@link Calendar.Cell} in {@link Calendar.GridBody}.\n\t */\n\texport interface RowProps extends TagProps<\"tr\"> {}\n\n\t/**\n\t * Every native `<th>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface HeaderCellProps extends TagProps<\"th\"> {}\n\n\t/**\n\t * Every native `<tbody>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridBodyProps extends TagProps<\"tbody\"> {}\n\n\t/**\n\t * Every native `<td>` attribute, unchanged, plus the `mix` passthrough. Day\n\t * state is read straight off the rendered element: the consumer sets\n\t * `aria-selected`, `aria-disabled`, `data-unavailable`, `data-outside-month`.\n\t */\n\texport interface CellProps extends TagProps<\"td\"> {}\n}\n\n/**\n * Renders a rounded, padded surface around whichever children a consumer\n * composes; `children` left unset renders a native `<input type=\"date\">`\n * through {@link Input}, the one part the platform itself operates.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the calendar's markup.\n * @example\n * <Calendar aria-label={t(\"form.startDate.label\")} name=\"startDate\" />\n * @example\n * <Calendar aria-label={t(\"calendar.label\")}>\n * \t<Calendar.Header>\n * \t\t<Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n * \t\t<Calendar.Heading>{monthLabel}</Calendar.Heading>\n * \t\t<Calendar.NextButton aria-label={t(\"calendar.next\")} />\n * \t</Calendar.Header>\n * \t<Calendar.Grid aria-label={monthLabel}>\n * \t\t<Calendar.GridHeader>\n * \t\t\t<Calendar.Row>\n * \t\t\t\t{weekdayLabels.map((day) => (\n * \t\t\t\t\t<Calendar.HeaderCell key={day}>{day}</Calendar.HeaderCell>\n * \t\t\t\t))}\n * \t\t\t</Calendar.Row>\n * \t\t</Calendar.GridHeader>\n * \t\t<Calendar.GridBody>\n * \t\t\t{weeks.map((week) => (\n * \t\t\t\t<Calendar.Row key={week[0].iso}>\n * \t\t\t\t\t{week.map((day) => (\n * \t\t\t\t\t\t<Calendar.Cell\n * \t\t\t\t\t\t\tkey={day.iso}\n * \t\t\t\t\t\t\taria-selected={day.iso === selected ? \"true\" : undefined}\n * \t\t\t\t\t\t\tdata-outside-month={day.outsideMonth ? \"\" : undefined}\n * \t\t\t\t\t\t>\n * \t\t\t\t\t\t\t{day.label}\n * \t\t\t\t\t\t</Calendar.Cell>\n * \t\t\t\t\t))}\n * \t\t\t\t</Calendar.Row>\n * \t\t\t))}\n * \t\t</Calendar.GridBody>\n * \t</Calendar.Grid>\n * </Calendar>\n */\nexport function Calendar(handle: Handle<Calendar.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\t\"aria-label\": ariaLabel,\n\t\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\tif (import.meta.env?.DEV && !children && !ariaLabel && !ariaLabelledBy) {\n\t\t\tconsole.warn(\n\t\t\t\t'Calendar: falling back to a plain \"input type=date\" needs an \"aria-label\" or \"aria-labelledby\" describing what it collects for assistive technology.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"calendar\"\n\t\t\t\tmix={[inlineBlock(), rounded(\"lg\"), p(3), bg(\"neutral.tint\"), mix]}\n\t\t\t>\n\t\t\t\t{children ?? (\n\t\t\t\t\t<Input\n\t\t\t\t\t\ttype=\"date\"\n\t\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Calendar}'s nav row: a flex row spacing\n * {@link Calendar.PreviousButton}, {@link Calendar.Heading}, and\n * {@link Calendar.NextButton} apart, the heading centered between the controls.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the nav row's markup.\n * @example\n * <Calendar.Header>\n * \t<Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n * \t<Calendar.Heading>{monthLabel}</Calendar.Heading>\n * \t<Calendar.NextButton aria-label={t(\"calendar.next\")} />\n * </Calendar.Header>\n */\nCalendar.Header = function CalendarHeader(handle: Handle<Calendar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[flex(), items(\"center\"), justify(\"between\"), mbe(4), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a round icon control standing for \"show the previous month\", sized\n * to match {@link Calendar.NextButton}. Its default chevron flips under\n * `dir=\"rtl\"` through CSS. A `calendarKeys()` mixin drives the behavior.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n */\nCalendar.PreviousButton = function CalendarPreviousButton(\n\thandle: Handle<Calendar.PreviousButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t'Calendar.PreviousButton: an icon-only control needs an \"aria-label\" describing what it does — assistive technology has no accessible text to announce otherwise.',\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_NAV_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"previous-button\"\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\trelative(),\n\t\t\t\t\tis(8),\n\t\t\t\t\tbs(8),\n\t\t\t\t\thitArea(),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\twhen(\"& svg\", [is(4), bs(4)]),\n\t\t\t\t\twhen(\"&:dir(rtl) svg\", scaleX(-1)),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children ?? <ChevronLeftIcon />}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a round icon control standing for \"show the following month\", with\n * the rendering, focus, and disabled-state contract of\n * {@link Calendar.PreviousButton} and a trailing chevron by default.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <Calendar.NextButton aria-label={t(\"calendar.next\")} />\n */\nCalendar.NextButton = function CalendarNextButton(handle: Handle<Calendar.NextButtonProps>) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t'Calendar.NextButton: an icon-only control needs an \"aria-label\" describing what it does — assistive technology has no accessible text to announce otherwise.',\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_NAV_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"next-button\"\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\trelative(),\n\t\t\t\t\tis(8),\n\t\t\t\t\tbs(8),\n\t\t\t\t\thitArea(),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\twhen(\"& svg\", [is(4), bs(4)]),\n\t\t\t\t\twhen(\"&:dir(rtl) svg\", scaleX(-1)),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children ?? <ChevronRightIcon />}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders the consumer-formatted month/year caption through {@link Heading},\n * centered between the nav controls at a small semibold size layered after\n * {@link Heading}'s own defaults, so this size and alignment win over them.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the caption's markup.\n * @example\n * <Calendar.Heading>{new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(visibleMonth)}</Calendar.Heading>\n */\nCalendar.Heading = function CalendarHeading(handle: Handle<Calendar.HeadingProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Heading\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"heading\"\n\t\t\t\tmix={[\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\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\n/**\n * Renders the day grid's native `<table>` host, rows and cells set apart by a\n * small gap on every side. Its `aria-label`/`aria-labelledby` — typically the\n * visible month label — names the whole grid; dev mode warns when it is absent.\n *\n * @param handle Runtime handle carrying the host `<table>`'s props.\n * @returns The render function producing the grid's markup.\n * @example\n * <Calendar.Grid aria-label={monthLabel}>\n * \t<Calendar.GridHeader>...</Calendar.GridHeader>\n * \t<Calendar.GridBody>...</Calendar.GridBody>\n * </Calendar.Grid>\n */\nCalendar.Grid = function CalendarGrid(handle: Handle<Calendar.GridProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Calendar.Grid: needs an \"aria-label\" or \"aria-labelledby\" identifying which month it shows for assistive technology.',\n\t\t);\n\n\t\treturn (\n\t\t\t<table\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"grid\"\n\t\t\t\tmix={[borderCollapse(\"separate\"), borderSpacing(\"0.25rem\"), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the grid's `<thead>` host: a plain wrapper for the weekday\n * {@link Calendar.Row}.\n *\n * @param handle Runtime handle carrying the host `<thead>`'s props.\n * @returns The render function producing the header section's markup.\n * @example\n * <Calendar.GridHeader>\n * \t<Calendar.Row>\n * \t\t<Calendar.HeaderCell>{t(\"calendar.weekdays.sun\")}</Calendar.HeaderCell>\n * \t</Calendar.Row>\n * </Calendar.GridHeader>\n */\nCalendar.GridHeader = function CalendarGridHeader(handle: Handle<Calendar.GridHeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <thead {...rest} data-slot=\"grid-header\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<tr>` host: one row of {@link Calendar.HeaderCell} inside\n * {@link Calendar.GridHeader}, or one week of {@link Calendar.Cell} inside\n * {@link Calendar.GridBody}.\n *\n * @param handle Runtime handle carrying the host `<tr>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Calendar.Row>\n * \t<Calendar.Cell>{day.label}</Calendar.Cell>\n * </Calendar.Row>\n */\nCalendar.Row = function CalendarRow(handle: Handle<Calendar.RowProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <tr {...rest} data-slot=\"row\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders a weekday abbreviation inside a native `<th scope=\"col\">`, sized\n * small and muted beneath {@link Calendar.Cell}'s own larger day numbers.\n *\n * @param handle Runtime handle carrying the host `<th>`'s props.\n * @returns The render function producing the weekday header's markup.\n * @example\n * <Calendar.HeaderCell>{t(\"calendar.weekdays.sun\")}</Calendar.HeaderCell>\n */\nCalendar.HeaderCell = function CalendarHeaderCell(handle: Handle<Calendar.HeaderCellProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<th\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header-cell\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ scope: \"col\" }),\n\t\t\t\t\tpbe(2),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttext(\"xs\"),\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 grid's `<tbody>` host: a plain wrapper for one\n * {@link Calendar.Row} per week.\n *\n * @param handle Runtime handle carrying the host `<tbody>`'s props.\n * @returns The render function producing the body section's markup.\n * @example\n * <Calendar.GridBody>\n * \t{weeks.map((week) => (\n * \t\t<Calendar.Row key={week[0].iso}>...</Calendar.Row>\n * \t))}\n * </Calendar.GridBody>\n */\nCalendar.GridBody = function CalendarGridBody(handle: Handle<Calendar.GridBodyProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <tbody {...rest} data-slot=\"grid-body\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders one calendar day inside a native `<td>`, a fixed round pill around\n * its number. `aria-selected`, `aria-disabled`, `data-unavailable`,\n * `data-outside-month`, and `aria-invalid` each drive their own visual state.\n *\n * @param handle Runtime handle carrying the host `<td>`'s props.\n * @returns The render function producing the day's markup.\n * @example\n * <Calendar.Cell aria-selected={day.iso === selected ? \"true\" : undefined}>\n * \t{day.label}\n * </Calendar.Cell>\n * @example\n * <Calendar.Cell data-outside-month=\"\">{day.label}</Calendar.Cell>\n */\nCalendar.Cell = function CalendarCell(handle: Handle<Calendar.CellProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<td\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"cell\"\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t/**\n\t\t\t\t\t * Table alignment centres the day while the cell stays a table cell in its row; a row\n\t\t\t\t\t * laid out as a flex box turns its cells into blocks, where `align-content` centres the\n\t\t\t\t\t * day. Each declaration answers one of the two cases.\n\t\t\t\t\t */\n\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\tverticalAlign(\"middle\"),\n\t\t\t\t\traw({ alignContent: \"center\" }),\n\t\t\t\t\tis(9),\n\t\t\t\t\tbs(9),\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]', [bg(\"brand.solid\"), fg(\"brand.onSolid\")]),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(30)]),\n\t\t\t\t\twhen(\"&[data-unavailable]\", [fg(\"neutral.muted\"), textDecoration(\"line-through\")]),\n\t\t\t\t\twhen(\"&[data-outside-month]\", fg(\"neutral.muted\")),\n\t\t\t\t\twhen('&[aria-invalid=\"true\"]', [bg(\"danger.solid\"), fg(\"danger.onSolid\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
13
+ "content": "/**\n * A month-grid calendar surface composed from a navigable header and a native\n * `<table>` of day cells, styled through the platform's own semantics. Used\n * bare, it renders a native `<input type=\"date\">` — a complete,\n * keyboard-operable date control on its own.\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 { ChevronLeftIcon, ChevronRightIcon } from \"@sdxc/icons\";\nimport { bg, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tborderCollapse,\n\tborderSpacing,\n\tflex,\n\tgrow,\n\tinlineBlock,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { bs, is, mbe, p, pbe } from \"@sdxc/u/size\";\nimport { hover, when } from \"@sdxc/u/state\";\nimport { scaleX } from \"@sdxc/u/transform\";\nimport {\n\ttabularNums,\n\ttext,\n\ttextAlign,\n\ttextDecoration,\n\tverticalAlign,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport {\n\twarnIfNoAccessibleLabel,\n\twarnIfNoAccessibleName,\n} from \"@sdxc/ui/utils\";\n\nimport { Heading } from \"@sdxc/ui/heading\";\nimport { Input } from \"@sdxc/ui/input\";\n\nconst DEFAULT_COLOR: Calendar.Color = \"neutral\";\n\n/**\n * `type` for {@link Calendar.PreviousButton} and {@link Calendar.NextButton}\n * when a consumer supplies none, keeping a click on either control a plain\n * month change inside a surrounding `<form>`.\n */\nconst DEFAULT_NAV_BUTTON_TYPE: NonNullable<Calendar.PreviousButtonProps[\"type\"]> = \"button\";\n\n/**\n * Prop types for {@link Calendar} and its compound parts.\n */\nexport namespace Calendar {\n\t/**\n\t * Semantic color role for the bare `<input type=\"date\">` fallback's keyboard\n\t * focus ring, each mapped to its matching `--ui-*` variables. The composed\n\t * grid reads fixed semantic roles, identical across every rendered month.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Props accepted by {@link Calendar}. Composing {@link Calendar.Header} and\n\t * {@link Calendar.Grid} as `children` renders the visual month surface;\n\t * `children` left unset renders the native `<input type=\"date\">` fallback.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Semantic color role for the bare fallback control's focus ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Native `name` submitted with an enclosing form, read only by the bare fallback control. */\n\t\tname?: string;\n\t\t/** Current value, in `YYYY-MM-DD` form, for a bare fallback control a consumer tracks itself. */\n\t\tvalue?: string;\n\t\t/** Initial value, in `YYYY-MM-DD` form, for a bare fallback control left to the platform's own uncontrolled state. */\n\t\tdefaultValue?: string;\n\t\t/** Earliest accepted date, in `YYYY-MM-DD` form, read only by the bare fallback control. */\n\t\tmin?: string;\n\t\t/** Latest accepted date, in `YYYY-MM-DD` form, read only by the bare fallback control. */\n\t\tmax?: string;\n\t\t/** Granularity, in days, the bare fallback control's value must fall on. */\n\t\tstep?: number;\n\t\t/** Marks the bare fallback control required for its enclosing form. */\n\t\trequired?: boolean;\n\t\t/** Marks the bare fallback control inert and excluded from the tab order. */\n\t\tdisabled?: boolean;\n\t\t/** Marks the bare fallback control's value fixed, while keeping it focusable and included in form submission. */\n\t\treadOnly?: boolean;\n\t\t/** Native autofill hint for the bare fallback control, e.g. `\"bday\"`. */\n\t\tautoComplete?: string;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_NAV_BUTTON_TYPE}. Needs an `aria-label`\n\t * (e.g. `\"Previous month\"`) as the control's only accessible name.\n\t */\n\texport interface PreviousButtonProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix`\n\t * passthrough, mirroring {@link Calendar.PreviousButton} for the following\n\t * month instead.\n\t */\n\texport interface NextButtonProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every prop {@link Heading} accepts, unchanged. `level` still chooses\n\t * which native heading element renders, defaulting the same way\n\t * {@link Heading} does.\n\t */\n\texport interface HeadingProps extends Heading.Props {}\n\n\t/**\n\t * Every native `<table>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridProps extends TagProps<\"table\"> {}\n\n\t/**\n\t * Every native `<thead>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridHeaderProps extends TagProps<\"thead\"> {}\n\n\t/**\n\t * Every native `<tr>` attribute, unchanged, plus the `mix` passthrough. Holds\n\t * one row of {@link Calendar.HeaderCell} in {@link Calendar.GridHeader}, or\n\t * one week of {@link Calendar.Cell} in {@link Calendar.GridBody}.\n\t */\n\texport interface RowProps extends TagProps<\"tr\"> {}\n\n\t/**\n\t * Every native `<th>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface HeaderCellProps extends TagProps<\"th\"> {}\n\n\t/**\n\t * Every native `<tbody>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface GridBodyProps extends TagProps<\"tbody\"> {}\n\n\t/**\n\t * Every native `<td>` attribute, unchanged, plus the `mix` passthrough. Day\n\t * state is read straight off the rendered element: the consumer sets\n\t * `aria-selected`, `aria-disabled`, `data-unavailable`, `data-outside-month`.\n\t */\n\texport interface CellProps extends TagProps<\"td\"> {}\n}\n\n/**\n * Renders a rounded, padded surface around whichever children a consumer\n * composes; `children` left unset renders a native `<input type=\"date\">`\n * through {@link Input}, the one part the platform itself operates.\n *\n * @param handle Runtime handle carrying the root element's props.\n * @returns The render function producing the calendar's markup.\n * @example\n * <Calendar aria-label={t(\"form.startDate.label\")} name=\"startDate\" />\n * @example\n * <Calendar aria-label={t(\"calendar.label\")}>\n * \t<Calendar.Header>\n * \t\t<Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n * \t\t<Calendar.Heading>{monthLabel}</Calendar.Heading>\n * \t\t<Calendar.NextButton aria-label={t(\"calendar.next\")} />\n * \t</Calendar.Header>\n * \t<Calendar.Grid aria-label={monthLabel}>\n * \t\t<Calendar.GridHeader>\n * \t\t\t<Calendar.Row>\n * \t\t\t\t{weekdayLabels.map((day) => (\n * \t\t\t\t\t<Calendar.HeaderCell key={day}>{day}</Calendar.HeaderCell>\n * \t\t\t\t))}\n * \t\t\t</Calendar.Row>\n * \t\t</Calendar.GridHeader>\n * \t\t<Calendar.GridBody>\n * \t\t\t{weeks.map((week) => (\n * \t\t\t\t<Calendar.Row key={week[0].iso}>\n * \t\t\t\t\t{week.map((day) => (\n * \t\t\t\t\t\t<Calendar.Cell\n * \t\t\t\t\t\t\tkey={day.iso}\n * \t\t\t\t\t\t\taria-selected={day.iso === selected ? \"true\" : undefined}\n * \t\t\t\t\t\t\tdata-outside-month={day.outsideMonth ? \"\" : undefined}\n * \t\t\t\t\t\t>\n * \t\t\t\t\t\t\t{day.label}\n * \t\t\t\t\t\t</Calendar.Cell>\n * \t\t\t\t\t))}\n * \t\t\t\t</Calendar.Row>\n * \t\t\t))}\n * \t\t</Calendar.GridBody>\n * \t</Calendar.Grid>\n * </Calendar>\n */\nexport function Calendar(handle: Handle<Calendar.Props>) {\n\treturn () => {\n\t\tlet {\n\t\t\tcolor,\n\t\t\tname,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tmin,\n\t\t\tmax,\n\t\t\tstep,\n\t\t\trequired,\n\t\t\tdisabled,\n\t\t\treadOnly,\n\t\t\tautoComplete,\n\t\t\t\"aria-label\": ariaLabel,\n\t\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t\tchildren,\n\t\t\tmix,\n\t\t\t...rest\n\t\t} = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\tif (import.meta.env?.DEV && !children && !ariaLabel && !ariaLabelledBy) {\n\t\t\tconsole.warn(\n\t\t\t\t'Calendar: falling back to a plain \"input type=date\" needs an \"aria-label\" or \"aria-labelledby\" describing what it collects for assistive technology.',\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"calendar\"\n\t\t\t\tmix={mergeMix([inlineBlock(), rounded(\"lg\"), p(3), bg(\"neutral.tint\")], mix)}\n\t\t\t>\n\t\t\t\t{children ?? (\n\t\t\t\t\t<Input\n\t\t\t\t\t\ttype=\"date\"\n\t\t\t\t\t\tcolor={resolvedColor}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tautoComplete={autoComplete}\n\t\t\t\t\t\taria-label={ariaLabel}\n\t\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Calendar}'s nav row: a flex row spacing\n * {@link Calendar.PreviousButton}, {@link Calendar.Heading}, and\n * {@link Calendar.NextButton} apart, the heading centered between the controls.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the nav row's markup.\n * @example\n * <Calendar.Header>\n * \t<Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n * \t<Calendar.Heading>{monthLabel}</Calendar.Heading>\n * \t<Calendar.NextButton aria-label={t(\"calendar.next\")} />\n * </Calendar.Header>\n */\nCalendar.Header = function CalendarHeader(handle: Handle<Calendar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={mergeMix([flex(), items(\"center\"), justify(\"between\"), mbe(4)], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a round icon control standing for \"show the previous month\", sized\n * to match {@link Calendar.NextButton}. Its default chevron flips under\n * `dir=\"rtl\"` through CSS. A `calendarKeys()` mixin drives the behavior.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <Calendar.PreviousButton aria-label={t(\"calendar.previous\")} />\n */\nCalendar.PreviousButton = function CalendarPreviousButton(\n\thandle: Handle<Calendar.PreviousButtonProps>,\n) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t'Calendar.PreviousButton: an icon-only control needs an \"aria-label\" describing what it does — assistive technology has no accessible text to announce otherwise.',\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_NAV_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"previous-button\"\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\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tis(8),\n\t\t\t\t\t\tbs(8),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\twhen(\"& svg\", [is(4), bs(4)]),\n\t\t\t\t\t\twhen(\"&:dir(rtl) svg\", scaleX(-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\t\t{children ?? <ChevronLeftIcon />}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a round icon control standing for \"show the following month\", with\n * the rendering, focus, and disabled-state contract of\n * {@link Calendar.PreviousButton} and a trailing chevron by default.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <Calendar.NextButton aria-label={t(\"calendar.next\")} />\n */\nCalendar.NextButton = function CalendarNextButton(handle: Handle<Calendar.NextButtonProps>) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t'Calendar.NextButton: an icon-only control needs an \"aria-label\" describing what it does — assistive technology has no accessible text to announce otherwise.',\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_NAV_BUTTON_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"next-button\"\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\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tis(8),\n\t\t\t\t\t\tbs(8),\n\t\t\t\t\t\thitArea(),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\t\twhen(\"& svg\", [is(4), bs(4)]),\n\t\t\t\t\t\twhen(\"&:dir(rtl) svg\", scaleX(-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\t\t{children ?? <ChevronRightIcon />}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders the consumer-formatted month/year caption through {@link Heading},\n * centered between the nav controls at a small semibold size layered after\n * {@link Heading}'s own defaults, so this size and alignment win over them.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the caption's markup.\n * @example\n * <Calendar.Heading>{new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\" }).format(visibleMonth)}</Calendar.Heading>\n */\nCalendar.Heading = function CalendarHeading(handle: Handle<Calendar.HeadingProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Heading\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"heading\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\tshrink(1),\n\t\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\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\n/**\n * Renders the day grid's native `<table>` host, rows and cells set apart by a\n * small gap on every side. Its `aria-label`/`aria-labelledby` — typically the\n * visible month label — names the whole grid; dev mode warns when it is absent.\n *\n * @param handle Runtime handle carrying the host `<table>`'s props.\n * @returns The render function producing the grid's markup.\n * @example\n * <Calendar.Grid aria-label={monthLabel}>\n * \t<Calendar.GridHeader>...</Calendar.GridHeader>\n * \t<Calendar.GridBody>...</Calendar.GridBody>\n * </Calendar.Grid>\n */\nCalendar.Grid = function CalendarGrid(handle: Handle<Calendar.GridProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleLabel(\n\t\t\thandle.props,\n\t\t\t'Calendar.Grid: needs an \"aria-label\" or \"aria-labelledby\" identifying which month it shows for assistive technology.',\n\t\t);\n\n\t\treturn (\n\t\t\t<table\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"grid\"\n\t\t\t\tmix={mergeMix([borderCollapse(\"separate\"), borderSpacing(\"0.25rem\")], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the grid's `<thead>` host: a plain wrapper for the weekday\n * {@link Calendar.Row}.\n *\n * @param handle Runtime handle carrying the host `<thead>`'s props.\n * @returns The render function producing the header section's markup.\n * @example\n * <Calendar.GridHeader>\n * \t<Calendar.Row>\n * \t\t<Calendar.HeaderCell>{t(\"calendar.weekdays.sun\")}</Calendar.HeaderCell>\n * \t</Calendar.Row>\n * </Calendar.GridHeader>\n */\nCalendar.GridHeader = function CalendarGridHeader(handle: Handle<Calendar.GridHeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <thead {...rest} data-slot=\"grid-header\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<tr>` host: one row of {@link Calendar.HeaderCell} inside\n * {@link Calendar.GridHeader}, or one week of {@link Calendar.Cell} inside\n * {@link Calendar.GridBody}.\n *\n * @param handle Runtime handle carrying the host `<tr>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Calendar.Row>\n * \t<Calendar.Cell>{day.label}</Calendar.Cell>\n * </Calendar.Row>\n */\nCalendar.Row = function CalendarRow(handle: Handle<Calendar.RowProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <tr {...rest} data-slot=\"row\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders a weekday abbreviation inside a native `<th scope=\"col\">`, sized\n * small and muted beneath {@link Calendar.Cell}'s own larger day numbers.\n *\n * @param handle Runtime handle carrying the host `<th>`'s props.\n * @returns The render function producing the weekday header's markup.\n * @example\n * <Calendar.HeaderCell>{t(\"calendar.weekdays.sun\")}</Calendar.HeaderCell>\n */\nCalendar.HeaderCell = function CalendarHeaderCell(handle: Handle<Calendar.HeaderCellProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<th\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header-cell\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[attrs({ scope: \"col\" }), pbe(2), weight(\"medium\"), fg(\"neutral.muted\"), text(\"xs\")],\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 grid's `<tbody>` host: a plain wrapper for one\n * {@link Calendar.Row} per week.\n *\n * @param handle Runtime handle carrying the host `<tbody>`'s props.\n * @returns The render function producing the body section's markup.\n * @example\n * <Calendar.GridBody>\n * \t{weeks.map((week) => (\n * \t\t<Calendar.Row key={week[0].iso}>...</Calendar.Row>\n * \t))}\n * </Calendar.GridBody>\n */\nCalendar.GridBody = function CalendarGridBody(handle: Handle<Calendar.GridBodyProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <tbody {...rest} data-slot=\"grid-body\" mix={[mix]} />;\n\t};\n};\n\n/**\n * Renders one calendar day inside a native `<td>`, a fixed round pill around\n * its number. `aria-selected`, `aria-disabled`, `data-unavailable`,\n * `data-outside-month`, and `aria-invalid` each drive their own visual state.\n *\n * @param handle Runtime handle carrying the host `<td>`'s props.\n * @returns The render function producing the day's markup.\n * @example\n * <Calendar.Cell aria-selected={day.iso === selected ? \"true\" : undefined}>\n * \t{day.label}\n * </Calendar.Cell>\n * @example\n * <Calendar.Cell data-outside-month=\"\">{day.label}</Calendar.Cell>\n */\nCalendar.Cell = function CalendarCell(handle: Handle<Calendar.CellProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<td\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"cell\"\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\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Table alignment centres the day while the cell stays a table cell in its row; a row\n\t\t\t\t\t\t * laid out as a flex box turns its cells into blocks, where `align-content` centres the\n\t\t\t\t\t\t * day. Each declaration answers one of the two cases.\n\t\t\t\t\t\t */\n\t\t\t\t\t\ttextAlign(\"center\"),\n\t\t\t\t\t\tverticalAlign(\"middle\"),\n\t\t\t\t\t\traw({ alignContent: \"center\" }),\n\t\t\t\t\t\tis(9),\n\t\t\t\t\t\tbs(9),\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\twhen('&[aria-selected=\"true\"]', [bg(\"brand.solid\"), fg(\"brand.onSolid\")]),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(30)]),\n\t\t\t\t\t\twhen(\"&[data-unavailable]\", [fg(\"neutral.muted\"), textDecoration(\"line-through\")]),\n\t\t\t\t\t\twhen(\"&[data-outside-month]\", fg(\"neutral.muted\")),\n\t\t\t\t\t\twhen('&[aria-invalid=\"true\"]', [bg(\"danger.solid\"), fg(\"danger.onSolid\")]),\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"
14
14
  },
15
15
  "test": null
16
16
  }