@whatsaaaa/ui-vue 0.0.0-stage → 0.2.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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -2
  3. package/dist/color-mode.d.ts +14 -0
  4. package/dist/color-mode.js +34 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.js +12 -0
  7. package/dist/theme/badge.d.ts +70 -0
  8. package/dist/theme/badge.js +116 -0
  9. package/dist/theme/button.d.ts +136 -0
  10. package/dist/theme/button.js +193 -0
  11. package/dist/theme/card.d.ts +29 -0
  12. package/dist/theme/card.js +44 -0
  13. package/dist/theme/checkbox.d.ts +159 -0
  14. package/dist/theme/checkbox.js +73 -0
  15. package/dist/theme/choice.d.ts +82 -0
  16. package/dist/theme/choice.js +124 -0
  17. package/dist/theme/field-group.d.ts +9 -0
  18. package/dist/theme/field-group.js +16 -0
  19. package/dist/theme/field.d.ts +263 -0
  20. package/dist/theme/field.js +248 -0
  21. package/dist/theme/file-upload.d.ts +106 -0
  22. package/dist/theme/file-upload.js +124 -0
  23. package/dist/theme/form-field.d.ts +44 -0
  24. package/dist/theme/form-field.js +34 -0
  25. package/dist/theme/index.d.ts +2349 -0
  26. package/dist/theme/index.js +130 -0
  27. package/dist/theme/input-date.d.ts +127 -0
  28. package/dist/theme/input-date.js +78 -0
  29. package/dist/theme/input-menu.d.ts +210 -0
  30. package/dist/theme/input-menu.js +83 -0
  31. package/dist/theme/input-number.d.ts +77 -0
  32. package/dist/theme/input-number.js +110 -0
  33. package/dist/theme/input-tags.d.ts +284 -0
  34. package/dist/theme/input-tags.js +38 -0
  35. package/dist/theme/input-time.d.ts +2 -0
  36. package/dist/theme/input-time.js +5 -0
  37. package/dist/theme/input.d.ts +138 -0
  38. package/dist/theme/input.js +48 -0
  39. package/dist/theme/modal.d.ts +31 -0
  40. package/dist/theme/modal.js +44 -0
  41. package/dist/theme/pin-input.d.ts +61 -0
  42. package/dist/theme/pin-input.js +40 -0
  43. package/dist/theme/radio-group.d.ts +177 -0
  44. package/dist/theme/radio-group.js +111 -0
  45. package/dist/theme/select-menu.d.ts +154 -0
  46. package/dist/theme/select-menu.js +22 -0
  47. package/dist/theme/select.d.ts +254 -0
  48. package/dist/theme/select.js +109 -0
  49. package/dist/theme/shared.d.ts +69 -0
  50. package/dist/theme/shared.js +103 -0
  51. package/dist/theme/table.d.ts +45 -0
  52. package/dist/theme/table.js +111 -0
  53. package/dist/theme/tabs.d.ts +95 -0
  54. package/dist/theme/tabs.js +144 -0
  55. package/dist/theme/tags.d.ts +40 -0
  56. package/dist/theme/tags.js +52 -0
  57. package/dist/theme/textarea.d.ts +127 -0
  58. package/dist/theme/textarea.js +72 -0
  59. package/package.json +65 -3
  60. package/src/index.css +123 -0
  61. package/src/nuxt-ui.css +148 -0
