@vmz/ui 0.3.6 → 0.3.7

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 (42) hide show
  1. package/README.md +51 -51
  2. package/package.json +2 -2
  3. package/src/components/Accordion.vmz +94 -94
  4. package/src/components/AppShell.vmz +5 -2
  5. package/src/components/Autocomplete.vmz +154 -154
  6. package/src/components/Badge.vmz +70 -70
  7. package/src/components/Breadcrumb.vmz +72 -72
  8. package/src/components/BulkActions.vmz +51 -51
  9. package/src/components/Button.vmz +213 -211
  10. package/src/components/Callout.vmz +77 -77
  11. package/src/components/Card.vmz +120 -120
  12. package/src/components/Checkbox.vmz +55 -55
  13. package/src/components/CodeBlock.vmz +21 -6
  14. package/src/components/ConsoleShell.vmz +251 -251
  15. package/src/components/DataTable.vmz +194 -194
  16. package/src/components/DatePicker.vmz +674 -674
  17. package/src/components/Dialog.vmz +17 -1
  18. package/src/components/Drawer.vmz +427 -427
  19. package/src/components/Dropdown.vmz +51 -5
  20. package/src/components/Empty.vmz +54 -54
  21. package/src/components/Field.vmz +115 -115
  22. package/src/components/FormItem.vmz +79 -79
  23. package/src/components/Link.vmz +5 -1
  24. package/src/components/List.vmz +102 -102
  25. package/src/components/Menu.vmz +243 -243
  26. package/src/components/Pagination.vmz +71 -69
  27. package/src/components/Popover.vmz +223 -223
  28. package/src/components/Prose.vmz +81 -81
  29. package/src/components/RadioGroup.vmz +124 -124
  30. package/src/components/Segmented.vmz +51 -51
  31. package/src/components/Select.vmz +533 -533
  32. package/src/components/Steps.vmz +103 -103
  33. package/src/components/Switch.vmz +98 -98
  34. package/src/components/Table.vmz +165 -165
  35. package/src/components/Tabs.vmz +110 -110
  36. package/src/components/Tag.vmz +43 -43
  37. package/src/components/TextArea.vmz +118 -118
  38. package/src/components/Timeline.vmz +76 -76
  39. package/src/components/Toc.vmz +74 -74
  40. package/src/components/Tooltip.vmz +58 -58
  41. package/src/components/Tree.vmz +191 -191
  42. package/src/components/Upload.vmz +1299 -1289
