@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
package/src/components/Tree.vmz
CHANGED
|
@@ -1,191 +1,214 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div data-vmz-ui="tree" class="vmz-ui-tree">
|
|
3
|
-
<p v-if="label" :id="labelId" class="vmz-ui-tree__label">
|
|
4
|
-
{{ label }}
|
|
5
|
-
</p>
|
|
6
|
-
<ul role="tree" :aria-labelledby="labelId" :aria-label="label" @click="onTreeClick" :onKeyDown="onTreeKeyDown" class="vmz-ui-tree__items">
|
|
7
|
-
<li v-for="item in items" :key="item.id" role="treeitem" :id="item.id" :data-vmz-tree-item="item.id" :data-depth="item.depth" :aria-selected="selected === item.id ? 'true' : 'false'" :aria-expanded="item.expandedAttr" :tabindex="selected === item.id ? 0 : -1" class="vmz-ui-tree__item" :style="item
|
|
8
|
-
<button v-if="item.expandable" type="button" :data-vmz-tree-twist="item.id" :aria-label="item.twistLabel" tabindex="-1" class="vmz-ui-tree__twist">
|
|
9
|
-
|
|
10
|
-
</button>
|
|
11
|
-
<span v-if="!item.expandable" aria-hidden="true" class="vmz-ui-tree__twist-spacer" />
|
|
12
|
-
<span :data-vmz-tree-title="item.id" class="vmz-ui-tree__title">
|
|
13
|
-
{{ item.title }}
|
|
14
|
-
</span>
|
|
15
|
-
</li>
|
|
16
|
-
</ul>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
<style>
|
|
20
|
-
.vmz-ui-tree {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
gap: 0.
|
|
24
|
-
max-width: 28rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.vmz-ui-tree__label {
|
|
28
|
-
margin: 0;
|
|
29
|
-
font-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div data-vmz-ui="tree" class="vmz-ui-tree">
|
|
3
|
+
<p v-if="label" :id="labelId" class="vmz-ui-tree__label">
|
|
4
|
+
{{ label }}
|
|
5
|
+
</p>
|
|
6
|
+
<ul role="tree" :aria-labelledby="labelId" :aria-label="label" @click="onTreeClick" :onKeyDown="onTreeKeyDown" class="vmz-ui-tree__items">
|
|
7
|
+
<li v-for="item in items" :key="item.id" role="treeitem" :id="item.id" :data-vmz-tree-item="item.id" :data-depth="item.depth" :aria-selected="selected === item.id ? 'true' : 'false'" :aria-expanded="item.expandedAttr" :tabindex="selected === item.id ? 0 : -1" class="vmz-ui-tree__item" :style="rowStyle(item)">
|
|
8
|
+
<button v-if="item.expandable" type="button" :data-vmz-tree-twist="item.id" :aria-label="item.twistLabel" tabindex="-1" class="vmz-ui-tree__twist">
|
|
9
|
+
<Icon :name="item.expanded ? 'action.chevron-down' : 'action.chevron-right'" size="sm" decorative />
|
|
10
|
+
</button>
|
|
11
|
+
<span v-if="!item.expandable" aria-hidden="true" class="vmz-ui-tree__twist-spacer" />
|
|
12
|
+
<span :data-vmz-tree-title="item.id" class="vmz-ui-tree__title">
|
|
13
|
+
{{ item.title }}
|
|
14
|
+
</span>
|
|
15
|
+
</li>
|
|
16
|
+
</ul>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<style>
|
|
20
|
+
.vmz-ui-tree {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--vmz-space-2, 0.5rem);
|
|
24
|
+
max-width: 28rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.vmz-ui-tree__label {
|
|
28
|
+
margin: 0;
|
|
29
|
+
font-size: 0.875rem;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
color: var(--vmz-text-ink);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vmz-ui-tree__items {
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: var(--vmz-space-1, 0.25rem);
|
|
37
|
+
list-style: none;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
border: 1px solid var(--vmz-line-default, var(--vmz-line-strong));
|
|
40
|
+
border-radius: var(--vmz-radius-lg, 8px);
|
|
41
|
+
background: var(--vmz-surface-paper);
|
|
42
|
+
color: var(--vmz-text-ink);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.vmz-ui-tree__item {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--vmz-space-1, 0.25rem);
|
|
49
|
+
min-height: var(--vmz-control-height, 2rem);
|
|
50
|
+
padding-inline-end: var(--vmz-space-3, 0.75rem);
|
|
51
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
52
|
+
font-size: 0.875rem;
|
|
53
|
+
line-height: 1.5;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
outline: none;
|
|
56
|
+
transition:
|
|
57
|
+
background-color var(--vmz-motion-control-duration, 120ms) var(--vmz-motion-control-easing, cubic-bezier(0.2, 0, 0, 1)),
|
|
58
|
+
color var(--vmz-motion-control-duration, 120ms) var(--vmz-motion-control-easing, cubic-bezier(0.2, 0, 0, 1));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.vmz-ui-tree__item:hover {
|
|
62
|
+
background: var(--vmz-surface-mist);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.vmz-ui-tree__item[aria-selected="true"] {
|
|
66
|
+
background: var(--vmz-action-primary-soft, var(--vmz-surface-mist));
|
|
67
|
+
color: var(--vmz-action-primary-active);
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.vmz-ui-tree__item[aria-selected="true"]:hover {
|
|
72
|
+
background: var(--vmz-action-primary-soft, var(--vmz-surface-mist));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.vmz-ui-tree__item:focus-visible {
|
|
76
|
+
box-shadow: inset 0 0 0 2px var(--vmz-focus-ring);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.vmz-ui-tree__twist {
|
|
80
|
+
flex: 0 0 auto;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 1.25rem;
|
|
85
|
+
height: 1.25rem;
|
|
86
|
+
padding: 0;
|
|
87
|
+
border: none;
|
|
88
|
+
border-radius: var(--vmz-radius-sm, 4px);
|
|
89
|
+
background: transparent;
|
|
90
|
+
color: var(--vmz-text-tertiary);
|
|
91
|
+
font: inherit;
|
|
92
|
+
line-height: 1;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
outline: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.vmz-ui-tree__twist:hover {
|
|
98
|
+
color: var(--vmz-text-ink);
|
|
99
|
+
background: var(--vmz-surface-mist);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.vmz-ui-tree__twist:focus-visible {
|
|
103
|
+
box-shadow: inset 0 0 0 2px var(--vmz-focus-ring);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.vmz-ui-tree__twist-spacer {
|
|
107
|
+
flex: 0 0 auto;
|
|
108
|
+
width: 1.25rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.vmz-ui-tree__title {
|
|
112
|
+
flex: 1 1 auto;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
116
|
+
<script client>
|
|
117
|
+
/**
|
|
118
|
+
* VMZ UI — Tree (ordinary hierarchy).
|
|
119
|
+
* Parent owns visible flat rows + selected + expand state.
|
|
120
|
+
* Not virtualized / not DataGrid tree mode.
|
|
121
|
+
*/
|
|
122
|
+
export default class Tree {
|
|
123
|
+
public label: string = "";
|
|
124
|
+
public labelId: string = "vmz-tree-label";
|
|
125
|
+
public selected: string = "";
|
|
126
|
+
/**
|
|
127
|
+
* @type {{
|
|
128
|
+
* id: string,
|
|
129
|
+
* title: string,
|
|
130
|
+
* depth: string,
|
|
131
|
+
* expandable: boolean,
|
|
132
|
+
* expanded: boolean,
|
|
133
|
+
* expandedAttr: string,
|
|
134
|
+
* twistLabel: string,
|
|
135
|
+
* padStyle: string
|
|
136
|
+
* }[]}
|
|
137
|
+
*/
|
|
138
|
+
public items: {
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
depth: string;
|
|
142
|
+
expandable: boolean;
|
|
143
|
+
expanded: boolean;
|
|
144
|
+
expandedAttr: string;
|
|
145
|
+
twistLabel: string;
|
|
146
|
+
padStyle: string;
|
|
147
|
+
}[] = [];
|
|
148
|
+
public onSelect: ((id: string) => void) | null = null;
|
|
149
|
+
public onToggle: ((id: string) => void) | null = null;
|
|
150
|
+
select(id) {
|
|
151
|
+
if (typeof this.onSelect === "function") this.onSelect(id);
|
|
152
|
+
}
|
|
153
|
+
toggle(id) {
|
|
154
|
+
if (typeof this.onToggle === "function") this.onToggle(id);
|
|
155
|
+
}
|
|
156
|
+
rowStyle(item) {
|
|
157
|
+
const provided = String(item?.padStyle || "").trim();
|
|
158
|
+
if (provided) return provided;
|
|
159
|
+
const depth = Math.max(0, Number(item?.depth) || 0);
|
|
160
|
+
return `padding-inline-start: ${0.75 + depth}rem`;
|
|
161
|
+
}
|
|
162
|
+
onTreeClick(ev) {
|
|
163
|
+
const t = ev && ev.target;
|
|
164
|
+
const twist =
|
|
165
|
+
t && typeof t.closest === "function" ? t.closest("[data-vmz-tree-twist]") : null;
|
|
166
|
+
if (twist) {
|
|
167
|
+
const id =
|
|
168
|
+
typeof twist.getAttribute === "function"
|
|
169
|
+
? twist.getAttribute("data-vmz-tree-twist")
|
|
170
|
+
: null;
|
|
171
|
+
if (id) {
|
|
172
|
+
ev.preventDefault();
|
|
173
|
+
ev.stopPropagation();
|
|
174
|
+
this.toggle(id);
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const el = t && typeof t.closest === "function" ? t.closest("[data-vmz-tree-item]") : null;
|
|
179
|
+
const id =
|
|
180
|
+
el && typeof el.getAttribute === "function"
|
|
181
|
+
? el.getAttribute("data-vmz-tree-item")
|
|
182
|
+
: null;
|
|
183
|
+
if (id) this.select(id);
|
|
184
|
+
}
|
|
185
|
+
onTreeKeyDown(ev) {
|
|
186
|
+
if (!ev || !this.items?.length) return;
|
|
187
|
+
const ids = this.items.map((it) => it.id);
|
|
188
|
+
const idx = Math.max(0, ids.indexOf(this.selected));
|
|
189
|
+
const cur = this.items[idx];
|
|
190
|
+
if (ev.key === "ArrowRight" && cur?.expandable && !cur.expanded) {
|
|
191
|
+
ev.preventDefault();
|
|
192
|
+
this.toggle(cur.id);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (ev.key === "ArrowLeft" && cur?.expandable && cur.expanded) {
|
|
196
|
+
ev.preventDefault();
|
|
197
|
+
this.toggle(cur.id);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
let next = idx;
|
|
201
|
+
if (ev.key === "ArrowDown") next = (idx + 1) % ids.length;
|
|
202
|
+
else if (ev.key === "ArrowUp") next = (idx - 1 + ids.length) % ids.length;
|
|
203
|
+
else if (ev.key === "Home") next = 0;
|
|
204
|
+
else if (ev.key === "End") next = ids.length - 1;
|
|
205
|
+
else if (ev.key === "Enter" || ev.key === " ") {
|
|
206
|
+
ev.preventDefault();
|
|
207
|
+
if (cur) this.select(cur.id);
|
|
208
|
+
return;
|
|
209
|
+
} else return;
|
|
210
|
+
ev.preventDefault();
|
|
211
|
+
this.select(ids[next]);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
</script>
|
|
@@ -7,25 +7,40 @@
|
|
|
7
7
|
.vmz-ui-typography {
|
|
8
8
|
margin: 0;
|
|
9
9
|
color: var(--vmz-text-ink);
|
|
10
|
-
font: inherit;
|
|
11
|
-
|
|
10
|
+
font-family: inherit;
|
|
11
|
+
font-size: var(--vmz-type-body);
|
|
12
|
+
font-weight: var(--vmz-type-weight-regular);
|
|
13
|
+
line-height: var(--vmz-type-line-height-body);
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
.vmz-ui-typography[data-variant="title"] {
|
|
14
|
-
font-
|
|
15
|
-
font-
|
|
16
|
-
|
|
17
|
-
line-height: 1.3;
|
|
17
|
+
font-size: var(--vmz-type-title);
|
|
18
|
+
font-weight: var(--vmz-type-weight-semibold);
|
|
19
|
+
line-height: var(--vmz-type-line-height-title);
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
.vmz-ui-typography[data-variant="subtitle"] {
|
|
23
|
+
font-size: var(--vmz-type-subtitle);
|
|
24
|
+
font-weight: var(--vmz-type-weight-medium);
|
|
25
|
+
line-height: var(--vmz-type-line-height-title);
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
.vmz-ui-typography[data-variant="secondary"] {
|
|
29
|
+
font-size: var(--vmz-type-body);
|
|
20
30
|
color: var(--vmz-text-steel);
|
|
31
|
+
line-height: var(--vmz-type-line-height-body);
|
|
21
32
|
}
|
|
33
|
+
|
|
22
34
|
.vmz-ui-typography[data-variant="caption"] {
|
|
23
35
|
color: var(--vmz-text-steel);
|
|
24
|
-
font-size:
|
|
36
|
+
font-size: var(--vmz-type-caption);
|
|
37
|
+
line-height: var(--vmz-type-line-height-caption);
|
|
25
38
|
}
|
|
39
|
+
|
|
26
40
|
.vmz-ui-typography[data-variant="code"] {
|
|
27
41
|
font-family: var(--vmz-font-mono, monospace);
|
|
28
|
-
font-size:
|
|
42
|
+
font-size: var(--vmz-type-code);
|
|
43
|
+
line-height: var(--vmz-type-line-height-code);
|
|
29
44
|
}
|
|
30
45
|
</style>
|
|
31
46
|
<script client>
|