@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,220 +1,221 @@
1
1
  <template>
2
2
  <div
3
- class="vmz-ui-datatable-wrap"
4
- data-vmz-ui="data-table"
5
- data-sort-key={sortKey}
6
- data-sort-dir={sortDir}
7
- data-selected-count={selectedCount}
8
- >
9
- <table class="vmz-ui-datatable">
10
- <thead onClick={onHeadClick}>
11
- <tr>
12
- <th scope="col" class="vmz-ui-datatable__check">
13
- <input
14
- type="checkbox"
15
- class="vmz-ui-datatable__box"
16
- data-vmz-select-all="true"
17
- aria-label={selectAllLabel}
18
- checked={allSelected}
19
- />
20
- </th>
21
- <th each={columns} as="col" key={col.id} scope="col" data-vmz-col={col.id}>
22
- <button type="button" class="vmz-ui-datatable__sort" data-vmz-sort={col.id}>
23
- {col.title}
24
- </button>
25
- </th>
26
- <th if={hasRowAction} scope="col">{actionTitle}</th>
27
- </tr>
28
- </thead>
29
- <tbody onClick={onBodyClick}>
30
- <tr
31
- each={rows}
32
- as="row"
33
- key={row.id}
34
- data-vmz-row={row.id}
35
- data-selected={row.selectedAttr}
36
- >
37
- <td class="vmz-ui-datatable__check">
38
- <input
39
- type="checkbox"
40
- class="vmz-ui-datatable__box"
41
- data-vmz-select={row.id}
42
- aria-label={row.selectLabel}
43
- checked={row.selected}
44
- />
45
- </td>
46
- <td each={row.cells} as="cell">{cell}</td>
47
- <td if={hasRowAction}>
48
- <button
49
- type="button"
50
- class="vmz-ui-datatable__row-action"
51
- data-vmz-row-action={row.id}
52
- disabled={rowActionDisabled}
53
- >
54
- {actionLabel}
55
- </button>
56
- </td>
57
- </tr>
58
- </tbody>
59
- </table>
60
- </div>
3
+ class="vmz-ui-datatable-wrap"
4
+ data-vmz-ui="data-table"
5
+ data-sort-key={sortKey}
6
+ data-sort-dir={sortDir}
7
+ data-selected-count={selectedCount}
8
+ >
9
+ <table class="vmz-ui-datatable">
10
+ <thead onClick={onHeadClick}>
11
+ <tr>
12
+ <th scope="col" class="vmz-ui-datatable__check">
13
+ <input
14
+ type="checkbox"
15
+ class="vmz-ui-datatable__box"
16
+ data-vmz-select-all="true"
17
+ aria-label={selectAllLabel}
18
+ checked={allSelected}
19
+ />
20
+ </th>
21
+ <th each={columns} as="col" key={col.id} scope="col" data-vmz-col={col.id}>
22
+ <button type="button" class="vmz-ui-datatable__sort" data-vmz-sort={col.id}>
23
+ {col.title}
24
+ </button>
25
+ </th>
26
+ <th if={hasRowAction} scope="col">{actionTitle}</th>
27
+ </tr>
28
+ </thead>
29
+ <tbody onClick={onBodyClick}>
30
+ <tr
31
+ each={rows}
32
+ as="row"
33
+ key={row.id}
34
+ data-vmz-row={row.id}
35
+ data-selected={row.selectedAttr}
36
+ >
37
+ <td class="vmz-ui-datatable__check">
38
+ <input
39
+ type="checkbox"
40
+ class="vmz-ui-datatable__box"
41
+ data-vmz-select={row.id}
42
+ aria-label={row.selectLabel}
43
+ checked={row.selected}
44
+ />
45
+ </td>
46
+ <td each={row.cells} as="cell">{cell}</td>
47
+ <td if={hasRowAction}>
48
+ <button
49
+ type="button"
50
+ class="vmz-ui-datatable__row-action"
51
+ data-vmz-row-action={row.id}
52
+ disabled={rowActionDisabled}
53
+ >
54
+ {actionLabel}
55
+ </button>
56
+ </td>
57
+ </tr>
58
+ </tbody>
59
+ </table>
60
+ </div>
61
61
  </template>
62
62
 
63
63
  <style>
64
- .vmz-ui-datatable-wrap {
65
- max-height: 16rem;
66
- overflow: auto;
67
- border: 1px solid var(--vmz-line-default);
68
- border-radius: 2px;
69
- background: var(--vmz-surface-paper);
70
- color: var(--vmz-text-ink);
71
- }
64
+ .vmz-ui-datatable-wrap {
65
+ max-height: 16rem;
66
+ overflow: auto;
67
+ border: 1px solid var(--vmz-line-default);
68
+ border-radius: var(--vmz-radius-md, 6px);
69
+ background: var(--vmz-surface-paper);
70
+ color: var(--vmz-text-ink);
71
+ }
72
72
 
73
- .vmz-ui-datatable {
74
- width: 100%;
75
- border-collapse: collapse;
76
- font: inherit;
77
- }
73
+ .vmz-ui-datatable {
74
+ width: 100%;
75
+ border-collapse: collapse;
76
+ font: inherit;
77
+ }
78
78
 
