@sdxc/ui 2026.10.10 → 2026.10.13
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 +522 -668
- package/dist/animations/transitions.d.ts +45 -20
- package/dist/animations/transitions.js +104 -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/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/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
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { bg, borderEdge, fg, outline, outlineStyle } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
|
-
import { cursor } from "@sdxc/u/general";
|
|
4
|
+
import { cursor, raw } from "@sdxc/u/general";
|
|
5
5
|
import { hstack, shrink, vstack } from "@sdxc/u/layout";
|
|
6
6
|
import { overflow } from "@sdxc/u/overflow";
|
|
7
7
|
import { bs, is, maxBs, pb, pi } from "@sdxc/u/size";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
9
9
|
import { text, textAlign } from "@sdxc/u/typography";
|
|
10
10
|
import { attrs } from "remix/component";
|
|
11
|
-
import { floatingSurface } from "../styles/floating-surface.js";
|
|
11
|
+
import { concentricRadius, floatingSurface, surfacePadding } from "../styles/floating-surface.js";
|
|
12
12
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
13
|
/** `role="listbox"` applied to {@link Command.List} through {@link attrs} unless a consumer supplies its own `role`. */
|
|
14
14
|
const DEFAULT_LIST_ROLE = "listbox";
|
|
15
15
|
/** `role="option"` applied to {@link Command.Item} through {@link attrs} unless a consumer supplies its own `role`. */
|
|
16
16
|
const DEFAULT_ITEM_ROLE = "option";
|
|
17
17
|
/**
|
|
18
|
-
* Renders the panel's root host:
|
|
19
|
-
* stacking its compound parts in a
|
|
20
|
-
*
|
|
18
|
+
* Renders the panel's root host: an elevated `<div>` rounded concentric
|
|
19
|
+
* with {@link Command.Item}'s corners, stacking its compound parts in a
|
|
20
|
+
* column and clipping {@link Command.List}'s scrolled content to that radius.
|
|
21
21
|
*
|
|
22
22
|
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
23
23
|
* @returns The render function producing the panel's markup.
|
|
@@ -34,7 +34,14 @@ const DEFAULT_ITEM_ROLE = "option";
|
|
|
34
34
|
export function Command(handle) {
|
|
35
35
|
return () => {
|
|
36
36
|
let { children, mix, ...rest } = handle.props;
|
|
37
|
-
return (_jsx("div", { ...rest, "data-slot": "command", mix: [
|
|
37
|
+
return (_jsx("div", { ...rest, "data-slot": "command", mix: [
|
|
38
|
+
floatingSurface(),
|
|
39
|
+
raw({ borderRadius: concentricRadius(surfacePadding(1)) }),
|
|
40
|
+
vstack(),
|
|
41
|
+
overflow("hidden"),
|
|
42
|
+
fg("neutral.emphasis"),
|
|
43
|
+
mix,
|
|
44
|
+
], children: children }));
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
@@ -87,12 +94,10 @@ Command.List = function CommandList(handle) {
|
|
|
87
94
|
attrs({ role: DEFAULT_LIST_ROLE }),
|
|
88
95
|
maxBs("18rem"),
|
|
89
96
|
overflow("auto"),
|
|
90
|
-
pi(1),
|
|
91
|
-
|
|
92
|
-
* The list
|
|
93
|
-
*
|
|
94
|
-
* padding then sits above the empty-state message and nothing balances it
|
|
95
|
-
* below — the message reads as pushed down rather than centered.
|
|
97
|
+
pi(surfacePadding(1)),
|
|
98
|
+
/**
|
|
99
|
+
* The list spends its block padding only while a row is visible, so a filter hiding every
|
|
100
|
+
* row leaves the empty-state message centered.
|
|
96
101
|
*/
|
|
97
102
|
when('&:has([data-slot="item"]:not([hidden]))', pb(2)),
|
|
98
103
|
outlineStyle("none"),
|
|
@@ -124,12 +129,10 @@ Command.Item = function CommandItem(handle) {
|
|
|
124
129
|
interactiveTransition(),
|
|
125
130
|
attrs({ role: DEFAULT_ITEM_ROLE }),
|
|
126
131
|
hstack({ gap: 2, align: "center" }),
|
|
127
|
-
|
|
128
|
-
* A glyph anywhere in the row is
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* overrun, so every row lands on a different width and the column of glyphs
|
|
132
|
-
* reads as a rendering fault.
|
|
132
|
+
/**
|
|
133
|
+
* A glyph anywhere in the row is sized against the row's text and holds that size when the
|
|
134
|
+
* row runs short; the default `flex-shrink: 1` would squeeze each glyph by its own row's
|
|
135
|
+
* overrun and leave the column of glyphs ragged.
|
|
133
136
|
*/
|
|
134
137
|
when("& svg", [shrink(), is(4), bs(4)]),
|
|
135
138
|
cursor("default"),
|
|
@@ -137,16 +140,10 @@ Command.Item = function CommandItem(handle) {
|
|
|
137
140
|
pi(2),
|
|
138
141
|
pb(2),
|
|
139
142
|
fg("neutral.emphasis"),
|
|
140
|
-
|
|
141
|
-
* The active row is a cursor
|
|
142
|
-
*
|
|
143
|
-
* the
|
|
144
|
-
* lightness as the panel behind it, which leaves the cursor invisible and the
|
|
145
|
-
* arrow keys moving something nobody can see.
|
|
146
|
-
*
|
|
147
|
-
* Pointer state and the cursor are written as selectors that exclude each
|
|
148
|
-
* other, so a row under the pointer keeps saying it is the active one whichever
|
|
149
|
-
* order the layers land in.
|
|
143
|
+
/**
|
|
144
|
+
* The active row is a cursor tinted far enough off the surface to find at a glance, while
|
|
145
|
+
* its text keeps reading as text. Pointer and cursor states use mutually exclusive selectors,
|
|
146
|
+
* so the row under the pointer stays marked active whichever order the layers land in.
|
|
150
147
|
*/
|
|
151
148
|
when('&:hover:not([aria-selected="true"])', bg("neutral.bg-tint-hover")),
|
|
152
149
|
when('&:active:not([aria-selected="true"])', bg("neutral.bg-tint-pressed")),
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
|
2
2
|
import { borderEdge, fg, outline } from "@sdxc/u/color";
|
|
3
3
|
import { mis, pb, pi, pie } from "@sdxc/u/size";
|
|
4
4
|
import { not } from "@sdxc/u/state";
|
|
5
|
-
import { text, weight } from "@sdxc/u/typography";
|
|
5
|
+
import { tabularNums, text, weight } from "@sdxc/u/typography";
|
|
6
6
|
import { Menu } from "./menu.js";
|
|
7
7
|
import { Section } from "./section.js";
|
|
8
8
|
/**
|
|
@@ -181,8 +181,8 @@ ContextMenu.RadioItem = ContextMenu.Item;
|
|
|
181
181
|
ContextMenu.RadioGroup = ContextMenu.Group;
|
|
182
182
|
/**
|
|
183
183
|
* Renders {@link ContextMenu.ShortcutProps.children} as a row's trailing
|
|
184
|
-
* keyboard-shortcut hint: pushed to the row's inline end
|
|
185
|
-
*
|
|
184
|
+
* keyboard-shortcut hint: pushed to the row's inline end, muted, and set in
|
|
185
|
+
* tabular digits so the hints of a column of rows line up.
|
|
186
186
|
*
|
|
187
187
|
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
188
188
|
* @returns The render function producing the shortcut hint's markup.
|
|
@@ -195,6 +195,6 @@ ContextMenu.RadioGroup = ContextMenu.Group;
|
|
|
195
195
|
ContextMenu.Shortcut = function ContextMenuShortcut(handle) {
|
|
196
196
|
return () => {
|
|
197
197
|
let { children, mix, ...rest } = handle.props;
|
|
198
|
-
return (_jsx("span", { ...rest, mix: [mis("auto"), fg("neutral.muted"), text("xs"), mix], children: children }));
|
|
198
|
+
return (_jsx("span", { ...rest, mix: [mis("auto"), fg("neutral.muted"), text("xs"), tabularNums(), mix], children: children }));
|
|
199
199
|
};
|
|
200
200
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { tabularNums } from "@sdxc/u/typography";
|
|
2
3
|
import { fieldStackLayout } from "../styles/field-stack-layout.js";
|
|
3
4
|
import { resolveFieldWiring } from "../utils/resolve-field-wiring.js";
|
|
4
5
|
import { Description } from "./description.js";
|
|
@@ -44,6 +45,6 @@ export function DateField(handle) {
|
|
|
44
45
|
});
|
|
45
46
|
return (_jsxs("div", { ...rest, "data-slot": "date-field", mix: [fieldStackLayout(), mix], children: [_jsx(Label, { htmlFor: handle.id, mix: parts?.label, children: label }), _jsx(Input, { id: handle.id, type: "date", name: name, value: value, defaultValue: defaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete,
|
|
46
47
|
// oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.
|
|
47
|
-
autoFocus: resolvedAutoFocus, "aria-invalid": resolvedInvalid, "aria-describedby": describedBy, color: resolvedColor, mix: parts?.input }), description ? (_jsx(Description, { id: descriptionId, mix: parts?.description, children: description })) : null, errorMessage ? (_jsx(FieldError, { id: errorId, mix: parts?.error, children: errorMessage })) : null] }));
|
|
48
|
+
autoFocus: resolvedAutoFocus, "aria-invalid": resolvedInvalid, "aria-describedby": describedBy, color: resolvedColor, mix: [tabularNums(), parts?.input] }), description ? (_jsx(Description, { id: descriptionId, mix: parts?.description, children: description })) : null, errorMessage ? (_jsx(FieldError, { id: errorId, mix: parts?.error, children: errorMessage })) : null] }));
|
|
48
49
|
};
|
|
49
50
|
}
|
|
@@ -56,7 +56,7 @@ DatePicker.Group = function DatePickerGroup(handle) {
|
|
|
56
56
|
return (_jsx("div", { ...rest, "data-slot": "group", mix: [
|
|
57
57
|
flex(),
|
|
58
58
|
items("center"),
|
|
59
|
-
|
|
59
|
+
/**
|
|
60
60
|
* The fields compose into one control, so the pair keeps the rounding on its own
|
|
61
61
|
* outer corners and the seam the two share is drawn once.
|
|
62
62
|
*/
|
|
@@ -69,26 +69,22 @@ DatePicker.Group = function DatePickerGroup(handle) {
|
|
|
69
69
|
roundedCorner("start-end", "none"),
|
|
70
70
|
roundedCorner("end-end", "none"),
|
|
71
71
|
]),
|
|
72
|
-
|
|
73
|
-
* Focus
|
|
74
|
-
*
|
|
75
|
-
* dates is. The focused one is raised so its own ring crosses the seam rather
|
|
76
|
-
* than being painted over by its neighbour.
|
|
72
|
+
/**
|
|
73
|
+
* Focus shows on the field holding it, naming which date has it where a ring around
|
|
74
|
+
* the pair names only the group. That field is raised so its ring crosses the seam.
|
|
77
75
|
*/
|
|
78
76
|
when("& > *:focus-visible", z(1)),
|
|
79
|
-
|
|
80
|
-
* Validity
|
|
81
|
-
*
|
|
82
|
-
* the
|
|
83
|
-
* the seam read as damage rather than as one field needing attention.
|
|
77
|
+
/**
|
|
78
|
+
* Validity belongs to the pair, since a range is one value and half of one makes it
|
|
79
|
+
* invalid: one ring is drawn around the group and each field's own ring is released,
|
|
80
|
+
* so the seam shows one field needing attention.
|
|
84
81
|
*/
|
|
85
82
|
when('&:has(> :user-invalid), &:has(> [aria-invalid="true"])', outline({ color: "danger.ring", offset: 2 })),
|
|
86
83
|
when('& > :user-invalid:not(:focus-visible), & > [aria-invalid="true"]:not(:focus-visible)',
|
|
87
|
-
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* `:focus-visible` so a field being filled in still shows its own focus ring.
|
|
84
|
+
/**
|
|
85
|
+
* Important so it reaches across to the cascade layer where `Input` states the field's
|
|
86
|
+
* invalid ring. The selector excludes `:focus-visible`, so a field being filled in still
|
|
87
|
+
* shows its own focus ring.
|
|
92
88
|
*/
|
|
93
89
|
raw({ outline: "none !important" })),
|
|
94
90
|
mix,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { fg } from "@sdxc/u/color";
|
|
3
|
-
import { text } from "@sdxc/u/typography";
|
|
3
|
+
import { pretty, text } from "@sdxc/u/typography";
|
|
4
4
|
/**
|
|
5
5
|
* Renders its children inside a `<p>` sized and colored as a small run of
|
|
6
6
|
* supporting copy: the library's default text size paired with the neutral
|
|
@@ -16,6 +16,6 @@ import { text } from "@sdxc/u/typography";
|
|
|
16
16
|
export function Description(handle) {
|
|
17
17
|
return () => {
|
|
18
18
|
let { mix, ...rest } = handle.props;
|
|
19
|
-
return _jsx("p", { ...rest, mix: [fg("neutral.muted"), text("sm"), mix] });
|
|
19
|
+
return _jsx("p", { ...rest, mix: [fg("neutral.muted"), text("sm"), pretty(), mix] });
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { XIcon } from "@sdxc/icons";
|
|
3
|
-
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
|
-
import { backdropBlur, backdropSaturate, opacity, rounded, transition, transitionBehavior, } from "@sdxc/u/effects";
|
|
5
|
-
import { raw } from "@sdxc/u/general";
|
|
3
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { backdropBlur, backdropSaturate, opacity, rounded, shadow, transition, transitionBehavior, } from "@sdxc/u/effects";
|
|
5
|
+
import { raw, vars } from "@sdxc/u/general";
|
|
6
6
|
import { absolute, container, fixed, flex, flexCol, flexColReverse, flexRow, gap, inset, justify, relative, } from "@sdxc/u/layout";
|
|
7
7
|
import { overflow } from "@sdxc/u/overflow";
|
|
8
8
|
import { at, media, startingStyle, supports } from "@sdxc/u/responsive";
|
|
9
9
|
import { is, maxBs, maxIs, p } from "@sdxc/u/size";
|
|
10
10
|
import { when } from "@sdxc/u/state";
|
|
11
|
-
import { fontSize, leading, textAlign, tracking, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { balance, fontSize, leading, pretty, textAlign, tracking, weight, } from "@sdxc/u/typography";
|
|
12
12
|
import { durations, easings } from "../animations/tokens.js";
|
|
13
|
+
import { SHADOW_RING } from "../styles/floating-surface.js";
|
|
13
14
|
import { Button } from "./button.js";
|
|
14
15
|
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
15
16
|
/**
|
|
@@ -78,11 +79,9 @@ export function Dialog(handle) {
|
|
|
78
79
|
fg("neutral.emphasis"),
|
|
79
80
|
rounded("lg"),
|
|
80
81
|
is("full"),
|
|
81
|
-
|
|
82
|
-
* Wide enough for the form a dialog usually carries
|
|
83
|
-
*
|
|
84
|
-
* stacks them into a ribbon. A consumer with less to say narrows it through
|
|
85
|
-
* `mix`.
|
|
82
|
+
/**
|
|
83
|
+
* Wide enough for the form a dialog usually carries, so a field, its help text and a row
|
|
84
|
+
* of actions read as one column. A consumer with less to say narrows it through `mix`.
|
|
86
85
|
*/
|
|
87
86
|
maxIs("32rem"),
|
|
88
87
|
maxBs("90vh"),
|
|
@@ -106,11 +105,15 @@ export function Dialog(handle) {
|
|
|
106
105
|
supports("(backdrop-filter: blur(0))", media("(prefers-reduced-transparency: no-preference)", when("&::backdrop", [backdropBlur("md"), backdropSaturate(1.4)]))),
|
|
107
106
|
startingStyle(when("&[open]::backdrop", opacity(0))),
|
|
108
107
|
outline("none"),
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}),
|
|
108
|
+
/**
|
|
109
|
+
* The panel's edge is a ring shadow that takes on the tone behind it, over a
|
|
110
|
+
* transparent border that forced-colors mode still paints as a line.
|
|
111
|
+
*/
|
|
112
|
+
border({ color: "transparent", width: 1 }),
|
|
113
|
+
shadow("xl"),
|
|
114
|
+
vars({ "ui-box-shadow-ring": SHADOW_RING }),
|
|
115
|
+
/** `overscrollBehavior` has no matching utility. */
|
|
116
|
+
raw({ overscrollBehavior: "contain" }),
|
|
114
117
|
mix,
|
|
115
118
|
], children: children }));
|
|
116
119
|
};
|
|
@@ -162,6 +165,7 @@ Dialog.Title = function DialogTitle(handle) {
|
|
|
162
165
|
tracking("tight"),
|
|
163
166
|
fontSize("lg"),
|
|
164
167
|
leading(1),
|
|
168
|
+
balance(),
|
|
165
169
|
mix,
|
|
166
170
|
], children: rest.children }));
|
|
167
171
|
};
|
|
@@ -179,7 +183,7 @@ Dialog.Title = function DialogTitle(handle) {
|
|
|
179
183
|
Dialog.Description = function DialogDescription(handle) {
|
|
180
184
|
return () => {
|
|
181
185
|
let { mix, ...rest } = handle.props;
|
|
182
|
-
return (_jsx("p", { ...rest, "data-slot": "description", mix: [fg("neutral.muted"), fontSize("sm"), mix], children: rest.children }));
|
|
186
|
+
return (_jsx("p", { ...rest, "data-slot": "description", mix: [fg("neutral.muted"), fontSize("sm"), pretty(), mix], children: rest.children }));
|
|
183
187
|
};
|
|
184
188
|
};
|
|
185
189
|
/**
|
|
@@ -8,7 +8,7 @@ import { media } from "@sdxc/u/responsive";
|
|
|
8
8
|
import { bs, is, m, pb, pbe, pi } from "@sdxc/u/size";
|
|
9
9
|
import { detailsContent, hover, open, when } from "@sdxc/u/state";
|
|
10
10
|
import { rotate } from "@sdxc/u/transform";
|
|
11
|
-
import { textAlign, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { balance, textAlign, weight } from "@sdxc/u/typography";
|
|
12
12
|
import { panelChrome } from "../styles/panel-chrome.js";
|
|
13
13
|
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
14
14
|
/**
|
|
@@ -52,7 +52,7 @@ export function Disclosure(handle) {
|
|
|
52
52
|
transitionDuration("200ms"),
|
|
53
53
|
]),
|
|
54
54
|
when("&[open]::details-content", bs("auto")),
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
56
|
* The glyph a trigger carries as `data-slot="icon"` turns over while the section
|
|
57
57
|
* is open, the same rule `Accordion` states: the section owns the turn because
|
|
58
58
|
* only it knows it is open, and the trigger owns which glyph turns.
|
|
@@ -84,7 +84,7 @@ Disclosure.Header = function DisclosureHeader(handle) {
|
|
|
84
84
|
let { children, mix, ...rest } = handle.props;
|
|
85
85
|
let resolved = resolveHeadingLevel(handle);
|
|
86
86
|
let Tag = TAG_BY_LEVEL[resolved];
|
|
87
|
-
return (_jsx(Tag, { ...rest, "data-heading-level": resolved, mix: [m(0), mix], children: children }));
|
|
87
|
+
return (_jsx(Tag, { ...rest, "data-heading-level": resolved, mix: [m(0), balance(), mix], children: children }));
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
@@ -105,11 +105,10 @@ Disclosure.Header = function DisclosureHeader(handle) {
|
|
|
105
105
|
Disclosure.Trigger = function DisclosureTrigger(handle) {
|
|
106
106
|
return () => {
|
|
107
107
|
let { children, mix, ...rest } = handle.props;
|
|
108
|
-
|
|
109
|
-
* A `<summary>` has no `disabled`, so a row
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* script runs rather than waiting for a handler to cancel the toggle.
|
|
108
|
+
/**
|
|
109
|
+
* A `<summary>` has no `disabled`, so a disabled row leaves the tab order to keep Enter
|
|
110
|
+
* and Space off it. With the pointer-events rule below, that covers all `disabled` does,
|
|
111
|
+
* and it holds before any script runs.
|
|
113
112
|
*/
|
|
114
113
|
let disabled = rest["aria-disabled"] === "true";
|
|
115
114
|
return (_jsx("summary", { ...rest, tabIndex: disabled ? -1 : rest.tabIndex, mix: [
|
|
@@ -122,6 +121,7 @@ Disclosure.Trigger = function DisclosureTrigger(handle) {
|
|
|
122
121
|
pb(3),
|
|
123
122
|
pi(3),
|
|
124
123
|
textAlign("start"),
|
|
124
|
+
balance(),
|
|
125
125
|
weight("medium"),
|
|
126
126
|
fg("neutral.emphasis"),
|
|
127
127
|
hover(bg("neutral.tint")),
|
|
@@ -130,10 +130,9 @@ Disclosure.Trigger = function DisclosureTrigger(handle) {
|
|
|
130
130
|
listStyle(),
|
|
131
131
|
when("&::-webkit-details-marker", hidden()),
|
|
132
132
|
when("&::marker", raw({ content: '""' })),
|
|
133
|
-
|
|
134
|
-
* The indicator is
|
|
135
|
-
*
|
|
136
|
-
* squeezes the row.
|
|
133
|
+
/**
|
|
134
|
+
* The indicator is sized against the label beside it, whatever an icon set draws at,
|
|
135
|
+
* and holds that size when a long label squeezes the row.
|
|
137
136
|
*/
|
|
138
137
|
when('& [data-slot="icon"]', [is(4), bs(4), shrink()]),
|
|
139
138
|
transition("color, background-color, border-color, outline-color, text-decoration-color, fill, stroke"),
|
|
@@ -159,11 +158,10 @@ Disclosure.Panel = function DisclosurePanel(handle) {
|
|
|
159
158
|
let { children, mix, ...rest } = handle.props;
|
|
160
159
|
return (_jsx("div", { ...rest, mix: [
|
|
161
160
|
overflow(),
|
|
162
|
-
|
|
163
|
-
* The panel is inset to the
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* padding already separates the two.
|
|
161
|
+
/**
|
|
162
|
+
* The panel is inset to the line the trigger's label sits on, so the section reads as
|
|
163
|
+
* one block; the block-start stays open because the trigger's own padding already
|
|
164
|
+
* separates the two.
|
|
167
165
|
*/
|
|
168
166
|
pi(3),
|
|
169
167
|
pbe(3),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A preset of {@link Dialog} docked flush against one physical edge of the
|
|
3
|
-
* viewport, sized to fill that edge
|
|
4
|
-
*
|
|
5
|
-
* `::backdrop`, the `ui-dialog` named container its
|
|
6
|
-
* and the missing-`id` dev-mode contract check — carries
|
|
7
|
-
* {@link Dialog}, since this component composes it directly.
|
|
3
|
+
* viewport, sized to fill that edge, sliding into place from it on open and
|
|
4
|
+
* fading out with a short drift toward it on close. Every other detail — the
|
|
5
|
+
* dimming, blurrable `::backdrop`, the `ui-dialog` named container its
|
|
6
|
+
* compound parts query, and the missing-`id` dev-mode contract check — carries
|
|
7
|
+
* over from {@link Dialog}, since this component composes it directly.
|
|
8
8
|
*
|
|
9
9
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
10
|
* @copyright Sergio Xalambrí 2026
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
|
-
import { rounded
|
|
3
|
-
import { willChange } from "@sdxc/u/general";
|
|
2
|
+
import { rounded } from "@sdxc/u/effects";
|
|
3
|
+
import { vars, willChange } from "@sdxc/u/general";
|
|
4
4
|
import { fixed, insBe, insBs, insIe, insIs, insLeft, insRight } from "@sdxc/u/layout";
|
|
5
|
-
import { media, startingStyle } from "@sdxc/u/responsive";
|
|
6
5
|
import { bs, is, m, maxBs, maxIs } from "@sdxc/u/size";
|
|
7
|
-
import { data
|
|
8
|
-
import { translateX, translateY } from "@sdxc/u/transform";
|
|
6
|
+
import { data } from "@sdxc/u/state";
|
|
9
7
|
import { durations, easings } from "../animations/tokens.js";
|
|
8
|
+
import { enterExit } from "../animations/transitions.js";
|
|
10
9
|
import { Dialog } from "./dialog.js";
|
|
11
10
|
/**
|
|
12
11
|
* Physical edge of the viewport {@link Drawer} docks against when
|
|
13
12
|
* `placement` is left unset.
|
|
14
13
|
*/
|
|
15
14
|
const DEFAULT_PLACEMENT = "bottom";
|
|
15
|
+
/**
|
|
16
|
+
* How far toward its edge the panel drifts while it fades out on close: a
|
|
17
|
+
* hint of the direction it came from, short of the full slide it entered with.
|
|
18
|
+
*/
|
|
19
|
+
const EXIT_DISTANCE = "1rem";
|
|
20
|
+
/** Blur radius in pixels the panel softens to as it fades out. */
|
|
21
|
+
const EXIT_BLUR_PX = 4;
|
|
16
22
|
/**
|
|
17
23
|
* Renders {@link Dialog} pinned to one edge of the viewport, animating a
|
|
18
24
|
* `transform` off the native `open` attribute so `@starting-style` can
|
|
@@ -46,21 +52,19 @@ export function Drawer(handle) {
|
|
|
46
52
|
fixed(),
|
|
47
53
|
m(0),
|
|
48
54
|
rounded("none"),
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
enterExit({
|
|
56
|
+
translate: "var(--ui-drawer-enter-offset)",
|
|
57
|
+
duration: durations.slow,
|
|
51
58
|
easing: easings.decelerate,
|
|
59
|
+
exit: { translate: "var(--ui-drawer-exit-offset)", opacity: 0, blur: EXIT_BLUR_PX },
|
|
60
|
+
exitDuration: durations.fast,
|
|
61
|
+
exitEasing: easings.accelerate,
|
|
52
62
|
}),
|
|
53
|
-
willChange("
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* edge leaves that centring in force and the drawer away from the edge asked for.
|
|
59
|
-
*
|
|
60
|
-
* Both measures are stated for the same reason: a `<dialog>` sizes to its
|
|
61
|
-
* content on both axes, so pinning the two opposite insets does not stretch it.
|
|
62
|
-
* Each placement therefore gives the edge it docks to a depth and tells the
|
|
63
|
-
* other axis to fill.
|
|
63
|
+
willChange("translate"),
|
|
64
|
+
/**
|
|
65
|
+
* Each placement frees the far edge so the dialog's centring lets go, gives its docked
|
|
66
|
+
* edge a depth, and fills the other axis, since a `<dialog>` sizes to its content on both
|
|
67
|
+
* axes even with opposite insets pinned.
|
|
64
68
|
*/
|
|
65
69
|
data("placement", "top", [
|
|
66
70
|
insBs("0"),
|
|
@@ -71,8 +75,10 @@ export function Drawer(handle) {
|
|
|
71
75
|
maxBs("90vh"),
|
|
72
76
|
is("full"),
|
|
73
77
|
maxIs("none"),
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
vars({
|
|
79
|
+
"ui-drawer-enter-offset": "0 -100%",
|
|
80
|
+
"ui-drawer-exit-offset": `0 -${EXIT_DISTANCE}`,
|
|
81
|
+
}),
|
|
76
82
|
]),
|
|
77
83
|
data("placement", "bottom", [
|
|
78
84
|
insBe("0"),
|
|
@@ -83,8 +89,10 @@ export function Drawer(handle) {
|
|
|
83
89
|
maxBs("90vh"),
|
|
84
90
|
is("full"),
|
|
85
91
|
maxIs("none"),
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
vars({
|
|
93
|
+
"ui-drawer-enter-offset": "0 100%",
|
|
94
|
+
"ui-drawer-exit-offset": `0 ${EXIT_DISTANCE}`,
|
|
95
|
+
}),
|
|
88
96
|
]),
|
|
89
97
|
data("placement", "left", [
|
|
90
98
|
insBs("0"),
|
|
@@ -95,8 +103,10 @@ export function Drawer(handle) {
|
|
|
95
103
|
maxIs("90vw"),
|
|
96
104
|
bs("full"),
|
|
97
105
|
maxBs("none"),
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
vars({
|
|
107
|
+
"ui-drawer-enter-offset": "-100% 0",
|
|
108
|
+
"ui-drawer-exit-offset": `-${EXIT_DISTANCE} 0`,
|
|
109
|
+
}),
|
|
100
110
|
]),
|
|
101
111
|
data("placement", "right", [
|
|
102
112
|
insBs("0"),
|
|
@@ -107,16 +117,11 @@ export function Drawer(handle) {
|
|
|
107
117
|
maxIs("90vw"),
|
|
108
118
|
bs("full"),
|
|
109
119
|
maxBs("none"),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
when('&[data-placement="top"][open]', translateY("-100%")),
|
|
115
|
-
when('&[data-placement="bottom"][open]', translateY("100%")),
|
|
116
|
-
when('&[data-placement="left"][open]', translateX("-100%")),
|
|
117
|
-
when('&[data-placement="right"][open]', translateX("100%")),
|
|
120
|
+
vars({
|
|
121
|
+
"ui-drawer-enter-offset": "100% 0",
|
|
122
|
+
"ui-drawer-exit-offset": `${EXIT_DISTANCE} 0`,
|
|
123
|
+
}),
|
|
118
124
|
]),
|
|
119
|
-
media("(prefers-reduced-motion: reduce)", transitionProperty("none")),
|
|
120
125
|
mix,
|
|
121
126
|
] }));
|
|
122
127
|
};
|
|
@@ -41,16 +41,10 @@ export function DropIndicator(handle) {
|
|
|
41
41
|
bs("0.125rem"),
|
|
42
42
|
rounded("full"),
|
|
43
43
|
transition("background-color", { duration: 150 }),
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* so the list neither reflows nor jumps when one of them lights up.
|
|
49
|
-
*
|
|
50
|
-
* The two states are written as selectors that exclude each other rather than
|
|
51
|
-
* as a resting value a state rule overrides, because each entry compiles into
|
|
52
|
-
* its own cascade layer and a plain utility's layer can land after the state
|
|
53
|
-
* rule meant to beat it — which leaves the active bar painted like the rest.
|
|
44
|
+
/**
|
|
45
|
+
* The resting bar paints nothing while keeping its place, so only the targeted gap reads
|
|
46
|
+
* as marked and the list never reflows when one lights up. The states use exclusive
|
|
47
|
+
* selectors because each entry compiles into its own cascade layer, landing in any order.
|
|
54
48
|
*/
|
|
55
49
|
when("&:not([data-drop-target])", bg("transparent")),
|
|
56
50
|
when("&[data-drop-target]", bg("brand.solid")),
|
package/dist/components/empty.js
CHANGED
|
@@ -3,7 +3,7 @@ import { bg, border, colorMix, fg } from "@sdxc/u/color";
|
|
|
3
3
|
import { rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { flex, flexCol, flexWrap, gap, items, justify } from "@sdxc/u/layout";
|
|
5
5
|
import { bs, is, mbs, p } from "@sdxc/u/size";
|
|
6
|
-
import { fontSize, leading, textAlign, tracking, weight } from "@sdxc/u/typography";
|
|
6
|
+
import { balance, fontSize, leading, pretty, textAlign, tracking, weight, } from "@sdxc/u/typography";
|
|
7
7
|
import { attrs } from "remix/component";
|
|
8
8
|
import { semanticColorPanel } from "../styles/semantic-color-panel.js";
|
|
9
9
|
import { DEFAULT_ICON_ARIA_HIDDEN } from "../utils/decorative-icon.js";
|
|
@@ -92,7 +92,14 @@ Empty.Title = function EmptyTitle(handle) {
|
|
|
92
92
|
let { children, mix, ...rest } = handle.props;
|
|
93
93
|
let level = resolveHeadingLevel(handle);
|
|
94
94
|
let Tag = TAG_BY_LEVEL[level];
|
|
95
|
-
return (_jsx(Tag, { ...rest, "data-slot": "title", mix: [
|
|
95
|
+
return (_jsx(Tag, { ...rest, "data-slot": "title", mix: [
|
|
96
|
+
weight("semibold"),
|
|
97
|
+
tracking("tight"),
|
|
98
|
+
fontSize("base"),
|
|
99
|
+
leading("snug"),
|
|
100
|
+
balance(),
|
|
101
|
+
mix,
|
|
102
|
+
], children: children }));
|
|
96
103
|
};
|
|
97
104
|
};
|
|
98
105
|
/**
|
|
@@ -109,6 +116,7 @@ Empty.Description = function EmptyDescription(handle) {
|
|
|
109
116
|
return (_jsx("p", { ...rest, "data-slot": "description", mix: [
|
|
110
117
|
fontSize("sm"),
|
|
111
118
|
leading("relaxed"),
|
|
119
|
+
pretty(),
|
|
112
120
|
fg(colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent")),
|
|
113
121
|
mix,
|
|
114
122
|
], children: children }));
|
|
@@ -127,10 +135,9 @@ Empty.Action = function EmptyAction(handle) {
|
|
|
127
135
|
return () => {
|
|
128
136
|
let { children, mix, ...rest } = handle.props;
|
|
129
137
|
return (_jsx("div", { ...rest, "data-slot": "action", mix: [
|
|
130
|
-
|
|
131
|
-
* The slot
|
|
132
|
-
*
|
|
133
|
-
* that wraps, since two buttons side by side outgrow a narrow panel.
|
|
138
|
+
/**
|
|
139
|
+
* The slot lays out however many actions the state offers as a centered row that
|
|
140
|
+
* wraps, since two buttons side by side outgrow a narrow panel.
|
|
134
141
|
*/
|
|
135
142
|
flex(),
|
|
136
143
|
flexWrap(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { fg } from "@sdxc/u/color";
|
|
3
|
-
import { text, weight } from "@sdxc/u/typography";
|
|
3
|
+
import { pretty, text, weight } from "@sdxc/u/typography";
|
|
4
4
|
import { attrs } from "remix/component";
|
|
5
5
|
/**
|
|
6
6
|
* `data-field-error` applied through {@link attrs} unless a consumer
|
|
@@ -30,6 +30,7 @@ export function FieldError(handle) {
|
|
|
30
30
|
fg("danger"),
|
|
31
31
|
weight("medium"),
|
|
32
32
|
text("sm"),
|
|
33
|
+
pretty(),
|
|
33
34
|
mix,
|
|
34
35
|
] }));
|
|
35
36
|
};
|
|
@@ -52,12 +52,10 @@ export function FileTrigger(handle) {
|
|
|
52
52
|
items("center"),
|
|
53
53
|
justify("center"),
|
|
54
54
|
gap(2),
|
|
55
|
-
|
|
56
|
-
* A glyph is
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* `flex-shrink: 1` compresses the glyph rather than the words, and a squashed
|
|
60
|
-
* icon reads as a rendering fault.
|
|
55
|
+
/**
|
|
56
|
+
* A glyph is sized against the label beside it and holds that size, so the row keeps the
|
|
57
|
+
* height its text and padding ask for; the default `flex-shrink: 1` would squash the glyph
|
|
58
|
+
* ahead of the words.
|
|
61
59
|
*/
|
|
62
60
|
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
63
61
|
rounded("md"),
|
|
@@ -75,10 +73,9 @@ export function FileTrigger(handle) {
|
|
|
75
73
|
pi("1rem"),
|
|
76
74
|
pb("0.5rem"),
|
|
77
75
|
text("sm"),
|
|
78
|
-
|
|
79
|
-
* The row measure is stated
|
|
80
|
-
*
|
|
81
|
-
* Group fuses the two, and still grows when a long label wraps.
|
|
76
|
+
/**
|
|
77
|
+
* The row measure is stated, so the control lines up with a field of the same size when
|
|
78
|
+
* a Group fuses the two, and still grows when a long label wraps.
|
|
82
79
|
*/
|
|
83
80
|
minBs("2.5rem"),
|
|
84
81
|
data("size", "sm", [
|