@vieo-io/ui 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 +373 -0
- package/README.md +28 -2
- package/dist/AppShell.d.ts +22 -0
- package/dist/AppShell.jsx +16 -0
- package/dist/AppSwitcher.d.ts +23 -0
- package/dist/AppSwitcher.jsx +24 -0
- package/dist/Badge.d.ts +7 -0
- package/dist/Badge.jsx +4 -0
- package/dist/Button.d.ts +9 -0
- package/dist/Button.jsx +17 -0
- package/dist/Checkbox.d.ts +8 -0
- package/dist/Checkbox.jsx +9 -0
- package/dist/CommandPalette.d.ts +42 -0
- package/dist/CommandPalette.jsx +107 -0
- package/dist/Dialog.d.ts +13 -0
- package/dist/Dialog.jsx +37 -0
- package/dist/EmptyState.d.ts +11 -0
- package/dist/EmptyState.jsx +17 -0
- package/dist/Icon.d.ts +11 -0
- package/dist/Icon.jsx +12 -0
- package/dist/IconButton.d.ts +16 -0
- package/dist/IconButton.jsx +25 -0
- package/dist/Kbd.d.ts +8 -0
- package/dist/Kbd.jsx +23 -0
- package/dist/Listbox.d.ts +18 -0
- package/dist/Listbox.jsx +48 -0
- package/dist/Menu.d.ts +31 -0
- package/dist/Menu.jsx +114 -0
- package/dist/ObjectCard.d.ts +23 -0
- package/dist/ObjectCard.jsx +41 -0
- package/dist/Popover.d.ts +15 -0
- package/dist/Popover.jsx +50 -0
- package/dist/Resizer.d.ts +17 -0
- package/dist/Resizer.jsx +43 -0
- package/dist/SegmentedControl.d.ts +19 -0
- package/dist/SegmentedControl.jsx +39 -0
- package/dist/Select.d.ts +13 -0
- package/dist/Select.jsx +17 -0
- package/dist/SettingRow.d.ts +15 -0
- package/dist/SettingRow.jsx +26 -0
- package/dist/Sidebar.d.ts +29 -0
- package/dist/Sidebar.jsx +106 -0
- package/dist/Switch.d.ts +10 -0
- package/dist/Switch.jsx +11 -0
- package/dist/Tabs.d.ts +17 -0
- package/dist/Tabs.jsx +31 -0
- package/dist/TextField.d.ts +20 -0
- package/dist/TextField.jsx +36 -0
- package/dist/Toast.d.ts +23 -0
- package/dist/Toast.jsx +124 -0
- package/dist/Toolbar.d.ts +17 -0
- package/dist/Toolbar.jsx +67 -0
- package/dist/Tooltip.d.ts +12 -0
- package/dist/Tooltip.jsx +54 -0
- package/dist/Tree.d.ts +36 -0
- package/dist/Tree.jsx +149 -0
- package/dist/app-switcher.css +73 -0
- package/dist/aria.d.ts +2 -0
- package/dist/aria.js +6 -0
- package/dist/button.css +117 -0
- package/dist/controls.css +187 -0
- package/dist/dialog.css +60 -0
- package/dist/field.css +68 -0
- package/dist/icon.css +5 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +28 -0
- package/dist/layers.d.ts +7 -0
- package/dist/layers.js +38 -0
- package/dist/listbox.css +49 -0
- package/dist/menu.css +56 -0
- package/dist/object-card.css +81 -0
- package/dist/palette.css +86 -0
- package/dist/paths.d.ts +68 -0
- package/dist/paths.js +68 -0
- package/dist/popover.css +21 -0
- package/dist/roving.d.ts +21 -0
- package/dist/roving.js +48 -0
- package/dist/setting.css +42 -0
- package/dist/shell.css +186 -0
- package/dist/small.css +77 -0
- package/dist/styles.css +20 -0
- package/dist/tabs.css +44 -0
- package/dist/toast.css +72 -0
- package/dist/toolbar.css +54 -0
- package/dist/tooltip.css +14 -0
- package/dist/tree.css +129 -0
- package/dist/trigger.d.ts +15 -0
- package/dist/trigger.js +1 -0
- package/package.json +52 -3
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* Checkbox, Switch, Select, and SegmentedControl. */
|
|
2
|
+
|
|
3
|
+
.vds-checkbox {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--space-2);
|
|
7
|
+
font-size: var(--font-ui);
|
|
8
|
+
line-height: var(--line-ui);
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.vds-checkbox__input {
|
|
13
|
+
position: relative;
|
|
14
|
+
flex: none;
|
|
15
|
+
width: 16px;
|
|
16
|
+
height: 16px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
accent-color: var(--accent);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.vds-checkbox:has(:disabled) {
|
|
23
|
+
color: var(--muted);
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.vds-switch {
|
|
28
|
+
position: relative;
|
|
29
|
+
flex: none;
|
|
30
|
+
width: 32px;
|
|
31
|
+
height: 18px;
|
|
32
|
+
margin: 0;
|
|
33
|
+
border-radius: var(--radius-pill);
|
|
34
|
+
background: var(--border-strong);
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
appearance: none;
|
|
37
|
+
transition: background var(--dur) var(--ease);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.vds-switch::after {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 2px;
|
|
43
|
+
left: 2px;
|
|
44
|
+
width: 14px;
|
|
45
|
+
height: 14px;
|
|
46
|
+
border-radius: 50%;
|
|
47
|
+
background: var(--bg);
|
|
48
|
+
content: "";
|
|
49
|
+
transition: transform var(--dur) var(--ease);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vds-switch:checked {
|
|
53
|
+
background: var(--accent);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.vds-switch:checked::after {
|
|
57
|
+
background: var(--accent-ink);
|
|
58
|
+
transform: translateX(14px);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.vds-switch:focus-visible {
|
|
62
|
+
outline: none;
|
|
63
|
+
box-shadow: var(--focus-ring);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.vds-switch:disabled {
|
|
67
|
+
opacity: 0.5;
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (prefers-color-scheme: dark) {
|
|
72
|
+
:root:not([data-theme="light"]) .vds-switch:not(:checked)::after {
|
|
73
|
+
background: var(--text);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:root[data-theme="dark"] .vds-switch:not(:checked)::after {
|
|
78
|
+
background: var(--text);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (pointer: coarse) {
|
|
82
|
+
/* A native select can't hold a touch area larger than itself. */
|
|
83
|
+
.vds-select__input {
|
|
84
|
+
min-height: var(--hit-min);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.vds-switch::before,
|
|
88
|
+
.vds-checkbox__input::before {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 50%;
|
|
91
|
+
left: 50%;
|
|
92
|
+
width: max(100%, var(--hit-min));
|
|
93
|
+
height: max(100%, var(--hit-min));
|
|
94
|
+
content: "";
|
|
95
|
+
transform: translate(-50%, -50%);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.vds-select {
|
|
100
|
+
position: relative;
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
min-width: 160px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.vds-select__input {
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: var(--control-height);
|
|
109
|
+
padding: 0 calc(var(--space-2) * 2 + var(--icon-size-sm)) 0 var(--space-3);
|
|
110
|
+
border: 1px solid var(--border-strong);
|
|
111
|
+
border-radius: var(--radius-sm);
|
|
112
|
+
background: var(--surface);
|
|
113
|
+
color: var(--text);
|
|
114
|
+
font: inherit;
|
|
115
|
+
font-size: var(--font-ui);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
appearance: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.vds-select__input:focus-visible {
|
|
121
|
+
outline: none;
|
|
122
|
+
box-shadow: var(--focus-ring);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.vds-select__input:disabled {
|
|
126
|
+
color: var(--muted);
|
|
127
|
+
cursor: not-allowed;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.vds-select__chevron {
|
|
131
|
+
position: absolute;
|
|
132
|
+
right: var(--space-2);
|
|
133
|
+
color: var(--muted);
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.vds-segmented {
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
padding: 2px;
|
|
140
|
+
border-radius: var(--radius-sm);
|
|
141
|
+
background: var(--bg-hover);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.vds-segmented__option {
|
|
145
|
+
position: relative;
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: var(--space-1);
|
|
149
|
+
height: calc(var(--control-height) - 4px);
|
|
150
|
+
padding: 0 var(--space-3);
|
|
151
|
+
border: 0;
|
|
152
|
+
border-radius: var(--radius-xs);
|
|
153
|
+
background: transparent;
|
|
154
|
+
color: var(--text);
|
|
155
|
+
font: inherit;
|
|
156
|
+
font-size: var(--font-ui);
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.vds-segmented__option[aria-checked="true"] {
|
|
161
|
+
background: var(--surface);
|
|
162
|
+
box-shadow:
|
|
163
|
+
0 0 0 1px var(--border),
|
|
164
|
+
var(--shadow-2);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.vds-segmented__option:focus-visible {
|
|
168
|
+
outline: none;
|
|
169
|
+
box-shadow: var(--focus-ring);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.vds-segmented__option:disabled {
|
|
173
|
+
opacity: 0.5;
|
|
174
|
+
cursor: not-allowed;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@media (pointer: coarse) {
|
|
178
|
+
.vds-segmented__option::before {
|
|
179
|
+
position: absolute;
|
|
180
|
+
top: 50%;
|
|
181
|
+
left: 0;
|
|
182
|
+
width: 100%;
|
|
183
|
+
height: max(100%, var(--hit-min));
|
|
184
|
+
content: "";
|
|
185
|
+
transform: translateY(-50%);
|
|
186
|
+
}
|
|
187
|
+
}
|
package/dist/dialog.css
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.vds-dialog-backdrop {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: var(--z-dialog);
|
|
5
|
+
background: var(--scrim);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.vds-dialog {
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 50%;
|
|
12
|
+
z-index: var(--z-dialog);
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--space-3);
|
|
16
|
+
width: min(32rem, calc(100vw - 2 * var(--space-4)));
|
|
17
|
+
max-height: calc(100vh - 2 * var(--space-6));
|
|
18
|
+
overflow: auto;
|
|
19
|
+
padding: var(--space-5);
|
|
20
|
+
border: 1px solid var(--border);
|
|
21
|
+
border-radius: var(--radius-lg);
|
|
22
|
+
background: var(--raised);
|
|
23
|
+
color: var(--text);
|
|
24
|
+
box-shadow: var(--shadow-pop);
|
|
25
|
+
transform: translate(-50%, -50%);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* A phone shows a dialog as a sheet from the bottom edge. */
|
|
29
|
+
@media (max-width: 639.98px) {
|
|
30
|
+
.vds-dialog {
|
|
31
|
+
top: auto;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
width: auto;
|
|
36
|
+
max-height: 90dvh;
|
|
37
|
+
padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
|
|
38
|
+
border-width: 1px 0 0;
|
|
39
|
+
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
|
40
|
+
transform: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vds-dialog:focus {
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vds-dialog__title {
|
|
49
|
+
margin: 0;
|
|
50
|
+
font-family: var(--font-family-display);
|
|
51
|
+
font-size: var(--font-ui);
|
|
52
|
+
font-weight: var(--weight-strong);
|
|
53
|
+
letter-spacing: var(--tracking-title);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.vds-dialog__description {
|
|
57
|
+
margin: 0;
|
|
58
|
+
color: var(--muted);
|
|
59
|
+
font-size: var(--font-sm);
|
|
60
|
+
}
|
package/dist/field.css
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.vds-field {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--space-1);
|
|
5
|
+
font-size: var(--font-ui);
|
|
6
|
+
line-height: var(--line-ui);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.vds-field__label {
|
|
10
|
+
font-size: var(--font-sm);
|
|
11
|
+
font-weight: var(--weight-strong);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.vds-field__input {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: var(--control-height);
|
|
18
|
+
padding: 0 var(--space-3);
|
|
19
|
+
border: 1px solid var(--border-strong);
|
|
20
|
+
border-radius: var(--radius-sm);
|
|
21
|
+
background: var(--surface);
|
|
22
|
+
color: var(--text);
|
|
23
|
+
font: inherit;
|
|
24
|
+
font-feature-settings: var(--font-features-ui);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.vds-field__input--multiline {
|
|
28
|
+
height: auto;
|
|
29
|
+
min-height: calc(var(--control-height) * 3);
|
|
30
|
+
padding: var(--space-2) var(--space-3);
|
|
31
|
+
resize: vertical;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vds-field__input::placeholder {
|
|
35
|
+
color: var(--muted);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vds-field__input:focus-visible {
|
|
39
|
+
border-color: var(--accent);
|
|
40
|
+
outline: none;
|
|
41
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vds-field__input:disabled {
|
|
45
|
+
color: var(--muted);
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.vds-field--invalid .vds-field__input {
|
|
50
|
+
border-color: var(--danger);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vds-field__hint {
|
|
54
|
+
color: var(--muted);
|
|
55
|
+
font-size: var(--font-sm);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vds-field__error {
|
|
59
|
+
color: var(--danger);
|
|
60
|
+
font-size: var(--font-sm);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* An input can't hold a touch area larger than itself. */
|
|
64
|
+
@media (pointer: coarse) {
|
|
65
|
+
.vds-field__input {
|
|
66
|
+
min-height: var(--hit-min);
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/icon.css
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { AppShell, type AppShellProps } from './AppShell';
|
|
2
|
+
export { type App, AppMark, AppSwitcher, type AppSwitcherProps } from './AppSwitcher';
|
|
3
|
+
export { aria } from './aria';
|
|
4
|
+
export { Badge, type BadgeProps } from './Badge';
|
|
5
|
+
export { Button, type ButtonProps } from './Button';
|
|
6
|
+
export { Checkbox, type CheckboxProps } from './Checkbox';
|
|
7
|
+
export { type Command, CommandPalette, type CommandPaletteProps } from './CommandPalette';
|
|
8
|
+
export { Dialog, type DialogProps } from './Dialog';
|
|
9
|
+
export { EmptyState, type EmptyStateProps } from './EmptyState';
|
|
10
|
+
export { Icon, type IconName, type IconProps, iconNames } from './Icon';
|
|
11
|
+
export { IconButton, type IconButtonProps } from './IconButton';
|
|
12
|
+
export { Kbd, type KbdProps } from './Kbd';
|
|
13
|
+
export { Listbox, type ListboxOption, type ListboxProps } from './Listbox';
|
|
14
|
+
export { Menu, type MenuItem, type MenuProps } from './Menu';
|
|
15
|
+
export { ObjectCard, type ObjectCardData, type ObjectCardProps } from './ObjectCard';
|
|
16
|
+
export { Popover, type PopoverProps } from './Popover';
|
|
17
|
+
export { Resizer, type ResizerProps } from './Resizer';
|
|
18
|
+
export { SegmentedControl, type SegmentedControlProps, type SegmentedOption, } from './SegmentedControl';
|
|
19
|
+
export { Select, type SelectOption, type SelectProps } from './Select';
|
|
20
|
+
export { type SettingControlProps, SettingRow, type SettingRowProps } from './SettingRow';
|
|
21
|
+
export { Sidebar, type SidebarProps } from './Sidebar';
|
|
22
|
+
export { Switch, type SwitchProps } from './Switch';
|
|
23
|
+
export { type Tab, Tabs, type TabsProps } from './Tabs';
|
|
24
|
+
export { TextField, type TextFieldProps } from './TextField';
|
|
25
|
+
export { dismissToast, Toaster, type ToastKind, type ToastOptions, toast } from './Toast';
|
|
26
|
+
export { Toolbar, type ToolbarProps } from './Toolbar';
|
|
27
|
+
export { Tooltip, type TooltipProps } from './Tooltip';
|
|
28
|
+
export { Tree, type TreeNode, type TreeProps } from './Tree';
|
|
29
|
+
export type { TriggerProps } from './trigger';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { AppShell } from './AppShell';
|
|
2
|
+
export { AppMark, AppSwitcher } from './AppSwitcher';
|
|
3
|
+
export { aria } from './aria';
|
|
4
|
+
export { Badge } from './Badge';
|
|
5
|
+
export { Button } from './Button';
|
|
6
|
+
export { Checkbox } from './Checkbox';
|
|
7
|
+
export { CommandPalette } from './CommandPalette';
|
|
8
|
+
export { Dialog } from './Dialog';
|
|
9
|
+
export { EmptyState } from './EmptyState';
|
|
10
|
+
export { Icon, iconNames } from './Icon';
|
|
11
|
+
export { IconButton } from './IconButton';
|
|
12
|
+
export { Kbd } from './Kbd';
|
|
13
|
+
export { Listbox } from './Listbox';
|
|
14
|
+
export { Menu } from './Menu';
|
|
15
|
+
export { ObjectCard } from './ObjectCard';
|
|
16
|
+
export { Popover } from './Popover';
|
|
17
|
+
export { Resizer } from './Resizer';
|
|
18
|
+
export { SegmentedControl, } from './SegmentedControl';
|
|
19
|
+
export { Select } from './Select';
|
|
20
|
+
export { SettingRow } from './SettingRow';
|
|
21
|
+
export { Sidebar } from './Sidebar';
|
|
22
|
+
export { Switch } from './Switch';
|
|
23
|
+
export { Tabs } from './Tabs';
|
|
24
|
+
export { TextField } from './TextField';
|
|
25
|
+
export { dismissToast, Toaster, toast } from './Toast';
|
|
26
|
+
export { Toolbar } from './Toolbar';
|
|
27
|
+
export { Tooltip } from './Tooltip';
|
|
28
|
+
export { Tree } from './Tree';
|
package/dist/layers.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Placement } from '@floating-ui/dom';
|
|
2
|
+
export declare function closeOnOutside(inside: () => (Element | undefined)[], close: () => void): () => void;
|
|
3
|
+
export declare function isTopDialog(dialog: object): boolean;
|
|
4
|
+
/** Keeps `floating` beside `anchor` until the returned cleanup runs. */
|
|
5
|
+
export declare function place(anchor: Element, floating: HTMLElement, placement: Placement): () => void;
|
|
6
|
+
/** Puts `dialog` on top of the stack until the returned cleanup runs. */
|
|
7
|
+
export declare function pushDialog(dialog: object): () => void;
|
package/dist/layers.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
|
|
2
|
+
/** Open modal dialogs, oldest first, so only the top one answers Escape. */
|
|
3
|
+
const DIALOGS = [];
|
|
4
|
+
export function closeOnOutside(inside, close) {
|
|
5
|
+
const onPointerDown = (event) => {
|
|
6
|
+
const target = event.target;
|
|
7
|
+
if (target && inside().some((element) => element?.contains(target)))
|
|
8
|
+
return;
|
|
9
|
+
close();
|
|
10
|
+
};
|
|
11
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
12
|
+
return () => document.removeEventListener('pointerdown', onPointerDown, true);
|
|
13
|
+
}
|
|
14
|
+
export function isTopDialog(dialog) {
|
|
15
|
+
return DIALOGS.at(-1) === dialog;
|
|
16
|
+
}
|
|
17
|
+
/** Keeps `floating` beside `anchor` until the returned cleanup runs. */
|
|
18
|
+
export function place(anchor, floating, placement) {
|
|
19
|
+
return autoUpdate(anchor, floating, () => {
|
|
20
|
+
void computePosition(anchor, floating, {
|
|
21
|
+
placement,
|
|
22
|
+
strategy: 'fixed',
|
|
23
|
+
middleware: [offset(6), flip(), shift({ padding: 8 })],
|
|
24
|
+
}).then(({ x, y }) => {
|
|
25
|
+
floating.style.left = `${x}px`;
|
|
26
|
+
floating.style.top = `${y}px`;
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Puts `dialog` on top of the stack until the returned cleanup runs. */
|
|
31
|
+
export function pushDialog(dialog) {
|
|
32
|
+
DIALOGS.push(dialog);
|
|
33
|
+
return () => {
|
|
34
|
+
const at = DIALOGS.indexOf(dialog);
|
|
35
|
+
if (at >= 0)
|
|
36
|
+
DIALOGS.splice(at, 1);
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/listbox.css
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.vds-listbox {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--row-gap);
|
|
5
|
+
padding: var(--space-1);
|
|
6
|
+
border: 1px solid var(--border);
|
|
7
|
+
border-radius: var(--radius-md);
|
|
8
|
+
background: var(--panel);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.vds-listbox__option {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
min-height: var(--row-height);
|
|
16
|
+
padding: var(--space-1) var(--space-2);
|
|
17
|
+
border-radius: var(--radius-sm);
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vds-listbox__option:hover {
|
|
22
|
+
background: var(--bg-hover);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vds-listbox__option:focus-visible {
|
|
26
|
+
outline: none;
|
|
27
|
+
box-shadow: var(--focus-ring);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vds-listbox__option[aria-selected="true"] {
|
|
31
|
+
background: var(--accent-soft);
|
|
32
|
+
font-weight: var(--weight-strong);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.vds-listbox__option[aria-disabled="true"] {
|
|
36
|
+
color: var(--muted);
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.vds-listbox__description {
|
|
41
|
+
color: var(--muted);
|
|
42
|
+
font-size: var(--font-sm);
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* --muted is only held readable on the page and the hover fill, not on --accent-soft. */
|
|
47
|
+
.vds-listbox__option[aria-selected="true"] .vds-listbox__description {
|
|
48
|
+
color: var(--text);
|
|
49
|
+
}
|
package/dist/menu.css
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.vds-menu {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
padding: var(--space-1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.vds-menu__item {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--space-2);
|
|
11
|
+
height: var(--row-height);
|
|
12
|
+
padding: 0 var(--space-2);
|
|
13
|
+
border: 0;
|
|
14
|
+
border-radius: var(--radius-sm);
|
|
15
|
+
background: transparent;
|
|
16
|
+
color: var(--text);
|
|
17
|
+
font: inherit;
|
|
18
|
+
font-size: var(--font-ui);
|
|
19
|
+
text-align: start;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.vds-menu__item:hover,
|
|
24
|
+
.vds-menu__item:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
background: var(--bg-hover);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.vds-menu__item[aria-disabled="true"] {
|
|
30
|
+
color: var(--muted);
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vds-menu__item--danger {
|
|
35
|
+
color: var(--danger);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vds-menu__item--current {
|
|
39
|
+
background: var(--accent-soft);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vds-menu__lines {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
padding: var(--space-1) 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vds-menu__description {
|
|
49
|
+
color: var(--muted);
|
|
50
|
+
font-size: var(--font-sm);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vds-menu__item:has(.vds-menu__lines) {
|
|
54
|
+
height: auto;
|
|
55
|
+
min-height: var(--row-height);
|
|
56
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.vds-object-card {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
4
|
+
gap: var(--space-1) var(--space-3);
|
|
5
|
+
align-items: start;
|
|
6
|
+
max-width: 560px;
|
|
7
|
+
padding: var(--space-3);
|
|
8
|
+
border: 1px solid var(--border);
|
|
9
|
+
border-radius: var(--radius-md);
|
|
10
|
+
background: var(--surface);
|
|
11
|
+
color: var(--text);
|
|
12
|
+
font-family: var(--font-family-ui);
|
|
13
|
+
font-feature-settings: var(--font-features-ui);
|
|
14
|
+
font-size: var(--font-ui);
|
|
15
|
+
line-height: var(--line-ui);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.vds-object-card__lines {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 2px;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vds-object-card__what {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: var(--space-2);
|
|
30
|
+
color: var(--muted);
|
|
31
|
+
font-size: var(--font-sm);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vds-object-card__status {
|
|
35
|
+
color: var(--text);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vds-object-card__title {
|
|
39
|
+
font-weight: var(--weight-strong);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vds-object-card__summary {
|
|
43
|
+
color: var(--muted);
|
|
44
|
+
font-size: var(--font-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.vds-object-card > .vds-button {
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* On a phone the Open action takes its own row. */
|
|
52
|
+
@media (max-width: 640px) {
|
|
53
|
+
.vds-object-card {
|
|
54
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vds-object-card > .vds-button {
|
|
58
|
+
grid-column: 2;
|
|
59
|
+
justify-self: start;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.vds-object-link {
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: var(--space-1);
|
|
67
|
+
padding: 0 var(--space-1);
|
|
68
|
+
border-radius: var(--radius-xs);
|
|
69
|
+
background: var(--bg-hover);
|
|
70
|
+
color: var(--text);
|
|
71
|
+
font-family: var(--font-family-ui);
|
|
72
|
+
font-feature-settings: var(--font-features-ui);
|
|
73
|
+
font-size: 0.875em;
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vds-object-link:focus-visible,
|
|
78
|
+
.vds-object-card > .vds-button:focus-visible {
|
|
79
|
+
outline: none;
|
|
80
|
+
box-shadow: var(--focus-ring);
|
|
81
|
+
}
|
package/dist/palette.css
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.vds-palette {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
border: 1px solid var(--border);
|
|
6
|
+
border-radius: var(--radius-lg);
|
|
7
|
+
background: var(--raised);
|
|
8
|
+
color: var(--text);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.vds-palette__input {
|
|
12
|
+
height: calc(var(--control-height) + var(--space-3));
|
|
13
|
+
padding: 0 var(--space-4);
|
|
14
|
+
border: 0;
|
|
15
|
+
border-bottom: 1px solid var(--border);
|
|
16
|
+
background: transparent;
|
|
17
|
+
color: var(--text);
|
|
18
|
+
font: inherit;
|
|
19
|
+
font-size: var(--font-ui);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.vds-palette__input:focus {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vds-palette__input::placeholder {
|
|
27
|
+
color: var(--muted);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vds-palette__list {
|
|
31
|
+
max-height: 22rem;
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
padding: var(--space-1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.vds-palette__heading {
|
|
37
|
+
padding: var(--space-2) var(--space-2) var(--space-1);
|
|
38
|
+
color: var(--muted);
|
|
39
|
+
font-size: var(--font-xs);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vds-palette__option {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--space-2);
|
|
46
|
+
height: var(--row-height);
|
|
47
|
+
padding: 0 var(--space-2);
|
|
48
|
+
border-radius: var(--radius-sm);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vds-palette__option[aria-selected="true"] {
|
|
53
|
+
background: var(--accent-soft);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.vds-palette__option[aria-disabled="true"] {
|
|
57
|
+
color: var(--muted);
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.vds-palette__label {
|
|
62
|
+
flex: 1;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.vds-palette__hint {
|
|
69
|
+
color: var(--muted);
|
|
70
|
+
font-family: var(--font-family-mono);
|
|
71
|
+
font-feature-settings: var(--font-features-mono);
|
|
72
|
+
font-size: var(--font-xs);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.vds-palette__empty {
|
|
76
|
+
margin: 0;
|
|
77
|
+
padding: var(--space-5) var(--space-4);
|
|
78
|
+
color: var(--muted);
|
|
79
|
+
font-size: var(--font-sm);
|
|
80
|
+
text-align: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* --muted is only held readable on the page and the hover fill, not on --accent-soft. */
|
|
84
|
+
.vds-palette__option[aria-selected="true"] .vds-palette__hint {
|
|
85
|
+
color: var(--text);
|
|
86
|
+
}
|