@sdxc/ui 2026.9.14 → 2026.9.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) 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 +27 -4
  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 +5 -5
  82. package/src/reset.css +6 -4
  83. package/src/theme.css +33 -3
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Adapts the WAI-ARIA grid keyboard pattern onto a GridList's rows and
3
- * action cells: one roving focus position moves with the arrow and
4
- * Home/End keys, and Space/Shift/Ctrl drive selection through a
2
+ * Adapts the WAI-ARIA grid pattern onto a GridList's rows and action
3
+ * cells: one roving focus position moves with the arrow and Home/End keys
4
+ * or a click, and Space, Shift and a click drive selection through a
5
5
  * `SelectionModel` instance.
6
6
  *
7
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
@@ -133,9 +133,9 @@ function syncSelection(host, model) {
133
133
  }
134
134
  }
135
135
  /**
136
- * Adds ARIA grid keyboard navigation and selection to a GridList's rows and
137
- * action cells, driving a `SelectionModel` and mirroring its `"change"`
138
- * events back onto the rows as `aria-selected`.
136
+ * Adds ARIA grid keyboard and pointer navigation to a GridList's rows and
137
+ * action cells, driving a `SelectionModel` from both and mirroring its
138
+ * `"change"` events back onto the rows as `aria-selected`.
139
139
  *
140
140
  * @param model Behavior class instance owning the grid's selected keys.
141
141
  * @example
@@ -180,6 +180,28 @@ export const gridListKeys = createMixin((handle) => {
180
180
  return;
181
181
  setRovingTabindex(rows, stopAt(rows, position));
182
182
  }),
183
+ on("pointerdown", (event) => {
184
+ /* A shift-click spans rows, so the grid keeps that gesture for selection. */
185
+ if (event.shiftKey)
186
+ event.preventDefault();
187
+ }),
188
+ on("click", (event) => {
189
+ if (hostNode === undefined)
190
+ return;
191
+ let rows = queryRows(hostNode);
192
+ let position = locate(rows, event.target);
193
+ if (position === null)
194
+ return;
195
+ focusElement(rows, stopAt(rows, position));
196
+ /* Selection belongs to the row, leaving an action cell's click to its own action. */
197
+ if (position.cellIndex !== null)
198
+ return;
199
+ let key = resolveKey(model, rowKeyOf(rows[position.rowIndex]));
200
+ if (event.shiftKey)
201
+ model.selectRange(key);
202
+ else
203
+ model.toggle(key);
204
+ }),
183
205
  on("keydown", (event) => {
184
206
  if (hostNode === undefined)
185
207
  return;
@@ -117,15 +117,22 @@ function setOpen(host, open) {
117
117
  export const hotkey = createMixin((handle) => {
118
118
  let getHostNode = trackHostNode(handle);
119
119
  let parsed;
120
- document.addEventListener("keydown", (event) => {
121
- let hostNode = getHostNode();
122
- if (hostNode === undefined || parsed === undefined)
123
- return;
124
- if (event.repeat || !matchesCombo(event, parsed))
125
- return;
126
- event.preventDefault();
127
- setOpen(hostNode, !isOpen(hostNode));
128
- }, { signal: handle.signal });
120
+ /**
121
+ * A combination is watched on the document the host was inserted into, which is what
122
+ * keeps the mixin to the one document it belongs to and leaves it inert wherever the
123
+ * host is rendered without one, such as on a server.
124
+ */
125
+ handle.addEventListener("insert", (event) => {
126
+ event.node.ownerDocument.addEventListener("keydown", (keyEvent) => {
127
+ let hostNode = getHostNode();
128
+ if (hostNode === undefined || parsed === undefined)
129
+ return;
130
+ if (keyEvent.repeat || !matchesCombo(keyEvent, parsed))
131
+ return;
132
+ keyEvent.preventDefault();
133
+ setOpen(hostNode, !isOpen(hostNode));
134
+ }, { signal: handle.signal });
135
+ });
129
136
  return (combo) => {
130
137
  parsed = parseCombo(combo);
131
138
  };
@@ -34,6 +34,7 @@ export * from "./long-press.js";
34
34
  export * from "./menu-keys.js";
35
35
  export * from "./menubar-keys.js";
36
36
  export * from "./message-follow.js";
37
+ export * from "./mirror-selected-option.js";
37
38
  export * from "./otp-slots.js";
38
39
  export * from "./persist.js";
39
40
  export * from "./press-toggle.js";
@@ -34,6 +34,7 @@ export * from "./long-press.js";
34
34
  export * from "./menu-keys.js";
35
35
  export * from "./menubar-keys.js";
36
36
  export * from "./message-follow.js";
37
+ export * from "./mirror-selected-option.js";
37
38
  export * from "./otp-slots.js";
38
39
  export * from "./persist.js";
39
40
  export * from "./press-toggle.js";
@@ -7,7 +7,7 @@
7
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
8
8
  * @copyright Sergio Xalambrí 2026
9
9
  */
10
- import { createMixin } from "remix/ui";
10
+ import { createMixin, on } from "remix/ui";
11
11
  import * as listbox from "remix/ui/listbox";
12
12
  import { trackHostNode } from "./track-host-node.js";
13
13
  /** DOM event type dispatched by {@link listboxKeys} whenever the selected value or the active option changes. */
@@ -58,6 +58,24 @@ export const listboxKeys = createMixin((handle) => {
58
58
  lastActiveValue = activeValue;
59
59
  getHostNode()?.dispatchEvent(new ListboxChangeEvent({ value, activeValue }));
60
60
  }
61
- return listbox.list();
61
+ return [
62
+ /*
63
+ * Moving past the first option carries on to the last, matching the wrap the
64
+ * forward direction already makes. The primitive's own handler runs on this same
65
+ * host, so the press is settled here before it reaches that one.
66
+ */
67
+ on("keydown", (event) => {
68
+ if (event.key !== "ArrowUp")
69
+ return;
70
+ let options = [...event.currentTarget.querySelectorAll('[role="option"]')].filter((option) => option.getAttribute("aria-disabled") !== "true");
71
+ let first = options[0];
72
+ if (!first || first.getAttribute("data-highlighted") !== "true")
73
+ return;
74
+ event.preventDefault();
75
+ event.stopImmediatePropagation();
76
+ context.navigate("last");
77
+ }),
78
+ listbox.list(),
79
+ ];
62
80
  };
63
81
  });
@@ -125,8 +125,13 @@ function precedes(node, reference) {
125
125
  * @param model Model whose pinned state gates the jump.
126
126
  */
127
127
  function stickToEndIfPinned(host, model) {
128
+ /*
129
+ * Following lands at once, so a viewport that scrolls smoothly still keeps up with a
130
+ * reply arriving a word at a time: an eased scroll would restart on every word and
131
+ * spend the whole answer travelling.
132
+ */
128
133
  if (model.pinned)
129
- host.scrollTop = host.scrollHeight;
134
+ host.scrollTo({ top: host.scrollHeight, behavior: "instant" });
130
135
  }
131
136
  /**
132
137
  * Re-measures the viewport's reachable edges and anchor turn into `model`,
@@ -188,6 +193,19 @@ function scrollableTokens(model) {
188
193
  tokens.push("end");
189
194
  return tokens.length > 0 ? tokens.join(" ") : null;
190
195
  }
196
+ /**
197
+ * Finds the jump-to-latest control paired with `host`, looking inside the scrolling
198
+ * element and then in the frame around it, so the control can float over the scroller
199
+ * rather than scroll along with what it points at.
200
+ *
201
+ * @param host Scrolling element the follow behavior is attached to.
202
+ * @returns The paired control, or `null` where the pairing renders none.
203
+ */
204
+ function findJumpControl(host) {
205
+ return (host.querySelector(`[${MESSAGE_SCROLLER_JUMP_ATTRIBUTE}]`) ??
206
+ host.parentElement?.querySelector(`[${MESSAGE_SCROLLER_JUMP_ATTRIBUTE}]`) ??
207
+ null);
208
+ }
191
209
  /**
192
210
  * Mirrors `model`'s state onto the viewport and its jump-to-latest control:
193
211
  * autoscrolling and scrollable attributes track `pinned` and reachable
@@ -206,7 +224,7 @@ function syncAttributesFromModel(host, model) {
206
224
  host.setAttribute(MESSAGE_SCROLLER_SCROLLABLE_ATTRIBUTE, tokens);
207
225
  else
208
226
  host.removeAttribute(MESSAGE_SCROLLER_SCROLLABLE_ATTRIBUTE);
209
- let button = host.querySelector(`[${MESSAGE_SCROLLER_JUMP_ATTRIBUTE}]`);
227
+ let button = findJumpControl(host);
210
228
  if (!button)
211
229
  return;
212
230
  let visible = !model.pinned;
@@ -282,26 +300,44 @@ export const messageFollow = createMixin((handle) => {
282
300
  let anchorId = model.anchorTurnId;
283
301
  let anchorNode = anchorId ? findItemById(host, anchorId) : undefined;
284
302
  let prependHeight = 0;
285
- let appendedNew = false;
303
+ let grewAtEnd = false;
286
304
  for (let record of records) {
305
+ if (record.type === "characterData") {
306
+ grewAtEnd = true;
307
+ continue;
308
+ }
287
309
  for (let node of record.addedNodes) {
288
310
  if (!(node instanceof HTMLElement))
289
311
  continue;
290
312
  if (anchorNode && precedes(node, anchorNode))
291
313
  prependHeight += node.getBoundingClientRect().height;
292
314
  else
293
- appendedNew = true;
315
+ grewAtEnd = true;
294
316
  }
295
317
  }
296
318
  if (prependHeight > 0)
297
319
  host.scrollTop += prependHeight;
298
- if (appendedNew)
320
+ if (grewAtEnd)
299
321
  stickToEndIfPinned(host, model);
300
322
  ensureItemsObserved(host, model);
301
323
  resync(host, model, false);
302
324
  }
303
325
  handle.addEventListener("insert", (event) => {
304
326
  hostNode = event.node;
327
+ /*
328
+ * The press is answered from the frame around the scroller rather than the scroller
329
+ * itself, so a control floating over the log reaches the behavior the same way one
330
+ * rendered inside it does.
331
+ */
332
+ let pressScope = event.node.parentElement ?? event.node;
333
+ pressScope.addEventListener("click", (pressEvent) => {
334
+ let target = pressEvent.target;
335
+ if (!(target instanceof Element))
336
+ return;
337
+ if (!target.closest(`[${MESSAGE_SCROLLER_JUMP_ATTRIBUTE}]`))
338
+ return;
339
+ boundModel?.scrollToEnd();
340
+ }, { signal: handle.signal });
305
341
  if (boundModel) {
306
342
  stickToEndIfPinned(hostNode, boundModel);
307
343
  ensureItemsObserved(hostNode, boundModel);
@@ -311,7 +347,15 @@ export const messageFollow = createMixin((handle) => {
311
347
  if (hostNode && boundModel)
312
348
  handleMutations(hostNode, boundModel, records);
313
349
  });
314
- mutationObserver.observe(event.node, { childList: true, subtree: true });
350
+ /*
351
+ * Text counts as growth, not just nodes: a reply that arrives a word at a time grows
352
+ * by rewriting the row it is already in, and following has to keep up with that.
353
+ */
354
+ mutationObserver.observe(event.node, {
355
+ childList: true,
356
+ subtree: true,
357
+ characterData: true,
358
+ });
315
359
  let resizeObserver = new ResizeObserver(() => {
316
360
  if (!hostNode || !boundModel)
317
361
  return;
@@ -356,12 +400,6 @@ export const messageFollow = createMixin((handle) => {
356
400
  if (SCROLL_KEYS.has(event.key))
357
401
  userScrollIntent = true;
358
402
  }),
359
- on("click", (event) => {
360
- let target = event.target;
361
- if (target instanceof Element && target.closest(`[${MESSAGE_SCROLLER_JUMP_ATTRIBUTE}]`)) {
362
- model.scrollToEnd();
363
- }
364
- }),
365
403
  ],
366
404
  });
367
405
  };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Keeps a `<selectedcontent>` slot showing the option a `<select>` has
3
+ * selected, restoring the mirror the browser maintains whenever a re-render
4
+ * of the tree the field sits in clears it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { MixinFactory } from "remix/ui";
10
+ /**
11
+ * Writes the selected `<option>`'s content back into the host
12
+ * `<selectedcontent>` once a render has committed and left the slot empty.
13
+ *
14
+ * The platform fills the slot from the selected option, so what it holds belongs
15
+ * to the browser rather than to the tree the field was rendered in. A re-render of
16
+ * that tree finds content nobody declared and empties the slot, which leaves the
17
+ * trigger blank until the next choice is made; writing the option back on commit is
18
+ * what keeps the two agreeing. A slot holding a consumer's own fallback content is
19
+ * left alone, since that content is the tree's to own.
20
+ *
21
+ * @example
22
+ * <selectedcontent mix={[mirrorSelectedOption()]} />
23
+ */
24
+ export declare const mirrorSelectedOption: MixinFactory<HTMLElement>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Keeps a `<selectedcontent>` slot showing the option a `<select>` has
3
+ * selected, restoring the mirror the browser maintains whenever a re-render
4
+ * of the tree the field sits in clears it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/ui";
10
+ /**
11
+ * Writes the selected `<option>`'s content back into the host
12
+ * `<selectedcontent>` once a render has committed and left the slot empty.
13
+ *
14
+ * The platform fills the slot from the selected option, so what it holds belongs
15
+ * to the browser rather than to the tree the field was rendered in. A re-render of
16
+ * that tree finds content nobody declared and empties the slot, which leaves the
17
+ * trigger blank until the next choice is made; writing the option back on commit is
18
+ * what keeps the two agreeing. A slot holding a consumer's own fallback content is
19
+ * left alone, since that content is the tree's to own.
20
+ *
21
+ * @example
22
+ * <selectedcontent mix={[mirrorSelectedOption()]} />
23
+ */
24
+ export const mirrorSelectedOption = createMixin((handle) => {
25
+ handle.addEventListener("commit", (event) => {
26
+ let slot = event.node;
27
+ if (slot.hasChildNodes())
28
+ return;
29
+ let option = slot.closest("select")?.selectedOptions[0];
30
+ if (!option)
31
+ return;
32
+ slot.append(...[...option.childNodes].map((child) => child.cloneNode(true)));
33
+ });
34
+ return () => { };
35
+ });
@@ -2,8 +2,9 @@
2
2
  * Adapts the WAI-ARIA tree keyboard pattern onto a Tree's rows: a roving
3
3
  * focus position moves between visible rows, arrow keys expand, collapse, or
4
4
  * step into and out of a subtree, and typed text matches labels, with every
5
- * selection change delegated to a shared `SelectionModel`. Each row still
6
- * renders in document order behind a disclosure control, staying expandable.
5
+ * selection change delegated to a shared `SelectionModel`. Expanding or
6
+ * collapsing a branch writes its `aria-expanded` and opens or closes the
7
+ * `<details>` revealing it, so a row's two halves say the same thing.
7
8
  *
8
9
  * @author [Sergio Xalambrí](https://sergiodxa.com)
9
10
  * @copyright Sergio Xalambrí 2026
@@ -2,8 +2,9 @@
2
2
  * Adapts the WAI-ARIA tree keyboard pattern onto a Tree's rows: a roving
3
3
  * focus position moves between visible rows, arrow keys expand, collapse, or
4
4
  * step into and out of a subtree, and typed text matches labels, with every
5
- * selection change delegated to a shared `SelectionModel`. Each row still
6
- * renders in document order behind a disclosure control, staying expandable.
5
+ * selection change delegated to a shared `SelectionModel`. Expanding or
6
+ * collapsing a branch writes its `aria-expanded` and opens or closes the
7
+ * `<details>` revealing it, so a row's two halves say the same thing.
7
8
  *
8
9
  * @author [Sergio Xalambrí](https://sergiodxa.com)
9
10
  * @copyright Sergio Xalambrí 2026
@@ -18,6 +19,10 @@ import { isPrintableKey, labelFor, setRovingTabindex } from "../utils/keyboard-n
18
19
  export const TREE_ITEM_ATTRIBUTE = "data-tree-item";
19
20
  /** Selector matching a row excluded from keyboard navigation and selection. */
20
21
  const DISABLED_SELECTOR = '[aria-disabled="true"]';
22
+ /** Selector matching the row's own disclosure label, which its `<details>` hangs from. */
23
+ const SUMMARY_SELECTOR = "summary";
24
+ /** Selector matching the disclosure whose `[open]` reveals a row's subtree. */
25
+ const DISCLOSURE_SELECTOR = "details";
21
26
  /** Idle time after the last keystroke before the typeahead buffer resets. */
22
27
  const TYPEAHEAD_RESET_MS = 500;
23
28
  /** DOM event type dispatched by {@link treeKeys} whenever the bound model's selection or the active row changes. */
@@ -41,10 +46,38 @@ export class TreeChangeEvent extends Event {
41
46
  this.activeKey = init.activeKey;
42
47
  }
43
48
  }
49
+ /**
50
+ * The `<details>` whose `[open]` reveals `row`'s subtree, found through the
51
+ * row's own `<summary>` so the match is the branch the row labels; `null` for
52
+ * a row whose markup discloses its subtree some other way.
53
+ */
54
+ function disclosureFor(row) {
55
+ let summary = row.closest(SUMMARY_SELECTOR);
56
+ return summary?.closest(DISCLOSURE_SELECTOR) ?? null;
57
+ }
58
+ /**
59
+ * Reads whether `row`'s branch is expanded, answering from the `<details>`
60
+ * revealing its subtree wherever the row sits in one, so a press straight on
61
+ * the disclosure is the state the next keystroke moves from.
62
+ */
63
+ function isTreeItemExpanded(row) {
64
+ return disclosureFor(row)?.open ?? row.getAttribute("aria-expanded") === "true";
65
+ }
66
+ /**
67
+ * Expands or collapses `row`'s branch across both halves of the state it
68
+ * carries: the `aria-expanded` assistive technology announces, and the
69
+ * `[open]` a surrounding `<details>` reveals the subtree from.
70
+ */
71
+ function setTreeItemExpanded(row, expanded) {
72
+ row.setAttribute("aria-expanded", expanded ? "true" : "false");
73
+ let disclosure = disclosureFor(row);
74
+ if (disclosure)
75
+ disclosure.open = expanded;
76
+ }
44
77
  /**
45
78
  * Reads rows beneath `host` carrying {@link TREE_ITEM_ATTRIBUTE} into a flat
46
79
  * {@link TreeRow} list, deriving level, parent, children, and visibility from
47
- * `aria-level`/`aria-expanded` alone, via one level-ordered stack pass so no row re-scans its ancestors.
80
+ * `aria-level` and each row's own disclosure state, via one level-ordered stack pass so no row re-scans its ancestors.
48
81
  */
49
82
  function collectRows(host) {
50
83
  let elements = Array.from(host.querySelectorAll(`[${TREE_ITEM_ATTRIBUTE}]`));
@@ -63,7 +96,7 @@ function collectRows(host) {
63
96
  level,
64
97
  parent,
65
98
  hasChildren: nextLevel > level,
66
- expanded: element.getAttribute("aria-expanded") === "true",
99
+ expanded: isTreeItemExpanded(element),
67
100
  disabled: element.matches(DISABLED_SELECTOR),
68
101
  visible: parent === null || (parent.visible && parent.expanded),
69
102
  };
@@ -162,6 +195,20 @@ export const treeKeys = createMixin((handle) => {
162
195
  setRovingTabindex(rows.map((candidate) => candidate.element), row.element);
163
196
  }
164
197
  }),
198
+ on("toggle", (event) => {
199
+ if (!hostNode)
200
+ return;
201
+ let disclosure = event.target;
202
+ if (!(disclosure instanceof HTMLDetailsElement))
203
+ return;
204
+ let row = disclosure.querySelector(`:scope > ${SUMMARY_SELECTOR}[${TREE_ITEM_ATTRIBUTE}][aria-expanded]`);
205
+ if (!row)
206
+ return;
207
+ row.setAttribute("aria-expanded", disclosure.open ? "true" : "false");
208
+ refreshKeys(hostNode, model);
209
+ },
210
+ /* A `toggle` event stays on the `<details>` it fires at, so the host hears it on the way down. */
211
+ true),
165
212
  on("keydown", (event) => {
166
213
  if (!hostNode)
167
214
  return;
@@ -197,7 +244,7 @@ export const treeKeys = createMixin((handle) => {
197
244
  return;
198
245
  event.preventDefault();
199
246
  if (current.hasChildren && !current.expanded) {
200
- current.element.setAttribute("aria-expanded", "true");
247
+ setTreeItemExpanded(current.element, true);
201
248
  refreshKeys(hostNode, model);
202
249
  return;
203
250
  }
@@ -213,7 +260,7 @@ export const treeKeys = createMixin((handle) => {
213
260
  return;
214
261
  event.preventDefault();
215
262
  if (current.hasChildren && current.expanded) {
216
- current.element.setAttribute("aria-expanded", "false");
263
+ setTreeItemExpanded(current.element, false);
217
264
  refreshKeys(hostNode, model);
218
265
  return;
219
266
  }
@@ -61,5 +61,5 @@ export declare class ValidateChangeEvent extends Event {
61
61
  * <input name="email" type="email" required aria-describedby="email-error" mix={[validate(EmailSchema)]} />
62
62
  * <p id="email-error" data-field-error hidden />
63
63
  */
64
- export declare const validate: import("remix/ui").MixinFactory<HTMLElement, [schema: Schema<string, unknown>], import("remix/ui").ElementProps>;
64
+ export declare const validate: import("remix/ui").MixinFactory<HTMLElement, [schema: Schema<unknown, unknown>], import("remix/ui").ElementProps>;
65
65
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/ui",
3
- "version": "2026.9.14",
3
+ "version": "2026.9.29",
4
4
  "description": "Styled, accessible remix/ui components rendered as server HTML",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,11 +16,11 @@
16
16
  "./theme.css": "./src/theme.css"
17
17
  },
18
18
  "dependencies": {
19
- "@sdxc/icons": "2026.9.14",
20
- "@sdxc/u": "2026.9.14",
21
- "remix": "3.0.0-rc.2"
19
+ "@sdxc/icons": "2026.9.29",
20
+ "@sdxc/u": "2026.9.29",
21
+ "remix": "3.0.0-rc.4"
22
22
  },
23
- "gitHead": "069de2cb44985d682e160f9f4e72b06394b9a239",
23
+ "gitHead": "c17409b830b01b93514feb67818e3b1dcf654f5a",
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
package/src/reset.css CHANGED
@@ -1,9 +1,10 @@
1
1
  /*
2
2
  * Base reset: border-box sizing, zeroed margins/padding,
3
- * borders reset to "0 solid" so bare border-widths work later, form controls
4
- * that inherit font/color/line-height, transparent button/input backgrounds
5
- * with a sensible cursor, block-level media, and the rest of the usual
6
- * list/table/[hidden] normalizations.
3
+ * borders reset to "0 solid" so bare border-widths work later, the theme's
4
+ * sans font stack applied once at the document root for every element to
5
+ * inherit, form controls that inherit font/color/line-height, transparent
6
+ * button/input backgrounds with a sensible cursor, block-level media, and the
7
+ * rest of the usual list/table/[hidden] normalizations.
7
8
  *
8
9
  * Every selector is wrapped in :where(...) so the whole file carries zero
9
10
  * specificity and can never beat a component's own css() rules.
@@ -33,6 +34,7 @@
33
34
  }
34
35
 
35
36
  :where(html, :host) {
37
+ font-family: var(--ui-font-sans);
36
38
  line-height: 1.5;
37
39
  -webkit-text-size-adjust: 100%;
38
40
  tab-size: 4;
package/src/theme.css CHANGED
@@ -12,9 +12,13 @@
12
12
  *
13
13
  * This file adds only what's genuinely specific to this package on top of that base:
14
14
  * - Interaction-state variants (`-bg-tint-hover`, `-bg-tint-pressed`,
15
- * `-bg-solid-hover`, `-bg-solid-pressed`) that `@sdxc/u`'s own theme
16
- * contract doesn't define, since how much a color shifts on hover/press
17
- * is a component-library design decision, not a lower-level primitive.
15
+ * `-bg-solid-hover`, `-bg-solid-pressed`, `-border-hover`) that `@sdxc/u`'s
16
+ * own theme contract doesn't define, since how much a color shifts on
17
+ * hover/press is a component-library design decision, not a lower-level
18
+ * primitive. `-border-hover` sits one step along from the resting `-border`,
19
+ * well short of the `-border-strong` the contract reserves for focus,
20
+ * validity and the high-contrast promotion, so pointing at a control reads
21
+ * as a nudge rather than as a change of state.
18
22
  * - A `--ui-chart-{1..8}` categorical color sequence for multi-series
19
23
  * charts — a component-library concern, not a theme-contract concept.
20
24
  *
@@ -31,30 +35,35 @@
31
35
  --ui-brand-bg-tint-pressed: var(--ui-color-brand-200);
32
36
  --ui-brand-bg-solid-hover: var(--ui-color-brand-700);
33
37
  --ui-brand-bg-solid-pressed: var(--ui-color-brand-800);
38
+ --ui-brand-border-hover: var(--ui-color-brand-300);
34
39
 
35
40
  /* Neutral — solid backgrounds use inverted shades (dark on light) */
36
41
  --ui-neutral-bg-tint-hover: var(--ui-color-neutral-100);
37
42
  --ui-neutral-bg-tint-pressed: var(--ui-color-neutral-200);
38
43
  --ui-neutral-bg-solid-hover: var(--ui-color-neutral-800);
39
44
  --ui-neutral-bg-solid-pressed: var(--ui-color-neutral-700);
45
+ --ui-neutral-border-hover: var(--ui-color-neutral-300);
40
46
 
41
47
  /* Danger */
42
48
  --ui-danger-bg-tint-hover: var(--ui-color-danger-100);
43
49
  --ui-danger-bg-tint-pressed: var(--ui-color-danger-200);
44
50
  --ui-danger-bg-solid-hover: var(--ui-color-danger-700);
45
51
  --ui-danger-bg-solid-pressed: var(--ui-color-danger-800);
52
+ --ui-danger-border-hover: var(--ui-color-danger-300);
46
53
 
47
54
  /* Warning */
48
55
  --ui-warning-bg-tint-hover: var(--ui-color-warning-100);
49
56
  --ui-warning-bg-tint-pressed: var(--ui-color-warning-200);
50
57
  --ui-warning-bg-solid-hover: var(--ui-color-warning-700);
51
58
  --ui-warning-bg-solid-pressed: var(--ui-color-warning-800);
59
+ --ui-warning-border-hover: var(--ui-color-warning-300);
52
60
 
53
61
  /* Success */
54
62
  --ui-success-bg-tint-hover: var(--ui-color-success-100);
55
63
  --ui-success-bg-tint-pressed: var(--ui-color-success-200);
56
64
  --ui-success-bg-solid-hover: var(--ui-color-success-700);
57
65
  --ui-success-bg-solid-pressed: var(--ui-color-success-800);
66
+ --ui-success-border-hover: var(--ui-color-success-300);
58
67
 
59
68
  /* Chart: categorical sequence for multi-series charts */
60
69
  --ui-chart-1: var(--ui-color-brand-600);
@@ -73,26 +82,31 @@
73
82
  --ui-brand-bg-tint-pressed: var(--ui-color-brand-800);
74
83
  --ui-brand-bg-solid-hover: var(--ui-color-brand-700);
75
84
  --ui-brand-bg-solid-pressed: var(--ui-color-brand-800);
85
+ --ui-brand-border-hover: var(--ui-color-brand-700);
76
86
 
77
87
  --ui-neutral-bg-tint-hover: var(--ui-color-neutral-900);
78
88
  --ui-neutral-bg-tint-pressed: var(--ui-color-neutral-800);
79
89
  --ui-neutral-bg-solid-hover: var(--ui-color-neutral-200);
80
90
  --ui-neutral-bg-solid-pressed: var(--ui-color-neutral-300);
91
+ --ui-neutral-border-hover: var(--ui-color-neutral-600);
81
92
 
82
93
  --ui-danger-bg-tint-hover: var(--ui-color-danger-900);
83
94
  --ui-danger-bg-tint-pressed: var(--ui-color-danger-800);
84
95
  --ui-danger-bg-solid-hover: var(--ui-color-danger-700);
85
96
  --ui-danger-bg-solid-pressed: var(--ui-color-danger-800);
97
+ --ui-danger-border-hover: var(--ui-color-danger-700);
86
98
 
87
99
  --ui-warning-bg-tint-hover: var(--ui-color-warning-900);
88
100
  --ui-warning-bg-tint-pressed: var(--ui-color-warning-800);
89
101
  --ui-warning-bg-solid-hover: var(--ui-color-warning-700);
90
102
  --ui-warning-bg-solid-pressed: var(--ui-color-warning-800);
103
+ --ui-warning-border-hover: var(--ui-color-warning-700);
91
104
 
92
105
  --ui-success-bg-tint-hover: var(--ui-color-success-900);
93
106
  --ui-success-bg-tint-pressed: var(--ui-color-success-800);
94
107
  --ui-success-bg-solid-hover: var(--ui-color-success-700);
95
108
  --ui-success-bg-solid-pressed: var(--ui-color-success-800);
109
+ --ui-success-border-hover: var(--ui-color-success-700);
96
110
 
97
111
  /* Chart: categorical sequence for multi-series charts */
98
112
  --ui-chart-1: var(--ui-color-brand-400);
@@ -112,26 +126,31 @@
112
126
  --ui-brand-bg-tint-pressed: var(--ui-color-brand-800);
113
127
  --ui-brand-bg-solid-hover: var(--ui-color-brand-700);
114
128
  --ui-brand-bg-solid-pressed: var(--ui-color-brand-800);
129
+ --ui-brand-border-hover: var(--ui-color-brand-700);
115
130
 
116
131
  --ui-neutral-bg-tint-hover: var(--ui-color-neutral-900);
117
132
  --ui-neutral-bg-tint-pressed: var(--ui-color-neutral-800);
118
133
  --ui-neutral-bg-solid-hover: var(--ui-color-neutral-200);
119
134
  --ui-neutral-bg-solid-pressed: var(--ui-color-neutral-300);
135
+ --ui-neutral-border-hover: var(--ui-color-neutral-600);
120
136
 
121
137
  --ui-danger-bg-tint-hover: var(--ui-color-danger-900);
122
138
  --ui-danger-bg-tint-pressed: var(--ui-color-danger-800);
123
139
  --ui-danger-bg-solid-hover: var(--ui-color-danger-700);
124
140
  --ui-danger-bg-solid-pressed: var(--ui-color-danger-800);
141
+ --ui-danger-border-hover: var(--ui-color-danger-700);
125
142
 
126
143
  --ui-warning-bg-tint-hover: var(--ui-color-warning-900);
127
144
  --ui-warning-bg-tint-pressed: var(--ui-color-warning-800);
128
145
  --ui-warning-bg-solid-hover: var(--ui-color-warning-700);
129
146
  --ui-warning-bg-solid-pressed: var(--ui-color-warning-800);
147
+ --ui-warning-border-hover: var(--ui-color-warning-700);
130
148
 
131
149
  --ui-success-bg-tint-hover: var(--ui-color-success-900);
132
150
  --ui-success-bg-tint-pressed: var(--ui-color-success-800);
133
151
  --ui-success-bg-solid-hover: var(--ui-color-success-700);
134
152
  --ui-success-bg-solid-pressed: var(--ui-color-success-800);
153
+ --ui-success-border-hover: var(--ui-color-success-700);
135
154
 
136
155
  /* Chart: categorical sequence for multi-series charts */
137
156
  --ui-chart-1: var(--ui-color-brand-400);
@@ -144,3 +163,14 @@
144
163
  --ui-chart-8: var(--ui-color-warning-300);
145
164
  }
146
165
  }
166
+
167
+ /* High contrast: the resting border is already promoted, so its hover step follows it */
168
+ @media (prefers-contrast: more) {
169
+ :root {
170
+ --ui-brand-border-hover: var(--ui-brand-border-strong);
171
+ --ui-neutral-border-hover: var(--ui-neutral-border-strong);
172
+ --ui-success-border-hover: var(--ui-success-border-strong);
173
+ --ui-warning-border-hover: var(--ui-warning-border-strong);
174
+ --ui-danger-border-hover: var(--ui-danger-border-strong);
175
+ }
176
+ }