@vmz/ui 0.2.3 → 0.2.5

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