@sdxc/ui 2026.9.14 → 2026.9.28

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 (82) hide show
  1. package/dist/animations/keyframes.d.ts +6 -0
  2. package/dist/animations/keyframes.js +8 -4
  3. package/dist/components/accordion.js +5 -1
  4. package/dist/components/alert-dialog.js +2 -2
  5. package/dist/components/attachment.js +7 -2
  6. package/dist/components/bubble.js +14 -20
  7. package/dist/components/button.d.ts +0 -14
  8. package/dist/components/button.js +60 -19
  9. package/dist/components/calendar.js +12 -5
  10. package/dist/components/card.js +8 -1
  11. package/dist/components/carousel.js +9 -3
  12. package/dist/components/color-picker.js +23 -4
  13. package/dist/components/color-slider.js +11 -1
  14. package/dist/components/color-wheel.js +14 -4
  15. package/dist/components/command.js +34 -7
  16. package/dist/components/date-picker.d.ts +20 -53
  17. package/dist/components/date-picker.js +50 -108
  18. package/dist/components/date-range-picker.d.ts +22 -43
  19. package/dist/components/date-range-picker.js +8 -52
  20. package/dist/components/dialog.js +15 -3
  21. package/dist/components/disclosure.d.ts +4 -1
  22. package/dist/components/disclosure.js +52 -11
  23. package/dist/components/drawer.js +16 -0
  24. package/dist/components/drop-indicator.d.ts +9 -8
  25. package/dist/components/drop-indicator.js +19 -6
  26. package/dist/components/empty.js +18 -3
  27. package/dist/components/file-trigger.js +35 -15
  28. package/dist/components/form.d.ts +15 -1
  29. package/dist/components/form.js +16 -6
  30. package/dist/components/grid-list.js +23 -7
  31. package/dist/components/group.d.ts +6 -6
  32. package/dist/components/group.js +28 -6
  33. package/dist/components/hover-card.js +38 -2
  34. package/dist/components/image-placeholder.js +8 -2
  35. package/dist/components/input.js +22 -21
  36. package/dist/components/item.js +9 -1
  37. package/dist/components/keyboard.d.ts +7 -7
  38. package/dist/components/keyboard.js +33 -7
  39. package/dist/components/link-button.js +32 -18
  40. package/dist/components/listbox.js +10 -1
  41. package/dist/components/menu.js +8 -2
  42. package/dist/components/message-scroller.js +19 -6
  43. package/dist/components/meter.js +17 -8
  44. package/dist/components/number-field.js +9 -3
  45. package/dist/components/overlay-arrow.js +16 -2
  46. package/dist/components/popover.js +31 -8
  47. package/dist/components/range-calendar.js +18 -4
  48. package/dist/components/search-field.d.ts +26 -1
  49. package/dist/components/search-field.js +84 -4
  50. package/dist/components/select.d.ts +7 -1
  51. package/dist/components/select.js +33 -29
  52. package/dist/components/sidebar.js +32 -11
  53. package/dist/components/slider.js +10 -6
  54. package/dist/components/table.js +2 -2
  55. package/dist/components/toggle-button.js +39 -15
  56. package/dist/components/tree.d.ts +6 -6
  57. package/dist/components/tree.js +25 -9
  58. package/dist/components/typeset.js +12 -1
  59. package/dist/mixins/calendar-keys.d.ts +6 -6
  60. package/dist/mixins/calendar-keys.js +35 -6
  61. package/dist/mixins/carousel-controls.d.ts +4 -2
  62. package/dist/mixins/carousel-controls.js +71 -20
  63. package/dist/mixins/clear-field.d.ts +9 -7
  64. package/dist/mixins/clear-field.js +25 -8
  65. package/dist/mixins/command-keys.js +22 -7
  66. package/dist/mixins/context-menu.d.ts +2 -0
  67. package/dist/mixins/context-menu.js +27 -1
  68. package/dist/mixins/copy-to-clipboard.js +15 -1
  69. package/dist/mixins/grid-list-keys.d.ts +6 -6
  70. package/dist/mixins/grid-list-keys.js +28 -6
  71. package/dist/mixins/hotkey.js +16 -9
  72. package/dist/mixins/index.d.ts +1 -0
  73. package/dist/mixins/index.js +1 -0
  74. package/dist/mixins/listbox-keys.js +20 -2
  75. package/dist/mixins/message-follow.js +50 -12
  76. package/dist/mixins/mirror-selected-option.d.ts +24 -0
  77. package/dist/mixins/mirror-selected-option.js +35 -0
  78. package/dist/mixins/treeKeys.d.ts +3 -2
  79. package/dist/mixins/treeKeys.js +53 -6
  80. package/dist/mixins/validate.d.ts +1 -1
  81. package/package.json +2 -2
  82. package/src/theme.css +33 -3
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/jsx-runtime";
2
2
  import { bg, fg } from "@sdxc/u/color";
