tailwind-variants 3.2.1 → 3.3.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/README.md +114 -50
- package/dist/chunk-2BFDQGZN.cjs +160 -0
- package/dist/chunk-AUQ4UGQK.js +673 -0
- package/dist/chunk-ICHZ2N3R.cjs +677 -0
- package/dist/chunk-OYFAXDFZ.js +147 -0
- package/dist/config-bO3A8WhU.d.cts +112 -0
- package/dist/config-bO3A8WhU.d.ts +112 -0
- package/dist/config.cjs +2 -0
- package/dist/config.d.cts +1 -0
- package/dist/config.d.ts +1 -23
- package/dist/config.js +1 -0
- package/dist/index.cjs +3314 -53
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +17 -115
- package/dist/index.js +3313 -49
- package/dist/lite.cjs +17 -12
- package/dist/lite.d.cts +10 -0
- package/dist/lite.d.ts +8 -11
- package/dist/lite.js +15 -8
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +168 -0
- package/dist/types.d.ts +122 -291
- package/dist/types.js +1 -0
- package/dist/utils.cjs +12 -12
- package/dist/utils.d.cts +16 -0
- package/dist/utils.d.ts +16 -32
- package/dist/utils.js +1 -1
- package/package.json +62 -66
- package/dist/chunk-2JY7EID6.cjs +0 -124
- package/dist/chunk-52Z2HSI4.cjs +0 -273
- package/dist/chunk-LQJYWU4O.js +0 -112
- package/dist/chunk-RZF76H2U.js +0 -269
package/dist/types.d.ts
CHANGED
|
@@ -1,300 +1,134 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export type {ClassValue};
|
|
11
|
-
|
|
12
|
-
export type ClassProp<V extends unknown = ClassValue> =
|
|
13
|
-
| {class?: V; className?: never}
|
|
14
|
-
| {class?: never; className?: V};
|
|
15
|
-
|
|
1
|
+
import { C as ClassNameValue, a as TVConfig } from './config-bO3A8WhU.js';
|
|
2
|
+
|
|
3
|
+
type ClassProp<V = ClassNameValue> = {
|
|
4
|
+
class?: V;
|
|
5
|
+
className?: never;
|
|
6
|
+
} | {
|
|
7
|
+
class?: never;
|
|
8
|
+
className?: V;
|
|
9
|
+
};
|
|
16
10
|
type TVBaseName = "base";
|
|
17
|
-
|
|
18
11
|
type TVScreens = "initial";
|
|
19
|
-
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type CnClassValue =
|
|
33
|
-
| string
|
|
34
|
-
| number
|
|
35
|
-
| bigint
|
|
36
|
-
| boolean
|
|
37
|
-
| null
|
|
38
|
-
| undefined
|
|
39
|
-
| CnClassDictionary
|
|
40
|
-
| CnClassArray;
|
|
41
|
-
|
|
12
|
+
type TVSlots = Record<string, ClassNameValue> | undefined;
|
|
13
|
+
type TVVariantsShape = Record<string, Record<string, unknown>> | undefined;
|
|
14
|
+
interface TVReturnTypeLike<V extends TVVariantsShape, S extends TVSlots> {
|
|
15
|
+
(...args: any[]): any;
|
|
16
|
+
variants: V;
|
|
17
|
+
slots: S;
|
|
18
|
+
}
|
|
19
|
+
type OmitUndefined<T> = T extends undefined ? never : T;
|
|
20
|
+
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
21
|
+
type VariantValue<V, K> = K extends keyof V ? StringToBoolean<keyof V[K]> : never;
|
|
22
|
+
type VariantValueWithBooleanUndefined<V, K> = VariantValue<V, K> | (boolean extends VariantValue<V, K> ? undefined : never);
|
|
23
|
+
type CnClassValue = string | number | bigint | boolean | null | undefined | CnClassDictionary | CnClassArray;
|
|
42
24
|
interface CnClassDictionary {
|
|
43
|
-
|
|
25
|
+
[key: string]: any;
|
|
44
26
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export type WithInitialScreen<T extends Array<string>> = ["initial", ...T];
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* ----------------------------------------------------------------------
|
|
59
|
-
* TV Types
|
|
60
|
-
* ----------------------------------------------------------------------
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
type TVSlotsWithBase<S extends TVSlots, B extends ClassValue> = B extends undefined
|
|
64
|
-
? keyof S
|
|
65
|
-
: keyof S | TVBaseName;
|
|
66
|
-
|
|
67
|
-
type SlotsClassValue<S extends TVSlots, B extends ClassValue> = {
|
|
68
|
-
[K in TVSlotsWithBase<S, B>]?: ClassValue;
|
|
27
|
+
interface CnClassArray extends Array<CnClassValue> {
|
|
28
|
+
}
|
|
29
|
+
type CnOptions = CnClassValue[];
|
|
30
|
+
type CnReturn = string | undefined;
|
|
31
|
+
type isTrueOrArray<T> = T extends true | unknown[] ? true : false;
|
|
32
|
+
type WithInitialScreen<T extends Array<string>> = ["initial", ...T];
|
|
33
|
+
type TVSlotsWithBase<S extends TVSlots, B extends ClassNameValue> = keyof S | (B extends undefined ? never : TVBaseName);
|
|
34
|
+
type SlotsClassValue<S extends TVSlots, B extends ClassNameValue> = {
|
|
35
|
+
[K in TVSlotsWithBase<S, B>]?: ClassNameValue;
|
|
69
36
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
: {
|
|
74
|
-
[key: string]: {
|
|
75
|
-
[key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassValue : ClassValue;
|
|
76
|
-
};
|
|
37
|
+
type TVVariantsDefault<S extends TVSlots, B extends ClassNameValue> = S extends undefined ? {} : {
|
|
38
|
+
[key: string]: {
|
|
39
|
+
[key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
|
|
77
40
|
};
|
|
78
|
-
|
|
79
|
-
export type TVVariants<
|
|
80
|
-
S extends TVSlots | undefined,
|
|
81
|
-
B extends ClassValue | undefined = undefined,
|
|
82
|
-
EV extends TVVariants<ES> | undefined = undefined,
|
|
83
|
-
ES extends TVSlots | undefined = undefined,
|
|
84
|
-
> = EV extends undefined
|
|
85
|
-
? TVVariantsDefault<S, B>
|
|
86
|
-
:
|
|
87
|
-
| {
|
|
88
|
-
[K in keyof EV]: {
|
|
89
|
-
[K2 in keyof EV[K]]: S extends TVSlots
|
|
90
|
-
? SlotsClassValue<S, B> | ClassValue
|
|
91
|
-
: ClassValue;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
| TVVariantsDefault<S, B>;
|
|
95
|
-
|
|
96
|
-
export type TVCompoundVariants<
|
|
97
|
-
V extends TVVariants<S>,
|
|
98
|
-
S extends TVSlots,
|
|
99
|
-
B extends ClassValue,
|
|
100
|
-
EV extends TVVariants<ES>,
|
|
101
|
-
ES extends TVSlots,
|
|
102
|
-
> = Array<
|
|
103
|
-
{
|
|
104
|
-
[K in keyof V | keyof EV]?:
|
|
105
|
-
| (K extends keyof V ? StringToBoolean<keyof V[K]> : never)
|
|
106
|
-
| (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never)
|
|
107
|
-
| (K extends keyof V ? StringToBoolean<keyof V[K]>[] : never);
|
|
108
|
-
} & ClassProp<SlotsClassValue<S, B> | ClassValue>
|
|
109
|
-
>;
|
|
110
|
-
|
|
111
|
-
export type TVCompoundSlots<
|
|
112
|
-
V extends TVVariants<S>,
|
|
113
|
-
S extends TVSlots,
|
|
114
|
-
B extends ClassValue,
|
|
115
|
-
> = Array<
|
|
116
|
-
V extends undefined
|
|
117
|
-
? {
|
|
118
|
-
slots: Array<TVSlotsWithBase<S, B>>;
|
|
119
|
-
} & ClassProp
|
|
120
|
-
: {
|
|
121
|
-
slots: Array<TVSlotsWithBase<S, B>>;
|
|
122
|
-
} & {
|
|
123
|
-
[K in keyof V]?: StringToBoolean<keyof V[K]> | StringToBoolean<keyof V[K]>[];
|
|
124
|
-
} & ClassProp
|
|
125
|
-
>;
|
|
126
|
-
|
|
127
|
-
export type TVDefaultVariants<
|
|
128
|
-
V extends TVVariants<S>,
|
|
129
|
-
S extends TVSlots,
|
|
130
|
-
EV extends TVVariants<ES>,
|
|
131
|
-
ES extends TVSlots,
|
|
132
|
-
> = {
|
|
133
|
-
[K in keyof V | keyof EV]?:
|
|
134
|
-
| (K extends keyof V ? StringToBoolean<keyof V[K]> : never)
|
|
135
|
-
| (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never);
|
|
136
41
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
42
|
+
type TVVariants<S extends TVSlots | undefined, B extends ClassNameValue | undefined = undefined, EV extends TVVariantsShape = undefined, _ES extends TVSlots | undefined = undefined> = EV extends undefined ? TVVariantsDefault<S, B> : {
|
|
43
|
+
[K in keyof EV]: {
|
|
44
|
+
[K2 in keyof EV[K]]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
|
|
45
|
+
};
|
|
46
|
+
} | TVVariantsDefault<S, B>;
|
|
47
|
+
type TVCompoundVariants<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, _ES extends TVSlots> = Array<{
|
|
48
|
+
[K in keyof V | keyof EV]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<EV, K> | (K extends keyof V ? VariantValueWithBooleanUndefined<V, K>[] : never);
|
|
49
|
+
} & ClassProp<SlotsClassValue<S, B> | ClassNameValue>>;
|
|
50
|
+
type TVCompoundSlots<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue> = Array<{
|
|
51
|
+
slots: Array<TVSlotsWithBase<S, B>>;
|
|
52
|
+
} & {
|
|
53
|
+
[K in keyof V]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<V, K>[];
|
|
54
|
+
} & ClassProp>;
|
|
55
|
+
type TVDefaultVariants<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = {
|
|
56
|
+
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K>;
|
|
140
57
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
V extends TVVariants<S>,
|
|
144
|
-
S extends TVSlots,
|
|
145
|
-
EV extends TVVariants<ES>,
|
|
146
|
-
ES extends TVSlots,
|
|
147
|
-
> = EV extends undefined
|
|
148
|
-
? V extends undefined
|
|
149
|
-
? ClassProp<ClassValue>
|
|
150
|
-
: {
|
|
151
|
-
[K in keyof V]?: StringToBoolean<keyof V[K]> | undefined;
|
|
152
|
-
} & ClassProp<ClassValue>
|
|
153
|
-
: V extends undefined
|
|
154
|
-
? {
|
|
155
|
-
[K in keyof EV]?: StringToBoolean<keyof EV[K]> | undefined;
|
|
156
|
-
} & ClassProp<ClassValue>
|
|
157
|
-
: {
|
|
158
|
-
[K in keyof V | keyof EV]?:
|
|
159
|
-
| (K extends keyof V ? StringToBoolean<keyof V[K]> : never)
|
|
160
|
-
| (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never)
|
|
161
|
-
| undefined;
|
|
162
|
-
} & ClassProp<ClassValue>;
|
|
163
|
-
|
|
164
|
-
export type TVVariantKeys<V extends TVVariants<S>, S extends TVSlots> = V extends Object
|
|
165
|
-
? Array<keyof V>
|
|
166
|
-
: undefined;
|
|
167
|
-
|
|
168
|
-
export type TVReturnProps<
|
|
169
|
-
V extends TVVariants<S>,
|
|
170
|
-
S extends TVSlots,
|
|
171
|
-
B extends ClassValue,
|
|
172
|
-
EV extends TVVariants<ES>,
|
|
173
|
-
ES extends TVSlots,
|
|
174
|
-
// @ts-expect-error
|
|
175
|
-
E extends TVReturnType = undefined,
|
|
176
|
-
> = {
|
|
177
|
-
extend: E;
|
|
178
|
-
base: B;
|
|
179
|
-
slots: S;
|
|
180
|
-
variants: V;
|
|
181
|
-
defaultVariants: TVDefaultVariants<V, S, EV, ES>;
|
|
182
|
-
compoundVariants: TVCompoundVariants<V, S, B, EV, ES>;
|
|
183
|
-
compoundSlots: TVCompoundSlots<V, S, B>;
|
|
184
|
-
variantKeys: TVVariantKeys<V, S>;
|
|
58
|
+
type TVScreenPropsValue<V extends TVVariantsShape, _S extends TVSlots, K extends keyof V> = {
|
|
59
|
+
[Screen in TVScreens]?: StringToBoolean<keyof V[K]>;
|
|
185
60
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
61
|
+
type TVProps<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = EV extends undefined ? V extends undefined ? ClassProp<ClassNameValue> : {
|
|
62
|
+
[K in keyof V]?: VariantValue<V, K> | undefined;
|
|
63
|
+
} & ClassProp<ClassNameValue> : V extends undefined ? {
|
|
64
|
+
[K in keyof EV]?: VariantValue<EV, K> | undefined;
|
|
65
|
+
} & ClassProp<ClassNameValue> : {
|
|
66
|
+
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K> | undefined;
|
|
67
|
+
} & ClassProp<ClassNameValue>;
|
|
68
|
+
type TVVariantKeys<V extends TVVariantsShape, _S extends TVSlots> = V extends undefined ? undefined : Array<keyof V>;
|
|
69
|
+
type TVMergedVariants<V extends TVVariantsShape, EV extends TVVariantsShape> = V extends undefined ? EV : EV extends undefined ? V : V & EV;
|
|
70
|
+
type TVMergedSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES : ES extends undefined ? S : S & ES;
|
|
71
|
+
interface TVReturnProps<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> {
|
|
72
|
+
extend: E;
|
|
73
|
+
base: B;
|
|
74
|
+
slots: TVMergedSlots<S, ES>;
|
|
75
|
+
variants: TVMergedVariants<V, EV>;
|
|
76
|
+
defaultVariants: TVDefaultVariants<V, S, EV, ES>;
|
|
77
|
+
compoundVariants: TVCompoundVariants<V, S, B, EV, ES>;
|
|
78
|
+
compoundSlots: TVCompoundSlots<V, S, B>;
|
|
79
|
+
variantKeys: TVVariantKeys<TVMergedVariants<V, EV>, TVMergedSlots<S, ES>>;
|
|
80
|
+
}
|
|
81
|
+
type HasSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES extends undefined ? false : true : true;
|
|
82
|
+
interface TVReturnType<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> extends TVReturnProps<V, S, B, EV, ES, E> {
|
|
83
|
+
(props?: TVProps<V, S, EV, ES>): HasSlots<S, ES> extends true ? {
|
|
84
|
+
[K in keyof (ES extends undefined ? {} : ES)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
|
|
85
|
+
} & {
|
|
208
86
|
[K in keyof (S extends undefined ? {} : S)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
|
|
209
|
-
|
|
210
|
-
[K in
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
export type TV = {
|
|
216
|
-
<
|
|
217
|
-
V extends TVVariants<S, B, EV>,
|
|
218
|
-
CV extends TVCompoundVariants<V, S, B, EV, ES>,
|
|
219
|
-
DV extends TVDefaultVariants<V, S, EV, ES>,
|
|
220
|
-
B extends ClassValue = undefined,
|
|
221
|
-
S extends TVSlots = undefined,
|
|
222
|
-
// @ts-expect-error
|
|
223
|
-
E extends TVReturnType = TVReturnType<
|
|
224
|
-
V,
|
|
225
|
-
S,
|
|
226
|
-
B,
|
|
227
|
-
// @ts-expect-error
|
|
228
|
-
EV extends undefined ? {} : EV,
|
|
229
|
-
// @ts-expect-error
|
|
230
|
-
ES extends undefined ? {} : ES
|
|
231
|
-
>,
|
|
232
|
-
EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"],
|
|
233
|
-
ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined,
|
|
234
|
-
>(
|
|
235
|
-
options: {
|
|
236
|
-
/**
|
|
237
|
-
* Extend allows for easy composition of components.
|
|
238
|
-
* @see https://www.tailwind-variants.org/docs/composing-components
|
|
239
|
-
*/
|
|
240
|
-
extend?: E;
|
|
241
|
-
/**
|
|
242
|
-
* Base allows you to set a base class for a component.
|
|
243
|
-
*/
|
|
244
|
-
base?: B;
|
|
245
|
-
/**
|
|
246
|
-
* Slots allow you to separate a component into multiple parts.
|
|
247
|
-
* @see https://www.tailwind-variants.org/docs/slots
|
|
248
|
-
*/
|
|
249
|
-
slots?: S;
|
|
250
|
-
/**
|
|
251
|
-
* Variants allow you to create multiple versions of the same component.
|
|
252
|
-
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
|
|
253
|
-
*/
|
|
254
|
-
variants?: V;
|
|
255
|
-
/**
|
|
256
|
-
* Compound variants allow you to apply classes to multiple variants at once.
|
|
257
|
-
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
|
|
258
|
-
*/
|
|
259
|
-
compoundVariants?: CV;
|
|
260
|
-
/**
|
|
261
|
-
* Compound slots allow you to apply classes to multiple slots at once.
|
|
262
|
-
*/
|
|
263
|
-
compoundSlots?: TVCompoundSlots<V, S, B>;
|
|
264
|
-
/**
|
|
265
|
-
* Default variants allow you to set default variants for a component.
|
|
266
|
-
* @see https://www.tailwind-variants.org/docs/variants#default-variants
|
|
267
|
-
*/
|
|
268
|
-
defaultVariants?: DV;
|
|
269
|
-
},
|
|
87
|
+
} & {
|
|
88
|
+
[K in TVBaseName]: (slotProps?: TVProps<V, S, EV, ES>) => string;
|
|
89
|
+
} : string;
|
|
90
|
+
}
|
|
91
|
+
type TV = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
|
|
270
92
|
/**
|
|
271
|
-
*
|
|
272
|
-
* @see https://www.tailwind-variants.org/docs/
|
|
93
|
+
* Extend allows for easy composition of components.
|
|
94
|
+
* @see https://www.tailwind-variants.org/docs/composing-components
|
|
273
95
|
*/
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
96
|
+
extend?: E;
|
|
97
|
+
/**
|
|
98
|
+
* Base allows you to set a base class for a component.
|
|
99
|
+
*/
|
|
100
|
+
base?: B;
|
|
101
|
+
/**
|
|
102
|
+
* Slots allow you to separate a component into multiple parts.
|
|
103
|
+
* @see https://www.tailwind-variants.org/docs/slots
|
|
104
|
+
*/
|
|
105
|
+
slots?: S;
|
|
106
|
+
/**
|
|
107
|
+
* Variants allow you to create multiple versions of the same component.
|
|
108
|
+
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
|
|
109
|
+
*/
|
|
110
|
+
variants?: V;
|
|
111
|
+
/**
|
|
112
|
+
* Compound variants allow you to apply classes to multiple variants at once.
|
|
113
|
+
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
|
|
114
|
+
*/
|
|
115
|
+
compoundVariants?: CV;
|
|
116
|
+
/**
|
|
117
|
+
* Compound slots allow you to apply classes to multiple slots at once.
|
|
118
|
+
*/
|
|
119
|
+
compoundSlots?: TVCompoundSlots<V, S, B>;
|
|
120
|
+
/**
|
|
121
|
+
* Default variants allow you to set default variants for a component.
|
|
122
|
+
* @see https://www.tailwind-variants.org/docs/variants#default-variants
|
|
123
|
+
*/
|
|
124
|
+
defaultVariants?: DV;
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* The config object allows you to modify the default configuration.
|
|
128
|
+
* @see https://www.tailwind-variants.org/docs/api-reference#config-optional
|
|
129
|
+
*/
|
|
130
|
+
config?: TVConfig) => TVReturnType<V, S, B, EV, ES, E>;
|
|
131
|
+
type TVLite = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
|
|
298
132
|
/**
|
|
299
133
|
* Extend allows for easy composition of components.
|
|
300
134
|
* @see https://www.tailwind-variants.org/docs/composing-components
|
|
@@ -328,10 +162,7 @@ export type TVLite = {
|
|
|
328
162
|
* @see https://www.tailwind-variants.org/docs/variants#default-variants
|
|
329
163
|
*/
|
|
330
164
|
defaultVariants?: DV;
|
|
331
|
-
|
|
332
|
-
|
|
165
|
+
}) => TVReturnType<V, S, B, EV, ES, E>;
|
|
166
|
+
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
|
|
333
167
|
|
|
334
|
-
export type
|
|
335
|
-
OmitUndefined<Parameters<Component>[0]>,
|
|
336
|
-
"class" | "className"
|
|
337
|
-
>;
|
|
168
|
+
export { type ClassProp, ClassNameValue as ClassValue, type CnOptions, type CnReturn, type OmitUndefined, type StringToBoolean, type TV, type TVCompoundSlots, type TVCompoundVariants, type TVDefaultVariants, type TVLite, type TVProps, type TVReturnProps, type TVReturnType, type TVReturnTypeLike, type TVScreenPropsValue, type TVVariantKeys, type TVVariants, type VariantProps, type WithInitialScreen, type isTrueOrArray };
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/utils.cjs
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2BFDQGZN_cjs = require('./chunk-2BFDQGZN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "cx", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk2BFDQGZN_cjs.cx; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "falsyToString", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk2BFDQGZN_cjs.falsyToString; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "flat", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk2BFDQGZN_cjs.flat; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "flatArray", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk2BFDQGZN_cjs.flatArray; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "flatMergeArrays", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk2BFDQGZN_cjs.flatMergeArrays; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "isBoolean", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk2BFDQGZN_cjs.isBoolean; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "isEmptyObject", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk2BFDQGZN_cjs.isEmptyObject; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "isEqual", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk2BFDQGZN_cjs.isEqual; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "joinObjects", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk2BFDQGZN_cjs.joinObjects; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "mergeObjects", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk2BFDQGZN_cjs.mergeObjects; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "removeExtraSpaces", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunk2BFDQGZN_cjs.removeExtraSpaces; }
|
|
50
50
|
});
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CnOptions, CnReturn } from './types.cjs';
|
|
2
|
+
import './config-bO3A8WhU.cjs';
|
|
3
|
+
|
|
4
|
+
declare const removeExtraSpaces: (str: string) => string;
|
|
5
|
+
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
|
|
6
|
+
declare const falsyToString: <T>(value: T) => T | string;
|
|
7
|
+
declare const isEmptyObject: (obj: unknown) => boolean;
|
|
8
|
+
declare const isEqual: (obj1: object, obj2: object) => boolean;
|
|
9
|
+
declare const isBoolean: (value: unknown) => boolean;
|
|
10
|
+
declare const joinObjects: <T extends Record<string, unknown>, U extends Record<string, unknown>>(obj1: T, obj2: U) => T & U;
|
|
11
|
+
declare const flat: <T>(arr: unknown[], target: T[]) => void;
|
|
12
|
+
declare function flatArray<T>(arr: unknown[]): T[];
|
|
13
|
+
declare const flatMergeArrays: <T>(...arrays: unknown[][]) => T[];
|
|
14
|
+
declare const mergeObjects: <T extends object, U extends object>(obj1: T, obj2: U) => Record<string, unknown>;
|
|
15
|
+
|
|
16
|
+
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
) => Record<string, unknown>;
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
export declare const isEqual: (obj1: object, obj2: object) => boolean;
|
|
19
|
-
|
|
20
|
-
export declare const isBoolean: (value: unknown) => boolean;
|
|
21
|
-
|
|
22
|
-
export declare const joinObjects: <
|
|
23
|
-
T extends Record<string, unknown>,
|
|
24
|
-
U extends Record<string, unknown>,
|
|
25
|
-
>(
|
|
26
|
-
obj1: T,
|
|
27
|
-
obj2: U,
|
|
28
|
-
) => T & U;
|
|
29
|
-
|
|
30
|
-
export declare const flat: <T>(arr: unknown[], target: T[]) => void;
|
|
31
|
-
|
|
32
|
-
export declare const cx: <T extends CnOptions>(...classes: T) => CnReturn;
|
|
1
|
+
import { CnOptions, CnReturn } from './types.js';
|
|
2
|
+
import './config-bO3A8WhU.js';
|
|
3
|
+
|
|
4
|
+
declare const removeExtraSpaces: (str: string) => string;
|
|
5
|
+
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
|
|
6
|
+
declare const falsyToString: <T>(value: T) => T | string;
|
|
7
|
+
declare const isEmptyObject: (obj: unknown) => boolean;
|
|
8
|
+
declare const isEqual: (obj1: object, obj2: object) => boolean;
|
|
9
|
+
declare const isBoolean: (value: unknown) => boolean;
|
|
10
|
+
declare const joinObjects: <T extends Record<string, unknown>, U extends Record<string, unknown>>(obj1: T, obj2: U) => T & U;
|
|
11
|
+
declare const flat: <T>(arr: unknown[], target: T[]) => void;
|
|
12
|
+
declare function flatArray<T>(arr: unknown[]): T[];
|
|
13
|
+
declare const flatMergeArrays: <T>(...arrays: unknown[][]) => T[];
|
|
14
|
+
declare const mergeObjects: <T extends object, U extends object>(obj1: T, obj2: U) => Record<string, unknown>;
|
|
15
|
+
|
|
16
|
+
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces };
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces } from './chunk-
|
|
1
|
+
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces } from './chunk-OYFAXDFZ.js';
|