@whatsaaaa/ui-vue 0.1.0 → 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.
@@ -2,15 +2,24 @@ import badge from "./badge.js";
2
2
  import button from "./button.js";
3
3
  import card from "./card.js";
4
4
  import checkbox from "./checkbox.js";
5
+ import fieldGroup from "./field-group.js";
6
+ import fileUpload from "./file-upload.js";
5
7
  import formField from "./form-field.js";
8
+ import inputDate from "./input-date.js";
9
+ import inputMenu from "./input-menu.js";
10
+ import inputNumber from "./input-number.js";
11
+ import inputTags from "./input-tags.js";
12
+ import inputTime from "./input-time.js";
6
13
  import input from "./input.js";
7
14
  import modal from "./modal.js";
15
+ import pinInput from "./pin-input.js";
8
16
  import radioGroup from "./radio-group.js";
9
17
  import selectMenu from "./select-menu.js";
10
18
  import select from "./select.js";
11
19
  import { colors } from "./shared.js";
12
20
  import table from "./table.js";
13
21
  import tabs from "./tabs.js";
22
+ import textarea from "./textarea.js";
14
23
  /*
15
24
  * The names the design system's Tailwind entry adds to Tailwind's. tailwind-merge, which Nuxt UI
16
25
  * resolves conflicting classes with, has to know each in its utility. Otherwise it keeps both of
@@ -101,12 +110,21 @@ export const ui = {
101
110
  button,
102
111
  card,
103
112
  checkbox,
113
+ fieldGroup,
114
+ fileUpload,
104
115
  formField,
105
116
  input,
117
+ inputDate,
118
+ inputMenu,
119
+ inputNumber,
120
+ inputTags,
121
+ inputTime,
106
122
  modal,
123
+ pinInput,
107
124
  radioGroup,
108
125
  select,
109
126
  selectMenu,
110
127
  table,
111
128
  tabs,
129
+ textarea,
112
130
  };
@@ -0,0 +1,127 @@
1
+ /** A field of a date or a time: input-time.ts takes it too. */
2
+ declare const _default: {
3
+ slots: {
4
+ base: string;
5
+ leadingIcon: string;
6
+ trailingIcon: string;
7
+ segment: string;
8
+ separatorIcon: string;
9
+ };
10
+ variants: {
11
+ size: {
12
+ xs: {
13
+ base: string;
14
+ separatorIcon: string;
15
+ segment: string;
16
+ leading: string;
17
+ trailing: string;
18
+ leadingIcon: string;
19
+ trailingIcon: string;
20
+ };
21
+ sm: {
22
+ base: string;
23
+ separatorIcon: string;
24
+ segment: string;
25
+ leading: string;
26
+ trailing: string;
27
+ leadingIcon: string;
28
+ trailingIcon: string;
29
+ };
30
+ md: {
31
+ base: string;
32
+ separatorIcon: string;
33
+ segment: string;
34
+ leading: string;
35
+ trailing: string;
36
+ leadingIcon: string;
37
+ trailingIcon: string;
38
+ };
39
+ lg: {
40
+ base: string;
41
+ separatorIcon: string;
42
+ segment: string;
43
+ leading: string;
44
+ trailing: string;
45
+ leadingIcon: string;
46
+ trailingIcon: string;
47
+ };
48
+ xl: {
49
+ base: string;
50
+ separatorIcon: string;
51
+ segment: string;
52
+ leading: string;
53
+ trailing: string;
54
+ leadingIcon: string;
55
+ trailingIcon: string;
56
+ };
57
+ };
58
+ variant: {
59
+ outline: string;
60
+ soft: string;
61
+ subtle: string;
62
+ ghost: string;
63
+ none: string;
64
+ };
65
+ };
66
+ compoundVariants: ({
67
+ variant: string;
68
+ highlight: boolean;
69
+ class: string;
70
+ color?: undefined;
71
+ } | {
72
+ variant: string;
73
+ highlight: boolean;
74
+ color: string;
75
+ class: string;
76
+ } | {
77
+ fixed: boolean;
78
+ size: string[];
79
+ class: string;
80
+ } | {
81
+ leading: boolean;
82
+ size: "xs" | "sm" | "md" | "lg" | "xl";
83
+ class: string;
84
+ } | {
85
+ trailing: boolean;
86
+ size: "xs" | "sm" | "md" | "lg" | "xl";
87
+ class: string;
88
+ } | {
89
+ loading: boolean;
90
+ leading: boolean;
91
+ class: {
92
+ leadingIcon: string;
93
+ trailingIcon?: undefined;
94
+ };
95
+ trailing?: undefined;
96
+ } | {
97
+ loading: boolean;
98
+ leading: boolean;
99
+ trailing: boolean;
100
+ class: {
101
+ trailingIcon: string;
102
+ leadingIcon?: undefined;
103
+ };
104
+ } | ({
105
+ highlight: boolean;
106
+ } & {
107
+ color: import("./shared.ts").Color;
108
+ class: string | Record<string, string>;
109
+ }) | {
110
+ variant: string[];
111
+ class: string;
112
+ } | {
113
+ fieldGroup: string[];
114
+ class: string;
115
+ highlight?: undefined;
116
+ } | {
117
+ fieldGroup: string[];
118
+ highlight: boolean;
119
+ class: string;
120
+ } | {
121
+ variant: string[];
122
+ class: {
123
+ segment: string;
124
+ };
125
+ })[];
126
+ };
127
+ export default _default;
@@ -0,0 +1,78 @@
1
+ import { fieldSizes, fieldWithinCompoundVariants, fieldWithinVariants, iconsWithinSizes, inGroup, } from "./field.js";
2
+ import { inputSlots } from "./input.js";
3
+ import { transition } from "./shared.js";
4
+ /*
5
+ * A date or a time typed a part at a time: the field is the text field, with its focus on the
6
+ * part being typed, and its parts, the segments, sit side by side in it. The part with the focus
7
+ * is on the tag's tint, the system's interactive tint, which reads on every variant of the field,
8
+ * and in forced colors in the selection's colors. A part not filled in yet and the literal between
9
+ * parts are the secondary text, an invalid date the danger text. Its icon is the one the app
10
+ * names, or Nuxt UI's, at the control's icon size.
11
+ */
12
+ /**
13
+ * A segment is as wide as its figures, in figures of one width, with the room of the tint around
14
+ * them: a day, a month, an hour and a minute two figures, a year four, whatever their value.
15
+ * Nuxt UI gives each a width of its own at each size, which a year in Inter overflows.
16
+ */
17
+ const segmentWidths = 'data-[segment=day]:w-auto data-[segment=month]:w-auto data-[segment=year]:w-auto not-data-[segment=literal]:w-auto data-[segment=day]:min-w-[calc(2ch+2*var(--ws-space-4))] data-[segment=month]:min-w-[calc(2ch+2*var(--ws-space-4))] data-[segment=year]:min-w-[calc(4ch+2*var(--ws-space-4))] data-[segment=hour]:min-w-[calc(2ch+2*var(--ws-space-4))] data-[segment=minute]:min-w-[calc(2ch+2*var(--ws-space-4))] data-[segment=second]:min-w-[calc(2ch+2*var(--ws-space-4))]';
18
+ /** The field at each size, and the icon between the two dates of a range at the control's size. */
19
+ const sizes = {
20
+ xs: {
21
+ ...fieldSizes.xs,
22
+ ...iconsWithinSizes.xs,
23
+ base: 'h-(--ws-control-height-xs) px-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))] py-0 gap-0 text-body-sm',
24
+ separatorIcon: 'size-(--ws-control-icon-size-xs)',
25
+ segment: segmentWidths,
26
+ },
27
+ sm: {
28
+ ...fieldSizes.sm,
29
+ ...iconsWithinSizes.sm,
30
+ base: 'h-(--ws-control-height-sm) px-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))] py-0 gap-0 text-body-sm',
31
+ separatorIcon: 'size-(--ws-control-icon-size-sm)',
32
+ segment: segmentWidths,
33
+ },
34
+ md: {
35
+ ...fieldSizes.md,
36
+ ...iconsWithinSizes.md,
37
+ base: 'h-(--ws-control-height-md) px-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))] py-0 gap-0 text-body',
38
+ separatorIcon: 'size-(--ws-control-icon-size-md)',
39
+ segment: segmentWidths,
40
+ },
41
+ lg: {
42
+ ...fieldSizes.lg,
43
+ ...iconsWithinSizes.lg,
44
+ base: 'h-(--ws-control-height-lg) px-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))] py-0 gap-0 text-body',
45
+ separatorIcon: 'size-(--ws-control-icon-size-lg)',
46
+ segment: segmentWidths,
47
+ },
48
+ xl: {
49
+ ...fieldSizes.xl,
50
+ ...iconsWithinSizes.xl,
51
+ base: 'h-(--ws-control-height-xl) px-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))] py-0 gap-0 text-body',
52
+ separatorIcon: 'size-(--ws-control-icon-size-xl)',
53
+ segment: segmentWidths,
54
+ },
55
+ };
56
+ /** A field of a date or a time: input-time.ts takes it too. */
57
+ export default {
58
+ slots: {
59
+ base: `rounded-(--ws-control-radius) font-sans cursor-text ${transition}`,
60
+ leadingIcon: inputSlots.leadingIcon,
61
+ trailingIcon: inputSlots.trailingIcon,
62
+ segment: `rounded-(--ws-radius-sm) px-(--ws-space-4) data-[segment=literal]:px-0 tabular-nums text-(--ws-field-text-rest) data-placeholder:text-text-secondary data-[segment=literal]:text-text-secondary data-invalid:text-danger-text data-disabled:opacity-100 data-disabled:text-(--ws-field-text-disabled) forced-colors:focus:bg-[Highlight] forced-colors:focus:text-[HighlightText] forced-colors:focus:forced-color-adjust-none ${transition}`,
63
+ separatorIcon: 'mx-(--ws-space-4) text-(--ws-field-icon-rest)',
64
+ },
65
+ variants: {
66
+ size: sizes,
67
+ variant: fieldWithinVariants,
68
+ },
69
+ compoundVariants: [
70
+ ...fieldWithinCompoundVariants,
71
+ ...inGroup,
72
+ // over Nuxt UI's fill of each variant, and under the pointer
73
+ {
74
+ variant: ['outline', 'soft', 'subtle', 'ghost', 'none'],
75
+ class: { segment: 'focus:bg-tag-bg focus:text-tag-text group-hover:focus:bg-tag-bg' },
76
+ },
77
+ ],
78
+ };
@@ -0,0 +1,210 @@
1
+ declare const _default: {
2
+ slots: {
3
+ trailing: string;
4
+ content: string;
5
+ arrow: string;
6
+ group: string;
7
+ empty: string;
8
+ label: string;
9
+ separator: string;
10
+ item: string;
11
+ itemLeadingIcon: string;
12
+ itemTrailing: string;
13
+ itemTrailingIcon: string;
14
+ itemDescription: string;
15
+ tagsItem: string;
16
+ tagsItemDelete: string;
17
+ tagsItemDeleteIcon: string;
18
+ tagsInput: string;
19
+ base: string;
20
+ leadingIcon: string;
21
+ trailingIcon: string;
22
+ };
23
+ variants: {
24
+ size: {
25
+ [k: string]: {
26
+ label: string;
27
+ item: string;
28
+ itemLeadingIcon: string;
29
+ itemTrailingIcon: string;
30
+ empty: string;
31
+ tagsItem: string;
32
+ tagsItemDeleteIcon: string;
33
+ base: string;
34
+ leading: string;
35
+ trailing: string;
36
+ leadingIcon: string;
37
+ trailingIcon: string;
38
+ } | {
39
+ label: string;
40
+ item: string;
41
+ itemLeadingIcon: string;
42
+ itemTrailingIcon: string;
43
+ empty: string;
44
+ tagsItem: string;
45
+ tagsItemDeleteIcon: string;
46
+ base: string;
47
+ leading: string;
48
+ trailing: string;
49
+ leadingIcon: string;
50
+ trailingIcon: string;
51
+ } | {
52
+ label: string;
53
+ item: string;
54
+ itemLeadingIcon: string;
55
+ itemTrailingIcon: string;
56
+ empty: string;
57
+ tagsItem: string;
58
+ tagsItemDeleteIcon: string;
59
+ base: string;
60
+ leading: string;
61
+ trailing: string;
62
+ leadingIcon: string;
63
+ trailingIcon: string;
64
+ } | {
65
+ label: string;
66
+ item: string;
67
+ itemLeadingIcon: string;
68
+ itemTrailingIcon: string;
69
+ empty: string;
70
+ tagsItem: string;
71
+ tagsItemDeleteIcon: string;
72
+ base: string;
73
+ leading: string;
74
+ trailing: string;
75
+ leadingIcon: string;
76
+ trailingIcon: string;
77
+ } | {
78
+ label: string;
79
+ item: string;
80
+ itemLeadingIcon: string;
81
+ itemTrailingIcon: string;
82
+ empty: string;
83
+ tagsItem: string;
84
+ tagsItemDeleteIcon: string;
85
+ base: string;
86
+ leading: string;
87
+ trailing: string;
88
+ leadingIcon: string;
89
+ trailingIcon: string;
90
+ };
91
+ };
92
+ variant: {
93
+ outline: string;
94
+ soft: string;
95
+ subtle: string;
96
+ ghost: string;
97
+ none: string;
98
+ };
99
+ virtualize: {
100
+ false: {
101
+ viewport: string;
102
+ };
103
+ };
104
+ };
105
+ compoundVariants: ({
106
+ variant: string;
107
+ highlight: boolean;
108
+ class: string;
109
+ color?: undefined;
110
+ } | {
111
+ variant: string;
112
+ highlight: boolean;
113
+ color: string;
114
+ class: string;
115
+ } | {
116
+ fixed: boolean;
117
+ size: string[];
118
+ class: string;
119
+ } | {
120
+ leading: boolean;
121
+ size: "xs" | "sm" | "md" | "lg" | "xl";
122
+ class: string;
123
+ } | {
124
+ trailing: boolean;
125
+ size: "xs" | "sm" | "md" | "lg" | "xl";
126
+ class: string;
127
+ } | {
128
+ loading: boolean;
129
+ leading: boolean;
130
+ class: {
131
+ leadingIcon: string;
132
+ trailingIcon?: undefined;
133
+ };
134
+ trailing?: undefined;
135
+ } | {
136
+ loading: boolean;
137
+ leading: boolean;
138
+ trailing: boolean;
139
+ class: {
140
+ trailingIcon: string;
141
+ leadingIcon?: undefined;
142
+ };
143
+ } | ({
144
+ highlight: boolean;
145
+ } & {
146
+ color: import("./shared.ts").Color;
147
+ class: string | Record<string, string>;
148
+ }) | {
149
+ variant: string[];
150
+ class: string;
151
+ } | {
152
+ fieldGroup: string[];
153
+ class: {
154
+ root: string;
155
+ };
156
+ highlight?: undefined;
157
+ } | {
158
+ fieldGroup: string[];
159
+ highlight: boolean;
160
+ class: {
161
+ root: string;
162
+ };
163
+ } | {
164
+ variant: string;
165
+ size: string;
166
+ class: {
167
+ leading: string;
168
+ trailing: string;
169
+ };
170
+ } | {
171
+ multiple: boolean;
172
+ size: "xs" | "sm" | "md" | "lg" | "xl";
173
+ class: {
174
+ leading: string;
175
+ trailing: string;
176
+ base: string;
177
+ } | {
178
+ leading: string;
179
+ trailing: string;
180
+ base: string;
181
+ } | {
182
+ leading: string;
183
+ trailing: string;
184
+ base: string;
185
+ } | {
186
+ leading: string;
187
+ trailing: string;
188
+ base: string;
189
+ } | {
190
+ leading: string;
191
+ trailing: string;
192
+ base: string;
193
+ };
194
+ } | {
195
+ multiple: boolean;
196
+ variant: string;
197
+ class: string;
198
+ } | {
199
+ multiple: boolean;
200
+ class: string;
201
+ variant?: undefined;
202
+ } | {
203
+ multiple: boolean;
204
+ variant: string[];
205
+ class: {
206
+ tagsItem: string;
207
+ };
208
+ })[];
209
+ };
210
+ export default _default;
@@ -0,0 +1,83 @@
1
+ import { fieldCompoundVariants, fieldSizes, fieldVariants, fieldWithinCompoundVariants, fieldWithinVariants, iconsWithinSizes, inGroupRoot, } from "./field.js";
2
+ import { bareIcons, inputSlots } from "./input.js";
3
+ import { listMotion, selectSlots, selectVariants } from "./select.js";
4
+ import { tag, tagDelete, tagDeleteIcon, tagDeleteIconSize, tagOfField, tagOnRaised, tagsFieldSizes, tagsInput, } from "./tags.js";
5
+ /*
6
+ * A text field whose list opens under it as it is typed in: the field is the text field, and the
7
+ * list draws what the select menu's draws, from the select menu's theme. With several values the
8
+ * field is a field of tags, which tags.ts draws, with its focus on the text field inside it.
9
+ */
10
+ const sizes = Object.fromEntries(['xs', 'sm', 'md', 'lg', 'xl'].map((size) => {
11
+ const { label, item, itemLeadingIcon, itemTrailingIcon, empty } = selectVariants.size[size];
12
+ return [
13
+ size,
14
+ {
15
+ ...fieldSizes[size],
16
+ label,
17
+ item,
18
+ itemLeadingIcon,
19
+ itemTrailingIcon,
20
+ empty,
21
+ tagsItem: tagOfField[size],
22
+ tagsItemDeleteIcon: tagDeleteIconSize,
23
+ },
24
+ ];
25
+ }));
26
+ /** With several values, the field of tags at each size, its icons inside its edge. */
27
+ const tagsFields = ['xs', 'sm', 'md', 'lg', 'xl'].map((size) => ({
28
+ multiple: true,
29
+ size,
30
+ class: { base: tagsFieldSizes[size], ...iconsWithinSizes[size] },
31
+ }));
32
+ export default {
33
+ slots: {
34
+ ...inputSlots,
35
+ trailing: 'disabled:opacity-100',
36
+ // the list's panel, which Nuxt UI opens with its own motion
37
+ content: `${selectSlots.content} ${listMotion}`,
38
+ arrow: selectSlots.arrow,
39
+ group: selectSlots.group,
40
+ empty: selectSlots.empty,
41
+ label: selectSlots.label,
42
+ separator: selectSlots.separator,
43
+ item: selectSlots.item,
44
+ itemLeadingIcon: selectSlots.itemLeadingIcon,
45
+ itemTrailing: selectSlots.itemTrailing,
46
+ itemTrailingIcon: selectSlots.itemTrailingIcon,
47
+ itemDescription: selectSlots.itemDescription,
48
+ tagsItem: tag,
49
+ tagsItemDelete: tagDelete,
50
+ tagsItemDeleteIcon: tagDeleteIcon,
51
+ tagsInput,
52
+ },
53
+ variants: {
54
+ size: sizes,
55
+ variant: fieldVariants,
56
+ virtualize: {
57
+ false: { viewport: selectSlots.viewport },
58
+ },
59
+ },
60
+ compoundVariants: [
61
+ // Nuxt UI takes the edge off a field of one value after the variants have drawn it, and
62
+ // fades it disabled and dims its placeholder: the text field's are drawn over them
63
+ {
64
+ multiple: false,
65
+ variant: ['outline', 'soft', 'subtle', 'ghost'],
66
+ class: 'border-(length:--ws-control-border-width-rest)',
67
+ },
68
+ { multiple: false, class: 'disabled:opacity-100 placeholder:text-text-secondary' },
69
+ // with several values the field is one with the focus inside it, disabled by data-disabled
70
+ ...Object.entries(fieldWithinVariants).map(([variant, classes]) => ({
71
+ multiple: true,
72
+ variant,
73
+ class: classes,
74
+ })),
75
+ ...bareIcons,
76
+ ...tagsFields,
77
+ ...fieldCompoundVariants,
78
+ ...inGroupRoot,
79
+ // with several values the field shows the focus of the text field inside it
80
+ ...fieldWithinCompoundVariants.map((compound) => ({ ...compound, multiple: true })),
81
+ { multiple: true, variant: ['soft', 'subtle'], class: { tagsItem: tagOnRaised } },
82
+ ],
83
+ };
@@ -0,0 +1,77 @@
1
+ declare const _default: {
2
+ slots: {
3
+ base: string;
4
+ increment: string;
5
+ decrement: string;
6
+ };
7
+ variants: {
8
+ size: {
9
+ xs: string;
10
+ sm: string;
11
+ md: string;
12
+ lg: string;
13
+ xl: string;
14
+ };
15
+ variant: {
16
+ outline: string;
17
+ soft: string;
18
+ subtle: string;
19
+ ghost: string;
20
+ none: string;
21
+ };
22
+ };
23
+ compoundVariants: ({
24
+ variant: string;
25
+ highlight: boolean;
26
+ class: string;
27
+ color?: undefined;
28
+ } | {
29
+ variant: string;
30
+ highlight: boolean;
31
+ color: string;
32
+ class: string;
33
+ } | {
34
+ fixed: boolean;
35
+ size: string[];
36
+ class: string;
37
+ } | ({
38
+ highlight: boolean;
39
+ } & {
40
+ color: import("./shared.ts").Color;
41
+ class: string | Record<string, string>;
42
+ }) | {
43
+ variant: string[];
44
+ class: string;
45
+ } | {
46
+ fieldGroup: string[];
47
+ class: {
48
+ root: string;
49
+ };
50
+ highlight?: undefined;
51
+ } | {
52
+ fieldGroup: string[];
53
+ highlight: boolean;
54
+ class: {
55
+ root: string;
56
+ };
57
+ } | {
58
+ decrement: boolean;
59
+ size: "xs" | "sm" | "md" | "lg" | "xl";
60
+ class: string;
61
+ } | {
62
+ increment: boolean;
63
+ size: "xs" | "sm" | "md" | "lg" | "xl";
64
+ class: string;
65
+ } | {
66
+ orientation: string;
67
+ size: "xs" | "sm" | "md" | "lg" | "xl";
68
+ class: {
69
+ decrement: string;
70
+ increment: string;
71
+ };
72
+ } | {
73
+ orientation: string;
74
+ class: string;
75
+ })[];
76
+ };
77
+ export default _default;