@vmz/ui 0.3.6 → 0.3.7
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 +51 -51
- package/package.json +2 -2
- package/src/components/Accordion.vmz +94 -94
- package/src/components/AppShell.vmz +5 -2
- package/src/components/Autocomplete.vmz +154 -154
- package/src/components/Badge.vmz +70 -70
- package/src/components/Breadcrumb.vmz +72 -72
- package/src/components/BulkActions.vmz +51 -51
- package/src/components/Button.vmz +213 -211
- package/src/components/Callout.vmz +77 -77
- package/src/components/Card.vmz +120 -120
- package/src/components/Checkbox.vmz +55 -55
- package/src/components/CodeBlock.vmz +21 -6
- package/src/components/ConsoleShell.vmz +251 -251
- package/src/components/DataTable.vmz +194 -194
- package/src/components/DatePicker.vmz +674 -674
- package/src/components/Dialog.vmz +17 -1
- package/src/components/Drawer.vmz +427 -427
- package/src/components/Dropdown.vmz +51 -5
- package/src/components/Empty.vmz +54 -54
- package/src/components/Field.vmz +115 -115
- package/src/components/FormItem.vmz +79 -79
- package/src/components/Link.vmz +5 -1
- package/src/components/List.vmz +102 -102
- package/src/components/Menu.vmz +243 -243
- package/src/components/Pagination.vmz +71 -69
- package/src/components/Popover.vmz +223 -223
- package/src/components/Prose.vmz +81 -81
- package/src/components/RadioGroup.vmz +124 -124
- package/src/components/Segmented.vmz +51 -51
- package/src/components/Select.vmz +533 -533
- package/src/components/Steps.vmz +103 -103
- package/src/components/Switch.vmz +98 -98
- package/src/components/Table.vmz +165 -165
- package/src/components/Tabs.vmz +110 -110
- package/src/components/Tag.vmz +43 -43
- package/src/components/TextArea.vmz +118 -118
- package/src/components/Timeline.vmz +76 -76
- package/src/components/Toc.vmz +74 -74
- package/src/components/Tooltip.vmz +58 -58
- package/src/components/Tree.vmz +191 -191
- package/src/components/Upload.vmz +1299 -1289
package/src/components/List.vmz
CHANGED
|
@@ -1,102 +1,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: 0.375rem;
|
|
18
|
-
max-width: 28rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.vmz-ui-list__label {
|
|
22
|
-
margin: 0;
|
|
23
|
-
font-weight: 600;
|
|
24
|
-
color: var(--vmz-text-ink);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.vmz-ui-list__items {
|
|
28
|
-
margin: 0;
|
|
29
|
-
padding: 0.25rem;
|
|
30
|
-
list-style: none;
|
|
31
|
-
border: 1px solid var(--vmz-line-default);
|
|
32
|
-
border-radius: var(--vmz-radius-md, 6px);
|
|
33
|
-
background: var(--vmz-surface-paper);
|
|
34
|
-
color: var(--vmz-text-ink);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.vmz-ui-list__item {
|
|
38
|
-
padding: var(--vmz-density-control-padding-y) var(--vmz-density-control-padding-x);
|
|
39
|
-
border-radius: var(--vmz-radius-md, 6px);
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
outline: none;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.vmz-ui-list__item[aria-selected="true"] {
|
|
45
|
-
background: var(--vmz-action-primary-background);
|
|
46
|
-
color: var(--vmz-action-primary-foreground);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.vmz-ui-list__item:hover {
|
|
50
|
-
background: color-mix(in srgb, var(--vmz-action-primary-background) 14%, transparent);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.vmz-ui-list__item[aria-selected="true"]:hover {
|
|
54
|
-
background: var(--vmz-action-primary-hover);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.vmz-ui-list__item:focus-visible {
|
|
58
|
-
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
61
|
-
<script client>
|
|
62
|
-
/**
|
|
63
|
-
* VMZ UI — List (ordinary selectable list).
|
|
64
|
-
* Parent owns `selected` id; click + Arrow/Home/End. Not a DataGrid.
|
|
65
|
-
*/
|
|
66
|
-
export default class List {
|
|
67
|
-
public label: string = "List";
|
|
68
|
-
public labelId: string = "vmz-list-label";
|
|
69
|
-
public selected: string = "";
|
|
70
|
-
/** @type {{ id: string, title: string }[]} */
|
|
71
|
-
public items: {
|
|
72
|
-
id: string;
|
|
73
|
-
title: string;
|
|
74
|
-
}[] = [];
|
|
75
|
-
public onSelect: ((id: string) => void) | null = null;
|
|
76
|
-
select(id) {
|
|
77
|
-
if (typeof this.onSelect === "function") this.onSelect(id);
|
|
78
|
-
}
|
|
79
|
-
onListClick(ev) {
|
|
80
|
-
const t = ev && ev.target;
|
|
81
|
-
const el = t && typeof t.closest === "function" ? t.closest("[data-vmz-list-item]") : null;
|
|
82
|
-
const id =
|
|
83
|
-
el && typeof el.getAttribute === "function"
|
|
84
|
-
? el.getAttribute("data-vmz-list-item")
|
|
85
|
-
: null;
|
|
86
|
-
if (id) this.select(id);
|
|
87
|
-
}
|
|
88
|
-
onListKeyDown(ev) {
|
|
89
|
-
if (!ev || !this.items?.length) return;
|
|
90
|
-
const ids = this.items.map((it) => it.id);
|
|
91
|
-
const idx = Math.max(0, ids.indexOf(this.selected));
|
|
92
|
-
let next = idx;
|
|
93
|
-
if (ev.key === "ArrowDown") next = (idx + 1) % ids.length;
|
|
94
|
-
else if (ev.key === "ArrowUp") next = (idx - 1 + ids.length) % ids.length;
|
|
95
|
-
else if (ev.key === "Home") next = 0;
|
|
96
|
-
else if (ev.key === "End") next = ids.length - 1;
|
|
97
|
-
else return;
|
|
98
|
-
ev.preventDefault();
|
|
99
|
-
this.select(ids[next]);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
</script>
|
|
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.375rem;
|
|
18
|
+
max-width: 28rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vmz-ui-list__label {
|
|
22
|
+
margin: 0;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: var(--vmz-text-ink);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.vmz-ui-list__items {
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0.25rem;
|
|
30
|
+
list-style: none;
|
|
31
|
+
border: 1px solid var(--vmz-line-default);
|
|
32
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
33
|
+
background: var(--vmz-surface-paper);
|
|
34
|
+
color: var(--vmz-text-ink);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.vmz-ui-list__item {
|
|
38
|
+
padding: var(--vmz-density-control-padding-y) var(--vmz-density-control-padding-x);
|
|
39
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
outline: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vmz-ui-list__item[aria-selected="true"] {
|
|
45
|
+
background: var(--vmz-action-primary-background);
|
|
46
|
+
color: var(--vmz-action-primary-foreground);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.vmz-ui-list__item:hover {
|
|
50
|
+
background: color-mix(in srgb, var(--vmz-action-primary-background) 14%, transparent);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vmz-ui-list__item[aria-selected="true"]:hover {
|
|
54
|
+
background: var(--vmz-action-primary-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vmz-ui-list__item:focus-visible {
|
|
58
|
+
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
61
|
+
<script client>
|
|
62
|
+
/**
|
|
63
|
+
* VMZ UI — List (ordinary selectable list).
|
|
64
|
+
* Parent owns `selected` id; click + Arrow/Home/End. Not a DataGrid.
|
|
65
|
+
*/
|
|
66
|
+
export default class List {
|
|
67
|
+
public label: string = "List";
|
|
68
|
+
public labelId: string = "vmz-list-label";
|
|
69
|
+
public selected: string = "";
|
|
70
|
+
/** @type {{ id: string, title: string }[]} */
|
|
71
|
+
public items: {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
}[] = [];
|
|
75
|
+
public onSelect: ((id: string) => void) | null = null;
|
|
76
|
+
select(id) {
|
|
77
|
+
if (typeof this.onSelect === "function") this.onSelect(id);
|
|
78
|
+
}
|
|
79
|
+
onListClick(ev) {
|
|
80
|
+
const t = ev && ev.target;
|
|
81
|
+
const el = t && typeof t.closest === "function" ? t.closest("[data-vmz-list-item]") : null;
|
|
82
|
+
const id =
|
|
83
|
+
el && typeof el.getAttribute === "function"
|
|
84
|
+
? el.getAttribute("data-vmz-list-item")
|
|
85
|
+
: null;
|
|
86
|
+
if (id) this.select(id);
|
|
87
|
+
}
|
|
88
|
+
onListKeyDown(ev) {
|
|
89
|
+
if (!ev || !this.items?.length) return;
|
|
90
|
+
const ids = this.items.map((it) => it.id);
|
|
91
|
+
const idx = Math.max(0, ids.indexOf(this.selected));
|
|
92
|
+
let next = idx;
|
|
93
|
+
if (ev.key === "ArrowDown") next = (idx + 1) % ids.length;
|
|
94
|
+
else if (ev.key === "ArrowUp") next = (idx - 1 + ids.length) % ids.length;
|
|
95
|
+
else if (ev.key === "Home") next = 0;
|
|
96
|
+
else if (ev.key === "End") next = ids.length - 1;
|
|
97
|
+
else return;
|
|
98
|
+
ev.preventDefault();
|
|
99
|
+
this.select(ids[next]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|