@xds/react 1.0.0-rc.1 → 1.0.1

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.
Files changed (111) hide show
  1. package/dist/Accordion.js +3 -2
  2. package/dist/Button.js +5 -3
  3. package/dist/Card.js +1 -1
  4. package/dist/DatePicker.js +167 -170
  5. package/dist/DateRangePicker.js +91 -94
  6. package/dist/Menu.js +83 -75
  7. package/dist/SearchField.js +4 -2
  8. package/dist/Select.js +123 -98
  9. package/dist/Slider.d.ts +1 -1
  10. package/dist/Slider.js +44 -35
  11. package/dist/TextField.js +130 -107
  12. package/dist/Toast.d.ts +1 -1
  13. package/dist/Toast.js +50 -45
  14. package/dist/Tooltip.js +54 -40
  15. package/dist/base.d.ts +1 -1
  16. package/dist/base.js +1 -1
  17. package/dist/picture.js +2 -2
  18. package/dist/portal.d.ts +6 -4
  19. package/dist/portal.js +61 -9
  20. package/eject/files/Accordion.tsx +5 -2
  21. package/eject/files/Avatar.tsx +1 -1
  22. package/eject/files/AvatarStack.tsx +1 -1
  23. package/eject/files/Badge.tsx +1 -1
  24. package/eject/files/Banner.tsx +1 -1
  25. package/eject/files/Button.tsx +9 -5
  26. package/eject/files/Card.tsx +2 -2
  27. package/eject/files/Checkbox.tsx +1 -1
  28. package/eject/files/Chip.tsx +1 -1
  29. package/eject/files/ChipBar.tsx +1 -1
  30. package/eject/files/CountBadge.tsx +1 -1
  31. package/eject/files/DatePicker.tsx +32 -23
  32. package/eject/files/DateRangePicker.tsx +34 -23
  33. package/eject/files/Dialog.tsx +1 -1
  34. package/eject/files/Divider.tsx +1 -1
  35. package/eject/files/EmptyState.tsx +1 -1
  36. package/eject/files/Icon.tsx +1 -1
  37. package/eject/files/IconButton.tsx +1 -1
  38. package/eject/files/ListRow.tsx +1 -1
  39. package/eject/files/MediaCard.tsx +1 -1
  40. package/eject/files/Menu.tsx +7 -7
  41. package/eject/files/ProgressBar.tsx +1 -1
  42. package/eject/files/RadioGroup.tsx +1 -1
  43. package/eject/files/SearchField.tsx +6 -2
  44. package/eject/files/SectionHeader.tsx +1 -1
  45. package/eject/files/SegmentedControl.tsx +1 -1
  46. package/eject/files/Select.tsx +20 -22
  47. package/eject/files/Sidebar.tsx +1 -1
  48. package/eject/files/Skeleton.tsx +1 -1
  49. package/eject/files/Slider.tsx +11 -5
  50. package/eject/files/Spinner.tsx +1 -1
  51. package/eject/files/Switch.tsx +1 -1
  52. package/eject/files/Tabs.tsx +1 -1
  53. package/eject/files/Text.tsx +1 -1
  54. package/eject/files/TextField.tsx +18 -4
  55. package/eject/files/Thumbnail.tsx +1 -1
  56. package/eject/files/Toast.tsx +11 -15
  57. package/eject/files/Tooltip.tsx +9 -3
  58. package/eject/files/accordion.css +1 -1
  59. package/eject/files/accordion.ts +1 -1
  60. package/eject/files/avatar-stack.ts +1 -1
  61. package/eject/files/avatar.ts +1 -1
  62. package/eject/files/badge.ts +1 -1
  63. package/eject/files/banner.ts +1 -1
  64. package/eject/files/base.css +1 -1
  65. package/eject/files/button.css +3 -3
  66. package/eject/files/button.ts +1 -1
  67. package/eject/files/card.ts +1 -1
  68. package/eject/files/checkbox.ts +1 -1
  69. package/eject/files/chip-bar.ts +1 -1
  70. package/eject/files/chip.ts +1 -1
  71. package/eject/files/count-badge.ts +1 -1
  72. package/eject/files/date-picker.css +5 -5
  73. package/eject/files/date-picker.ts +30 -11
  74. package/eject/files/date-range-picker.ts +16 -8
  75. package/eject/files/dialog.css +6 -6
  76. package/eject/files/dialog.ts +1 -1
  77. package/eject/files/divider.ts +1 -1
  78. package/eject/files/empty-state.ts +1 -1
  79. package/eject/files/icon.ts +1 -1
  80. package/eject/files/list-row.ts +1 -1
  81. package/eject/files/media-card.ts +1 -1
  82. package/eject/files/menu.css +4 -4
  83. package/eject/files/menu.ts +1 -1
  84. package/eject/files/overlay.css +40 -0
  85. package/eject/files/parts.ts +1 -1
  86. package/eject/files/progress-bar.ts +1 -1
  87. package/eject/files/radio-group.css +1 -1
  88. package/eject/files/radio-group.ts +1 -1
  89. package/eject/files/section-header.ts +1 -1
  90. package/eject/files/segmented-control.ts +1 -1
  91. package/eject/files/select.css +17 -6
  92. package/eject/files/select.ts +1 -1
  93. package/eject/files/sidebar.ts +1 -1
  94. package/eject/files/skeleton.ts +1 -1
  95. package/eject/files/slider.css +1 -1
  96. package/eject/files/slider.ts +17 -5
  97. package/eject/files/spinner.ts +1 -1
  98. package/eject/files/switch.ts +1 -1
  99. package/eject/files/tabs.css +1 -1
  100. package/eject/files/tabs.ts +1 -1
  101. package/eject/files/text-field.css +4 -8
  102. package/eject/files/text-field.ts +1 -1
  103. package/eject/files/text.ts +1 -1
  104. package/eject/files/thumbnail.ts +1 -1
  105. package/eject/files/toast.ts +1 -1
  106. package/eject/files/tooltip.css +3 -3
  107. package/eject/files/tooltip.ts +1 -1
  108. package/eject/manifest.json +4 -2
  109. package/package.json +3 -3
  110. package/styles.css +15 -11
  111. package/tailwind.css +21 -14
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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(`${value.start}T12:00:00Z`),
78
- new Date(`${value.end}T12:00:00Z`),
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 day = (value: IsoDate | undefined) => (value === undefined ? undefined : parseDate(value));
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: shown.map((value) => parseDate(value)),
123
- min: day(props.min),
124
- max: day(props.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
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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 `--xds-layer-overlay` and Zag's `--layer-index`.
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(--xds-layer-overlay) + var(--layer-index, 0));
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(--xds-layer-overlay) + var(--layer-index, 0));
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: xds-fade-out var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
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: xds-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
49
+ animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
50
50
  forwards;
