@xds/react 0.2.0 → 1.0.0
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/Accordion.js +3 -2
- package/dist/Button.js +5 -3
- package/dist/Card.js +1 -1
- package/dist/DatePicker.js +167 -170
- package/dist/DateRangePicker.js +91 -94
- package/dist/Menu.js +83 -75
- package/dist/SearchField.js +4 -2
- package/dist/Select.js +123 -98
- package/dist/Slider.d.ts +1 -1
- package/dist/Slider.js +44 -35
- package/dist/TextField.js +130 -107
- package/dist/Toast.d.ts +1 -1
- package/dist/Toast.js +50 -45
- package/dist/Tooltip.js +54 -40
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/picture.js +2 -2
- package/dist/portal.d.ts +6 -4
- package/dist/portal.js +61 -9
- package/eject/files/Accordion.tsx +5 -2
- package/eject/files/Avatar.tsx +1 -1
- package/eject/files/AvatarStack.tsx +1 -1
- package/eject/files/Badge.tsx +1 -1
- package/eject/files/Banner.tsx +1 -1
- package/eject/files/Button.tsx +9 -5
- package/eject/files/Card.tsx +2 -2
- package/eject/files/Checkbox.tsx +1 -1
- package/eject/files/Chip.tsx +1 -1
- package/eject/files/ChipBar.tsx +1 -1
- package/eject/files/CountBadge.tsx +1 -1
- package/eject/files/DatePicker.tsx +32 -23
- package/eject/files/DateRangePicker.tsx +34 -23
- package/eject/files/Dialog.tsx +1 -1
- package/eject/files/Divider.tsx +1 -1
- package/eject/files/EmptyState.tsx +1 -1
- package/eject/files/Icon.tsx +1 -1
- package/eject/files/IconButton.tsx +1 -1
- package/eject/files/ListRow.tsx +1 -1
- package/eject/files/MediaCard.tsx +1 -1
- package/eject/files/Menu.tsx +7 -7
- package/eject/files/ProgressBar.tsx +1 -1
- package/eject/files/RadioGroup.tsx +1 -1
- package/eject/files/SearchField.tsx +6 -2
- package/eject/files/SectionHeader.tsx +1 -1
- package/eject/files/SegmentedControl.tsx +1 -1
- package/eject/files/Select.tsx +20 -22
- package/eject/files/Sidebar.tsx +1 -1
- package/eject/files/Skeleton.tsx +1 -1
- package/eject/files/Slider.tsx +11 -5
- package/eject/files/Spinner.tsx +1 -1
- package/eject/files/Switch.tsx +1 -1
- package/eject/files/Tabs.tsx +1 -1
- package/eject/files/Text.tsx +1 -1
- package/eject/files/TextField.tsx +18 -4
- package/eject/files/Thumbnail.tsx +1 -1
- package/eject/files/Toast.tsx +11 -15
- package/eject/files/Tooltip.tsx +9 -3
- package/eject/files/accordion.css +1 -1
- package/eject/files/accordion.ts +1 -1
- package/eject/files/avatar-stack.ts +1 -1
- package/eject/files/avatar.ts +1 -1
- package/eject/files/badge.ts +1 -1
- package/eject/files/banner.ts +1 -1
- package/eject/files/base.css +1 -1
- package/eject/files/button.css +3 -3
- package/eject/files/button.ts +1 -1
- package/eject/files/card.ts +1 -1
- package/eject/files/checkbox.ts +1 -1
- package/eject/files/chip-bar.ts +1 -1
- package/eject/files/chip.ts +1 -1
- package/eject/files/count-badge.ts +1 -1
- package/eject/files/date-picker.css +5 -5
- package/eject/files/date-picker.ts +30 -11
- package/eject/files/date-range-picker.ts +16 -8
- package/eject/files/dialog.css +6 -6
- package/eject/files/dialog.ts +1 -1
- package/eject/files/divider.ts +1 -1
- package/eject/files/empty-state.ts +1 -1
- package/eject/files/icon.ts +1 -1
- package/eject/files/list-row.ts +1 -1
- package/eject/files/media-card.ts +1 -1
- package/eject/files/menu.css +4 -4
- package/eject/files/menu.ts +1 -1
- package/eject/files/overlay.css +40 -0
- package/eject/files/parts.ts +1 -1
- package/eject/files/progress-bar.ts +1 -1
- package/eject/files/radio-group.css +1 -1
- package/eject/files/radio-group.ts +1 -1
- package/eject/files/section-header.ts +1 -1
- package/eject/files/segmented-control.ts +1 -1
- package/eject/files/select.css +17 -6
- package/eject/files/select.ts +1 -1
- package/eject/files/sidebar.ts +1 -1
- package/eject/files/skeleton.ts +1 -1
- package/eject/files/slider.css +1 -1
- package/eject/files/slider.ts +17 -5
- package/eject/files/spinner.ts +1 -1
- package/eject/files/switch.ts +1 -1
- package/eject/files/tabs.css +1 -1
- package/eject/files/tabs.ts +1 -1
- package/eject/files/text-field.css +4 -8
- package/eject/files/text-field.ts +1 -1
- package/eject/files/text.ts +1 -1
- package/eject/files/thumbnail.ts +1 -1
- package/eject/files/toast.ts +1 -1
- package/eject/files/tooltip.css +3 -3
- package/eject/files/tooltip.ts +1 -1
- package/eject/manifest.json +4 -2
- package/package.json +3 -3
- package/styles.css +15 -11
- package/tailwind.css +21 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import { space } from "@xds/react/base";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
formatDay,
|
|
11
11
|
type IsoDate,
|
|
12
12
|
openingDay,
|
|
13
|
+
parseIsoDate,
|
|
13
14
|
} from "./date-picker.ts";
|
|
14
15
|
|
|
15
16
|
/** The first and the last day of a range, both chosen, `start` no later than `end`. */
|
|
@@ -73,9 +74,13 @@ export function rangeDayChoice(
|
|
|
73
74
|
* as `formatDay` does.
|
|
74
75
|
*/
|
|
75
76
|
export function formatRange(value: DateRange, locale: string): string {
|
|
77
|
+
if (!parseIsoDate(value.start) || !parseIsoDate(value.end)) return "";
|
|
78
|
+
// Guard inverted bounds so Intl.DateTimeFormat.formatRange never throws RangeError.
|
|
79
|
+
const [start, end] =
|
|
80
|
+
value.start <= value.end ? [value.start, value.end] : [value.end, value.start];
|
|
76
81
|
return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).formatRange(
|
|
77
|
-
new Date(`${
|
|
78
|
-
new Date(`${
|
|
82
|
+
new Date(`${start}T12:00:00Z`),
|
|
83
|
+
new Date(`${end}T12:00:00Z`),
|
|
79
84
|
);
|
|
80
85
|
}
|
|
81
86
|
|
|
@@ -109,9 +114,12 @@ export function dateRangeMachineProps(
|
|
|
109
114
|
months: number;
|
|
110
115
|
onDraft: (draft: RangeDraft | null) => void;
|
|
111
116
|
onChange: (value: DateRange) => void;
|
|
117
|
+
gutter?: number;
|
|
112
118
|
},
|
|
113
119
|
): datePicker.Props {
|
|
114
|
-
const
|
|
120
|
+
const parsedShown = shown
|
|
121
|
+
.map((value) => parseIsoDate(value))
|
|
122
|
+
.filter((value): value is DateValue => value !== undefined);
|
|
115
123
|
const [first] = shown;
|
|
116
124
|
return {
|
|
117
125
|
id: options.id,
|
|
@@ -119,9 +127,9 @@ export function dateRangeMachineProps(
|
|
|
119
127
|
timeZone: getLocalTimeZone(),
|
|
120
128
|
selectionMode: "range",
|
|
121
129
|
numOfMonths: options.months,
|
|
122
|
-
value:
|
|
123
|
-
min:
|
|
124
|
-
max:
|
|
130
|
+
value: parsedShown,
|
|
131
|
+
min: parseIsoDate(props.min),
|
|
132
|
+
max: parseIsoDate(props.max),
|
|
125
133
|
defaultFocusedValue: parseDate(openingDay({ ...props, value: props.value?.start })),
|
|
126
134
|
isDateUnavailable: (date: DateValue) =>
|
|
127
135
|
shown.length === 1 &&
|
|
@@ -144,7 +152,7 @@ export function dateRangeMachineProps(
|
|
|
144
152
|
outsideDaySelectable: false,
|
|
145
153
|
minView: "day",
|
|
146
154
|
maxView: "day",
|
|
147
|
-
positioning: { placement: "bottom-start", gutter: space[1] },
|
|
155
|
+
positioning: { placement: "bottom-start", gutter: options.gutter ?? space[1] },
|
|
148
156
|
translations: dateRangeTranslations(props),
|
|
149
157
|
};
|
|
150
158
|
}
|
package/eject/files/dialog.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
* Parts: `.{{prefix}}-dialog__backdrop` (the scrim), `.{{prefix}}-dialog__positioner` (fills the window and centers
|
|
9
9
|
* the dialog), `.{{prefix}}-dialog` (the dialog itself), `__title`, `__description`, `__body`, `__actions`.
|
|
10
10
|
* States: `[data-state="closed"]` on the backdrop and the dialog while they animate out.
|
|
11
|
-
* The backdrop and the positioner stack by `--
|
|
11
|
+
* The backdrop and the positioner stack by `--{{prefix}}-layer-overlay` and Zag's `--layer-index`.
|
|
12
12
|
*/
|
|
13
13
|
@layer components {
|
|
14
14
|
.{{prefix}}-dialog__backdrop {
|
|
15
15
|
position: fixed;
|
|
16
16
|
inset: 0;
|
|
17
|
-
z-index: calc(var(--
|
|
17
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
18
18
|
background: var(--xds-color-scrim);
|
|
19
19
|
/* Zag turns pointer events off on the body while the dialog is open, and the backdrop would
|
|
20
20
|
inherit that. It takes a press beside the dialog itself, so the component can keep the
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.{{prefix}}-dialog__positioner {
|
|
29
29
|
position: fixed;
|
|
30
30
|
inset: 0;
|
|
31
|
-
z-index: calc(var(--
|
|
31
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
align-items: center;
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
/* After the rules above, which they replace. The positioner follows the dialog's state, as
|
|
42
42
|
Zag gives the positioner none; a closing dialog takes no more presses. */
|
|
43
43
|
.{{prefix}}-dialog__backdrop[data-state="closed"] {
|
|
44
|
-
animation:
|
|
44
|
+
animation: {{prefix}}-fade-out var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
45
45
|
forwards;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.{{prefix}}-dialog__positioner:has(> .{{prefix}}-dialog[data-state="closed"]) {
|
|
49
|
-
animation:
|
|
49
|
+
animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
50
50
|
forwards;
|
|
51
51
|
}
|
|
52
52
|
|
package/eject/files/dialog.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** Dialog's props in every framework, short of `onClose`, its body and its actions. */
|
package/eject/files/divider.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** A line between groups of content. Decorative lines use the low-contrast border color. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { IconName } from "@xds/react/base";
|
package/eject/files/icon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { IconName } from "@xds/react/base";
|
package/eject/files/list-row.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** ListRow's props in every framework, short of `leading`, `trailing` and `onPress`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { ThumbnailRatio } from "@xds/react/base";
|
package/eject/files/menu.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
.{{prefix}}-menu__underlay {
|
|
39
39
|
position: fixed;
|
|
40
40
|
inset: 0;
|
|
41
|
-
z-index: var(--
|
|
41
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.{{prefix}}-menu__positioner {
|
|
45
|
-
z-index: calc(var(--
|
|
45
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.{{prefix}}-menu {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
|
|
78
78
|
/* After the rules above, which it replaces. A closing menu takes no more presses. */
|
|
79
79
|
.{{prefix}}-menu[data-state="closed"] {
|
|
80
|
-
animation:
|
|
80
|
+
animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
81
81
|
forwards;
|
|
82
82
|
pointer-events: none;
|
|
83
83
|
}
|
package/eject/files/menu.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { IconName } from "@xds/react/base";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* What every overlay shares: the level it is drawn on and how it leaves.
|
|
7
|
+
*
|
|
8
|
+
* The level: a dialog's scrim and the dialog, a menu, a select's list, a tooltip. Zag puts
|
|
9
|
+
* `--layer-index` on each layer it opens (0 for the first, 1 for one opened from it), and an
|
|
10
|
+
* overlay adds it, so the later one is on top. The design tokens have no z-index: only the web
|
|
11
|
+
* needs one. A toast needs none, as it is in the top layer.
|
|
12
|
+
*/
|
|
13
|
+
:root {
|
|
14
|
+
--{{prefix}}-layer-overlay: 100000;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* How every overlay leaves: a menu, a select's list, a tooltip and a dialog fade and shrink a
|
|
18
|
+
little, a dialog's scrim fades. Each starts it on `[data-state="closed"]`, and its component
|
|
19
|
+
keeps it on the page until it ends. Each holds the last frame (`forwards`): a framework may
|
|
20
|
+
paint once more before it removes the overlay, which would otherwise show again for that
|
|
21
|
+
frame. Both ends are set: WebKit does not run a transform animation that starts from an
|
|
22
|
+
implicit `none`.
|
|
23
|
+
The scale is a literal because a custom property inside a keyframe keeps WebKit from running
|
|
24
|
+
the animation on the compositor. */
|
|
25
|
+
@keyframes {{prefix}}-overlay-exit {
|
|
26
|
+
from {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
transform: scale(1);
|
|
29
|
+
}
|
|
30
|
+
to {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
transform: scale(0.95);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@keyframes {{prefix}}-fade-out {
|
|
37
|
+
to {
|
|
38
|
+
opacity: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
package/eject/files/parts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** ProgressBar's props in every framework. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
export type RadioOption<Value extends string = string> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { IconName } from "@xds/react/base";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import { PEER_FOCUS } from "@xds/react/base";
|
package/eject/files/select.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* States: `:hover`, `:focus-visible`, `:disabled` and `[data-invalid]` on the trigger,
|
|
14
14
|
* `[data-placeholder-shown]` on it while nothing is chosen; `[data-highlighted]` and `:active`
|
|
15
15
|
* on an item; `[data-side]` on the content, and `[data-state="closed"]` while it animates out.
|
|
16
|
-
* The positioner stacks by `--
|
|
16
|
+
* The positioner stacks by `--{{prefix}}-layer-overlay` and Zag's `--layer-index`.
|
|
17
17
|
*
|
|
18
18
|
* A DatePicker's field is this field, with the same parts under `.{{prefix}}-date-picker` (and its trigger
|
|
19
19
|
* inside a `.{{prefix}}-date-picker__control`, which its calendar is placed against), so the rules of the
|
|
@@ -127,7 +127,8 @@
|
|
|
127
127
|
color: var(--xds-color-field-placeholder);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
/* One line under the box, as under a TextField: the help or the error.
|
|
130
|
+
/* One line under the box, as under a TextField: the help or the error. When nothing is shown
|
|
131
|
+
the line takes no room so the empty live error region stays mounted without shifting layout. */
|
|
131
132
|
.{{prefix}}-select__footer,
|
|
132
133
|
.{{prefix}}-date-picker__footer {
|
|
133
134
|
display: flex;
|
|
@@ -135,6 +136,11 @@
|
|
|
135
136
|
gap: var(--xds-space-3);
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
.{{prefix}}-select__footer:not(:has(> :not(:empty))),
|
|
140
|
+
.{{prefix}}-date-picker__footer:not(:has(> :not(:empty))) {
|
|
141
|
+
position: absolute;
|
|
142
|
+
}
|
|
143
|
+
|
|
138
144
|
.{{prefix}}-select__description,
|
|
139
145
|
.{{prefix}}-select__error,
|
|
140
146
|
.{{prefix}}-date-picker__description,
|
|
@@ -154,6 +160,11 @@
|
|
|
154
160
|
color: var(--xds-color-status-danger);
|
|
155
161
|
}
|
|
156
162
|
|
|
163
|
+
.{{prefix}}-select__error:empty,
|
|
164
|
+
.{{prefix}}-date-picker__error:empty {
|
|
165
|
+
position: absolute;
|
|
166
|
+
}
|
|
167
|
+
|
|
157
168
|
/* ------------------------------------------------------------ the list */
|
|
158
169
|
|
|
159
170
|
/* Over the page and under the open list, as under a Menu: a press outside only closes the
|
|
@@ -161,12 +172,12 @@
|
|
|
161
172
|
.{{prefix}}-select__underlay {
|
|
162
173
|
position: fixed;
|
|
163
174
|
inset: 0;
|
|
164
|
-
z-index: var(--
|
|
175
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
/* Zag sets the position, and the width: exactly the field's, however short the options. */
|
|
168
179
|
.{{prefix}}-select__positioner {
|
|
169
|
-
z-index: calc(var(--
|
|
180
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
170
181
|
}
|
|
171
182
|
|
|
172
183
|
/* A menu's surface. It scrolls when the window has no room for all of it. */
|
|
@@ -193,7 +204,7 @@
|
|
|
193
204
|
|
|
194
205
|
/* After the rules above, which it replaces. A closing list takes no more presses. */
|
|
195
206
|
.{{prefix}}-select__content[data-state="closed"] {
|
|
196
|
-
animation:
|
|
207
|
+
animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
197
208
|
forwards;
|
|
198
209
|
pointer-events: none;
|
|
199
210
|
}
|
package/eject/files/select.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
export type SelectOption<Value extends string = string> = {
|
package/eject/files/sidebar.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import { type IconName, PRESSABLE_ROW } from "@xds/react/base";
|
package/eject/files/skeleton.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
export type SkeletonShape = "text" | "rect" | "circle";
|
package/eject/files/slider.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
package/eject/files/slider.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import { focusWithoutRing } from "@xds/react/base";
|
|
@@ -17,11 +17,18 @@ export type SliderBaseProps = {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
/** Shows the current value at the end of the label's line. */
|
|
19
19
|
showValue?: boolean;
|
|
20
|
+
/** The name the value is submitted under with a form. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Formats the displayed value in a fixed locale (useful for SSR). */
|
|
23
|
+
locale?: string;
|
|
20
24
|
};
|
|
21
25
|
|
|
22
|
-
/** The value as it is shown beside the label and read out: a number in the reader's
|
|
23
|
-
export function sliderValueText(value: number): string {
|
|
24
|
-
|
|
26
|
+
/** The value as it is shown beside the label and read out: a number in the chosen or reader's locale. */
|
|
27
|
+
export function sliderValueText(value: number, locale?: string): string {
|
|
28
|
+
// Outside the browser (SSR), fall back to en-US unless an explicit locale is given so server and
|
|
29
|
+
// client can align deterministically.
|
|
30
|
+
const tag = locale ?? (typeof navigator === "undefined" ? "en-US" : navigator.language);
|
|
31
|
+
return new Intl.NumberFormat(tag).format(value);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/**
|
|
@@ -48,7 +55,12 @@ export function sliderArrowValue(
|
|
|
48
55
|
const direction = event.key === "ArrowUp" ? 1 : event.key === "ArrowDown" ? -1 : 0;
|
|
49
56
|
if (direction === 0) return undefined;
|
|
50
57
|
const { value, min, max, step, pageSize } = options;
|
|
51
|
-
const
|
|
58
|
+
const delta = event.shiftKey ? pageSize : step;
|
|
59
|
+
const decimals = Math.max(
|
|
60
|
+
String(step).split(".")[1]?.length ?? 0,
|
|
61
|
+
String(delta).split(".")[1]?.length ?? 0,
|
|
62
|
+
);
|
|
63
|
+
const next = Number((value + direction * delta).toFixed(decimals));
|
|
52
64
|
return Math.min(max, Math.max(min, next));
|
|
53
65
|
}
|
|
54
66
|
|
package/eject/files/spinner.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
const SIZE = {
|
package/eject/files/switch.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** Switch's props in every framework, short of `onChange`. */
|
package/eject/files/tabs.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
package/eject/files/tabs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
import type { IconName } from "@xds/react/base";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -83,15 +83,11 @@
|
|
|
83
83
|
outline: var(--xds-border-width-thin) solid var(--xds-color-danger-default);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
/* Focused, an invalid field keeps its red border
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
86
|
+
/* Focused, an invalid field keeps its red border and outline (dropping only the inset line),
|
|
87
|
+
whether plain or grouped with leading/trailing slots. */
|
|
88
|
+
.{{prefix}}-text-field__control[aria-invalid="true"]:focus,
|
|
91
89
|
.{{prefix}}-text-field__control:has(> .{{prefix}}-text-field__input[aria-invalid="true"]:focus) {
|
|
92
|
-
border-color: var(--xds-color-field-border-focus);
|
|
93
90
|
box-shadow: none;
|
|
94
|
-
outline-style: none;
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
/* After the error, which it outranks. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** TextField's props in every framework, short of `onChange` and the `leading` and `trailing` slots. */
|
package/eject/files/text.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
// Written out in full: Tailwind only generates the classes it can find as whole strings.
|
package/eject/files/thumbnail.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
// Written out in full: Tailwind only generates the classes it can find as whole strings.
|
package/eject/files/toast.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** One thing the person can do about a toast's message, such as undoing it. */
|
package/eject/files/tooltip.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Ejected from `@xds/react` 0.
|
|
2
|
+
* Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
3
3
|
* as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
4
|
*/
|
|
5
5
|
/*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
@layer components {
|
|
14
14
|
.{{prefix}}-tooltip__positioner {
|
|
15
|
-
z-index: calc(var(--
|
|
15
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.{{prefix}}-tooltip {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
/* After the rules above, which it replaces. */
|
|
53
53
|
.{{prefix}}-tooltip[data-state="closed"] {
|
|
54
|
-
animation:
|
|
54
|
+
animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
55
55
|
forwards;
|
|
56
56
|
}
|
|
57
57
|
|
package/eject/files/tooltip.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Ejected from `@xds/react` 0.
|
|
1
|
+
// Ejected from `@xds/react` 1.0.0 by `xds eject`. This copy is the app's own: change it
|
|
2
2
|
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
3
|
|
|
4
4
|
/** Tooltip's props in every framework, short of the control it describes. */
|
package/eject/manifest.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
3
|
"library": "@xds/react",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"prefix": "{{prefix}}",
|
|
6
6
|
"support": [
|
|
7
7
|
"parts.ts",
|
|
8
|
-
"base.css"
|
|
8
|
+
"base.css",
|
|
9
|
+
"overlay.css"
|
|
9
10
|
],
|
|
10
11
|
"styles": [
|
|
11
12
|
"base.css",
|
|
13
|
+
"overlay.css",
|
|
12
14
|
"accordion.css",
|
|
13
15
|
"button.css",
|
|
14
16
|
"date-picker.css",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xds/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The xds design system's components for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"eject"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@xds/tokens": "0.
|
|
50
|
-
"@xds/core": "0.
|
|
49
|
+
"@xds/tokens": "1.0.0",
|
|
50
|
+
"@xds/core": "1.0.0",
|
|
51
51
|
"@internationalized/date": "3.12.4",
|
|
52
52
|
"@zag-js/accordion": "2.0.0-next.4",
|
|
53
53
|
"@zag-js/aria-hidden": "2.0.0-next.4",
|