@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.
Files changed (66) hide show
  1. package/README.md +8 -0
  2. package/contracts/token-requirements.v0.json +2 -6
  3. package/package.json +18 -2
  4. package/presets/web-surface.v0.json +24 -10
  5. package/src/components/Accordion.vmz +88 -89
  6. package/src/components/Alert.vmz +64 -63
  7. package/src/components/AppShell.vmz +64 -45
  8. package/src/components/Autocomplete.vmz +152 -151
  9. package/src/components/Avatar.vmz +16 -0
  10. package/src/components/Badge.vmz +46 -46
  11. package/src/components/Breadcrumb.vmz +52 -48
  12. package/src/components/BulkActions.vmz +37 -37
  13. package/src/components/Button.vmz +90 -75
  14. package/src/components/Callout.vmz +61 -61
  15. package/src/components/Card.vmz +58 -51
  16. package/src/components/Checkbox.vmz +56 -53
  17. package/src/components/CodeBlock.vmz +51 -51
  18. package/src/components/Collapse.vmz +20 -0
  19. package/src/components/ConsoleShell.vmz +134 -99
  20. package/src/components/Content.vmz +11 -0
  21. package/src/components/DataTable.vmz +197 -196
  22. package/src/components/DatePicker.vmz +613 -536
  23. package/src/components/Dialog.vmz +365 -384
  24. package/src/components/Divider.vmz +19 -0
  25. package/src/components/Drawer.vmz +361 -378
  26. package/src/components/Dropdown.vmz +22 -0
  27. package/src/components/Empty.vmz +36 -36
  28. package/src/components/Field.vmz +69 -40
  29. package/src/components/FilterBar.vmz +15 -15
  30. package/src/components/Flex.vmz +12 -0
  31. package/src/components/Footer.vmz +11 -0
  32. package/src/components/Form.vmz +56 -58
  33. package/src/components/FormItem.vmz +59 -59
  34. package/src/components/Grid.vmz +12 -0
  35. package/src/components/Header.vmz +11 -0
  36. package/src/components/Icon.vmz +86 -0
  37. package/src/components/Layout.vmz +11 -0
  38. package/src/components/Link.vmz +33 -33
  39. package/src/components/List.vmz +96 -96
  40. package/src/components/Menu.vmz +229 -240
  41. package/src/components/Notification.vmz +62 -62
  42. package/src/components/Pagination.vmz +63 -65
  43. package/src/components/Popover.vmz +202 -219
  44. package/src/components/Progress.vmz +18 -0
  45. package/src/components/Prose.vmz +61 -61
  46. package/src/components/QueryForm.vmz +26 -27
  47. package/src/components/RadioGroup.vmz +116 -113
  48. package/src/components/Result.vmz +63 -63
  49. package/src/components/Segmented.vmz +29 -0
  50. package/src/components/Select.vmz +462 -290
  51. package/src/components/Sider.vmz +6 -0
  52. package/src/components/Skeleton.vmz +58 -58
  53. package/src/components/Space.vmz +15 -0
  54. package/src/components/Spinner.vmz +29 -29
  55. package/src/components/Steps.vmz +86 -86
  56. package/src/components/Switch.vmz +86 -88
  57. package/src/components/Table.vmz +116 -114
  58. package/src/components/Tabs.vmz +113 -112
  59. package/src/components/Tag.vmz +8 -0
  60. package/src/components/TextArea.vmz +76 -49
  61. package/src/components/Timeline.vmz +55 -50
  62. package/src/components/Toc.vmz +64 -60
  63. package/src/components/Tooltip.vmz +51 -51
  64. package/src/components/Tree.vmz +184 -190
  65. package/src/components/Typography.vmz +9 -0
  66. package/src/components/Upload.vmz +1130 -1151
@@ -1,215 +1,209 @@
1
1
  <template>
2
2
  <div class="vmz-ui-tree" data-vmz-ui="tree">
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}
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
- <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"
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
- {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>
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
- display: flex;
46
- flex-direction: column;
47
- gap: 0.35rem;
48
- max-width: 28rem;
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
- margin: 0;
53
- font-weight: 600;
54
- color: var(--vmz-text-ink);
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
- margin: 0;
59
- padding: 0.25rem;
60
- list-style: none;
61
- border: 1px solid var(--vmz-line-default);
62
- border-radius: 2px;
63
- background: var(--vmz-surface-paper);
64
- color: var(--vmz-text-ink);
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
- 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: 2px;
73
- cursor: pointer;
74
- outline: none;
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
- background: var(--vmz-action-primary-background);
79
- color: var(--vmz-action-primary-foreground);
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
- background: color-mix(in srgb, var(--vmz-action-primary-background) 14%, transparent);
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
- background: var(--vmz-action-primary-hover);
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
- box-shadow: 0 0 0 2px var(--vmz-focus-ring);
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
- 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: 2px;
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
- }
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
- box-shadow: 0 0 0 2px var(--vmz-focus-ring);
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
- flex: 0 0 auto;
116
- width: 1.35rem;
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
- flex: 1 1 auto;
121
- }
119
+ .vmz-ui-tree__title {
120
+ flex: 1 1 auto;
121
+ }
122
122
  </style>
123
123
 
124
124
  <script client>
125
125
  /**
126
- * VMZ UI — Tree (ordinary hierarchy).
127
- * Parent owns visible flat rows + selected + expand state.
128
- * Not virtualized / not DataGrid tree mode.
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
- 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
-
159
- select(id) {
160
- if (typeof this.onSelect === 'function') this.onSelect(id);
161
- }
162
-
163
- toggle(id) {
164
- if (typeof this.onToggle === 'function') this.onToggle(id);
165
- }
166
-
167
- onTreeClick(ev) {
168
- const t = ev && ev.target;
169
- const twist =
170
- t && typeof t.closest === 'function' ? t.closest('[data-vmz-tree-twist]') : null;
171
- if (twist) {
172
- const id =
173
- typeof twist.getAttribute === 'function' ? twist.getAttribute('data-vmz-tree-twist') : null;
174
- if (id) {
175
- ev.preventDefault();
176
- ev.stopPropagation();
177
- this.toggle(id);
178
- }
179
- return;
180
- }
181
- const el = t && typeof t.closest === 'function' ? t.closest('[data-vmz-tree-item]') : null;
182
- const id = el && typeof el.getAttribute === 'function' ? el.getAttribute('data-vmz-tree-item') : null;
183
- if (id) this.select(id);
184
- }
185
-
186
- onTreeKeyDown(ev) {
187
- if (!ev || !this.items?.length) return;
188
- const ids = this.items.map((it) => it.id);
189
- const idx = Math.max(0, ids.indexOf(this.selected));
190
- const cur = this.items[idx];
191
- if (ev.key === 'ArrowRight' && cur?.expandable && !cur.expanded) {
192
- ev.preventDefault();
193
- this.toggle(cur.id);
194
- return;
195
- }
196
- if (ev.key === 'ArrowLeft' && cur?.expandable && cur.expanded) {
197
- ev.preventDefault();
198
- this.toggle(cur.id);
199
- return;
200
- }
201
- let next = idx;
202
- if (ev.key === 'ArrowDown') next = (idx + 1) % ids.length;
203
- else if (ev.key === 'ArrowUp') next = (idx - 1 + ids.length) % ids.length;
204
- else if (ev.key === 'Home') next = 0;
205
- else if (ev.key === 'End') next = ids.length - 1;
206
- else if (ev.key === 'Enter' || ev.key === ' ') {
207
- ev.preventDefault();
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>