51
51
  }
52
52
 
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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. */
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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(--xds-layer-overlay);
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(--xds-layer-overlay) + var(--layer-index, 0));
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: xds-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
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
  }
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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.1 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
+ }
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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 `--xds-layer-overlay` and Zag's `--layer-index`.
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(--xds-layer-overlay);
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(--xds-layer-overlay) + var(--layer-index, 0));
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: xds-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
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
  }
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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> = {
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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";
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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 own locale. */
23
- export function sliderValueText(value: number): string {
24
- return new Intl.NumberFormat().format(value);
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 next = value + direction * (event.shiftKey ? pageSize : step);
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
 
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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 = {
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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`. */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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; a group shows focus instead. */
87
- .{{prefix}}-text-field__control[aria-invalid="true"]:focus {
88
- box-shadow: none;
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` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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. */
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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.
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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.
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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. */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
2
+ * Ejected from `@xds/react` 1.0.1 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(--xds-layer-overlay) + var(--layer-index, 0));
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: xds-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
54
+ animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
55
55
  forwards;
56
56
  }
57
57
 
@@ -1,4 +1,4 @@
1
- // Ejected from `@xds/react` 1.0.0-rc.1 by `xds eject`. This copy is the app's own: change it
1
+ // Ejected from `@xds/react` 1.0.1 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. */
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "format": 1,
3
3
  "library": "@xds/react",
4
- "version": "1.0.0-rc.1",
4
+ "version": "1.0.1",
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": "1.0.0-rc.1",
3
+ "version": "1.0.1",
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": "1.0.0-rc.1",
50
- "@xds/core": "1.0.0-rc.1",
49
+ "@xds/tokens": "1.0.1",
50
+ "@xds/core": "1.0.1",
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",