@sdxc/ui 2026.10.12 → 2026.10.14

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 (107) hide show
  1. package/README.md +524 -668
  2. package/dist/animations/transitions.d.ts +45 -20
  3. package/dist/animations/transitions.js +108 -35
  4. package/dist/behaviors/announcer.js +2 -1
  5. package/dist/behaviors/toaster.js +2 -1
  6. package/dist/components/accordion.js +5 -9
  7. package/dist/components/alert-dialog.js +3 -3
  8. package/dist/components/alert.js +11 -2
  9. package/dist/components/attachment.js +1 -1
  10. package/dist/components/badge.js +2 -1
  11. package/dist/components/breadcrumbs.js +17 -9
  12. package/dist/components/bubble.js +6 -5
  13. package/dist/components/button.d.ts +14 -0
  14. package/dist/components/button.js +61 -20
  15. package/dist/components/calendar.js +12 -8
  16. package/dist/components/card.d.ts +5 -3
  17. package/dist/components/card.js +32 -14
  18. package/dist/components/carousel.js +4 -6
  19. package/dist/components/chart.js +5 -4
  20. package/dist/components/checkbox.js +2 -2
  21. package/dist/components/color-picker.js +8 -11
  22. package/dist/components/color-slider.js +16 -5
  23. package/dist/components/color-swatch-picker.js +7 -4
  24. package/dist/components/color-wheel.js +7 -9
  25. package/dist/components/combobox.js +5 -1
  26. package/dist/components/command.d.ts +3 -3
  27. package/dist/components/command.js +25 -28
  28. package/dist/components/context-menu.js +4 -4
  29. package/dist/components/date-field.js +2 -1
  30. package/dist/components/date-picker.js +12 -16
  31. package/dist/components/description.js +2 -2
  32. package/dist/components/dialog.js +19 -15
  33. package/dist/components/disclosure.js +15 -17
  34. package/dist/components/drawer.d.ts +5 -5
  35. package/dist/components/drawer.js +38 -33
  36. package/dist/components/drop-indicator.js +4 -10
  37. package/dist/components/empty.js +13 -6
  38. package/dist/components/field-error.js +2 -1
  39. package/dist/components/file-trigger.js +7 -10
  40. package/dist/components/grid-list.js +15 -16
  41. package/dist/components/group.js +5 -6
  42. package/dist/components/heading.js +2 -1
  43. package/dist/components/hover-card.js +4 -5
  44. package/dist/components/image-placeholder.js +17 -12
  45. package/dist/components/index.d.ts +1 -0
  46. package/dist/components/index.js +1 -0
  47. package/dist/components/input.js +8 -11
  48. package/dist/components/item.js +4 -7
  49. package/dist/components/keyboard.js +9 -9
  50. package/dist/components/link-button.js +26 -8
  51. package/dist/components/listbox.d.ts +3 -2
  52. package/dist/components/listbox.js +9 -8
  53. package/dist/components/menu.js +6 -6
  54. package/dist/components/menubar.js +6 -5
  55. package/dist/components/message-scroller.js +4 -6
  56. package/dist/components/message.js +2 -2
  57. package/dist/components/meter.js +2 -2
  58. package/dist/components/modal.d.ts +2 -2
  59. package/dist/components/modal.js +12 -24
  60. package/dist/components/navigation-menu.js +5 -4
  61. package/dist/components/number-field.js +6 -6
  62. package/dist/components/overlay-arrow.js +2 -2
  63. package/dist/components/pagination.js +3 -1
  64. package/dist/components/popover.js +7 -19
  65. package/dist/components/progress-bar.js +2 -2
  66. package/dist/components/range-calendar.js +5 -3
  67. package/dist/components/resizable.js +8 -3
  68. package/dist/components/search-field.js +7 -7
  69. package/dist/components/select.js +26 -39
  70. package/dist/components/sheet.js +30 -22
  71. package/dist/components/shortcut-list.js +2 -2
  72. package/dist/components/sidebar.js +24 -22
  73. package/dist/components/slider.d.ts +3 -3
  74. package/dist/components/slider.js +18 -6
  75. package/dist/components/switch.js +2 -2
  76. package/dist/components/table.d.ts +15 -2
  77. package/dist/components/table.js +36 -14
  78. package/dist/components/tag-group.js +10 -5
  79. package/dist/components/text.js +2 -2
  80. package/dist/components/time-field.js +2 -1
  81. package/dist/components/toast.js +5 -2
  82. package/dist/components/toggle-button.js +28 -12
  83. package/dist/components/tree.js +9 -5
  84. package/dist/components/typeset.js +5 -2
  85. package/dist/components/youtube-embed.d.ts +35 -0
  86. package/dist/components/youtube-embed.js +29 -0
  87. package/dist/mixins/carousel-controls.js +11 -15
  88. package/dist/mixins/clear-field.js +4 -5
  89. package/dist/mixins/context-menu.js +5 -8
  90. package/dist/mixins/grid-list-keys.js +5 -2
  91. package/dist/mixins/listbox-keys.js +1 -1
  92. package/dist/mixins/message-follow.js +7 -13
  93. package/dist/mixins/treeKeys.js +5 -3
  94. package/dist/styles/floating-surface.d.ts +62 -14
  95. package/dist/styles/floating-surface.js +67 -10
  96. package/dist/styles/hit-area.d.ts +36 -0
  97. package/dist/styles/hit-area.js +48 -0
  98. package/dist/styles/index.d.ts +1 -0
  99. package/dist/styles/index.js +1 -0
  100. package/dist/styles/output-caption-text.d.ts +3 -2
  101. package/dist/styles/output-caption-text.js +4 -3
  102. package/dist/styles/range-thumb-appearance.js +17 -18
  103. package/dist/utils/glyph-edges.d.ts +24 -0
  104. package/dist/utils/glyph-edges.js +46 -0
  105. package/package.json +5 -4
  106. package/src/reset.css +4 -1
  107. package/src/theme.css +49 -2
