@sdxc/ui 0.0.0-pre.1 → 2026.9.28
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/dist/animations/keyframes.d.ts +6 -0
- package/dist/animations/keyframes.js +8 -4
- package/dist/components/accordion.js +5 -1
- package/dist/components/alert-dialog.js +2 -2
- package/dist/components/attachment.js +7 -2
- package/dist/components/bubble.js +14 -20
- package/dist/components/button.d.ts +0 -14
- package/dist/components/button.js +60 -19
- package/dist/components/calendar.js +12 -5
- package/dist/components/card.js +8 -1
- package/dist/components/carousel.js +9 -3
- package/dist/components/color-picker.js +23 -4
- package/dist/components/color-slider.js +11 -1
- package/dist/components/color-wheel.js +14 -4
- package/dist/components/command.js +34 -7
- package/dist/components/date-picker.d.ts +20 -53
- package/dist/components/date-picker.js +50 -108
- package/dist/components/date-range-picker.d.ts +22 -43
- package/dist/components/date-range-picker.js +8 -52
- package/dist/components/dialog.js +15 -3
- package/dist/components/disclosure.d.ts +4 -1
- package/dist/components/disclosure.js +52 -11
- package/dist/components/drawer.js +16 -0
- package/dist/components/drop-indicator.d.ts +9 -8
- package/dist/components/drop-indicator.js +19 -6
- package/dist/components/empty.js +18 -3
- package/dist/components/file-trigger.js +35 -15
- package/dist/components/form.d.ts +15 -1
- package/dist/components/form.js +16 -6
- package/dist/components/grid-list.js +23 -7
- package/dist/components/group.d.ts +6 -6
- package/dist/components/group.js +28 -6
- package/dist/components/hover-card.js +38 -2
- package/dist/components/image-placeholder.js +8 -2
- package/dist/components/input.js +22 -21
- package/dist/components/item.js +9 -1
- package/dist/components/keyboard.d.ts +7 -7
- package/dist/components/keyboard.js +33 -7
- package/dist/components/link-button.js +32 -18
- package/dist/components/listbox.js +10 -1
- package/dist/components/menu.js +8 -2
- package/dist/components/message-scroller.js +19 -6
- package/dist/components/meter.js +17 -8
- package/dist/components/number-field.js +9 -3
- package/dist/components/overlay-arrow.js +16 -2
- package/dist/components/popover.js +31 -8
- package/dist/components/range-calendar.js +18 -4
- package/dist/components/search-field.d.ts +26 -1
- package/dist/components/search-field.js +84 -4
- package/dist/components/select.d.ts +7 -1
- package/dist/components/select.js +33 -29
- package/dist/components/sidebar.js +32 -11
- package/dist/components/slider.js +10 -6
- package/dist/components/table.js +2 -2
- package/dist/components/toggle-button.js +39 -15
- package/dist/components/tree.d.ts +6 -6
- package/dist/components/tree.js +25 -9
- package/dist/components/typeset.js +12 -1
- package/dist/mixins/calendar-keys.d.ts +6 -6
- package/dist/mixins/calendar-keys.js +35 -6
- package/dist/mixins/carousel-controls.d.ts +4 -2
- package/dist/mixins/carousel-controls.js +71 -20
- package/dist/mixins/clear-field.d.ts +9 -7
- package/dist/mixins/clear-field.js +25 -8
- package/dist/mixins/command-keys.js +22 -7
- package/dist/mixins/context-menu.d.ts +2 -0
- package/dist/mixins/context-menu.js +27 -1
- package/dist/mixins/copy-to-clipboard.js +15 -1
- package/dist/mixins/grid-list-keys.d.ts +6 -6
- package/dist/mixins/grid-list-keys.js +28 -6
- package/dist/mixins/hotkey.js +16 -9
- package/dist/mixins/index.d.ts +1 -0
- package/dist/mixins/index.js +1 -0
- package/dist/mixins/listbox-keys.js +20 -2
- package/dist/mixins/message-follow.js +50 -12
- package/dist/mixins/mirror-selected-option.d.ts +24 -0
- package/dist/mixins/mirror-selected-option.js +35 -0
- package/dist/mixins/treeKeys.d.ts +3 -2
- package/dist/mixins/treeKeys.js +53 -6
- package/dist/mixins/validate.d.ts +1 -1
- package/package.json +4 -4
- package/src/theme.css +33 -3
|
@@ -94,6 +94,12 @@ export declare namespace Shimmer {
|
|
|
94
94
|
easing?: string;
|
|
95
95
|
/** Width of the moving highlight band, as a CSS length or percentage. Defaults to {@link DEFAULT_SHIMMER_BAND_SIZE}. */
|
|
96
96
|
bandSize?: string;
|
|
97
|
+
/**
|
|
98
|
+
* What the host looks like outside the gate. `"hidden"` suits an element that
|
|
99
|
+
* exists only as a loading cue; `"visible"` keeps an element that carries its own
|
|
100
|
+
* content legible once the loop settles. Defaults to `"hidden"`.
|
|
101
|
+
*/
|
|
102
|
+
outsideGate?: "hidden" | "visible";
|
|
97
103
|
/**
|
|
98
104
|
* Selector fragment, relative to the host, that gates the loop. Defaults
|
|
99
105
|
* to {@link DEFAULT_SHIMMER_WHEN}; pass a custom fragment (e.g.
|
|
@@ -93,16 +93,20 @@ function resolveTarget(when) {
|
|
|
93
93
|
/**
|
|
94
94
|
* Mount/gate shell every loop factory wraps its animation in: an
|
|
95
95
|
* `@starting-style` fade from {@link HIDDEN_OPACITY}, an `allow-discrete`
|
|
96
|
-
* transition, and a
|
|
96
|
+
* transition, and, for a host that exists only as a loading cue, a return to hidden
|
|
97
|
+
* outside the `when` gate. A host that carries content of its own asks to stay
|
|
98
|
+
* `"visible"` there instead, so its text survives the loop settling.
|
|
97
99
|
*/
|
|
98
|
-
function loopShell(target, when, fadeDurationVar, restOpacity) {
|
|
100
|
+
function loopShell(target, when, fadeDurationVar, restOpacity, outsideGate = "hidden") {
|
|
99
101
|
return combine([
|
|
100
102
|
raw({
|
|
101
103
|
opacity: restOpacity,
|
|
102
104
|
transition: `opacity var(${fadeDurationVar}, ${DEFAULT_FADE_DURATION}) ease, display var(${fadeDurationVar}, ${DEFAULT_FADE_DURATION}) ease-out`,
|
|
103
105
|
}),
|
|
104
106
|
transitionBehavior("allow-discrete"),
|
|
105
|
-
when === undefined
|
|
107
|
+
when === undefined || outsideGate === "visible"
|
|
108
|
+
? undefined
|
|
109
|
+
: gate(`&:not(${when})`, opacity(HIDDEN_OPACITY)),
|
|
106
110
|
startingStyle(gate(target, opacity(HIDDEN_OPACITY))),
|
|
107
111
|
]);
|
|
108
112
|
}
|
|
@@ -199,7 +203,7 @@ export function shimmer(options = {}) {
|
|
|
199
203
|
let when = options.when ?? DEFAULT_SHIMMER_WHEN;
|
|
200
204
|
let target = resolveTarget(when);
|
|
201
205
|
return combine([
|
|
202
|
-
loopShell(target, when, "--ui-shimmer-fade-duration", 1),
|
|
206
|
+
loopShell(target, when, "--ui-shimmer-fade-duration", 1, options.outsideGate),
|
|
203
207
|
keyframes("ui-shimmer-sweep", {
|
|
204
208
|
from: { backgroundPosition: "-100% 0" },
|
|
205
209
|
to: { backgroundPosition: "200% 0" },
|
|
@@ -160,6 +160,10 @@ Accordion.Trigger = function AccordionTrigger(handle) {
|
|
|
160
160
|
Accordion.Content = function AccordionContent(handle) {
|
|
161
161
|
return () => {
|
|
162
162
|
let { mix, ...rest } = handle.props;
|
|
163
|
-
|
|
163
|
+
/*
|
|
164
|
+
* A row in an accordion runs edge to edge, the way its trigger does, so the panel's
|
|
165
|
+
* own inline inset is released here rather than carried through.
|
|
166
|
+
*/
|
|
167
|
+
return _jsx(Disclosure.Panel, { ...rest, mix: [pi(0), pbe(4), fg("neutral"), text("sm"), mix] });
|
|
164
168
|
};
|
|
165
169
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
2
|
import { fg } from "@sdxc/u/color";
|
|
3
3
|
import { flex, gap, justify, vstack } from "@sdxc/u/layout";
|
|
4
|
-
import {
|
|
4
|
+
import { mbs } from "@sdxc/u/size";
|
|
5
5
|
import { text, weight } from "@sdxc/u/typography";
|
|
6
6
|
import { Button } from "./button.js";
|
|
7
7
|
import { Dialog } from "./dialog.js";
|
|
@@ -47,7 +47,7 @@ const DEFAULT_CANCEL_COLOR = "neutral";
|
|
|
47
47
|
export function AlertDialog(handle) {
|
|
48
48
|
return () => {
|
|
49
49
|
let { children, mix, ...rest } = handle.props;
|
|
50
|
-
return (_jsx(Dialog, { ...rest, role: "alertdialog", closedby: "closerequest", mix:
|
|
50
|
+
return (_jsx(Dialog, { ...rest, role: "alertdialog", closedby: "closerequest", mix: mix, children: children }));
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -28,7 +28,7 @@ const NARROW_CONTAINER_QUERY = `@container ${CONTAINER_NAME} (max-width: 12rem)`
|
|
|
28
28
|
/**
|
|
29
29
|
* Selector fragment gating {@link Attachment.Title}'s shimmer: it matches the
|
|
30
30
|
* title's own `data-state` attribute while that reads `"uploading"` or
|
|
31
|
-
* `"processing"`, so a title
|
|
31
|
+
* `"processing"`, so a title in any other state renders as plain text.
|
|
32
32
|
*/
|
|
33
33
|
const TITLE_SHIMMER_WHEN = ':is([data-state="uploading"], [data-state="processing"])';
|
|
34
34
|
const DEFAULT_ACTION_VARIANT = "ghost";
|
|
@@ -174,7 +174,12 @@ Attachment.Title = function AttachmentTitle(handle) {
|
|
|
174
174
|
weight("semibold"),
|
|
175
175
|
truncate(),
|
|
176
176
|
text("sm"),
|
|
177
|
-
|
|
177
|
+
/*
|
|
178
|
+
* The loop settles visible, because this host carries the file's name: a gated
|
|
179
|
+
* loop rests hidden outside its gate, which suits an element that exists only
|
|
180
|
+
* as a loading cue and would leave every finished upload unnamed.
|
|
181
|
+
*/
|
|
182
|
+
shimmer({ when: TITLE_SHIMMER_WHEN, outsideGate: "visible" }),
|
|
178
183
|
mix,
|
|
179
184
|
], children: children }));
|
|
180
185
|
};
|
|
@@ -2,17 +2,13 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { bg, border, fg } from "@sdxc/u/color";
|
|
3
3
|
import { rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { raw, vars } from "@sdxc/u/general";
|
|
5
|
-
import { block,
|
|
6
|
-
import { maxIs,
|
|
5
|
+
import { block, flex, flexWrap, gap, items, vstack } from "@sdxc/u/layout";
|
|
6
|
+
import { maxIs, mie, mis, pb, pbe, pi, width } from "@sdxc/u/size";
|
|
7
7
|
import { data, when } from "@sdxc/u/state";
|
|
8
8
|
import { wordBreak } from "@sdxc/u/typography";
|
|
9
9
|
import { attrs } from "remix/ui";
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
* {@link Bubble.Reactions} can measure the frame's own width and fall back to
|
|
13
|
-
* a plain, non-overlapping row once that space runs out.
|
|
14
|
-
*/
|
|
15
|
-
const CONTAINER_NAME = "ui-bubble";
|
|
10
|
+
/** Selector matching every framed variant, the ones that hug their own text. */
|
|
11
|
+
const FRAMED = '&:not([data-variant="ghost"])';
|
|
16
12
|
/** Visual weight {@link Bubble} falls back to when `variant` is omitted. */
|
|
17
13
|
const DEFAULT_VARIANT = "default";
|
|
18
14
|
/** Edge of the row {@link Bubble} falls back to when `align` is omitted. */
|
|
@@ -50,20 +46,18 @@ export function Bubble(handle) {
|
|
|
50
46
|
let resolvedVariant = variant ?? DEFAULT_VARIANT;
|
|
51
47
|
let resolvedAlign = align ?? DEFAULT_ALIGN;
|
|
52
48
|
return (_jsx("div", { ...rest, "data-slot": "bubble", "data-variant": resolvedVariant, "data-align": resolvedAlign, mix: [
|
|
53
|
-
container(CONTAINER_NAME),
|
|
54
49
|
block(),
|
|
55
|
-
maxIs("80%"),
|
|
56
50
|
rounded("xl"),
|
|
57
51
|
border({ width: 1 }),
|
|
58
52
|
border("transparent"),
|
|
59
|
-
width("fit-content"),
|
|
53
|
+
when(FRAMED, [width("fit-content"), maxIs("80%")]),
|
|
54
|
+
when(`${FRAMED}[data-align="start"]`, mie("auto")),
|
|
55
|
+
when(`${FRAMED}[data-align="end"]`, mis("auto")),
|
|
60
56
|
data("align", "start", [
|
|
61
|
-
mie("auto"),
|
|
62
57
|
raw({ borderEndStartRadius: "var(--ui-radius-xs, 0.125rem)" }),
|
|
63
58
|
vars({ "ui-bubble-reactions-justify": "flex-start" }),
|
|
64
59
|
]),
|
|
65
60
|
data("align", "end", [
|
|
66
|
-
mis("auto"),
|
|
67
61
|
raw({ borderEndEndRadius: "var(--ui-radius-xs, 0.125rem)" }),
|
|
68
62
|
vars({ "ui-bubble-reactions-justify": "flex-end" }),
|
|
69
63
|
]),
|
|
@@ -78,12 +72,8 @@ export function Bubble(handle) {
|
|
|
78
72
|
]),
|
|
79
73
|
data("variant", "ghost", [
|
|
80
74
|
fg("neutral.emphasis"),
|
|
81
|
-
maxIs("none"),
|
|
82
|
-
mis(0),
|
|
83
|
-
mie(0),
|
|
84
75
|
bg("transparent"),
|
|
85
76
|
border("transparent"),
|
|
86
|
-
width("full"),
|
|
87
77
|
]),
|
|
88
78
|
data("variant", "destructive", [bg("danger.solid"), fg("danger.onSolid")]),
|
|
89
79
|
mix,
|
|
@@ -172,10 +162,14 @@ Bubble.Reactions = function BubbleReactions(handle) {
|
|
|
172
162
|
flexWrap("wrap"),
|
|
173
163
|
items("center"),
|
|
174
164
|
gap(1),
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
/*
|
|
166
|
+
* The row sits on the line the turn's own text sits on, and clears the frame's
|
|
167
|
+
* lower edge: inset to match the content beside it, a negative pull would lift
|
|
168
|
+
* the reactions into the last line of the message they belong to.
|
|
169
|
+
*/
|
|
170
|
+
pi(3.5),
|
|
171
|
+
pbe(2.5),
|
|
177
172
|
raw({ justifyContent: "var(--ui-bubble-reactions-justify, flex-start)" }),
|
|
178
|
-
when(`@container ${CONTAINER_NAME} (max-width: 16rem)`, mbs("0.375rem")),
|
|
179
173
|
mix,
|
|
180
174
|
], children: children }));
|
|
181
175
|
};
|
|
@@ -61,18 +61,4 @@ export declare namespace Button {
|
|
|
61
61
|
parts?: PartsProps;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Visual state lives in `data-color`/`data-variant`/`data-size` on the host, so
|
|
66
|
-
* hover, pressed, and focus-visible stay on native pseudo-classes. `type` precedes
|
|
67
|
-
* the spread so the platform sees it while parsing `command`/`commandfor`.
|
|
68
|
-
*
|
|
69
|
-
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
70
|
-
* @returns The render function producing the button's markup.
|
|
71
|
-
* @example
|
|
72
|
-
* <Button type="submit">{t("actions.save")}</Button>
|
|
73
|
-
* @example
|
|
74
|
-
* <Button color="danger" variant="outline" size="sm">{t("actions.delete")}</Button>
|
|
75
|
-
* @example
|
|
76
|
-
* <Button type="submit" isPending={isSubmitting}>{t("actions.save")}</Button>
|
|
77
|
-
*/
|
|
78
64
|
export declare function Button(handle: Handle<Button.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -4,7 +4,7 @@ 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, pb, pi } from "@sdxc/u/size";
|
|
7
|
+
import { bs, is, minBs, pb, pi } from "@sdxc/u/size";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
9
9
|
import { text, weight } from "@sdxc/u/typography";
|
|
10
10
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
@@ -32,6 +32,17 @@ const INVOKER_TYPE = "button";
|
|
|
32
32
|
* @example
|
|
33
33
|
* <Button type="submit" isPending={isSubmitting}>{t("actions.save")}</Button>
|
|
34
34
|
*/
|
|
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
|
+
}
|
|
35
46
|
export function Button(handle) {
|
|
36
47
|
return () => {
|
|
37
48
|
let { color, variant, size, isPending, disabled, type, parts, children, mix, ...rest } = handle.props;
|
|
@@ -41,8 +52,9 @@ export function Button(handle) {
|
|
|
41
52
|
let resolvedVariant = variant ?? DEFAULT_VARIANT;
|
|
42
53
|
let resolvedSize = size ?? DEFAULT_SIZE;
|
|
43
54
|
let resolvedDisabled = disabled || isPending;
|
|
55
|
+
let iconOnly = holdsOnlyAGlyph(children);
|
|
44
56
|
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.");
|
|
45
|
-
return (_jsx("button", { type: resolvedType, ...rest, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": resolvedSize, "data-pending": isPending || undefined, disabled: resolvedDisabled, mix: [
|
|
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: [
|
|
46
58
|
when("&:focus-visible", [
|
|
47
59
|
outline({ color: "brand.ring", offset: 2 }),
|
|
48
60
|
when('&[data-color="neutral"]', outline("neutral.ring")),
|
|
@@ -56,11 +68,13 @@ export function Button(handle) {
|
|
|
56
68
|
justify("center"),
|
|
57
69
|
gap(2),
|
|
58
70
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
71
|
+
* A glyph is measured against the label it sits beside rather than against
|
|
72
|
+
* whatever an icon set draws at, so the row keeps the height its text and
|
|
73
|
+
* padding ask for. It never shrinks either: squeeze the row and the default
|
|
74
|
+
* `flex-shrink: 1` compresses the glyph rather than the words, and a squashed
|
|
75
|
+
* icon reads as a rendering fault.
|
|
62
76
|
*/
|
|
63
|
-
when("& > svg", shrink()),
|
|
77
|
+
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
64
78
|
rounded("md"),
|
|
65
79
|
weight("medium"),
|
|
66
80
|
cursor("default"),
|
|
@@ -73,9 +87,36 @@ export function Button(handle) {
|
|
|
73
87
|
* fill (transparent for ghost), so solid and ghost render the exact
|
|
74
88
|
* footprint outline does.
|
|
75
89
|
*/
|
|
76
|
-
border({ width:
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
border({ width: 1, noStyleDefault: true }),
|
|
91
|
+
/*
|
|
92
|
+
* The row measure is stated rather than left to fall out of the padding and
|
|
93
|
+
* the border, so the control lines up with a field of the same size when a
|
|
94
|
+
* Group fuses the two, and still grows when a long label wraps.
|
|
95
|
+
*/
|
|
96
|
+
minBs("2.5rem"),
|
|
97
|
+
when('&[data-size="sm"]', [
|
|
98
|
+
pi(3),
|
|
99
|
+
pb(1.5),
|
|
100
|
+
text("xs"),
|
|
101
|
+
minBs("2rem"),
|
|
102
|
+
when("& > svg", [is(3), bs(3)]),
|
|
103
|
+
]),
|
|
104
|
+
when('&[data-size="lg"]', [
|
|
105
|
+
pi(5),
|
|
106
|
+
pb(2.5),
|
|
107
|
+
text("base"),
|
|
108
|
+
minBs("3rem"),
|
|
109
|
+
when("& > svg", [is(5), bs(5)]),
|
|
110
|
+
]),
|
|
111
|
+
/*
|
|
112
|
+
* A button holding a glyph and nothing else is a target for that glyph alone, so
|
|
113
|
+
* it takes a round footprint as tall as the row it would otherwise fill. The
|
|
114
|
+
* measure is written out per size, since a box sized by its own content on both
|
|
115
|
+
* axes has no ratio to resolve against.
|
|
116
|
+
*/
|
|
117
|
+
when("&[data-icon-only]", [pi(0), is("2.5rem"), bs("2.5rem"), shrink(), rounded("full")]),
|
|
118
|
+
when('&[data-size="sm"][data-icon-only]', [is("2rem"), bs("2rem")]),
|
|
119
|
+
when('&[data-size="lg"][data-icon-only]', [is("3rem"), bs("3rem")]),
|
|
79
120
|
when('&[data-variant="solid"]', [
|
|
80
121
|
when('&[data-color="brand"]', [
|
|
81
122
|
bg("brand.solid"),
|
|
@@ -125,33 +166,33 @@ export function Button(handle) {
|
|
|
125
166
|
when('&[data-variant="outline"]', [
|
|
126
167
|
bg("transparent"),
|
|
127
168
|
when('&[data-color="brand"]', [
|
|
128
|
-
border("brand
|
|
169
|
+
border("brand"),
|
|
129
170
|
fg("brand"),
|
|
130
|
-
when("&:hover", bg("brand.tint")),
|
|
171
|
+
when("&:hover", [bg("brand.tint"), border("brand.border-hover")]),
|
|
131
172
|
when("&:active", bg("brand.bg-tint-hover")),
|
|
132
173
|
]),
|
|
133
174
|
when('&[data-color="neutral"]', [
|
|
134
|
-
border("neutral
|
|
175
|
+
border("neutral"),
|
|
135
176
|
fg("neutral"),
|
|
136
|
-
when("&:hover", bg("neutral.tint")),
|
|
177
|
+
when("&:hover", [bg("neutral.tint"), border("neutral.border-hover")]),
|
|
137
178
|
when("&:active", bg("neutral.bg-tint-hover")),
|
|
138
179
|
]),
|
|
139
180
|
when('&[data-color="success"]', [
|
|
140
|
-
border("success
|
|
181
|
+
border("success"),
|
|
141
182
|
fg("success"),
|
|
142
|
-
when("&:hover", bg("success.tint")),
|
|
183
|
+
when("&:hover", [bg("success.tint"), border("success.border-hover")]),
|
|
143
184
|
when("&:active", bg("success.bg-tint-hover")),
|
|
144
185
|
]),
|
|
145
186
|
when('&[data-color="warning"]', [
|
|
146
|
-
border("warning
|
|
187
|
+
border("warning"),
|
|
147
188
|
fg("warning"),
|
|
148
|
-
when("&:hover", bg("warning.tint")),
|
|
189
|
+
when("&:hover", [bg("warning.tint"), border("warning.border-hover")]),
|
|
149
190
|
when("&:active", bg("warning.bg-tint-hover")),
|
|
150
191
|
]),
|
|
151
192
|
when('&[data-color="danger"]', [
|
|
152
|
-
border("danger
|
|
193
|
+
border("danger"),
|
|
153
194
|
fg("danger"),
|
|
154
|
-
when("&:hover", bg("danger.tint")),
|
|
195
|
+
when("&:hover", [bg("danger.tint"), border("danger.border-hover")]),
|
|
155
196
|
when("&:active", bg("danger.bg-tint-hover")),
|
|
156
197
|
]),
|
|
157
198
|
]),
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
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
|
-
import { cursor } from "@sdxc/u/general";
|
|
5
|
+
import { cursor, raw } from "@sdxc/u/general";
|
|
6
6
|
import { basis, borderCollapse, borderSpacing, flex, grow, inlineBlock, items, justify, 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, weight } from "@sdxc/u/typography";
|
|
10
|
+
import { text, textAlign, textDecoration, verticalAlign, weight } from "@sdxc/u/typography";
|
|
11
11
|
import { attrs } from "remix/ui";
|
|
12
12
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
13
|
import { warnIfNoAccessibleLabel, warnIfNoAccessibleName, } from "../utils/warn-if-no-accessible-name.js";
|
|
@@ -299,9 +299,16 @@ Calendar.Cell = function CalendarCell(handle) {
|
|
|
299
299
|
return (_jsx("td", { ...rest, "data-slot": "cell", mix: [
|
|
300
300
|
interactiveTransition(),
|
|
301
301
|
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
/*
|
|
303
|
+
* The day sits centred inside the cell through table alignment, which is what
|
|
304
|
+
* keeps the cell a cell: a flex box here would take every day out of the row it
|
|
305
|
+
* belongs to and stack the month into a single column. A row laid out as a flex
|
|
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.
|
|
308
|
+
*/
|
|
309
|
+
textAlign("center"),
|
|
310
|
+
verticalAlign("middle"),
|
|
311
|
+
raw({ alignContent: "center" }),
|
|
305
312
|
is(9),
|
|
306
313
|
bs(9),
|
|
307
314
|
cursor("default"),
|
package/dist/components/card.js
CHANGED
|
@@ -3,6 +3,7 @@ import { border } from "@sdxc/u/color";
|
|
|
3
3
|
import { opacity, rounded, shadow } from "@sdxc/u/effects";
|
|
4
4
|
import { flex, flexCol, gap, items } from "@sdxc/u/layout";
|
|
5
5
|
import { p, pbe, pbs, pi } from "@sdxc/u/size";
|
|
6
|
+
import { when } from "@sdxc/u/state";
|
|
6
7
|
import { fontSize, leading, tracking, weight } from "@sdxc/u/typography";
|
|
7
8
|
import { semanticColorPanel } from "../styles/semantic-color-panel.js";
|
|
8
9
|
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
@@ -103,7 +104,13 @@ Card.Description = function CardDescription(handle) {
|
|
|
103
104
|
Card.Content = function CardContent(handle) {
|
|
104
105
|
return () => {
|
|
105
106
|
let { mix, ...rest } = handle.props;
|
|
106
|
-
return _jsx("div", { ...rest,
|
|
107
|
+
return (_jsx("div", { ...rest,
|
|
108
|
+
/*
|
|
109
|
+
* The body meets whatever sits above it with no gap of its own, because a header
|
|
110
|
+
* already carries that space. Opening the card takes it back: a card written as
|
|
111
|
+
* content alone would otherwise start hard against its own top edge.
|
|
112
|
+
*/
|
|
113
|
+
mix: [pbs(0), when("&:first-child", pbs(6)), pbe(6), pi(6), mix] }));
|
|
107
114
|
};
|
|
108
115
|
};
|
|
109
116
|
/**
|
|
@@ -130,8 +130,8 @@ Carousel.Track = function CarouselTrack(handle) {
|
|
|
130
130
|
};
|
|
131
131
|
/**
|
|
132
132
|
* A single slide: a `<div>` held at `--ui-carousel-slide-size` along the
|
|
133
|
-
* inline axis,
|
|
134
|
-
*
|
|
133
|
+
* inline axis, snapping to its inline-start edge so the viewport settles on a
|
|
134
|
+
* slide boundary.
|
|
135
135
|
*
|
|
136
136
|
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
137
137
|
* @returns The render function producing the slide's markup.
|
|
@@ -145,10 +145,16 @@ 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, but does not force the scroll to
|
|
150
|
+
* stop at it. `scroll-snap-stop: always` clamps every scroll to a single snap
|
|
151
|
+
* point, programmatic ones included, which leaves a jump to any slide but the
|
|
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.
|
|
154
|
+
*/
|
|
148
155
|
raw({
|
|
149
156
|
flexBasis: "var(--ui-carousel-slide-size, 18rem)",
|
|
150
157
|
scrollSnapAlign: "start",
|
|
151
|
-
scrollSnapStop: "always",
|
|
152
158
|
}),
|
|
153
159
|
mix,
|
|
154
160
|
] }));
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { outline } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded, transition } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, raw } from "@sdxc/u/general";
|
|
5
|
-
import { hstack, inlineFlex, relative, shrink, vstack } from "@sdxc/u/layout";
|
|
5
|
+
import { hstack, inlineFlex, items, justify, relative, shrink, vstack } from "@sdxc/u/layout";
|
|
6
6
|
import { media } from "@sdxc/u/responsive";
|
|
7
7
|
import { bs, is, p } from "@sdxc/u/size";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
@@ -95,7 +95,11 @@ 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
|
+
* Focus is shown by the control that holds it, the way `Group` shows it: a ring
|
|
100
|
+
* around the row says the group is focused without saying whether the field or
|
|
101
|
+
* the preview has it, and it stacks with the ring that control draws for itself.
|
|
102
|
+
*/
|
|
99
103
|
hstack({ gap: 2, align: "center" }),
|
|
100
104
|
mix,
|
|
101
105
|
] }));
|
|
@@ -126,6 +130,8 @@ ColorPicker.Trigger = function ColorPickerTrigger(handle) {
|
|
|
126
130
|
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
127
131
|
relative(),
|
|
128
132
|
inlineFlex(),
|
|
133
|
+
items("center"),
|
|
134
|
+
justify("center"),
|
|
129
135
|
is("var(--ui-color-picker-trigger-size, 2.25rem)"),
|
|
130
136
|
bs("var(--ui-color-picker-trigger-size, 2.25rem)"),
|
|
131
137
|
rounded("md"),
|
|
@@ -136,10 +142,23 @@ ColorPicker.Trigger = function ColorPickerTrigger(handle) {
|
|
|
136
142
|
p(0),
|
|
137
143
|
shrink(),
|
|
138
144
|
when('&[data-shape="square"]', rounded("none")),
|
|
139
|
-
|
|
145
|
+
/*
|
|
146
|
+
* The preview is the button, so the swatch is grown through the measure the
|
|
147
|
+
* swatch itself reads rather than by overriding the size it sets: a size passed
|
|
148
|
+
* down as `mix` compiles into its own cascade layer and can land before the
|
|
149
|
+
* swatch's own, which leaves the preview at its default size in a corner of the
|
|
150
|
+
* button.
|
|
151
|
+
*/
|
|
152
|
+
raw({ "--ui-color-swatch-size-md": "100%" }),
|
|
153
|
+
/*
|
|
154
|
+
* Hover steps the preview's edge one shade darker rather than laying a second
|
|
155
|
+
* ring outside it, since the swatch already draws an edge of its own and the
|
|
156
|
+
* two together read as a border drawn twice.
|
|
157
|
+
*/
|
|
158
|
+
when("&:hover", raw({ boxShadow: "0 0 0 1px var(--ui-neutral-border-hover)" })),
|
|
140
159
|
media("(prefers-reduced-motion: reduce)", raw({ transitionDuration: "0s" })),
|
|
141
160
|
mix,
|
|
142
|
-
], children: _jsx(ColorSwatch, { value: value, shape: resolvedShape
|
|
161
|
+
], children: _jsx(ColorSwatch, { value: value, shape: resolvedShape }) }));
|
|
143
162
|
};
|
|
144
163
|
};
|
|
145
164
|
/**
|
|
@@ -85,7 +85,17 @@ export function ColorSlider(handle) {
|
|
|
85
85
|
let resolvedMax = max ?? DEFAULT_MAX_BY_CHANNEL[channel];
|
|
86
86
|
let resolvedValue = value ?? defaultValue ?? resolvedMin;
|
|
87
87
|
handle.context.set({ channel, min: resolvedMin, max: resolvedMax, value: resolvedValue });
|
|
88
|
-
return (_jsx("div", { "data-channel": channel, ...rest, mix: [
|
|
88
|
+
return (_jsx("div", { "data-channel": channel, ...rest, mix: [
|
|
89
|
+
vstack({ gap: 2 }),
|
|
90
|
+
is("full"),
|
|
91
|
+
/*
|
|
92
|
+
* The slider takes the width it is given rather than insisting on a floor: a
|
|
93
|
+
* minimum wider than the panel holding it does not make the track usable, it
|
|
94
|
+
* makes the panel overflow, and the track is what runs off the edge.
|
|
95
|
+
*/
|
|
96
|
+
minIs(0),
|
|
97
|
+
mix,
|
|
98
|
+
] }));
|
|
89
99
|
};
|
|
90
100
|
}
|
|
91
101
|
/**
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { bg, border, outline, outlineStyle } from "@sdxc/u/color";
|
|
3
3
|
import { mask, opacity, rounded, shadow, transition, transitionDuration } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, pointerEvents, pseudoContent, raw } from "@sdxc/u/general";
|
|
5
|
-
import { absolute, appearance, block, inlineBlock, insBs, insIs, inset, relative, } from "@sdxc/u/layout";
|
|
5
|
+
import { absolute, appearance, block, inlineBlock, insBs, insIs, inset, relative, shrink, } from "@sdxc/u/layout";
|
|
6
6
|
import { media } from "@sdxc/u/responsive";
|
|
7
7
|
import { bs, is, m, mbs, minIs, mis } from "@sdxc/u/size";
|
|
8
8
|
import { when } from "@sdxc/u/state";
|
|
@@ -69,15 +69,25 @@ 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
|
-
|
|
72
|
+
/*
|
|
73
|
+
* The two shapes size themselves through selectors that exclude each other: a
|
|
74
|
+
* circular wheel states one measure for both axes, and a bare `is("full")`
|
|
75
|
+
* beside it compiles into its own cascade layer that can land after the
|
|
76
|
+
* circular rule and stretch the wheel into an ellipse.
|
|
77
|
+
*/
|
|
78
|
+
when('&:not([data-shape="circular"])', [block(), is("full"), minIs("10rem")]),
|
|
75
79
|
when('&[data-shape="circular"]', when("&:has(> input:focus-visible)", outline({ color: "brand.ring", offset: 2 }))),
|
|
76
80
|
when('&[data-shape="circular"]', [
|
|
77
81
|
inlineBlock(),
|
|
78
82
|
is("var(--ui-color-wheel-size, 12rem)"),
|
|
79
83
|
bs("var(--ui-color-wheel-size, 12rem)"),
|
|
80
84
|
minIs("0"),
|
|
85
|
+
/*
|
|
86
|
+
* A wheel is round, so it holds the one measure it states on both axes. As a
|
|
87
|
+
* flex item it would otherwise shrink on the inline axis alone when the row
|
|
88
|
+
* runs short, and a circle squeezed on one axis is an ellipse.
|
|
89
|
+
*/
|
|
90
|
+
shrink(),
|
|
81
91
|
rounded("full"),
|
|
82
92
|
bg({ image: WHEEL_CONIC_GRADIENT }),
|
|
83
93
|
mask(RING_MASK),
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { bg, borderEdge, fg, outline, outlineStyle } from "@sdxc/u/color";
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor } from "@sdxc/u/general";
|
|
5
|
-
import { hstack, vstack } from "@sdxc/u/layout";
|
|
5
|
+
import { hstack, shrink, vstack } from "@sdxc/u/layout";
|
|
6
6
|
import { overflow } from "@sdxc/u/overflow";
|
|
7
|
-
import { bs, is, maxBs,
|
|
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/ui";
|
|
@@ -87,7 +87,14 @@ Command.List = function CommandList(handle) {
|
|
|
87
87
|
attrs({ role: DEFAULT_LIST_ROLE }),
|
|
88
88
|
maxBs("18rem"),
|
|
89
89
|
overflow("auto"),
|
|
90
|
-
|
|
90
|
+
pi(1),
|
|
91
|
+
/*
|
|
92
|
+
* The list's own block padding is spent only when it has a row to space. A
|
|
93
|
+
* filter that hides every row leaves the list empty but still padded, and that
|
|
94
|
+
* padding then sits above the empty-state message and nothing balances it
|
|
95
|
+
* below — the message reads as pushed down rather than centered.
|
|
96
|
+
*/
|
|
97
|
+
when('&:has([data-slot="item"]:not([hidden]))', pb(2)),
|
|
91
98
|
outlineStyle("none"),
|
|
92
99
|
mix,
|
|
93
100
|
] }));
|
|
@@ -117,15 +124,35 @@ Command.Item = function CommandItem(handle) {
|
|
|
117
124
|
interactiveTransition(),
|
|
118
125
|
attrs({ role: DEFAULT_ITEM_ROLE }),
|
|
119
126
|
hstack({ gap: 2, align: "center" }),
|
|
127
|
+
/*
|
|
128
|
+
* A glyph anywhere in the row is measured against the row's text and holds that
|
|
129
|
+
* measure when the row runs out of space: the default `flex-shrink: 1`
|
|
130
|
+
* otherwise squeezes it by however much that row's own label and shortcut
|
|
131
|
+
* overrun, so every row lands on a different width and the column of glyphs
|
|
132
|
+
* reads as a rendering fault.
|
|
133
|
+
*/
|
|
134
|
+
when("& svg", [shrink(), is(4), bs(4)]),
|
|
120
135
|
cursor("default"),
|
|
121
136
|
rounded("md"),
|
|
122
137
|
pi(2),
|
|
123
138
|
pb(2),
|
|
124
139
|
fg("neutral.emphasis"),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
/*
|
|
141
|
+
* The active row is a cursor, not a banner: a tint marks where the keyboard is
|
|
142
|
+
* while the row's own text keeps reading as text. It is tinted far enough off
|
|
143
|
+
* the surface to be found at a glance, though — the plain tint is the same
|
|
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.
|
|
150
|
+
*/
|
|
151
|
+
when('&:hover:not([aria-selected="true"])', bg("neutral.bg-tint-hover")),
|
|
152
|
+
when('&:active:not([aria-selected="true"])', bg("neutral.bg-tint-pressed")),
|
|
153
|
+
when('&:focus:not([aria-selected="true"])', bg("brand.bg-tint-hover")),
|
|
154
|
+
when('&[aria-selected="true"]', [bg("brand.bg-tint-hover"), fg("neutral.emphasis")]),
|
|
155
|
+
when('&[aria-selected="true"]:hover', bg("brand.bg-tint-pressed")),
|
|
129
156
|
when('&[aria-disabled="true"]', opacity(50)),
|
|
130
157
|
text("sm"),
|
|
131
158
|
outlineStyle("none"),
|