@vmz/ui 0.3.6 → 0.3.8
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 +53 -51
- package/contracts/token-requirements.v0.json +58 -1
- package/package.json +5 -2
- package/presets/web-surface.v0.json +14 -12
- package/src/components/Accordion.vmz +127 -94
- package/src/components/Alert.vmz +125 -28
- package/src/components/AppShell.vmz +125 -57
- package/src/components/Autocomplete.vmz +261 -154
- package/src/components/Avatar.vmz +20 -12
- package/src/components/Badge.vmz +62 -70
- package/src/components/Breadcrumb.vmz +86 -72
- package/src/components/BulkActions.vmz +56 -51
- package/src/components/Button.vmz +237 -211
- package/src/components/Callout.vmz +178 -77
- package/src/components/Card.vmz +141 -120
- package/src/components/Checkbox.vmz +131 -55
- package/src/components/CodeBlock.vmz +77 -30
- package/src/components/Collapse.vmz +64 -11
- package/src/components/ConsoleShell.vmz +405 -251
- package/src/components/Content.vmz +15 -1
- package/src/components/DataTable.vmz +294 -194
- package/src/components/DatePicker.vmz +766 -674
- package/src/components/Descriptions.vmz +90 -0
- package/src/components/Dialog.vmz +137 -38
- package/src/components/Divider.vmz +8 -1
- package/src/components/Drawer.vmz +518 -427
- package/src/components/Dropdown.vmz +195 -51
- package/src/components/Empty.vmz +96 -54
- package/src/components/Field.vmz +170 -115
- package/src/components/FilterBar.vmz +34 -4
- package/src/components/Flex.vmz +3 -1
- package/src/components/Footer.vmz +6 -3
- package/src/components/Form.vmz +41 -0
- package/src/components/FormItem.vmz +78 -79
- package/src/components/Grid.vmz +6 -3
- package/src/components/Header.vmz +193 -6
- package/src/components/Layout.vmz +3 -1
- package/src/components/Link.vmz +25 -10
- package/src/components/List.vmz +124 -102
- package/src/components/Menu.vmz +416 -243
- package/src/components/Message.vmz +167 -0
- package/src/components/Notification.vmz +132 -37
- package/src/components/Pagination.vmz +237 -69
- package/src/components/Popconfirm.vmz +287 -0
- package/src/components/Popover.vmz +341 -223
- package/src/components/Progress.vmz +16 -5
- package/src/components/Prose.vmz +180 -81
- package/src/components/QueryForm.vmz +31 -9
- package/src/components/RadioGroup.vmz +204 -124
- package/src/components/Result.vmz +60 -27
- package/src/components/Segmented.vmz +86 -51
- package/src/components/Select.vmz +620 -533
- package/src/components/Sider.vmz +120 -7
- package/src/components/Skeleton.vmz +9 -7
- package/src/components/Space.vmz +9 -3
- package/src/components/Spinner.vmz +5 -4
- package/src/components/Steps.vmz +118 -103
- package/src/components/Switch.vmz +131 -98
- package/src/components/Table.vmz +270 -165
- package/src/components/Tabs.vmz +125 -110
- package/src/components/Tag.vmz +60 -43
- package/src/components/TextArea.vmz +125 -118
- package/src/components/Timeline.vmz +111 -76
- package/src/components/Toc.vmz +90 -74
- package/src/components/Tooltip.vmz +107 -58
- package/src/components/Tree.vmz +214 -191
- package/src/components/Typography.vmz +23 -8
- package/src/components/Upload.vmz +1394 -1289
|
@@ -1,98 +1,131 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label data-vmz-ui="switch" :for="controlId" class="vmz-ui-switch">
|
|
3
|
-
<button :id="controlId" type="button" role="switch" :aria-checked="checked" :aria-describedby="describedBy" :disabled="disabled" @click="toggle" :onKeyDown="onKeyDown" class="vmz-ui-switch__control">
|
|
4
|
-
<span aria-hidden="true" class="vmz-ui-switch__thumb" />
|
|
5
|
-
</button>
|
|
6
|
-
<span class="vmz-ui-switch__label">
|
|
7
|
-
{{ label }}
|
|
8
|
-
</span>
|
|
9
|
-
</label>
|
|
10
|
-
</template>
|
|
11
|
-
<style>
|
|
12
|
-
.vmz-ui-switch {
|
|
13
|
-
display: inline-flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
gap:
|
|
16
|
-
font: inherit;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<label data-vmz-ui="switch" :for="controlId" :data-disabled="disabled ? 'true' : 'false'" class="vmz-ui-switch">
|
|
3
|
+
<button :id="controlId" type="button" role="switch" :aria-checked="checked ? 'true' : 'false'" :data-checked="checked ? 'true' : 'false'" :aria-describedby="describedBy" :disabled="disabled" @click="toggle" :onKeyDown="onKeyDown" class="vmz-ui-switch__control">
|
|
4
|
+
<span aria-hidden="true" class="vmz-ui-switch__thumb" />
|
|
5
|
+
</button>
|
|
6
|
+
<span class="vmz-ui-switch__label">
|
|
7
|
+
{{ label }}
|
|
8
|
+
</span>
|
|
9
|
+
</label>
|
|
10
|
+
</template>
|
|
11
|
+
<style>
|
|
12
|
+
.vmz-ui-switch {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: var(--vmz-space-2);
|
|
16
|
+
font: inherit;
|
|
17
|
+
font-size: 0.875rem;
|
|
18
|
+
line-height: 1.5715;
|
|
19
|
+
color: var(--vmz-text-ink);
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.vmz-ui-switch__control {
|
|
24
|
+
position: relative;
|
|
25
|
+
flex: 0 0 auto;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
width: 2.5rem;
|
|
28
|
+
height: 1.5rem;
|
|
29
|
+
padding: 0;
|
|
30
|
+
border: 0;
|
|
31
|
+
border-radius: var(--vmz-radius-pill);
|
|
32
|
+
background: var(--vmz-line-strong);
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
outline: none;
|
|
35
|
+
transition:
|
|
36
|
+
background-color var(--vmz-motion-control-duration) var(--vmz-motion-control-easing),
|
|
37
|
+
box-shadow var(--vmz-motion-control-duration) var(--vmz-motion-control-easing);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.vmz-ui-switch__control:hover:not(:disabled):not([aria-checked="true"]) {
|
|
41
|
+
background: var(--vmz-text-tertiary);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vmz-ui-switch__control[aria-checked="true"],
|
|
45
|
+
.vmz-ui-switch__control[data-checked="true"] {
|
|
46
|
+
background: var(--vmz-action-primary-background);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.vmz-ui-switch__control[aria-checked="true"]:hover:not(:disabled),
|
|
50
|
+
.vmz-ui-switch__control[data-checked="true"]:hover:not(:disabled) {
|
|
51
|
+
background: var(--vmz-action-primary-hover);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.vmz-ui-switch__control:active:not(:disabled)[aria-checked="true"],
|
|
55
|
+
.vmz-ui-switch__control:active:not(:disabled)[data-checked="true"] {
|
|
56
|
+
background: var(--vmz-action-primary-active);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vmz-ui-switch__control:focus-visible {
|
|
60
|
+
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.vmz-ui-switch__control:disabled {
|
|
64
|
+
opacity: 0.55;
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.vmz-ui-switch__thumb {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: var(--vmz-space-1);
|
|
71
|
+
left: var(--vmz-space-1);
|
|
72
|
+
width: 1rem;
|
|
73
|
+
height: 1rem;
|
|
74
|
+
border-radius: var(--vmz-radius-pill);
|
|
75
|
+
background: var(--vmz-action-primary-foreground);
|
|
76
|
+
transition: transform var(--vmz-motion-control-duration) var(--vmz-motion-control-easing);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.vmz-ui-switch__control[aria-checked="true"] .vmz-ui-switch__thumb,
|
|
80
|
+
.vmz-ui-switch__control[data-checked="true"] .vmz-ui-switch__thumb {
|
|
81
|
+
transform: translateX(1rem);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.vmz-ui-switch__label {
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.vmz-ui-switch[data-disabled="true"] {
|
|
89
|
+
opacity: 0.55;
|
|
90
|
+
cursor: not-allowed;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.vmz-ui-switch[data-disabled="true"] .vmz-ui-switch__control,
|
|
94
|
+
.vmz-ui-switch[data-disabled="true"] .vmz-ui-switch__label {
|
|
95
|
+
cursor: not-allowed;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (prefers-reduced-motion: reduce) {
|
|
99
|
+
.vmz-ui-switch__control,
|
|
100
|
+
.vmz-ui-switch__thumb {
|
|
101
|
+
transition: none;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
<script client>
|
|
106
|
+
/**
|
|
107
|
+
* VMZ UI — Switch (UI2).
|
|
108
|
+
* role=switch + aria-checked; parent owns checked (no parallel form store).
|
|
109
|
+
*/
|
|
110
|
+
export default class Switch {
|
|
111
|
+
public label: string = "";
|
|
112
|
+
public checked: boolean = false;
|
|
113
|
+
public disabled: boolean = false;
|
|
114
|
+
public controlId: string = "vmz-switch";
|
|
115
|
+
public describedBy: string = "";
|
|
116
|
+
public onChange: ((checked: boolean) => void) | null = null;
|
|
117
|
+
toggle() {
|
|
118
|
+
if (this.disabled) return;
|
|
119
|
+
const next = !this.checked;
|
|
120
|
+
this.emit("change", next);
|
|
121
|
+
if (typeof this.onChange === "function") this.onChange(next);
|
|
122
|
+
}
|
|
123
|
+
onKeyDown(ev) {
|
|
124
|
+
if (!ev) return;
|
|
125
|
+
if (ev.key === " " || ev.key === "Enter") {
|
|
126
|
+
ev.preventDefault();
|
|
127
|
+
this.toggle();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</script>
|