@whatsaaaa/ui-vue 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +24 -2
- package/dist/color-mode.d.ts +14 -0
- package/dist/color-mode.js +34 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/theme/badge.d.ts +62 -0
- package/dist/theme/badge.js +123 -0
- package/dist/theme/button.d.ts +119 -0
- package/dist/theme/button.js +190 -0
- package/dist/theme/card.d.ts +29 -0
- package/dist/theme/card.js +44 -0
- package/dist/theme/checkbox.d.ts +159 -0
- package/dist/theme/checkbox.js +73 -0
- package/dist/theme/choice.d.ts +82 -0
- package/dist/theme/choice.js +124 -0
- package/dist/theme/field.d.ts +131 -0
- package/dist/theme/field.js +173 -0
- package/dist/theme/form-field.d.ts +44 -0
- package/dist/theme/form-field.js +34 -0
- package/dist/theme/index.d.ts +1288 -0
- package/dist/theme/index.js +112 -0
- package/dist/theme/input.d.ts +146 -0
- package/dist/theme/input.js +46 -0
- package/dist/theme/modal.d.ts +31 -0
- package/dist/theme/modal.js +44 -0
- package/dist/theme/radio-group.d.ts +177 -0
- package/dist/theme/radio-group.js +111 -0
- package/dist/theme/select-menu.d.ts +181 -0
- package/dist/theme/select-menu.js +22 -0
- package/dist/theme/select.d.ts +281 -0
- package/dist/theme/select.js +109 -0
- package/dist/theme/shared.d.ts +69 -0
- package/dist/theme/shared.js +103 -0
- package/dist/theme/table.d.ts +45 -0
- package/dist/theme/table.js +111 -0
- package/dist/theme/tabs.d.ts +95 -0
- package/dist/theme/tabs.js +144 -0
- package/package.json +65 -3
- package/src/index.css +123 -0
- package/src/nuxt-ui.css +148 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { byColor, forcedControlEdge } from "./shared.js";
|
|
2
|
+
/*
|
|
3
|
+
* What a text field, a select and a select menu share: the field of the design system's input
|
|
4
|
+
* spec, specs/input.spec.json. The control height, the value in Inter, an edge in the field
|
|
5
|
+
* border on the page color, the text color's secondary on hover. With an error the edge is the
|
|
6
|
+
* danger color, two pixels wide. They read the component tier by name, --ws-field-* and
|
|
7
|
+
* --ws-control-*, so a change of the tier reaches them.
|
|
8
|
+
*
|
|
9
|
+
* The edge is a border, not Nuxt UI's ring, so that forced colors keep it; the ring is taken off.
|
|
10
|
+
* A border takes room, so the field is laid out from its outer edge: the value and an icon start
|
|
11
|
+
* the padding and the rest edge in. An edge wider than the field's at rest, an error's or a
|
|
12
|
+
* highlighted bare field's, takes what it adds, --field-edge-extra, off the paddings inside it,
|
|
13
|
+
* so nothing moves when it changes.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The heights, paddings and value sizes, for the field and the icons in it. An input's icons sit
|
|
17
|
+
* beside it, not inside its edge: past the padding and the rest edge, where a value starts.
|
|
18
|
+
*/
|
|
19
|
+
export const fieldSizes = {
|
|
20
|
+
xs: {
|
|
21
|
+
base: 'h-(--ws-control-height-xs) px-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-xs) text-body-sm',
|
|
22
|
+
leading: 'ps-[calc(var(--ws-space-8)+var(--ws-control-border-width-rest))]',
|
|
23
|
+
trailing: 'pe-[calc(var(--ws-space-8)+var(--ws-control-border-width-rest))]',
|
|
24
|
+
leadingIcon: 'size-(--ws-control-icon-size-xs)',
|
|
25
|
+
trailingIcon: 'size-(--ws-control-icon-size-xs)',
|
|
26
|
+
},
|
|
27
|
+
sm: {
|
|
28
|
+
base: 'h-(--ws-control-height-sm) px-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-sm) text-body-sm',
|
|
29
|
+
leading: 'ps-[calc(var(--ws-space-10)+var(--ws-control-border-width-rest))]',
|
|
30
|
+
trailing: 'pe-[calc(var(--ws-space-10)+var(--ws-control-border-width-rest))]',
|
|
31
|
+
leadingIcon: 'size-(--ws-control-icon-size-sm)',
|
|
32
|
+
trailingIcon: 'size-(--ws-control-icon-size-sm)',
|
|
33
|
+
},
|
|
34
|
+
md: {
|
|
35
|
+
base: 'h-(--ws-control-height-md) px-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-md) text-body',
|
|
36
|
+
leading: 'ps-[calc(var(--ws-space-12)+var(--ws-control-border-width-rest))]',
|
|
37
|
+
trailing: 'pe-[calc(var(--ws-space-12)+var(--ws-control-border-width-rest))]',
|
|
38
|
+
leadingIcon: 'size-(--ws-control-icon-size-md)',
|
|
39
|
+
trailingIcon: 'size-(--ws-control-icon-size-md)',
|
|
40
|
+
},
|
|
41
|
+
lg: {
|
|
42
|
+
base: 'h-(--ws-control-height-lg) px-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-lg) text-body',
|
|
43
|
+
leading: 'ps-[calc(var(--ws-space-14)+var(--ws-control-border-width-rest))]',
|
|
44
|
+
trailing: 'pe-[calc(var(--ws-space-14)+var(--ws-control-border-width-rest))]',
|
|
45
|
+
leadingIcon: 'size-(--ws-control-icon-size-lg)',
|
|
46
|
+
trailingIcon: 'size-(--ws-control-icon-size-lg)',
|
|
47
|
+
},
|
|
48
|
+
xl: {
|
|
49
|
+
base: 'h-(--ws-control-height-xl) px-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-xl) text-body',
|
|
50
|
+
leading: 'ps-[calc(var(--ws-space-16)+var(--ws-control-border-width-rest))]',
|
|
51
|
+
trailing: 'pe-[calc(var(--ws-space-16)+var(--ws-control-border-width-rest))]',
|
|
52
|
+
leadingIcon: 'size-(--ws-control-icon-size-xl)',
|
|
53
|
+
trailingIcon: 'size-(--ws-control-icon-size-xl)',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The field's edge, of the control's width: transparent where the variant draws none, so that
|
|
58
|
+
* every field lays out alike, and forced colors draw one there. The bare field, inside another
|
|
59
|
+
* control, has none: its value starts the padding in, as that control's content does.
|
|
60
|
+
*/
|
|
61
|
+
const edge = 'ring-0 border-(length:--ws-control-border-width-rest)';
|
|
62
|
+
/** The edge of a field in error, wider: in forced colors too, which draw the control's edge. */
|
|
63
|
+
const invalidEdge = 'ring-0 border-(length:--ws-control-border-width-invalid) forced-colors:border-(length:--ws-control-border-width-invalid) [--field-edge-extra:calc(var(--ws-control-border-width-invalid)_-_var(--ws-control-border-width-rest))]';
|
|
64
|
+
/** In forced colors every field but the bare one is outlined, as a field there is. */
|
|
65
|
+
export const fieldVariants = {
|
|
66
|
+
outline: `text-(--ws-field-text-rest) bg-(--ws-field-bg-rest) ${edge} border-(--ws-field-border-rest) ${forcedControlEdge}`,
|
|
67
|
+
soft: `text-text bg-raised/60 hover:bg-raised focus:bg-raised disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge}`,
|
|
68
|
+
subtle: `text-text bg-raised ${edge} border-field-border ${forcedControlEdge}`,
|
|
69
|
+
ghost: `text-text bg-transparent hover:bg-raised focus:bg-raised disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge}`,
|
|
70
|
+
none: 'text-text bg-transparent',
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* A highlighted field takes its color as the edge, and keeps it on hover and focus. A field in
|
|
74
|
+
* error is highlighted in the error color: the invalid edge, wider.
|
|
75
|
+
*/
|
|
76
|
+
const highlight = {
|
|
77
|
+
primary: `${edge} border-interactive hover:border-interactive focus-visible:border-interactive`,
|
|
78
|
+
success: `${edge} border-tip hover:border-tip focus-visible:border-tip`,
|
|
79
|
+
info: `${edge} border-note hover:border-note focus-visible:border-note`,
|
|
80
|
+
warning: `${edge} border-warning hover:border-warning focus-visible:border-warning`,
|
|
81
|
+
error: `${invalidEdge} border-(--ws-field-border-invalid) hover:border-(--ws-field-border-invalid) focus-visible:border-(--ws-field-border-invalid)`,
|
|
82
|
+
neutral: `${edge} border-text hover:border-text focus-visible:border-text`,
|
|
83
|
+
};
|
|
84
|
+
/** Text before or after the value starts past the icon: the field's padding, the icon and the gap. */
|
|
85
|
+
const iconRoom = [
|
|
86
|
+
{
|
|
87
|
+
leading: true,
|
|
88
|
+
size: 'xs',
|
|
89
|
+
class: 'ps-[calc(var(--ws-space-8)+var(--ws-control-icon-size-xs)+var(--ws-control-gap-xs)-var(--field-edge-extra,0px))]',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
leading: true,
|
|
93
|
+
size: 'sm',
|
|
94
|
+
class: 'ps-[calc(var(--ws-space-10)+var(--ws-control-icon-size-sm)+var(--ws-control-gap-sm)-var(--field-edge-extra,0px))]',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
leading: true,
|
|
98
|
+
size: 'md',
|
|
99
|
+
class: 'ps-[calc(var(--ws-space-12)+var(--ws-control-icon-size-md)+var(--ws-control-gap-md)-var(--field-edge-extra,0px))]',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
leading: true,
|
|
103
|
+
size: 'lg',
|
|
104
|
+
class: 'ps-[calc(var(--ws-space-14)+var(--ws-control-icon-size-lg)+var(--ws-control-gap-lg)-var(--field-edge-extra,0px))]',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
leading: true,
|
|
108
|
+
size: 'xl',
|
|
109
|
+
class: 'ps-[calc(var(--ws-space-16)+var(--ws-control-icon-size-xl)+var(--ws-control-gap-xl)-var(--field-edge-extra,0px))]',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
trailing: true,
|
|
113
|
+
size: 'xs',
|
|
114
|
+
class: 'pe-[calc(var(--ws-space-8)+var(--ws-control-icon-size-xs)+var(--ws-control-gap-xs)-var(--field-edge-extra,0px))]',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
trailing: true,
|
|
118
|
+
size: 'sm',
|
|
119
|
+
class: 'pe-[calc(var(--ws-space-10)+var(--ws-control-icon-size-sm)+var(--ws-control-gap-sm)-var(--field-edge-extra,0px))]',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
trailing: true,
|
|
123
|
+
size: 'md',
|
|
124
|
+
class: 'pe-[calc(var(--ws-space-12)+var(--ws-control-icon-size-md)+var(--ws-control-gap-md)-var(--field-edge-extra,0px))]',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
trailing: true,
|
|
128
|
+
size: 'lg',
|
|
129
|
+
class: 'pe-[calc(var(--ws-space-14)+var(--ws-control-icon-size-lg)+var(--ws-control-gap-lg)-var(--field-edge-extra,0px))]',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
trailing: true,
|
|
133
|
+
size: 'xl',
|
|
134
|
+
class: 'pe-[calc(var(--ws-space-16)+var(--ws-control-icon-size-xl)+var(--ws-control-gap-xl)-var(--field-edge-extra,0px))]',
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
export const fieldCompoundVariants = [
|
|
138
|
+
// The edge lightens on hover, stays as it is on focus, where the ring shows, and fades when
|
|
139
|
+
// the field is disabled.
|
|
140
|
+
{
|
|
141
|
+
variant: ['outline', 'subtle'],
|
|
142
|
+
class: 'hover:border-(--ws-field-border-hover) focus-visible:border-(--ws-field-border-rest) disabled:border-(--ws-field-border-disabled) outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
variant: ['soft', 'ghost'],
|
|
146
|
+
class: 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
|
|
147
|
+
},
|
|
148
|
+
...byColor(highlight, { highlight: true }),
|
|
149
|
+
// The bare field draws no edge at rest: highlighted, it gives back the whole edge it draws.
|
|
150
|
+
{
|
|
151
|
+
variant: 'none',
|
|
152
|
+
highlight: true,
|
|
153
|
+
class: '[--field-edge-extra:var(--ws-control-border-width-rest)]',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
variant: 'none',
|
|
157
|
+
highlight: true,
|
|
158
|
+
color: 'error',
|
|
159
|
+
class: '[--field-edge-extra:var(--ws-control-border-width-invalid)]',
|
|
160
|
+
},
|
|
161
|
+
...iconRoom,
|
|
162
|
+
// Nuxt UI sets the value smaller from md up, where iOS would not zoom: the system keeps one size.
|
|
163
|
+
{ fixed: false, size: ['xs', 'sm'], class: 'md:text-body-sm' },
|
|
164
|
+
{ fixed: false, size: ['md', 'lg', 'xl'], class: 'md:text-body' },
|
|
165
|
+
// The loading icon turns only for a reader who has not asked for less motion.
|
|
166
|
+
{ loading: true, leading: true, class: { leadingIcon: 'animate-none motion-safe:animate-spin' } },
|
|
167
|
+
{
|
|
168
|
+
loading: true,
|
|
169
|
+
leading: false,
|
|
170
|
+
trailing: true,
|
|
171
|
+
class: { trailingIcon: 'animate-none motion-safe:animate-spin' },
|
|
172
|
+
},
|
|
173
|
+
];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
slots: {
|
|
3
|
+
label: string;
|
|
4
|
+
description: string;
|
|
5
|
+
hint: string;
|
|
6
|
+
help: string;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
xs: {
|
|
12
|
+
root: string;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
sm: {
|
|
16
|
+
root: string;
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
md: {
|
|
20
|
+
root: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
lg: {
|
|
24
|
+
root: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
xl: {
|
|
28
|
+
root: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
required: {
|
|
33
|
+
true: {
|
|
34
|
+
label: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
orientation: {
|
|
38
|
+
vertical: {
|
|
39
|
+
container: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The form field of the design system's input spec: a mono label, the control, then the help and
|
|
3
|
+
* the error under it, six pixels apart. The error is a word with the danger icon before it, at
|
|
4
|
+
* the icon size and centered on its first line, never a color alone, and in forced colors the
|
|
5
|
+
* icon takes the text's color. The required mark is the system's red, which reads at 4.5:1 in
|
|
6
|
+
* both themes. Hints go under the field: the help text, not the hint beside the label. The colors
|
|
7
|
+
* read the component tier by name, --ws-field-*.
|
|
8
|
+
*/
|
|
9
|
+
export default {
|
|
10
|
+
slots: {
|
|
11
|
+
label: 'font-mono font-normal text-(--ws-field-label-text-rest)',
|
|
12
|
+
description: 'text-text-secondary font-sans',
|
|
13
|
+
hint: 'text-text-secondary font-sans',
|
|
14
|
+
help: 'mt-1.5 text-(--ws-field-help-text-rest) font-sans',
|
|
15
|
+
error: "mt-1.5 flex gap-1.5 font-sans font-(--ws-field-error-font-weight) text-(--ws-field-error-text-rest) before:shrink-0 before:size-icon before:mt-[calc((1lh-var(--ws-size-icon))/2)] before:text-(--ws-field-error-icon-rest) before:bg-current before:content-[''] before:mask-(--ws-icon-danger) before:mask-center before:mask-no-repeat before:mask-size-(--ws-size-icon) forced-colors:before:bg-[CanvasText]",
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
xs: { root: 'text-body-sm', label: 'text-label-sm' },
|
|
20
|
+
sm: { root: 'text-body-sm', label: 'text-label-sm' },
|
|
21
|
+
md: { root: 'text-body-sm', label: 'text-label' },
|
|
22
|
+
lg: { root: 'text-body-sm', label: 'text-label' },
|
|
23
|
+
xl: { root: 'text-body', label: 'text-label' },
|
|
24
|
+
},
|
|
25
|
+
required: {
|
|
26
|
+
true: {
|
|
27
|
+
label: "after:content-['*'] after:ms-0.5 after:text-(--ws-field-required-text-rest)",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
orientation: {
|
|
31
|
+
vertical: { container: 'mt-1.5' },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|