@vmz/ui 0.0.2 → 0.0.4
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.
- package/README.md +25 -3
- package/conformance/fixtures/button-control-motion.json +22 -0
- package/conformance/fixtures/dialog-overlay-motion.json +27 -0
- package/conformance/fixtures/drawer-overlay-motion.json +27 -0
- package/conformance/pack.v0.json +7 -0
- package/contracts/token-requirements.v0.json +604 -2
- package/package.json +50 -2
- package/presets/web-surface.v0.json +34 -0
- package/src/components/Accordion.vmz +112 -0
- package/src/components/Alert.vmz +84 -0
- package/src/components/AppShell.vmz +97 -0
- package/src/components/Autocomplete.vmz +176 -0
- package/src/components/Badge.vmz +63 -0
- package/src/components/Breadcrumb.vmz +66 -0
- package/src/components/BulkActions.vmz +52 -0
- package/src/components/Button.vmz +71 -4
- package/src/components/Callout.vmz +80 -0
- package/src/components/Card.vmz +81 -0
- package/src/components/Checkbox.vmz +69 -0
- package/src/components/CodeBlock.vmz +67 -0
- package/src/components/ConsoleShell.vmz +127 -0
- package/src/components/DataTable.vmz +220 -0
- package/src/components/DatePicker.vmz +93 -0
- package/src/components/Dialog.vmz +442 -0
- package/src/components/Drawer.vmz +435 -0
- package/src/components/Empty.vmz +52 -0
- package/src/components/Field.vmz +88 -0
- package/src/components/FilterBar.vmz +27 -0
- package/src/components/Form.vmz +72 -0
- package/src/components/FormItem.vmz +78 -0
- package/src/components/Link.vmz +48 -0
- package/src/components/List.vmz +116 -0
- package/src/components/Menu.vmz +270 -0
- package/src/components/Notification.vmz +83 -0
- package/src/components/Pagination.vmz +81 -0
- package/src/components/Popover.vmz +253 -0
- package/src/components/Prose.vmz +83 -0
- package/src/components/QueryForm.vmz +39 -0
- package/src/components/RadioGroup.vmz +135 -0
- package/src/components/Result.vmz +84 -0
- package/src/components/Select.vmz +351 -0
- package/src/components/Skeleton.vmz +80 -0
- package/src/components/Spinner.vmz +45 -0
- package/src/components/Steps.vmz +107 -0
- package/src/components/Switch.vmz +109 -0
- package/src/components/Table.vmz +134 -0
- package/src/components/Tabs.vmz +132 -0
- package/src/components/TextArea.vmz +91 -0
- package/src/components/Timeline.vmz +67 -0
- package/src/components/Toc.vmz +77 -0
- package/src/components/Tooltip.vmz +68 -0
- package/src/components/Tree.vmz +215 -0
- package/src/components/Upload.vmz +102 -0
|
@@ -0,0 +1,220 @@
|
|
|
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 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
|
+
</template>
|
|
62
|
+
|
|
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
|
+
}
|
|
72
|
+
|
|
73
|
+
.vmz-ui-datatable {
|
|
74
|
+
width: 100%;
|
|
75
|
+
border-collapse: collapse;
|
|
76
|
+
font: inherit;
|
|
77
|
+
}
|
|
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
|
+
}
|
|
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
|
+
}
|
|
96
|
+
|
|
97
|
+
.vmz-ui-datatable__check {
|
|
98
|
+
width: 2.25rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.vmz-ui-datatable__box {
|
|
102
|
+
width: 1rem;
|
|
103
|
+
height: 1rem;
|
|
104
|
+
accent-color: var(--vmz-action-primary-background);
|
|
105
|
+
outline: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.vmz-ui-datatable__box:focus-visible {
|
|
109
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.vmz-ui-datatable tr[data-selected='true'] {
|
|
113
|
+
background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
|
|
114
|
+
}
|
|
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
|
+
}
|
|
126
|
+
|
|
127
|
+
.vmz-ui-datatable__sort:focus-visible {
|
|
128
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
129
|
+
}
|
|
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
|
+
}
|
|
142
|
+
|
|
143
|
+
.vmz-ui-datatable__row-action:focus-visible {
|
|
144
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.vmz-ui-datatable__row-action:disabled {
|
|
148
|
+
opacity: 0.55;
|
|
149
|
+
cursor: not-allowed;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
|
|
153
|
+
<script client>
|
|
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
|
+
*/
|
|
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
|
+
}
|
|
219
|
+
}
|
|
220
|
+
</script>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vmz-ui-date-picker" data-vmz-ui="date-picker" data-invalid={invalidAttr}>
|
|
3
|
+
<label if={label} class="vmz-ui-date-picker__label" for={controlId}>{label}</label>
|
|
4
|
+
<input
|
|
5
|
+
id={controlId}
|
|
6
|
+
class="vmz-ui-date-picker__control"
|
|
7
|
+
type="date"
|
|
8
|
+
value={value}
|
|
9
|
+
min={min}
|
|
10
|
+
max={max}
|
|
11
|
+
disabled={disabled}
|
|
12
|
+
aria-invalid={error ? 'true' : 'false'}
|
|
13
|
+
aria-describedby={describedBy}
|
|
14
|
+
onInput={onInput}
|
|
15
|
+
onChange={onChange}
|
|
16
|
+
/>
|
|
17
|
+
<p if={description} id={descriptionId} class="vmz-ui-date-picker__description">{description}</p>
|
|
18
|
+
<p if={error} id={errorId} class="vmz-ui-date-picker__error" role="alert">{error}</p>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.vmz-ui-date-picker {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 0.35rem;
|
|
27
|
+
max-width: 28rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vmz-ui-date-picker__label {
|
|
31
|
+
font: inherit;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.vmz-ui-date-picker__control {
|
|
36
|
+
font: inherit;
|
|
37
|
+
padding: var(--vmz-density-control-padding-y) var(--vmz-density-control-padding-x);
|
|
38
|
+
border: 1px solid var(--vmz-action-primary-background);
|
|
39
|
+
border-radius: 2px;
|
|
40
|
+
background: transparent;
|
|
41
|
+
color: inherit;
|
|
42
|
+
outline: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.vmz-ui-date-picker[data-invalid='true'] .vmz-ui-date-picker__control {
|
|
46
|
+
border-color: var(--vmz-status-danger-accent);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.vmz-ui-date-picker__control:focus-visible {
|
|
50
|
+
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vmz-ui-date-picker__control:disabled {
|
|
54
|
+
opacity: 0.55;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vmz-ui-date-picker__description {
|
|
59
|
+
margin: 0;
|
|
60
|
+
opacity: 0.75;
|
|
61
|
+
font-size: 0.9em;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.vmz-ui-date-picker__error {
|
|
65
|
+
margin: 0;
|
|
66
|
+
color: var(--vmz-status-danger-foreground);
|
|
67
|
+
font-size: 0.9em;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
70
|
+
|
|
71
|
+
<script client>
|
|
72
|
+
/**
|
|
73
|
+
* VMZ UI — DatePicker.
|
|
74
|
+
* WebSurface thin gate: native date input. Parent owns ISO value (YYYY-MM-DD).
|
|
75
|
+
* No calendar overlay runtime; richer picker stays out of @vmz/ui core until needed.
|
|
76
|
+
*/
|
|
77
|
+
export default class DatePicker {
|
|
78
|
+
public label: string = '';
|
|
79
|
+
public description: string = '';
|
|
80
|
+
public error: string = '';
|
|
81
|
+
public value: string = '';
|
|
82
|
+
public min: string = '';
|
|
83
|
+
public max: string = '';
|
|
84
|
+
public disabled: boolean = false;
|
|
85
|
+
public invalidAttr: string = 'false';
|
|
86
|
+
public controlId: string = 'vmz-date';
|
|
87
|
+
public descriptionId: string = 'vmz-date-desc';
|
|
88
|
+
public errorId: string = 'vmz-date-err';
|
|
89
|
+
public describedBy: string = '';
|
|
90
|
+
public onInput: ((e: Event) => void) | null = null;
|
|
91
|
+
public onChange: ((e: Event) => void) | null = null;
|
|
92
|
+
}
|
|
93
|
+
</script>
|