@@ -1,194 +1,194 @@
1
- <template>
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>
35
- </div>
36
- </template>
37
- <style>
38
- .vmz-ui-datatable-wrap {
39
- max-height: 16rem;
40
- overflow: auto;
41
- border: 1px solid var(--vmz-line-default);
42
- border-radius: var(--vmz-radius-md, 6px);
43
- background: var(--vmz-surface-paper);
44
- color: var(--vmz-text-ink);
45
- }
46
-
47
- .vmz-ui-datatable {
48
- width: 100%;
49
- border-collapse: collapse;
50
- font: inherit;
51
- }
52
-
53
- .vmz-ui-datatable th,
54
- .vmz-ui-datatable td {
55
- padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
56
- text-align: left;
57
- border-bottom: 1px solid var(--vmz-line-default);
58
- vertical-align: middle;
59
- }
60
-
61
- .vmz-ui-datatable thead th {
62
- position: sticky;
63
- top: 0;
64
- z-index: 1;
65
- font-weight: 700;
66
- color: var(--vmz-action-primary-active);
67
- background: var(--vmz-surface-mist);
68
- box-shadow: 0 1px 0 var(--vmz-line-default);
69
- }
70
-
71
- .vmz-ui-datatable__check {
72
- width: 2.25rem;
73
- }
74
-
75
- .vmz-ui-datatable__box {
76
- width: 1rem;
77
- height: 1rem;
78
- accent-color: var(--vmz-action-primary-background);
79
- outline: none;
80
- }
81
-
82
- .vmz-ui-datatable__box:focus-visible {
83
- box-shadow: 0 0 0 3px var(--vmz-focus-ring);
84
- }
85
-
86
- .vmz-ui-datatable tr[data-selected="true"] {
87
- background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
88
- }
89
-
90
- .vmz-ui-datatable__sort {
91
- font: inherit;
92
- font-weight: 700;
93
- padding: 0;
94
- border: 0;
95
- background: transparent;
96
- color: inherit;
97
- cursor: pointer;
98
- outline: none;
99
- }
100
-
101
- .vmz-ui-datatable__sort:focus-visible {
102
- box-shadow: 0 0 0 3px var(--vmz-focus-ring);
103
- }
104
-
105
- .vmz-ui-datatable__row-action {
106
- font: inherit;
107
- font-weight: 600;
108
- padding: 0.25rem 0.5rem;
109
- border: 1px solid var(--vmz-line-default);
110
- border-radius: var(--vmz-radius-md, 6px);
111
- background: transparent;
112
- color: var(--vmz-action-primary-active);
113
- cursor: pointer;
114
- outline: none;
115
- }
116
-
117
- .vmz-ui-datatable__row-action:focus-visible {
118
- box-shadow: 0 0 0 3px var(--vmz-focus-ring);
119
- }
120
-
121
- .vmz-ui-datatable__row-action:disabled {
122
- opacity: 0.55;
123
- cursor: not-allowed;
124
- }
125
- </style>
126
- <script client>
127
- /**
128
- * VMZ UI — DataTable (ordinary Console table).
129
- * Parent owns rows + selection + sort. Sticky header.
130
- * Large-grid features live outside this package.
131
- */
132
- export default class DataTable {
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
- }
193
- }
194
- </script>
1
+ <template>
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>
35
+ </div>
36
+ </template>
37
+ <style>
38
+ .vmz-ui-datatable-wrap {
39
+ max-height: 16rem;
40
+ overflow: auto;
41
+ border: 1px solid var(--vmz-line-default);
42
+ border-radius: var(--vmz-radius-md, 6px);
43
+ background: var(--vmz-surface-paper);
44
+ color: var(--vmz-text-ink);
45
+ }
46
+
47
+ .vmz-ui-datatable {
48
+ width: 100%;
49
+ border-collapse: collapse;
50
+ font: inherit;
51
+ }
52
+
53
+ .vmz-ui-datatable th,
54
+ .vmz-ui-datatable td {
55
+ padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
56
+ text-align: left;
57
+ border-bottom: 1px solid var(--vmz-line-default);
58
+ vertical-align: middle;
59
+ }
60
+
61
+ .vmz-ui-datatable thead th {
62
+ position: sticky;
63
+ top: 0;
64
+ z-index: 1;
65
+ font-weight: 700;
66
+ color: var(--vmz-action-primary-active);
67
+ background: var(--vmz-surface-mist);
68
+ box-shadow: 0 1px 0 var(--vmz-line-default);
69
+ }
70
+
71
+ .vmz-ui-datatable__check {
72
+ width: 2.25rem;
73
+ }
74
+
75
+ .vmz-ui-datatable__box {
76
+ width: 1rem;
77
+ height: 1rem;
78
+ accent-color: var(--vmz-action-primary-background);
79
+ outline: none;
80
+ }
81
+
82
+ .vmz-ui-datatable__box:focus-visible {
83
+ box-shadow: 0 0 0 3px var(--vmz-focus-ring);
84
+ }
85
+
86
+ .vmz-ui-datatable tr[data-selected="true"] {
87
+ background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
88
+ }
89
+
90
+ .vmz-ui-datatable__sort {
91
+ font: inherit;
92
+ font-weight: 700;
93
+ padding: 0;
94
+ border: 0;
95
+ background: transparent;
96
+ color: inherit;
97
+ cursor: pointer;
98
+ outline: none;
99
+ }
100
+
101
+ .vmz-ui-datatable__sort:focus-visible {
102
+ box-shadow: 0 0 0 3px var(--vmz-focus-ring);
103
+ }
104
+
105
+ .vmz-ui-datatable__row-action {
106
+ font: inherit;
107
+ font-weight: 600;
108
+ padding: 0.25rem 0.5rem;
109
+ border: 1px solid var(--vmz-line-default);
110
+ border-radius: var(--vmz-radius-md, 6px);
111
+ background: transparent;
112
+ color: var(--vmz-action-primary-active);
113
+ cursor: pointer;
114
+ outline: none;
115
+ }
116
+
117
+ .vmz-ui-datatable__row-action:focus-visible {
118
+ box-shadow: 0 0 0 3px var(--vmz-focus-ring);
119
+ }
120
+
121
+ .vmz-ui-datatable__row-action:disabled {
122
+ opacity: 0.55;
123
+ cursor: not-allowed;
124
+ }
125
+ </style>
126
+ <script client>
127
+ /**
128
+ * VMZ UI — DataTable (ordinary Console table).
129
+ * Parent owns rows + selection + sort. Sticky header.
130
+ * Large-grid features live outside this package.
131
+ */
132
+ export default class DataTable {
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
+ }
193
+ }
194
+ </script>