@xds/react 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/Accordion.d.ts +20 -0
- package/dist/Accordion.js +197 -0
- package/dist/Avatar.d.ts +9 -0
- package/dist/Avatar.js +69 -0
- package/dist/AvatarStack.d.ts +8 -0
- package/dist/AvatarStack.js +105 -0
- package/dist/Badge.d.ts +13 -0
- package/dist/Badge.js +66 -0
- package/dist/Banner.d.ts +23 -0
- package/dist/Banner.js +166 -0
- package/dist/Button.d.ts +14 -0
- package/dist/Button.js +159 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +173 -0
- package/dist/Checkbox.d.ts +10 -0
- package/dist/Checkbox.js +140 -0
- package/dist/Chip.d.ts +12 -0
- package/dist/Chip.js +74 -0
- package/dist/ChipBar.d.ts +12 -0
- package/dist/ChipBar.js +38 -0
- package/dist/CountBadge.d.ts +12 -0
- package/dist/CountBadge.js +64 -0
- package/dist/DatePicker.d.ts +20 -0
- package/dist/DatePicker.js +429 -0
- package/dist/DateRangePicker.d.ts +24 -0
- package/dist/DateRangePicker.js +370 -0
- package/dist/Defaults.d.ts +17 -0
- package/dist/Defaults.js +48 -0
- package/dist/Dialog.d.ts +20 -0
- package/dist/Dialog.js +137 -0
- package/dist/Divider.d.ts +4 -0
- package/dist/Divider.js +31 -0
- package/dist/EmptyState.d.ts +12 -0
- package/dist/EmptyState.js +86 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Icon.js +79 -0
- package/dist/IconButton.d.ts +12 -0
- package/dist/IconButton.js +119 -0
- package/dist/ListRow.d.ts +21 -0
- package/dist/ListRow.js +185 -0
- package/dist/MediaCard.d.ts +20 -0
- package/dist/MediaCard.js +279 -0
- package/dist/Menu.d.ts +18 -0
- package/dist/Menu.js +244 -0
- package/dist/ProgressBar.d.ts +8 -0
- package/dist/ProgressBar.js +65 -0
- package/dist/RadioGroup.d.ts +15 -0
- package/dist/RadioGroup.js +176 -0
- package/dist/SearchField.d.ts +15 -0
- package/dist/SearchField.js +152 -0
- package/dist/SectionHeader.d.ts +14 -0
- package/dist/SectionHeader.js +124 -0
- package/dist/SegmentedControl.d.ts +12 -0
- package/dist/SegmentedControl.js +106 -0
- package/dist/Select.d.ts +18 -0
- package/dist/Select.js +318 -0
- package/dist/Sidebar.d.ts +21 -0
- package/dist/Sidebar.js +220 -0
- package/dist/Skeleton.d.ts +11 -0
- package/dist/Skeleton.js +64 -0
- package/dist/Slider.d.ts +13 -0
- package/dist/Slider.js +151 -0
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.js +97 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +116 -0
- package/dist/Tabs.d.ts +14 -0
- package/dist/Tabs.js +137 -0
- package/dist/Text.d.ts +10 -0
- package/dist/Text.js +46 -0
- package/dist/TextField.d.ts +22 -0
- package/dist/TextField.js +213 -0
- package/dist/Thumbnail.d.ts +9 -0
- package/dist/Thumbnail.js +152 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.js +121 -0
- package/dist/Tooltip.d.ts +26 -0
- package/dist/Tooltip.js +166 -0
- package/dist/base.d.ts +11 -0
- package/dist/base.js +10 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/modal-popover.d.ts +7 -0
- package/dist/modal-popover.js +37 -0
- package/dist/picture.d.ts +13 -0
- package/dist/picture.js +76 -0
- package/dist/portal.d.ts +9 -0
- package/dist/portal.js +27 -0
- package/dist/presence.d.ts +6 -0
- package/dist/presence.js +34 -0
- package/dist/preview.d.ts +17 -0
- package/dist/preview.js +126 -0
- package/dist/root.d.ts +12 -0
- package/dist/root.js +1 -0
- package/dist/trigger.d.ts +24 -0
- package/dist/trigger.js +47 -0
- package/eject/files/Accordion.tsx +157 -0
- package/eject/files/Avatar.tsx +41 -0
- package/eject/files/AvatarStack.tsx +47 -0
- package/eject/files/Badge.tsx +33 -0
- package/eject/files/Banner.tsx +70 -0
- package/eject/files/Button.tsx +88 -0
- package/eject/files/Card.tsx +85 -0
- package/eject/files/Checkbox.tsx +59 -0
- package/eject/files/Chip.tsx +43 -0
- package/eject/files/ChipBar.tsx +31 -0
- package/eject/files/CountBadge.tsx +50 -0
- package/eject/files/DatePicker.tsx +192 -0
- package/eject/files/DateRangePicker.tsx +271 -0
- package/eject/files/Dialog.tsx +108 -0
- package/eject/files/Divider.tsx +13 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +38 -0
- package/eject/files/IconButton.tsx +62 -0
- package/eject/files/ListRow.tsx +86 -0
- package/eject/files/MediaCard.tsx +111 -0
- package/eject/files/Menu.tsx +168 -0
- package/eject/files/ProgressBar.tsx +34 -0
- package/eject/files/RadioGroup.tsx +112 -0
- package/eject/files/SearchField.tsx +88 -0
- package/eject/files/SectionHeader.tsx +56 -0
- package/eject/files/SegmentedControl.tsx +57 -0
- package/eject/files/Select.tsx +228 -0
- package/eject/files/Sidebar.tsx +149 -0
- package/eject/files/Skeleton.tsx +28 -0
- package/eject/files/Slider.tsx +109 -0
- package/eject/files/Spinner.tsx +36 -0
- package/eject/files/Switch.tsx +53 -0
- package/eject/files/Tabs.tsx +71 -0
- package/eject/files/Text.tsx +31 -0
- package/eject/files/TextField.tsx +122 -0
- package/eject/files/Thumbnail.tsx +66 -0
- package/eject/files/Toast.tsx +88 -0
- package/eject/files/Tooltip.tsx +120 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +68 -0
- package/eject/files/base.css +38 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +32 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +352 -0
- package/eject/files/date-picker.ts +250 -0
- package/eject/files/date-range-picker.ts +323 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +176 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/progress-bar.ts +23 -0
- package/eject/files/radio-group.css +160 -0
- package/eject/files/radio-group.ts +24 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +30 -0
- package/eject/files/select.css +285 -0
- package/eject/files/select.ts +36 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +136 -0
- package/eject/files/slider.ts +65 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +34 -0
- package/eject/files/tabs.css +112 -0
- package/eject/files/tabs.ts +35 -0
- package/eject/files/text-field.css +229 -0
- package/eject/files/text-field.ts +48 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +104 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +814 -0
- package/package.json +66 -4
- package/page.css +20 -0
- package/styles.css +3252 -0
- package/tailwind.css +2665 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Ejected from `@xds/react` 0.2.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
|
+
* Select: Zag's select machine. The field stays where it is; its list is rendered into the
|
|
7
|
+
* body, always, hidden while closed once it has animated out.
|
|
8
|
+
*
|
|
9
|
+
* Parts: `.{{prefix}}-select` (the column), `__label`, `__trigger` (the closed field, a <button>),
|
|
10
|
+
* `__value`, `__footer`, `__description`, `__error`; in the list, `__underlay` (over the page
|
|
11
|
+
* while the list is open), `__positioner`, `__content` (the surface, which scrolls), `__list`
|
|
12
|
+
* (the list box), `__item`, `__item-words`, `__item-label`, `__item-description`.
|
|
13
|
+
* States: `:hover`, `:focus-visible`, `:disabled` and `[data-invalid]` on the trigger,
|
|
14
|
+
* `[data-placeholder-shown]` on it while nothing is chosen; `[data-highlighted]` and `:active`
|
|
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`.
|
|
17
|
+
*
|
|
18
|
+
* A DatePicker's field is this field, with the same parts under `.{{prefix}}-date-picker` (and its trigger
|
|
19
|
+
* inside a `.{{prefix}}-date-picker__control`, which its calendar is placed against), so the rules of the
|
|
20
|
+
* field name both; date-picker.css draws its calendar.
|
|
21
|
+
*/
|
|
22
|
+
@layer components {
|
|
23
|
+
.{{prefix}}-select,
|
|
24
|
+
.{{prefix}}-date-picker {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: var(--xds-space-1);
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.{{prefix}}-select__label,
|
|
32
|
+
.{{prefix}}-date-picker__label {
|
|
33
|
+
width: fit-content;
|
|
34
|
+
font-size: var(--xds-typography-label-size);
|
|
35
|
+
font-weight: var(--xds-typography-label-weight);
|
|
36
|
+
line-height: var(--xds-typography-label-line-height);
|
|
37
|
+
color: var(--xds-color-text-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.{{prefix}}-select:has(.{{prefix}}-select__trigger:disabled) .{{prefix}}-select__label,
|
|
41
|
+
.{{prefix}}-date-picker:has(.{{prefix}}-date-picker__trigger:disabled) .{{prefix}}-date-picker__label {
|
|
42
|
+
opacity: 0.5;
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ------------------------------------------------------------ the field */
|
|
48
|
+
|
|
49
|
+
/* A text field's box: the same height, inset, corners and type, with the icon at the end
|
|
50
|
+
(the chevrons, or a DatePicker's calendar) a gap away from the value. */
|
|
51
|
+
.{{prefix}}-select__trigger,
|
|
52
|
+
.{{prefix}}-date-picker__trigger {
|
|
53
|
+
position: relative;
|
|
54
|
+
isolation: isolate;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--xds-space-2);
|
|
58
|
+
width: 100%;
|
|
59
|
+
min-height: var(--xds-size-control-md);
|
|
60
|
+
padding-block: 0;
|
|
61
|
+
padding-inline: var(--xds-space-3);
|
|
62
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-field-border);
|
|
63
|
+
border-radius: var(--xds-radius-md);
|
|
64
|
+
background-color: var(--xds-color-field-background);
|
|
65
|
+
color: var(--xds-color-field-text);
|
|
66
|
+
text-align: start;
|
|
67
|
+
outline-style: none;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
user-select: none;
|
|
70
|
+
touch-action: manipulation;
|
|
71
|
+
-webkit-tap-highlight-color: transparent;
|
|
72
|
+
transition-property: background-color, border-color, box-shadow;
|
|
73
|
+
transition-duration: var(--xds-motion-duration-fast);
|
|
74
|
+
transition-timing-function: var(--xds-motion-easing-standard);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* A text field's ring sits on its border, not a gap away from it. */
|
|
78
|
+
.{{prefix}}-select__trigger:focus-visible,
|
|
79
|
+
.{{prefix}}-date-picker__trigger:focus-visible {
|
|
80
|
+
border-color: var(--xds-color-field-border-focus);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Invalid as a text field is: red, and thicker, so the state does not depend on telling
|
|
84
|
+
colors apart. Focused, it stays red and the inner line goes. */
|
|
85
|
+
.{{prefix}}-select__trigger[data-invalid],
|
|
86
|
+
.{{prefix}}-date-picker__trigger[data-invalid] {
|
|
87
|
+
border-color: var(--xds-color-field-border-invalid);
|
|
88
|
+
box-shadow: inset 0 0 0 var(--xds-border-width-thin) var(--xds-color-field-border-invalid);
|
|
89
|
+
outline: var(--xds-border-width-thin) solid var(--xds-color-danger-default);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.{{prefix}}-select__trigger[data-invalid]:focus,
|
|
93
|
+
.{{prefix}}-date-picker__trigger[data-invalid]:focus {
|
|
94
|
+
box-shadow: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* After focus and the error, which it outranks. */
|
|
98
|
+
@media (hover: hover) {
|
|
99
|
+
.{{prefix}}-select__trigger:hover,
|
|
100
|
+
.{{prefix}}-date-picker__trigger:hover {
|
|
101
|
+
border-color: var(--xds-color-text-primary);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.{{prefix}}-select__trigger:disabled,
|
|
106
|
+
.{{prefix}}-date-picker__trigger:disabled {
|
|
107
|
+
opacity: 0.5;
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* One line, cut short with an ellipsis, so a long option does not make the field taller. */
|
|
113
|
+
.{{prefix}}-select__value,
|
|
114
|
+
.{{prefix}}-date-picker__value {
|
|
115
|
+
flex: 1 1 0%;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
overflow-wrap: break-word;
|
|
121
|
+
font-size: var(--xds-typography-body-size);
|
|
122
|
+
line-height: var(--xds-typography-body-line-height);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.{{prefix}}-select__trigger[data-placeholder-shown] .{{prefix}}-select__value,
|
|
126
|
+
.{{prefix}}-date-picker__trigger[data-placeholder-shown] .{{prefix}}-date-picker__value {
|
|
127
|
+
color: var(--xds-color-field-placeholder);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* One line under the box, as under a TextField: the help or the error. */
|
|
131
|
+
.{{prefix}}-select__footer,
|
|
132
|
+
.{{prefix}}-date-picker__footer {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: baseline;
|
|
135
|
+
gap: var(--xds-space-3);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.{{prefix}}-select__description,
|
|
139
|
+
.{{prefix}}-select__error,
|
|
140
|
+
.{{prefix}}-date-picker__description,
|
|
141
|
+
.{{prefix}}-date-picker__error {
|
|
142
|
+
font-size: var(--xds-typography-detail-size);
|
|
143
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
144
|
+
overflow-wrap: break-word;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.{{prefix}}-select__description,
|
|
148
|
+
.{{prefix}}-date-picker__description {
|
|
149
|
+
color: var(--xds-color-text-secondary);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.{{prefix}}-select__error,
|
|
153
|
+
.{{prefix}}-date-picker__error {
|
|
154
|
+
color: var(--xds-color-status-danger);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* ------------------------------------------------------------ the list */
|
|
158
|
+
|
|
159
|
+
/* Over the page and under the open list, as under a Menu: a press outside only closes the
|
|
160
|
+
list, and the field under the pointer keeps its own border meanwhile. */
|
|
161
|
+
.{{prefix}}-select__underlay {
|
|
162
|
+
position: fixed;
|
|
163
|
+
inset: 0;
|
|
164
|
+
z-index: var(--xds-layer-overlay);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Zag sets the position, and the width: exactly the field's, however short the options. */
|
|
168
|
+
.{{prefix}}-select__positioner {
|
|
169
|
+
z-index: calc(var(--xds-layer-overlay) + var(--layer-index, 0));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* A menu's surface. It scrolls when the window has no room for all of it. */
|
|
173
|
+
.{{prefix}}-select__content {
|
|
174
|
+
max-height: var(--available-height);
|
|
175
|
+
overflow-y: auto;
|
|
176
|
+
overscroll-behavior: contain;
|
|
177
|
+
scroll-padding-block: var(--xds-space-1);
|
|
178
|
+
/* A thin scrollbar in the text's color, faint, which stays out of the way of the rows. */
|
|
179
|
+
scrollbar-width: thin;
|
|
180
|
+
scrollbar-color: color-mix(in oklab, var(--xds-color-text-primary) 15%, transparent)
|
|
181
|
+
transparent;
|
|
182
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-menu-border);
|
|
183
|
+
border-radius: var(--xds-radius-md);
|
|
184
|
+
background: var(--xds-color-menu-background);
|
|
185
|
+
box-shadow: var(--xds-shadow-raised);
|
|
186
|
+
transform-origin: var(--transform-origin);
|
|
187
|
+
animation: {{prefix}}-select-enter var(--xds-motion-duration-fast) var(--xds-motion-easing-enter);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.{{prefix}}-select__content[data-side="top"] {
|
|
191
|
+
animation-name: {{prefix}}-select-enter-above;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* After the rules above, which it replaces. A closing list takes no more presses. */
|
|
195
|
+
.{{prefix}}-select__content[data-state="closed"] {
|
|
196
|
+
animation: xds-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
197
|
+
forwards;
|
|
198
|
+
pointer-events: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (prefers-reduced-motion: reduce) {
|
|
202
|
+
.{{prefix}}-select__content,
|
|
203
|
+
.{{prefix}}-select__content[data-state="closed"] {
|
|
204
|
+
animation: none;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Focus stays on the list while the arrow keys move the highlight, which is what shows. */
|
|
209
|
+
.{{prefix}}-select__list {
|
|
210
|
+
position: relative;
|
|
211
|
+
overflow: clip;
|
|
212
|
+
padding: var(--xds-space-1);
|
|
213
|
+
outline: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* A row looks like a compact list row. A compact row is shorter than a finger needs, so on
|
|
217
|
+
a touch screen it grows to the smallest pressable size. The padding above and below only
|
|
218
|
+
shows on a row of two lines, an option with a description. */
|
|
219
|
+
.{{prefix}}-select__item {
|
|
220
|
+
position: relative;
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: flex-start;
|
|
224
|
+
gap: var(--xds-space-2);
|
|
225
|
+
min-height: max(var(--xds-size-list-row-compact), var(--xds-size-target-min));
|
|
226
|
+
padding: var(--xds-space-1) var(--xds-space-2);
|
|
227
|
+
border-radius: var(--xds-radius-sm);
|
|
228
|
+
white-space: nowrap;
|
|
229
|
+
font-size: var(--xds-typography-detail-size);
|
|
230
|
+
font-weight: var(--xds-typography-detail-weight);
|
|
231
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
232
|
+
color: var(--xds-color-menu-text);
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
touch-action: manipulation;
|
|
235
|
+
transition: background-color var(--xds-motion-duration-fast) var(--xds-motion-easing-standard);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* The pointer moves the same highlight as the arrow keys, so one rule draws both. The
|
|
239
|
+
highlight is a fill, which shows inside the list where a focus ring would be clipped. */
|
|
240
|
+
.{{prefix}}-select__item[data-highlighted] {
|
|
241
|
+
background: var(--xds-color-menu-item-background-hover);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.{{prefix}}-select__item:active {
|
|
245
|
+
background: var(--xds-color-menu-item-background-pressed);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.{{prefix}}-select__item-words {
|
|
249
|
+
display: flex;
|
|
250
|
+
flex: 1 1 0%;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
min-width: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.{{prefix}}-select__item-label,
|
|
256
|
+
.{{prefix}}-select__item-description {
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
text-overflow: ellipsis;
|
|
259
|
+
white-space: nowrap;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.{{prefix}}-select__item-description {
|
|
263
|
+
font-size: var(--xds-typography-footnote-size);
|
|
264
|
+
font-weight: var(--xds-typography-footnote-weight);
|
|
265
|
+
line-height: var(--xds-typography-footnote-line-height);
|
|
266
|
+
color: var(--xds-color-text-secondary);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* The list grows a little as it fades in, from the side of the field it opens on. The scale
|
|
271
|
+
and the distance are literals: a custom property inside a keyframe keeps WebKit from running
|
|
272
|
+
the animation on the compositor. */
|
|
273
|
+
@keyframes {{prefix}}-select-enter {
|
|
274
|
+
from {
|
|
275
|
+
opacity: 0;
|
|
276
|
+
transform: translate3d(0, -0.25rem, 0) scale(0.95);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@keyframes {{prefix}}-select-enter-above {
|
|
281
|
+
from {
|
|
282
|
+
opacity: 0;
|
|
283
|
+
transform: translate3d(0, 0.25rem, 0) scale(0.95);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Ejected from `@xds/react` 0.2.0 by `xds eject`. This copy is the app's own: change it
|
|
2
|
+
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
|
+
|
|
4
|
+
export type SelectOption<Value extends string = string> = {
|
|
5
|
+
value: Value;
|
|
6
|
+
label: string;
|
|
7
|
+
/** A line of help under the label, in the list only. */
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Select's props in every framework, short of `onChange`. */
|
|
12
|
+
export type SelectBaseProps<Value extends string = string> = {
|
|
13
|
+
/** Always visible, like a TextField's. */
|
|
14
|
+
label: string;
|
|
15
|
+
options: readonly SelectOption<Value>[];
|
|
16
|
+
/** The chosen option. Leave it out while nothing is chosen. */
|
|
17
|
+
value?: Value | undefined;
|
|
18
|
+
/** Shown in the field while nothing is chosen. */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** Help shown under the field. Replaced by `error` while there is one. */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** What is wrong and how to fix it. Clear it when the choice changes. */
|
|
23
|
+
error?: string | undefined;
|
|
24
|
+
/** The name the choice is submitted under with a form. */
|
|
25
|
+
name?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The ids of the label and the help line of the option at `index`, under the Select's own id.
|
|
31
|
+
* The option is named by its label alone, as the field shows it, and described by the help.
|
|
32
|
+
*/
|
|
33
|
+
export function selectOptionIds(id: string, index: number) {
|
|
34
|
+
const label = `${id}-option-${index}`;
|
|
35
|
+
return { label, description: `${label}-description` };
|
|
36
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Ejected from `@xds/react` 0.2.0 by `xds eject`. This copy is the app's own: change it
|
|
2
|
+
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
|
+
|
|
4
|
+
import { type IconName, PRESSABLE_ROW } from "@xds/react/base";
|
|
5
|
+
|
|
6
|
+
export type SidebarItem<Value extends string = string> = {
|
|
7
|
+
value: Value;
|
|
8
|
+
label: string;
|
|
9
|
+
icon: IconName;
|
|
10
|
+
/** How many things the place holds, at the end of the row. Zero or less shows none. */
|
|
11
|
+
count?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type SidebarSection<Value extends string = string> = {
|
|
15
|
+
/** Shown above the items; a hairline takes its place while the sidebar is collapsed. */
|
|
16
|
+
title?: string;
|
|
17
|
+
items: readonly SidebarItem<Value>[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Sidebar's props in every framework, short of `onChange`, `header` and `footer`. */
|
|
21
|
+
export type SidebarBaseProps<Value extends string = string> = {
|
|
22
|
+
sections: readonly SidebarSection<Value>[];
|
|
23
|
+
/** The current place. */
|
|
24
|
+
value: Value;
|
|
25
|
+
/** Names the navigation for assistive technology, such as "Main". */
|
|
26
|
+
label: string;
|
|
27
|
+
/** A rail of icons, each named by a Tooltip. The app decides when, and holds the state. */
|
|
28
|
+
collapsed?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// The same number a CountBadge would show, without its red: this is how many things a place
|
|
32
|
+
// holds, not how many are waiting.
|
|
33
|
+
const MAX_COUNT = 99;
|
|
34
|
+
|
|
35
|
+
/** What the end of a row says about `count`, or nothing for zero or less. */
|
|
36
|
+
export function sidebarCount(count: number | undefined): string | undefined {
|
|
37
|
+
if (count === undefined || count <= 0) return undefined;
|
|
38
|
+
return count > MAX_COUNT ? `${MAX_COUNT}+` : String(count);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function sidebarClass(collapsed = false): string {
|
|
42
|
+
return `flex h-full shrink-0 flex-col gap-2 border-xds-sidebar-border border-e bg-xds-sidebar-background p-2 ${collapsed ? "w-xds-sidebar-rail" : "w-xds-sidebar"}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A section after the first is a gap away from the one before it. */
|
|
46
|
+
export function sidebarSectionClass(index: number, collapsed = false): string {
|
|
47
|
+
return index === 0 ? "" : collapsed ? "mt-2" : "mt-4";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Still there while collapsed, for the list it names, but not shown. */
|
|
51
|
+
export function sidebarTitleClass(collapsed = false): string {
|
|
52
|
+
return collapsed ? "sr-only" : "px-2 pb-1 text-xds-footnote text-xds-sidebar-section-title";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** A row of the collapsed rail: an icon-only button with the fills of a pressable list row. */
|
|
56
|
+
export function sidebarRailButtonClass(selected = false): string {
|
|
57
|
+
return `flex min-h-xds-list-row-compact w-full cursor-pointer items-center justify-center transition-colors duration-(--xds-motion-duration-fast) ${selected ? `bg-xds-list-row-background-selected text-xds-text-primary ${PRESSABLE_ROW.selected}` : `text-xds-text-secondary ${PRESSABLE_ROW.rest}`} ${PRESSABLE_ROW.focus}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The icon of an expanded row. */
|
|
61
|
+
export function sidebarIconClass(selected = false): string {
|
|
62
|
+
return selected ? "text-xds-text-primary" : "text-xds-text-secondary";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const SIDEBAR_PARTS = {
|
|
66
|
+
/** The header and the footer stay; the places between them scroll. */
|
|
67
|
+
edge: "shrink-0",
|
|
68
|
+
places: "flex min-h-0 flex-1 flex-col overflow-y-auto",
|
|
69
|
+
/** The hairline in place of a section's title while collapsed. */
|
|
70
|
+
rule: "mx-2 mb-2 h-(--xds-border-width-thin) bg-xds-sidebar-border",
|
|
71
|
+
list: "flex flex-col",
|
|
72
|
+
/** The row is clipped to the rounded shape; its focus ring is inside it. */
|
|
73
|
+
item: "overflow-hidden rounded-xds-md",
|
|
74
|
+
count: "text-xds-detail text-xds-text-secondary tabular-nums",
|
|
75
|
+
} as const;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Ejected from `@xds/react` 0.2.0 by `xds eject`. This copy is the app's own: change it
|
|
2
|
+
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
|
+
|
|
4
|
+
export type SkeletonShape = "text" | "rect" | "circle";
|
|
5
|
+
|
|
6
|
+
/** Skeleton's props in every framework. */
|
|
7
|
+
export type SkeletonBaseProps = {
|
|
8
|
+
/**
|
|
9
|
+
* `text` is one line of body text, `rect` a block such as a picture, `circle` an avatar.
|
|
10
|
+
* A `rect` needs a `height`, and a `circle` one of the two lengths.
|
|
11
|
+
*/
|
|
12
|
+
shape?: SkeletonShape;
|
|
13
|
+
/** A number is in pixels; a string is any CSS length. A `text` line fills its row without it. */
|
|
14
|
+
width?: number | string;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const SHAPE = {
|
|
19
|
+
text: "h-(--xds-typography-body-size) w-full rounded-xds-sm",
|
|
20
|
+
rect: "w-full rounded-xds-md",
|
|
21
|
+
circle: "rounded-xds-full",
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
// The pulse is `xds-skeleton-pulse` in the stylesheet. People who ask for less motion get a
|
|
25
|
+
// placeholder that stands still.
|
|
26
|
+
export function skeletonClass(shape: SkeletonShape = "text"): string {
|
|
27
|
+
return `block shrink-0 animate-[xds-skeleton-pulse_var(--xds-motion-duration-pulse)_var(--xds-motion-easing-standard)_infinite] bg-xds-skeleton-background motion-reduce:animate-none ${SHAPE[shape]}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The width and height to set on the placeholder, as CSS lengths. A circle is as wide as it is
|
|
32
|
+
* tall, whichever of the two it was given.
|
|
33
|
+
*/
|
|
34
|
+
export function skeletonSize(options: SkeletonBaseProps): { width?: string; height?: string } {
|
|
35
|
+
const width = cssLength(options.width);
|
|
36
|
+
const height = cssLength(options.height);
|
|
37
|
+
const box =
|
|
38
|
+
options.shape === "circle"
|
|
39
|
+
? { width: width ?? height, height: height ?? width }
|
|
40
|
+
: { width, height };
|
|
41
|
+
const size: { width?: string; height?: string } = {};
|
|
42
|
+
if (box.width !== undefined) size.width = box.width;
|
|
43
|
+
if (box.height !== undefined) size.height = box.height;
|
|
44
|
+
return size;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// React adds `px` to a number in a style; other frameworks set the bare number, which the
|
|
48
|
+
// browser ignores.
|
|
49
|
+
function cssLength(value: number | string | undefined): string | undefined {
|
|
50
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
51
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Ejected from `@xds/react` 0.2.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
|
+
* Slider: Zag's slider machine, with one thumb.
|
|
7
|
+
*
|
|
8
|
+
* Parts: `.{{prefix}}-slider` (a grid: the label and the value on one line, the track under them),
|
|
9
|
+
* `__label`, `__output`, `__control` (the pressable band, which Zag measures to turn a press into
|
|
10
|
+
* a value), `__track` (the line), `__range` (the fill), `__thumb`.
|
|
11
|
+
* States: `[data-disabled]` on the root, `:focus-visible` and `[data-dragging]` on the thumb.
|
|
12
|
+
* Zag places the thumb and the ends of the fill with its own inline styles.
|
|
13
|
+
*/
|
|
14
|
+
@layer components {
|
|
15
|
+
.{{prefix}}-slider {
|
|
16
|
+
display: grid;
|
|
17
|
+
grid-template-areas:
|
|
18
|
+
"label output"
|
|
19
|
+
"track track";
|
|
20
|
+
grid-template-columns: 1fr auto;
|
|
21
|
+
row-gap: var(--xds-space-1);
|
|
22
|
+
column-gap: var(--xds-space-2);
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.{{prefix}}-slider__label {
|
|
27
|
+
grid-area: label;
|
|
28
|
+
width: fit-content;
|
|
29
|
+
font-size: var(--xds-typography-label-size);
|
|
30
|
+
font-weight: var(--xds-typography-label-weight);
|
|
31
|
+
line-height: var(--xds-typography-label-line-height);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.{{prefix}}-slider__output {
|
|
35
|
+
grid-area: output;
|
|
36
|
+
align-self: end;
|
|
37
|
+
font-size: var(--xds-typography-detail-size);
|
|
38
|
+
font-weight: var(--xds-typography-detail-weight);
|
|
39
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
40
|
+
font-variant-numeric: tabular-nums;
|
|
41
|
+
color: var(--xds-color-text-secondary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* The pressable band, as tall as the smallest pressable area, and inset by half a thumb at
|
|
45
|
+
each end so the thumb is centered on the value. It is as wide as the slider besides, so
|
|
46
|
+
the far end reaches half a thumb past the slider's edge. */
|
|
47
|
+
.{{prefix}}-slider__control {
|
|
48
|
+
grid-area: track;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: max(var(--xds-size-target-min), var(--xds-size-slider-thumb));
|
|
51
|
+
margin-inline: calc(var(--xds-size-slider-thumb) / 2);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.{{prefix}}-slider__track {
|
|
56
|
+
height: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* The line runs past the band's insets, to where the thumb's edge is at either extreme. */
|
|
60
|
+
.{{prefix}}-slider__track::before {
|
|
61
|
+
content: "";
|
|
62
|
+
position: absolute;
|
|
63
|
+
inset-inline: calc(var(--xds-size-slider-thumb) / -2);
|
|
64
|
+
top: 50%;
|
|
65
|
+
height: var(--xds-size-slider-track);
|
|
66
|
+
translate: 0 -50%;
|
|
67
|
+
border-radius: var(--xds-radius-full);
|
|
68
|
+
background: var(--xds-color-slider-track);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Zag sizes the fill from the start of the inset band; the padding reaches back over the
|
|
72
|
+
inset, so the fill starts where the line does. */
|
|
73
|
+
.{{prefix}}-slider__range {
|
|
74
|
+
top: 50%;
|
|
75
|
+
box-sizing: content-box;
|
|
76
|
+
height: var(--xds-size-slider-track);
|
|
77
|
+
margin-inline-start: calc(var(--xds-size-slider-thumb) / -2);
|
|
78
|
+
padding-inline-start: calc(var(--xds-size-slider-thumb) / 2);
|
|
79
|
+
translate: 0 -50%;
|
|
80
|
+
border-radius: var(--xds-radius-full);
|
|
81
|
+
background: var(--xds-color-slider-fill);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Zag centers the thumb on the value across; this centers it on the line. */
|
|
86
|
+
.{{prefix}}-slider__thumb {
|
|
87
|
+
top: 50%;
|
|
88
|
+
z-index: 2;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
width: var(--xds-size-slider-thumb);
|
|
91
|
+
height: var(--xds-size-slider-thumb);
|
|
92
|
+
translate: 0 -50%;
|
|
93
|
+
border: var(--xds-border-width-thick) solid var(--xds-color-slider-thumb-border);
|
|
94
|
+
border-radius: var(--xds-radius-full);
|
|
95
|
+
background: var(--xds-color-slider-thumb);
|
|
96
|
+
outline: none;
|
|
97
|
+
cursor: grab;
|
|
98
|
+
transition: border-color var(--xds-motion-duration-fast) var(--xds-motion-easing-standard);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.{{prefix}}-slider__thumb[data-dragging] {
|
|
102
|
+
cursor: grabbing;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.{{prefix}}-slider__thumb:focus-visible {
|
|
106
|
+
z-index: 10;
|
|
107
|
+
outline: var(--xds-focus-width) solid var(--xds-color-border-focus);
|
|
108
|
+
outline-offset: var(--xds-focus-offset);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Disabled is recolored, not faded: the fill and the thumb's ring turn grey, and so do the
|
|
112
|
+
label and the value. */
|
|
113
|
+
.{{prefix}}-slider[data-disabled] {
|
|
114
|
+
cursor: not-allowed;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.{{prefix}}-slider[data-disabled] .{{prefix}}-slider__label,
|
|
119
|
+
.{{prefix}}-slider[data-disabled] .{{prefix}}-slider__output {
|
|
120
|
+
color: var(--xds-color-text-disabled);
|
|
121
|
+
cursor: not-allowed;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.{{prefix}}-slider[data-disabled] .{{prefix}}-slider__range {
|
|
125
|
+
background: var(--xds-color-slider-disabled-fill);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.{{prefix}}-slider[data-disabled] .{{prefix}}-slider__thumb {
|
|
129
|
+
border-color: var(--xds-color-slider-disabled-fill);
|
|
130
|
+
cursor: default;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.{{prefix}}-slider[data-disabled] .{{prefix}}-slider__control {
|
|
134
|
+
cursor: default;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Ejected from `@xds/react` 0.2.0 by `xds eject`. This copy is the app's own: change it
|
|
2
|
+
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
|
+
|
|
4
|
+
import { focusWithoutRing } from "@xds/react/base";
|
|
5
|
+
|
|
6
|
+
/** Slider's props in every framework, short of `onChange`. */
|
|
7
|
+
export type SliderBaseProps = {
|
|
8
|
+
/** Shown above the track, and names the slider for assistive technology. */
|
|
9
|
+
label: string;
|
|
10
|
+
value: number;
|
|
11
|
+
/** Defaults to 0. */
|
|
12
|
+
min?: number;
|
|
13
|
+
/** Defaults to 100. */
|
|
14
|
+
max?: number;
|
|
15
|
+
/** The values snap to multiples of it from `min`. Defaults to 1. */
|
|
16
|
+
step?: number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Shows the current value at the end of the label's line. */
|
|
19
|
+
showValue?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
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);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* How far Page Up, Page Down and a shifted arrow key move the thumb: a tenth of the range,
|
|
29
|
+
* rounded to a whole number of steps and never less than one.
|
|
30
|
+
*/
|
|
31
|
+
export function sliderPageSize(options: { min: number; max: number; step: number }): number {
|
|
32
|
+
const { min, max, step } = options;
|
|
33
|
+
const steps = Math.max(Math.round((max - min) / 10 / step), 1);
|
|
34
|
+
// Rounded to the step's decimals, so that 3 steps of 0.1 are 0.3.
|
|
35
|
+
const decimals = String(step).split(".")[1]?.length ?? 0;
|
|
36
|
+
return Number((steps * step).toFixed(decimals));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Where Up or Down moves the thumb of a horizontal slider, as they move a native range input:
|
|
41
|
+
* a step, or `pageSize` with Shift, within the range. Undefined for any other key. Zag's
|
|
42
|
+
* horizontal slider leaves the two keys to the page.
|
|
43
|
+
*/
|
|
44
|
+
export function sliderArrowValue(
|
|
45
|
+
event: { key: string; shiftKey: boolean },
|
|
46
|
+
options: { value: number; min: number; max: number; step: number; pageSize: number },
|
|
47
|
+
): number | undefined {
|
|
48
|
+
const direction = event.key === "ArrowUp" ? 1 : event.key === "ArrowDown" ? -1 : 0;
|
|
49
|
+
if (direction === 0) return undefined;
|
|
50
|
+
const { value, min, max, step, pageSize } = options;
|
|
51
|
+
const next = value + direction * (event.shiftKey ? pageSize : step);
|
|
52
|
+
return Math.min(max, Math.max(min, next));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* For a press on a slider's track or thumb, ahead of Zag's handler. Zag keeps the press from
|
|
57
|
+
* focusing anything, then focuses the thumb from a script; focused here first, the thumb shows
|
|
58
|
+
* no keyboard ring.
|
|
59
|
+
*/
|
|
60
|
+
export function focusThumbOnPress(
|
|
61
|
+
event: { button: number },
|
|
62
|
+
thumb: HTMLElement | null | undefined,
|
|
63
|
+
): void {
|
|
64
|
+
if (event.button === 0) focusWithoutRing(thumb);
|
|
65
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Ejected from `@xds/react` 0.2.0 by `xds eject`. This copy is the app's own: change it
|
|
2
|
+
// as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
3
|
+
|
|
4
|
+
const SIZE = {
|
|
5
|
+
sm: "size-xds-spinner-sm",
|
|
6
|
+
md: "size-xds-spinner-md",
|
|
7
|
+
lg: "size-xds-spinner-lg",
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export type SpinnerSize = keyof typeof SIZE;
|
|
11
|
+
|
|
12
|
+
export type SpinnerBaseProps = {
|
|
13
|
+
size?: SpinnerSize;
|
|
14
|
+
/** Announces the spinner. Leave it out next to text that already says what is happening. */
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** The class of the spinner's ring. Its wrapper is `inline-flex shrink-0`. */
|
|
19
|
+
export function spinnerClass(size: SpinnerSize = "md"): string {
|
|
20
|
+
// People who ask for less motion get a slow pulse instead of a spin, not a frozen ring.
|
|
21
|
+
return `${SIZE[size]} animate-spin motion-reduce:animate-pulse`;
|
|
22
|
+
}
|