@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,101 @@
|
|
|
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
|
+
* Popover: Zag's popover machine. A surface that opens beside the control that opens it, with a
|
|
7
|
+
* title, a close button and whatever the app puts in it: a short form, details, actions. It is
|
|
8
|
+
* not modal: a press outside, Escape or the close button closes it, and the focus goes back to
|
|
9
|
+
* the trigger.
|
|
10
|
+
*
|
|
11
|
+
* Parts: `.{{prefix}}-popover__trigger` (added to the Button or IconButton that opens it),
|
|
12
|
+
* `.{{prefix}}-popover__positioner` (placed by Zag), `.{{prefix}}-popover` (the surface,
|
|
13
|
+
* role="dialog"), `__header`, `__title`, `__close` and `__body`.
|
|
14
|
+
* States: `[aria-expanded="true"]` on the trigger while open, `[data-state="open"|"closed"]` and `[data-placement]` on the surface.
|
|
15
|
+
*/
|
|
16
|
+
@layer components {
|
|
17
|
+
/* The trigger stays pressed while its popover is open, which ties the popover to the control
|
|
18
|
+
it came from, as a menu's does. */
|
|
19
|
+
.{{prefix}}-popover__trigger[aria-expanded="true"] {
|
|
20
|
+
background-color: var(--button-bg-pressed);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.{{prefix}}-popover__positioner {
|
|
24
|
+
z-index: var(--{{prefix}}-layer-overlay);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.{{prefix}}-popover {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: var(--xds-space-2);
|
|
31
|
+
/* Six times `space.12`: room for a short form or a few lines of text. */
|
|
32
|
+
width: min(calc(6 * var(--xds-space-12)), calc(100svw - 2 * var(--xds-space-4)));
|
|
33
|
+
max-height: var(--available-height);
|
|
34
|
+
padding: var(--xds-space-4);
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
overscroll-behavior: contain;
|
|
37
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-popover-border);
|
|
38
|
+
border-radius: var(--xds-radius-lg);
|
|
39
|
+
background: var(--xds-color-popover-background);
|
|
40
|
+
color: var(--xds-color-popover-text);
|
|
41
|
+
box-shadow: var(--xds-shadow-raised);
|
|
42
|
+
outline: none;
|
|
43
|
+
font-size: var(--xds-typography-body-size);
|
|
44
|
+
line-height: var(--xds-typography-body-line-height);
|
|
45
|
+
transform-origin: var(--transform-origin);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.{{prefix}}-popover[data-state="open"] {
|
|
49
|
+
animation: {{prefix}}-popover-in var(--xds-motion-duration-fast) var(--xds-motion-easing-standard);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.{{prefix}}-popover[data-state="closed"] {
|
|
53
|
+
animation: {{prefix}}-popover-out var(--xds-motion-duration-fast) var(--xds-motion-easing-standard)
|
|
54
|
+
forwards;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@keyframes {{prefix}}-popover-in {
|
|
58
|
+
from {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
transform: scale(var(--xds-motion-press-scale));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@keyframes {{prefix}}-popover-out {
|
|
65
|
+
to {
|
|
66
|
+
opacity: 0;
|
|
67
|
+
transform: scale(var(--xds-motion-press-scale));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (prefers-reduced-motion: reduce) {
|
|
72
|
+
.{{prefix}}-popover[data-state] {
|
|
73
|
+
animation: none;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.{{prefix}}-popover__header {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
gap: var(--xds-space-2);
|
|
82
|
+
/* The close button's own room around its icon, so its icon lines up with the edge. */
|
|
83
|
+
margin-inline-end: calc(-1 * var(--xds-space-2));
|
|
84
|
+
margin-block: calc(-1 * var(--xds-space-1));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.{{prefix}}-popover__title {
|
|
88
|
+
margin: 0;
|
|
89
|
+
color: var(--xds-color-popover-title);
|
|
90
|
+
font-size: var(--xds-typography-heading-size);
|
|
91
|
+
font-weight: var(--xds-typography-heading-weight);
|
|
92
|
+
line-height: var(--xds-typography-heading-line-height);
|
|
93
|
+
letter-spacing: var(--xds-typography-heading-letter-spacing);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.{{prefix}}-popover__body {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: var(--xds-space-3);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
/** Popover's props in every framework, short of its trigger and its content. */
|
|
5
|
+
export type PopoverBaseProps = {
|
|
6
|
+
/** Names the popover, and stands at its top. */
|
|
7
|
+
title: string;
|
|
8
|
+
/**
|
|
9
|
+
* The side of the trigger it opens on, where it opens beside it: below unless there is no
|
|
10
|
+
* room. Where fingers are used it is a sheet across the bottom of the screen instead.
|
|
11
|
+
*/
|
|
12
|
+
placement?: "bottom" | "top";
|
|
13
|
+
/** Names its close button: `close` from the closest `Labels` unless it is given. */
|
|
14
|
+
closeLabel?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether it is open. Given at all, even as `undefined`, the app keeps it and changes it in
|
|
17
|
+
* `onOpenChange`; otherwise the popover keeps its own, from `defaultOpen`.
|
|
18
|
+
*/
|
|
19
|
+
open?: boolean;
|
|
20
|
+
/** Whether it starts open when it keeps its own. */
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The classes of a Popover's parts: its trigger (added to the Button or IconButton that opens
|
|
26
|
+
* it), the positioner Zag places, the surface (the root part,
|
|
27
|
+
* `{{prefix}}-popover`, which takes the app's class and attributes), its header, title, close button
|
|
28
|
+
* and body.
|
|
29
|
+
*/
|
|
30
|
+
export const POPOVER_PARTS = {
|
|
31
|
+
trigger: "{{prefix}}-popover__trigger",
|
|
32
|
+
positioner: "{{prefix}}-popover__positioner",
|
|
33
|
+
header: "{{prefix}}-popover__header",
|
|
34
|
+
title: "{{prefix}}-popover__title",
|
|
35
|
+
close: "{{prefix}}-popover__close",
|
|
36
|
+
body: "{{prefix}}-popover__body",
|
|
37
|
+
} as const;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
/** ProgressBar's props in every framework. */
|
|
5
|
+
export type ProgressBarBaseProps = {
|
|
6
|
+
/** How far along, from 0 to 1. Values outside are clamped. */
|
|
7
|
+
value: number;
|
|
8
|
+
/** Says what is progressing; a screen reader reads it with the percentage. */
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/** The whole percentage a value from 0 to 1 stands for, clamped to 0 to 100. */
|
|
13
|
+
export function progressPercent(value: number): number {
|
|
14
|
+
return Math.round(Math.min(1, Math.max(0, value)) * 100);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The track. It has the progress bar role and holds the fill. Forced colors fill it in the page's
|
|
19
|
+
* color, so it takes an edge in the text's.
|
|
20
|
+
*/
|
|
21
|
+
export const progressBarClass =
|
|
22
|
+
"h-xds-progress w-full overflow-hidden rounded-full bg-xds-progress-track forced-colors:border forced-colors:border-[CanvasText]";
|
|
23
|
+
|
|
24
|
+
/** The fill, whose width is the percentage: the system's highlight in forced colors. */
|
|
25
|
+
export const progressBarFillClass =
|
|
26
|
+
"h-full rounded-full bg-xds-progress-fill transition-[width] duration-(--xds-motion-duration-normal) motion-reduce:transition-none forced-colors:bg-[Highlight]";
|
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
* RadioGroup: native radio buttons, hidden and drawn beside, in a group named by its legend.
|
|
7
|
+
*
|
|
8
|
+
* Parts: `.{{prefix}}-radio-group` (the column), `__label` (the legend), `__options`, `__option` (the
|
|
9
|
+
* pressable row, a <label>), `__input` (the hidden radio), `__row`, `__circle-line`, `__circle`,
|
|
10
|
+
* `__dot`, `__words`, `__text`, `__description`, `__error`.
|
|
11
|
+
* States: `:checked`, `:focus-visible` and `:disabled` on the input; the row and the legend
|
|
12
|
+
* follow it through `:has()`.
|
|
13
|
+
*/
|
|
14
|
+
@layer components {
|
|
15
|
+
.{{prefix}}-radio-group {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.{{prefix}}-radio-group__label {
|
|
21
|
+
margin-bottom: var(--xds-space-1);
|
|
22
|
+
font-size: var(--xds-typography-label-size);
|
|
23
|
+
font-weight: var(--xds-typography-label-weight);
|
|
24
|
+
line-height: var(--xds-typography-label-line-height);
|
|
25
|
+
color: var(--xds-color-text-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.{{prefix}}-radio-group__options {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: var(--xds-space-2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.{{prefix}}-radio-group__option {
|
|
35
|
+
position: relative;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
width: fit-content;
|
|
39
|
+
min-height: var(--xds-size-target-min);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
user-select: none;
|
|
42
|
+
touch-action: manipulation;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.{{prefix}}-radio-group__row {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
gap: var(--xds-space-2);
|
|
49
|
+
font-size: var(--xds-typography-body-size);
|
|
50
|
+
font-weight: var(--xds-typography-body-weight);
|
|
51
|
+
line-height: var(--xds-typography-body-line-height);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* The circle sits on the first line of the label, however many lines the label wraps to.
|
|
55
|
+
`1lh` is the height of that line; on a touch screen the circle may be the taller of the
|
|
56
|
+
two. */
|
|
57
|
+
.{{prefix}}-radio-group__circle-line {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
align-items: center;
|
|
61
|
+
height: max(1lh, var(--xds-size-radio));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.{{prefix}}-radio-group__circle {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
width: var(--xds-size-radio);
|
|
69
|
+
height: var(--xds-size-radio);
|
|
70
|
+
border-radius: calc(infinity * 1px);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Half of the whole circle, ring included, not of the space inside it. */
|
|
74
|
+
.{{prefix}}-radio-group__dot {
|
|
75
|
+
display: none;
|
|
76
|
+
width: calc(var(--xds-size-radio) / 2);
|
|
77
|
+
height: calc(var(--xds-size-radio) / 2);
|
|
78
|
+
border-radius: calc(infinity * 1px);
|
|
79
|
+
background-color: var(--xds-color-radio-dot);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:checked) .{{prefix}}-radio-group__dot {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Around the circle, as around a checkbox's box. */
|
|
87
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:focus-visible)
|
|
88
|
+
.{{prefix}}-radio-group__circle {
|
|
89
|
+
outline: var(--xds-focus-width) solid var(--xds-color-border-focus);
|
|
90
|
+
outline-offset: var(--xds-focus-offset);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* The whole group is enabled or disabled, so the circle has one look or the other. Enabled,
|
|
94
|
+
a thin ring at rest and a thick one around a dot when chosen, so the choice does not
|
|
95
|
+
depend on color; disabled, filled instead of outlined, like a disabled checkbox. */
|
|
96
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__circle {
|
|
97
|
+
background-color: var(--xds-color-radio-disabled-background);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:enabled) .{{prefix}}-radio-group__circle {
|
|
101
|
+
border: var(--xds-border-width-thin) solid var(--xds-color-radio-border);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:enabled:checked)
|
|
105
|
+
.{{prefix}}-radio-group__circle {
|
|
106
|
+
border-width: var(--xds-border-width-thick);
|
|
107
|
+
border-color: var(--xds-color-radio-border-checked);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* The label and the description under it. */
|
|
111
|
+
.{{prefix}}-radio-group__words {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.{{prefix}}-radio-group__text {
|
|
118
|
+
color: var(--xds-color-text-primary);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.{{prefix}}-radio-group__description {
|
|
122
|
+
font-size: var(--xds-typography-detail-size);
|
|
123
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
124
|
+
overflow-wrap: break-word;
|
|
125
|
+
color: var(--xds-color-text-secondary);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* An inline run in its live region, which is as tall as a line of the group's text. */
|
|
129
|
+
.{{prefix}}-radio-group__error {
|
|
130
|
+
margin-top: var(--xds-space-1);
|
|
131
|
+
font-size: var(--xds-typography-detail-size);
|
|
132
|
+
line-height: var(--xds-typography-detail-line-height);
|
|
133
|
+
overflow-wrap: break-word;
|
|
134
|
+
color: var(--xds-color-status-danger);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ------------------------------------------------------------ disabled */
|
|
138
|
+
|
|
139
|
+
/* The text is recolored rather than faded. */
|
|
140
|
+
.{{prefix}}-radio-group:has(.{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__label {
|
|
141
|
+
color: var(--xds-color-text-disabled);
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) {
|
|
147
|
+
cursor: not-allowed;
|
|
148
|
+
pointer-events: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__dot {
|
|
152
|
+
background-color: var(--xds-color-radio-disabled-dot);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__text,
|
|
156
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled)
|
|
157
|
+
.{{prefix}}-radio-group__description {
|
|
158
|
+
color: var(--xds-color-text-disabled);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Forced colors draw every fill in the page's color, which would hide the dot and a disabled
|
|
162
|
+
circle: the dot takes the system's highlight, and a disabled group the system's gray, its
|
|
163
|
+
circle outlined. */
|
|
164
|
+
@media (forced-colors: active) {
|
|
165
|
+
.{{prefix}}-radio-group__dot {
|
|
166
|
+
background-color: Highlight;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__circle {
|
|
170
|
+
border: var(--xds-border-width-thin) solid GrayText;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__dot {
|
|
174
|
+
background-color: GrayText;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.{{prefix}}-radio-group:has(.{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__label,
|
|
178
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled) .{{prefix}}-radio-group__text,
|
|
179
|
+
.{{prefix}}-radio-group__option:has(> .{{prefix}}-radio-group__input:disabled)
|
|
180
|
+
.{{prefix}}-radio-group__description {
|
|
181
|
+
color: GrayText;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 RadioOption<Value extends string = string> = {
|
|
5
|
+
value: Value;
|
|
6
|
+
label: string;
|
|
7
|
+
/** A line of help under the label. */
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** RadioGroup's props in every framework, short of `onChange`. */
|
|
12
|
+
export type RadioGroupBaseProps<Value extends string = string> = {
|
|
13
|
+
/** The group's visible legend, which also names it for assistive technology. */
|
|
14
|
+
label: string;
|
|
15
|
+
options: readonly RadioOption<Value>[];
|
|
16
|
+
/**
|
|
17
|
+
* The chosen option, `undefined` while nothing is chosen. Leave it out for a group that keeps
|
|
18
|
+
* its own choice, from `defaultValue`: the group is controlled whenever `value` is given, even
|
|
19
|
+
* as `undefined`.
|
|
20
|
+
*/
|
|
21
|
+
value?: Value | undefined;
|
|
22
|
+
/** The first choice of a group that keeps its own, without `value`. */
|
|
23
|
+
defaultValue?: Value | undefined;
|
|
24
|
+
/** Disables the whole group. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** What is wrong and how to fix it, under the options. Clear it when the choice changes. */
|
|
27
|
+
error?: string | undefined;
|
|
28
|
+
/** The name the choice is submitted under with a form. */
|
|
29
|
+
name?: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 } from "@xds/vue/base";
|
|
5
|
+
|
|
6
|
+
/** SectionHeader's props in every framework, short of its action. */
|
|
7
|
+
export type SectionHeaderBaseProps = {
|
|
8
|
+
title: string;
|
|
9
|
+
/** A line under the title. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Before the title. */
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
/** The heading level in the document outline. Defaults to 2. */
|
|
14
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// What sits beside the title is centered on the title's first line, not on the whole block,
|
|
18
|
+
// so it stays put when a description is added. `1lh` in the heading's type is that line.
|
|
19
|
+
const TITLE_LINE = "flex h-lh shrink-0 items-center text-xds-heading";
|
|
20
|
+
|
|
21
|
+
export const SECTION_HEADER_PARTS = {
|
|
22
|
+
root: "flex items-start gap-4",
|
|
23
|
+
/** The icon and the text. */
|
|
24
|
+
lead: "flex min-w-0 flex-1 items-start gap-2",
|
|
25
|
+
icon: `${TITLE_LINE} text-xds-text-secondary`,
|
|
26
|
+
text: "flex min-w-0 flex-col gap-0.5",
|
|
27
|
+
title: "text-xds-heading text-xds-text-primary",
|
|
28
|
+
description: "text-xds-detail text-xds-text-secondary",
|
|
29
|
+
action: TITLE_LINE,
|
|
30
|
+
// Button's own `iconEnd` does not mirror; this one has to, as it points onward.
|
|
31
|
+
chevron: "rtl:-scale-x-100",
|
|
32
|
+
} as const;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { PEER_FOCUS } from "@xds/vue/base";
|
|
5
|
+
|
|
6
|
+
/** SegmentedControl's props in every framework, short of `onChange`. */
|
|
7
|
+
export type SegmentedControlBaseProps<Value extends string> = {
|
|
8
|
+
options: readonly { value: Value; label: string }[];
|
|
9
|
+
/** The chosen segment. Leave it out for a control that keeps its own, from `defaultValue`. */
|
|
10
|
+
value?: Value;
|
|
11
|
+
/** The first segment of a control that keeps its own, without `value`. Defaults to the first. */
|
|
12
|
+
defaultValue?: Value;
|
|
13
|
+
/** Says what is being chosen, for assistive technology. */
|
|
14
|
+
"aria-label": string;
|
|
15
|
+
/** Stretches to the width of its container. */
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** The track the segments sit in. */
|
|
20
|
+
export function segmentedControlClass(fullWidth = false): string {
|
|
21
|
+
return `h-xds-control-md rounded-xds-md bg-xds-segmented-track p-0.5 ${fullWidth ? "flex w-full" : "inline-flex w-fit"}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The label around each segment's hidden radio button. */
|
|
25
|
+
export function segmentedControlOptionClass(fullWidth = false): string {
|
|
26
|
+
return `relative flex cursor-pointer ${fullWidth ? "flex-1" : ""}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The segment drawn beside the hidden radio button. The border is there on every segment,
|
|
31
|
+
* transparent until selected, so selecting does not move the text.
|
|
32
|
+
*/
|
|
33
|
+
export const segmentedControlSegmentClass = `flex w-full items-center justify-center whitespace-nowrap rounded-[calc(var(--xds-radius-md)-2px)] border border-transparent px-4 text-xds-label text-xds-segmented-text peer-checked:border-xds-segmented-selected-border peer-checked:bg-xds-segmented-selected-background peer-checked:text-xds-segmented-selected-text peer-checked:shadow-xds-subtle forced-colors:peer-checked:bg-[Highlight] forced-colors:peer-checked:text-[HighlightText] forced-colors:peer-checked:forced-color-adjust-none ${PEER_FOCUS}`;
|