@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.
Files changed (53) hide show
  1. package/README.md +25 -3
  2. package/conformance/fixtures/button-control-motion.json +22 -0
  3. package/conformance/fixtures/dialog-overlay-motion.json +27 -0
  4. package/conformance/fixtures/drawer-overlay-motion.json +27 -0
  5. package/conformance/pack.v0.json +7 -0
  6. package/contracts/token-requirements.v0.json +604 -2
  7. package/package.json +50 -2
  8. package/presets/web-surface.v0.json +34 -0
  9. package/src/components/Accordion.vmz +112 -0
  10. package/src/components/Alert.vmz +84 -0
  11. package/src/components/AppShell.vmz +97 -0
  12. package/src/components/Autocomplete.vmz +176 -0
  13. package/src/components/Badge.vmz +63 -0
  14. package/src/components/Breadcrumb.vmz +66 -0
  15. package/src/components/BulkActions.vmz +52 -0
  16. package/src/components/Button.vmz +71 -4
  17. package/src/components/Callout.vmz +80 -0
  18. package/src/components/Card.vmz +81 -0
  19. package/src/components/Checkbox.vmz +69 -0
  20. package/src/components/CodeBlock.vmz +67 -0
  21. package/src/components/ConsoleShell.vmz +127 -0
  22. package/src/components/DataTable.vmz +220 -0
  23. package/src/components/DatePicker.vmz +93 -0
  24. package/src/components/Dialog.vmz +442 -0
  25. package/src/components/Drawer.vmz +435 -0
  26. package/src/components/Empty.vmz +52 -0
  27. package/src/components/Field.vmz +88 -0
  28. package/src/components/FilterBar.vmz +27 -0
  29. package/src/components/Form.vmz +72 -0
  30. package/src/components/FormItem.vmz +78 -0
  31. package/src/components/Link.vmz +48 -0
  32. package/src/components/List.vmz +116 -0
  33. package/src/components/Menu.vmz +270 -0
  34. package/src/components/Notification.vmz +83 -0
  35. package/src/components/Pagination.vmz +81 -0
  36. package/src/components/Popover.vmz +253 -0
  37. package/src/components/Prose.vmz +83 -0
  38. package/src/components/QueryForm.vmz +39 -0
  39. package/src/components/RadioGroup.vmz +135 -0
  40. package/src/components/Result.vmz +84 -0
  41. package/src/components/Select.vmz +351 -0
  42. package/src/components/Skeleton.vmz +80 -0
  43. package/src/components/Spinner.vmz +45 -0
  44. package/src/components/Steps.vmz +107 -0
  45. package/src/components/Switch.vmz +109 -0
  46. package/src/components/Table.vmz +134 -0
  47. package/src/components/Tabs.vmz +132 -0
  48. package/src/components/TextArea.vmz +91 -0
  49. package/src/components/Timeline.vmz +67 -0
  50. package/src/components/Toc.vmz +77 -0
  51. package/src/components/Tooltip.vmz +68 -0
  52. package/src/components/Tree.vmz +215 -0
  53. package/src/components/Upload.vmz +102 -0
