@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
@@ -1,13 +1,15 @@
1
1
  import { bg, border, outline } from "@sdxc/u/color";
2
- import { rounded, transition } from "@sdxc/u/effects";
3
- import { combine, raw } from "@sdxc/u/general";
2
+ import { rounded, shadow, transition, transitionDuration } from "@sdxc/u/effects";
3
+ import { combine, cursor, raw } from "@sdxc/u/general";
4
+ import { appearance } from "@sdxc/u/layout";
4
5
  import { media } from "@sdxc/u/responsive";
5
6
  import { bs, is } from "@sdxc/u/size";
6
7
  import { when } from "@sdxc/u/state";
8
+ import { scaleProperty } from "@sdxc/u/transform";
7
9
  /**
8
10
  * The declarations shared by both engines' thumb pseudo-elements; the
9
- * webkit-only appearance reset is composed separately by the caller. Its
10
- * box-shadow stays raw; no shared shadow-scale entry matches this value.
11
+ * webkit-only appearance reset is composed separately by the caller. The
12
+ * lift reads the theme's `--ui-shadow-base`, so it follows the app's shadow scale.
11
13
  */
12
14
  function thumbBase(size, borderWidth) {
13
15
  return combine([
@@ -16,10 +18,8 @@ function thumbBase(size, borderWidth) {
16
18
  rounded("full"),
17
19
  border({ color: "brand.solid", width: borderWidth }),
18
20
  bg("neutral.tint"),
19
- raw({
20
- boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
21
- cursor: "pointer",
22
- }),
21
+ shadow("base"),
22
+ cursor("pointer"),
23
23
  transition("box-shadow, scale", {
24
24
  duration: 150,
25
25
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -51,26 +51,25 @@ export function rangeThumbAppearance(sizeVariable, borderWidthVariable) {
51
51
  let size = `var(${sizeVariable}, 1.25rem)`;
52
52
  let borderWidth = `var(${borderWidthVariable}, 2px)`;
53
53
  return combine([
54
- when("&::-webkit-slider-thumb", combine([
55
- raw({ WebkitAppearance: "none", appearance: "none" }),
56
- thumbBase(size, borderWidth),
57
- ])),
54
+ when("&::-webkit-slider-thumb", combine([appearance("none", { moz: false }), thumbBase(size, borderWidth)])),
58
55
  when("&::-moz-range-thumb", thumbBase(size, borderWidth)),
59
- when("&:active::-webkit-slider-thumb", raw({ scale: "1.1" })),
60
- when("&:active::-moz-range-thumb", raw({ scale: "1.1" })),
56
+ when("&:active::-webkit-slider-thumb", scaleProperty(1.1)),
57
+ when("&:active::-moz-range-thumb", scaleProperty(1.1)),
61
58
  when("&:focus-visible::-webkit-slider-thumb", outline({ color: "brand.ring", offset: 2 })),
62
59
  when("&:focus-visible::-moz-range-thumb", outline({ color: "brand.ring", offset: 2 })),
63
60
  when("&:disabled::-webkit-slider-thumb", [
64
- raw({ cursor: "not-allowed", boxShadow: "none" }),
61
+ cursor("not-allowed"),
62
+ raw({ boxShadow: "none" }),
65
63
  border("neutral"),
66
64
  ]),
67
65
  when("&:disabled::-moz-range-thumb", [
68
- raw({ cursor: "not-allowed", boxShadow: "none" }),
66
+ cursor("not-allowed"),
67
+ raw({ boxShadow: "none" }),
69
68
  border("neutral"),
70
69
  ]),
71
70
  media("(prefers-reduced-motion: reduce)", [
72
- when("&::-webkit-slider-thumb", raw({ transitionDuration: "0s" })),
73
- when("&::-moz-range-thumb", raw({ transitionDuration: "0s" })),
71
+ when("&::-webkit-slider-thumb", transitionDuration("0s")),
72
+ when("&::-moz-range-thumb", transitionDuration("0s")),
74
73
  ]),
75
74
  ]);
76
75
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Reports which edges of a labelled control's content are elements rather than text,
3
+ * so a button can trim the padding beside a leading or trailing glyph — a question a
4
+ * selector cannot answer, since `:first-child` and `:last-child` skip text nodes.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Which edges of a control's rendered children are elements.
11
+ */
12
+ export interface GlyphEdges {
13
+ start: boolean;
14
+ end: boolean;
15
+ }
16
+ /**
17
+ * Reports whether the first and last rendered children are elements. A lone child has
18
+ * no label to balance, so it reports neither edge — an icon-only control is its own case.
19
+ *
20
+ * @param children A control's own `children` value.
21
+ * @returns Which edges hold an element beside a label.
22
+ * @example glyphEdges([<PlusIcon />, "Add"]) // { start: true, end: false }
23
+ */
24
+ export declare function glyphEdges(children: unknown): GlyphEdges;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Reports which edges of a labelled control's content are elements rather than text,
3
+ * so a button can trim the padding beside a leading or trailing glyph — a question a
4
+ * selector cannot answer, since `:first-child` and `:last-child` skip text nodes.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Whether a rendered child is an element: a non-array object, which is the shape a JSX
11
+ * element takes, as opposed to text, numbers, or a nested list.
12
+ *
13
+ * @param child One rendered child.
14
+ * @returns Whether `child` renders an element.
15
+ */
16
+ function isElementNode(child) {
17
+ return typeof child === "object" && child !== null && !Array.isArray(child);
18
+ }
19
+ /**
20
+ * Whether a child renders anything: `null`, `undefined`, booleans, and whitespace-only
21
+ * strings occupy a JSX slot but draw nothing, so they never count as an edge.
22
+ *
23
+ * @param child One child slot.
24
+ * @returns Whether `child` renders visible content.
25
+ */
26
+ function rendersSomething(child) {
27
+ if (child === null || child === undefined || typeof child === "boolean")
28
+ return false;
29
+ return !(typeof child === "string" && child.trim() === "");
30
+ }
31
+ /**
32
+ * Reports whether the first and last rendered children are elements. A lone child has
33
+ * no label to balance, so it reports neither edge — an icon-only control is its own case.
34
+ *
35
+ * @param children A control's own `children` value.
36
+ * @returns Which edges hold an element beside a label.
37
+ * @example glyphEdges([<PlusIcon />, "Add"]) // { start: true, end: false }
38
+ */
39
+ export function glyphEdges(children) {
40
+ if (!Array.isArray(children))
41
+ return { start: false, end: false };
42
+ let rendered = children.filter(rendersSomething);
43
+ if (rendered.length < 2)
44
+ return { start: false, end: false };
45
+ return { start: isElementNode(rendered[0]), end: isElementNode(rendered[rendered.length - 1]) };
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/ui",
3
- "version": "2026.10.12",
3
+ "version": "2026.10.14",
4
4
  "description": "Styled, accessible remix/component components rendered as server HTML",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,11 +17,12 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@remix-run/ui": "0.12.1",
20
- "@sdxc/icons": "2026.10.12",
21
- "@sdxc/u": "2026.10.2",
20
+ "@sdxc/icons": "2026.10.13",
21
+ "@sdxc/u": "2026.10.13",
22
+ "@sdxc/uuid": "2026.10.13",
22
23
  "remix": "3.0.0"
23
24
  },
24
- "gitHead": "857ef87ddb0b2484e28b46431d0740fcc80e5f33",
25
+ "gitHead": "2981b3f8283031e5e2d347864fa40c6a48d21247",
25
26
  "publishConfig": {
26
27
  "access": "public"
27
28
  },
package/src/reset.css CHANGED
@@ -2,7 +2,8 @@
2
2
  * Base reset: border-box sizing, zeroed margins/padding,
3
3
  * borders reset to "0 solid" so bare border-widths work later, the theme's
4
4
  * sans font stack applied once at the document root for every element to
5
- * inherit, MathML drawn in the system's math font, form controls that inherit
5
+ * inherit, grayscale antialiasing on macOS so light-on-dark text renders at
6
+ * its designed weight instead of the heavier subpixel default, MathML drawn in the system's math font, form controls that inherit
6
7
  * font/color/line-height, transparent button/input backgrounds with a sensible
7
8
  * cursor, block-level media, the theme's focus ring for keyboard focus, and the
8
9
  * rest of the usual list/table/[hidden] normalizations.
@@ -42,6 +43,8 @@
42
43
  -webkit-text-size-adjust: 100%;
43
44
  tab-size: 4;
44
45
  -webkit-tap-highlight-color: transparent;
46
+ -webkit-font-smoothing: antialiased;
47
+ -moz-osx-font-smoothing: grayscale;
45
48
  }
46
49
 
47
50
  /*
package/src/theme.css CHANGED
@@ -21,6 +21,13 @@
21
21
  * as a nudge rather than as a change of state.
22
22
  * - A `--ui-chart-{1..8}` categorical color sequence for multi-series
23
23
  * charts — a component-library concern, not a theme-contract concept.
24
+ * - `--ui-target-size`, the smallest pointer target `hitArea()` grows a small
25
+ * control to: 24px (WCAG 2.5.8) by default, 44px under `pointer: coarse`.
26
+ * - `--ui-shadow-ring` / `--ui-shadow-ring-hover`, the hairline ring plus soft
27
+ * lift an elevated surface draws its edge with, so the edge takes on the
28
+ * tone of whatever sits behind it; high contrast turns it into a solid line.
29
+ * - `--ui-image-outline`, the inset hairline that keeps an image's edge
30
+ * visible against a background of the same tone.
24
31
  *
25
32
  * Dark Mode:
26
33
  * - Add .dark class to <html> for forced dark mode
@@ -74,6 +81,25 @@
74
81
  --ui-chart-6: var(--ui-color-brand-400);
75
82
  --ui-chart-7: var(--ui-color-success-400);
76
83
  --ui-chart-8: var(--ui-color-warning-400);
84
+
85
+ /* Pointer targets: WCAG 2.5.8 minimum, the floor hitArea() grows small controls to */
86
+ --ui-target-size: 1.5rem;
87
+
88
+ /* Elevated surfaces: a translucent hairline ring plus a soft lift */
89
+ --ui-shadow-ring:
90
+ 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06), 0 2px 4px 0 rgb(0 0 0 / 0.04);
91
+ --ui-shadow-ring-hover:
92
+ 0 0 0 1px rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08), 0 2px 4px 0 rgb(0 0 0 / 0.06);
93
+
94
+ /* Images: an inset hairline that holds the edge against a same-tone background */
95
+ --ui-image-outline: rgb(0 0 0 / 0.1);
96
+ }
97
+
98
+ /* Touch input: grow every hitArea() target to the 44px a fingertip needs */
99
+ @media (pointer: coarse) {
100
+ :root {
101
+ --ui-target-size: 2.75rem;
102
+ }
77
103
  }
78
104
 
79
105
  /* Forced dark mode */
@@ -117,6 +143,12 @@
117
143
  --ui-chart-6: var(--ui-color-brand-300);
118
144
  --ui-chart-7: var(--ui-color-success-300);
119
145
  --ui-chart-8: var(--ui-color-warning-300);
146
+
147
+ /* Elevated surfaces: a light hairline reads as the edge where a shadow cannot */
148
+ --ui-shadow-ring: 0 0 0 1px rgb(255 255 255 / 0.08);
149
+ --ui-shadow-ring-hover: 0 0 0 1px rgb(255 255 255 / 0.12);
150
+
151
+ --ui-image-outline: rgb(255 255 255 / 0.1);
120
152
  }
121
153
 
122
154
  /* System-preference dark mode */
@@ -161,16 +193,31 @@
161
193
  --ui-chart-6: var(--ui-color-brand-300);
162
194
  --ui-chart-7: var(--ui-color-success-300);
163
195
  --ui-chart-8: var(--ui-color-warning-300);
196
+
197
+ /* Elevated surfaces: a light hairline reads as the edge where a shadow cannot */
198
+ --ui-shadow-ring: 0 0 0 1px rgb(255 255 255 / 0.08);
199
+ --ui-shadow-ring-hover: 0 0 0 1px rgb(255 255 255 / 0.12);
200
+
201
+ --ui-image-outline: rgb(255 255 255 / 0.1);
164
202
  }
165
203
  }
166
204
 
167
- /* High contrast: the resting border is already promoted, so its hover step follows it */
205
+ /*
206
+ * High contrast: the resting border is already promoted, so its hover step follows it,
207
+ * and an elevated surface's ring becomes a solid line in that promoted border color.
208
+ * Listed after both dark blocks and matching the same elements, so it wins in every scheme.
209
+ */
168
210
  @media (prefers-contrast: more) {
169
- :root {
211
+ :root,
212
+ :is(.dark, .dark *),
213
+ :is(.system, .system *) {
170
214
  --ui-brand-border-hover: var(--ui-brand-border-strong);
171
215
  --ui-neutral-border-hover: var(--ui-neutral-border-strong);
172
216
  --ui-success-border-hover: var(--ui-success-border-strong);
173
217
  --ui-warning-border-hover: var(--ui-warning-border-strong);
174
218
  --ui-danger-border-hover: var(--ui-danger-border-strong);
219
+
220
+ --ui-shadow-ring: 0 0 0 1px var(--ui-neutral-border-strong);
221
+ --ui-shadow-ring-hover: 0 0 0 1px var(--ui-neutral-border-strong);
175
222
  }
176
223
  }