@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.
- package/README.md +524 -668
- package/dist/animations/transitions.d.ts +45 -20
- package/dist/animations/transitions.js +108 -35
- package/dist/behaviors/announcer.js +2 -1
- package/dist/behaviors/toaster.js +2 -1
- package/dist/components/accordion.js +5 -9
- package/dist/components/alert-dialog.js +3 -3
- package/dist/components/alert.js +11 -2
- package/dist/components/attachment.js +1 -1
- package/dist/components/badge.js +2 -1
- package/dist/components/breadcrumbs.js +17 -9
- package/dist/components/bubble.js +6 -5
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.js +61 -20
- package/dist/components/calendar.js +12 -8
- package/dist/components/card.d.ts +5 -3
- package/dist/components/card.js +32 -14
- package/dist/components/carousel.js +4 -6
- package/dist/components/chart.js +5 -4
- package/dist/components/checkbox.js +2 -2
- package/dist/components/color-picker.js +8 -11
- package/dist/components/color-slider.js +16 -5
- package/dist/components/color-swatch-picker.js +7 -4
- package/dist/components/color-wheel.js +7 -9
- package/dist/components/combobox.js +5 -1
- package/dist/components/command.d.ts +3 -3
- package/dist/components/command.js +25 -28
- package/dist/components/context-menu.js +4 -4
- package/dist/components/date-field.js +2 -1
- package/dist/components/date-picker.js +12 -16
- package/dist/components/description.js +2 -2
- package/dist/components/dialog.js +19 -15
- package/dist/components/disclosure.js +15 -17
- package/dist/components/drawer.d.ts +5 -5
- package/dist/components/drawer.js +38 -33
- package/dist/components/drop-indicator.js +4 -10
- package/dist/components/empty.js +13 -6
- package/dist/components/field-error.js +2 -1
- package/dist/components/file-trigger.js +7 -10
- package/dist/components/grid-list.js +15 -16
- package/dist/components/group.js +5 -6
- package/dist/components/heading.js +2 -1
- package/dist/components/hover-card.js +4 -5
- package/dist/components/image-placeholder.js +17 -12
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input.js +8 -11
- package/dist/components/item.js +4 -7
- package/dist/components/keyboard.js +9 -9
- package/dist/components/link-button.js +26 -8
- package/dist/components/listbox.d.ts +3 -2
- package/dist/components/listbox.js +9 -8
- package/dist/components/menu.js +6 -6
- package/dist/components/menubar.js +6 -5
- package/dist/components/message-scroller.js +4 -6
- package/dist/components/message.js +2 -2
- package/dist/components/meter.js +2 -2
- package/dist/components/modal.d.ts +2 -2
- package/dist/components/modal.js +12 -24
- package/dist/components/navigation-menu.js +5 -4
- package/dist/components/number-field.js +6 -6
- package/dist/components/overlay-arrow.js +2 -2
- package/dist/components/pagination.js +3 -1
- package/dist/components/popover.js +7 -19
- package/dist/components/progress-bar.js +2 -2
- package/dist/components/range-calendar.js +5 -3
- package/dist/components/resizable.js +8 -3
- package/dist/components/search-field.js +7 -7
- package/dist/components/select.js +26 -39
- package/dist/components/sheet.js +30 -22
- package/dist/components/shortcut-list.js +2 -2
- package/dist/components/sidebar.js +24 -22
- package/dist/components/slider.d.ts +3 -3
- package/dist/components/slider.js +18 -6
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +15 -2
- package/dist/components/table.js +36 -14
- package/dist/components/tag-group.js +10 -5
- package/dist/components/text.js +2 -2
- package/dist/components/time-field.js +2 -1
- package/dist/components/toast.js +5 -2
- package/dist/components/toggle-button.js +28 -12
- package/dist/components/tree.js +9 -5
- package/dist/components/typeset.js +5 -2
- package/dist/components/youtube-embed.d.ts +35 -0
- package/dist/components/youtube-embed.js +29 -0
- package/dist/mixins/carousel-controls.js +11 -15
- package/dist/mixins/clear-field.js +4 -5
- package/dist/mixins/context-menu.js +5 -8
- package/dist/mixins/grid-list-keys.js +5 -2
- package/dist/mixins/listbox-keys.js +1 -1
- package/dist/mixins/message-follow.js +7 -13
- package/dist/mixins/treeKeys.js +5 -3
- package/dist/styles/floating-surface.d.ts +62 -14
- package/dist/styles/floating-surface.js +67 -10
- package/dist/styles/hit-area.d.ts +36 -0
- package/dist/styles/hit-area.js +48 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/styles/output-caption-text.d.ts +3 -2
- package/dist/styles/output-caption-text.js +4 -3
- package/dist/styles/range-thumb-appearance.js +17 -18
- package/dist/utils/glyph-edges.d.ts +24 -0
- package/dist/utils/glyph-edges.js +46 -0
- package/package.json +5 -4
- package/src/reset.css +4 -1
- package/src/theme.css +49 -2
|
@@ -3,12 +3,13 @@ import { GripVerticalIcon } from "@sdxc/icons";
|
|
|
3
3
|
import { bg, borderEdge, fg, outline } from "@sdxc/u/color";
|
|
4
4
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
5
5
|
import { cursor } from "@sdxc/u/general";
|
|
6
|
-
import { container, flex, flexCol, gap, grid, gridTemplate, items, shrink, virtualize, } from "@sdxc/u/layout";
|
|
6
|
+
import { container, flex, flexCol, gap, grid, gridTemplate, items, relative, shrink, virtualize, } from "@sdxc/u/layout";
|
|
7
7
|
import { at } from "@sdxc/u/responsive";
|
|
8
8
|
import { bs, is, mbs, pb, pbs, pi } from "@sdxc/u/size";
|
|
9
9
|
import { active, data, not, when } from "@sdxc/u/state";
|
|
10
10
|
import { text, textTransform, tracking, weight } from "@sdxc/u/typography";
|
|
11
11
|
import { attrs } from "remix/component";
|
|
12
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
12
13
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
14
|
import { panelChrome } from "../styles/panel-chrome.js";
|
|
14
15
|
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
@@ -112,24 +113,20 @@ GridList.Item = function GridListItem(handle) {
|
|
|
112
113
|
flex(),
|
|
113
114
|
items("center"),
|
|
114
115
|
gap(2),
|
|
115
|
-
|
|
116
|
-
* A glyph
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* however much that row's own text overruns, so every row lands on a
|
|
120
|
-
* different width and the column of glyphs reads as a rendering fault.
|
|
116
|
+
/**
|
|
117
|
+
* A leading glyph is sized against the row's text and holds that size when the row runs
|
|
118
|
+
* short; the default `flex-shrink: 1` would squeeze each glyph by its own row's overrun
|
|
119
|
+
* and leave the column of glyphs ragged.
|
|
121
120
|
*/
|
|
122
121
|
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
123
122
|
rounded("md"),
|
|
124
123
|
pb(2),
|
|
125
124
|
pi(2),
|
|
126
125
|
fg("neutral.emphasis"),
|
|
127
|
-
|
|
128
|
-
* A selected row
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* selection are written as selectors that exclude each other, so a hovered
|
|
132
|
-
* row keeps saying it is selected whichever order the layers land in.
|
|
126
|
+
/**
|
|
127
|
+
* A selected row is tinted far enough off the surface to read at a glance; the plain tint
|
|
128
|
+
* matches the list's background. Pointer and selection states use mutually exclusive
|
|
129
|
+
* selectors, so a hovered row stays visibly selected whichever order the layers land in.
|
|
133
130
|
*/
|
|
134
131
|
when('&:hover:not([aria-selected="true"])', bg("neutral.bg-tint-hover")),
|
|
135
132
|
when('&:active:not([aria-selected="true"])', bg("neutral.bg-tint-pressed")),
|
|
@@ -210,9 +207,9 @@ GridList.Header = function GridListHeader(handle) {
|
|
|
210
207
|
*/
|
|
211
208
|
GridList.LoadMoreItem = SentinelRow;
|
|
212
209
|
/**
|
|
213
|
-
* Renders
|
|
214
|
-
*
|
|
215
|
-
*
|
|
210
|
+
* Renders a row's drag grip as a native `<button type="button">` written before the
|
|
211
|
+
* consumer's attributes, so a `command`/`commandfor` pair still runs inside a `<form>`;
|
|
212
|
+
* its pointer target grows to `--ui-target-size` around the 16px glyph.
|
|
216
213
|
*
|
|
217
214
|
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
218
215
|
* @returns The render function producing the handle's markup.
|
|
@@ -227,6 +224,8 @@ GridList.DragHandle = function GridListDragHandle(handle) {
|
|
|
227
224
|
let { mix, ...rest } = handle.props;
|
|
228
225
|
return (_jsx("button", { type: "button", ...rest, mix: [
|
|
229
226
|
attrs({ role: DEFAULT_DRAG_HANDLE_ROLE, "data-drag-handle": DEFAULT_DRAG_HANDLE_MARKER }),
|
|
227
|
+
relative(),
|
|
228
|
+
hitArea(),
|
|
230
229
|
fg("neutral.muted"),
|
|
231
230
|
cursor("grab"),
|
|
232
231
|
active(cursor("grabbing")),
|
package/dist/components/group.js
CHANGED
|
@@ -39,7 +39,7 @@ export function Group(handle) {
|
|
|
39
39
|
attrs({ role: DEFAULT_ROLE }),
|
|
40
40
|
flex(),
|
|
41
41
|
items("center"),
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
43
|
* The controls compose into one shape, so the cluster keeps the rounding on
|
|
44
44
|
* its own outer corners and the seam where two of them meet is drawn once.
|
|
45
45
|
*/
|
|
@@ -52,11 +52,10 @@ export function Group(handle) {
|
|
|
52
52
|
roundedCorner("start-end", "none"),
|
|
53
53
|
roundedCorner("end-end", "none"),
|
|
54
54
|
]),
|
|
55
|
-
|
|
56
|
-
* Focus
|
|
57
|
-
* cluster
|
|
58
|
-
*
|
|
59
|
-
* neighbour rather than being painted over by it.
|
|
55
|
+
/**
|
|
56
|
+
* Focus shows on the control holding it, naming which control has it where a ring
|
|
57
|
+
* around the cluster names only the group. That control is raised so its ring
|
|
58
|
+
* crosses the seam it shares with a neighbour.
|
|
60
59
|
*/
|
|
61
60
|
when("& > *:focus-visible", z(1)),
|
|
62
61
|
when('&[aria-invalid="true"] > *:focus-visible', outlineColor("danger")),
|
|
@@ -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 { fontSize, leading, tracking, weight } from "@sdxc/u/typography";
|
|
3
|
+
import { balance, fontSize, leading, tracking, weight } from "@sdxc/u/typography";
|
|
4
4
|
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
5
5
|
/**
|
|
6
6
|
* Renders its children inside the native heading element matching `level`,
|
|
@@ -25,6 +25,7 @@ export function Heading(handle) {
|
|
|
25
25
|
fg("neutral.emphasis"),
|
|
26
26
|
fontSize("lg"),
|
|
27
27
|
leading("none"),
|
|
28
|
+
balance(),
|
|
28
29
|
mix,
|
|
29
30
|
] }));
|
|
30
31
|
};
|
|
@@ -39,10 +39,9 @@ export function HoverCard(handle) {
|
|
|
39
39
|
media("(hover: hover)", when('&:hover [data-slot="hover-card-content"]', [
|
|
40
40
|
opacity(100),
|
|
41
41
|
visibility(),
|
|
42
|
-
|
|
43
|
-
* An open card is something the reader reaches into, so it takes the
|
|
44
|
-
*
|
|
45
|
-
* its own cascade sublayer ordered by first appearance, and the resting
|
|
42
|
+
/**
|
|
43
|
+
* An open card is something the reader reaches into, so it takes the pointer.
|
|
44
|
+
* `!important` settles it: each mix entry gets its own cascade sublayer, and the resting
|
|
46
45
|
* state's own rule may land in a later one.
|
|
47
46
|
*/
|
|
48
47
|
raw({
|
|
@@ -133,7 +132,7 @@ HoverCard.Content = function HoverCardContent(handle) {
|
|
|
133
132
|
marginLeft("var(--ui-popover-offset, 0.5rem)"),
|
|
134
133
|
raw({ left: "100%" }),
|
|
135
134
|
]),
|
|
136
|
-
|
|
135
|
+
/**
|
|
137
136
|
* The card rests off its trigger's edge, and a pointer travelling between the
|
|
138
137
|
* two crosses that space, so the card's own hit area reaches back across it
|
|
139
138
|
* and the pair reads as one surface for as long as the pointer is on either.
|
|
@@ -6,7 +6,7 @@ import { absolute, center, flex, inlineFlex, insBe, insIe, inset, items, justify
|
|
|
6
6
|
import { overflow } from "@sdxc/u/overflow";
|
|
7
7
|
import { bs, fit, is, mis } from "@sdxc/u/size";
|
|
8
8
|
import { data, precededBy, when } from "@sdxc/u/state";
|
|
9
|
-
import { text, textTransform, weight } from "@sdxc/u/typography";
|
|
9
|
+
import { tabularNums, text, textTransform, weight } from "@sdxc/u/typography";
|
|
10
10
|
/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */
|
|
11
11
|
const DEFAULT_SIZE = "md";
|
|
12
12
|
/**
|
|
@@ -14,6 +14,11 @@ const DEFAULT_SIZE = "md";
|
|
|
14
14
|
* fall back to when `shape` is omitted.
|
|
15
15
|
*/
|
|
16
16
|
const DEFAULT_SHAPE = "circle";
|
|
17
|
+
/**
|
|
18
|
+
* The inset hairline {@link ImagePlaceholder.Image} draws over a picture's
|
|
19
|
+
* edge, read from the theme's `--ui-image-outline`, which flips for dark mode.
|
|
20
|
+
*/
|
|
21
|
+
const IMAGE_OUTLINE = "var(--ui-image-outline, rgb(0 0 0 / 0.1))";
|
|
17
22
|
/**
|
|
18
23
|
* Renders the placeholder host: a fixed-size, centered box whose `data-shape`
|
|
19
24
|
* attribute styles it, its image, and its fallback together, leaving room
|
|
@@ -75,9 +80,9 @@ export function ImagePlaceholder(handle) {
|
|
|
75
80
|
};
|
|
76
81
|
}
|
|
77
82
|
/**
|
|
78
|
-
* Renders the placeholder's image layer: an `<img>` cropped
|
|
79
|
-
*
|
|
80
|
-
*
|
|
83
|
+
* Renders the placeholder's image layer: an `<img>` cropped to cover, clipped to
|
|
84
|
+
* {@link ImagePlaceholder}'s `data-shape`, its inset hairline holding the edge on
|
|
85
|
+
* a same-tone background. Its order against {@link ImagePlaceholder.Fallback} decides what shows.
|
|
81
86
|
*
|
|
82
87
|
* @param handle Runtime handle carrying the host `<img>`'s props.
|
|
83
88
|
* @returns The render function producing the image layer's markup.
|
|
@@ -94,6 +99,7 @@ ImagePlaceholder.Image = function ImagePlaceholderImage(handle) {
|
|
|
94
99
|
fit("cover"),
|
|
95
100
|
inset(0, 0, 0, 0),
|
|
96
101
|
overflow("hidden"),
|
|
102
|
+
outline({ color: IMAGE_OUTLINE, width: 1, offset: -1 }),
|
|
97
103
|
mix,
|
|
98
104
|
] }));
|
|
99
105
|
};
|
|
@@ -112,12 +118,10 @@ ImagePlaceholder.Fallback = function ImagePlaceholderFallback(handle) {
|
|
|
112
118
|
return () => {
|
|
113
119
|
let { children, mix, ...rest } = handle.props;
|
|
114
120
|
return (_jsx("span", { ...rest, "data-slot": "fallback", mix: [
|
|
115
|
-
|
|
116
|
-
* Both layers fill the host
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* stands down through `visibility`, which no other rule here sets, so the
|
|
120
|
-
* order the page declared these rules in cannot bring it back.
|
|
121
|
+
/**
|
|
122
|
+
* Both layers fill the host and this one follows the image, so it hides while an unbroken
|
|
123
|
+
* image is present and takes over once the image fails. It hides through `visibility`,
|
|
124
|
+
* which no other rule here sets, so declaration order keeps it hidden.
|
|
121
125
|
*/
|
|
122
126
|
precededBy('img[data-slot="image"]:not([data-image-error])', visibility("hidden")),
|
|
123
127
|
absolute(),
|
|
@@ -185,8 +189,8 @@ ImagePlaceholder.Group = function ImagePlaceholderGroup(handle) {
|
|
|
185
189
|
};
|
|
186
190
|
/**
|
|
187
191
|
* Renders the "+N" overflow indicator trailing {@link ImagePlaceholder.Group}:
|
|
188
|
-
* a
|
|
189
|
-
*
|
|
192
|
+
* a medium box matching {@link ImagePlaceholder}'s size, ring and `shape`, its
|
|
193
|
+
* tabular digits keeping a changing count the same width.
|
|
190
194
|
*
|
|
191
195
|
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
192
196
|
* @returns The render function producing the overflow indicator's markup.
|
|
@@ -213,6 +217,7 @@ ImagePlaceholder.GroupCount = function ImagePlaceholderGroupCount(handle) {
|
|
|
213
217
|
is("var(--ui-image-placeholder-size-md, 2.5rem)"),
|
|
214
218
|
bs("var(--ui-image-placeholder-size-md, 2.5rem)"),
|
|
215
219
|
text("sm"),
|
|
220
|
+
tabularNums(),
|
|
216
221
|
ringShadow("neutral.tint"),
|
|
217
222
|
mix,
|
|
218
223
|
], children: children }));
|
package/dist/components/index.js
CHANGED
package/dist/components/input.js
CHANGED
|
@@ -46,19 +46,16 @@ export function Input(handle) {
|
|
|
46
46
|
pb(2),
|
|
47
47
|
when("&::placeholder", fg("neutral.muted")),
|
|
48
48
|
hover(border("neutral.border-hover")),
|
|
49
|
-
|
|
50
|
-
* Focus
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* thick slab, which says the field changed shape rather than that it took
|
|
54
|
-
* focus. The border only steps to its hover weight, so nothing jumps.
|
|
49
|
+
/**
|
|
50
|
+
* Focus draws a ring standing off the field, as every button here does, and the border
|
|
51
|
+
* steps only to its hover weight: a strong border flush with the ring reads as the field
|
|
52
|
+
* changing shape.
|
|
55
53
|
*/
|
|
56
54
|
when("&:focus", border("neutral.border-hover")),
|
|
57
|
-
|
|
58
|
-
* Pointer focus drops the platform outline
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* layer resets the ring's color, width and style all at once.
|
|
55
|
+
/**
|
|
56
|
+
* Pointer focus drops the platform outline and keyboard focus keeps the ring below. The
|
|
57
|
+
* selectors exclude each other because `outline: none` is a shorthand, and from a later
|
|
58
|
+
* cascade layer it resets the ring's color, width and style at once.
|
|
62
59
|
*/
|
|
63
60
|
when("&:focus:not(:focus-visible)", outline("none")),
|
|
64
61
|
focusVisible([
|
package/dist/components/item.js
CHANGED
|
@@ -57,13 +57,10 @@ export function Item(handle) {
|
|
|
57
57
|
pb("var(--ui-item-padding-block, 0.625rem)"),
|
|
58
58
|
pi("var(--ui-item-padding-inline, 0.75rem)"),
|
|
59
59
|
container(CONTAINER_NAME),
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* container query cannot change the layout of the container it measures — and
|
|
65
|
-
* the row would hold `nowrap` while its actions took the whole line, leaving
|
|
66
|
-
* the content with nothing.
|
|
60
|
+
/**
|
|
61
|
+
* The row wraps at every width, and {@link Item.Actions} claiming a full line once the
|
|
62
|
+
* row is narrow decides when it does; a query on this row's own container can only
|
|
63
|
+
* restyle its descendants, never the row itself.
|
|
67
64
|
*/
|
|
68
65
|
flexWrap("wrap"),
|
|
69
66
|
mix,
|
|
@@ -3,7 +3,7 @@ import { bg, border, fg } from "@sdxc/u/color";
|
|
|
3
3
|
import { rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { inlineFlex, items, justify } from "@sdxc/u/layout";
|
|
5
5
|
import { bs, minIs, mis, pi } from "@sdxc/u/size";
|
|
6
|
-
import { leading, text } from "@sdxc/u/typography";
|
|
6
|
+
import { leading, tabularNums, text } from "@sdxc/u/typography";
|
|
7
7
|
/**
|
|
8
8
|
* Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start
|
|
9
9
|
* auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,
|
|
@@ -19,18 +19,17 @@ export function Keyboard(handle) {
|
|
|
19
19
|
let { mix, ...rest } = handle.props;
|
|
20
20
|
return (_jsx("kbd", { ...rest, mix: [
|
|
21
21
|
mis("auto"),
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
/*
|
|
27
|
-
* The cap centers its glyph without `center()`, because that pattern composes
|
|
28
|
-
* `flex()` and would turn the cap into a block of its own — a key standing on
|
|
29
|
-
* its own line in the middle of the sentence naming it.
|
|
22
|
+
/**
|
|
23
|
+
* The cap centers its glyph as an inline box, so a key sits inside the sentence
|
|
24
|
+
* naming it; `center()` composes `flex()` and would put the key on a line of its own.
|
|
30
25
|
*/
|
|
31
26
|
inlineFlex(),
|
|
32
27
|
items("center"),
|
|
33
28
|
justify("center"),
|
|
29
|
+
/**
|
|
30
|
+
* A cap keeps its height and a minimum width whatever it holds, so a single
|
|
31
|
+
* letter and a two-glyph chord sit on the same line as each other.
|
|
32
|
+
*/
|
|
34
33
|
bs("1.25rem"),
|
|
35
34
|
minIs("1.25rem"),
|
|
36
35
|
pi(1.5),
|
|
@@ -40,6 +39,7 @@ export function Keyboard(handle) {
|
|
|
40
39
|
fg("neutral"),
|
|
41
40
|
text("xs"),
|
|
42
41
|
leading("none"),
|
|
42
|
+
tabularNums(),
|
|
43
43
|
mix,
|
|
44
44
|
] }));
|
|
45
45
|
};
|
|
@@ -3,10 +3,12 @@ import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, pointerEvents, userSelect } from "@sdxc/u/general";
|
|
5
5
|
import { gap, inlineFlex, items, justify, shrink } from "@sdxc/u/layout";
|
|
6
|
-
import { bs, is, minBs, pb, pi } from "@sdxc/u/size";
|
|
6
|
+
import { bs, is, minBs, pb, pi, pie, pis } from "@sdxc/u/size";
|
|
7
7
|
import { active, data, hover, when } from "@sdxc/u/state";
|
|
8
8
|
import { text, weight } from "@sdxc/u/typography";
|
|
9
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
9
10
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
11
|
+
import { glyphEdges } from "../utils/glyph-edges.js";
|
|
10
12
|
/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */
|
|
11
13
|
const DEFAULT_COLOR = "neutral";
|
|
12
14
|
/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */
|
|
@@ -29,11 +31,12 @@ const DEFAULT_SIZE = "md";
|
|
|
29
31
|
*/
|
|
30
32
|
export function LinkButton(handle) {
|
|
31
33
|
return () => {
|
|
32
|
-
let { color, variant, size, mix, ...rest } = handle.props;
|
|
34
|
+
let { color, variant, size, children, mix, ...rest } = handle.props;
|
|
33
35
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
34
36
|
let resolvedVariant = variant ?? DEFAULT_VARIANT;
|
|
35
37
|
let resolvedSize = size ?? DEFAULT_SIZE;
|
|
36
|
-
|
|
38
|
+
let edges = glyphEdges(children);
|
|
39
|
+
return (_jsx("a", { ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-glyph-start": edges.start || undefined, "data-glyph-end": edges.end || undefined, mix: [
|
|
37
40
|
when("&:focus-visible", [
|
|
38
41
|
outline({ color: "brand.ring", offset: 2 }),
|
|
39
42
|
data("color", "neutral", outline("neutral.ring")),
|
|
@@ -56,6 +59,8 @@ export function LinkButton(handle) {
|
|
|
56
59
|
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
57
60
|
rounded("md"),
|
|
58
61
|
weight("medium"),
|
|
62
|
+
/** A small control reaches `--ui-target-size` however a consumer positions it. */
|
|
63
|
+
hitArea({ anchor: "flex-center" }),
|
|
59
64
|
pi(4),
|
|
60
65
|
pb(2),
|
|
61
66
|
/**
|
|
@@ -64,10 +69,9 @@ export function LinkButton(handle) {
|
|
|
64
69
|
* render at the same footprint.
|
|
65
70
|
*/
|
|
66
71
|
border({ width: 1 }),
|
|
67
|
-
|
|
68
|
-
* The row measure is stated
|
|
69
|
-
*
|
|
70
|
-
* Group fuses the two, and still grows when a long label wraps.
|
|
72
|
+
/**
|
|
73
|
+
* The row measure is stated, so the control lines up with a field of the same size when
|
|
74
|
+
* a Group fuses the two, and still grows when a long label wraps.
|
|
71
75
|
*/
|
|
72
76
|
minBs("2.5rem"),
|
|
73
77
|
data("size", "sm", [pi(3), pb(1.5), minBs("2rem"), when("& > svg", [is(3), bs(3)])]),
|
|
@@ -78,6 +82,20 @@ export function LinkButton(handle) {
|
|
|
78
82
|
minBs("3rem"),
|
|
79
83
|
when("& > svg", [is(5), bs(5)]),
|
|
80
84
|
]),
|
|
85
|
+
/**
|
|
86
|
+
* A glyph beside a label carries its own side bearing, so the padding on that
|
|
87
|
+
* side drops one step and the glyph and the words read as evenly inset.
|
|
88
|
+
*/
|
|
89
|
+
when("&[data-glyph-start]:has(> svg:first-child)", [
|
|
90
|
+
pis(3),
|
|
91
|
+
data("size", "sm", pis(2)),
|
|
92
|
+
data("size", "lg", pis(4)),
|
|
93
|
+
]),
|
|
94
|
+
when("&[data-glyph-end]:has(> svg:last-child)", [
|
|
95
|
+
pie(3),
|
|
96
|
+
data("size", "sm", pie(2)),
|
|
97
|
+
data("size", "lg", pie(4)),
|
|
98
|
+
]),
|
|
81
99
|
data("variant", "solid", [
|
|
82
100
|
data("color", "brand", [
|
|
83
101
|
bg("brand.solid"),
|
|
@@ -183,6 +201,6 @@ export function LinkButton(handle) {
|
|
|
183
201
|
text("sm"),
|
|
184
202
|
data("size", "sm", text("xs")),
|
|
185
203
|
mix,
|
|
186
|
-
] }));
|
|
204
|
+
], children: children }));
|
|
187
205
|
};
|
|
188
206
|
}
|
|
@@ -92,8 +92,9 @@ export declare namespace ListBox {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Renders the group host: a `<div>` laying its {@link ListBox.Item} options
|
|
95
|
-
* out as a scrollable column capped at a fixed block size
|
|
96
|
-
*
|
|
95
|
+
* out as a scrollable column capped at a fixed block size and rounded
|
|
96
|
+
* concentric with its rows, with `role` defaulting to `"radiogroup"` for
|
|
97
|
+
* single selection or `"group"` for `multiple`.
|
|
97
98
|
*
|
|
98
99
|
* @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ListBox.Context}.
|
|
99
100
|
* @returns The render function producing the group's markup.
|
|
@@ -5,10 +5,11 @@ import { opacity, rounded } from "@sdxc/u/effects";
|
|
|
5
5
|
import { cursor } from "@sdxc/u/general";
|
|
6
6
|
import { flex, gap, items } from "@sdxc/u/layout";
|
|
7
7
|
import { overflow } from "@sdxc/u/overflow";
|
|
8
|
-
import { maxBs,
|
|
8
|
+
import { maxBs, pb, pi } from "@sdxc/u/size";
|
|
9
9
|
import { active, hover, when } from "@sdxc/u/state";
|
|
10
10
|
import { text } from "@sdxc/u/typography";
|
|
11
11
|
import { attrs } from "remix/component";
|
|
12
|
+
import { surfaceInset } from "../styles/floating-surface.js";
|
|
12
13
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
14
|
import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
|
|
14
15
|
import { SentinelRow } from "./sentinel-row.js";
|
|
@@ -20,8 +21,9 @@ import { SentinelRow } from "./sentinel-row.js";
|
|
|
20
21
|
const DEFAULT_MULTIPLE = false;
|
|
21
22
|
/**
|
|
22
23
|
* Renders the group host: a `<div>` laying its {@link ListBox.Item} options
|
|
23
|
-
* out as a scrollable column capped at a fixed block size
|
|
24
|
-
*
|
|
24
|
+
* out as a scrollable column capped at a fixed block size and rounded
|
|
25
|
+
* concentric with its rows, with `role` defaulting to `"radiogroup"` for
|
|
26
|
+
* single selection or `"group"` for `multiple`.
|
|
25
27
|
*
|
|
26
28
|
* @param handle Runtime handle carrying the host `<div>`'s props and providing {@link ListBox.Context}.
|
|
27
29
|
* @returns The render function producing the group's markup.
|
|
@@ -50,7 +52,7 @@ export function ListBox(handle) {
|
|
|
50
52
|
attrs({ role: resolvedMultiple ? "group" : "radiogroup" }),
|
|
51
53
|
maxBs(60),
|
|
52
54
|
overflow("auto"),
|
|
53
|
-
|
|
55
|
+
surfaceInset(),
|
|
54
56
|
outline("none"),
|
|
55
57
|
mix,
|
|
56
58
|
] }));
|
|
@@ -89,10 +91,9 @@ ListBox.Item = function ListBoxItem(handle) {
|
|
|
89
91
|
hover(bg("neutral.bg-tint-hover")),
|
|
90
92
|
active(bg("neutral.bg-tint-pressed")),
|
|
91
93
|
when("&:has(input:focus)", bg("brand.bg-tint-pressed")),
|
|
92
|
-
|
|
93
|
-
* The row the keyboard is on is where the next Enter lands, so it is shown
|
|
94
|
-
*
|
|
95
|
-
* carries the stronger fill and would otherwise lose it while being walked past.
|
|
94
|
+
/**
|
|
95
|
+
* The row the keyboard is on is where the next Enter lands, so it is shown before it is
|
|
96
|
+
* chosen. The tint stops at the selected row, which keeps its stronger fill while walked past.
|
|
96
97
|
*/
|
|
97
98
|
when('&[data-highlighted="true"]:not(:has(input:checked)):not([aria-selected="true"])', [
|
|
98
99
|
bg("brand.bg-tint-pressed"),
|
package/dist/components/menu.js
CHANGED
|
@@ -3,10 +3,11 @@ import { bg, fg, outline } from "@sdxc/u/color";
|
|
|
3
3
|
import { rounded, opacity } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor } from "@sdxc/u/general";
|
|
5
5
|
import { flex, gap, items, shrink } from "@sdxc/u/layout";
|
|
6
|
-
import { bs, is, minIs, mb, pb, pi
|
|
6
|
+
import { bs, is, minIs, mb, pb, pi } from "@sdxc/u/size";
|
|
7
7
|
import { active, disabled, focusVisible, hover, when } from "@sdxc/u/state";
|
|
8
8
|
import { text, textAlign, textDecoration, weight } from "@sdxc/u/typography";
|
|
9
9
|
import { attrs } from "remix/component";
|
|
10
|
+
import { surfaceInset } from "../styles/floating-surface.js";
|
|
10
11
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
11
12
|
import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
|
|
12
13
|
import { Popover } from "./popover.js";
|
|
@@ -63,7 +64,7 @@ export function Menu(handle) {
|
|
|
63
64
|
return () => {
|
|
64
65
|
let { placement, children, mix, ...rest } = handle.props;
|
|
65
66
|
let resolvedPlacement = placement ?? DEFAULT_PLACEMENT;
|
|
66
|
-
return (_jsx(Popover, { ...rest, placement: resolvedPlacement, mix: [attrs({ role: DEFAULT_ROLE }), minIs("10rem"),
|
|
67
|
+
return (_jsx(Popover, { ...rest, placement: resolvedPlacement, mix: [attrs({ role: DEFAULT_ROLE }), minIs("10rem"), surfaceInset(), outline("none"), mix], children: children }));
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
@@ -91,10 +92,9 @@ Menu.Item = function MenuItem(handle) {
|
|
|
91
92
|
is("full"),
|
|
92
93
|
items("center"),
|
|
93
94
|
gap(2),
|
|
94
|
-
|
|
95
|
-
* A glyph in a row reads beside the row's own text, so it is
|
|
96
|
-
*
|
|
97
|
-
* while a long label wraps.
|
|
95
|
+
/**
|
|
96
|
+
* A glyph in a row reads beside the row's own text, so it is sized against that text
|
|
97
|
+
* and holds that size while a long label wraps.
|
|
98
98
|
*/
|
|
99
99
|
when("& > svg, & > [data-slot='icon']", [is("1rem"), bs("1rem"), shrink()]),
|
|
100
100
|
rounded("md"),
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
|
-
import { cursor, userSelect } from "@sdxc/u/general";
|
|
4
|
+
import { cursor, raw, userSelect } from "@sdxc/u/general";
|
|
5
5
|
import { flex, gap, inlineFlex, items } from "@sdxc/u/layout";
|
|
6
|
-
import { pb, pi } from "@sdxc/u/size";
|
|
6
|
+
import { p, pb, pi } from "@sdxc/u/size";
|
|
7
7
|
import { active, disabled, hover, when } from "@sdxc/u/state";
|
|
8
|
+
import { radius } from "@sdxc/u/tokens";
|
|
8
9
|
import { text, weight } from "@sdxc/u/typography";
|
|
9
10
|
import { attrs } from "remix/component";
|
|
11
|
+
import { concentricRadius, surfacePadding } from "../styles/floating-surface.js";
|
|
10
12
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
11
13
|
import { warnIfNoAccessibleLabel, warnIfNoAccessibleName, } from "../utils/warn-if-no-accessible-name.js";
|
|
12
14
|
/**
|
|
@@ -64,11 +66,10 @@ export function Menubar(handle) {
|
|
|
64
66
|
flex(),
|
|
65
67
|
items("center"),
|
|
66
68
|
gap("0.125rem"),
|
|
67
|
-
|
|
69
|
+
raw({ borderRadius: concentricRadius(surfacePadding(1), radius("sm")) }),
|
|
68
70
|
border({ color: "neutral", width: 1 }),
|
|
69
71
|
bg("neutral.tint"),
|
|
70
|
-
|
|
71
|
-
pi(1),
|
|
72
|
+
p(surfacePadding(1)),
|
|
72
73
|
mix,
|
|
73
74
|
] }));
|
|
74
75
|
};
|
|
@@ -171,12 +171,10 @@ MessageScroller.Button = function MessageScrollerButton(handle) {
|
|
|
171
171
|
z(1),
|
|
172
172
|
absolute(),
|
|
173
173
|
inset("auto", "auto", "1rem", "50%"),
|
|
174
|
-
|
|
175
|
-
* The control floats over
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* cascade sublayer ordered by first appearance, and the variant's own fill may
|
|
179
|
-
* land in a later one.
|
|
174
|
+
/**
|
|
175
|
+
* The control floats over the log, so it carries an opaque surface of its own to stay
|
|
176
|
+
* legible. `!important` settles it: each mix entry gets its own cascade sublayer, and
|
|
177
|
+
* the variant's own fill may land in a later one.
|
|
180
178
|
*/
|
|
181
179
|
raw({ backgroundColor: "var(--ui-bg, Canvas) !important" }),
|
|
182
180
|
shadow("md"),
|
|
@@ -4,7 +4,7 @@ import { container, flex, flexWrap, gap, grid, gridArea, gridTemplate, hstack, i
|
|
|
4
4
|
import { at } from "@sdxc/u/responsive";
|
|
5
5
|
import { maxIs, minIs } from "@sdxc/u/size";
|
|
6
6
|
import { when } from "@sdxc/u/state";
|
|
7
|
-
import { fontSize, weight } from "@sdxc/u/typography";
|
|
7
|
+
import { fontSize, tabularNums, weight } from "@sdxc/u/typography";
|
|
8
8
|
/**
|
|
9
9
|
* Named container {@link Message} declares on its own host, so
|
|
10
10
|
* {@link Message.Header} can query the row's own width instead of the
|
|
@@ -111,7 +111,7 @@ Message.Header = function MessageHeader(handle) {
|
|
|
111
111
|
items("baseline"),
|
|
112
112
|
gap("0.125rem", "0.5rem"),
|
|
113
113
|
when("& > :first-child", [fontSize("sm"), weight("semibold"), fg("neutral.emphasis")]),
|
|
114
|
-
when("& > :not(:first-child)", [fontSize("xs"), fg("neutral.muted")]),
|
|
114
|
+
when("& > :not(:first-child)", [fontSize("xs"), fg("neutral.muted"), tabularNums()]),
|
|
115
115
|
at("26rem", CONTAINER_NAME, [flexWrap("nowrap"), justify("between")]),
|
|
116
116
|
mix,
|
|
117
117
|
], children: children }));
|
package/dist/components/meter.js
CHANGED
|
@@ -7,7 +7,7 @@ import { overflow } from "@sdxc/u/overflow";
|
|
|
7
7
|
import { media } from "@sdxc/u/responsive";
|
|
8
8
|
import { bs, is, m, p } from "@sdxc/u/size";
|
|
9
9
|
import { data, when } from "@sdxc/u/state";
|
|
10
|
-
import { text } from "@sdxc/u/typography";
|
|
10
|
+
import { tabularNums, text } from "@sdxc/u/typography";
|
|
11
11
|
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
12
12
|
/** Semantic color role {@link Meter.Indicator} falls back to when `color` is omitted. */
|
|
13
13
|
const DEFAULT_COLOR = "neutral";
|
|
@@ -114,6 +114,6 @@ Meter.Indicator = function MeterIndicator(handle) {
|
|
|
114
114
|
Meter.ValueLabel = function MeterValueLabel(handle) {
|
|
115
115
|
return () => {
|
|
116
116
|
let { mix, ...rest } = handle.props;
|
|
117
|
-
return _jsx("span", { ...rest, mix: [text("sm"), fg("neutral"), mix] });
|
|
117
|
+
return _jsx("span", { ...rest, mix: [text("sm"), tabularNums(), fg("neutral"), mix] });
|
|
118
118
|
};
|
|
119
119
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* A pre-animated preset of {@link Dialog}: the same native `<dialog>` panel,
|
|
3
3
|
* its `::backdrop` treatment, and every compound part, with the panel's own
|
|
4
4
|
* pop-in and pop-out motion — a fade paired with a scale, entering from
|
|
5
|
-
* slightly smaller
|
|
6
|
-
* already wired onto the host.
|
|
5
|
+
* slightly smaller than rest and leaving faster, shrinking only halfway back
|
|
6
|
+
* and blurring softly as it fades — already wired onto the host.
|
|
7
7
|
*
|
|
8
8
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
9
|
* @copyright Sergio Xalambrí 2026
|