@@ -0,0 +1,263 @@
1
+ import { type ByColor } from './shared.ts';
2
+ /**
3
+ * The heights, paddings and value sizes, for the field and the icons in it. An input's icons sit
4
+ * beside it, not inside its edge: past the padding and the rest edge, where a value starts.
5
+ */
6
+ export declare const fieldSizes: {
7
+ xs: {
8
+ base: string;
9
+ leading: string;
10
+ trailing: string;
11
+ leadingIcon: string;
12
+ trailingIcon: string;
13
+ };
14
+ sm: {
15
+ base: string;
16
+ leading: string;
17
+ trailing: string;
18
+ leadingIcon: string;
19
+ trailingIcon: string;
20
+ };
21
+ md: {
22
+ base: string;
23
+ leading: string;
24
+ trailing: string;
25
+ leadingIcon: string;
26
+ trailingIcon: string;
27
+ };
28
+ lg: {
29
+ base: string;
30
+ leading: string;
31
+ trailing: string;
32
+ leadingIcon: string;
33
+ trailingIcon: string;
34
+ };
35
+ xl: {
36
+ base: string;
37
+ leading: string;
38
+ trailing: string;
39
+ leadingIcon: string;
40
+ trailingIcon: string;
41
+ };
42
+ };
43
+ /**
44
+ * The icons of a field that draws them inside its edge, as a field of tags and a date field do:
45
+ * the padding in from the edge, less what an edge wider than at rest adds, so that they sit where
46
+ * a text field's do and stay there when the edge widens. On the bare field, which draws no edge,
47
+ * that is the padding in from its side, as on a bare text field.
48
+ */
49
+ export declare const iconsWithinSizes: {
50
+ xs: {
51
+ leading: string;
52
+ trailing: string;
53
+ };
54
+ sm: {
55
+ leading: string;
56
+ trailing: string;
57
+ };
58
+ md: {
59
+ leading: string;
60
+ trailing: string;
61
+ };
62
+ lg: {
63
+ leading: string;
64
+ trailing: string;
65
+ };
66
+ xl: {
67
+ leading: string;
68
+ trailing: string;
69
+ };
70
+ };
71
+ /** In forced colors every field but the bare one is outlined, as a field there is. */
72
+ export declare const fieldVariants: {
73
+ outline: string;
74
+ soft: string;
75
+ subtle: string;
76
+ ghost: string;
77
+ none: string;
78
+ };
79
+ /** The same, with the focus inside: disabled is Reka's data-disabled, on an element that is no control. */
80
+ export declare const fieldWithinVariants: {
81
+ outline: string;
82
+ soft: string;
83
+ subtle: string;
84
+ ghost: string;
85
+ none: string;
86
+ };
87
+ /**
88
+ * A highlighted field takes its color as the edge, and keeps it on hover and focus. A field in
89
+ * error is highlighted in the error color: the invalid edge, wider.
90
+ */
91
+ export declare const fieldHighlight: ByColor;
92
+ /**
93
+ * The room for an icon at the start or the end of the field, where text before or after the value
94
+ * starts past it: the field's padding, the icon and the gap, less the extra edge.
95
+ */
96
+ export declare const iconRoomStart: {
97
+ xs: string;
98
+ sm: string;
99
+ md: string;
100
+ lg: string;
101
+ xl: string;
102
+ };
103
+ export declare const iconRoomEnd: {
104
+ xs: string;
105
+ sm: string;
106
+ md: string;
107
+ lg: string;
108
+ xl: string;
109
+ };
110
+ export type FieldSize = keyof typeof iconRoomStart;
111
+ export declare const fieldSizeNames: FieldSize[];
112
+ /**
113
+ * What every field shares across its states: the edge on hover, on focus and disabled, the
114
+ * focus ring, the highlighted edge, and one size of the value at every width.
115
+ */
116
+ export declare const fieldStateVariants: ({
117
+ variant: string;
118
+ highlight: boolean;
119
+ class: string;
120
+ color?: undefined;
121
+ } | {
122
+ variant: string;
123
+ highlight: boolean;
124
+ color: string;
125
+ class: string;
126
+ } | {
127
+ fixed: boolean;
128
+ size: string[];
129
+ class: string;
130
+ } | ({
131
+ highlight: boolean;
132
+ } & {
133
+ color: import("./shared.ts").Color;
134
+ class: string | Record<string, string>;
135
+ }) | {
136
+ variant: string[];
137
+ class: string;
138
+ })[];
139
+ export declare const fieldCompoundVariants: ({
140
+ variant: string;
141
+ highlight: boolean;
142
+ class: string;
143
+ color?: undefined;
144
+ } | {
145
+ variant: string;
146
+ highlight: boolean;
147
+ color: string;
148
+ class: string;
149
+ } | {
150
+ fixed: boolean;
151
+ size: string[];
152
+ class: string;
153
+ } | {
154
+ leading: boolean;
155
+ size: "xs" | "sm" | "md" | "lg" | "xl";
156
+ class: string;
157
+ } | {
158
+ trailing: boolean;
159
+ size: "xs" | "sm" | "md" | "lg" | "xl";
160
+ class: string;
161
+ } | {
162
+ loading: boolean;
163
+ leading: boolean;
164
+ class: {
165
+ leadingIcon: string;
166
+ trailingIcon?: undefined;
167
+ };
168
+ trailing?: undefined;
169
+ } | {
170
+ loading: boolean;
171
+ leading: boolean;
172
+ trailing: boolean;
173
+ class: {
174
+ trailingIcon: string;
175
+ leadingIcon?: undefined;
176
+ };
177
+ } | ({
178
+ highlight: boolean;
179
+ } & {
180
+ color: import("./shared.ts").Color;
181
+ class: string | Record<string, string>;
182
+ }) | {
183
+ variant: string[];
184
+ class: string;
185
+ })[];
186
+ /** The same, with the focus inside. */
187
+ export declare const fieldWithinCompoundVariants: ({
188
+ variant: string;
189
+ highlight: boolean;
190
+ class: string;
191
+ color?: undefined;
192
+ } | {
193
+ variant: string;
194
+ highlight: boolean;
195
+ color: string;
196
+ class: string;
197
+ } | {
198
+ fixed: boolean;
199
+ size: string[];
200
+ class: string;
201
+ } | {
202
+ leading: boolean;
203
+ size: "xs" | "sm" | "md" | "lg" | "xl";
204
+ class: string;
205
+ } | {
206
+ trailing: boolean;
207
+ size: "xs" | "sm" | "md" | "lg" | "xl";
208
+ class: string;
209
+ } | {
210
+ loading: boolean;
211
+ leading: boolean;
212
+ class: {
213
+ leadingIcon: string;
214
+ trailingIcon?: undefined;
215
+ };
216
+ trailing?: undefined;
217
+ } | {
218
+ loading: boolean;
219
+ leading: boolean;
220
+ trailing: boolean;
221
+ class: {
222
+ trailingIcon: string;
223
+ leadingIcon?: undefined;
224
+ };
225
+ } | ({
226
+ highlight: boolean;
227
+ } & {
228
+ color: import("./shared.ts").Color;
229
+ class: string | Record<string, string>;
230
+ }) | {
231
+ variant: string[];
232
+ class: string;
233
+ })[];
234
+ /**
235
+ * In a field group each control's edge lies over the one before it, so that the two make one
236
+ * line. A field under the pointer comes over the controls beside it, so that the line is its
237
+ * edge, one in a color over those too, under the pointer or not, so that its color keeps the
238
+ * line, and one with the focus, on itself or on a part inside it, over all of them, so that its
239
+ * ring shows whole: on the part that is the group's item, the field itself, or the root around a
240
+ * text field.
241
+ */
242
+ export declare const inGroup: ({
243
+ fieldGroup: string[];
244
+ class: string;
245
+ highlight?: undefined;
246
+ } | {
247
+ fieldGroup: string[];
248
+ highlight: boolean;
249
+ class: string;
250
+ })[];
251
+ export declare const inGroupRoot: ({
252
+ fieldGroup: string[];
253
+ class: {
254
+ root: string;
255
+ };
256
+ highlight?: undefined;
257
+ } | {
258
+ fieldGroup: string[];
259
+ highlight: boolean;
260
+ class: {
261
+ root: string;
262
+ };
263
+ })[];
@@ -0,0 +1,248 @@
1
+ import { byColor, forcedControlEdge } from "./shared.js";
2
+ /*
3
+ * What a text field, a select and a select menu share, and the fields restyled on them: the pin
4
+ * input's cells, the tag field, the input menu and the date and time fields. The field of the
5
+ * design system's input spec, specs/input.spec.json: the control height, the value in Inter, an
6
+ * edge in the field border on the page color, the text color's secondary on hover. With an error
7
+ * the edge is the danger color, two pixels wide. They read the component tier by name,
8
+ * --ws-field-* and --ws-control-*, so a change of the tier reaches them.
9
+ *
10
+ * The edge is a border, not Nuxt UI's ring, so that forced colors keep it; the ring is taken off.
11
+ * A border takes room, so the field is laid out from its outer edge: the value and an icon start
12
+ * the padding and the rest edge in. An edge wider than the field's at rest, an error's or a
13
+ * highlighted bare field's, takes what it adds, --field-edge-extra, off the paddings inside it,
14
+ * so nothing moves when it changes.
15
+ *
16
+ * A field whose focus is on a part inside it, as a tag field's input or a date field's segments
17
+ * are, shows the focus as the field it is: its within classes read has-focus where the others
18
+ * read focus.
19
+ */
20
+ /**
21
+ * The heights, paddings and value sizes, for the field and the icons in it. An input's icons sit
22
+ * beside it, not inside its edge: past the padding and the rest edge, where a value starts.
23
+ */
24
+ export const fieldSizes = {
25
+ xs: {
26
+ 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',
27
+ leading: 'ps-[calc(var(--ws-space-8)+var(--ws-control-border-width-rest))]',
28
+ trailing: 'pe-[calc(var(--ws-space-8)+var(--ws-control-border-width-rest))]',
29
+ leadingIcon: 'size-(--ws-control-icon-size-xs)',
30
+ trailingIcon: 'size-(--ws-control-icon-size-xs)',
31
+ },
32
+ sm: {
33
+ 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',
34
+ leading: 'ps-[calc(var(--ws-space-10)+var(--ws-control-border-width-rest))]',
35
+ trailing: 'pe-[calc(var(--ws-space-10)+var(--ws-control-border-width-rest))]',
36
+ leadingIcon: 'size-(--ws-control-icon-size-sm)',
37
+ trailingIcon: 'size-(--ws-control-icon-size-sm)',
38
+ },
39
+ md: {
40
+ 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',
41
+ leading: 'ps-[calc(var(--ws-space-12)+var(--ws-control-border-width-rest))]',
42
+ trailing: 'pe-[calc(var(--ws-space-12)+var(--ws-control-border-width-rest))]',
43
+ leadingIcon: 'size-(--ws-control-icon-size-md)',
44
+ trailingIcon: 'size-(--ws-control-icon-size-md)',
45
+ },
46
+ lg: {
47
+ 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',
48
+ leading: 'ps-[calc(var(--ws-space-14)+var(--ws-control-border-width-rest))]',
49
+ trailing: 'pe-[calc(var(--ws-space-14)+var(--ws-control-border-width-rest))]',
50
+ leadingIcon: 'size-(--ws-control-icon-size-lg)',
51
+ trailingIcon: 'size-(--ws-control-icon-size-lg)',
52
+ },
53
+ xl: {
54
+ 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',
55
+ leading: 'ps-[calc(var(--ws-space-16)+var(--ws-control-border-width-rest))]',
56
+ trailing: 'pe-[calc(var(--ws-space-16)+var(--ws-control-border-width-rest))]',
57
+ leadingIcon: 'size-(--ws-control-icon-size-xl)',
58
+ trailingIcon: 'size-(--ws-control-icon-size-xl)',
59
+ },
60
+ };
61
+ /**
62
+ * The icons of a field that draws them inside its edge, as a field of tags and a date field do:
63
+ * the padding in from the edge, less what an edge wider than at rest adds, so that they sit where
64
+ * a text field's do and stay there when the edge widens. On the bare field, which draws no edge,
65
+ * that is the padding in from its side, as on a bare text field.
66
+ */
67
+ export const iconsWithinSizes = {
68
+ xs: {
69
+ leading: 'ps-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))]',
70
+ trailing: 'pe-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))]',
71
+ },
72
+ sm: {
73
+ leading: 'ps-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))]',
74
+ trailing: 'pe-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))]',
75
+ },
76
+ md: {
77
+ leading: 'ps-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))]',
78
+ trailing: 'pe-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))]',
79
+ },
80
+ lg: {
81
+ leading: 'ps-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))]',
82
+ trailing: 'pe-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))]',
83
+ },
84
+ xl: {
85
+ leading: 'ps-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))]',
86
+ trailing: 'pe-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))]',
87
+ },
88
+ };
89
+ /**
90
+ * The field's edge, of the control's width: transparent where the variant draws none, so that
91
+ * every field lays out alike, and forced colors draw one there. The bare field, inside another
92
+ * control, has none: its value starts the padding in, as that control's content does.
93
+ */
94
+ const edge = 'ring-0 border-(length:--ws-control-border-width-rest)';
95
+ /** The edge of a field in error, wider: in forced colors too, which draw the control's edge. */
96
+ 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))]';
97
+ /** In forced colors every field but the bare one is outlined, as a field there is. */
98
+ export const fieldVariants = {
99
+ outline: `text-(--ws-field-text-rest) bg-(--ws-field-bg-rest) ${edge} border-(--ws-field-border-rest) ${forcedControlEdge}`,
100
+ soft: `text-text bg-raised/60 hover:bg-raised focus:bg-raised disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge}`,
101
+ subtle: `text-text bg-raised ${edge} border-field-border ${forcedControlEdge}`,
102
+ ghost: `text-text bg-transparent hover:bg-raised focus:bg-raised disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge}`,
103
+ none: 'text-text bg-transparent',
104
+ };
105
+ /** A disabled field's gray edge in forced colors, where Reka marks it data-disabled alone. */
106
+ const forcedWithinDisabled = 'forced-colors:data-disabled:border-[GrayText]';
107
+ /** The same, with the focus inside: disabled is Reka's data-disabled, on an element that is no control. */
108
+ export const fieldWithinVariants = {
109
+ ...fieldVariants,
110
+ outline: `${fieldVariants.outline} ${forcedWithinDisabled}`,
111
+ soft: `text-text bg-raised/60 hover:bg-raised has-focus:bg-raised data-disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge} ${forcedWithinDisabled}`,
112
+ subtle: `${fieldVariants.subtle} ${forcedWithinDisabled}`,
113
+ ghost: `text-text bg-transparent hover:bg-raised has-focus:bg-raised data-disabled:bg-transparent ${edge} border-transparent ${forcedControlEdge} ${forcedWithinDisabled}`,
114
+ };
115
+ /**
116
+ * A highlighted field takes its color as the edge, and keeps it on hover and focus. A field in
117
+ * error is highlighted in the error color: the invalid edge, wider.
118
+ */
119
+ export const fieldHighlight = {
120
+ primary: `${edge} border-interactive hover:border-interactive focus-visible:border-interactive`,
121
+ success: `${edge} border-tip hover:border-tip focus-visible:border-tip`,
122
+ info: `${edge} border-note hover:border-note focus-visible:border-note`,
123
+ warning: `${edge} border-warning hover:border-warning focus-visible:border-warning`,
124
+ error: `${invalidEdge} border-(--ws-field-border-invalid) hover:border-(--ws-field-border-invalid) focus-visible:border-(--ws-field-border-invalid)`,
125
+ neutral: `${edge} border-text hover:border-text focus-visible:border-text`,
126
+ };
127
+ const highlightWithin = {
128
+ primary: `${edge} border-interactive hover:border-interactive has-focus-visible:border-interactive`,
129
+ success: `${edge} border-tip hover:border-tip has-focus-visible:border-tip`,
130
+ info: `${edge} border-note hover:border-note has-focus-visible:border-note`,
131
+ warning: `${edge} border-warning hover:border-warning has-focus-visible:border-warning`,
132
+ error: `${invalidEdge} border-(--ws-field-border-invalid) hover:border-(--ws-field-border-invalid) has-focus-visible:border-(--ws-field-border-invalid)`,
133
+ neutral: `${edge} border-text hover:border-text has-focus-visible:border-text`,
134
+ };
135
+ /**
136
+ * The room for an icon at the start or the end of the field, where text before or after the value
137
+ * starts past it: the field's padding, the icon and the gap, less the extra edge.
138
+ */
139
+ export const iconRoomStart = {
140
+ xs: 'ps-[calc(var(--ws-space-8)+var(--ws-control-icon-size-xs)+var(--ws-control-gap-xs)-var(--field-edge-extra,0px))]',
141
+ sm: 'ps-[calc(var(--ws-space-10)+var(--ws-control-icon-size-sm)+var(--ws-control-gap-sm)-var(--field-edge-extra,0px))]',
142
+ md: 'ps-[calc(var(--ws-space-12)+var(--ws-control-icon-size-md)+var(--ws-control-gap-md)-var(--field-edge-extra,0px))]',
143
+ lg: 'ps-[calc(var(--ws-space-14)+var(--ws-control-icon-size-lg)+var(--ws-control-gap-lg)-var(--field-edge-extra,0px))]',
144
+ xl: 'ps-[calc(var(--ws-space-16)+var(--ws-control-icon-size-xl)+var(--ws-control-gap-xl)-var(--field-edge-extra,0px))]',
145
+ };
146
+ export const iconRoomEnd = {
147
+ xs: 'pe-[calc(var(--ws-space-8)+var(--ws-control-icon-size-xs)+var(--ws-control-gap-xs)-var(--field-edge-extra,0px))]',
148
+ sm: 'pe-[calc(var(--ws-space-10)+var(--ws-control-icon-size-sm)+var(--ws-control-gap-sm)-var(--field-edge-extra,0px))]',
149
+ md: 'pe-[calc(var(--ws-space-12)+var(--ws-control-icon-size-md)+var(--ws-control-gap-md)-var(--field-edge-extra,0px))]',
150
+ lg: 'pe-[calc(var(--ws-space-14)+var(--ws-control-icon-size-lg)+var(--ws-control-gap-lg)-var(--field-edge-extra,0px))]',
151
+ xl: 'pe-[calc(var(--ws-space-16)+var(--ws-control-icon-size-xl)+var(--ws-control-gap-xl)-var(--field-edge-extra,0px))]',
152
+ };
153
+ export const fieldSizeNames = Object.keys(iconRoomStart);
154
+ /** The bare field draws no edge at rest: highlighted, it gives back the whole edge it draws. */
155
+ const bareHighlight = [
156
+ {
157
+ variant: 'none',
158
+ highlight: true,
159
+ class: '[--field-edge-extra:var(--ws-control-border-width-rest)]',
160
+ },
161
+ {
162
+ variant: 'none',
163
+ highlight: true,
164
+ color: 'error',
165
+ class: '[--field-edge-extra:var(--ws-control-border-width-invalid)]',
166
+ },
167
+ ];
168
+ /** Nuxt UI sets the value smaller from md up, where iOS would not zoom: the system keeps one size. */
169
+ const oneValueSize = [
170
+ { fixed: false, size: ['xs', 'sm'], class: 'md:text-body-sm' },
171
+ { fixed: false, size: ['md', 'lg', 'xl'], class: 'md:text-body' },
172
+ ];
173
+ /**
174
+ * A field's icons, wherever its focus is: text before or after the value starts past an icon,
175
+ * and the loading icon turns only for a reader who has not asked for less motion.
176
+ */
177
+ const fieldIcons = [
178
+ ...fieldSizeNames.map((size) => ({ leading: true, size, class: iconRoomStart[size] })),
179
+ ...fieldSizeNames.map((size) => ({ trailing: true, size, class: iconRoomEnd[size] })),
180
+ { loading: true, leading: true, class: { leadingIcon: 'animate-none motion-safe:animate-spin' } },
181
+ {
182
+ loading: true,
183
+ leading: false,
184
+ trailing: true,
185
+ class: { trailingIcon: 'animate-none motion-safe:animate-spin' },
186
+ },
187
+ ];
188
+ /**
189
+ * What every field shares across its states: the edge on hover, on focus and disabled, the
190
+ * focus ring, the highlighted edge, and one size of the value at every width.
191
+ */
192
+ export const fieldStateVariants = [
193
+ // The edge lightens on hover, stays as it is on focus, where the ring shows, and fades when
194
+ // the field is disabled.
195
+ {
196
+ variant: ['outline', 'subtle'],
197
+ 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',
198
+ },
199
+ {
200
+ variant: ['soft', 'ghost'],
201
+ class: 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
202
+ },
203
+ ...byColor(fieldHighlight, { highlight: true }),
204
+ ...bareHighlight,
205
+ ...oneValueSize,
206
+ ];
207
+ export const fieldCompoundVariants = [...fieldStateVariants, ...fieldIcons];
208
+ /** The same, with the focus inside. */
209
+ export const fieldWithinCompoundVariants = [
210
+ {
211
+ variant: ['outline', 'subtle'],
212
+ class: 'hover:border-(--ws-field-border-hover) has-focus-visible:border-(--ws-field-border-rest) data-disabled:border-(--ws-field-border-disabled) outline-interactive has-focus-visible:outline-2 has-focus-visible:outline-solid has-focus-visible:outline-offset-3',
213
+ },
214
+ {
215
+ variant: ['soft', 'ghost'],
216
+ class: 'outline-interactive has-focus-visible:outline-2 has-focus-visible:outline-solid has-focus-visible:outline-offset-3',
217
+ },
218
+ ...byColor(highlightWithin, { highlight: true }),
219
+ ...bareHighlight,
220
+ ...oneValueSize,
221
+ ...fieldIcons,
222
+ ];
223
+ /**
224
+ * In a field group each control's edge lies over the one before it, so that the two make one
225
+ * line. A field under the pointer comes over the controls beside it, so that the line is its
226
+ * edge, one in a color over those too, under the pointer or not, so that its color keeps the
227
+ * line, and one with the focus, on itself or on a part inside it, over all of them, so that its
228
+ * ring shows whole: on the part that is the group's item, the field itself, or the root around a
229
+ * text field.
230
+ */
231
+ export const inGroup = [
232
+ {
233
+ fieldGroup: ['horizontal', 'vertical'],
234
+ class: 'hover:z-[1] focus-visible:z-[3] has-focus-visible:z-[3]',
235
+ },
236
+ { fieldGroup: ['horizontal', 'vertical'], highlight: true, class: 'z-[2] hover:z-[2]' },
237
+ ];
238
+ export const inGroupRoot = [
239
+ {
240
+ fieldGroup: ['horizontal', 'vertical'],
241
+ class: { root: 'hover:z-[1] has-focus-visible:z-[3]' },
242
+ },
243
+ {
244
+ fieldGroup: ['horizontal', 'vertical'],
245
+ highlight: true,
246
+ class: { root: 'z-[2] hover:z-[2]' },
247
+ },
248
+ ];
@@ -0,0 +1,106 @@
1
+ declare const _default: {
2
+ slots: {
3
+ base: string;
4
+ icon: string;
5
+ avatar: string;
6
+ label: string;
7
+ description: string;
8
+ actions: string;
9
+ file: string;
10
+ fileName: string;
11
+ fileSize: string;
12
+ };
13
+ variants: {
14
+ size: {
15
+ xs: {
16
+ base: string;
17
+ icon: string;
18
+ avatar: string;
19
+ file: string;
20
+ fileSize: string;
21
+ };
22
+ sm: {
23
+ base: string;
24
+ icon: string;
25
+ avatar: string;
26
+ file: string;
27
+ fileSize: string;
28
+ };
29
+ md: {
30
+ base: string;
31
+ icon: string;
32
+ avatar: string;
33
+ file: string;
34
+ fileSize: string;
35
+ };
36
+ lg: {
37
+ base: string;
38
+ icon: string;
39
+ avatar: string;
40
+ file: string;
41
+ fileSize: string;
42
+ };
43
+ xl: {
44
+ base: string;
45
+ icon: string;
46
+ avatar: string;
47
+ file: string;
48
+ fileSize: string;
49
+ };
50
+ };
51
+ variant: {
52
+ area: {
53
+ base: string;
54
+ wrapper: string;
55
+ };
56
+ };
57
+ layout: {
58
+ list: {
59
+ files: string;
60
+ file: string;
61
+ };
62
+ grid: {
63
+ fileLeadingAvatar: string;
64
+ files: string;
65
+ };
66
+ };
67
+ };
68
+ compoundVariants: ({
69
+ variant: string;
70
+ size: "xs" | "sm" | "md" | "lg" | "xl";
71
+ class: {
72
+ base: string;
73
+ };
74
+ } | ({
75
+ highlight: boolean;
76
+ } & {
77
+ color: import("./shared.ts").Color;
78
+ class: string | Record<string, string>;
79
+ }) | {
80
+ class: string;
81
+ interactive?: undefined;
82
+ disabled?: undefined;
83
+ dropzone?: undefined;
84
+ } | {
85
+ interactive: boolean;
86
+ disabled: boolean;
87
+ class: string;
88
+ dropzone?: undefined;
89
+ } | {
90
+ disabled: boolean;
91
+ class: {
92
+ base: string;
93
+ icon: string;
94
+ label: string;
95
+ description: string;
96
+ };
97
+ interactive?: undefined;
98
+ dropzone?: undefined;
99
+ } | {
100
+ dropzone: boolean;
101
+ class: string;
102
+ interactive?: undefined;
103
+ disabled?: undefined;
104
+ })[];
105
+ };
106
+ export default _default;