@@ -15,6 +15,7 @@ import { scaleProperty, translateProperty, translateX } from "@sdxc/u/transform"
15
15
  import { fontSize, tabularNums, textAlign, textDecoration, textTransform, tracking, truncate, weight, } from "@sdxc/u/typography";
16
16
  import { attrs } from "remix/component";
17
17
  import { durations, easings } from "../animations/tokens.js";
18
+ import { hitArea } from "../styles/hit-area.js";
18
19
  import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
19
20
  import { Dialog } from "./dialog.js";
20
21
  import { ScrollArea } from "./scroll-area.js";
@@ -219,11 +220,10 @@ Sidebar.MobileNav = function SidebarMobileNav(handle) {
219
220
  let { side, mix, ...rest } = handle.props;
220
221
  let resolvedSide = side ?? DEFAULT_SIDE;
221
222
  return (_jsx(Dialog, { ...rest, "data-slot": "mobile-nav", "data-side": resolvedSide, mix: [
222
- /*
223
- * A press outside the drawer closes it, which is how a drawer is dismissed on a
224
- * phone: a modal dialog closes on Escape and nothing else, and a touch device has
225
- * no Escape to press — so the only way out would be a control the drawer does not
226
- * render. A consumer wanting the drawer held open passes its own `closedby`.
223
+ /**
224
+ * A press outside closes the drawer, the way a drawer is dismissed on a phone: a modal
225
+ * dialog otherwise closes only on Escape, which a touch device lacks. A consumer
226
+ * holding the drawer open passes its own `closedby`.
227
227
  */
228
228
  attrs({ closedby: "any" }),
229
229
  fixed(),
@@ -277,11 +277,10 @@ Sidebar.Header = function SidebarHeader(handle) {
277
277
  return () => {
278
278
  let { mix, ...rest } = handle.props;
279
279
  return (_jsx("header", { ...rest, "data-slot": "header", mix: [
280
- /*
281
- * The slot paints the rail's own background rather than letting it show
282
- * through, so a consumer that holds this row against the viewport keeps the
283
- * scrolling content behind it out of sight. Inheriting it means the row still
284
- * matches whichever surface hosts it — the docked rail or the drawer.
280
+ /**
281
+ * The slot paints the rail's background, so content scrolling behind a row held
282
+ * against the viewport stays hidden; inheriting it matches whichever surface hosts
283
+ * the row, the docked rail or the drawer.
285
284
  */
286
285
  bg("inherit"),
287
286
  flex(),
@@ -528,9 +527,9 @@ Sidebar.GroupLabel = function SidebarGroupLabel(handle) {
528
527
  };
529
528
  };
530
529
  /**
531
- * Renders a small icon-only action button anchored to
532
- * {@link Sidebar.GroupLabel}'s trailing edge. In dev mode, an action with no
533
- * plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.
530
+ * Renders a small icon-only action button anchored to {@link Sidebar.GroupLabel}'s
531
+ * trailing edge, its pointer target grown to `--ui-target-size`. In dev mode, an
532
+ * action with no plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.
534
533
  *
535
534
  * @param handle Runtime handle carrying the host `<button>`'s props.
536
535
  * @returns The render function producing the action's markup.
@@ -548,9 +547,11 @@ Sidebar.GroupAction = function SidebarGroupAction(handle) {
548
547
  warnIfNoAccessibleName(handle.props, children, "Sidebar.GroupAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.");
549
548
  return (_jsx("button", { type: "button", ...rest, "data-slot": "group-action", mix: [
550
549
  when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
550
+ relative(),
551
551
  inlineFlex(),
552
552
  is("1.25rem"),
553
553
  bs("1.25rem"),
554
+ hitArea(),
554
555
  items("center"),
555
556
  justify("center"),
556
557
  when("&:disabled", [cursor("not-allowed"), opacity(50)]),
@@ -619,11 +620,10 @@ Sidebar.MenuItem = function SidebarMenuItem(handle) {
619
620
  return (_jsx("li", { ...rest, "data-slot": "menu-item", mix: [
620
621
  relative(),
621
622
  flex(),
622
- /*
623
- * A row on its own centres what it holds; a row that carries a sub-menu
624
- * stacks, so the nested list sits under it at full width. The two are
625
- * written under selectors that never match at once, so the layout holds
626
- * whichever order the cascade puts the pair in.
623
+ /**
624
+ * A plain row centres what it holds and a row carrying a sub-menu stacks, putting the
625
+ * nested list under it at full width. The selectors never match at once, so the layout
626
+ * holds whichever order the cascade puts the pair in.
627
627
  */
628
628
  when('&:not(:has([data-slot="menu-sub"]))', items("center")),
629
629
  when('&:has([data-slot="menu-sub"])', [flexCol(), items("stretch")]),
@@ -743,8 +743,8 @@ function menuRowMixins() {
743
743
  ];
744
744
  }
745
745
  /**
746
- * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s
747
- * trailing edge, revealed by `showOnHover` on hover or focus within the row.
746
+ * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s trailing
747
+ * edge, revealed by `showOnHover`, with its pointer target grown to `--ui-target-size`.
748
748
  * In dev mode, an action with no accessible name logs a `console.warn`.
749
749
  *
750
750
  * @param handle Runtime handle carrying the host `<button>`'s props.
@@ -772,6 +772,7 @@ Sidebar.MenuAction = function SidebarMenuAction(handle) {
772
772
  inlineFlex(),
773
773
  is("1.5rem"),
774
774
  bs("1.5rem"),
775
+ hitArea(),
775
776
  items("center"),
776
777
  justify("center"),
777
778
  opacity(0),
@@ -1009,8 +1010,8 @@ Sidebar.Rail = function SidebarRail(handle) {
1009
1010
  };
1010
1011
  };
1011
1012
  /**
1012
- * Renders the collapse toggle: a native, keyboard-reachable
1013
- * `<input type="checkbox">` wrapped in a button-styled `<label>`; its
1013
+ * Renders the collapse toggle: a native, keyboard-reachable `<input type="checkbox">`
1014
+ * in a button-styled `<label>` whose pointer target grows to `--ui-target-size`; its
1014
1015
  * `:checked` state drives every collapse rule in {@link Sidebar.Provider}.
1015
1016
  *
1016
1017
  * @param handle Runtime handle carrying the host checkbox's props.
@@ -1029,6 +1030,7 @@ Sidebar.Trigger = function SidebarTrigger(handle) {
1029
1030
  inlineFlex(),
1030
1031
  is("2rem"),
1031
1032
  bs("2rem"),
1033
+ hitArea(),
1032
1034
  items("center"),
1033
1035
  justify("center"),
1034
1036
  cursor("pointer"),
@@ -74,9 +74,9 @@ export declare namespace Slider {
74
74
  }
75
75
  }
76
76
  /**
77
- * Renders the root host: a `<div>` stacking its children, growing to fill
78
- * the inline axis by default or a fixed block axis when vertical. Resolves
79
- * the range, value, orientation, and thumb id into context for nested parts.
77
+ * Renders the root `<div>`, stacking its children and resolving range, value, orientation
78
+ * and thumb id into context. Nested parts scope orientation rules to its `data-slot`, so an
79
+ * ancestor carrying `data-orientation` (a toolbar, a scroll viewport) leaves its layout alone.
80
80
  *
81
81
  * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link Slider.Context}.
82
82
  * @returns The render function producing the root's markup.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "remix/component/jsx-runtime";
2
- import { absolute, after, appearance, basis, before, bg, border, bs, cursor, grow, insBe, insBs, insIe, insIs, inset, is, items, m, minBs, minIs, outlineStyle, overflow, pseudoContent, raw, relative, rounded, shrink, translateX, translateY, vstack, when, z, } from "@sdxc/u";
2
+ import { absolute, after, appearance, basis, before, bg, border, bs, cursor, grow, insBe, insBs, insIe, insIs, inset, is, items, m, minBs, minIs, outlineStyle, pseudoContent, raw, relative, rounded, shrink, tabularNums, translateX, translateY, vstack, when, z, } from "@sdxc/u";
3
3
  import { outputCaptionText } from "../styles/output-caption-text.js";
4
4
  import { rangeThumbAppearance } from "../styles/range-thumb-appearance.js";
5
5
  import { mergeStyle } from "../utils/merge-style.js";
@@ -13,9 +13,15 @@ const DEFAULT_MAX = 100;
13
13
  /** Default {@link Slider.ThumbProps} step, applied when `step` is omitted. */
14
14
  const DEFAULT_STEP = 1;
15
15
  /**
16
- * Renders the root host: a `<div>` stacking its children, growing to fill
17
- * the inline axis by default or a fixed block axis when vertical. Resolves
18
- * the range, value, orientation, and thumb id into context for nested parts.
16
+ * Negative inset growing {@link Slider.Thumb}'s native input across the track's thin
17
+ * axis to the larger of the thumb and `--ui-target-size`, clamped at zero so a track
18
+ * already that thick keeps its own box.
19
+ */
20
+ const THUMB_HIT_INSET = "min(0px, calc((100% - max(var(--ui-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem))) / 2))";
21
+ /**
22
+ * Renders the root `<div>`, stacking its children and resolving range, value, orientation
23
+ * and thumb id into context. Nested parts scope orientation rules to its `data-slot`, so an
24
+ * ancestor carrying `data-orientation` (a toolbar, a scroll viewport) leaves its layout alone.
19
25
  *
20
26
  * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link Slider.Context}.
21
27
  * @returns The render function producing the root's markup.
@@ -82,7 +88,6 @@ Slider.Track = function SliderTrack(handle) {
82
88
  when('[data-slot="slider"][data-orientation="vertical"] &', [
83
89
  is("var(--ui-slider-thumb-size, 1.25rem)"),
84
90
  minBs("0"),
85
- overflow("hidden"),
86
91
  ]),
87
92
  before([absolute(), rounded("full"), bg("neutral.border"), pseudoContent('""')]),
88
93
  after([absolute(), rounded("full"), bg("brand.solid"), pseudoContent('""')]),
@@ -145,6 +150,13 @@ Slider.Thumb = function SliderThumb(handle) {
145
150
  rangeThumbAppearance("--ui-slider-thumb-size", "--ui-slider-thumb-border-width"),
146
151
  absolute(),
147
152
  inset("0"),
153
+ /**
154
+ * The native input reaches past the track across its thin axis to a full pointer
155
+ * target, centred so the thumb stays on the visible rail. Its block axis is that
156
+ * thin axis in both orientations, since a vertical input runs `vertical-lr`.
157
+ */
158
+ insBs(THUMB_HIT_INSET),
159
+ insBe(THUMB_HIT_INSET),
148
160
  z(10),
149
161
  m("0"),
150
162
  appearance(),
@@ -178,6 +190,6 @@ Slider.Output = function SliderOutput(handle) {
178
190
  return () => {
179
191
  let { htmlFor, mix, ...rest } = handle.props;
180
192
  let context = handle.context.get(Slider);
181
- return (_jsx("output", { ...rest, htmlFor: htmlFor ?? context.thumbId, mix: [outputCaptionText(), mix] }));
193
+ return (_jsx("output", { ...rest, htmlFor: htmlFor ?? context.thumbId, mix: [outputCaptionText(), tabularNums(), mix] }));
182
194
  };
183
195
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
- import { absolute, appearance, before, bg, bs, cursor, focusVisible, hstack, inlineBlock, insBs, insIs, is, m, media, opacity, outline, pseudoContent, raw, relative, rounded, scaleProperty, shadow, shrink, transition, transitionDuration, when, } from "@sdxc/u";
2
+ import { absolute, appearance, before, bg, bs, cursor, focusVisible, hstack, inlineBlock, insBs, insIs, is, m, media, opacity, outline, pseudoContent, verticalAlign, relative, rounded, scaleProperty, shadow, shrink, transition, transitionDuration, when, } from "@sdxc/u";
3
3
  import { attrs } from "remix/component";
4
4
  import { durations, easings } from "../animations/tokens.js";
5
5
  /**
@@ -59,7 +59,7 @@ export function Switch(handle) {
59
59
  shrink(0),
60
60
  transition("background-color", { duration: durations.fast, easing: easings.standard }),
61
61
  when("&:disabled", cursor("not-allowed")),
62
- raw({ verticalAlign: "middle" }),
62
+ verticalAlign("middle"),
63
63
  before([
64
64
  pseudoContent('""'),
65
65
  insBs("var(--ui-switch-thumb-inset, 0.125rem)"),
@@ -59,8 +59,16 @@ export declare namespace Table {
59
59
  * shadows the deprecated native `align` with the logical values above.
60
60
  */
61
61
  interface ColumnProps extends Omit<TagProps<"th">, "align"> {
62
- /** Text alignment for the header and its indicator. Defaults to {@link DEFAULT_ALIGN}. */
62
+ /**
63
+ * Text alignment for the header and its indicator. Defaults to {@link DEFAULT_ALIGN},
64
+ * or {@link DEFAULT_NUMERIC_ALIGN} for a `numeric` column.
65
+ */
63
66
  align?: Align;
67
+ /**
68
+ * Marks the column as holding numbers, exposed as `data-numeric`: the header aligns
69
+ * to the end unless `align` says otherwise, matching `numeric` cells beneath it.
70
+ */
71
+ numeric?: boolean;
64
72
  /** Target URL that re-requests the table sorted by this column. Omit for an unsortable column. */
65
73
  href?: string;
66
74
  /** This column's current sort direction, when it's the active sort key. */
@@ -76,9 +84,14 @@ export declare namespace Table {
76
84
  interface RowProps extends TagProps<"tr"> {
77
85
  }
78
86
  /**
79
- * Every native `<td>` attribute, unchanged, plus the `mix` passthrough.
87
+ * Every native `<td>` attribute plus the `mix` passthrough and `numeric`.
80
88
  */
81
89
  interface CellProps extends TagProps<"td"> {
90
+ /**
91
+ * Marks the cell as a number, exposed as `data-numeric`: its figures render at
92
+ * tabular widths and align to the end, so digits line up down the column.
93
+ */
94
+ numeric?: boolean;
82
95
  }
83
96
  /**
84
97
  * Per-part styling for the elements {@link Table.LoadMore} renders besides
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
2
  import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "@sdxc/icons";
3
- import { bg, borderEdge, center, container, cursor, fg, fontSize, gap, hover, inlineFlex, is, items, opacity, outline, overflow, p, pb, pi, raw, relative, shrink, textAlign, textDecoration, userSelect, virtualize, weight, when, } from "@sdxc/u";
3
+ import { bg, borderEdge, center, container, cursor, fg, flex, fontSize, gap, hover, is, items, justify, opacity, outline, overflow, p, pb, pi, raw, relative, shrink, tabularNums, textAlign, textDecoration, userSelect, virtualize, weight, when, } from "@sdxc/u";
4
4
  import { attrs } from "remix/component";
5
5
  import { interactiveTransition } from "../styles/interactive-transition.js";
6
6
  import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
@@ -12,6 +12,16 @@ import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js"
12
12
  const CONTAINER_NAME = "ui-table";
13
13
  /** Text alignment {@link Table.Column} falls back to when `align` is omitted. */
14
14
  const DEFAULT_ALIGN = "start";
15
+ /**
16
+ * Text alignment a `numeric` {@link Table.Column} falls back to when `align` is
17
+ * omitted, lining its header up with the end-aligned figures beneath it.
18
+ */
19
+ const DEFAULT_NUMERIC_ALIGN = "end";
20
+ /**
21
+ * Flex alignment a sortable header's link takes for each column alignment, so the
22
+ * link fills the whole cell and still places its label where `align` puts it.
23
+ */
24
+ const JUSTIFY_BY_ALIGN = { start: "start", center: "center", end: "end" };
15
25
  /**
16
26
  * Renders the table's `<table>` host: a full-width, border-collapsed grid
17
27
  * with a small base font size, ready to hold {@link Table.Header} and
@@ -104,27 +114,28 @@ Table.Body = function TableBody(handle) {
104
114
  };
105
115
  };
106
116
  /**
107
- * Renders a column header inside a native `<th scope="col">`, aligned by
108
- * the `data-align` attribute. Setting `href` turns the label into a sort
109
- * link exposing `aria-sort` and a direction indicator for the active key.
117
+ * Renders a column header inside a native `<th scope="col">`, aligned by `data-align`.
118
+ * Setting `href` makes the header a cell-filling sort link with `aria-sort` and a direction
119
+ * indicator held square, so a header narrow enough to squeeze the link keeps both arrows legible.
110
120
  *
111
121
  * @param handle Runtime handle carrying the host `<th>`'s props.
112
122
  * @returns The render function producing the column header's markup.
113
123
  * @example
114
124
  * <Table.Column>{t("subjects.email")}</Table.Column>
115
125
  * @example
126
+ * <Table.Column numeric>{t("invoices.amount")}</Table.Column>
127
+ * @example
116
128
  * <Table.Column href={sortUrl("name", nextDirection)} sortDirection={activeSort === "name" ? currentDirection : undefined}>
117
129
  * {t("subjects.name")}
118
130
  * </Table.Column>
119
131
  */
120
132
  Table.Column = function TableColumn(handle) {
121
133
  return () => {
122
- let { align, href, sortDirection, parts, children, mix, ...rest } = handle.props;
123
- let resolvedAlign = align ?? DEFAULT_ALIGN;
124
- return (_jsx("th", { ...rest, "data-align": resolvedAlign, "aria-sort": href ? (sortDirection ?? "none") : undefined, "data-slot": "column", mix: [
134
+ let { align, numeric, href, sortDirection, parts, children, mix, ...rest } = handle.props;
135
+ let resolvedAlign = align ?? (numeric ? DEFAULT_NUMERIC_ALIGN : DEFAULT_ALIGN);
136
+ return (_jsx("th", { ...rest, "data-align": resolvedAlign, "data-numeric": numeric ? "" : undefined, "aria-sort": href ? (sortDirection ?? "none") : undefined, "data-slot": "column", mix: [
125
137
  attrs({ scope: "col" }),
126
- pi("1rem"),
127
- pb("0.75rem"),
138
+ href ? undefined : [pi("1rem"), pb("0.75rem")],
128
139
  textAlign("start"),
129
140
  weight(500),
130
141
  fg("neutral"),
@@ -134,8 +145,11 @@ Table.Column = function TableColumn(handle) {
134
145
  when("&[aria-sort]", [cursor("pointer"), userSelect()]),
135
146
  mix,
136
147
  ], children: href ? (_jsxs("a", { href: href, mix: [
137
- when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
138
- inlineFlex(),
148
+ when("&:focus-visible", outline({ color: "brand.ring", offset: -2 })),
149
+ flex(),
150
+ justify(JUSTIFY_BY_ALIGN[resolvedAlign]),
151
+ pi("1rem"),
152
+ pb("0.75rem"),
139
153
  items("center"),
140
154
  gap("0.25rem"),
141
155
  fg("inherit"),
@@ -174,17 +188,25 @@ Table.Row = function TableRow(handle) {
174
188
  };
175
189
  /**
176
190
  * Renders a native `<td>` host, padded on every side and colored as the
177
- * table's emphasized foreground text.
191
+ * table's emphasized foreground text; a `numeric` cell end-aligns tabular figures.
178
192
  *
179
193
  * @param handle Runtime handle carrying the host `<td>`'s props.
180
194
  * @returns The render function producing the cell's markup.
181
195
  * @example
182
196
  * <Table.Cell>{subject.name}</Table.Cell>
197
+ * @example
198
+ * <Table.Cell numeric>{formatCurrency(invoice.amount)}</Table.Cell>
183
199
  */
184
200
  Table.Cell = function TableCell(handle) {
185
201
  return () => {
186
- let { mix, ...rest } = handle.props;
187
- return (_jsx("td", { ...rest, "data-slot": "cell", mix: [pi("1rem"), pb("0.75rem"), fg("neutral.emphasis"), mix] }));
202
+ let { numeric, mix, ...rest } = handle.props;
203
+ return (_jsx("td", { ...rest, "data-numeric": numeric ? "" : undefined, "data-slot": "cell", mix: [
204
+ pi("1rem"),
205
+ pb("0.75rem"),
206
+ fg("neutral.emphasis"),
207
+ when("&[data-numeric]", [tabularNums(), textAlign("end")]),
208
+ mix,
209
+ ] }));
188
210
  };
189
211
  };
190
212
  /**
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "remix/component/jsx-runtime";
2
2
  import { XIcon } from "@sdxc/icons";
3
3
  import { bg, fg, outline, outlineColor } from "@sdxc/u/color";
4
4
  import { opacity, rounded } from "@sdxc/u/effects";
5
- import { cursor, listStyle } from "@sdxc/u/general";
5
+ import { cursor, listStyle, vars } from "@sdxc/u/general";
6
6
  import { flex, flexWrap, gap, inlineFlex, items, vstack } from "@sdxc/u/layout";
7
7
  import { bs, is, m, mie, p, pb, pi } from "@sdxc/u/size";
8
8
  import { active, data, hover, when } from "@sdxc/u/state";
@@ -17,6 +17,8 @@ const DEFAULT_ROLE = "group";
17
17
  const DEFAULT_COLOR = "neutral";
18
18
  /** Size variant {@link TagGroup.Tag} falls back to when `size` is omitted. */
19
19
  const DEFAULT_SIZE = "md";
20
+ /** Visible edge of {@link TagGroup.Remove}'s round glyph, small enough to sit inside a pill's line. */
21
+ const REMOVE_SIZE = "var(--ui-tag-remove-size, 1rem)";
20
22
  /**
21
23
  * Renders the group's `<div>` host, laying its {@link TagGroup.List} child
22
24
  * (and any preceding `Label`) out in a column with a small gap. Dev mode
@@ -130,11 +132,14 @@ TagGroup.Remove = function TagGroupRemove(handle) {
130
132
  return () => {
131
133
  let { mix, ...rest } = handle.props;
132
134
  return (_jsx(Button, { ...rest, type: "submit", variant: "ghost", "data-slot": "remove", mix: [
135
+ /**
136
+ * The control shrinks through Button's own icon-only measure, so it sits inside
137
+ * the pill's line instead of stretching the tag to a full button row, while
138
+ * Button's own hit area keeps its pointer target at `--ui-target-size`.
139
+ */
140
+ vars({ "ui-button-icon-size-md": REMOVE_SIZE }),
133
141
  mie(-1),
134
- pb(0.5),
135
- pi(0.5),
136
- rounded("full"),
137
- when("& svg", [is(3), bs(3)]),
142
+ when('&[data-slot="remove"] > svg', [is(3), bs(3)]),
138
143
  fg("currentColor"),
139
144
  hover(bg("brand.bg-tint-hover")),
140
145
  when('[data-color="neutral"] &:hover', bg("neutral.bg-tint-hover")),
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "remix/component/jsx-runtime";
2
2
  import { fg } from "@sdxc/u/color";
3
- import { text } from "@sdxc/u/typography";
3
+ import { pretty, text } from "@sdxc/u/typography";
4
4
  /**
5
5
  * Renders its children inside a `<span>` sized and colored as a small run of
6
6
  * body copy: the library's default text size paired with the neutral muted
@@ -14,6 +14,6 @@ import { text } from "@sdxc/u/typography";
14
14
  export function Text(handle) {
15
15
  return () => {
16
16
  let { mix, ...rest } = handle.props;
17
- return _jsx("span", { ...rest, mix: [fg("neutral"), text("sm"), mix] });
17
+ return _jsx("span", { ...rest, mix: [fg("neutral"), text("sm"), pretty(), mix] });
18
18
  };
19
19
  }
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { tabularNums } from "@sdxc/u/typography";
2
3
  import { fieldStackLayout } from "../styles/field-stack-layout.js";
3
4
  import { resolveFieldWiring } from "../utils/resolve-field-wiring.js";
4
5
  import { Description } from "./description.js";
@@ -43,6 +44,6 @@ export function TimeField(handle) {
43
44
  });
44
45
  return (_jsxs("div", { ...rest, "data-slot": "time-field", mix: [fieldStackLayout(), mix], children: [_jsx(Label, { htmlFor: handle.id, mix: parts?.label, children: label }), _jsx(Input, { id: handle.id, type: "time", name: name, value: value, defaultValue: defaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete,
45
46
  // oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.
46
- autoFocus: resolvedAutoFocus, "aria-invalid": resolvedInvalid, "aria-describedby": describedBy, color: resolvedColor, mix: parts?.input }), description ? (_jsx(Description, { id: descriptionId, mix: parts?.description, children: description })) : null, errorMessage ? (_jsx(FieldError, { id: errorId, mix: parts?.error, children: errorMessage })) : null] }));
47
+ autoFocus: resolvedAutoFocus, "aria-invalid": resolvedInvalid, "aria-describedby": describedBy, color: resolvedColor, mix: [tabularNums(), parts?.input] }), description ? (_jsx(Description, { id: descriptionId, mix: parts?.description, children: description })) : null, errorMessage ? (_jsx(FieldError, { id: errorId, mix: parts?.error, children: errorMessage })) : null] }));
47
48
  };
48
49
  }
@@ -8,9 +8,10 @@ import { media, supports } from "@sdxc/u/responsive";
8
8
  import { is, bs, maxIs, minIs, pb, pi, pie } from "@sdxc/u/size";
9
9
  import { active, data, hover, when } from "@sdxc/u/state";
10
10
  import { translateX } from "@sdxc/u/transform";
11
- import { fontSize, leading, weight } from "@sdxc/u/typography";
11
+ import { balance, fontSize, leading, pretty, weight } from "@sdxc/u/typography";
12
12
  import { attrs } from "remix/component";
13
13
  import { graphicHostStyle } from "../styles/graphic-host.js";
14
+ import { hitArea } from "../styles/hit-area.js";
14
15
  import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
15
16
  /**
16
17
  * `role` applied to {@link Toast} through {@link attrs} unless a consumer
@@ -193,7 +194,7 @@ Toast.Content = function ToastContent(handle) {
193
194
  Toast.Title = function ToastTitle(handle) {
194
195
  return () => {
195
196
  let { children, mix, ...rest } = handle.props;
196
- return (_jsx("h3", { ...rest, "data-slot": "title", mix: [weight(500), leading(1), fontSize("sm"), mix], children: children }));
197
+ return (_jsx("h3", { ...rest, "data-slot": "title", mix: [weight(500), leading(1), fontSize("sm"), balance(), mix], children: children }));
197
198
  };
198
199
  };
199
200
  /**
@@ -209,6 +210,7 @@ Toast.Description = function ToastDescription(handle) {
209
210
  let { children, mix, ...rest } = handle.props;
210
211
  return (_jsx("p", { ...rest, "data-slot": "description", mix: [
211
212
  fontSize("sm"),
213
+ pretty(),
212
214
  fg(colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent")),
213
215
  mix,
214
216
  ], children: children }));
@@ -307,6 +309,7 @@ Toast.Close = function ToastClose(handle) {
307
309
  transition("color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter"),
308
310
  insBs("0.5rem"),
309
311
  insIe("0.5rem"),
312
+ hitArea(),
310
313
  mix,
311
314
  ], children: _jsx(XIcon, { size: 16 }) }));
312
315
  };
@@ -3,11 +3,13 @@ import { bg, border, fg, outline } from "@sdxc/u/color";
3
3
  import { rounded, opacity } from "@sdxc/u/effects";
4
4
  import { cursor, userSelect } from "@sdxc/u/general";
5
5
  import { flex, flexCol, inlineFlex, items, justify, gap, shrink } from "@sdxc/u/layout";
6
- import { bs, is, minBs, pi, pb } from "@sdxc/u/size";
6
+ import { bs, is, minBs, pi, pb, pie, pis } from "@sdxc/u/size";
7
7
  import { when, hover, active, data } from "@sdxc/u/state";
8
8
  import { text, weight } from "@sdxc/u/typography";
9
9
  import { attrs } from "remix/component";
10
+ import { hitArea } from "../styles/hit-area.js";
10
11
  import { interactiveTransition } from "../styles/interactive-transition.js";
12
+ import { glyphEdges } from "../utils/glyph-edges.js";
11
13
  import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
12
14
  /** Semantic color role {@link ToggleButton} falls back to when `color` is omitted. */
13
15
  const DEFAULT_COLOR = "neutral";
@@ -61,8 +63,9 @@ export function ToggleButton(handle) {
61
63
  let resolvedVariant = variant ?? DEFAULT_VARIANT;
62
64
  let resolvedSize = size ?? DEFAULT_SIZE;
63
65
  let resolvedPressed = resolveAriaPressed(pressed);
66
+ let edges = glyphEdges(children);
64
67
  warnIfNoAccessibleName(handle.props, children, "ToggleButton: an icon-only toggle needs an `aria-label` describing what it does — assistive technology has no accessible name to announce otherwise.");
65
- return (_jsx("button", { ...rest, "aria-pressed": resolvedPressed, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, mix: [
68
+ return (_jsx("button", { ...rest, "aria-pressed": resolvedPressed, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-glyph-start": edges.start || undefined, "data-glyph-end": edges.end || undefined, mix: [
66
69
  when("&:focus-visible", [
67
70
  outline({ color: "brand.ring", offset: 2 }),
68
71
  when('&[data-color="neutral"]', outline("neutral.ring")),
@@ -75,24 +78,23 @@ export function ToggleButton(handle) {
75
78
  items("center"),
76
79
  justify("center"),
77
80
  gap("0.5rem"),
78
- /*
79
- * A glyph is measured against the label it sits beside rather than against
80
- * whatever an icon set draws at, so the row keeps the height its text and
81
- * padding ask for, and it never shrinks: squeeze the row and the default
82
- * `flex-shrink: 1` compresses the glyph rather than the words, and a squashed
83
- * icon reads as a rendering fault.
81
+ /**
82
+ * A glyph is sized against the label beside it and holds that size, so the row keeps the
83
+ * height its text and padding ask for; the default `flex-shrink: 1` would squash the glyph
84
+ * ahead of the words.
84
85
  */
85
86
  when("& > svg", [shrink(), is(4), bs(4)]),
86
87
  rounded("md"),
87
88
  weight(500),
88
89
  cursor("default"),
90
+ /** A small control reaches `--ui-target-size` however a consumer positions it. */
91
+ hitArea({ anchor: "flex-center" }),
89
92
  userSelect(),
90
93
  pi("1rem"),
91
94
  pb("0.5rem"),
92
- /*
93
- * The row measure is stated rather than left to fall out of the padding and
94
- * the border, so the control lines up with a field of the same size when a
95
- * Group fuses the two, and still grows when a long label wraps.
95
+ /**
96
+ * The row measure is stated, so the control lines up with a field of the same size when
97
+ * a Group fuses the two, and still grows when a long label wraps.
96
98
  */
97
99
  minBs("2.5rem"),
98
100
  when('&[data-size="sm"]', [
@@ -107,6 +109,20 @@ export function ToggleButton(handle) {
107
109
  minBs("3rem"),
108
110
  when("& > svg", [is(5), bs(5)]),
109
111
  ]),
112
+ /**
113
+ * A glyph beside a label carries its own side bearing, so the padding on that
114
+ * side drops one step and the glyph and the words read as evenly inset.
115
+ */
116
+ when("&[data-glyph-start]:has(> svg:first-child)", [
117
+ pis("0.75rem"),
118
+ when('&[data-size="sm"]', pis("0.5rem")),
119
+ when('&[data-size="lg"]', pis("1rem")),
120
+ ]),
121
+ when("&[data-glyph-end]:has(> svg:last-child)", [
122
+ pie("0.75rem"),
123
+ when('&[data-size="sm"]', pie("0.5rem")),
124
+ when('&[data-size="lg"]', pie("1rem")),
125
+ ]),
110
126
  text("sm"),
111
127
  data("size", "sm", text("xs")),
112
128
  data("size", "lg", text("base")),
@@ -144,9 +144,11 @@ function TreeItem(handle) {
144
144
  }),
145
145
  transitionDuration("200ms"),
146
146
  ]),
147
- // Collapsed and expanded sizes are written under selectors that never
148
- // match at once, so the reveal holds whichever order the cascade puts
149
- // the pair in.
147
+ /**
148
+ * Collapsed and expanded sizes are written under selectors that never
149
+ * match at once, so the reveal holds whichever order the cascade puts
150
+ * the pair in.
151
+ */
150
152
  when("&:not([open])::details-content", bs(0)),
151
153
  when("&[open]::details-content", bs("auto")),
152
154
  when(`&[open] > summary [data-slot="${DEFAULT_EXPAND_BUTTON_SLOT}"]`, rotate(90)),
@@ -187,8 +189,10 @@ Tree.ItemContent = function TreeItemContent(handle) {
187
189
  fg("neutral.emphasis"),
188
190
  cursor("default"),
189
191
  listStyle(),
190
- // The two indents are written under selectors that never match at once, so
191
- // a row keeps its own whichever order the cascade puts the pair in.
192
+ /**
193
+ * The two indents are written under selectors that never match at once, so
194
+ * a row keeps its own whichever order the cascade puts the pair in.
195
+ */
192
196
  when(`&:has([data-slot="${DEFAULT_EXPAND_BUTTON_SLOT}"])`, raw({
193
197
  paddingInlineStart: `calc(0.5rem + ${depth} * var(--ui-tree-indent, 1.25rem))`,
194
198
  })),
@@ -8,7 +8,7 @@ import { overflow } from "@sdxc/u/overflow";
8
8
  import { at } from "@sdxc/u/responsive";
9
9
  import { is, maxIs, pb, pi, pis } from "@sdxc/u/size";
10
10
  import { when } from "@sdxc/u/state";
11
- import { leading, textAlign, textDecoration, tracking, weight } from "@sdxc/u/typography";
11
+ import { balance, leading, pretty, tabularNums, textAlign, textDecoration, tracking, weight, } from "@sdxc/u/typography";
12
12
  import { css } from "remix/component";
13
13
  import { easings } from "../animations/tokens.js";
14
14
  /**
@@ -219,8 +219,10 @@ export function Typeset(handle) {
219
219
  leading(1.25),
220
220
  tracking("tight"),
221
221
  fg("neutral.emphasis"),
222
+ balance(),
222
223
  ]),
223
224
  when("& :where(h6)", fg("neutral")),
225
+ when("& :where(p, li, blockquote, dd)", pretty()),
224
226
  when("& :where(ul, ol)", pis("1.5em")),
225
227
  when("& :where(li)::marker", fg("neutral.muted")),
226
228
  when("& :where(blockquote)", [
@@ -251,7 +253,7 @@ export function Typeset(handle) {
251
253
  pb("0.875em"),
252
254
  overflow("auto"),
253
255
  ]),
254
- /*
256
+ /**
255
257
  * A fenced block's `code` is an inline box, so the chip padding above would
256
258
  * apply at the start of the box alone and indent the block's first line
257
259
  * past every line under it. The block's own padding is the `pre`'s.
@@ -272,6 +274,7 @@ export function Typeset(handle) {
272
274
  when("& :where(th, td):not([align])", textAlign("start")),
273
275
  when("& :where(th)", [weight("semibold"), fg("neutral.emphasis")]),
274
276
  when("& :where(th, td)", [
277
+ tabularNums(),
275
278
  pi("0.75em"),
276
279
  pb("0.5em"),
277
280
  borderEdge("block-end", { color: "neutral", width: "1px" }),