@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
|
@@ -4,20 +4,39 @@ import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
|
4
4
|
import { opacity, rounded, visibility } from "@sdxc/u/effects";
|
|
5
5
|
import { cursor, userSelect } from "@sdxc/u/general";
|
|
6
6
|
import { absolute, flex, gap, inlineFlex, inset, items, justify, relative, shrink, } from "@sdxc/u/layout";
|
|
7
|
-
import { bs, is, minBs, pb, pi } from "@sdxc/u/size";
|
|
7
|
+
import { bs, is, minBs, p, pb, pi, pie, pis } from "@sdxc/u/size";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
9
9
|
import { text, weight } from "@sdxc/u/typography";
|
|
10
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
10
11
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
12
|
+
import { glyphEdges } from "../utils/glyph-edges.js";
|
|
11
13
|
import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
|
|
12
14
|
const DEFAULT_COLOR = "neutral";
|
|
13
15
|
const DEFAULT_VARIANT = "solid";
|
|
14
16
|
const DEFAULT_SIZE = "md";
|
|
17
|
+
/** Edge of a small icon-only button, matching the `sm` row height. */
|
|
18
|
+
const ICON_ONLY_SIZE_SM = "var(--ui-button-icon-size-sm, 2rem)";
|
|
19
|
+
/** Edge of a medium icon-only button, matching the `md` row height. */
|
|
20
|
+
const ICON_ONLY_SIZE_MD = "var(--ui-button-icon-size-md, 2.5rem)";
|
|
21
|
+
/** Edge of a large icon-only button, matching the `lg` row height. */
|
|
22
|
+
const ICON_ONLY_SIZE_LG = "var(--ui-button-icon-size-lg, 3rem)";
|
|
15
23
|
/**
|
|
16
24
|
* Native `type` given to a button carrying `command`/`commandfor` and no
|
|
17
25
|
* `type` of its own: the platform treats a button that could also submit as an
|
|
18
26
|
* ambiguous invoker and skips its command, so an invoker needs this type.
|
|
19
27
|
*/
|
|
20
28
|
const INVOKER_TYPE = "button";
|
|
29
|
+
/**
|
|
30
|
+
* Reports whether `children` is a lone glyph, which is what makes a button a target for
|
|
31
|
+
* that glyph rather than for a label. A selector cannot answer this: `:only-child`
|
|
32
|
+
* counts elements, so a button holding text beside one icon still matches it.
|
|
33
|
+
*
|
|
34
|
+
* @param children The button's own children.
|
|
35
|
+
* @returns Whether the button renders a single element and no text of its own.
|
|
36
|
+
*/
|
|
37
|
+
function holdsOnlyAGlyph(children) {
|
|
38
|
+
return typeof children === "object" && children !== null && !Array.isArray(children);
|
|
39
|
+
}
|
|
21
40
|
/**
|
|
22
41
|
* Visual state lives in `data-color`/`data-variant`/`data-size` on the host, so
|
|
23
42
|
* hover, pressed, and focus-visible stay on native pseudo-classes. `type` precedes
|
|
@@ -32,17 +51,6 @@ const INVOKER_TYPE = "button";
|
|
|
32
51
|
* @example
|
|
33
52
|
* <Button type="submit" isPending={isSubmitting}>{t("actions.save")}</Button>
|
|
34
53
|
*/
|
|
35
|
-
/**
|
|
36
|
-
* Reports whether `children` is a lone glyph, which is what makes a button a target for
|
|
37
|
-
* that glyph rather than for a label. A selector cannot answer this: `:only-child`
|
|
38
|
-
* counts elements, so a button holding text beside one icon still matches it.
|
|
39
|
-
*
|
|
40
|
-
* @param children The button's own children.
|
|
41
|
-
* @returns Whether the button renders a single element and no text of its own.
|
|
42
|
-
*/
|
|
43
|
-
function holdsOnlyAGlyph(children) {
|
|
44
|
-
return typeof children === "object" && children !== null && !Array.isArray(children);
|
|
45
|
-
}
|
|
46
54
|
export function Button(handle) {
|
|
47
55
|
return () => {
|
|
48
56
|
let { color, variant, size, isPending, disabled, type, parts, children, mix, ...rest } = handle.props;
|
|
@@ -53,8 +61,9 @@ export function Button(handle) {
|
|
|
53
61
|
let resolvedSize = size ?? DEFAULT_SIZE;
|
|
54
62
|
let resolvedDisabled = disabled || isPending;
|
|
55
63
|
let iconOnly = holdsOnlyAGlyph(children);
|
|
64
|
+
let edges = glyphEdges(children);
|
|
56
65
|
warnIfNoAccessibleName(handle.props, children, "Button: an icon-only button needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.");
|
|
57
|
-
return (_jsx("button", { type: resolvedType, ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-pending": isPending || undefined, "data-icon-only": iconOnly || undefined, disabled: resolvedDisabled, mix: [
|
|
66
|
+
return (_jsx("button", { type: resolvedType, ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-pending": isPending || undefined, "data-icon-only": iconOnly || undefined, "data-glyph-start": edges.start || undefined, "data-glyph-end": edges.end || undefined, disabled: resolvedDisabled, mix: [
|
|
58
67
|
when("&:focus-visible", [
|
|
59
68
|
outline({ color: "brand.ring", offset: 2 }),
|
|
60
69
|
when('&[data-color="neutral"]', outline("neutral.ring")),
|
|
@@ -78,6 +87,8 @@ export function Button(handle) {
|
|
|
78
87
|
rounded("md"),
|
|
79
88
|
weight("medium"),
|
|
80
89
|
cursor("default"),
|
|
90
|
+
/** A small control reaches `--ui-target-size` however a consumer positions it. */
|
|
91
|
+
hitArea({ anchor: "flex-center" }),
|
|
81
92
|
userSelect(),
|
|
82
93
|
pi(4),
|
|
83
94
|
pb(2),
|
|
@@ -88,7 +99,7 @@ export function Button(handle) {
|
|
|
88
99
|
* footprint outline does.
|
|
89
100
|
*/
|
|
90
101
|
border({ width: 1, noStyleDefault: true }),
|
|
91
|
-
|
|
102
|
+
/**
|
|
92
103
|
* The row measure is stated rather than left to fall out of the padding and
|
|
93
104
|
* the border, so the control lines up with a field of the same size when a
|
|
94
105
|
* Group fuses the two, and still grows when a long label wraps.
|
|
@@ -108,15 +119,45 @@ export function Button(handle) {
|
|
|
108
119
|
minBs("3rem"),
|
|
109
120
|
when("& > svg", [is(5), bs(5)]),
|
|
110
121
|
]),
|
|
111
|
-
|
|
122
|
+
/**
|
|
123
|
+
* A glyph beside a label carries its own side bearing, so the padding on that
|
|
124
|
+
* side drops one step and the glyph and the words read as evenly inset.
|
|
125
|
+
*/
|
|
126
|
+
when("&[data-glyph-start]:has(> svg:first-child)", [
|
|
127
|
+
pis(3),
|
|
128
|
+
when('&[data-size="sm"]', pis(2)),
|
|
129
|
+
when('&[data-size="lg"]', pis(4)),
|
|
130
|
+
]),
|
|
131
|
+
when("&[data-glyph-end]:has(> svg:last-child)", [
|
|
132
|
+
pie(3),
|
|
133
|
+
when('&[data-size="sm"]', pie(2)),
|
|
134
|
+
when('&[data-size="lg"]', pie(4)),
|
|
135
|
+
]),
|
|
136
|
+
/**
|
|
112
137
|
* A button holding a glyph and nothing else is a target for that glyph alone, so
|
|
113
138
|
* it takes a round footprint as tall as the row it would otherwise fill. The
|
|
114
|
-
* measure is
|
|
115
|
-
* axes has no ratio to resolve against
|
|
139
|
+
* measure is a custom property per size, since a box sized by its own content on
|
|
140
|
+
* both axes has no ratio to resolve against, and an app or a composing part can
|
|
141
|
+
* resize it without touching the rule.
|
|
116
142
|
*/
|
|
117
|
-
when("&[data-icon-only]", [
|
|
118
|
-
|
|
119
|
-
|
|
143
|
+
when("&[data-icon-only]", [
|
|
144
|
+
p(0),
|
|
145
|
+
is(ICON_ONLY_SIZE_MD),
|
|
146
|
+
bs(ICON_ONLY_SIZE_MD),
|
|
147
|
+
minBs(ICON_ONLY_SIZE_MD),
|
|
148
|
+
shrink(),
|
|
149
|
+
rounded("full"),
|
|
150
|
+
]),
|
|
151
|
+
when('&[data-size="sm"][data-icon-only]', [
|
|
152
|
+
is(ICON_ONLY_SIZE_SM),
|
|
153
|
+
bs(ICON_ONLY_SIZE_SM),
|
|
154
|
+
minBs(ICON_ONLY_SIZE_SM),
|
|
155
|
+
]),
|
|
156
|
+
when('&[data-size="lg"][data-icon-only]', [
|
|
157
|
+
is(ICON_ONLY_SIZE_LG),
|
|
158
|
+
bs(ICON_ONLY_SIZE_LG),
|
|
159
|
+
minBs(ICON_ONLY_SIZE_LG),
|
|
160
|
+
]),
|
|
120
161
|
when('&[data-variant="solid"]', [
|
|
121
162
|
when('&[data-color="brand"]', [
|
|
122
163
|
bg("brand.solid"),
|
|
@@ -3,12 +3,13 @@ import { ChevronLeftIcon, ChevronRightIcon } from "@sdxc/icons";
|
|
|
3
3
|
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
4
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
5
5
|
import { cursor, raw } from "@sdxc/u/general";
|
|
6
|
-
import { basis, borderCollapse, borderSpacing, flex, grow, inlineBlock, items, justify, shrink, } from "@sdxc/u/layout";
|
|
6
|
+
import { basis, borderCollapse, borderSpacing, flex, grow, inlineBlock, items, justify, relative, shrink, } from "@sdxc/u/layout";
|
|
7
7
|
import { bs, is, mbe, p, pbe } from "@sdxc/u/size";
|
|
8
8
|
import { hover, when } from "@sdxc/u/state";
|
|
9
9
|
import { scaleX } from "@sdxc/u/transform";
|
|
10
|
-
import { text, textAlign, textDecoration, verticalAlign, weight } from "@sdxc/u/typography";
|
|
10
|
+
import { tabularNums, text, textAlign, textDecoration, verticalAlign, 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 { warnIfNoAccessibleLabel, warnIfNoAccessibleName, } from "../utils/warn-if-no-accessible-name.js";
|
|
14
15
|
import { Heading } from "./heading.js";
|
|
@@ -112,8 +113,10 @@ Calendar.PreviousButton = function CalendarPreviousButton(handle) {
|
|
|
112
113
|
flex(),
|
|
113
114
|
items("center"),
|
|
114
115
|
justify("center"),
|
|
116
|
+
relative(),
|
|
115
117
|
is(8),
|
|
116
118
|
bs(8),
|
|
119
|
+
hitArea(),
|
|
117
120
|
rounded("full"),
|
|
118
121
|
fg("neutral"),
|
|
119
122
|
hover(bg("neutral.bg-tint-hover")),
|
|
@@ -144,8 +147,10 @@ Calendar.NextButton = function CalendarNextButton(handle) {
|
|
|
144
147
|
flex(),
|
|
145
148
|
items("center"),
|
|
146
149
|
justify("center"),
|
|
150
|
+
relative(),
|
|
147
151
|
is(8),
|
|
148
152
|
bs(8),
|
|
153
|
+
hitArea(),
|
|
149
154
|
rounded("full"),
|
|
150
155
|
fg("neutral"),
|
|
151
156
|
hover(bg("neutral.bg-tint-hover")),
|
|
@@ -299,12 +304,10 @@ Calendar.Cell = function CalendarCell(handle) {
|
|
|
299
304
|
return (_jsx("td", { ...rest, "data-slot": "cell", mix: [
|
|
300
305
|
interactiveTransition(),
|
|
301
306
|
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
302
|
-
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* box turns its cells into blocks, where a block's own content alignment is what
|
|
307
|
-
* centres the day, so the two are written together and each answers one case.
|
|
307
|
+
/**
|
|
308
|
+
* Table alignment centres the day while the cell stays a table cell in its row; a row
|
|
309
|
+
* laid out as a flex box turns its cells into blocks, where `align-content` centres the
|
|
310
|
+
* day. Each declaration answers one of the two cases.
|
|
308
311
|
*/
|
|
309
312
|
textAlign("center"),
|
|
310
313
|
verticalAlign("middle"),
|
|
@@ -315,6 +318,7 @@ Calendar.Cell = function CalendarCell(handle) {
|
|
|
315
318
|
rounded("full"),
|
|
316
319
|
fg("neutral.emphasis"),
|
|
317
320
|
text("sm"),
|
|
321
|
+
tabularNums(),
|
|
318
322
|
hover(bg("neutral.bg-tint-hover")),
|
|
319
323
|
when('&[aria-selected="true"]', [bg("brand.solid"), fg("brand.onSolid")]),
|
|
320
324
|
when('&[aria-disabled="true"]', [cursor("not-allowed"), opacity(30)]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A bounded container grouping a header, body content, and footer actions
|
|
3
|
-
* into one
|
|
3
|
+
* into one ring-edged, softly lifted panel tinted by a semantic color role.
|
|
4
4
|
* The role colors border, background, and text together, so {@link Card.Title}
|
|
5
5
|
* and {@link Card.Description} inherit their text color from the root through
|
|
6
6
|
* ordinary CSS inheritance.
|
|
@@ -48,8 +48,10 @@ export declare namespace Card {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* The card panel: a rounded,
|
|
52
|
-
*
|
|
51
|
+
* The card panel: a rounded, softly lifted `<section>` tinted through the
|
|
52
|
+
* `data-color` attribute contract. A neutral card draws its edge as a ring
|
|
53
|
+
* shadow that takes on the tone behind it; a colored one keeps its tinted
|
|
54
|
+
* border inside that ring. Compose {@link Card.Header},
|
|
53
55
|
* {@link Card.Content}, and {@link Card.Footer} inside it.
|
|
54
56
|
*
|
|
55
57
|
* @param handle Runtime handle carrying the host `<section>`'s props.
|
package/dist/components/card.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
2
2
|
import { border } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded, shadow } from "@sdxc/u/effects";
|
|
4
|
+
import { vars } from "@sdxc/u/general";
|
|
4
5
|
import { flex, flexCol, gap, items } from "@sdxc/u/layout";
|
|
5
6
|
import { p, pbe, pbs, pi } from "@sdxc/u/size";
|
|
6
7
|
import { when } from "@sdxc/u/state";
|
|
7
|
-
import { fontSize, leading, tracking, weight } from "@sdxc/u/typography";
|
|
8
|
+
import { balance, fontSize, leading, pretty, tracking, weight } from "@sdxc/u/typography";
|
|
9
|
+
import { SHADOW_RING } from "../styles/floating-surface.js";
|
|
8
10
|
import { semanticColorPanel } from "../styles/semantic-color-panel.js";
|
|
9
11
|
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
10
12
|
/** Semantic color role {@link Card} falls back to when `color` is omitted. */
|
|
11
13
|
const DEFAULT_COLOR = "neutral";
|
|
12
14
|
/**
|
|
13
|
-
* The card panel: a rounded,
|
|
14
|
-
*
|
|
15
|
+
* The card panel: a rounded, softly lifted `<section>` tinted through the
|
|
16
|
+
* `data-color` attribute contract. A neutral card draws its edge as a ring
|
|
17
|
+
* shadow that takes on the tone behind it; a colored one keeps its tinted
|
|
18
|
+
* border inside that ring. Compose {@link Card.Header},
|
|
15
19
|
* {@link Card.Content}, and {@link Card.Footer} inside it.
|
|
16
20
|
*
|
|
17
21
|
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
@@ -38,7 +42,15 @@ export function Card(handle) {
|
|
|
38
42
|
return () => {
|
|
39
43
|
let { color, mix, ...rest } = handle.props;
|
|
40
44
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
41
|
-
return (_jsx("section", { "data-color": resolvedColor, ...rest, mix: [
|
|
45
|
+
return (_jsx("section", { "data-color": resolvedColor, ...rest, mix: [
|
|
46
|
+
semanticColorPanel(),
|
|
47
|
+
rounded("lg"),
|
|
48
|
+
border({ width: 1 }),
|
|
49
|
+
when('&[data-color="neutral"]', border("transparent")),
|
|
50
|
+
shadow("sm"),
|
|
51
|
+
vars({ "ui-box-shadow-ring": SHADOW_RING }),
|
|
52
|
+
mix,
|
|
53
|
+
] }));
|
|
42
54
|
};
|
|
43
55
|
}
|
|
44
56
|
/**
|
|
@@ -74,7 +86,7 @@ Card.Title = function CardTitle(handle) {
|
|
|
74
86
|
let { mix, ...rest } = handle.props;
|
|
75
87
|
let resolved = resolveHeadingLevel(handle);
|
|
76
88
|
let Tag = TAG_BY_LEVEL[resolved];
|
|
77
|
-
return (_jsx(Tag, { ...rest, "data-heading-level": resolved, mix: [fontSize("2xl"), leading(1), weight("semibold"), tracking("tight"), mix], children: rest.children }));
|
|
89
|
+
return (_jsx(Tag, { ...rest, "data-heading-level": resolved, mix: [fontSize("2xl"), leading(1), weight("semibold"), tracking("tight"), balance(), mix], children: rest.children }));
|
|
78
90
|
};
|
|
79
91
|
};
|
|
80
92
|
/**
|
|
@@ -89,12 +101,13 @@ Card.Title = function CardTitle(handle) {
|
|
|
89
101
|
Card.Description = function CardDescription(handle) {
|
|
90
102
|
return () => {
|
|
91
103
|
let { mix, ...rest } = handle.props;
|
|
92
|
-
return _jsx("p", { ...rest, mix: [fontSize("sm"), opacity(70), mix] });
|
|
104
|
+
return _jsx("p", { ...rest, mix: [fontSize("sm"), opacity(70), pretty(), mix] });
|
|
93
105
|
};
|
|
94
106
|
};
|
|
95
107
|
/**
|
|
96
108
|
* The card's main body slot: a `<div>` padded on its inline and block-end
|
|
97
|
-
* edges, leaving its block-start edge flush against {@link Card.Header}.
|
|
109
|
+
* edges, leaving its block-start edge flush against {@link Card.Header}. Its
|
|
110
|
+
* prose wraps with `text-wrap: pretty`, which every paragraph inside inherits.
|
|
98
111
|
*
|
|
99
112
|
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
100
113
|
* @returns The render function producing the body slot's markup.
|
|
@@ -104,13 +117,18 @@ Card.Description = function CardDescription(handle) {
|
|
|
104
117
|
Card.Content = function CardContent(handle) {
|
|
105
118
|
return () => {
|
|
106
119
|
let { mix, ...rest } = handle.props;
|
|
107
|
-
return (_jsx("div", { ...rest,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
return (_jsx("div", { ...rest, mix: [
|
|
121
|
+
/**
|
|
122
|
+
* The body leaves the gap above it to a header, and takes it back when it opens the card,
|
|
123
|
+
* so a card of content alone still clears its own top edge.
|
|
124
|
+
*/
|
|
125
|
+
pbs(0),
|
|
126
|
+
when("&:first-child", pbs(6)),
|
|
127
|
+
pbe(6),
|
|
128
|
+
pi(6),
|
|
129
|
+
pretty(),
|
|
130
|
+
mix,
|
|
131
|
+
] }));
|
|
114
132
|
};
|
|
115
133
|
};
|
|
116
134
|
/**
|
|
@@ -145,12 +145,10 @@ Carousel.Slide = function CarouselSlide(handle) {
|
|
|
145
145
|
attrs({ role: DEFAULT_SLIDE_ROLE }),
|
|
146
146
|
grow(0),
|
|
147
147
|
shrink(0),
|
|
148
|
-
|
|
149
|
-
* The slide snaps to the viewport's start edge
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* next one moving one slide instead — so a row of dots all scroll the same
|
|
153
|
-
* distance and none of them reach the slide they name.
|
|
148
|
+
/**
|
|
149
|
+
* The slide snaps to the viewport's start edge and leaves the scroll free to pass it:
|
|
150
|
+
* `scroll-snap-stop: always` clamps programmatic scrolls too, so every dot would move
|
|
151
|
+
* one slide and none would reach the slide it names.
|
|
154
152
|
*/
|
|
155
153
|
raw({
|
|
156
154
|
flexBasis: "var(--ui-carousel-slide-size, 18rem)",
|
package/dist/components/chart.js
CHANGED
|
@@ -9,7 +9,7 @@ import { bs, is, pb, pi } from "@sdxc/u/size";
|
|
|
9
9
|
import { z } from "@sdxc/u/stacking";
|
|
10
10
|
import { focusVisible, hover, when } from "@sdxc/u/state";
|
|
11
11
|
import { scaleProperty, translateProperty } from "@sdxc/u/transform";
|
|
12
|
-
import { fontSize, leading, nowrap, textDecoration, weight } from "@sdxc/u/typography";
|
|
12
|
+
import { fontSize, leading, nowrap, tabularNums, textDecoration, weight } from "@sdxc/u/typography";
|
|
13
13
|
import { attrs } from "remix/component";
|
|
14
14
|
import { durations, easings } from "../animations/tokens.js";
|
|
15
15
|
import { CHART_COLOR_SLOT_COUNT, chartPalette } from "../styles/chart-palette.js";
|
|
@@ -283,6 +283,7 @@ function ChartTooltip(handle) {
|
|
|
283
283
|
gap(1.5),
|
|
284
284
|
pb(1.5),
|
|
285
285
|
nowrap(),
|
|
286
|
+
tabularNums(),
|
|
286
287
|
opacity(0),
|
|
287
288
|
transition("opacity, scale", { duration: durations.fast, easing: easings.standard }),
|
|
288
289
|
when("&[data-open]", [opacity(100), scaleProperty(1)]),
|
|
@@ -346,8 +347,8 @@ ChartTooltip.Label = function ChartTooltipLabel(handle) {
|
|
|
346
347
|
};
|
|
347
348
|
/**
|
|
348
349
|
* Renders the tooltip's value slot: a native `<span>` showing the hovered
|
|
349
|
-
* point or wedge's own value, weighted
|
|
350
|
-
*
|
|
350
|
+
* point or wedge's own value, weighted as the surface's most prominent figure
|
|
351
|
+
* and set in tabular digits, so the surface holds its width as the value changes.
|
|
351
352
|
*
|
|
352
353
|
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
353
354
|
* @returns The render function producing the value's markup.
|
|
@@ -357,7 +358,7 @@ ChartTooltip.Label = function ChartTooltipLabel(handle) {
|
|
|
357
358
|
ChartTooltip.Value = function ChartTooltipValue(handle) {
|
|
358
359
|
return () => {
|
|
359
360
|
let { mix, ...rest } = handle.props;
|
|
360
|
-
return _jsx("span", { ...rest, "data-slot": "value", mix: [weight("semibold"), mix] });
|
|
361
|
+
return _jsx("span", { ...rest, "data-slot": "value", mix: [weight("semibold"), tabularNums(), mix] });
|
|
361
362
|
};
|
|
362
363
|
};
|
|
363
364
|
// @ts-ignore
|
|
@@ -32,8 +32,8 @@ export function Checkbox(handle) {
|
|
|
32
32
|
warnIfNoAccessibleName(handle.props, children, "Checkbox: a checkbox with no visible label text needs an `aria-label` describing what it toggles — assistive technology has no accessible name to announce otherwise.");
|
|
33
33
|
return (_jsxs("label", { mix: [relative(), hstack({ gap: 2, align: "center" })], children: [_jsxs("span", { "aria-hidden": "true", "data-slot": "box", "data-color": resolvedColor, mix: [
|
|
34
34
|
center(),
|
|
35
|
-
is("1.25rem"),
|
|
36
|
-
bs("1.25rem"),
|
|
35
|
+
is("var(--ui-checkbox-size, 1.25rem)"),
|
|
36
|
+
bs("var(--ui-checkbox-size, 1.25rem)"),
|
|
37
37
|
shrink(0),
|
|
38
38
|
rounded("sm"),
|
|
39
39
|
border({ width: 2, color: "neutral.strong" }),
|
|
@@ -95,7 +95,7 @@ ColorPicker.Group = function ColorPickerGroup(handle) {
|
|
|
95
95
|
return () => {
|
|
96
96
|
let { mix, ...rest } = handle.props;
|
|
97
97
|
return (_jsx("div", { ...rest, "data-slot": "group", mix: [
|
|
98
|
-
|
|
98
|
+
/**
|
|
99
99
|
* Focus is shown by the control that holds it, the way `Group` shows it: a ring
|
|
100
100
|
* around the row says the group is focused without saying whether the field or
|
|
101
101
|
* the preview has it, and it stacks with the ring that control draws for itself.
|
|
@@ -142,18 +142,15 @@ ColorPicker.Trigger = function ColorPickerTrigger(handle) {
|
|
|
142
142
|
p(0),
|
|
143
143
|
shrink(),
|
|
144
144
|
when('&[data-shape="square"]', rounded("none")),
|
|
145
|
-
|
|
146
|
-
* The
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* swatch's own, which leaves the preview at its default size in a corner of the
|
|
150
|
-
* button.
|
|
145
|
+
/**
|
|
146
|
+
* The swatch grows through the size variable it reads itself: a size passed down as
|
|
147
|
+
* `mix` compiles into its own cascade layer, which can land before the swatch's own
|
|
148
|
+
* and leave the preview at its default size in a corner of the button.
|
|
151
149
|
*/
|
|
152
150
|
raw({ "--ui-color-swatch-size-md": "100%" }),
|
|
153
|
-
|
|
154
|
-
* Hover steps the preview's edge one shade darker
|
|
155
|
-
*
|
|
156
|
-
* two together read as a border drawn twice.
|
|
151
|
+
/**
|
|
152
|
+
* Hover steps the preview's edge one shade darker, so the edge the swatch already
|
|
153
|
+
* draws stays the only one and the border reads once.
|
|
157
154
|
*/
|
|
158
155
|
when("&:hover", raw({ boxShadow: "0 0 0 1px var(--ui-neutral-border-hover)" })),
|
|
159
156
|
media("(prefers-reduced-motion: reduce)", raw({ transitionDuration: "0s" })),
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
|
2
2
|
import { bg, border, outlineStyle } from "@sdxc/u/color";
|
|
3
3
|
import { rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, pseudoContent } from "@sdxc/u/general";
|
|
5
|
-
import { absolute, appearance, inset, relative, vstack } from "@sdxc/u/layout";
|
|
5
|
+
import { absolute, appearance, insBe, insBs, inset, relative, vstack } from "@sdxc/u/layout";
|
|
6
6
|
import { bs, is, m, minIs } from "@sdxc/u/size";
|
|
7
7
|
import { z } from "@sdxc/u/stacking";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
@@ -41,6 +41,12 @@ const DEFAULT_STEP_BY_CHANNEL = {
|
|
|
41
41
|
lightness: 1,
|
|
42
42
|
alpha: 0.01,
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Negative inset growing {@link ColorSlider.Thumb}'s native input across the track's
|
|
46
|
+
* block axis to the larger of the thumb and `--ui-target-size`, clamped at zero so a
|
|
47
|
+
* track already that thick keeps its own box.
|
|
48
|
+
*/
|
|
49
|
+
const THUMB_HIT_INSET = "min(0px, calc((100% - max(var(--ui-color-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem))) / 2))";
|
|
44
50
|
/**
|
|
45
51
|
* Builds one {@link ColorSlider.Track} gradient string from its color stops,
|
|
46
52
|
* reading {@link TRACK_DIRECTION_PROPERTY} for its direction so the same
|
|
@@ -88,10 +94,9 @@ export function ColorSlider(handle) {
|
|
|
88
94
|
return (_jsx("div", { "data-channel": channel, ...rest, mix: [
|
|
89
95
|
vstack({ gap: 2 }),
|
|
90
96
|
is("full"),
|
|
91
|
-
|
|
92
|
-
* The slider takes the width it is given
|
|
93
|
-
*
|
|
94
|
-
* makes the panel overflow, and the track is what runs off the edge.
|
|
97
|
+
/**
|
|
98
|
+
* The slider takes the width it is given, so a narrow panel keeps the track inside it
|
|
99
|
+
* instead of overflowing with the track running off the edge.
|
|
95
100
|
*/
|
|
96
101
|
minIs(0),
|
|
97
102
|
mix,
|
|
@@ -170,6 +175,12 @@ ColorSlider.Thumb = function ColorSliderThumb(handle) {
|
|
|
170
175
|
cursor("pointer"),
|
|
171
176
|
when("&:disabled", cursor("not-allowed")),
|
|
172
177
|
inset("0"),
|
|
178
|
+
/**
|
|
179
|
+
* The native input reaches past the track's block axis to a full pointer target,
|
|
180
|
+
* centred so the thumb stays on the visible gradient.
|
|
181
|
+
*/
|
|
182
|
+
insBs(THUMB_HIT_INSET),
|
|
183
|
+
insBe(THUMB_HIT_INSET),
|
|
173
184
|
m("0"),
|
|
174
185
|
bg("transparent"),
|
|
175
186
|
outlineStyle("none"),
|
|
@@ -3,9 +3,10 @@ import { visuallyHidden } from "@sdxc/u/a11y";
|
|
|
3
3
|
import { border, outline } from "@sdxc/u/color";
|
|
4
4
|
import { opacity, ringShadow, transition } from "@sdxc/u/effects";
|
|
5
5
|
import { cursor } from "@sdxc/u/general";
|
|
6
|
-
import { flexWrap, hstack, inlineFlex } from "@sdxc/u/layout";
|
|
6
|
+
import { flexWrap, hstack, inlineFlex, relative } from "@sdxc/u/layout";
|
|
7
7
|
import { precededBy, when } from "@sdxc/u/state";
|
|
8
8
|
import { attrs } from "remix/component";
|
|
9
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
9
10
|
import { ColorSwatch } from "./color-swatch.js";
|
|
10
11
|
/**
|
|
11
12
|
* `role="radiogroup"` applied through {@link attrs} unless a consumer
|
|
@@ -41,9 +42,9 @@ export function ColorSwatchPicker(handle) {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
* Renders a single option: a hidden `<input type="radio">` paired with a
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Renders a single option: a hidden `<input type="radio">` paired with a {@link ColorSwatch}
|
|
46
|
+
* styled through `precededBy()` (a bare element-first selector serializes as a declaration),
|
|
47
|
+
* with the option's pointer target grown to `--ui-target-size` around smaller swatches.
|
|
47
48
|
*
|
|
48
49
|
* @param handle Runtime handle carrying the host `<label>`'s props.
|
|
49
50
|
* @returns The render function producing the option's markup.
|
|
@@ -60,7 +61,9 @@ ColorSwatchPicker.Swatch = function ColorSwatchPickerSwatch(handle) {
|
|
|
60
61
|
let context = handle.context.get(ColorSwatchPicker);
|
|
61
62
|
let resolvedName = name ?? context.name;
|
|
62
63
|
return (_jsxs("label", { ...rest, mix: [
|
|
64
|
+
relative(),
|
|
63
65
|
inlineFlex(),
|
|
66
|
+
hitArea(),
|
|
64
67
|
cursor("default"),
|
|
65
68
|
when("&:has(input:disabled)", [cursor("not-allowed"), opacity(50)]),
|
|
66
69
|
mix,
|
|
@@ -69,11 +69,10 @@ export function ColorWheel(handle) {
|
|
|
69
69
|
warnIfNoAccessibleLabel(handle.props, "ColorWheel: a wheel with no `aria-label` or `aria-labelledby` needs one describing the hue it picks — assistive technology has no accessible name to announce otherwise.");
|
|
70
70
|
return (_jsx("div", { ...rest, "data-slot": "color-wheel", style: resolvedStyle, mix: [
|
|
71
71
|
relative(),
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* circular rule and stretch the wheel into an ellipse.
|
|
72
|
+
/**
|
|
73
|
+
* Each shape sizes itself under a selector excluding the other: a bare `is("full")`
|
|
74
|
+
* compiles into its own cascade layer, which can land after the circular rule and
|
|
75
|
+
* stretch the wheel into an ellipse.
|
|
77
76
|
*/
|
|
78
77
|
when('&:not([data-shape="circular"])', [block(), is("full"), minIs("10rem")]),
|
|
79
78
|
when('&[data-shape="circular"]', when("&:has(> input:focus-visible)", outline({ color: "brand.ring", offset: 2 }))),
|
|
@@ -82,10 +81,9 @@ export function ColorWheel(handle) {
|
|
|
82
81
|
is("var(--ui-color-wheel-size, 12rem)"),
|
|
83
82
|
bs("var(--ui-color-wheel-size, 12rem)"),
|
|
84
83
|
minIs("0"),
|
|
85
|
-
|
|
86
|
-
* A wheel
|
|
87
|
-
*
|
|
88
|
-
* runs short, and a circle squeezed on one axis is an ellipse.
|
|
84
|
+
/**
|
|
85
|
+
* A wheel holds its one measure on both axes; as a flex item it would shrink on the
|
|
86
|
+
* inline axis alone when the row runs short, and a circle squeezed on one axis is an ellipse.
|
|
89
87
|
*/
|
|
90
88
|
shrink(),
|
|
91
89
|
rounded("full"),
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx } from "remix/component/jsx-runtime";
|
|
|
2
2
|
import { ChevronDownIcon } from "@sdxc/icons";
|
|
3
3
|
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
4
|
import { rounded } from "@sdxc/u/effects";
|
|
5
|
-
import { center, hstack, spacer, vstack } from "@sdxc/u/layout";
|
|
5
|
+
import { center, hstack, relative, spacer, vstack } from "@sdxc/u/layout";
|
|
6
6
|
import { bs, is, mis, pie } from "@sdxc/u/size";
|
|
7
7
|
import { when } from "@sdxc/u/state";
|
|
8
|
+
import { hitArea } from "../styles/hit-area.js";
|
|
8
9
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
9
10
|
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
10
11
|
import { Input } from "./input.js";
|
|
@@ -81,6 +82,7 @@ ComboBox.Input = function ComboBoxInput(handle) {
|
|
|
81
82
|
* Renders {@link ComboBox}'s trailing disclosure glyph: a native `<button>`
|
|
82
83
|
* pulled back over {@link ComboBox.Input}'s padding so it reads as part of
|
|
83
84
|
* the same field, its chevron marked `aria-hidden` since it carries no text.
|
|
85
|
+
* Its pointer target grows to `--ui-target-size` past its drawn 28px box.
|
|
84
86
|
*
|
|
85
87
|
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
86
88
|
* @returns The render function producing the button's markup.
|
|
@@ -94,6 +96,8 @@ ComboBox.Button = function ComboBoxButton(handle) {
|
|
|
94
96
|
return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, mix: [
|
|
95
97
|
interactiveTransition(),
|
|
96
98
|
center(),
|
|
99
|
+
relative(),
|
|
100
|
+
hitArea(),
|
|
97
101
|
is("1.75rem"),
|
|
98
102
|
bs("1.75rem"),
|
|
99
103
|
rounded("sm"),
|
|
@@ -55,9 +55,9 @@ export declare namespace Command {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Renders the panel's root host:
|
|
59
|
-
* stacking its compound parts in a
|
|
60
|
-
*
|
|
58
|
+
* Renders the panel's root host: an elevated `<div>` rounded concentric
|
|
59
|
+
* with {@link Command.Item}'s corners, stacking its compound parts in a
|
|
60
|
+
* column and clipping {@link Command.List}'s scrolled content to that radius.
|
|
61
61
|
*
|
|
62
62
|
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
63
63
|
* @returns The render function producing the panel's markup.
|