79
- .vmz-ui-datatable th,
80
- .vmz-ui-datatable td {
81
- padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
82
- text-align: left;
83
- border-bottom: 1px solid var(--vmz-line-default);
84
- vertical-align: middle;
85
- }
79
+ .vmz-ui-datatable th,
80
+ .vmz-ui-datatable td {
81
+ padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
82
+ text-align: left;
83
+ border-bottom: 1px solid var(--vmz-line-default);
84
+ vertical-align: middle;
85
+ }
86
86
 
87
- .vmz-ui-datatable thead th {
88
- position: sticky;
89
- top: 0;
90
- z-index: 1;
91
- font-weight: 700;
92
- color: var(--vmz-action-primary-active);
93
- background: var(--vmz-surface-mist);
94
- box-shadow: 0 1px 0 var(--vmz-line-default);
95
- }
87
+ .vmz-ui-datatable thead th {
88
+ position: sticky;
89
+ top: 0;
90
+ z-index: 1;
91
+ font-weight: 700;
92
+ color: var(--vmz-action-primary-active);
93
+ background: var(--vmz-surface-mist);
94
+ box-shadow: 0 1px 0 var(--vmz-line-default);
95
+ }
96
96
 
97
- .vmz-ui-datatable__check {
98
- width: 2.25rem;
99
- }
97
+ .vmz-ui-datatable__check {
98
+ width: 2.25rem;
99
+ }
100
100
 
101
- .vmz-ui-datatable__box {
102
- width: 1rem;
103
- height: 1rem;
104
- accent-color: var(--vmz-action-primary-background);
105
- outline: none;
106
- }
101
+ .vmz-ui-datatable__box {
102
+ width: 1rem;
103
+ height: 1rem;
104
+ accent-color: var(--vmz-action-primary-background);
105
+ outline: none;
106
+ }
107
107
 
108
- .vmz-ui-datatable__box:focus-visible {
109
- box-shadow: 0 0 0 2px var(--vmz-focus-ring);
110
- }
108
+ .vmz-ui-datatable__box:focus-visible {
109
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
110
+ }
111
111
 
112
- .vmz-ui-datatable tr[data-selected='true'] {
113
- background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
114
- }
112
+ .vmz-ui-datatable tr[data-selected='true'] {
113
+ background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
114
+ }
115
115
 
116
- .vmz-ui-datatable__sort {
117
- font: inherit;
118
- font-weight: 700;
119
- padding: 0;
120
- border: 0;
121
- background: transparent;
122
- color: inherit;
123
- cursor: pointer;
124
- outline: none;
125
- }
116
+ .vmz-ui-datatable__sort {
117
+ font: inherit;
118
+ font-weight: 700;
119
+ padding: 0;
120
+ border: 0;
121
+ background: transparent;
122
+ color: inherit;
123
+ cursor: pointer;
124
+ outline: none;
125
+ }
126
126
 
127
- .vmz-ui-datatable__sort:focus-visible {
128
- box-shadow: 0 0 0 2px var(--vmz-focus-ring);
129
- }
127
+ .vmz-ui-datatable__sort:focus-visible {
128
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
129
+ }
130
130
 
131
- .vmz-ui-datatable__row-action {
132
- font: inherit;
133
- font-weight: 600;
134
- padding: 0.3rem 0.55rem;
135
- border: 1px solid var(--vmz-action-primary-background);
136
- border-radius: 2px;
137
- background: transparent;
138
- color: var(--vmz-action-primary-active);
139
- cursor: pointer;
140
- outline: none;
141
- }
131
+ .vmz-ui-datatable__row-action {
132
+ font: inherit;
133
+ font-weight: 600;
134
+ padding: 0.3rem 0.55rem;
135
+ border: 1px solid var(--vmz-line-default);
136
+ border-radius: var(--vmz-radius-md, 6px);
137
+ background: transparent;
138
+ color: var(--vmz-action-primary-active);
139
+ cursor: pointer;
140
+ outline: none;
141
+ }
142
142
 
143
- .vmz-ui-datatable__row-action:focus-visible {
144
- box-shadow: 0 0 0 2px var(--vmz-focus-ring);
145
- }
143
+ .vmz-ui-datatable__row-action:focus-visible {
144
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
145
+ }
146
146
 
147
- .vmz-ui-datatable__row-action:disabled {
148
- opacity: 0.55;
149
- cursor: not-allowed;
150
- }
147
+ .vmz-ui-datatable__row-action:disabled {
148
+ opacity: 0.55;
149
+ cursor: not-allowed;
150
+ }
151
151
  </style>
152
152
 
153
153
  <script client>
