@vmz/ui 0.1.0 → 0.1.2
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 +8 -0
- package/contracts/token-requirements.v0.json +2 -6
- package/package.json +18 -2
- package/presets/web-surface.v0.json +24 -10
- package/src/components/Accordion.vmz +88 -89
- package/src/components/Alert.vmz +64 -63
- package/src/components/AppShell.vmz +64 -45
- package/src/components/Autocomplete.vmz +152 -151
- package/src/components/Avatar.vmz +16 -0
- package/src/components/Badge.vmz +46 -46
- package/src/components/Breadcrumb.vmz +52 -48
- package/src/components/BulkActions.vmz +37 -37
- package/src/components/Button.vmz +90 -75
- package/src/components/Callout.vmz +61 -61
- package/src/components/Card.vmz +58 -51
- package/src/components/Checkbox.vmz +56 -53
- package/src/components/CodeBlock.vmz +51 -51
- package/src/components/Collapse.vmz +20 -0
- package/src/components/ConsoleShell.vmz +134 -99
- package/src/components/Content.vmz +11 -0
- package/src/components/DataTable.vmz +197 -196
- package/src/components/DatePicker.vmz +613 -536
- package/src/components/Dialog.vmz +365 -384
- package/src/components/Divider.vmz +19 -0
- package/src/components/Drawer.vmz +361 -378
- package/src/components/Dropdown.vmz +22 -0
- package/src/components/Empty.vmz +36 -36
- package/src/components/Field.vmz +69 -40
- package/src/components/FilterBar.vmz +15 -15
- package/src/components/Flex.vmz +12 -0
- package/src/components/Footer.vmz +11 -0
- package/src/components/Form.vmz +56 -58
- package/src/components/FormItem.vmz +59 -59
- package/src/components/Grid.vmz +12 -0
- package/src/components/Header.vmz +11 -0
- package/src/components/Icon.vmz +86 -0
- package/src/components/Layout.vmz +11 -0
- package/src/components/Link.vmz +33 -33
- package/src/components/List.vmz +96 -96
- package/src/components/Menu.vmz +229 -240
- package/src/components/Notification.vmz +62 -62
- package/src/components/Pagination.vmz +63 -65
- package/src/components/Popover.vmz +202 -219
- package/src/components/Progress.vmz +18 -0
- package/src/components/Prose.vmz +61 -61
- package/src/components/QueryForm.vmz +26 -27
- package/src/components/RadioGroup.vmz +116 -113
- package/src/components/Result.vmz +63 -63
- package/src/components/Segmented.vmz +29 -0
- package/src/components/Select.vmz +462 -290
- package/src/components/Sider.vmz +6 -0
- package/src/components/Skeleton.vmz +58 -58
- package/src/components/Space.vmz +15 -0
- package/src/components/Spinner.vmz +29 -29
- package/src/components/Steps.vmz +86 -86
- package/src/components/Switch.vmz +86 -88
- package/src/components/Table.vmz +116 -114
- package/src/components/Tabs.vmz +113 -112
- package/src/components/Tag.vmz +8 -0
- package/src/components/TextArea.vmz +76 -49
- package/src/components/Timeline.vmz +55 -50
- package/src/components/Toc.vmz +64 -60
- package/src/components/Tooltip.vmz +51 -51
- package/src/components/Tree.vmz +184 -190
- package/src/components/Typography.vmz +9 -0
- package/src/components/Upload.vmz +1130 -1151
package/src/components/Tree.vmz
CHANGED
|
@@ -1,215 +1,209 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="vmz-ui-tree" data-vmz-ui="tree">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
<li
|
|
13
|
-
each={items}
|
|
14
|
-
as="item"
|
|
15
|
-
key={item.id}
|
|
16
|
-
class="vmz-ui-tree__item"
|
|
17
|
-
role="treeitem"
|
|
18
|
-
id={item.id}
|
|
19
|
-
data-vmz-tree-item={item.id}
|
|
20
|
-
data-depth={item.depth}
|
|
21
|
-
aria-selected={selected === item.id ? 'true' : 'false'}
|
|
22
|
-
aria-expanded={item.expandedAttr}
|
|
23
|
-
tabindex={selected === item.id ? 0 : -1}
|
|
24
|
-
style={item.padStyle}
|
|
3
|
+
<p if={label} class="vmz-ui-tree__label" id={labelId}>{label}</p>
|
|
4
|
+
<ul
|
|
5
|
+
class="vmz-ui-tree__items"
|
|
6
|
+
role="tree"
|
|
7
|
+
aria-labelledby={labelId}
|
|
8
|
+
aria-label={label}
|
|
9
|
+
onClick={onTreeClick}
|
|
10
|
+
onKeyDown={onTreeKeyDown}
|
|
25
11
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
<li
|
|
13
|
+
each={items}
|
|
14
|
+
as="item"
|
|
15
|
+
key={item.id}
|
|
16
|
+
class="vmz-ui-tree__item"
|
|
17
|
+
role="treeitem"
|
|
18
|
+
id={item.id}
|
|
19
|
+
data-vmz-tree-item={item.id}
|
|
20
|
+
data-depth={item.depth}
|
|
21
|
+
aria-selected={selected === item.id ? 'true' : 'false'}
|
|
22
|
+
aria-expanded={item.expandedAttr}
|
|
23
|
+
tabindex={selected === item.id ? 0 : -1}
|
|
24
|
+
style={item.padStyle}
|
|
33
25
|
>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
<button
|
|
27
|
+
if={item.expandable}
|
|
28
|
+
type="button"
|
|
29
|
+
class="vmz-ui-tree__twist"
|
|
30
|
+
data-vmz-tree-twist={item.id}
|
|
31
|
+
aria-label={item.twistLabel}
|
|
32
|
+
tabindex="-1"
|
|
33
|
+
>
|
|
34
|
+
{item.expanded ? '−' : '+'}
|
|
35
|
+
</button>
|
|
36
|
+
<span if={!item.expandable} class="vmz-ui-tree__twist-spacer" aria-hidden="true"></span>
|
|
37
|
+
<span class="vmz-ui-tree__title" data-vmz-tree-title={item.id}>{item.title}</span>
|
|
38
|
+
</li>
|
|
39
|
+
</ul>
|
|
40
|
+
</div>
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<style>
|
|
44
|
-
.vmz-ui-tree {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
44
|
+
.vmz-ui-tree {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: 0.35rem;
|
|
48
|
+
max-width: 28rem;
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
.vmz-ui-tree__label {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
51
|
+
.vmz-ui-tree__label {
|
|
52
|
+
margin: 0;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
color: var(--vmz-text-ink);
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
.vmz-ui-tree__items {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
57
|
+
.vmz-ui-tree__items {
|
|
58
|
+
margin: 0;
|
|
59
|
+
padding: 0.25rem;
|
|
60
|
+
list-style: none;
|
|
61
|
+
border: 1px solid var(--vmz-line-default);
|
|
62
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
63
|
+
background: var(--vmz-surface-paper);
|
|
64
|
+
color: var(--vmz-text-ink);
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
.vmz-ui-tree__item {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
67
|
+
.vmz-ui-tree__item {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: 0.35rem;
|
|
71
|
+
padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
|
|
72
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
outline: none;
|
|
75
|
+
}
|
|
76
76
|
|
|
77
|
-
.vmz-ui-tree__item[aria-selected='true'] {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
77
|
+
.vmz-ui-tree__item[aria-selected='true'] {
|
|
78
|
+
background: var(--vmz-action-primary-background);
|
|
79
|
+
color: var(--vmz-action-primary-foreground);
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
.vmz-ui-tree__item:hover {
|
|
83
|
-
|
|
84
|
-
}
|
|
82
|
+
.vmz-ui-tree__item:hover {
|
|
83
|
+
background: color-mix(in srgb, var(--vmz-action-primary-background) 14%, transparent);
|
|
84
|
+
}
|
|
85
85
|
|
|
86
|
-
.vmz-ui-tree__item[aria-selected='true']:hover {
|
|
87
|
-
|
|
88
|
-
}
|
|
86
|
+
.vmz-ui-tree__item[aria-selected='true']:hover {
|
|
87
|
+
background: var(--vmz-action-primary-hover);
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
.vmz-ui-tree__item:focus-visible {
|
|
91
|
-
|
|
92
|
-
}
|
|
90
|
+
.vmz-ui-tree__item:focus-visible {
|
|
91
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
92
|
+
}
|
|
93
93
|
|
|
94
|
-
.vmz-ui-tree__twist {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
94
|
+
.vmz-ui-tree__twist {
|
|
95
|
+
flex: 0 0 auto;
|
|
96
|
+
width: 1.35rem;
|
|
97
|
+
height: 1.35rem;
|
|
98
|
+
padding: 0;
|
|
99
|
+
border: 1px solid var(--vmz-line-default);
|
|
100
|
+
border-radius: var(--vmz-radius-md, 6px);
|
|
101
|
+
background: var(--vmz-surface-mist);
|
|
102
|
+
color: inherit;
|
|
103
|
+
font: inherit;
|
|
104
|
+
font-weight: 700;
|
|
105
|
+
line-height: 1;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
outline: none;
|
|
108
|
+
}
|
|
109
109
|
|
|
110
|
-
.vmz-ui-tree__twist:focus-visible {
|
|
111
|
-
|
|
112
|
-
}
|
|
110
|
+
.vmz-ui-tree__twist:focus-visible {
|
|
111
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
112
|
+
}
|
|
113
113
|
|
|
114
|
-
.vmz-ui-tree__twist-spacer {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
114
|
+
.vmz-ui-tree__twist-spacer {
|
|
115
|
+
flex: 0 0 auto;
|
|
116
|
+
width: 1.35rem;
|
|
117
|
+
}
|
|
118
118
|
|
|
119
|
-
.vmz-ui-tree__title {
|
|
120
|
-
|
|
121
|
-
}
|
|
119
|
+
.vmz-ui-tree__title {
|
|
120
|
+
flex: 1 1 auto;
|
|
121
|
+
}
|
|
122
122
|
</style>
|
|
123
123
|
|
|
124
124
|
<script client>
|
|
125
125
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
* VMZ UI — Tree (ordinary hierarchy).
|
|
127
|
+
* Parent owns visible flat rows + selected + expand state.
|
|
128
|
+
* Not virtualized / not DataGrid tree mode.
|
|
129
|
+
*/
|
|
130
130
|
export default class Tree {
|
|
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
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (cur) this.select(cur.id);
|
|
209
|
-
return;
|
|
210
|
-
} else return;
|
|
211
|
-
ev.preventDefault();
|
|
212
|
-
this.select(ids[next]);
|
|
213
|
-
}
|
|
131
|
+
public label: string = "Tree";
|
|
132
|
+
public labelId: string = "vmz-tree-label";
|
|
133
|
+
public selected: string = "";
|
|
134
|
+
/**
|
|
135
|
+
* @type {{
|
|
136
|
+
* id: string,
|
|
137
|
+
* title: string,
|
|
138
|
+
* depth: string,
|
|
139
|
+
* expandable: boolean,
|
|
140
|
+
* expanded: boolean,
|
|
141
|
+
* expandedAttr: string,
|
|
142
|
+
* twistLabel: string,
|
|
143
|
+
* padStyle: string
|
|
144
|
+
* }[]}
|
|
145
|
+
*/
|
|
146
|
+
public items: {
|
|
147
|
+
id: string;
|
|
148
|
+
title: string;
|
|
149
|
+
depth: string;
|
|
150
|
+
expandable: boolean;
|
|
151
|
+
expanded: boolean;
|
|
152
|
+
expandedAttr: string;
|
|
153
|
+
twistLabel: string;
|
|
154
|
+
padStyle: string;
|
|
155
|
+
}[] = [];
|
|
156
|
+
public onSelect: ((id: string) => void) | null = null;
|
|
157
|
+
public onToggle: ((id: string) => void) | null = null;
|
|
158
|
+
select(id) {
|
|
159
|
+
if (typeof this.onSelect === "function") this.onSelect(id);
|
|
160
|
+
}
|
|
161
|
+
toggle(id) {
|
|
162
|
+
if (typeof this.onToggle === "function") this.onToggle(id);
|
|
163
|
+
}
|
|
164
|
+
onTreeClick(ev) {
|
|
165
|
+
const t = ev && ev.target;
|
|
166
|
+
const twist = t && typeof t.closest === "function" ? t.closest("[data-vmz-tree-twist]") : null;
|
|
167
|
+
if (twist) {
|
|
168
|
+
const id = typeof twist.getAttribute === "function" ? twist.getAttribute("data-vmz-tree-twist") : null;
|
|
169
|
+
if (id) {
|
|
170
|
+
ev.preventDefault();
|
|
171
|
+
ev.stopPropagation();
|
|
172
|
+
this.toggle(id);
|
|
173
|
+
}
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const el = t && typeof t.closest === "function" ? t.closest("[data-vmz-tree-item]") : null;
|
|
177
|
+
const id = el && typeof el.getAttribute === "function" ? el.getAttribute("data-vmz-tree-item") : null;
|
|
178
|
+
if (id) this.select(id);
|
|
179
|
+
}
|
|
180
|
+
onTreeKeyDown(ev) {
|
|
181
|
+
if (!ev || !this.items?.length) return;
|
|
182
|
+
const ids = this.items.map((it) => it.id);
|
|
183
|
+
const idx = Math.max(0, ids.indexOf(this.selected));
|
|
184
|
+
const cur = this.items[idx];
|
|
185
|
+
if (ev.key === "ArrowRight" && cur?.expandable && !cur.expanded) {
|
|
186
|
+
ev.preventDefault();
|
|
187
|
+
this.toggle(cur.id);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (ev.key === "ArrowLeft" && cur?.expandable && cur.expanded) {
|
|
191
|
+
ev.preventDefault();
|
|
192
|
+
this.toggle(cur.id);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
let next = idx;
|
|
196
|
+
if (ev.key === "ArrowDown") next = (idx + 1) % ids.length;
|
|
197
|
+
else if (ev.key === "ArrowUp") next = (idx - 1 + ids.length) % ids.length;
|
|
198
|
+
else if (ev.key === "Home") next = 0;
|
|
199
|
+
else if (ev.key === "End") next = ids.length - 1;
|
|
200
|
+
else if (ev.key === "Enter" || ev.key === " ") {
|
|
201
|
+
ev.preventDefault();
|
|
202
|
+
if (cur) this.select(cur.id);
|
|
203
|
+
return;
|
|
204
|
+
} else return;
|
|
205
|
+
ev.preventDefault();
|
|
206
|
+
this.select(ids[next]);
|
|
207
|
+
}
|
|
214
208
|
}
|
|
215
209
|
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template><div class="vmz-ui-typography" data-vmz-ui="typography" data-variant={variant}><slot /></div></template>
|
|
2
|
+
<style>
|
|
3
|
+
.vmz-ui-typography{margin:0;color:var(--vmz-text-ink);font:inherit;line-height:1.6}
|
|
4
|
+
.vmz-ui-typography[data-variant='title']{font-family:var(--vmz-font-display,var(--vmz-font-sans));font-size:1.5rem;font-weight:650;line-height:1.3}
|
|
5
|
+
.vmz-ui-typography[data-variant='secondary']{color:var(--vmz-text-steel)}
|
|
6
|
+
.vmz-ui-typography[data-variant='caption']{color:var(--vmz-text-steel);font-size:.875rem}
|
|
7
|
+
.vmz-ui-typography[data-variant='code']{font-family:var(--vmz-font-mono,monospace);font-size:.92em}
|
|
8
|
+
</style>
|
|
9
|
+
<script client>export default class Typography { public variant: string = 'body'; }</script>
|