@sdxc/ui 2026.9.14 → 2026.9.29
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 +27 -4
- 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 +5 -5
- package/src/reset.css +6 -4
- package/src/theme.css +33 -3
|
@@ -39,16 +39,22 @@ export function HoverCard(handle) {
|
|
|
39
39
|
media("(hover: hover)", when('&:hover [data-slot="hover-card-content"]', [
|
|
40
40
|
opacity(100),
|
|
41
41
|
visibility(),
|
|
42
|
-
|
|
42
|
+
/*
|
|
43
|
+
* An open card is something the reader reaches into, so it takes the
|
|
44
|
+
* pointer. Importance is what settles it: every mix entry compiles into
|
|
45
|
+
* its own cascade sublayer ordered by first appearance, and the resting
|
|
46
|
+
* state's own rule may land in a later one.
|
|
47
|
+
*/
|
|
43
48
|
raw({
|
|
49
|
+
pointerEvents: "auto !important",
|
|
44
50
|
transitionDelay: "var(--ui-hover-card-open-delay, 0.4s)",
|
|
45
51
|
}),
|
|
46
52
|
])),
|
|
47
53
|
when('&:focus-within [data-slot="hover-card-content"]', [
|
|
48
54
|
opacity(100),
|
|
49
55
|
visibility(),
|
|
50
|
-
pointerEvents("auto"),
|
|
51
56
|
raw({
|
|
57
|
+
pointerEvents: "auto !important",
|
|
52
58
|
transitionDelay: "0s",
|
|
53
59
|
}),
|
|
54
60
|
]),
|
|
@@ -127,6 +133,36 @@ HoverCard.Content = function HoverCardContent(handle) {
|
|
|
127
133
|
marginLeft("var(--ui-popover-offset, 0.5rem)"),
|
|
128
134
|
raw({ left: "100%" }),
|
|
129
135
|
]),
|
|
136
|
+
/*
|
|
137
|
+
* The card rests off its trigger's edge, and a pointer travelling between the
|
|
138
|
+
* two crosses that space, so the card's own hit area reaches back across it
|
|
139
|
+
* and the pair reads as one surface for as long as the pointer is on either.
|
|
140
|
+
*/
|
|
141
|
+
when("&::before", raw({ content: '""', position: "absolute" })),
|
|
142
|
+
when('&[data-placement^="bottom"]::before', raw({
|
|
143
|
+
insetBlockEnd: "100%",
|
|
144
|
+
insetInlineStart: "0",
|
|
145
|
+
insetInlineEnd: "0",
|
|
146
|
+
blockSize: "var(--ui-popover-offset, 0.5rem)",
|
|
147
|
+
})),
|
|
148
|
+
when('&[data-placement^="top"]::before', raw({
|
|
149
|
+
insetBlockStart: "100%",
|
|
150
|
+
insetInlineStart: "0",
|
|
151
|
+
insetInlineEnd: "0",
|
|
152
|
+
blockSize: "var(--ui-popover-offset, 0.5rem)",
|
|
153
|
+
})),
|
|
154
|
+
when('&[data-placement^="left"]::before', raw({
|
|
155
|
+
left: "100%",
|
|
156
|
+
insetBlockStart: "0",
|
|
157
|
+
insetBlockEnd: "0",
|
|
158
|
+
inlineSize: "var(--ui-popover-offset, 0.5rem)",
|
|
159
|
+
})),
|
|
160
|
+
when('&[data-placement^="right"]::before', raw({
|
|
161
|
+
right: "100%",
|
|
162
|
+
insetBlockStart: "0",
|
|
163
|
+
insetBlockEnd: "0",
|
|
164
|
+
inlineSize: "var(--ui-popover-offset, 0.5rem)",
|
|
165
|
+
})),
|
|
130
166
|
when('&[data-placement="bottom"], &[data-placement="top"]', [
|
|
131
167
|
mi("auto"),
|
|
132
168
|
insIs("0"),
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
3
3
|
import { ringShadow, rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { userSelect } from "@sdxc/u/general";
|
|
5
|
-
import { absolute, center, flex, inlineFlex, insBe, insIe, inset, items, justify, relative, shrink, } from "@sdxc/u/layout";
|
|
5
|
+
import { absolute, center, flex, hidden, inlineFlex, insBe, insIe, inset, items, justify, relative, shrink, } from "@sdxc/u/layout";
|
|
6
6
|
import { overflow } from "@sdxc/u/overflow";
|
|
7
7
|
import { bs, fit, is, mis } from "@sdxc/u/size";
|
|
8
|
-
import { data, when } from "@sdxc/u/state";
|
|
8
|
+
import { data, precededBy, when } from "@sdxc/u/state";
|
|
9
9
|
import { text, textTransform, weight } from "@sdxc/u/typography";
|
|
10
10
|
/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */
|
|
11
11
|
const DEFAULT_SIZE = "md";
|
|
@@ -112,6 +112,12 @@ ImagePlaceholder.Fallback = function ImagePlaceholderFallback(handle) {
|
|
|
112
112
|
return () => {
|
|
113
113
|
let { children, mix, ...rest } = handle.props;
|
|
114
114
|
return (_jsx("span", { ...rest, "data-slot": "fallback", mix: [
|
|
115
|
+
/*
|
|
116
|
+
* Both layers fill the host, and this one is written after the image, so it
|
|
117
|
+
* would cover a picture that loaded. It stands down while an image is present
|
|
118
|
+
* and unbroken, and takes over once the image reports that it failed.
|
|
119
|
+
*/
|
|
120
|
+
precededBy('img[data-slot="image"]:not([data-image-error])', hidden()),
|
|
115
121
|
absolute(),
|
|
116
122
|
center(),
|
|
117
123
|
weight("medium"),
|
package/dist/components/input.js
CHANGED
|
@@ -45,29 +45,30 @@ export function Input(handle) {
|
|
|
45
45
|
pi(3),
|
|
46
46
|
pb(2),
|
|
47
47
|
when("&::placeholder", fg("neutral.muted")),
|
|
48
|
-
hover(border("neutral.
|
|
49
|
-
|
|
48
|
+
hover(border("neutral.border-hover")),
|
|
49
|
+
/*
|
|
50
|
+
* Focus is drawn as a ring standing off the field, the same way every button
|
|
51
|
+
* in this library draws it, rather than by darkening the border: a border
|
|
52
|
+
* promoted to its strong weight and a ring sat flush against it read as one
|
|
53
|
+
* thick slab, which says the field changed shape rather than that it took
|
|
54
|
+
* focus. The border only steps to its hover weight, so nothing jumps.
|
|
55
|
+
*/
|
|
56
|
+
when("&:focus", border("neutral.border-hover")),
|
|
57
|
+
/*
|
|
58
|
+
* Pointer focus drops the platform outline; keyboard focus keeps the ring
|
|
59
|
+
* drawn below. The two selectors exclude each other because `outline: none`
|
|
60
|
+
* is a shorthand, and a shorthand reaching this element from a later cascade
|
|
61
|
+
* layer resets the ring's color, width and style all at once.
|
|
62
|
+
*/
|
|
63
|
+
when("&:focus:not(:focus-visible)", outline("none")),
|
|
50
64
|
focusVisible([
|
|
51
|
-
border("neutral.
|
|
52
|
-
outline({ color: "
|
|
53
|
-
when('&[data-color="
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]),
|
|
57
|
-
when('&[data-color="success"]', [
|
|
58
|
-
border("success.strong"),
|
|
59
|
-
outline({ color: "success.ring", offset: 0 }),
|
|
60
|
-
]),
|
|
61
|
-
when('&[data-color="warning"]', [
|
|
62
|
-
border("warning.strong"),
|
|
63
|
-
outline({ color: "warning.ring", offset: 0 }),
|
|
64
|
-
]),
|
|
65
|
-
when('&[data-color="danger"]', [
|
|
66
|
-
border("danger.strong"),
|
|
67
|
-
outline({ color: "danger.ring", offset: 0 }),
|
|
68
|
-
]),
|
|
65
|
+
border("neutral.border-hover"),
|
|
66
|
+
outline({ color: "brand.ring", offset: 2 }),
|
|
67
|
+
when('&[data-color="success"]', outline("success.ring")),
|
|
68
|
+
when('&[data-color="warning"]', outline("warning.ring")),
|
|
69
|
+
when('&[data-color="danger"]', outline("danger.ring")),
|
|
69
70
|
]),
|
|
70
|
-
invalid([border("danger
|
|
71
|
+
invalid([border("danger"), outline({ color: "danger.ring", offset: 2 })]),
|
|
71
72
|
when("&:disabled", [opacity(50), bg("neutral.bg-tint-hover"), cursor("not-allowed")]),
|
|
72
73
|
text("sm"),
|
|
73
74
|
mix,
|
package/dist/components/item.js
CHANGED
|
@@ -57,7 +57,15 @@ export function Item(handle) {
|
|
|
57
57
|
pb("var(--ui-item-padding-block, 0.625rem)"),
|
|
58
58
|
pi("var(--ui-item-padding-inline, 0.75rem)"),
|
|
59
59
|
container(CONTAINER_NAME),
|
|
60
|
-
|
|
60
|
+
/*
|
|
61
|
+
* Wrapping is allowed at every width, and what decides whether it happens is
|
|
62
|
+
* {@link Item.Actions} claiming a full line once the row is narrow. Asking for
|
|
63
|
+
* it under this container's own query instead would never apply, because a
|
|
64
|
+
* container query cannot change the layout of the container it measures — and
|
|
65
|
+
* the row would hold `nowrap` while its actions took the whole line, leaving
|
|
66
|
+
* the content with nothing.
|
|
67
|
+
*/
|
|
68
|
+
flexWrap("wrap"),
|
|
61
69
|
mix,
|
|
62
70
|
], children: children }));
|
|
63
71
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A keyboard-shortcut hint rendered inside a native `<kbd>` element,
|
|
3
|
-
*
|
|
4
|
-
* pushes it to the trailing edge of whatever row it sits in —
|
|
5
|
-
* command, a tooltip's accelerator, a button's shortcut label.
|
|
2
|
+
* A keyboard-shortcut hint rendered inside a native `<kbd>` element, drawn as the key
|
|
3
|
+
* it names: a tinted, bordered cap sized to read beside the row's own text. Its
|
|
4
|
+
* inline-start auto margin pushes it to the trailing edge of whatever row it sits in —
|
|
5
|
+
* a menu item's command, a tooltip's accelerator, a button's shortcut label.
|
|
6
6
|
*
|
|
7
7
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
8
|
* @copyright Sergio Xalambrí 2026
|
|
@@ -21,9 +21,9 @@ export declare namespace Keyboard {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Renders its children inside a `<kbd>` element
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start
|
|
25
|
+
* auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,
|
|
26
|
+
* a tooltip, a button.
|
|
27
27
|
*
|
|
28
28
|
* @param handle Runtime handle carrying the host `<kbd>`'s props.
|
|
29
29
|
* @returns The render function producing the shortcut hint's markup.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
-
import { fg } from "@sdxc/u/color";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { bg, border, fg } from "@sdxc/u/color";
|
|
3
|
+
import { rounded } from "@sdxc/u/effects";
|
|
4
|
+
import { inlineFlex, items, justify } from "@sdxc/u/layout";
|
|
5
|
+
import { bs, minIs, mis, pi } from "@sdxc/u/size";
|
|
6
|
+
import { leading, text } from "@sdxc/u/typography";
|
|
5
7
|
/**
|
|
6
|
-
* Renders its children inside a `<kbd>` element
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start
|
|
9
|
+
* auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,
|
|
10
|
+
* a tooltip, a button.
|
|
9
11
|
*
|
|
10
12
|
* @param handle Runtime handle carrying the host `<kbd>`'s props.
|
|
11
13
|
* @returns The render function producing the shortcut hint's markup.
|
|
@@ -15,6 +17,30 @@ import { text } from "@sdxc/u/typography";
|
|
|
15
17
|
export function Keyboard(handle) {
|
|
16
18
|
return () => {
|
|
17
19
|
let { mix, ...rest } = handle.props;
|
|
18
|
-
return _jsx("kbd", { ...rest, mix: [
|
|
20
|
+
return (_jsx("kbd", { ...rest, mix: [
|
|
21
|
+
mis("auto"),
|
|
22
|
+
/*
|
|
23
|
+
* A cap keeps its height and a minimum width whatever it holds, so a single
|
|
24
|
+
* letter and a two-glyph chord sit on the same line as each other.
|
|
25
|
+
*/
|
|
26
|
+
/*
|
|
27
|
+
* The cap centers its glyph without `center()`, because that pattern composes
|
|
28
|
+
* `flex()` and would turn the cap into a block of its own — a key standing on
|
|
29
|
+
* its own line in the middle of the sentence naming it.
|
|
30
|
+
*/
|
|
31
|
+
inlineFlex(),
|
|
32
|
+
items("center"),
|
|
33
|
+
justify("center"),
|
|
34
|
+
bs("1.25rem"),
|
|
35
|
+
minIs("1.25rem"),
|
|
36
|
+
pi(1.5),
|
|
37
|
+
rounded("sm"),
|
|
38
|
+
bg("neutral.tint"),
|
|
39
|
+
border({ color: "neutral", width: 1 }),
|
|
40
|
+
fg("neutral"),
|
|
41
|
+
text("xs"),
|
|
42
|
+
leading("none"),
|
|
43
|
+
mix,
|
|
44
|
+
] }));
|
|
19
45
|
};
|
|
20
46
|
}
|
|
@@ -3,7 +3,7 @@ import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
|
3
3
|
import { opacity, rounded } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor, pointerEvents, userSelect } from "@sdxc/u/general";
|
|
5
5
|
import { gap, inlineFlex, items, justify, shrink } from "@sdxc/u/layout";
|
|
6
|
-
import { pb, pi } from "@sdxc/u/size";
|
|
6
|
+
import { bs, is, minBs, pb, pi } from "@sdxc/u/size";
|
|
7
7
|
import { active, data, hover, when } from "@sdxc/u/state";
|
|
8
8
|
import { text, weight } from "@sdxc/u/typography";
|
|
9
9
|
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
@@ -47,11 +47,13 @@ export function LinkButton(handle) {
|
|
|
47
47
|
justify("center"),
|
|
48
48
|
gap(2),
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* A glyph inside a link button is measured and held at size by the same rules
|
|
51
|
+
* `Button` states, for the same reasons: it is sized against the label beside
|
|
52
|
+
* it so the row keeps the height its text and padding ask for, and it never
|
|
53
|
+
* shrinks, since the default `flex-shrink: 1` would compress the glyph rather
|
|
54
|
+
* than the words and a squashed icon reads as a rendering fault.
|
|
53
55
|
*/
|
|
54
|
-
when("& > svg", shrink()),
|
|
56
|
+
when("& > svg", [shrink(), is(4), bs(4)]),
|
|
55
57
|
rounded("md"),
|
|
56
58
|
weight("medium"),
|
|
57
59
|
pi(4),
|
|
@@ -61,9 +63,21 @@ export function LinkButton(handle) {
|
|
|
61
63
|
* own fill (transparent for ghost), so solid, outline, and ghost
|
|
62
64
|
* render at the same footprint.
|
|
63
65
|
*/
|
|
64
|
-
border({ width:
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
border({ width: 1 }),
|
|
67
|
+
/*
|
|
68
|
+
* The row measure is stated rather than left to fall out of the padding and
|
|
69
|
+
* the border, so the control lines up with a field of the same size when a
|
|
70
|
+
* Group fuses the two, and still grows when a long label wraps.
|
|
71
|
+
*/
|
|
72
|
+
minBs("2.5rem"),
|
|
73
|
+
data("size", "sm", [pi(3), pb(1.5), minBs("2rem"), when("& > svg", [is(3), bs(3)])]),
|
|
74
|
+
data("size", "lg", [
|
|
75
|
+
pi(5),
|
|
76
|
+
pb(2.5),
|
|
77
|
+
text("base"),
|
|
78
|
+
minBs("3rem"),
|
|
79
|
+
when("& > svg", [is(5), bs(5)]),
|
|
80
|
+
]),
|
|
67
81
|
data("variant", "solid", [
|
|
68
82
|
data("color", "brand", [
|
|
69
83
|
bg("brand.solid"),
|
|
@@ -103,33 +117,33 @@ export function LinkButton(handle) {
|
|
|
103
117
|
]),
|
|
104
118
|
data("variant", "outline", [
|
|
105
119
|
data("color", "brand", [
|
|
106
|
-
border("brand
|
|
120
|
+
border("brand"),
|
|
107
121
|
fg("brand"),
|
|
108
|
-
hover(bg("brand.tint")),
|
|
122
|
+
hover([bg("brand.tint"), border("brand.border-hover")]),
|
|
109
123
|
active(bg("brand.bg-tint-hover")),
|
|
110
124
|
]),
|
|
111
125
|
data("color", "neutral", [
|
|
112
|
-
border("neutral
|
|
126
|
+
border("neutral"),
|
|
113
127
|
fg("neutral"),
|
|
114
|
-
hover(bg("neutral.tint")),
|
|
128
|
+
hover([bg("neutral.tint"), border("neutral.border-hover")]),
|
|
115
129
|
active(bg("neutral.bg-tint-hover")),
|
|
116
130
|
]),
|
|
117
131
|
data("color", "success", [
|
|
118
|
-
border("success
|
|
132
|
+
border("success"),
|
|
119
133
|
fg("success"),
|
|
120
|
-
hover(bg("success.tint")),
|
|
134
|
+
hover([bg("success.tint"), border("success.border-hover")]),
|
|
121
135
|
active(bg("success.bg-tint-hover")),
|
|
122
136
|
]),
|
|
123
137
|
data("color", "warning", [
|
|
124
|
-
border("warning
|
|
138
|
+
border("warning"),
|
|
125
139
|
fg("warning"),
|
|
126
|
-
hover(bg("warning.tint")),
|
|
140
|
+
hover([bg("warning.tint"), border("warning.border-hover")]),
|
|
127
141
|
active(bg("warning.bg-tint-hover")),
|
|
128
142
|
]),
|
|
129
143
|
data("color", "danger", [
|
|
130
|
-
border("danger
|
|
144
|
+
border("danger"),
|
|
131
145
|
fg("danger"),
|
|
132
|
-
hover(bg("danger.tint")),
|
|
146
|
+
hover([bg("danger.tint"), border("danger.border-hover")]),
|
|
133
147
|
active(bg("danger.bg-tint-hover")),
|
|
134
148
|
]),
|
|
135
149
|
]),
|
|
@@ -88,7 +88,16 @@ ListBox.Item = function ListBoxItem(handle) {
|
|
|
88
88
|
fg("neutral.emphasis"),
|
|
89
89
|
hover(bg("neutral.bg-tint-hover")),
|
|
90
90
|
active(bg("neutral.bg-tint-pressed")),
|
|
91
|
-
when("&:has(input:focus)", bg("brand.tint")),
|
|
91
|
+
when("&:has(input:focus)", bg("brand.bg-tint-pressed")),
|
|
92
|
+
/*
|
|
93
|
+
* The row the keyboard is on is where the next Enter lands, so it is shown
|
|
94
|
+
* before it is chosen. The tint stops at the selected row, which already
|
|
95
|
+
* carries the stronger fill and would otherwise lose it while being walked past.
|
|
96
|
+
*/
|
|
97
|
+
when('&[data-highlighted="true"]:not(:has(input:checked)):not([aria-selected="true"])', [
|
|
98
|
+
bg("brand.bg-tint-pressed"),
|
|
99
|
+
fg("brand.emphasis"),
|
|
100
|
+
]),
|
|
92
101
|
when('&:has(input:checked), &[aria-selected="true"]', [
|
|
93
102
|
bg("brand.solid"),
|
|
94
103
|
fg("brand.onSolid"),
|
package/dist/components/menu.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
|
2
2
|
import { bg, fg, outline } from "@sdxc/u/color";
|
|
3
3
|
import { rounded, opacity } from "@sdxc/u/effects";
|
|
4
4
|
import { cursor } from "@sdxc/u/general";
|
|
5
|
-
import { flex, gap, items } from "@sdxc/u/layout";
|
|
6
|
-
import { is, minIs, mb, pb, pi, p } from "@sdxc/u/size";
|
|
5
|
+
import { flex, gap, items, shrink } from "@sdxc/u/layout";
|
|
6
|
+
import { bs, is, minIs, mb, pb, pi, p } from "@sdxc/u/size";
|
|
7
7
|
import { active, disabled, focusVisible, hover, when } from "@sdxc/u/state";
|
|
8
8
|
import { text, textAlign, textDecoration, weight } from "@sdxc/u/typography";
|
|
9
9
|
import { attrs } from "remix/ui";
|
|
@@ -91,6 +91,12 @@ Menu.Item = function MenuItem(handle) {
|
|
|
91
91
|
is("full"),
|
|
92
92
|
items("center"),
|
|
93
93
|
gap(2),
|
|
94
|
+
/*
|
|
95
|
+
* A glyph in a row reads beside the row's own text, so it is measured against that
|
|
96
|
+
* text rather than at whatever size it was drawn at, and it holds that measure
|
|
97
|
+
* while a long label wraps.
|
|
98
|
+
*/
|
|
99
|
+
when("& > svg, & > [data-slot='icon']", [is("1rem"), bs("1rem"), shrink()]),
|
|
94
100
|
rounded("md"),
|
|
95
101
|
pi(3),
|
|
96
102
|
pb(2),
|
|
@@ -19,9 +19,10 @@ const CONTAINER_NAME = "ui-message-scroller";
|
|
|
19
19
|
/**
|
|
20
20
|
* Container width under which {@link MessageScroller.Button} switches from a
|
|
21
21
|
* centered floating pill to a bar stretched across the frame's own inline
|
|
22
|
-
* size.
|
|
22
|
+
* size. It is measured against the frame's own width, which a conversation
|
|
23
|
+
* column keeps well under a viewport's, so only a phone-width column reaches it.
|
|
23
24
|
*/
|
|
24
|
-
const BUTTON_NARROW_QUERY = `@container ${CONTAINER_NAME} (max-width:
|
|
25
|
+
const BUTTON_NARROW_QUERY = `@container ${CONTAINER_NAME} (max-width: 20rem)`;
|
|
25
26
|
/**
|
|
26
27
|
* `role="log"` applied to {@link MessageScroller.Content} through
|
|
27
28
|
* {@link attrs} unless a consumer supplies its own `role`, whose implicit
|
|
@@ -35,9 +36,13 @@ const DEFAULT_CONTENT_ROLE = "log";
|
|
|
35
36
|
*/
|
|
36
37
|
const DEFAULT_CONTENT_ARIA_RELEVANT = "additions";
|
|
37
38
|
/** Semantic color role {@link MessageScroller.Button} falls back to when `color` is omitted. */
|
|
38
|
-
const DEFAULT_BUTTON_COLOR = "
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
const DEFAULT_BUTTON_COLOR = "neutral";
|
|
40
|
+
/**
|
|
41
|
+
* Visual weight {@link MessageScroller.Button} falls back to when `variant` is omitted.
|
|
42
|
+
* The control floats over a conversation it points at rather than competing with it, so
|
|
43
|
+
* it reads as a surface of its own carrying an arrow.
|
|
44
|
+
*/
|
|
45
|
+
const DEFAULT_BUTTON_VARIANT = "outline";
|
|
41
46
|
/** Size variant {@link MessageScroller.Button} falls back to when `size` is omitted. */
|
|
42
47
|
const DEFAULT_BUTTON_SIZE = "sm";
|
|
43
48
|
/**
|
|
@@ -166,7 +171,15 @@ MessageScroller.Button = function MessageScrollerButton(handle) {
|
|
|
166
171
|
z(1),
|
|
167
172
|
absolute(),
|
|
168
173
|
inset("auto", "auto", "1rem", "50%"),
|
|
169
|
-
|
|
174
|
+
/*
|
|
175
|
+
* The control floats over a log it must stay legible against, so it carries an
|
|
176
|
+
* opaque surface of its own rather than the transparent fill an outline button
|
|
177
|
+
* sits on. Importance is what settles it: every mix entry compiles into its own
|
|
178
|
+
* cascade sublayer ordered by first appearance, and the variant's own fill may
|
|
179
|
+
* land in a later one.
|
|
180
|
+
*/
|
|
181
|
+
raw({ backgroundColor: "var(--ui-bg, Canvas) !important" }),
|
|
182
|
+
shadow("md"),
|
|
170
183
|
translateProperty("-50% 0"),
|
|
171
184
|
when(BUTTON_NARROW_QUERY, [
|
|
172
185
|
justify("center"),
|
package/dist/components/meter.js
CHANGED
|
@@ -21,7 +21,16 @@ const DEFAULT_MAX = 100;
|
|
|
21
21
|
* WebKit/Blink split it in three depending on `value` vs. `low`/`high`/
|
|
22
22
|
* `optimum`; Gecko exposes one. All four resolve their color from `data-color`.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Chrome and Safari name the fill by how the value scores against the optimum range, and
|
|
26
|
+
* Firefox names it once. Each engine gets a rule of its own, because a vendor
|
|
27
|
+
* pseudo-element an engine does not know invalidates every selector in the list beside it —
|
|
28
|
+
* one combined list leaves both engines with no fill at all.
|
|
29
|
+
*/
|
|
30
|
+
const FILL_SELECTORS = [
|
|
31
|
+
"&::-webkit-meter-optimum-value, &::-webkit-meter-suboptimum-value, &::-webkit-meter-even-less-good-value",
|
|
32
|
+
"&::-moz-meter-bar",
|
|
33
|
+
];
|
|
25
34
|
/**
|
|
26
35
|
* Renders the root column: a `<div>` stacking {@link Meter.Indicator} and an
|
|
27
36
|
* optional {@link Meter.ValueLabel} with a small gap. The native `<meter>`
|
|
@@ -81,13 +90,13 @@ Meter.Indicator = function MeterIndicator(handle) {
|
|
|
81
90
|
block(),
|
|
82
91
|
border("none"),
|
|
83
92
|
when("&::-webkit-meter-bar", [bg("neutral.border"), rounded("full")]),
|
|
84
|
-
when(
|
|
85
|
-
data("color", "brand", when(
|
|
86
|
-
data("color", "neutral", when(
|
|
87
|
-
data("color", "success", when(
|
|
88
|
-
data("color", "warning", when(
|
|
89
|
-
data("color", "danger", when(
|
|
90
|
-
media("(prefers-reduced-motion: reduce)", when(
|
|
93
|
+
FILL_SELECTORS.map((selector) => when(selector, [rounded("full"), transition("all")])),
|
|
94
|
+
data("color", "brand", FILL_SELECTORS.map((selector) => when(selector, bg("brand.solid")))),
|
|
95
|
+
data("color", "neutral", FILL_SELECTORS.map((selector) => when(selector, bg("neutral.solid")))),
|
|
96
|
+
data("color", "success", FILL_SELECTORS.map((selector) => when(selector, bg("success.solid")))),
|
|
97
|
+
data("color", "warning", FILL_SELECTORS.map((selector) => when(selector, bg("warning.solid")))),
|
|
98
|
+
data("color", "danger", FILL_SELECTORS.map((selector) => when(selector, bg("danger.solid")))),
|
|
99
|
+
media("(prefers-reduced-motion: reduce)", FILL_SELECTORS.map((selector) => when(selector, raw({ transitionDuration: "0s" })))),
|
|
91
100
|
mix,
|
|
92
101
|
] }));
|
|
93
102
|
};
|
|
@@ -99,10 +99,16 @@ NumberField.Group = function NumberFieldGroup(handle) {
|
|
|
99
99
|
border({ color: "neutral", width: 1 }),
|
|
100
100
|
bg("neutral.tint"),
|
|
101
101
|
fg("neutral.emphasis"),
|
|
102
|
-
hover(border("neutral.
|
|
102
|
+
hover(border("neutral.border-hover")),
|
|
103
|
+
/*
|
|
104
|
+
* The wrapper wears the focus of whichever part holds it, drawn as a ring
|
|
105
|
+
* standing off the field the way every button in this library draws one; the
|
|
106
|
+
* border only steps to its hover weight, since a ring sat flush against a
|
|
107
|
+
* darkened border reads as one thick slab rather than as focus.
|
|
108
|
+
*/
|
|
103
109
|
when("&:focus-within", [
|
|
104
|
-
outline({ color: "brand.ring", offset:
|
|
105
|
-
border("
|
|
110
|
+
outline({ color: "brand.ring", offset: 2 }),
|
|
111
|
+
border("neutral.border-hover"),
|
|
106
112
|
]),
|
|
107
113
|
mix,
|
|
108
114
|
] }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
2
|
import { fill } from "@sdxc/u/color";
|
|
3
3
|
import { calc, pointerEvents, var as varUtility } from "@sdxc/u/general";
|
|
4
|
-
import { absolute, insBe, insBs, insIe, insIs, insLeft, insRight } from "@sdxc/u/layout";
|
|
5
|
-
import { mb, mi } from "@sdxc/u/size";
|
|
4
|
+
import { absolute, flex, insBe, insBs, insIe, insIs, insLeft, insRight, items, justify, } from "@sdxc/u/layout";
|
|
5
|
+
import { is, mb, mi } from "@sdxc/u/size";
|
|
6
6
|
import { when } from "@sdxc/u/state";
|
|
7
7
|
import { rotate } from "@sdxc/u/transform";
|
|
8
8
|
import { attrs } from "remix/ui";
|
|
@@ -42,6 +42,13 @@ export function OverlayArrow(handle) {
|
|
|
42
42
|
return (_jsx("div", { "data-placement": resolvedPlacement, ...rest, mix: [
|
|
43
43
|
attrs({ "aria-hidden": DEFAULT_ARIA_HIDDEN }),
|
|
44
44
|
absolute(),
|
|
45
|
+
/*
|
|
46
|
+
* The host spans the whole edge it attaches to, so centring the glyph inside it
|
|
47
|
+
* is what puts the point under the trigger the surface is anchored to.
|
|
48
|
+
*/
|
|
49
|
+
flex(),
|
|
50
|
+
items("center"),
|
|
51
|
+
justify("center"),
|
|
45
52
|
fill("neutral.tint"),
|
|
46
53
|
pointerEvents(),
|
|
47
54
|
when('&[data-placement^="bottom"]', [
|
|
@@ -57,12 +64,18 @@ export function OverlayArrow(handle) {
|
|
|
57
64
|
insIs("0"),
|
|
58
65
|
insIe("0"),
|
|
59
66
|
]),
|
|
67
|
+
/*
|
|
68
|
+
* A side placement sits past the surface's own inline edge, where the space
|
|
69
|
+
* left to grow into is none, so the glyph is sized from its own content the
|
|
70
|
+
* way the block placements are sized from theirs.
|
|
71
|
+
*/
|
|
60
72
|
when('&[data-placement^="left"]', [
|
|
61
73
|
mb("auto"),
|
|
62
74
|
rotate(-90),
|
|
63
75
|
insLeft("100%"),
|
|
64
76
|
insBs("0"),
|
|
65
77
|
insBe("0"),
|
|
78
|
+
is("max-content"),
|
|
66
79
|
]),
|
|
67
80
|
when('&[data-placement^="right"]', [
|
|
68
81
|
mb("auto"),
|
|
@@ -70,6 +83,7 @@ export function OverlayArrow(handle) {
|
|
|
70
83
|
insRight("100%"),
|
|
71
84
|
insBs("0"),
|
|
72
85
|
insBe("0"),
|
|
86
|
+
is("max-content"),
|
|
73
87
|
]),
|
|
74
88
|
mix,
|
|
75
89
|
] }));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { raw } from "@sdxc/u/general";
|
|
2
3
|
import { inset, positionArea, positionTryFallbacks } from "@sdxc/u/layout";
|
|
3
4
|
import { m, marginLeft, marginRight, mbe, mbs } from "@sdxc/u/size";
|
|
4
5
|
import { data, when } from "@sdxc/u/state";
|
|
@@ -50,18 +51,40 @@ export function Popover(handle) {
|
|
|
50
51
|
when('&[data-placement^="left"]', marginRight("var(--ui-popover-offset, 0.5rem)")),
|
|
51
52
|
when('&[data-placement^="right"]', marginLeft("var(--ui-popover-offset, 0.5rem)")),
|
|
52
53
|
positionTryFallbacks("flip-block", "flip-inline", "flip-block flip-inline"),
|
|
54
|
+
/*
|
|
55
|
+
* A corner placement aligns one pair of edges and grows away from it, so the
|
|
56
|
+
* surface occupies the anchor's own track and spans the one beyond it. Naming
|
|
57
|
+
* the neighbouring cell instead — `bottom left` for `bottom-start` — would sit
|
|
58
|
+
* the surface past the anchor's edge rather than flush with it.
|
|
59
|
+
*/
|
|
53
60
|
data("placement", "top", positionArea("top")),
|
|
54
|
-
data("placement", "top-start", positionArea("top
|
|
55
|
-
data("placement", "top-end", positionArea("top
|
|
61
|
+
data("placement", "top-start", positionArea("top span-right")),
|
|
62
|
+
data("placement", "top-end", positionArea("top span-left")),
|
|
56
63
|
data("placement", "bottom", positionArea("bottom")),
|
|
57
|
-
data("placement", "bottom-start", positionArea("bottom
|
|
58
|
-
data("placement", "bottom-end", positionArea("bottom
|
|
64
|
+
data("placement", "bottom-start", positionArea("bottom span-right")),
|
|
65
|
+
data("placement", "bottom-end", positionArea("bottom span-left")),
|
|
59
66
|
data("placement", "left", positionArea("left")),
|
|
60
|
-
data("placement", "left-start", positionArea("left
|
|
61
|
-
data("placement", "left-end", positionArea("left
|
|
67
|
+
data("placement", "left-start", positionArea("left span-bottom")),
|
|
68
|
+
data("placement", "left-end", positionArea("left span-top")),
|
|
62
69
|
data("placement", "right", positionArea("right")),
|
|
63
|
-
data("placement", "right-start", positionArea("right
|
|
64
|
-
data("placement", "right-end", positionArea("right
|
|
70
|
+
data("placement", "right-start", positionArea("right span-bottom")),
|
|
71
|
+
data("placement", "right-end", positionArea("right span-top")),
|
|
72
|
+
/*
|
|
73
|
+
* A part built on this surface that lays its contents out — a stack, a grid —
|
|
74
|
+
* sets `display` in the author origin and beats the user agent's
|
|
75
|
+
* `[popover]:not(:popover-open) { display: none }`, leaving the surface on
|
|
76
|
+
* screen with nothing having opened it. The closed state is marked important
|
|
77
|
+
* because every `mix` entry compiles into its own cascade sublayer ordered by
|
|
78
|
+
* first appearance, and a consumer's entry is appended after these: later layer
|
|
79
|
+
* wins whatever the selectors say, so importance is what settles it.
|
|
80
|
+
*
|
|
81
|
+
* A `"hint"` surface is left out: that mode is the one a hint reveals itself
|
|
82
|
+
* in, from CSS state on its trigger rather than from an invoker, so it stays
|
|
83
|
+
* closed the whole time it is on screen and owns its own hidden state. An
|
|
84
|
+
* important rule here would be the one thing its reveal could not answer,
|
|
85
|
+
* since importance reverses layer order and this entry comes first.
|
|
86
|
+
*/
|
|
87
|
+
when('&:not(:popover-open):not([popover="hint"])', raw({ display: "none !important" })),
|
|
65
88
|
mix,
|
|
66
89
|
], children: children }));
|
|
67
90
|
};
|