@@ -0,0 +1,253 @@
1
+ <template>
2
+ <div
3
+ class="vmz-ui-popover-root"
4
+ data-vmz-ui="popover"
5
+ data-vmz-overlay-open={open}
6
+ >
7
+ <div
8
+ if={open}
9
+ class="vmz-ui-popover"
10
+ data-vmz-overlay="popover"
11
+ data-vmz-overlay-owner="popover"
12
+ data-vmz-overlay-stack={stackLevel}
13
+ >
14
+ <button
15
+ type="button"
16
+ class="vmz-ui-popover__backdrop"
17
+ data-vmz-overlay-layer="backdrop"
18
+ aria-label="Dismiss popover"
19
+ onClick={dismiss}
20
+ ></button>
21
+ <div
22
+ class="vmz-ui-popover__panel"
23
+ role="dialog"
24
+ aria-modal="false"
25
+ aria-labelledby={titleId}
26
+ tabindex="-1"
27
+ data-vmz-overlay-layer="panel"
28
+ data-vmz-focus="enter"
29
+ onKeyDown={onPanelKeyDown}
30
+ >
31
+ <h2 id={titleId} class="vmz-ui-popover__title">{title}</h2>
32
+ <div class="vmz-ui-popover__body">
33
+ <slot />
34
+ </div>
35
+ <div class="vmz-ui-popover__actions">
36
+ <button type="button" class="vmz-ui-popover__close" data-vmz-focus="close" onClick={dismiss}>
37
+ Close
38
+ </button>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <style>
46
+ .vmz-ui-popover-root {
47
+ display: block;
48
+ }
49
+
50
+ .vmz-ui-popover {
51
+ position: fixed;
52
+ inset: 0;
53
+ z-index: 35;
54
+ pointer-events: none;
55
+ }
56
+
57
+ .vmz-ui-popover[data-vmz-overlay-stack='1'] {
58
+ z-index: 50;
59
+ }
60
+
61
+ .vmz-ui-popover[data-vmz-overlay-stack='2'] {
62
+ z-index: 60;
63
+ }
64
+
65
+ .vmz-ui-popover[data-vmz-overlay-stack='3'] {
66
+ z-index: 70;
67
+ }
68
+
69
+ .vmz-ui-popover__backdrop {
70
+ position: absolute;
71
+ inset: 0;
72
+ border: 0;
73
+ padding: 0;
74
+ margin: 0;
75
+ cursor: default;
76
+ background: transparent;
77
+ pointer-events: auto;
78
+ }
79
+
80
+ .vmz-ui-popover__panel {
81
+ position: absolute;
82
+ z-index: 1;
83
+ top: 30%;
84
+ left: 50%;
85
+ transform: translateX(-50%);
86
+ box-sizing: border-box;
87
+ width: min(20rem, calc(100vw - 2rem));
88
+ min-height: 8rem;
89
+ padding: 0.85rem 1rem 1rem;
90
+ border: 1px solid var(--vmz-action-primary-background);
91
+ border-radius: 2px;
92
+ background: var(--vmz-action-primary-foreground);
93
+ color: var(--vmz-action-primary-active);
94
+ outline: none;
95
+ pointer-events: auto;
96
+ }
97
+
98
+ .vmz-ui-popover__panel:focus-visible {
99
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
100
+ }
101
+
102
+ .vmz-ui-popover__title {
103
+ margin: 0 0 0.5rem;
104
+ font-size: 1rem;
105
+ }
106
+
107
+ .vmz-ui-popover__body {
108
+ margin-bottom: 0.75rem;
109
+ }
110
+
111
+ .vmz-ui-popover__close {
112
+ font: inherit;
113
+ font-weight: 600;
114
+ padding: 0.4rem 0.7rem;
115
+ border: 1px solid transparent;
116
+ border-radius: 2px;
117
+ cursor: pointer;
118
+ background: var(--vmz-action-primary-background);
119
+ color: var(--vmz-action-primary-foreground);
120
+ }
121
+
122
+ .vmz-ui-popover__close:focus-visible {
123
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
124
+ }
125
+ </style>
126
+
127
+ <script client>
128
+ /**
129
+ * VMZ UI — Popover (UI2).
130
+ * Non-modal disclosure: Escape + outside dismiss + focus enter/restore.
131
+ * Parent owns live `open`. Fixed min size for layout stability.
132
+ * `stackLevel` raises z-index; Escape dismisses only the topmost stacked overlay.
133
+ */
134
+ export default class Popover {
135
+ public open: boolean = false;
136
+ public title: string = 'Popover';
137
+ public titleId: string = 'vmz-popover-title';
138
+ public stackLevel: string = '0';
139
+ public onClose: (() => void) | null = null;
140
+
141
+ _restoreFocus = null;
142
+ _panel = null;
143
+ _docKeyHandler = null;
144
+ _observer = null;
145
+
146
+ async onMount() {
147
+ if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return;
148
+ const root = this.__vmzDomRoot;
149
+ if (!root || typeof root.querySelector !== 'function') return;
150
+ this._observer = new MutationObserver(() => this._syncFromDom());
151
+ this._observer.observe(root, { childList: true, subtree: true });
152
+ this._syncFromDom();
153
+ }
154
+
155
+ onDestroy() {
156
+ if (this._observer) {
157
+ this._observer.disconnect();
158
+ this._observer = null;
159
+ }
160
+ this._teardownDocKey();
161
+ this._panel = null;
162
+ this._restoreFocus = null;
163
+ }
164
+
165
+ dismiss() {
166
+ if (typeof this.onClose === 'function') this.onClose();
167
+ }
168
+
169
+ _stackValue() {
170
+ const n = Number(this.stackLevel);
171
+ return Number.isFinite(n) ? n : 0;
172
+ }
173
+
174
+ _isTopmostStack() {
175
+ if (typeof document === 'undefined') return true;
176
+ const root = this.__vmzDomRoot;
177
+ const mine =
178
+ root && typeof root.querySelector === 'function'
179
+ ? root.querySelector('[data-vmz-overlay][data-vmz-overlay-stack]')
180
+ : null;
181
+ const myStack = Number(mine?.getAttribute('data-vmz-overlay-stack') || this.stackLevel || '0');
182
+ const open = document.querySelectorAll('[data-vmz-overlay][data-vmz-overlay-stack]');
183
+ let max = -Infinity;
184
+ for (const el of open) {
185
+ const n = Number(el.getAttribute('data-vmz-overlay-stack') || '0');
186
+ if (Number.isFinite(n) && n > max) max = n;
187
+ }
188
+ if (!Number.isFinite(max)) return true;
189
+ return (Number.isFinite(myStack) ? myStack : 0) >= max;
190
+ }
191
+
192
+ onPanelKeyDown(ev) {
193
+ if (!ev || ev.key !== 'Escape') return;
194
+ if (!this._isTopmostStack()) return;
195
+ ev.preventDefault();
196
+ ev.stopPropagation();
197
+ this.dismiss();
198
+ }
199
+
200
+ _syncFromDom() {
201
+ const root = this.__vmzDomRoot;
202
+ const panel =
203
+ root && typeof root.querySelector === 'function'
204
+ ? root.querySelector('[data-vmz-overlay="popover"] [data-vmz-focus="enter"]')
205
+ : null;
206
+ if (panel && !this._panel) this._enterFocus(panel);
207
+ else if (!panel && this._panel) this._exitFocus();
208
+ }
209
+
210
+ _enterFocus(panel) {
211
+ if (typeof document === 'undefined') return;
212
+ const active = document.activeElement;
213
+ if (!this._restoreFocus) {
214
+ const root = this.__vmzDomRoot;
215
+ const outside =
216
+ active instanceof HTMLElement &&
217
+ active !== document.body &&
218
+ !(root && typeof root.contains === 'function' && root.contains(active));
219
+ if (outside) this._restoreFocus = active;
220
+ }
221
+ this._panel = panel instanceof HTMLElement ? panel : null;
222
+ if (this._panel && typeof this._panel.focus === 'function') this._panel.focus();
223
+ if (!this._docKeyHandler) {
224
+ this._docKeyHandler = (ev) => {
225
+ if (ev.key !== 'Escape') return;
226
+ if (ev.defaultPrevented) return;
227
+ if (!this._isTopmostStack()) return;
228
+ ev.preventDefault();
229
+ ev.stopPropagation();
230
+ this.dismiss();
231
+ };
232
+ document.addEventListener('keydown', this._docKeyHandler);
233
+ }
234
+ }
235
+
236
+ _exitFocus() {
237
+ this._teardownDocKey();
238
+ this._panel = null;
239
+ const restore = this._restoreFocus;
240
+ this._restoreFocus = null;
241
+ if (restore && typeof restore.focus === 'function' && document.contains(restore)) {
242
+ restore.focus();
243
+ }
244
+ }
245
+
246
+ _teardownDocKey() {
247
+ if (typeof document !== 'undefined' && this._docKeyHandler) {
248
+ document.removeEventListener('keydown', this._docKeyHandler);
249
+ }
250
+ this._docKeyHandler = null;
251
+ }
252
+ }
253
+ </script>
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <article class="vmz-ui-prose" data-vmz-ui="prose">
3
+ <slot />
4
+ </article>
5
+ </template>
6
+
7
+ <style>
8
+ .vmz-ui-prose {
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: 1rem;
12
+ max-width: 42rem;
13
+ color: var(--vmz-text-ink);
14
+ font-family: var(--vmz-font-sans);
15
+ line-height: 1.65;
16
+ }
17
+
18
+ .vmz-ui-prose :where(h1, h2, h3) {
19
+ margin: 0;
20
+ font-family: var(--vmz-font-display);
21
+ font-weight: 700;
22
+ letter-spacing: -0.02em;
23
+ line-height: 1.2;
24
+ color: var(--vmz-text-ink);
25
+ scroll-margin-top: 1.25rem;
26
+ }
27
+
28
+ .vmz-ui-prose :where(h1) {
29
+ font-size: clamp(1.85rem, 4vw, 2.35rem);
30
+ }
31
+
32
+ .vmz-ui-prose :where(h2) {
33
+ font-size: 1.35rem;
34
+ margin-top: 0.5rem;
35
+ }
36
+
37
+ .vmz-ui-prose :where(h3) {
38
+ font-size: 1.1rem;
39
+ }
40
+
41
+ .vmz-ui-prose :where(p) {
42
+ margin: 0;
43
+ color: var(--vmz-text-ink);
44
+ }
45
+
46
+ .vmz-ui-prose :where(p.lead) {
47
+ font-size: 1.05rem;
48
+ color: var(--vmz-text-steel);
49
+ }
50
+
51
+ .vmz-ui-prose :where(ul, ol) {
52
+ margin: 0;
53
+ padding-left: 1.25rem;
54
+ color: var(--vmz-text-ink);
55
+ }
56
+
57
+ .vmz-ui-prose :where(li + li) {
58
+ margin-top: 0.35rem;
59
+ }
60
+
61
+ .vmz-ui-prose :where(a) {
62
+ color: var(--vmz-action-primary-background);
63
+ text-underline-offset: 0.15em;
64
+ }
65
+
66
+ .vmz-ui-prose :where(a:hover) {
67
+ color: var(--vmz-action-primary-hover);
68
+ }
69
+
70
+ .vmz-ui-prose :where(hr) {
71
+ border: 0;
72
+ border-top: 1px solid var(--vmz-line-default);
73
+ margin: 0.5rem 0;
74
+ }
75
+ </style>
76
+
77
+ <script client>
78
+ /**
79
+ * VMZ UI — Prose (Document/Product composition).
80
+ * Typography measure for long-form content; values from Style Theme only.
81
+ */
82
+ export default class Prose {}
83
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <form
3
+ class="vmz-ui-query-form"
4
+ data-vmz-ui="query-form"
5
+ data-dense="true"
6
+ aria-label={label}
7
+ onSubmit={onSubmitGuard}
8
+ >
9
+ <slot />
10
+ </form>
11
+ </template>
12
+
13
+ <style>
14
+ .vmz-ui-query-form {
15
+ display: flex;
16
+ flex-wrap: wrap;
17
+ align-items: flex-end;
18
+ gap: var(--vmz-density-compact-gap);
19
+ padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
20
+ border: 1px solid var(--vmz-action-primary-background);
21
+ border-radius: 2px;
22
+ }
23
+ </style>
24
+
25
+ <script client>
26
+ /**
27
+ * VMZ UI — QueryForm (UI5 Console Surface).
28
+ * Dense multi-field query landmark; spacing from density.compact.* tokens.
29
+ */
30
+ export default class QueryForm {
31
+ public label: string = 'Query';
32
+ public onSubmit: (() => void) | null = null;
33
+
34
+ onSubmitGuard(ev) {
35
+ if (ev && typeof ev.preventDefault === 'function') ev.preventDefault();
36
+ if (typeof this.onSubmit === 'function') this.onSubmit();
37
+ }
38
+ }
39
+ </script>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <fieldset
3
+ class="vmz-ui-radio-group"
4
+ data-vmz-ui="radio-group"
5
+ data-invalid={invalidAttr}
6
+ aria-describedby={describedBy}
7
+ disabled={disabled}
8
+ >
9
+ <legend class="vmz-ui-radio-group__legend">{label}</legend>
10
+ <div class="vmz-ui-radio-group__list" role="radiogroup" aria-label={label} onClick={onListClick}>
11
+ <label
12
+ each={items}
13
+ as="item"
14
+ key={item.value}
15
+ class="vmz-ui-radio-group__option"
16
+ for={item.id}
17
+ >
18
+ <input
19
+ id={item.id}
20
+ class="vmz-ui-radio-group__input"
21
+ type="radio"
22
+ name={name}
23
+ value={item.value}
24
+ checked={value === item.value}
25
+ disabled={disabled}
26
+ data-vmz-radio={item.value}
27
+ />
28
+ <span class="vmz-ui-radio-group__text">{item.label}</span>
29
+ </label>
30
+ </div>
31
+ <p if={description} id={descriptionId} class="vmz-ui-radio-group__description">{description}</p>
32
+ <p if={error} id={errorId} class="vmz-ui-radio-group__error" role="alert">{error}</p>
33
+ </fieldset>
34
+ </template>
35
+
36
+ <style>
37
+ .vmz-ui-radio-group {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 0.45rem;
41
+ max-width: 28rem;
42
+ margin: 0;
43
+ padding: 0;
44
+ border: 0;
45
+ min-width: 0;
46
+ }
47
+
48
+ .vmz-ui-radio-group__legend {
49
+ padding: 0;
50
+ font: inherit;
51
+ font-weight: 600;
52
+ }
53
+
54
+ .vmz-ui-radio-group__list {
55
+ display: flex;
56
+ flex-direction: column;
57
+ gap: 0.35rem;
58
+ }
59
+
60
+ .vmz-ui-radio-group__option {
61
+ display: inline-flex;
62
+ align-items: center;
63
+ gap: 0.45rem;
64
+ font: inherit;
65
+ cursor: pointer;
66
+ }
67
+
68
+ .vmz-ui-radio-group__input {
69
+ width: 1rem;
70
+ height: 1rem;
71
+ accent-color: var(--vmz-action-primary-background);
72
+ outline: none;
73
+ }
74
+
75
+ .vmz-ui-radio-group__input:focus-visible {
76
+ box-shadow: 0 0 0 2px var(--vmz-focus-ring);
77
+ }
78
+
79
+ .vmz-ui-radio-group__input:disabled {
80
+ opacity: 0.55;
81
+ cursor: not-allowed;
82
+ }
83
+
84
+ .vmz-ui-radio-group__text {
85
+ font-weight: 600;
86
+ }
87
+
88
+ .vmz-ui-radio-group__description {
89
+ margin: 0;
90
+ opacity: 0.75;
91
+ font-size: 0.9em;
92
+ }
93
+
94
+ .vmz-ui-radio-group__error {
95
+ margin: 0;
96
+ color: var(--vmz-status-danger-foreground);
97
+ font-size: 0.9em;
98
+ }
99
+
100
+ .vmz-ui-radio-group[data-invalid='true'] .vmz-ui-radio-group__legend {
101
+ color: var(--vmz-status-danger-foreground);
102
+ }
103
+ </style>
104
+
105
+ <script client>
106
+ /**
107
+ * VMZ UI — RadioGroup.
108
+ * Parent owns selected value; click path updates via onChange (live prop remains authoritative).
109
+ */
110
+ export default class RadioGroup {
111
+ public label: string = '';
112
+ public description: string = '';
113
+ public error: string = '';
114
+ public name: string = 'vmz-radio';
115
+ public value: string = '';
116
+ public items: Array<{ id: string; value: string; label: string }> = [];
117
+ public disabled: boolean = false;
118
+ public invalidAttr: string = 'false';
119
+ public descriptionId: string = 'vmz-radio-desc';
120
+ public errorId: string = 'vmz-radio-err';
121
+ public describedBy: string = '';
122
+ public onChange: ((value: string) => void) | null = null;
123
+
124
+ onListClick(ev) {
125
+ if (this.disabled) return;
126
+ const t = ev && ev.target;
127
+ if (!t || typeof t.closest !== 'function') return;
128
+ const input = t.closest('input[data-vmz-radio]');
129
+ if (!input) return;
130
+ const next = input.getAttribute('data-vmz-radio') || input.value || '';
131
+ if (!next || next === this.value) return;
132
+ if (typeof this.onChange === 'function') this.onChange(next);
133
+ }
134
+ }
135
+ </script>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <section
3
+ class="vmz-ui-result"
4
+ data-vmz-ui="result"
5
+ data-status={status}
6
+ >
7
+ <p class="vmz-ui-result__title">{title}</p>
8
+ <p if={description} class="vmz-ui-result__description">{description}</p>
9
+ <div class="vmz-ui-result__actions">
10
+ <slot />
11
+ </div>
12
+ </section>
13
+ </template>
14
+
15
+ <style>
16
+ .vmz-ui-result {
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: flex-start;
20
+ gap: var(--vmz-density-control-gap);
21
+ padding: calc(var(--vmz-density-control-padding-y) * 1.5) var(--vmz-density-control-padding-x);
22
+ border: 1px solid var(--vmz-status-info-accent);
23
+ border-radius: 2px;
24
+ color: var(--vmz-status-info-foreground);
25
+ }
26
+
27
+ .vmz-ui-result[data-status='info'] {
28
+ border-color: var(--vmz-status-info-accent);
29
+ color: var(--vmz-status-info-foreground);
30
+ }
31
+
32
+ .vmz-ui-result[data-status='success'] {
33
+ border-color: var(--vmz-status-success-accent);
34
+ color: var(--vmz-status-success-foreground);
35
+ }
36
+
37
+ .vmz-ui-result[data-status='warning'] {
38
+ border-color: var(--vmz-status-warning-accent);
39
+ color: var(--vmz-status-warning-foreground);
40
+ }
41
+
42
+ .vmz-ui-result[data-status='danger'] {
43
+ border-color: var(--vmz-status-danger-accent);
44
+ color: var(--vmz-status-danger-foreground);
45
+ }
46
+
47
+ :where([data-density='compact']) .vmz-ui-result {
48
+ gap: var(--vmz-density-compact-gap);
49
+ padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
50
+ }
51
+
52
+ .vmz-ui-result__title {
53
+ margin: 0;
54
+ font-size: 1.15rem;
55
+ font-weight: 700;
56
+ }
57
+
58
+ .vmz-ui-result__description {
59
+ margin: 0;
60
+ opacity: 0.9;
61
+ }
62
+
63
+ .vmz-ui-result__actions {
64
+ display: flex;
65
+ flex-wrap: wrap;
66
+ gap: 0.5rem;
67
+ }
68
+
69
+ .vmz-ui-result__actions:empty {
70
+ display: none;
71
+ }
72
+ </style>
73
+
74
+ <script client>
75
+ /**
76
+ * VMZ UI — Result (UI4 Commercial Surface).
77
+ * Outcome block for success/error flows; status → status.* tokens.
78
+ */
79
+ export default class Result {
80
+ public title: string = '';
81
+ public description: string = '';
82
+ public status: string = 'info';
83
+ }
84
+ </script>