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