3
3
  import { roundedCorner } from "@sdxc/u/effects";
4
4
  import { flex, gap, items } from "@sdxc/u/layout";
5
- import { data, when } from "@sdxc/u/state";
5
+ import { when } from "@sdxc/u/state";
6
6
  import { attrs } from "remix/ui";
7
7
  import { Calendar } from "./calendar.js";
8
8
  import { Input } from "./input.js";
@@ -190,20 +190,34 @@ RangeCalendar.Cell = function RangeCalendarCell(handle) {
190
190
  return () => {
191
191
  let { mix, ...rest } = handle.props;
192
192
  return (_jsx(Calendar.Cell, { ...rest, mix: [
193
- data("selection-start", [
193
+ /*
194
+ * A day is the range's opening, its closing, both at once, or one of the days
195
+ * between. The four are written under selectors that match one apiece, so each
196
+ * day keeps its own shape however the cascade orders the set.
197
+ */
198
+ when("&[data-selection-start]:not([data-selection-end])", [
194
199
  bg("brand.solid"),
195
200
  fg("brand.onSolid"),
196
201
  roundedCorner("start-end", "none"),
197
202
  roundedCorner("end-end", "none"),
198
203
  ]),
199
- data("selection-end", [
204
+ when("&[data-selection-end]:not([data-selection-start])", [
200
205
  bg("brand.solid"),
201
206
  fg("brand.onSolid"),
202
207
  roundedCorner("start-start", "none"),
203
208
  roundedCorner("end-start", "none"),
204
209
  ]),
210
+ // A range of one day opens and closes on itself, so it reads as a single day.
211
+ when("&[data-selection-start][data-selection-end]", [
212
+ bg("brand.solid"),
213
+ fg("brand.onSolid"),
214
+ ]),
205
215
  when('&[aria-selected="true"]:not([data-selection-start]):not([data-selection-end])', [
206
- bg("brand.tint"),
216
+ /*
217
+ * The days between carry the range across the row, so the band reads as one
218
+ * run at a glance while the two ends stay the strongest thing in the month.
219
+ */
220
+ bg("brand.bg-tint-hover"),
207
221
  fg("brand.emphasis"),
208
222
  roundedCorner("start-start", "none"),
209
223
  roundedCorner("start-end", "none"),
@@ -4,12 +4,15 @@
4
4
  * from whatever compound parts a given field needs. Its own
5
5
  * {@link SearchField.Input} part pairs a leading glyph with the native
6
6
  * `<input type="search">` control it decorates, building on {@link Input} for
7
- * that control's box, color, and state styling.
7
+ * that control's box, color, and state styling, and
8
+ * {@link SearchField.Control} rows that input with the
9
+ * {@link SearchField.Clear} button that empties it.
8
10
  *
9
11
  * @author [Sergio Xalambrí](https://sergiodxa.com)
10
12
  * @copyright Sergio Xalambrí 2026
11
13
  */
12
14
  import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
15
+ import { Button } from "./button.js";
13
16
  import { Input } from "./input.js";
14
17
  /**
15
18
  * Prop types for {@link SearchField} and its compound parts.
@@ -31,6 +34,26 @@ export declare namespace SearchField {
31
34
  */
32
35
  interface InputProps extends Omit<Input.Props, "type" | "list" | "role"> {
33
36
  }
37
+ /**
38
+ * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
39
+ * `children` holds one control row: the {@link SearchField.Input} and the
40
+ * {@link SearchField.Clear} button that empties it.
41
+ */
42
+ interface ControlProps extends TagProps<"div"> {
43
+ /** The row's contents: the search input, and the clear button reading it. */
44
+ children: RemixNode;
45
+ }
46
+ /**
47
+ * Every prop {@link Button} accepts except `type`, `variant`, `size`, and
48
+ * `command`, which this control fixes on the consumer's behalf, plus the
49
+ * `mix` passthrough.
50
+ */
51
+ interface ClearProps extends Omit<Button.Props, "type" | "variant" | "size" | "command" | "children"> {
52
+ /** The `id` of the input this button empties, naming the control it belongs to. */
53
+ commandfor: string;
54
+ /** Glyph or label the button shows. Defaults to a decorative {@link XIcon}. */
55
+ children?: RemixNode;
56
+ }
34
57
  }
35
58
  /**
36
59
  * Renders a `<search>` landmark — the platform's own role for a search
@@ -52,4 +75,6 @@ export declare namespace SearchField {
52
75
  export declare function SearchField(handle: Handle<SearchField.Props>): () => import("remix/ui").RemixElement;
53
76
  export declare namespace SearchField {
54
77
  var Input: (handle: Handle<SearchField.InputProps>) => () => import("remix/ui").RemixElement;
78
+ var Control: (handle: Handle<SearchField.ControlProps>) => () => import("remix/ui").RemixElement;
79
+ var Clear: (handle: Handle<SearchField.ClearProps>) => () => import("remix/ui").RemixElement;
55
80
  }
@@ -1,10 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/jsx-runtime";
2
- import { SearchIcon } from "@sdxc/icons";
2
+ import { SearchIcon, XIcon } from "@sdxc/icons";
3
3
  import { fg } from "@sdxc/u/color";
4
+ import { rounded } from "@sdxc/u/effects";
4
5
  import { pointerEvents } from "@sdxc/u/general";
5
- import { absolute, flex, insIs, items, relative } from "@sdxc/u/layout";
6
- import { pis } from "@sdxc/u/size";
6
+ import { absolute, appearance, flex, grow, hidden, insBs, insIe, insIs, items, relative, } from "@sdxc/u/layout";
7
+ import { bs, is, p, pis } from "@sdxc/u/size";
8
+ import { when } from "@sdxc/u/state";
9
+ import { translateY } from "@sdxc/u/transform";
10
+ import { clearField, SEARCH_FIELD_CLEAR_COMMAND } from "../mixins/clear-field.js";
7
11
  import { fieldStackLayout } from "../styles/field-stack-layout.js";
12
+ import { Button } from "./button.js";
8
13
  import { Input } from "./input.js";
9
14
  /**
10
15
  * Renders a `<search>` landmark — the platform's own role for a search
@@ -34,6 +39,10 @@ export function SearchField(handle) {
34
39
  * muted, decorative {@link SearchIcon} with a native `<input type="search">`
35
40
  * built on {@link Input}, inheriting its box, color, and state styling.
36
41
  *
42
+ * The user agent's own cancel affordance is suppressed, so clearing the field is
43
+ * {@link SearchField.Clear}'s job — one glyph the field styles and places, sitting
44
+ * alone in the trailing corner.
45
+ *
37
46
  * @param handle Runtime handle carrying the host `<input>`'s props.
38
47
  * @returns The render function producing the control's markup.
39
48
  * @example
@@ -44,6 +53,77 @@ export function SearchField(handle) {
44
53
  SearchField.Input = function SearchFieldInput(handle) {
45
54
  return () => {
46
55
  let { mix, ...rest } = handle.props;
47
- return (_jsxs("div", { "data-slot": "input-wrapper", mix: [relative(), flex(), items("center")], children: [_jsx(SearchIcon, { size: 16, "data-slot": "icon", mix: [absolute(), insIs("0.75rem"), pointerEvents(), fg("neutral.muted")] }), _jsx(Input, { type: "search", ...rest, mix: [pis("2.25rem"), mix] })] }));
56
+ return (_jsxs("div", { "data-slot": "input-wrapper", mix: [relative(), flex(), items("center")], children: [_jsx(SearchIcon, { size: 16, "data-slot": "icon", mix: [absolute(), insIs("0.75rem"), pointerEvents(), fg("neutral.muted")] }), _jsx(Input, { type: "search", ...rest, mix: [
57
+ pis("2.25rem"),
58
+ /*
59
+ * The field owns its own chrome, and {@link SearchField.Clear} draws the
60
+ * clear affordance. The user agent draws one of its own inside a search
61
+ * input that holds a value, unstyled and in the same corner, so the two
62
+ * would sit on top of each other.
63
+ */
64
+ when("&::-webkit-search-cancel-button", [appearance("none"), hidden()]),
65
+ when("&::-webkit-search-decoration", [appearance("none"), hidden()]),
66
+ mix,
67
+ ] })] }));
68
+ };
69
+ };
70
+ /**
71
+ * Renders the row holding {@link SearchField.Input} and the
72
+ * {@link SearchField.Clear} button beside it, and the positioning context that
73
+ * anchors the clear button to the input's trailing edge.
74
+ *
75
+ * @param handle Runtime handle carrying the host `<div>`'s props.
76
+ * @returns The render function producing the control row's markup.
77
+ * @example
78
+ * <SearchField.Control>
79
+ * <SearchField.Input id="site-search" name="q" />
80
+ * <SearchField.Clear commandfor="site-search" aria-label={t("search.clear")} />
81
+ * </SearchField.Control>
82
+ */
83
+ SearchField.Control = function SearchFieldControl(handle) {
84
+ return () => {
85
+ let { mix, ...rest } = handle.props;
86
+ return (_jsx("div", { ...rest, "data-slot": "control", mix: [
87
+ relative(),
88
+ flex(),
89
+ items("center"),
90
+ /* The input spans the row, so the field keeps the width its container offers. */
91
+ when('& > [data-slot="input-wrapper"]', grow()),
92
+ mix,
93
+ ] }));
94
+ };
95
+ };
96
+ /**
97
+ * Renders {@link SearchField}'s clear button: a round, icon-sized ghost
98
+ * {@link Button} centred on the input's trailing edge, carrying `clearField()`
99
+ * so it empties the `commandfor` input it names and shows while that input holds text.
100
+ *
101
+ * @param handle Runtime handle carrying the host `<button>`'s props.
102
+ * @returns The render function producing the clear button's markup.
103
+ * @example
104
+ * <SearchField.Clear commandfor="site-search" aria-label={t("search.clear")} />
105
+ * @example
106
+ * <SearchField.Clear commandfor="site-search">{t("search.clear")}</SearchField.Clear>
107
+ */
108
+ SearchField.Clear = function SearchFieldClear(handle) {
109
+ return () => {
110
+ let { children, mix, ...rest } = handle.props;
111
+ return (_jsx(Button, { type: "button", ...rest, hidden: true, variant: "ghost", size: "sm", command: SEARCH_FIELD_CLEAR_COMMAND, "data-slot": "clear", mix: [
112
+ clearField(),
113
+ /*
114
+ * A round, icon-sized target centred on the field, so its hover tint reads as a
115
+ * disc beside the text, and its glyph sits as far from the trailing edge as the
116
+ * search glyph sits from the leading one.
117
+ */
118
+ is(7),
119
+ bs(7),
120
+ p(0),
121
+ rounded("full"),
122
+ absolute(),
123
+ insIe("0.375rem"),
124
+ insBs("50%"),
125
+ translateY("-50%"),
126
+ mix,
127
+ ], children: children ?? _jsx(XIcon, { size: 16 }) }));
48
128
  };
49
129
  };
@@ -36,7 +36,13 @@ export declare namespace Select {
36
36
  * `multiple` and a `size` greater than `1` remain functional but switch
37
37
  * rendering back to the plain list-box; `role` is already implicit.
38
38
  */
39
- interface Props extends Omit<TagProps<"select">, "role"> {
39
+ /**
40
+ * `value` and `defaultValue` are left out on purpose. A `<select>` takes its selection
41
+ * from the option carrying `selected` and nothing else reads either attribute, so a
42
+ * value passed here goes unread and the field quietly shows its first option. Mark the
43
+ * option instead: `<Select.Option value="eu" selected>`.
44
+ */
45
+ interface Props extends Omit<TagProps<"select">, "role" | "defaultValue" | "value"> {
40
46
  /** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */
41
47
  color?: Color;
42
48
  }
@@ -9,6 +9,7 @@ import { bs, is, m, p, pb, pi } from "@sdxc/u/size";
9
9
  import { data, hover, when } from "@sdxc/u/state";
10
10
  import { text, textAlign, truncate } from "@sdxc/u/typography";
11
11
  import { attrs } from "remix/ui";
12
+ import { mirrorSelectedOption } from "../mixins/mirror-selected-option.js";
12
13
  /** Semantic color role {@link Select} falls back to when `color` is omitted. */
13
14
  const DEFAULT_COLOR = "neutral";
14
15
  /**
@@ -58,35 +59,30 @@ export function Select(handle) {
58
59
  justify("between"),
59
60
  cursor("default"),
60
61
  text("sm"),
61
- when("&:focus", outline("none")),
62
+ /*
63
+ * Focus is drawn as a ring standing off the field, the same way every button in
64
+ * this library draws it, rather than by darkening the border: a border promoted
65
+ * to its strong weight and a ring sat flush against it read as one thick slab,
66
+ * which says the field changed shape rather than that it took focus. The border
67
+ * only steps to its hover weight, so nothing jumps.
68
+ *
69
+ * Pointer focus drops the platform outline and keyboard focus keeps the ring. The
70
+ * two selectors exclude each other because `outline: none` is a shorthand, and a
71
+ * shorthand reaching this element from a later cascade layer resets the ring's
72
+ * color, width and style all at once.
73
+ */
74
+ when("&:focus:not(:focus-visible)", outline("none")),
62
75
  when("&:focus-visible", [
63
- border("neutral.strong"),
64
- outline({ color: "neutral.ring", offset: 0 }),
65
- data("color", "brand", [
66
- border("brand.strong"),
67
- outline({ color: "brand.ring", offset: 0 }),
68
- ]),
69
- data("color", "neutral", [
70
- border("neutral.strong"),
71
- outline({ color: "neutral.ring", offset: 0 }),
72
- ]),
73
- data("color", "success", [
74
- border("success.strong"),
75
- outline({ color: "success.ring", offset: 0 }),
76
- ]),
77
- data("color", "warning", [
78
- border("warning.strong"),
79
- outline({ color: "warning.ring", offset: 0 }),
80
- ]),
81
- data("color", "danger", [
82
- border("danger.strong"),
83
- outline({ color: "danger.ring", offset: 0 }),
84
- ]),
76
+ border("neutral.border-hover"),
77
+ outline({ color: "brand.ring", offset: 2 }),
78
+ data("color", "success", outline("success.ring")),
79
+ data("color", "warning", outline("warning.ring")),
80
+ data("color", "danger", outline("danger.ring")),
85
81
  ]),
86
82
  when('&[aria-invalid="true"], &:user-invalid', [
87
83
  outlineWidth("2px"),
88
84
  outlineStyle("solid"),
89
- raw({ outlineOffset: "0px" }),
85
+ raw({ outlineOffset: "2px" }),
90
86
  ]),
91
87
  when("&:disabled", [cursor("not-allowed"), opacity(50)]),
92
88
  raw({
@@ -136,11 +132,11 @@ export function Select(handle) {
136
132
  pb("0.5rem"),
137
133
  appearance("base-select"),
138
134
  transition("color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter"),
139
- hover(border("neutral.strong")),
140
- when("&:focus", border("neutral.strong")),
135
+ hover(border("neutral.border-hover")),
136
+ when("&:focus", border("neutral.border-hover")),
141
137
  when('&[aria-invalid="true"], &:user-invalid', [
142
- border("danger.strong"),
143
- outline({ color: "danger.ring", offset: 0 }),
138
+ border("danger"),
139
+ outline({ color: "danger.ring", offset: 2 }),
144
140
  ]),
145
141
  when("&:disabled", bg("neutral.bg-tint-hover")),
146
142
  raw({
@@ -219,7 +215,15 @@ Select.Trigger = function SelectTrigger(handle) {
219
215
  Select.Value = function SelectValue(handle) {
220
216
  return () => {
221
217
  let { mix, ...rest } = handle.props;
222
- return (_jsx("selectedcontent", { ...rest, mix: [grow(), shrink(1), basis("0%"), truncate(), textAlign("start"), mix] }));
218
+ return (_jsx("selectedcontent", { ...rest, mix: [
219
+ mirrorSelectedOption(),
220
+ grow(),
221
+ shrink(1),
222
+ basis("0%"),
223
+ truncate(),
224
+ textAlign("start"),
225
+ mix,
226
+ ] }));
223
227
  };
224
228
  };
225
229
  /**
@@ -200,7 +200,8 @@ Sidebar.Provider = function SidebarProvider(handle) {
200
200
  /**
201
201
  * Renders the docked, edge-to-edge mobile substitute for {@link Sidebar}:
202
202
  * {@link Sidebar}'s nav content re-composed inside {@link Dialog}, docked
203
- * to `side` and opened via Invoker Commands, not a viewport check.
203
+ * to `side` and opened via Invoker Commands, not a viewport check. A press
204
+ * outside it closes it, which is the dismissal a touch device has.
204
205
  *
205
206
  * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.
206
207
  * @returns The render function producing the drawer's markup.
@@ -218,6 +219,13 @@ Sidebar.MobileNav = function SidebarMobileNav(handle) {
218
219
  let { side, mix, ...rest } = handle.props;
219
220
  let resolvedSide = side ?? DEFAULT_SIDE;
220
221
  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`.
227
+ */
228
+ attrs({ closedby: "any" }),
221
229
  fixed(),
222
230
  insBs("0"),
223
231
  insBe("0"),
@@ -268,6 +276,13 @@ Sidebar.Header = function SidebarHeader(handle) {
268
276
  return () => {
269
277
  let { mix, ...rest } = handle.props;
270
278
  return (_jsx("header", { ...rest, "data-slot": "header", mix: [
279
+ /*
280
+ * The slot paints the rail's own background rather than letting it show
281
+ * through, so a consumer that holds this row against the viewport keeps the
282
+ * scrolling content behind it out of sight. Inheriting it means the row still
283
+ * matches whichever surface hosts it — the docked rail or the drawer.
284
+ */
285
+ bg("inherit"),
271
286
  flex(),
272
287
  bs("4rem"),
273
288
  shrink(),
@@ -310,7 +325,7 @@ Sidebar.Content = function SidebarContent(handle) {
310
325
  minBs("0"),
311
326
  bs("auto"),
312
327
  gap("1rem"),
313
- pi("0.75rem"),
328
+ pi("0.5rem"),
314
329
  pb("1rem"),
315
330
  mix,
316
331
  ] }));
@@ -332,6 +347,7 @@ Sidebar.Footer = function SidebarFooter(handle) {
332
347
  return () => {
333
348
  let { mix, ...rest } = handle.props;
334
349
  return (_jsx("footer", { ...rest, "data-slot": "footer", mix: [
350
+ bg("inherit"),
335
351
  flex(),
336
352
  shrink(),
337
353
  items("center"),
@@ -341,7 +357,7 @@ Sidebar.Footer = function SidebarFooter(handle) {
341
357
  color: colorMix("oklab", { color: "var(--ui-neutral-border)", weight: 80 }, "transparent"),
342
358
  }),
343
359
  gap("0.5rem"),
344
- pi("1rem"),
360
+ pi("0.5rem"),
345
361
  pbs("1rem"),
346
362
  pbe("calc(1rem + env(safe-area-inset-bottom, 0px))"),
347
363
  mix,
@@ -409,7 +425,7 @@ Sidebar.Item = function SidebarItem(handle) {
409
425
  when('&[aria-disabled="true"]', [cursor("not-allowed"), opacity(50)]),
410
426
  gap("0.75rem"),
411
427
  rounded("lg"),
412
- pi("0.75rem"),
428
+ pi("0.5rem"),
413
429
  pb("0.5rem"),
414
430
  fg("neutral"),
415
431
  transition("color, background-color, border-color, outline-color, text-decoration-color, fill, stroke"),
@@ -602,7 +618,14 @@ Sidebar.MenuItem = function SidebarMenuItem(handle) {
602
618
  return (_jsx("li", { ...rest, "data-slot": "menu-item", mix: [
603
619
  relative(),
604
620
  flex(),
605
- items("center"),
621
+ /*
622
+ * A row on its own centres what it holds; a row that carries a sub-menu
623
+ * stacks, so the nested list sits under it at full width. The two are
624
+ * written under selectors that never match at once, so the layout holds
625
+ * whichever order the cascade puts the pair in.
626
+ */
627
+ when('&:not(:has([data-slot="menu-sub"]))', items("center")),
628
+ when('&:has([data-slot="menu-sub"])', [flexCol(), items("stretch")]),
606
629
  when("&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']", opacity(100)),
607
630
  mix,
608
631
  ] }));
@@ -682,7 +705,6 @@ function menuRowMixins() {
682
705
  when("& > span", truncate()),
683
706
  data("size", "sm", [
684
707
  minBs("1.75rem"),
685
- pi("0.625rem"),
686
708
  pb("0.375rem"),
687
709
  fontSize("xs"),
688
710
  when("& > svg:first-child, & > [data-slot='icon']:first-child", [
@@ -693,7 +715,6 @@ function menuRowMixins() {
693
715
  data("size", "md", minBs("2.25rem")),
694
716
  data("size", "lg", [
695
717
  minBs("2.75rem"),
696
- pi("1rem"),
697
718
  pb("0.625rem"),
698
719
  fontSize("base"),
699
720
  when("& > svg:first-child, & > [data-slot='icon']:first-child", [
@@ -706,7 +727,7 @@ function menuRowMixins() {
706
727
  when('&[aria-disabled="true"]', [cursor("not-allowed"), opacity(50)]),
707
728
  gap("0.75rem"),
708
729
  rounded("lg"),
709
- pi("0.75rem"),
730
+ pi("0.5rem"),
710
731
  pb("0.5rem"),
711
732
  fg("neutral"),
712
733
  transition("color, background-color, border-color, outline-color, text-decoration-color, fill, stroke"),
@@ -816,7 +837,7 @@ Sidebar.MenuSkeleton = function SidebarMenuSkeleton(handle) {
816
837
  items("center"),
817
838
  bs("2.25rem"),
818
839
  gap("0.75rem"),
819
- pi("0.75rem"),
840
+ pi("0.5rem"),
820
841
  rounded("lg"),
821
842
  mix,
822
843
  ], children: [resolvedShowIcon && (_jsx("span", { "aria-hidden": "true", "data-slot": "menu-skeleton-icon", mix: [is("1rem"), bs("1rem"), shrink(), rounded("sm"), bg("neutral.border")] })), _jsx("span", { "aria-hidden": "true", "data-slot": "menu-skeleton-text", mix: [bs("1rem"), grow(), is("60%"), rounded("md"), bg("neutral.border")] })] }));
@@ -841,11 +862,11 @@ Sidebar.MenuSub = function SidebarMenuSub(handle) {
841
862
  let { mix, ...rest } = handle.props;
842
863
  return (_jsx("ul", { ...rest, "data-slot": "menu-sub", mix: [
843
864
  relative(),
844
- mis("0.875rem"),
865
+ mis("1rem"),
845
866
  flex(),
846
867
  flexCol(),
847
868
  borderEdge("inline-start", { width: 1, style: "solid" }),
848
- pis("0.875rem"),
869
+ pis("0.625rem"),
849
870
  gap("0.125rem"),
850
871
  border("neutral"),
851
872
  mix,
@@ -47,7 +47,7 @@ export function Slider(handle) {
47
47
  orientation: resolvedOrientation,
48
48
  thumbId: handle.id,
49
49
  });
50
- return (_jsx("div", { "data-orientation": resolvedOrientation, ...rest, mix: [
50
+ return (_jsx("div", { "data-slot": "slider", "data-orientation": resolvedOrientation, ...rest, mix: [
51
51
  vstack({ gap: "0.5rem" }),
52
52
  when('&[data-orientation="horizontal"]', [is("100%"), minIs("10rem")]),
53
53
  when('&[data-orientation="vertical"]', [bs("10rem"), items("center")]),
@@ -79,14 +79,18 @@ Slider.Track = function SliderTrack(handle) {
79
79
  is("100%"),
80
80
  bs("var(--ui-slider-thumb-size, 1.25rem)"),
81
81
  ]),
82
- when('[data-orientation="vertical"] &', [
82
+ when('[data-slot="slider"][data-orientation="vertical"] &', [
83
83
  is("var(--ui-slider-thumb-size, 1.25rem)"),
84
84
  minBs("0"),
85
85
  overflow("hidden"),
86
86
  ]),
87
87
  before([absolute(), rounded("full"), bg("neutral.border"), pseudoContent('""')]),
88
88
  after([absolute(), rounded("full"), bg("brand.solid"), pseudoContent('""')]),
89
- when('[data-orientation="vertical"] &', [grow(), shrink(1), basis("0%")]),
89
+ when('[data-slot="slider"][data-orientation="vertical"] &', [
90
+ grow(),
91
+ shrink(1),
92
+ basis("0%"),
93
+ ]),
90
94
  when('[data-orientation="horizontal"] &::before', [
91
95
  bs("var(--ui-slider-track-thickness, 0.5rem)"),
92
96
  insIs("0"),
@@ -101,14 +105,14 @@ Slider.Track = function SliderTrack(handle) {
101
105
  insBs("50%"),
102
106
  translateY("-50%"),
103
107
  ]),
104
- when('[data-orientation="vertical"] &::before', [
108
+ when('[data-slot="slider"][data-orientation="vertical"] &::before', [
105
109
  is("var(--ui-slider-track-thickness, 0.5rem)"),
106
110
  bs("100%"),
107
111
  insBs("0"),
108
112
  insIs("50%"),
109
113
  translateX("-50%"),
110
114
  ]),
111
- when('[data-orientation="vertical"] &::after', [
115
+ when('[data-slot="slider"][data-orientation="vertical"] &::after', [
112
116
  is("var(--ui-slider-track-thickness, 0.5rem)"),
113
117
  bs("var(--ui-slider-fill, 0%)"),
114
118
  insBe("0"),
@@ -155,7 +159,7 @@ Slider.Thumb = function SliderThumb(handle) {
155
159
  bg("transparent"),
156
160
  border({ style: "none" }),
157
161
  ]),
158
- when('[data-orientation="vertical"] &', raw({ writingMode: "vertical-lr", direction: "rtl" })),
162
+ when('[data-slot="slider"][data-orientation="vertical"] &', raw({ writingMode: "vertical-lr", direction: "rtl" })),
159
163
  mix,
160
164
  ] }));
161
165
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/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, textAlign, textDecoration, userSelect, virtualize, weight, when, } from "@sdxc/u";
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";
4
4
  import { attrs } from "remix/ui";
5
5
  import { interactiveTransition } from "../styles/interactive-transition.js";
6
6
  import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
@@ -142,7 +142,7 @@ Table.Column = function TableColumn(handle) {
142
142
  textDecoration("none"),
143
143
  hover(textDecoration("underline")),
144
144
  parts?.link,
145
- ], children: [children, sortDirection === "ascending" && _jsx(ArrowUpIcon, { size: 14 }), sortDirection === "descending" && _jsx(ArrowDownIcon, { size: 14 }), !sortDirection && _jsx(ArrowUpDownIcon, { size: 14, mix: [opacity(40)] })] })) : (children) }));
145
+ ], children: [children, sortDirection === "ascending" && _jsx(ArrowUpIcon, { size: 14, mix: [shrink()] }), sortDirection === "descending" && _jsx(ArrowDownIcon, { size: 14, mix: [shrink()] }), !sortDirection && _jsx(ArrowUpDownIcon, { size: 14, mix: [shrink(), opacity(40)] })] })) : (children) }));
146
146
  };
147
147
  };
148
148
  /**
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
2
2
  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
- import { flex, flexCol, inlineFlex, items, justify, gap } from "@sdxc/u/layout";
6
- import { pi, pb } from "@sdxc/u/size";
5
+ import { flex, flexCol, inlineFlex, items, justify, gap, shrink } from "@sdxc/u/layout";
6
+ import { bs, is, minBs, pi, pb } 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/ui";
@@ -75,14 +75,38 @@ export function ToggleButton(handle) {
75
75
  items("center"),
76
76
  justify("center"),
77
77
  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.
84
+ */
85
+ when("& > svg", [shrink(), is(4), bs(4)]),
78
86
  rounded("md"),
79
87
  weight(500),
80
88
  cursor("default"),
81
89
  userSelect(),
82
90
  pi("1rem"),
83
91
  pb("0.5rem"),
84
- when('&[data-size="sm"]', [pi("0.75rem"), pb("0.375rem")]),
85
- when('&[data-size="lg"]', [pi("1.25rem"), pb("0.625rem")]),
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.
96
+ */
97
+ minBs("2.5rem"),
98
+ when('&[data-size="sm"]', [
99
+ pi("0.75rem"),
100
+ pb("0.375rem"),
101
+ minBs("2rem"),
102
+ when("& > svg", [is(3), bs(3)]),
103
+ ]),
104
+ when('&[data-size="lg"]', [
105
+ pi("1.25rem"),
106
+ pb("0.625rem"),
107
+ minBs("3rem"),
108
+ when("& > svg", [is(5), bs(5)]),
109
+ ]),
86
110
  text("sm"),
87
111
  data("size", "sm", text("xs")),
88
112
  data("size", "lg", text("base")),
@@ -119,39 +143,39 @@ export function ToggleButton(handle) {
119
143
  ]),
120
144
  ]),
121
145
  when('&[data-variant="outline"]', [
122
- border({ width: 2, noStyleDefault: true }),
146
+ border({ width: 1, noStyleDefault: true }),
123
147
  bg("transparent"),
124
148
  ]),
125
149
  when('&[data-variant="ghost"]', bg("transparent")),
126
150
  when('&[data-variant="outline"]', [
127
151
  when('&[data-color="brand"]', [
128
- border("brand.border-strong"),
152
+ border("brand.border"),
129
153
  fg("brand.fg"),
130
- hover(bg("brand.bg-tint")),
154
+ hover([bg("brand.bg-tint"), border("brand.border-hover")]),
131
155
  active(bg("brand.bg-tint-hover")),
132
156
  ]),
133
157
  when('&[data-color="neutral"]', [
134
- border("neutral.border-strong"),
158
+ border("neutral.border"),
135
159
  fg("neutral.fg"),
136
- hover(bg("neutral.bg-tint")),
160
+ hover([bg("neutral.bg-tint"), border("neutral.border-hover")]),
137
161
  active(bg("neutral.bg-tint-hover")),
138
162
  ]),
139
163
  when('&[data-color="success"]', [
140
- border("success.border-strong"),
164
+ border("success.border"),
141
165
  fg("success.fg"),
142
- hover(bg("success.bg-tint")),
166
+ hover([bg("success.bg-tint"), border("success.border-hover")]),
143
167
  active(bg("success.bg-tint-hover")),
144
168
  ]),
145
169
  when('&[data-color="danger"]', [
146
- border("danger.border-strong"),
170
+ border("danger.border"),
147
171
  fg("danger.fg"),
148
- hover(bg("danger.bg-tint")),
172
+ hover([bg("danger.bg-tint"), border("danger.border-hover")]),
149
173
  active(bg("danger.bg-tint-hover")),
150
174
  ]),
151
175
  when('&[data-color="warning"]', [
152
- border("warning.border-strong"),
176
+ border("warning.border"),
153
177
  fg("warning.fg"),
154
- hover(bg("warning.bg-tint")),
178
+ hover([bg("warning.bg-tint"), border("warning.border-hover")]),
155
179
  active(bg("warning.bg-tint-hover")),
156
180
  ]),
157
181
  ]),