154
154
  /**
155
- * VMZ UI — DataTable (ordinary Console table).
156
- * Parent owns rows + selection + sort. Sticky header.
157
- * Large-grid features live outside this package.
158
- */
155
+ * VMZ UI — DataTable (ordinary Console table).
156
+ * Parent owns rows + selection + sort. Sticky header.
157
+ * Large-grid features live outside this package.
158
+ */
159
159
  export default class DataTable {
160
- /** @type {{ id: string, title: string }[]} */
161
- public columns: { id: string; title: string }[] = [];
162
- /**
163
- * @type {{
164
- * id: string,
165
- * cells: string[],
166
- * selected: boolean,
167
- * selectedAttr: string,
168
- * selectLabel: string
169
- * }[]}
170
- */
171
- public rows: {
172
- id: string;
173
- cells: string[];
174
- selected: boolean;
175
- selectedAttr: string;
176
- selectLabel: string;
177
- }[] = [];
178
- public hasRowAction: boolean = false;
179
- public rowActionDisabled: boolean = false;
180
- public actionTitle: string = 'Action';
181
- public actionLabel: string = 'Open';
182
- public sortKey: string = '';
183
- public sortDir: string = 'asc';
184
- public selectedCount: string = '0';
185
- public allSelected: boolean = false;
186
- public selectAllLabel: string = 'Select all rows';
187
- public onRowAction: ((rowId: string) => void) | null = null;
188
- public onSort: ((columnId: string) => void) | null = null;
189
- public onToggleRow: ((rowId: string) => void) | null = null;
190
- public onToggleAll: (() => void) | null = null;
191
-
192
- onBodyClick(ev) {
193
- const t = ev && ev.target;
194
- if (!t || typeof t.closest !== 'function') return;
195
- const select = t.closest('[data-vmz-select]');
196
- if (select) {
197
- const id = select.getAttribute('data-vmz-select');
198
- if (id && typeof this.onToggleRow === 'function') this.onToggleRow(id);
199
- return;
200
- }
201
- const action = t.closest('[data-vmz-row-action]');
202
- if (!action || action.disabled) return;
203
- const id = action.getAttribute('data-vmz-row-action');
204
- if (id && typeof this.onRowAction === 'function') this.onRowAction(id);
205
- }
206
-
207
- onHeadClick(ev) {
208
- const t = ev && ev.target;
209
- if (!t || typeof t.closest !== 'function') return;
210
- if (t.closest('[data-vmz-select-all]')) {
211
- if (typeof this.onToggleAll === 'function') this.onToggleAll();
212
- return;
213
- }
214
- const sort = t.closest('[data-vmz-sort]');
215
- if (!sort) return;
216
- const id = sort.getAttribute('data-vmz-sort');
217
- if (id && typeof this.onSort === 'function') this.onSort(id);
218
- }
160
+ /** @type {{ id: string, title: string }[]} */
161
+ public columns: {
162
+ id: string;
163
+ title: string;
164
+ }[] = [];
165
+ /**
166
+ * @type {{
167
+ * id: string,
168
+ * cells: string[],
169
+ * selected: boolean,
170
+ * selectedAttr: string,
171
+ * selectLabel: string
172
+ * }[]}
173
+ */
174
+ public rows: {
175
+ id: string;
176
+ cells: string[];
177
+ selected: boolean;
178
+ selectedAttr: string;
179
+ selectLabel: string;
180
+ }[] = [];
181
+ public hasRowAction: boolean = false;
182
+ public rowActionDisabled: boolean = false;
183
+ public actionTitle: string = "Action";
184
+ public actionLabel: string = "Open";
185
+ public sortKey: string = "";
186
+ public sortDir: string = "asc";
187
+ public selectedCount: string = "0";
188
+ public allSelected: boolean = false;
189
+ public selectAllLabel: string = "Select all rows";
190
+ public onRowAction: ((rowId: string) => void) | null = null;
191
+ public onSort: ((columnId: string) => void) | null = null;
192
+ public onToggleRow: ((rowId: string) => void) | null = null;
193
+ public onToggleAll: (() => void) | null = null;
194
+ onBodyClick(ev) {
195
+ const t = ev && ev.target;
196
+ if (!t || typeof t.closest !== "function") return;
197
+ const select = t.closest("[data-vmz-select]");
198
+ if (select) {
199
+ const id = select.getAttribute("data-vmz-select");
200
+ if (id && typeof this.onToggleRow === "function") this.onToggleRow(id);
201
+ return;
202
+ }
203
+ const action = t.closest("[data-vmz-row-action]");
204
+ if (!action || action.disabled) return;
205
+ const id = action.getAttribute("data-vmz-row-action");
206
+ if (id && typeof this.onRowAction === "function") this.onRowAction(id);
207
+ }
208
+ onHeadClick(ev) {
209
+ const t = ev && ev.target;
210
+ if (!t || typeof t.closest !== "function") return;
211
+ if (t.closest("[data-vmz-select-all]")) {
212
+ if (typeof this.onToggleAll === "function") this.onToggleAll();
213
+ return;
214
+ }
215
+ const sort = t.closest("[data-vmz-sort]");
216
+ if (!sort) return;
217
+ const id = sort.getAttribute("data-vmz-sort");
218
+ if (id && typeof this.onSort === "function") this.onSort(id);
219
+ }
219
220
  }
220
221
  </script>