@vmz/ui 0.3.6 → 0.3.8
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/README.md +53 -51
- package/contracts/token-requirements.v0.json +58 -1
- package/package.json +5 -2
- package/presets/web-surface.v0.json +14 -12
- package/src/components/Accordion.vmz +127 -94
- package/src/components/Alert.vmz +125 -28
- package/src/components/AppShell.vmz +125 -57
- package/src/components/Autocomplete.vmz +261 -154
- package/src/components/Avatar.vmz +20 -12
- package/src/components/Badge.vmz +62 -70
- package/src/components/Breadcrumb.vmz +86 -72
- package/src/components/BulkActions.vmz +56 -51
- package/src/components/Button.vmz +237 -211
- package/src/components/Callout.vmz +178 -77
- package/src/components/Card.vmz +141 -120
- package/src/components/Checkbox.vmz +131 -55
- package/src/components/CodeBlock.vmz +77 -30
- package/src/components/Collapse.vmz +64 -11
- package/src/components/ConsoleShell.vmz +405 -251
- package/src/components/Content.vmz +15 -1
- package/src/components/DataTable.vmz +294 -194
- package/src/components/DatePicker.vmz +766 -674
- package/src/components/Descriptions.vmz +90 -0
- package/src/components/Dialog.vmz +137 -38
- package/src/components/Divider.vmz +8 -1
- package/src/components/Drawer.vmz +518 -427
- package/src/components/Dropdown.vmz +195 -51
- package/src/components/Empty.vmz +96 -54
- package/src/components/Field.vmz +170 -115
- package/src/components/FilterBar.vmz +34 -4
- package/src/components/Flex.vmz +3 -1
- package/src/components/Footer.vmz +6 -3
- package/src/components/Form.vmz +41 -0
- package/src/components/FormItem.vmz +78 -79
- package/src/components/Grid.vmz +6 -3
- package/src/components/Header.vmz +193 -6
- package/src/components/Layout.vmz +3 -1
- package/src/components/Link.vmz +25 -10
- package/src/components/List.vmz +124 -102
- package/src/components/Menu.vmz +416 -243
- package/src/components/Message.vmz +167 -0
- package/src/components/Notification.vmz +132 -37
- package/src/components/Pagination.vmz +237 -69
- package/src/components/Popconfirm.vmz +287 -0
- package/src/components/Popover.vmz +341 -223
- package/src/components/Progress.vmz +16 -5
- package/src/components/Prose.vmz +180 -81
- package/src/components/QueryForm.vmz +31 -9
- package/src/components/RadioGroup.vmz +204 -124
- package/src/components/Result.vmz +60 -27
- package/src/components/Segmented.vmz +86 -51
- package/src/components/Select.vmz +620 -533
- package/src/components/Sider.vmz +120 -7
- package/src/components/Skeleton.vmz +9 -7
- package/src/components/Space.vmz +9 -3
- package/src/components/Spinner.vmz +5 -4
- package/src/components/Steps.vmz +118 -103
- package/src/components/Switch.vmz +131 -98
- package/src/components/Table.vmz +270 -165
- package/src/components/Tabs.vmz +125 -110
- package/src/components/Tag.vmz +60 -43
- package/src/components/TextArea.vmz +125 -118
- package/src/components/Timeline.vmz +111 -76
- package/src/components/Toc.vmz +90 -74
- package/src/components/Tooltip.vmz +107 -58
- package/src/components/Tree.vmz +214 -191
- package/src/components/Typography.vmz +23 -8
- package/src/components/Upload.vmz +1394 -1289
|
@@ -1,18 +1,205 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<header data-vmz-ui="header" class="vmz-ui-header">
|
|
2
|
+
<header data-vmz-ui="header" :data-structured="hasNav() ? 'true' : 'false'" :onKeyDown="onMenuKeyDown" class="vmz-ui-header">
|
|
3
|
+
<div v-if="hasNav()" class="vmz-ui-header__inner">
|
|
4
|
+
<a v-if="brand" :href="homeHref" class="vmz-ui-header__brand">
|
|
5
|
+
{{ brand }}
|
|
6
|
+
</a>
|
|
7
|
+
<nav :id="navId" :aria-label="navLabel" :data-open="menuOpen ? 'true' : null" class="vmz-ui-header__nav">
|
|
8
|
+
<a v-for="item in nav" :key="item.id" :href="item.href" :data-vmz-nav="item.id" :data-active="item.id === activeId ? 'true' : 'false'" :aria-current="item.id === activeId ? 'page' : null" @click="closeMenu" class="vmz-ui-header__nav-item">
|
|
9
|
+
{{ item.title }}
|
|
10
|
+
</a>
|
|
11
|
+
</nav>
|
|
12
|
+
<div class="vmz-ui-header__actions">
|
|
13
|
+
<slot name="actions" />
|
|
14
|
+
</div>
|
|
15
|
+
<button type="button" :aria-label="menuLabel ? menuLabel : navLabel" :aria-expanded="menuOpen ? 'true' : 'false'" :aria-controls="navId" @click="toggleMenu" class="vmz-ui-header__menu">
|
|
16
|
+
<Icon :name="menuOpen ? 'action.close' : 'action.menu'" size="md" decorative />
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
3
19
|
<slot />
|
|
4
20
|
</header>
|
|
5
21
|
</template>
|
|
6
22
|
<style>
|
|
7
23
|
.vmz-ui-header {
|
|
8
|
-
|
|
24
|
+
position: sticky;
|
|
25
|
+
top: 0;
|
|
26
|
+
z-index: 30;
|
|
27
|
+
background: var(--vmz-surface-paper);
|
|
28
|
+
border-bottom: 1px solid var(--vmz-line-subtle);
|
|
29
|
+
}
|
|
30
|
+
.vmz-ui-header[data-structured="false"] {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: var(--vmz-space-6, 2rem);
|
|
34
|
+
min-height: var(--vmz-layout-header-height, 4rem);
|
|
35
|
+
padding: 0 var(--vmz-layout-gutter, 1rem);
|
|
36
|
+
}
|
|
37
|
+
.vmz-ui-header__inner {
|
|
38
|
+
width: min(var(--vmz-layout-max-width, 75rem), calc(100% - (var(--vmz-layout-gutter, 1rem) * 2)));
|
|
39
|
+
height: var(--vmz-layout-header-height, 4rem);
|
|
40
|
+
margin: 0 auto;
|
|
9
41
|
display: flex;
|
|
10
42
|
align-items: center;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
43
|
+
gap: var(--vmz-space-6, 2rem);
|
|
44
|
+
}
|
|
45
|
+
.vmz-ui-header__brand {
|
|
46
|
+
flex: none;
|
|
47
|
+
color: var(--vmz-text-ink);
|
|
48
|
+
font-family: var(--vmz-font-sans);
|
|
49
|
+
font-size: 1.0625rem;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
line-height: 1.25;
|
|
52
|
+
letter-spacing: -0.01em;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
border-radius: var(--vmz-radius-sm, 4px);
|
|
55
|
+
outline: none;
|
|
56
|
+
transition: color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
57
|
+
}
|
|
58
|
+
.vmz-ui-header__brand:hover {
|
|
59
|
+
color: var(--vmz-action-primary-background);
|
|
60
|
+
}
|
|
61
|
+
.vmz-ui-header__brand:focus-visible {
|
|
62
|
+
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
63
|
+
}
|
|
64
|
+
.vmz-ui-header__nav {
|
|
65
|
+
flex: 0 1 auto;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
height: 100%;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: var(--vmz-space-5, 1.5rem);
|
|
71
|
+
}
|
|
72
|
+
.vmz-ui-header__nav-item {
|
|
73
|
+
position: relative;
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
height: 100%;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
border-bottom: 2px solid transparent;
|
|
79
|
+
color: var(--vmz-text-steel);
|
|
80
|
+
font-size: 0.875rem;
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
line-height: 1;
|
|
83
|
+
text-decoration: none;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
outline: none;
|
|
86
|
+
transition:
|
|
87
|
+
color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1)),
|
|
88
|
+
border-color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
89
|
+
}
|
|
90
|
+
.vmz-ui-header__nav-item:hover {
|
|
91
|
+
color: var(--vmz-action-primary-background);
|
|
92
|
+
}
|
|
93
|
+
.vmz-ui-header__nav-item[data-active="true"] {
|
|
94
|
+
color: var(--vmz-action-primary-background);
|
|
95
|
+
border-bottom-color: var(--vmz-action-primary-background);
|
|
96
|
+
}
|
|
97
|
+
.vmz-ui-header__nav-item:focus-visible {
|
|
98
|
+
border-radius: var(--vmz-radius-sm, 4px);
|
|
99
|
+
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
100
|
+
}
|
|
101
|
+
.vmz-ui-header__actions {
|
|
102
|
+
flex: none;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: var(--vmz-space-2, 0.5rem);
|
|
106
|
+
margin-left: auto;
|
|
107
|
+
}
|
|
108
|
+
.vmz-ui-header__menu {
|
|
109
|
+
display: none;
|
|
110
|
+
}
|
|
111
|
+
@media (max-width: 720px) {
|
|
112
|
+
.vmz-ui-header[data-structured="false"] {
|
|
113
|
+
min-height: var(--vmz-layout-header-height-compact, 3.5rem);
|
|
114
|
+
gap: var(--vmz-space-3, 0.75rem);
|
|
115
|
+
}
|
|
116
|
+
.vmz-ui-header__inner {
|
|
117
|
+
height: var(--vmz-layout-header-height-compact, 3.5rem);
|
|
118
|
+
gap: var(--vmz-space-3, 0.75rem);
|
|
119
|
+
}
|
|
120
|
+
.vmz-ui-header__nav {
|
|
121
|
+
display: none;
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 100%;
|
|
124
|
+
left: 0;
|
|
125
|
+
right: 0;
|
|
126
|
+
height: auto;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
align-items: stretch;
|
|
129
|
+
gap: 0;
|
|
130
|
+
padding: var(--vmz-space-2, 0.5rem) var(--vmz-layout-gutter, 1rem) var(--vmz-space-4, 1rem);
|
|
131
|
+
border-bottom: 1px solid var(--vmz-line-subtle);
|
|
132
|
+
background: var(--vmz-surface-paper);
|
|
133
|
+
box-shadow: var(--vmz-shadow-popup);
|
|
134
|
+
}
|
|
135
|
+
.vmz-ui-header__nav[data-open="true"] {
|
|
136
|
+
display: flex;
|
|
137
|
+
}
|
|
138
|
+
.vmz-ui-header__nav-item {
|
|
139
|
+
height: 2.5rem;
|
|
140
|
+
padding: 0 var(--vmz-space-1, 0.25rem);
|
|
141
|
+
border-bottom: 0;
|
|
142
|
+
}
|
|
143
|
+
.vmz-ui-header__menu {
|
|
144
|
+
flex: none;
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
width: 2.5rem;
|
|
149
|
+
height: 2.5rem;
|
|
150
|
+
padding: 0;
|
|
151
|
+
border: 0;
|
|
152
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
153
|
+
background: transparent;
|
|
154
|
+
color: var(--vmz-text-ink);
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
outline: none;
|
|
157
|
+
transition: background-color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
158
|
+
}
|
|
159
|
+
.vmz-ui-header__menu:hover {
|
|
160
|
+
background: var(--vmz-surface-mist);
|
|
161
|
+
}
|
|
162
|
+
.vmz-ui-header__menu:focus-visible {
|
|
163
|
+
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
164
|
+
}
|
|
14
165
|
}
|
|
15
166
|
</style>
|
|
16
167
|
<script client>
|
|
17
|
-
|
|
168
|
+
/**
|
|
169
|
+
* VMZ UI — Header (Commercial chrome).
|
|
170
|
+
* Flat nav links plus a named `actions` slot. With no `nav` items the default
|
|
171
|
+
* slot renders as a plain padded bar. Copy stays with the parent.
|
|
172
|
+
*/
|
|
173
|
+
export default class Header {
|
|
174
|
+
public brand: string = "";
|
|
175
|
+
public homeHref: string = "/";
|
|
176
|
+
public navLabel: string = "";
|
|
177
|
+
public menuLabel: string = "";
|
|
178
|
+
/** Id of the nav item representing the current page. */
|
|
179
|
+
public activeId: string = "";
|
|
180
|
+
public navId: string = "vmz-ui-header-nav";
|
|
181
|
+
/** Parent-supplied labels; the component never hardcodes copy. */
|
|
182
|
+
public nav: {
|
|
183
|
+
id: string;
|
|
184
|
+
title: string;
|
|
185
|
+
href: string;
|
|
186
|
+
}[] = [];
|
|
187
|
+
menuOpen = false;
|
|
188
|
+
|
|
189
|
+
hasNav() {
|
|
190
|
+
return Array.isArray(this.nav) && this.nav.length > 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
toggleMenu() {
|
|
194
|
+
this.menuOpen = !this.menuOpen;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
closeMenu() {
|
|
198
|
+
if (this.menuOpen) this.menuOpen = false;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
onMenuKeyDown(e) {
|
|
202
|
+
if (e && e.key === "Escape") this.closeMenu();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
18
205
|
</script>
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
min-height: 100%;
|
|
11
|
-
|
|
11
|
+
color: var(--vmz-text-ink);
|
|
12
|
+
background: var(--vmz-surface-page);
|
|
13
|
+
font-family: var(--vmz-font-sans);
|
|
12
14
|
}
|
|
13
15
|
</style>
|
|
14
16
|
<script client>
|
package/src/components/Link.vmz
CHANGED
|
@@ -6,22 +6,21 @@
|
|
|
6
6
|
<style>
|
|
7
7
|
.vmz-ui-link {
|
|
8
8
|
font: inherit;
|
|
9
|
-
font-weight:
|
|
10
|
-
color: var(--vmz-action-
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
color: var(--vmz-action-link-foreground);
|
|
11
11
|
text-decoration: underline;
|
|
12
12
|
text-underline-offset: 0.2em;
|
|
13
13
|
text-decoration-thickness: 1px;
|
|
14
|
-
text-decoration-color:
|
|
14
|
+
text-decoration-color: currentColor;
|
|
15
15
|
outline: none;
|
|
16
|
-
border-radius: var(--vmz-radius-sm
|
|
16
|
+
border-radius: var(--vmz-radius-sm);
|
|
17
17
|
transition:
|
|
18
|
-
color var(--vmz-motion-control-duration
|
|
19
|
-
text-decoration-color var(--vmz-motion-control-duration
|
|
18
|
+
color var(--vmz-motion-control-duration) var(--vmz-motion-control-easing),
|
|
19
|
+
text-decoration-color var(--vmz-motion-control-duration) var(--vmz-motion-control-easing);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.vmz-ui-link:hover {
|
|
23
|
-
color: var(--vmz-action-
|
|
24
|
-
text-decoration-color: currentColor;
|
|
23
|
+
color: var(--vmz-action-link-hover);
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
.vmz-ui-link:active {
|
|
@@ -39,21 +38,33 @@
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
.vmz-ui-link[data-variant="muted"]:hover {
|
|
42
|
-
color: var(--vmz-action-
|
|
41
|
+
color: var(--vmz-action-link-hover);
|
|
43
42
|
text-decoration-color: currentColor;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/* Navigation link: chrome, not prose — underline is the hover affordance. */
|
|
47
46
|
.vmz-ui-link[data-variant="nav"] {
|
|
48
47
|
font-weight: 500;
|
|
48
|
+
color: var(--vmz-text-ink);
|
|
49
49
|
text-decoration: none;
|
|
50
50
|
text-decoration-color: transparent;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.vmz-ui-link[data-variant="nav"]:hover {
|
|
54
|
+
color: var(--vmz-action-link-hover);
|
|
54
55
|
text-decoration: underline;
|
|
55
56
|
text-decoration-color: currentColor;
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
.vmz-ui-link[data-variant="nav"]:active {
|
|
60
|
+
color: var(--vmz-action-primary-active);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (prefers-reduced-motion: reduce) {
|
|
64
|
+
.vmz-ui-link {
|
|
65
|
+
transition: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
57
68
|
</style>
|
|
58
69
|
<script client>
|
|
59
70
|
/**
|
|
@@ -65,7 +76,11 @@ export default class Link {
|
|
|
65
76
|
public href: string = "#";
|
|
66
77
|
public target: string = "";
|
|
67
78
|
public rel: string = "";
|
|
68
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* `default` inline prose link · `muted` quiet inline link · `nav` chrome link.
|
|
81
|
+
* Appearance/semantic hint only: navigation, `href`, `target` and `rel` are
|
|
82
|
+
* unaffected, and unknown values render as `default` without error.
|
|
83
|
+
*/
|
|
69
84
|
public variant: string = "default";
|
|
70
85
|
}
|
|
71
86
|
</script>
|
package/src/components/List.vmz
CHANGED
|
@@ -1,102 +1,124 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div data-vmz-ui="list" class="vmz-ui-list">
|
|
3
|
-
<p v-if="label" :id="labelId" class="vmz-ui-list__label">
|
|
4
|
-
{{ label }}
|
|
5
|
-
</p>
|
|
6
|
-
<ul role="listbox" :aria-labelledby="labelId" :aria-label="label" @click="onListClick" :onKeyDown="onListKeyDown" class="vmz-ui-list__items">
|
|
7
|
-
<li v-for="item in items" :key="item.id" role="option" :id="item.id" :data-vmz-list-item="item.id" :aria-selected="selected === item.id ? 'true' : 'false'" :tabindex="selected === item.id ? 0 : -1" class="vmz-ui-list__item">
|
|
8
|
-
{{ item.title }}
|
|
9
|
-
</li>
|
|
10
|
-
</ul>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<style>
|
|
14
|
-
.vmz-ui-list {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
gap: 0.
|
|
18
|
-
max-width: 28rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.vmz-ui-list__label {
|
|
22
|
-
margin: 0;
|
|
23
|
-
font-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.vmz-ui-list__item
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.vmz-ui-list__item:
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div data-vmz-ui="list" class="vmz-ui-list">
|
|
3
|
+
<p v-if="label" :id="labelId" class="vmz-ui-list__label">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</p>
|
|
6
|
+
<ul role="listbox" :aria-labelledby="labelId" :aria-label="label" @click="onListClick" :onKeyDown="onListKeyDown" class="vmz-ui-list__items">
|
|
7
|
+
<li v-for="item in items" :key="item.id" role="option" :id="item.id" :data-vmz-list-item="item.id" :aria-selected="selected === item.id ? 'true' : 'false'" :tabindex="selected === item.id ? 0 : -1" class="vmz-ui-list__item">
|
|
8
|
+
{{ item.title }}
|
|
9
|
+
</li>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<style>
|
|
14
|
+
.vmz-ui-list {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: var(--vmz-space-2, 0.5rem);
|
|
18
|
+
max-width: 28rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vmz-ui-list__label {
|
|
22
|
+
margin: 0;
|
|
23
|
+
font-size: 0.875rem;
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
color: var(--vmz-text-ink);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.vmz-ui-list__items {
|
|
29
|
+
margin: 0;
|
|
30
|
+
padding: 0;
|
|
31
|
+
list-style: none;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
border: 1px solid var(--vmz-line-default, var(--vmz-line-strong));
|
|
34
|
+
border-radius: var(--vmz-radius-lg, 8px);
|
|
35
|
+
background: var(--vmz-surface-paper);
|
|
36
|
+
color: var(--vmz-text-ink);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.vmz-ui-list__item {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
min-height: var(--vmz-control-height, 2rem);
|
|
43
|
+
padding: var(--vmz-space-2, 0.5rem) var(--vmz-space-4, 1rem);
|
|
44
|
+
font-size: 0.875rem;
|
|
45
|
+
line-height: 1.5;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
outline: none;
|
|
48
|
+
transition:
|
|
49
|
+
background-color var(--vmz-motion-control-duration, 120ms) var(--vmz-motion-control-easing, cubic-bezier(0.2, 0, 0, 1)),
|
|
50
|
+
color var(--vmz-motion-control-duration, 120ms) var(--vmz-motion-control-easing, cubic-bezier(0.2, 0, 0, 1));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vmz-ui-list__item + .vmz-ui-list__item {
|
|
54
|
+
border-top: 1px solid var(--vmz-line-subtle, var(--vmz-line-default));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vmz-ui-list__item:hover {
|
|
58
|
+
background: var(--vmz-surface-mist);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.vmz-ui-list__item[aria-selected="true"] {
|
|
62
|
+
background: var(--vmz-action-primary-soft, var(--vmz-surface-mist));
|
|
63
|
+
color: var(--vmz-action-primary-active);
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.vmz-ui-list__item[aria-selected="true"]:hover {
|
|
68
|
+
background: var(--vmz-action-primary-soft, var(--vmz-surface-mist));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.vmz-ui-list__item:focus-visible {
|
|
72
|
+
box-shadow: inset 0 0 0 2px var(--vmz-focus-ring);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:where([data-density="compact"]) .vmz-ui-list__item {
|
|
76
|
+
padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:where([data-density="dense"]) .vmz-ui-list__item {
|
|
80
|
+
padding: var(--vmz-density-dense-padding-y) var(--vmz-density-dense-padding-x);
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
<script client>
|
|
84
|
+
/**
|
|
85
|
+
* VMZ UI — List (ordinary selectable list).
|
|
86
|
+
* Parent owns `selected` id; click + Arrow/Home/End. Not a DataGrid.
|
|
87
|
+
*/
|
|
88
|
+
export default class List {
|
|
89
|
+
public label: string = "";
|
|
90
|
+
public labelId: string = "vmz-list-label";
|
|
91
|
+
public selected: string = "";
|
|
92
|
+
/** @type {{ id: string, title: string }[]} */
|
|
93
|
+
public items: {
|
|
94
|
+
id: string;
|
|
95
|
+
title: string;
|
|
96
|
+
}[] = [];
|
|
97
|
+
public onSelect: ((id: string) => void) | null = null;
|
|
98
|
+
select(id) {
|
|
99
|
+
if (typeof this.onSelect === "function") this.onSelect(id);
|
|
100
|
+
}
|
|
101
|
+
onListClick(ev) {
|
|
102
|
+
const t = ev && ev.target;
|
|
103
|
+
const el = t && typeof t.closest === "function" ? t.closest("[data-vmz-list-item]") : null;
|
|
104
|
+
const id =
|
|
105
|
+
el && typeof el.getAttribute === "function"
|
|
106
|
+
? el.getAttribute("data-vmz-list-item")
|
|
107
|
+
: null;
|
|
108
|
+
if (id) this.select(id);
|
|
109
|
+
}
|
|
110
|
+
onListKeyDown(ev) {
|
|
111
|
+
if (!ev || !this.items?.length) return;
|
|
112
|
+
const ids = this.items.map((it) => it.id);
|
|
113
|
+
const idx = Math.max(0, ids.indexOf(this.selected));
|
|
114
|
+
let next = idx;
|
|
115
|
+
if (ev.key === "ArrowDown") next = (idx + 1) % ids.length;
|
|
116
|
+
else if (ev.key === "ArrowUp") next = (idx - 1 + ids.length) % ids.length;
|
|
117
|
+
else if (ev.key === "Home") next = 0;
|
|
118
|
+
else if (ev.key === "End") next = ids.length - 1;
|
|
119
|
+
else return;
|
|
120
|
+
ev.preventDefault();
|
|
121
|
+
this.select(ids[next]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
</script>
|