@xds/vue 1.0.1 → 1.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/dist/Banner.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/Breadcrumb.js +4 -0
- package/dist/Breadcrumb.vue.d.ts +6 -0
- package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/Button.vue.d.ts +9 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Checkbox.vue.d.ts +13 -10
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +42 -22
- package/dist/Combobox.js +4 -0
- package/dist/Combobox.vue.d.ts +22 -0
- package/dist/Combobox.vue_vue_type_script_setup_true_lang.js +140 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/Dialog.vue.d.ts +5 -2
- package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/IconButton.vue.d.ts +9 -1
- package/dist/IconButton.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Labels.vue.d.ts +17 -0
- package/dist/Labels.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/Labels2.js +4 -0
- package/dist/Link.js +4 -0
- package/dist/Link.vue.d.ts +27 -0
- package/dist/Link.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/Menu.vue.d.ts +4 -1
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/Pagination.js +4 -0
- package/dist/Pagination.vue.d.ts +9 -0
- package/dist/Pagination.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/Popover.js +4 -0
- package/dist/Popover.vue.d.ts +26 -0
- package/dist/Popover.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang.js +13 -7
- package/dist/SearchField.vue.d.ts +11 -8
- package/dist/SearchField.vue_vue_type_script_setup_true_lang.js +40 -22
- package/dist/SegmentedControl.vue.d.ts +3 -7
- package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +13 -14
- package/dist/Select.vue.d.ts +3 -1
- package/dist/Select.vue_vue_type_script_setup_true_lang.js +47 -18
- package/dist/Slider.vue.d.ts +3 -8
- package/dist/Slider.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/Switch.vue.d.ts +13 -10
- package/dist/Switch.vue_vue_type_script_setup_true_lang.js +33 -21
- package/dist/Table.js +4 -0
- package/dist/Table.vue.d.ts +10 -0
- package/dist/Table.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/Tabs.vue.d.ts +3 -5
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/TextField.vue.d.ts +11 -8
- package/dist/TextField.vue_vue_type_script_setup_true_lang.js +26 -13
- package/dist/TimePicker.js +4 -0
- package/dist/TimePicker.vue.d.ts +10 -0
- package/dist/TimePicker.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
- package/dist/ToastQueue.js +4 -0
- package/dist/ToastQueue.vue.d.ts +9 -0
- package/dist/ToastQueue.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/TooltipOverlay.vue.d.ts +1 -0
- package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/base.d.ts +13 -0
- package/dist/base.js +14 -0
- package/dist/controlled.d.ts +46 -0
- package/dist/controlled.js +64 -2
- package/dist/index.d.ts +14 -3
- package/dist/index.js +11 -1
- package/dist/labels.d.ts +9 -0
- package/dist/labels.js +17 -0
- package/dist/preview.d.ts +20 -3
- package/dist/preview.js +37 -7
- package/dist/trigger.d.ts +7 -0
- package/dist/trigger.js +13 -1
- package/eject/files/Accordion.vue +89 -0
- package/eject/files/AccordionPanel.vue +47 -0
- package/eject/files/Avatar.vue +41 -0
- package/eject/files/AvatarStack.vue +46 -0
- package/eject/files/Badge.vue +29 -0
- package/eject/files/Banner.vue +65 -0
- package/eject/files/Breadcrumb.vue +43 -0
- package/eject/files/Button.vue +93 -0
- package/eject/files/Card.vue +85 -0
- package/eject/files/Checkbox.vue +104 -0
- package/eject/files/Chip.vue +32 -0
- package/eject/files/ChipBar.vue +25 -0
- package/eject/files/Combobox.vue +175 -0
- package/eject/files/CountBadge.vue +45 -0
- package/eject/files/DatePicker.vue +223 -0
- package/eject/files/DateRangePicker.vue +317 -0
- package/eject/files/Dialog.vue +105 -0
- package/eject/files/Divider.vue +15 -0
- package/eject/files/EmptyState.vue +28 -0
- package/eject/files/Icon.vue +34 -0
- package/eject/files/IconButton.vue +71 -0
- package/eject/files/Link.vue +48 -0
- package/eject/files/ListRow.vue +33 -0
- package/eject/files/MediaCard.vue +109 -0
- package/eject/files/Menu.vue +181 -0
- package/eject/files/Pagination.vue +88 -0
- package/eject/files/PlaceRow.vue +54 -0
- package/eject/files/Popover.vue +119 -0
- package/eject/files/ProgressBar.vue +34 -0
- package/eject/files/RadioGroup.vue +126 -0
- package/eject/files/SearchField.vue +129 -0
- package/eject/files/SectionHeader.vue +37 -0
- package/eject/files/SegmentedControl.vue +81 -0
- package/eject/files/Select.vue +269 -0
- package/eject/files/Sidebar.vue +101 -0
- package/eject/files/SidebarRailButton.vue +31 -0
- package/eject/files/Skeleton.vue +27 -0
- package/eject/files/Slider.vue +126 -0
- package/eject/files/Spinner.vue +36 -0
- package/eject/files/Switch.vue +88 -0
- package/eject/files/Table.vue +77 -0
- package/eject/files/Tabs.vue +72 -0
- package/eject/files/Text.vue +22 -0
- package/eject/files/TextField.vue +190 -0
- package/eject/files/Thumbnail.vue +62 -0
- package/eject/files/TimePicker.vue +224 -0
- package/eject/files/Toast.vue +83 -0
- package/eject/files/ToastQueue.vue +54 -0
- package/eject/files/Tooltip.vue +28 -0
- package/eject/files/TooltipOverlay.vue +86 -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 +71 -0
- package/eject/files/base.css +38 -0
- package/eject/files/breadcrumb.css +51 -0
- package/eject/files/breadcrumb.ts +42 -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 +52 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/combobox.css +269 -0
- package/eject/files/combobox.ts +85 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +375 -0
- package/eject/files/date-picker.ts +280 -0
- package/eject/files/date-range-picker.ts +338 -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/link.css +64 -0
- package/eject/files/link.ts +63 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +192 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/overlay.css +40 -0
- package/eject/files/pagination.css +106 -0
- package/eject/files/pagination.ts +68 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/popover.css +101 -0
- package/eject/files/popover.ts +37 -0
- package/eject/files/progress-bar.ts +26 -0
- package/eject/files/radio-group.css +184 -0
- package/eject/files/radio-group.ts +30 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +33 -0
- package/eject/files/select.css +347 -0
- package/eject/files/select.ts +77 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +160 -0
- package/eject/files/slider.ts +80 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +45 -0
- package/eject/files/table.css +107 -0
- package/eject/files/table.ts +84 -0
- package/eject/files/tabs.css +120 -0
- package/eject/files/tabs.ts +37 -0
- package/eject/files/text-field.css +225 -0
- package/eject/files/text-field.ts +64 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/time-picker.ts +113 -0
- package/eject/files/toast-queue.ts +64 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +111 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +1122 -0
- package/package.json +11 -4
- package/styles.css +1135 -167
- package/tailwind.css +1295 -218
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Ejected from `@xds/vue` 1.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 `--{{prefix}}-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. A TimePicker is a Select of times, with the
|
|
21
|
+
* same parts, field and list, under `.{{prefix}}-time-picker`.
|
|
22
|
+
*/
|
|
23
|
+
@layer components {
|
|
24
|
+
.{{prefix}}-select,
|
|
25
|
+
.{{prefix}}-date-picker,
|
|
26
|
+
.{{prefix}}-time-picker {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: var(--xds-space-1);
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.{{prefix}}-select__label,
|
|
34
|
+
.{{prefix}}-date-picker__label,
|
|
35
|
+
.{{prefix}}-time-picker__label {
|
|
36
|
+
width: fit-content;
|
|
37
|
+
font-size: var(--xds-typography-label-size);
|
|
38
|
+
font-weight: var(--xds-typography-label-weight);
|
|
39
|
+
line-height: var(--xds-typography-label-line-height);
|
|
40
|
+
color: var(--xds-color-text-primary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.{{prefix}}-select:has(.{{prefix}}-select__trigger:disabled) .{{prefix}}-select__label,
|
|
44
|
+
.{{prefix}}-date-picker:has(.{{prefix}}-date-picker__trigger:disabled) .{{prefix}}-date-picker__label,
|
|
45
|
+
.{{prefix}}-time-picker:has(.{{prefix}}-time-picker__trigger:disabled) .{{prefix}}-time-picker__label {
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ------------------------------------------------------------ the field */
|
|
52
|
+
|
|
53
|
+
/* A text field's box: the same height, inset, corners and type, with the icon at the end
|
|
54
|
+
(the chevrons, a DatePicker's calendar or a TimePicker's clock) a gap away from the value. */
|
|
55
|
+
.{{prefix}}-select__trigger,
|
|
56
|
+
.{{prefix}}-date-picker__trigger,
|
|
57
|
+
.{{prefix}}-time-picker__trigger {
|
|
58
|
+
position: relative;
|
|
59
|
+
isolation: isolate;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: var(--xds-space-2);
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-height: var(--xds-size-control-md);
|
|
65
|
+
padding-block: 0;
|
|
66
|
+
padding-inline: var(--xds-space-3);
|
|
67
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-field-border);
|
|
68
|
+
border-radius: var(--xds-radius-md);
|
|
69
|
+
background-color: var(--xds-color-field-background);
|
|
70
|
+
color: var(--xds-color-field-text);
|
|
71
|
+
text-align: start;
|
|
72
|
+
outline-style: none;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
user-select: none;
|
|
75
|
+
touch-action: manipulation;
|
|
76
|
+
-webkit-tap-highlight-color: transparent;
|
|
77
|
+
transition-property: background-color, border-color, box-shadow;
|
|
78
|
+
transition-duration: var(--xds-motion-duration-fast);
|
|
79
|
+
transition-timing-function: var(--xds-motion-easing-standard);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* A text field's ring sits on its border, not a gap away from it. */
|
|
83
|
+
.{{prefix}}-select__trigger:focus-visible,
|
|
84
|
+
.{{prefix}}-date-picker__trigger:focus-visible,
|
|
85
|
+
.{{prefix}}-time-picker__trigger:focus-visible {
|
|
86
|
+
border-color: var(--xds-color-field-border-focus);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Invalid as a text field is: red, and thicker, so the state does not depend on telling
|
|
90
|
+
colors apart. Focused, it stays red and the inner line goes. */
|
|
91
|
+
.{{prefix}}-select__trigger[data-invalid],
|
|
92
|
+
.{{prefix}}-date-picker__trigger[data-invalid],
|
|
93
|
+
.{{prefix}}-time-picker__trigger[data-invalid] {
|
|
94
|
+
border-color: var(--xds-color-field-border-invalid);
|
|
95
|
+
box-shadow: inset 0 0 0 var(--xds-border-width-thin) var(--xds-color-field-border-invalid);
|
|
96
|
+
outline: var(--xds-border-width-thin) solid var(--xds-color-danger-default);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.{{prefix}}-select__trigger[data-invalid]:focus,
|
|
100
|
+
.{{prefix}}-date-picker__trigger[data-invalid]:focus,
|
|
101
|
+
.{{prefix}}-time-picker__trigger[data-invalid]:focus {
|
|
102
|
+
box-shadow: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* After focus and the error, which it outranks. */
|
|
106
|
+
@media (hover: hover) {
|
|
107
|
+
.{{prefix}}-select__trigger:hover,
|
|
108
|
+
.{{prefix}}-date-picker__trigger:hover,
|
|
109
|
+
.{{prefix}}-time-picker__trigger:hover {
|
|
110
|
+
border-color: var(--xds-color-text-primary);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.{{prefix}}-select__trigger:disabled,
|
|
115
|
+
.{{prefix}}-date-picker__trigger:disabled,
|
|
116
|
+
.{{prefix}}-time-picker__trigger:disabled {
|
|
117
|
+
opacity: 0.5;
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* One line, cut short with an ellipsis, so a long option does not make the field taller. */
|
|
123
|
+
.{{prefix}}-select__value,
|
|
124
|
+
.{{prefix}}-date-picker__value,
|
|
125
|
+
.{{prefix}}-time-picker__value {
|
|
126
|
+
flex: 1 1 0%;
|
|
127
|
+
min-width: 0;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
text-overflow: ellipsis;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
overflow-wrap: break-word;
|
|
132
|
+
font-size: var(--xds-typography-body-size);
|
|
133
|
+
line-height: var(--xds-typography-body-line-height);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.{{prefix}}-select__trigger[data-placeholder-shown] .{{prefix}}-select__value,
|
|
137
|
+
.{{prefix}}-date-picker__trigger[data-placeholder-shown] .{{prefix}}-date-picker__value,
|
|
138
|
+
.{{prefix}}-time-picker__trigger[data-placeholder-shown] .{{prefix}}-time-picker__value {
|
|
139
|
+
color: var(--xds-color-field-placeholder);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* One line under the box, as under a TextField: the help or the error. When nothing is shown
|
|
143
|
+
the line takes no room so the empty live error region stays mounted without shifting layout. */
|
|
144
|
+
.{{prefix}}-select__footer,
|
|
145
|
+
.{{prefix}}-date-picker__footer,
|
|
146
|
+
.{{prefix}}-time-picker__footer {
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: baseline;
|
|
149
|
+
gap: var(--xds-space-3);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.{{prefix}}-select__footer:not(:has(> :not(:empty))),
|
|
153
|
+
.{{prefix}}-date-picker__footer:not(:has(> :not(:empty))),
|
|
154
|
+
.{{prefix}}-time-picker__footer:not(:has(> :not(:empty))) {
|
|
155
|
+
position: absolute;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.{{prefix}}-select__description,
|
|
159
|
+
.{{prefix}}-select__error,
|
|
160
|
+
.{{prefix}}-date-picker__description,
|
|
161
|
+
.{{prefix}}-date-picker__error,
|
|
162
|
+
.{{prefix}}-time-picker__description,
|
|
163
|
+
.{{prefix}}-time-picker__error {
|
|
164
|
+
font-size: var(--xds-typography-detail-size);
|
|
165
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
166
|
+
overflow-wrap: break-word;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.{{prefix}}-select__description,
|
|
170
|
+
.{{prefix}}-date-picker__description,
|
|
171
|
+
.{{prefix}}-time-picker__description {
|
|
172
|
+
color: var(--xds-color-text-secondary);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.{{prefix}}-select__error,
|
|
176
|
+
.{{prefix}}-date-picker__error,
|
|
177
|
+
.{{prefix}}-time-picker__error {
|
|
178
|
+
color: var(--xds-color-status-danger);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.{{prefix}}-select__error:empty,
|
|
182
|
+
.{{prefix}}-date-picker__error:empty,
|
|
183
|
+
.{{prefix}}-time-picker__error:empty {
|
|
184
|
+
position: absolute;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* ------------------------------------------------------------ the list */
|
|
188
|
+
|
|
189
|
+
/* Over the page and under the open list, as under a Menu: a press outside only closes the
|
|
190
|
+
list, and the field under the pointer keeps its own border meanwhile. */
|
|
191
|
+
.{{prefix}}-select__underlay,
|
|
192
|
+
.{{prefix}}-time-picker__underlay {
|
|
193
|
+
position: fixed;
|
|
194
|
+
inset: 0;
|
|
195
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Zag sets the position, and the width: exactly the field's, however short the options. */
|
|
199
|
+
.{{prefix}}-select__positioner,
|
|
200
|
+
.{{prefix}}-time-picker__positioner {
|
|
201
|
+
z-index: calc(var(--{{prefix}}-layer-overlay) + var(--layer-index, 0));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* A menu's surface. It scrolls when the window has no room for all of it. */
|
|
205
|
+
.{{prefix}}-select__content,
|
|
206
|
+
.{{prefix}}-time-picker__content {
|
|
207
|
+
max-height: var(--available-height);
|
|
208
|
+
overflow-y: auto;
|
|
209
|
+
overscroll-behavior: contain;
|
|
210
|
+
scroll-padding-block: var(--xds-space-1);
|
|
211
|
+
/* A thin scrollbar in the text's color, faint, which stays out of the way of the rows. */
|
|
212
|
+
scrollbar-width: thin;
|
|
213
|
+
scrollbar-color: color-mix(in oklab, var(--xds-color-text-primary) 15%, transparent)
|
|
214
|
+
transparent;
|
|
215
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-menu-border);
|
|
216
|
+
border-radius: var(--xds-radius-md);
|
|
217
|
+
background: var(--xds-color-menu-background);
|
|
218
|
+
box-shadow: var(--xds-shadow-raised);
|
|
219
|
+
transform-origin: var(--transform-origin);
|
|
220
|
+
animation: {{prefix}}-select-enter var(--xds-motion-duration-fast) var(--xds-motion-easing-enter);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.{{prefix}}-select__content[data-side="top"],
|
|
224
|
+
.{{prefix}}-time-picker__content[data-side="top"] {
|
|
225
|
+
animation-name: {{prefix}}-select-enter-above;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* After the rules above, which it replaces. A closing list takes no more presses. */
|
|
229
|
+
.{{prefix}}-select__content[data-state="closed"],
|
|
230
|
+
.{{prefix}}-time-picker__content[data-state="closed"] {
|
|
231
|
+
animation: {{prefix}}-overlay-exit var(--xds-motion-duration-fast) var(--xds-motion-easing-exit)
|
|
232
|
+
forwards;
|
|
233
|
+
pointer-events: none;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (prefers-reduced-motion: reduce) {
|
|
237
|
+
.{{prefix}}-select__content,
|
|
238
|
+
.{{prefix}}-select__content[data-state="closed"],
|
|
239
|
+
.{{prefix}}-time-picker__content,
|
|
240
|
+
.{{prefix}}-time-picker__content[data-state="closed"] {
|
|
241
|
+
animation: none;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Focus stays on the list while the arrow keys move the highlight, which is what shows. */
|
|
246
|
+
.{{prefix}}-select__list,
|
|
247
|
+
.{{prefix}}-time-picker__list {
|
|
248
|
+
position: relative;
|
|
249
|
+
overflow: clip;
|
|
250
|
+
padding: var(--xds-space-1);
|
|
251
|
+
outline: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* A row looks like a compact list row. A compact row is shorter than a finger needs, so on
|
|
255
|
+
a touch screen it grows to the smallest pressable size. The padding above and below only
|
|
256
|
+
shows on a row of two lines, an option with a description. */
|
|
257
|
+
.{{prefix}}-select__item,
|
|
258
|
+
.{{prefix}}-time-picker__item {
|
|
259
|
+
position: relative;
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: flex-start;
|
|
263
|
+
gap: var(--xds-space-2);
|
|
264
|
+
min-height: max(var(--xds-size-list-row-compact), var(--xds-size-target-min));
|
|
265
|
+
padding: var(--xds-space-1) var(--xds-space-2);
|
|
266
|
+
border-radius: var(--xds-radius-sm);
|
|
267
|
+
white-space: nowrap;
|
|
268
|
+
font-size: var(--xds-typography-detail-size);
|
|
269
|
+
font-weight: var(--xds-typography-detail-weight);
|
|
270
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
271
|
+
color: var(--xds-color-menu-text);
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
touch-action: manipulation;
|
|
274
|
+
transition: background-color var(--xds-motion-duration-fast) var(--xds-motion-easing-standard);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* The pointer moves the same highlight as the arrow keys, so one rule draws both. The
|
|
278
|
+
highlight is a fill, which shows inside the list where a focus ring would be clipped. */
|
|
279
|
+
.{{prefix}}-select__item[data-highlighted],
|
|
280
|
+
.{{prefix}}-time-picker__item[data-highlighted] {
|
|
281
|
+
background: var(--xds-color-menu-item-background-hover);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.{{prefix}}-select__item:active,
|
|
285
|
+
.{{prefix}}-time-picker__item:active {
|
|
286
|
+
background: var(--xds-color-menu-item-background-pressed);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.{{prefix}}-select__item-words,
|
|
290
|
+
.{{prefix}}-time-picker__item-words {
|
|
291
|
+
display: flex;
|
|
292
|
+
flex: 1 1 0%;
|
|
293
|
+
flex-direction: column;
|
|
294
|
+
min-width: 0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.{{prefix}}-select__item-label,
|
|
298
|
+
.{{prefix}}-select__item-description,
|
|
299
|
+
.{{prefix}}-time-picker__item-label,
|
|
300
|
+
.{{prefix}}-time-picker__item-description {
|
|
301
|
+
overflow: hidden;
|
|
302
|
+
text-overflow: ellipsis;
|
|
303
|
+
white-space: nowrap;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.{{prefix}}-select__item-description,
|
|
307
|
+
.{{prefix}}-time-picker__item-description {
|
|
308
|
+
font-size: var(--xds-typography-footnote-size);
|
|
309
|
+
font-weight: var(--xds-typography-footnote-weight);
|
|
310
|
+
line-height: var(--xds-typography-footnote-line-height);
|
|
311
|
+
color: var(--xds-color-text-secondary);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* Forced colors draw every fill in the page's color, so the row under the pointer or the
|
|
315
|
+
keyboard takes the system's highlight. The browser draws a backplate in the page's color behind text in forced colors,
|
|
316
|
+
which would hide the highlight's text, so these keep their colors, which are the system's. */
|
|
317
|
+
@media (forced-colors: active) {
|
|
318
|
+
.{{prefix}}-select__item[data-highlighted],
|
|
319
|
+
.{{prefix}}-time-picker__item[data-highlighted] {
|
|
320
|
+
forced-color-adjust: none;
|
|
321
|
+
background-color: Highlight;
|
|
322
|
+
color: HighlightText;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.{{prefix}}-select__item[data-highlighted] *,
|
|
326
|
+
.{{prefix}}-time-picker__item[data-highlighted] * {
|
|
327
|
+
color: inherit;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* The list grows a little as it fades in, from the side of the field it opens on. The scale
|
|
333
|
+
and the distance are literals: a custom property inside a keyframe keeps WebKit from running
|
|
334
|
+
the animation on the compositor. */
|
|
335
|
+
@keyframes {{prefix}}-select-enter {
|
|
336
|
+
from {
|
|
337
|
+
opacity: 0;
|
|
338
|
+
transform: translate3d(0, -0.25rem, 0) scale(0.95);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@keyframes {{prefix}}-select-enter-above {
|
|
343
|
+
from {
|
|
344
|
+
opacity: 0;
|
|
345
|
+
transform: translate3d(0, 0.25rem, 0) scale(0.95);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Ejected from `@xds/vue` 1.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
|
+
/**
|
|
17
|
+
* The chosen option, `undefined` while nothing is chosen. Leave it out for a select that keeps
|
|
18
|
+
* its own choice, from `defaultValue`: it is controlled whenever `value` is given, even as
|
|
19
|
+
* `undefined`.
|
|
20
|
+
*/
|
|
21
|
+
value?: Value | undefined;
|
|
22
|
+
/** The first choice of a select that keeps its own, without `value`. */
|
|
23
|
+
defaultValue?: Value | undefined;
|
|
24
|
+
/** Shown in the field while nothing is chosen. */
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/** Help shown under the field. Replaced by `error` while there is one. */
|
|
27
|
+
description?: string;
|
|
28
|
+
/** What is wrong and how to fix it. Clear it when the choice changes. */
|
|
29
|
+
error?: string | undefined;
|
|
30
|
+
/** The name the choice is submitted under with a form. */
|
|
31
|
+
name?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Lets the person choose any number of options, with `values` in place of `value`. The list
|
|
35
|
+
* stays open as options are chosen and unchosen, each chosen one marked with a check, and the
|
|
36
|
+
* field shows their labels in the options' order.
|
|
37
|
+
*/
|
|
38
|
+
multiple?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The chosen options of a select with `multiple`. Leave it out for one that keeps its own
|
|
41
|
+
* choice, from `defaultValues`.
|
|
42
|
+
*/
|
|
43
|
+
values?: readonly Value[] | undefined;
|
|
44
|
+
/** The first choice of a select with `multiple` that keeps its own, without `values`. */
|
|
45
|
+
defaultValues?: readonly Value[] | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* What the field of a select with `multiple` shows: the chosen options' labels in the options'
|
|
50
|
+
* order, joined by commas, or `undefined` while none is chosen, for the placeholder. In the
|
|
51
|
+
* options' order, not the order they were chosen in, so the field reads the same however the
|
|
52
|
+
* person got there.
|
|
53
|
+
*/
|
|
54
|
+
export function selectedLabels<Value extends string>(
|
|
55
|
+
options: readonly SelectOption<Value>[],
|
|
56
|
+
values: readonly Value[],
|
|
57
|
+
): string | undefined {
|
|
58
|
+
const chosen = options.filter((option) => values.includes(option.value));
|
|
59
|
+
return chosen.length === 0 ? undefined : chosen.map((option) => option.label).join(", ");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** `values` in the options' order, which is the order a select with `multiple` reports. */
|
|
63
|
+
export function orderedValues<Value extends string>(
|
|
64
|
+
options: readonly SelectOption<Value>[],
|
|
65
|
+
values: readonly Value[],
|
|
66
|
+
): Value[] {
|
|
67
|
+
return options.map((option) => option.value).filter((value) => values.includes(value));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The ids of the label and the help line of the option at `index`, under the Select's own id.
|
|
72
|
+
* The option is named by its label alone, as the field shows it, and described by the help.
|
|
73
|
+
*/
|
|
74
|
+
export function selectOptionIds(id: string, index: number) {
|
|
75
|
+
const label = `${id}-option-${index}`;
|
|
76
|
+
return { label, description: `${label}-description` };
|
|
77
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Ejected from `@xds/vue` 1.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/vue/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/vue` 1.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
|
+
}
|