@splenddev/kreativ-ui 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.
- package/README.md +1133 -1365
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +783 -95
- package/dist/index.d.ts +783 -95
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +99 -66
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, ReactElement, HTMLAttributes, TextareaHTMLAttributes, RefObject, JSX } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
6
|
type Orientation = "horizontal" | "vertical";
|
|
7
7
|
type SizeValue = Size | (string & {});
|
|
8
8
|
type BaseVariant = "solid" | "outline" | "ghost" | "soft";
|
|
9
|
-
type
|
|
9
|
+
type BaseColor = "brand" | "destructive" | "success" | "warning" | "info" | "neutral" | "white";
|
|
10
|
+
type Variant = BaseVariant;
|
|
10
11
|
interface Styleable {
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
@@ -14,99 +15,785 @@ type BaseTransition = "none" | "fade" | "rotate" | "slide" | "scale";
|
|
|
14
15
|
type DeepPartial<T> = {
|
|
15
16
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
interface
|
|
21
|
-
|
|
18
|
+
type CSSPropertiesWithVars = CSSProperties & {
|
|
19
|
+
[key: `--${string}`]: string | number | undefined;
|
|
20
|
+
};
|
|
21
|
+
interface BaseProps {
|
|
22
|
+
/**
|
|
23
|
+
* Additional CSS classes.
|
|
24
|
+
*/
|
|
25
|
+
className?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Inline styles.
|
|
28
|
+
*/
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
/**
|
|
31
|
+
* Component content.
|
|
32
|
+
*/
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Removes the component's default styling.
|
|
36
|
+
*/
|
|
37
|
+
unstyled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface SizeProps {
|
|
40
|
+
/**
|
|
41
|
+
* Component size.
|
|
42
|
+
*/
|
|
22
43
|
size?: SizeValue;
|
|
44
|
+
}
|
|
45
|
+
interface ColorProps<Color extends string = string> {
|
|
46
|
+
/**
|
|
47
|
+
* Component color.
|
|
48
|
+
*/
|
|
49
|
+
color?: Color;
|
|
50
|
+
}
|
|
51
|
+
interface VariantProps<Variant extends string = string> {
|
|
52
|
+
/**
|
|
53
|
+
* Visual variant.
|
|
54
|
+
*/
|
|
55
|
+
variant?: Variant;
|
|
56
|
+
}
|
|
57
|
+
interface DisabledProps {
|
|
58
|
+
/**
|
|
59
|
+
* Disables the component.
|
|
60
|
+
*/
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface LoadingProps {
|
|
64
|
+
/**
|
|
65
|
+
* Displays a loading state and prevents interaction.
|
|
66
|
+
*/
|
|
23
67
|
isLoading?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface FullWidthProps {
|
|
70
|
+
/**
|
|
71
|
+
* Makes the component span the available width.
|
|
72
|
+
*/
|
|
73
|
+
fullWidth?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface ClearableProps {
|
|
76
|
+
/**
|
|
77
|
+
* Allows the current value to be cleared.
|
|
78
|
+
*/
|
|
79
|
+
clearable?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Called when the current value is cleared.
|
|
82
|
+
*/
|
|
83
|
+
onClear?: () => void;
|
|
84
|
+
}
|
|
85
|
+
interface StateProps {
|
|
86
|
+
/**
|
|
87
|
+
* Displays an error state.
|
|
88
|
+
*/
|
|
89
|
+
error?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Displays a success state.
|
|
92
|
+
*/
|
|
93
|
+
success?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type ButtonSize = SizeValue | "icon";
|
|
97
|
+
type ButtonVariant = BaseVariant | "link";
|
|
98
|
+
type ButtonColor = BaseColor;
|
|
99
|
+
interface ButtonRenderProps {
|
|
100
|
+
className?: string;
|
|
101
|
+
style?: React.CSSProperties;
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
"aria-busy"?: boolean;
|
|
104
|
+
children?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps {
|
|
107
|
+
size?: ButtonSize;
|
|
24
108
|
leftIcon?: ReactNode;
|
|
25
109
|
rightIcon?: ReactNode;
|
|
26
|
-
|
|
110
|
+
iconOnly?: boolean;
|
|
111
|
+
render?: (props: ButtonRenderProps) => React.ReactElement;
|
|
27
112
|
}
|
|
28
113
|
|
|
29
114
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
30
115
|
|
|
31
|
-
|
|
116
|
+
/**
|
|
117
|
+
* A CSS class name or a string containing multiple class names.
|
|
118
|
+
* Typically used to apply styles generated by a styling solution (e.g., CSS Modules, Tailwind, Panda CSS).
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const baseStyle: RecipeStyle = "btn btn-primary";
|
|
123
|
+
* const variantStyle: RecipeStyle = "bg-blue-500 hover:bg-blue-600";
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
type RecipeStyle = string;
|
|
127
|
+
type RecipeVariantValue = string | boolean | number;
|
|
128
|
+
/**
|
|
129
|
+
* A mapping of variant key to a CSS class string.
|
|
130
|
+
* Each variant option maps to a specific style.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const colorVariants: RecipeVariant = {
|
|
135
|
+
* brand: "bg-brand text-white",
|
|
136
|
+
* destructive: "bg-red-500 text-white",
|
|
137
|
+
* outline: "border-2 border-current bg-transparent",
|
|
138
|
+
* };
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
type RecipeVariant = Record<string, RecipeStyle>;
|
|
142
|
+
/**
|
|
143
|
+
* Defines a compound variant: a set of conditions (multiple variant keys)
|
|
144
|
+
* that together produce a specific className.
|
|
145
|
+
*
|
|
146
|
+
* This is useful when you need to apply styles only when two or more
|
|
147
|
+
* variant values are combined (e.g., `variant="solid"` AND `color="brand"`).
|
|
148
|
+
*
|
|
149
|
+
* @property conditions - A record where keys are variant names and values are the variant values.
|
|
150
|
+
* @property className - The style to apply when all conditions match.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* const compound: RecipeCompoundVariant = {
|
|
155
|
+
* conditions: { variant: "solid", color: "brand" },
|
|
156
|
+
* className: "shadow-lg bg-brand-dark",
|
|
157
|
+
* };
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
interface RecipeCompoundVariant {
|
|
161
|
+
conditions: Record<string, RecipeVariantValue>;
|
|
162
|
+
className: RecipeStyle;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Defines the complete styling recipe for a single component.
|
|
166
|
+
*
|
|
167
|
+
* A recipe consists of:
|
|
168
|
+
* - **base**: styles applied to every instance of the component.
|
|
169
|
+
* - **variants**: a set of variant groups (e.g., `size`, `color`, `variant`).
|
|
170
|
+
* - **defaultVariants**: which variant values to use when none are provided.
|
|
171
|
+
* - **compoundVariants**: conditional styles that apply when multiple variant conditions are met.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const buttonRecipe: RecipeDefinition = {
|
|
176
|
+
* base: "inline-flex items-center justify-center rounded font-medium transition-colors",
|
|
177
|
+
* variants: {
|
|
178
|
+
* variant: {
|
|
179
|
+
* solid: "bg-brand text-white hover:bg-brand-dark",
|
|
180
|
+
* outline: "border-2 border-brand text-brand hover:bg-brand/10",
|
|
181
|
+
* ghost: "text-brand hover:bg-brand/10",
|
|
182
|
+
* },
|
|
183
|
+
* size: {
|
|
184
|
+
* sm: "px-3 py-1 text-sm",
|
|
185
|
+
* md: "px-4 py-2 text-base",
|
|
186
|
+
* lg: "px-6 py-3 text-lg",
|
|
187
|
+
* },
|
|
188
|
+
* },
|
|
189
|
+
* defaultVariants: {
|
|
190
|
+
* variant: "solid",
|
|
191
|
+
* size: "md",
|
|
192
|
+
* },
|
|
193
|
+
* compoundVariants: [
|
|
194
|
+
* {
|
|
195
|
+
* conditions: { variant: "solid", size: "lg" },
|
|
196
|
+
* className: "shadow-lg",
|
|
197
|
+
* },
|
|
198
|
+
* ],
|
|
199
|
+
* };
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
interface RecipeDefinition {
|
|
203
|
+
/**
|
|
204
|
+
* Base classes applied to every component.
|
|
205
|
+
* These are combined with the variant classes.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* base: "flex items-center gap-2"
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
base?: RecipeStyle;
|
|
213
|
+
/**
|
|
214
|
+
* Variant groups.
|
|
215
|
+
* Each key defines a variant prop name (e.g., `size`, `color`).
|
|
216
|
+
* The value is a map of variant option → CSS classes.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* variants: {
|
|
221
|
+
* size: {
|
|
222
|
+
* sm: "text-sm px-3 py-1",
|
|
223
|
+
* md: "text-base px-4 py-2",
|
|
224
|
+
* },
|
|
225
|
+
* color: {
|
|
226
|
+
* brand: "bg-brand text-white",
|
|
227
|
+
* destructive: "bg-red-500 text-white",
|
|
228
|
+
* },
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
variants?: Record<string, RecipeVariant>;
|
|
233
|
+
/**
|
|
234
|
+
* Variants used when no explicit prop is provided.
|
|
235
|
+
*
|
|
236
|
+
* Supports string, boolean, and numeric values.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts
|
|
240
|
+
* defaultVariants: {
|
|
241
|
+
* size: "md",
|
|
242
|
+
* rounded: false,
|
|
243
|
+
* }
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
defaultVariants?: Record<string, RecipeVariantValue>;
|
|
247
|
+
/**
|
|
248
|
+
* Classes applied when multiple variant conditions match.
|
|
249
|
+
* This is useful for special combinations that require additional styling.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* compoundVariants: [
|
|
254
|
+
* {
|
|
255
|
+
* conditions: { variant: "solid", color: "brand" },
|
|
256
|
+
* className: "shadow-lg",
|
|
257
|
+
* },
|
|
258
|
+
* {
|
|
259
|
+
* conditions: { size: "lg", color: "destructive" },
|
|
260
|
+
* className: "uppercase",
|
|
261
|
+
* },
|
|
262
|
+
* ]
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
compoundVariants?: RecipeCompoundVariant[];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* A collection of component recipes, keyed by component name.
|
|
269
|
+
* Each component has its own `RecipeDefinition`.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const recipes: RecipeCollection = {
|
|
274
|
+
* Button: buttonRecipe,
|
|
275
|
+
* Card: cardRecipe,
|
|
276
|
+
* Input: inputRecipe,
|
|
277
|
+
* };
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
type RecipeCollection = Record<string, RecipeDefinition>;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The primitive value type for any design token.
|
|
284
|
+
* Can be a CSS value as a string (e.g., "16px", "#fff", "1.5rem")
|
|
285
|
+
* or a unitless number (e.g., 0, 1.5, 4).
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* const fontSize: TokenValue = "1.25rem";
|
|
290
|
+
* const opacity: TokenValue = 0.8;
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
type TokenValue = string | number;
|
|
294
|
+
/**
|
|
295
|
+
* A wrapper around a single design value.
|
|
296
|
+
* @template T - The specific TokenValue type (defaults to string | number).
|
|
297
|
+
*
|
|
298
|
+
* Every leaf in the token tree is a TokenDefinition.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* const blue500: TokenDefinition<string> = { value: "#3b82f6" };
|
|
303
|
+
* const spacing4: TokenDefinition<number> = { value: 4 };
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
interface TokenDefinition<T extends TokenValue = TokenValue> {
|
|
307
|
+
value: T;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* A recursive structure that allows nested token collections.
|
|
311
|
+
* Keys are arbitrary strings and values are either a leaf (TokenDefinition)
|
|
312
|
+
* or another nested group.
|
|
313
|
+
*
|
|
314
|
+
* This enables hierarchical paths like:
|
|
315
|
+
* - colors.blue.500
|
|
316
|
+
* - spacing.4
|
|
317
|
+
* - radii.md
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* const tokens: TokenGroup = {
|
|
322
|
+
* colors: {
|
|
323
|
+
* blue: {
|
|
324
|
+
* 50: { value: "#eff6ff" },
|
|
325
|
+
* 500: { value: "#3b82f6" },
|
|
326
|
+
* },
|
|
327
|
+
* red: { value: "#ef4444" }, // direct leaf
|
|
328
|
+
* },
|
|
329
|
+
* spacing: {
|
|
330
|
+
* sm: { value: "8px" },
|
|
331
|
+
* md: { value: "16px" },
|
|
332
|
+
* },
|
|
333
|
+
* };
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
interface TokenGroup {
|
|
337
|
+
[key: string]: TokenDefinition | TokenGroup;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* A flat collection of color values for a single color family.
|
|
341
|
+
* Keys typically represent shades (e.g., "50", "100", "500", "900").
|
|
342
|
+
* Each value is a TokenDefinition<string> representing a CSS color.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* const blueScale: ColorScale = {
|
|
347
|
+
* 50: { value: "#eff6ff" },
|
|
348
|
+
* 100: { value: "#dbeafe" },
|
|
349
|
+
* 500: { value: "#3b82f6" },
|
|
350
|
+
* 900: { value: "#1e3a8a" },
|
|
351
|
+
* };
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
interface ColorScale {
|
|
355
|
+
[key: string]: TokenDefinition<string>;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* A collection of color scales and/or direct color tokens.
|
|
359
|
+
* Keys are colour family names (e.g., "blue", "gray", "brand").
|
|
360
|
+
* Values can be a full ColorScale or a single TokenDefinition<string>.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* const colors: ColorTokens = {
|
|
365
|
+
* blue: { 50: { value: "#eff6ff" }, 500: { value: "#3b82f6" } },
|
|
366
|
+
* gray: { 100: { value: "#f3f4f6" }, 900: { value: "#111827" } },
|
|
367
|
+
* brand: { value: "#2563eb" }, // flat single color
|
|
368
|
+
* };
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
32
371
|
interface ColorTokens {
|
|
33
|
-
|
|
34
|
-
brandHover: ColorToken;
|
|
35
|
-
brandFg: ColorToken;
|
|
36
|
-
surface: ColorToken;
|
|
37
|
-
surfaceRaised: ColorToken;
|
|
38
|
-
surfaceSunken: ColorToken;
|
|
39
|
-
border: ColorToken;
|
|
40
|
-
text: ColorToken;
|
|
41
|
-
textMuted: ColorToken;
|
|
42
|
-
danger: ColorToken;
|
|
43
|
-
dangerFg: ColorToken;
|
|
44
|
-
destructive: ColorToken;
|
|
45
|
-
destructiveFg: ColorToken;
|
|
46
|
-
destructiveHover: ColorToken;
|
|
47
|
-
success: ColorToken;
|
|
48
|
-
successFg: ColorToken;
|
|
49
|
-
successHover: ColorToken;
|
|
50
|
-
warning: ColorToken;
|
|
51
|
-
warningFg: ColorToken;
|
|
52
|
-
warningHover: ColorToken;
|
|
53
|
-
info: ColorToken;
|
|
54
|
-
infoFg: ColorToken;
|
|
55
|
-
infoHover: ColorToken;
|
|
56
|
-
}
|
|
57
|
-
interface ThemeTokens {
|
|
58
|
-
colors: ColorTokens;
|
|
59
|
-
radius: string;
|
|
60
|
-
font: string;
|
|
372
|
+
[key: string]: ColorScale | TokenDefinition<string>;
|
|
61
373
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
374
|
+
/**
|
|
375
|
+
* A flat map of spacing tokens.
|
|
376
|
+
* Keys describe the spacing size (e.g., "xs", "md", "lg", "4").
|
|
377
|
+
* Values are TokenDefinition<string> containing a CSS length.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* const spacing: SpacingTokens = {
|
|
382
|
+
* xs: { value: "4px" },
|
|
383
|
+
* md: { value: "16px" },
|
|
384
|
+
* lg: { value: "24px" },
|
|
385
|
+
* };
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
interface SpacingTokens {
|
|
389
|
+
[key: string]: TokenDefinition<string>;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* A flat map of border‑radius tokens.
|
|
393
|
+
* Keys describe the radius size (e.g., "sm", "md", "full").
|
|
394
|
+
* Values are TokenDefinition<string> containing a CSS length.
|
|
395
|
+
*/
|
|
396
|
+
interface RadiusTokens {
|
|
397
|
+
[key: string]: TokenDefinition<string>;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* A flat map of font‑family tokens.
|
|
401
|
+
* Keys describe the font name (e.g., "body", "heading", "mono").
|
|
402
|
+
* Values are TokenDefinition<string> containing a CSS font‑family value.
|
|
403
|
+
*/
|
|
404
|
+
interface FontTokens {
|
|
405
|
+
[key: string]: TokenDefinition<string>;
|
|
66
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* A flat map of font‑size tokens.
|
|
409
|
+
* Keys describe the size name (e.g., "xs", "sm", "base", "xl").
|
|
410
|
+
* Values are TokenDefinition<string> containing a CSS font‑size.
|
|
411
|
+
*/
|
|
412
|
+
interface FontSizeTokens {
|
|
413
|
+
[key: string]: TokenDefinition<string>;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* A flat map of font‑weight tokens.
|
|
417
|
+
* Keys describe the weight name (e.g., "normal", "medium", "bold").
|
|
418
|
+
* Values are TokenDefinition<string> containing a CSS font‑weight (e.g., "400", "700").
|
|
419
|
+
*/
|
|
420
|
+
interface FontWeightTokens {
|
|
421
|
+
[key: string]: TokenDefinition<string>;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* A flat map of line‑height tokens.
|
|
425
|
+
* Keys describe the line‑height name (e.g., "tight", "normal", "loose").
|
|
426
|
+
* Values are TokenDefinition<string> containing a CSS line‑height.
|
|
427
|
+
*/
|
|
428
|
+
interface LineHeightTokens {
|
|
429
|
+
[key: string]: TokenDefinition<string>;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* A flat map of letter‑spacing tokens.
|
|
433
|
+
* Keys describe the spacing name (e.g., "tight", "wide", "wider").
|
|
434
|
+
* Values are TokenDefinition<string> containing a CSS letter‑spacing.
|
|
435
|
+
*/
|
|
436
|
+
interface LetterSpacingTokens {
|
|
437
|
+
[key: string]: TokenDefinition<string>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* A flat map of shadow tokens.
|
|
441
|
+
* Keys describe the shadow name (e.g., "sm", "md", "lg", "xl").
|
|
442
|
+
* Values are TokenDefinition<string> containing a CSS box‑shadow value.
|
|
443
|
+
*/
|
|
444
|
+
interface ShadowTokens {
|
|
445
|
+
[key: string]: TokenDefinition<string>;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* A flat map of animation tokens.
|
|
449
|
+
* Keys describe the animation name (e.g., "fade", "slide", "spin").
|
|
450
|
+
* Values are TokenDefinition<string> containing a CSS animation shorthand or keyframes name.
|
|
451
|
+
*/
|
|
452
|
+
interface AnimationTokens {
|
|
453
|
+
[key: string]: TokenDefinition<string>;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Primitive (raw) design tokens.
|
|
457
|
+
* These are mode‑agnostic values that serve as the foundation for semantic tokens.
|
|
458
|
+
* Each category is optional; you may define only the ones you need.
|
|
459
|
+
*
|
|
460
|
+
* The index signature allows custom token groups (e.g., "zIndices", "borders", "opacities")
|
|
461
|
+
* to be added as the design system evolves.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```ts
|
|
465
|
+
* const tokens: DesignTokens = {
|
|
466
|
+
* colors: {
|
|
467
|
+
* blue: { 50: { value: "#eff6ff" }, 500: { value: "#3b82f6" } },
|
|
468
|
+
* gray: { 100: { value: "#f3f4f6" }, 900: { value: "#111827" } },
|
|
469
|
+
* },
|
|
470
|
+
* spacing: { sm: { value: "8px" }, md: { value: "16px" } },
|
|
471
|
+
* radii: { md: { value: "8px" } },
|
|
472
|
+
* };
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
interface DesignTokens {
|
|
476
|
+
colors?: ColorTokens;
|
|
477
|
+
spacing?: SpacingTokens;
|
|
478
|
+
radii?: RadiusTokens;
|
|
479
|
+
fonts?: FontTokens;
|
|
480
|
+
fontSizes?: FontSizeTokens;
|
|
481
|
+
fontWeights?: FontWeightTokens;
|
|
482
|
+
lineHeights?: LineHeightTokens;
|
|
483
|
+
letterSpacings?: LetterSpacingTokens;
|
|
484
|
+
shadows?: ShadowTokens;
|
|
485
|
+
animations?: AnimationTokens;
|
|
486
|
+
[key: string]: unknown;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* A value that can differ between light and dark color modes.
|
|
490
|
+
* @template T - The type of the value (defaults to string).
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* const brandColor: ColorModeValue = {
|
|
495
|
+
* light: "#3b82f6",
|
|
496
|
+
* dark: "#60a5fa",
|
|
497
|
+
* };
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
type ColorModeValue<T = string> = {
|
|
501
|
+
light: T;
|
|
502
|
+
dark: T;
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* A semantic token that can be either a static value or a mode‑dependent value.
|
|
506
|
+
* @template T - The TokenValue type (defaults to string).
|
|
507
|
+
*
|
|
508
|
+
* Semantic tokens represent a role (e.g., "background", "text", "border")
|
|
509
|
+
* rather than a raw value. They are used to create themes that adapt to color mode.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* const surfaceToken: SemanticToken = {
|
|
514
|
+
* value: { light: "#ffffff", dark: "#1e293b" }
|
|
515
|
+
* };
|
|
516
|
+
* const dangerToken: SemanticToken = { value: "#ef4444" }; // static
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
519
|
+
interface SemanticToken<T extends TokenValue = string> {
|
|
520
|
+
value: T | ColorModeValue<T>;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* A flat record of semantic color tokens.
|
|
524
|
+
* Keys describe the color role (e.g., "brand", "surface", "text", "danger").
|
|
525
|
+
* Values are SemanticToken<string> that resolve to a CSS color.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* const semanticColors: SemanticColorTokens = {
|
|
530
|
+
* brand: { value: { light: "#3b82f6", dark: "#60a5fa" } },
|
|
531
|
+
* surface: { value: { light: "#ffffff", dark: "#1e293b" } },
|
|
532
|
+
* text: { value: { light: "#111827", dark: "#f1f5f9" } },
|
|
533
|
+
* danger: { value: "#ef4444" }, // static
|
|
534
|
+
* };
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
interface SemanticColorTokens {
|
|
538
|
+
[key: string]: SemanticToken<string>;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Container for all semantic tokens.
|
|
542
|
+
* Currently only `colors` is defined, but the index signature allows
|
|
543
|
+
* future categories like `shadows`, `borders`, or `opacities`.
|
|
544
|
+
*/
|
|
545
|
+
interface SemanticTokens {
|
|
546
|
+
colors?: SemanticColorTokens;
|
|
547
|
+
[key: string]: unknown;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* A set of CSS properties that define a typography style.
|
|
551
|
+
* All properties are optional – you can compose styles incrementally.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```ts
|
|
555
|
+
* const headingStyle: TextStyle = {
|
|
556
|
+
* fontFamily: "Inter, sans-serif",
|
|
557
|
+
* fontSize: "2rem",
|
|
558
|
+
* fontWeight: 700,
|
|
559
|
+
* lineHeight: "1.2",
|
|
560
|
+
* letterSpacing: "-0.02em",
|
|
561
|
+
* };
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
interface TextStyle {
|
|
565
|
+
fontFamily?: string;
|
|
566
|
+
fontSize?: string;
|
|
567
|
+
fontWeight?: string | number;
|
|
568
|
+
lineHeight?: string;
|
|
569
|
+
letterSpacing?: string;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* A collection of named text styles.
|
|
573
|
+
* Keys are style names (e.g., "heading", "body", "caption", "label").
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* const textStyles: TextStyles = {
|
|
578
|
+
* heading: { fontSize: "2rem", fontWeight: 700 },
|
|
579
|
+
* body: { fontSize: "1rem", lineHeight: "1.5" },
|
|
580
|
+
* };
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
type TextStyles = Record<string, TextStyle>;
|
|
584
|
+
/**
|
|
585
|
+
* A set of CSS properties that define the dimensions and spacing
|
|
586
|
+
* for a component at a specific size.
|
|
587
|
+
*
|
|
588
|
+
* Used to build size‑variant scales for components (e.g., "sm", "md", "lg").
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* const buttonSize: SizeToken = {
|
|
593
|
+
* height: "40px",
|
|
594
|
+
* paddingX: "16px",
|
|
595
|
+
* fontSize: "1rem",
|
|
596
|
+
* iconSize: "20px",
|
|
597
|
+
* radius: "8px",
|
|
598
|
+
* };
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
67
601
|
interface SizeToken {
|
|
68
602
|
height?: string;
|
|
603
|
+
width?: string;
|
|
69
604
|
paddingX?: string;
|
|
605
|
+
paddingY?: string;
|
|
70
606
|
fontSize?: string;
|
|
71
607
|
gap?: string;
|
|
72
608
|
iconSize?: string;
|
|
73
609
|
radius?: string;
|
|
74
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* A collection of named size tokens.
|
|
613
|
+
* Keys are size names (e.g., "sm", "md", "lg", "xl").
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```ts
|
|
617
|
+
* const sizes: SizeScale = {
|
|
618
|
+
* sm: { height: "32px", paddingX: "12px", fontSize: "0.875rem" },
|
|
619
|
+
* md: { height: "40px", paddingX: "16px", fontSize: "1rem" },
|
|
620
|
+
* lg: { height: "48px", paddingX: "24px", fontSize: "1.125rem" },
|
|
621
|
+
* };
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
75
624
|
type SizeScale = Record<string, SizeToken>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
625
|
+
/**
|
|
626
|
+
* Defines the transition properties for a theme change.
|
|
627
|
+
* `type` refers to a base transition key (imported from BaseTransition).
|
|
628
|
+
* `duration` and `delay` are in milliseconds.
|
|
629
|
+
* `easing` is a CSS easing function.
|
|
630
|
+
*/
|
|
631
|
+
interface ThemeTransition {
|
|
632
|
+
type?: BaseTransition;
|
|
633
|
+
duration?: number;
|
|
634
|
+
delay?: number;
|
|
635
|
+
easing?: string;
|
|
82
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* The complete theme object provided by the design system.
|
|
639
|
+
* It combines primitive tokens, semantic tokens, text styles,
|
|
640
|
+
* component recipes, a global intensity, legacy tokens, and size scales.
|
|
641
|
+
*
|
|
642
|
+
* @property tokens - Raw design values (colors, spacing, radii, etc.).
|
|
643
|
+
* @property semanticTokens - Role‑based tokens that adapt to color mode.
|
|
644
|
+
* @property textStyles - Reusable typography styles.
|
|
645
|
+
* @property recipes - Component‑specific styles (from RecipeCollection).
|
|
646
|
+
* @property intensity - A global multiplier for visual prominence (e.g., 0.8, 1, 1.2).
|
|
647
|
+
* @property light - Legacy theme tokens for light mode (kept for migration).
|
|
648
|
+
* @property dark - Legacy theme tokens for dark mode (kept for migration).
|
|
649
|
+
* @property sizes - Legacy component size scale (will move to recipes).
|
|
650
|
+
*/
|
|
83
651
|
interface Theme {
|
|
652
|
+
tokens: DesignTokens;
|
|
653
|
+
semanticTokens: SemanticTokens;
|
|
654
|
+
textStyles: TextStyles;
|
|
655
|
+
recipes: RecipeCollection;
|
|
84
656
|
intensity: number;
|
|
85
|
-
light: ThemeTokens;
|
|
86
|
-
dark: ThemeTokens;
|
|
87
657
|
sizes: SizeScale;
|
|
88
|
-
components?: ComponentOverrides;
|
|
89
658
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
659
|
+
/**
|
|
660
|
+
* A flat record of resolved token values, typically CSS‑ready strings.
|
|
661
|
+
* Used internally for injecting variables.
|
|
662
|
+
*/
|
|
663
|
+
type ResolvedTokens = Record<string, string>;
|
|
664
|
+
/**
|
|
665
|
+
* Defines three standard intensity levels.
|
|
666
|
+
* Useful for scaling effects like shadows, saturation, or contrast.
|
|
667
|
+
*/
|
|
668
|
+
interface IntensityMap {
|
|
669
|
+
subtle: number;
|
|
670
|
+
default: number;
|
|
671
|
+
bold: number;
|
|
672
|
+
}
|
|
673
|
+
interface ThemeOverride {
|
|
674
|
+
/**
|
|
675
|
+
* Override primitive design tokens.
|
|
676
|
+
* Allows partial updates to raw values like colors, spacing, radii, etc.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* tokens: {
|
|
681
|
+
* colors: { blue: { 500: { value: "#1d4ed8" } } },
|
|
682
|
+
* spacing: { md: { value: "20px" } },
|
|
683
|
+
* }
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
tokens?: DeepPartial<DesignTokens>;
|
|
687
|
+
/**
|
|
688
|
+
* Override semantic tokens.
|
|
689
|
+
* Allows partial updates to role‑based tokens (brand, surface, text, etc.)
|
|
690
|
+
* that can adapt to light/dark modes.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```ts
|
|
694
|
+
* semanticTokens: {
|
|
695
|
+
* colors: {
|
|
696
|
+
* brand: { value: { light: "#1d4ed8", dark: "#60a5fa" } },
|
|
697
|
+
* surface: { value: { light: "#ffffff", dark: "#0f172a" } },
|
|
698
|
+
* },
|
|
699
|
+
* }
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
semanticTokens?: DeepPartial<SemanticTokens>;
|
|
703
|
+
/**
|
|
704
|
+
* Override reusable text styles.
|
|
705
|
+
* Allows partial updates to typography presets like heading, body, caption, etc.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```ts
|
|
709
|
+
* textStyles: {
|
|
710
|
+
* heading: { fontSize: "2.5rem", fontWeight: 800 },
|
|
711
|
+
* body: { fontSize: "1.125rem", lineHeight: "1.75" },
|
|
712
|
+
* }
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
textStyles?: DeepPartial<TextStyles>;
|
|
716
|
+
/**
|
|
717
|
+
* Override component recipes.
|
|
718
|
+
* Allows modifying the base styles, variants, default variants, and compound variants
|
|
719
|
+
* for any component (e.g., Button, Card, Input) without rewriting the entire theme.
|
|
720
|
+
*
|
|
721
|
+
* Each key is a component name, and the value is a deep partial of its RecipeDefinition.
|
|
722
|
+
* This means you can override only specific variants or classes while keeping the rest intact.
|
|
723
|
+
*
|
|
724
|
+
* @example
|
|
725
|
+
* ```ts
|
|
726
|
+
* recipes: {
|
|
727
|
+
* Button: {
|
|
728
|
+
* base: "custom-base-class inline-flex items-center",
|
|
729
|
+
* variants: {
|
|
730
|
+
* size: {
|
|
731
|
+
* md: "px-6 py-3 text-lg", // override only the "md" size
|
|
732
|
+
* },
|
|
733
|
+
* },
|
|
734
|
+
* compoundVariants: [
|
|
735
|
+
* {
|
|
736
|
+
* conditions: { variant: "solid", color: "brand" },
|
|
737
|
+
* className: "shadow-lg custom-brand-shadow",
|
|
738
|
+
* },
|
|
739
|
+
* ],
|
|
740
|
+
* },
|
|
741
|
+
* Card: {
|
|
742
|
+
* base: "rounded-xl p-6 bg-surface",
|
|
743
|
+
* },
|
|
744
|
+
* }
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
recipes?: DeepPartial<RecipeCollection>;
|
|
748
|
+
/**
|
|
749
|
+
* Override the global visual intensity.
|
|
750
|
+
* A multiplier for effects like shadows, saturation, or contrast.
|
|
751
|
+
* Typical values: 0.8 (subtle), 1.0 (default), 1.2 (bold).
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* ```ts
|
|
755
|
+
* intensity: 1.1 // Slightly bolder than default
|
|
756
|
+
* ```
|
|
757
|
+
*/
|
|
758
|
+
intensity?: number;
|
|
759
|
+
/**
|
|
760
|
+
* Override legacy component size scales.
|
|
761
|
+
* Allows updating specific size tokens (height, padding, fontSize, etc.)
|
|
762
|
+
* for a given size name (e.g., "sm", "md", "lg").
|
|
763
|
+
*
|
|
764
|
+
* This will eventually be replaced by component‑specific size variants in recipes.
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```ts
|
|
768
|
+
* sizes: {
|
|
769
|
+
* md: { height: "44px", paddingX: "20px" }, // override only "md" size
|
|
770
|
+
* lg: { height: "52px", fontSize: "1.25rem" },
|
|
771
|
+
* }
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
93
774
|
sizes?: Record<string, Partial<SizeToken>>;
|
|
94
|
-
|
|
95
|
-
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Represents the active color mode.
|
|
778
|
+
* - "light": force light mode.
|
|
779
|
+
* - "dark": force dark mode.
|
|
780
|
+
* - "system": follow the user's operating system preference.
|
|
781
|
+
*/
|
|
96
782
|
type ColorMode = "light" | "dark" | "system";
|
|
97
783
|
|
|
784
|
+
type ThemeTogglerVariant = Exclude<ButtonVariant, 'link'>;
|
|
98
785
|
type ThemeTogglerDisplay = "buttons" | "cycle";
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
interface ThemeTogglerProps {
|
|
786
|
+
type ThemeTogglerColor = Exclude<BaseColor, "destructive" | "warning" | "success" | "white" | "info">;
|
|
787
|
+
interface ThemeTogglerProps extends Omit<BaseProps, "children"> {
|
|
102
788
|
variant?: ThemeTogglerVariant;
|
|
103
789
|
activeVariant?: ThemeTogglerVariant;
|
|
104
|
-
|
|
790
|
+
color?: ButtonProps["color"];
|
|
791
|
+
activeColor?: ButtonProps["color"];
|
|
792
|
+
size?: ButtonProps["size"];
|
|
105
793
|
iconOnly?: boolean;
|
|
106
794
|
allowSystem?: boolean;
|
|
107
795
|
orientation?: Orientation;
|
|
108
796
|
rounded?: boolean;
|
|
109
|
-
unstyled?: boolean;
|
|
110
797
|
labels?: {
|
|
111
798
|
light?: string;
|
|
112
799
|
dark?: string;
|
|
@@ -117,37 +804,24 @@ interface ThemeTogglerProps {
|
|
|
117
804
|
dark?: React.ReactNode;
|
|
118
805
|
system?: React.ReactNode;
|
|
119
806
|
};
|
|
120
|
-
|
|
121
|
-
transition?: {
|
|
122
|
-
type: BaseTransition;
|
|
123
|
-
duration?: number;
|
|
124
|
-
delay?: number;
|
|
125
|
-
easing?: string;
|
|
126
|
-
};
|
|
807
|
+
buttonProps?: Omit<ButtonProps, "variant" | "color" | "size" | "children">;
|
|
127
808
|
display?: ThemeTogglerDisplay;
|
|
128
|
-
|
|
809
|
+
transition?: ThemeTransition;
|
|
129
810
|
}
|
|
130
811
|
|
|
131
|
-
declare function ThemeToggler({ variant, activeVariant, size, iconOnly, allowSystem, orientation, rounded, unstyled, labels, icons, className, buttonProps, display, transition, }: ThemeTogglerProps): react.JSX.Element;
|
|
812
|
+
declare function ThemeToggler({ variant, activeVariant, color, activeColor, size, iconOnly, allowSystem, orientation, rounded, unstyled, labels, icons, className, buttonProps, display, transition, }: ThemeTogglerProps): react.JSX.Element;
|
|
132
813
|
|
|
133
814
|
type InputVariant = "outline" | "filled" | "ghost";
|
|
134
815
|
type InputSize = "sm" | "md" | "lg";
|
|
135
816
|
type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "password-current" | "password-new" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
|
|
136
|
-
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">,
|
|
137
|
-
variant?: InputVariant;
|
|
817
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">, BaseProps, SizeProps, VariantProps<InputVariant>, DisabledProps, LoadingProps, FullWidthProps, ClearableProps, StateProps {
|
|
138
818
|
inputClassName?: string;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
success?: boolean;
|
|
819
|
+
size?: string;
|
|
820
|
+
kind?: InputKind;
|
|
142
821
|
rounded?: boolean;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
fullWidth?: boolean;
|
|
822
|
+
startIcon?: ReactNode;
|
|
823
|
+
endIcon?: ReactNode;
|
|
146
824
|
hideKindIcon?: boolean;
|
|
147
|
-
isLoading?: boolean;
|
|
148
|
-
clearable?: boolean;
|
|
149
|
-
onClear?: () => void;
|
|
150
|
-
kind?: InputKind;
|
|
151
825
|
}
|
|
152
826
|
type InputKindDefaults = Record<InputKind, {
|
|
153
827
|
type?: string;
|
|
@@ -179,7 +853,7 @@ declare namespace FormField {
|
|
|
179
853
|
var Message: typeof FormFieldMessage;
|
|
180
854
|
}
|
|
181
855
|
|
|
182
|
-
declare function FormFieldLabel({ children, className }: {
|
|
856
|
+
declare function FormFieldLabel({ children, className, }: {
|
|
183
857
|
children: ReactNode;
|
|
184
858
|
className?: string;
|
|
185
859
|
}): react.JSX.Element;
|
|
@@ -188,14 +862,14 @@ declare function FormFieldDescription({ children, }: {
|
|
|
188
862
|
children: React.ReactNode;
|
|
189
863
|
}): react.JSX.Element;
|
|
190
864
|
|
|
191
|
-
declare function FormFieldMessage({ children
|
|
865
|
+
declare function FormFieldMessage({ children }: {
|
|
192
866
|
children: React.ReactNode;
|
|
193
867
|
}): react.JSX.Element;
|
|
194
868
|
|
|
195
869
|
type FormFieldControlProps<T = Record<string, unknown>> = {
|
|
196
870
|
children: ReactElement<T>;
|
|
197
871
|
};
|
|
198
|
-
declare function FormFieldControl<T = Record<string, unknown>>({ children, }: FormFieldControlProps<T>):
|
|
872
|
+
declare function FormFieldControl<T = Record<string, unknown>>({ children, }: FormFieldControlProps<T>): react.JSX.Element;
|
|
199
873
|
|
|
200
874
|
interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
201
875
|
className?: string;
|
|
@@ -248,7 +922,7 @@ declare function SelectGroup({ children, className }: SelectGroupProps): react.J
|
|
|
248
922
|
|
|
249
923
|
declare function SelectLabel({ children, className }: SelectLabelProps): react.JSX.Element;
|
|
250
924
|
|
|
251
|
-
declare function Select({ value: valueProp, defaultValue, onValueChange, disabled, required, name, variant, size, className, placeholder, "aria-
|
|
925
|
+
declare function Select({ value: valueProp, defaultValue, onValueChange, disabled, required, name, variant, size, className, placeholder, "aria-describedby": ariaDescribedBy, clearable, error, success, tabIndex, rounded, children, }: SelectProps): react.JSX.Element;
|
|
252
926
|
declare namespace Select {
|
|
253
927
|
var Trigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
254
928
|
var Content: typeof SelectContent;
|
|
@@ -276,11 +950,13 @@ interface SelectContextValue {
|
|
|
276
950
|
triggerId: string;
|
|
277
951
|
triggerRef: React.RefObject<HTMLDivElement | null>;
|
|
278
952
|
contentId: string;
|
|
279
|
-
isInvalid: boolean;
|
|
280
|
-
isSuccess: boolean;
|
|
281
953
|
describedBy?: string;
|
|
282
|
-
required?: boolean;
|
|
283
954
|
selectedLabel?: React.ReactNode;
|
|
955
|
+
labelId: string | undefined;
|
|
956
|
+
tabIndex?: number;
|
|
957
|
+
required?: boolean;
|
|
958
|
+
isInvalid: boolean;
|
|
959
|
+
isSuccess: boolean;
|
|
284
960
|
activeValue: string | undefined;
|
|
285
961
|
setActiveValue: (value: string | undefined) => void;
|
|
286
962
|
items: Map<string, SelectItemMeta>;
|
|
@@ -412,7 +1088,7 @@ interface ComboboxInputProps {
|
|
|
412
1088
|
className?: string;
|
|
413
1089
|
}
|
|
414
1090
|
|
|
415
|
-
declare function ComboboxItem({ value, disabled, children, className }: ComboboxItemProps): react.JSX.Element | null;
|
|
1091
|
+
declare function ComboboxItem({ value, disabled, children, className, }: ComboboxItemProps): react.JSX.Element | null;
|
|
416
1092
|
|
|
417
1093
|
declare function ComboboxContent({ className, children, }: {
|
|
418
1094
|
className?: string;
|
|
@@ -471,7 +1147,7 @@ interface MultiSelectContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
471
1147
|
}
|
|
472
1148
|
declare function MultiSelectContent({ className, children, ...props }: MultiSelectContentProps): react.JSX.Element | null;
|
|
473
1149
|
|
|
474
|
-
declare function MultiSelectItem({ value, disabled, children, className }: MultiSelectItemProps): react.JSX.Element;
|
|
1150
|
+
declare function MultiSelectItem({ value, disabled, children, className, }: MultiSelectItemProps): react.JSX.Element;
|
|
475
1151
|
|
|
476
1152
|
declare function MultiSelect({ value: valueProp, defaultValue, onValueChange, disabled, required, name, variant, size, placeholder, maxVisibleChips, className, children, error, success, rounded, clearable, }: MultiSelectProps): react.JSX.Element;
|
|
477
1153
|
declare namespace MultiSelect {
|
|
@@ -535,14 +1211,16 @@ interface ThemeContextValue {
|
|
|
535
1211
|
resolvedMode: "light" | "dark";
|
|
536
1212
|
setMode: (mode: ColorMode) => void;
|
|
537
1213
|
fallbackSize: string;
|
|
1214
|
+
tokens: ResolvedTokens;
|
|
538
1215
|
}
|
|
539
1216
|
declare const ThemeContext: react.Context<ThemeContextValue | null>;
|
|
540
1217
|
|
|
541
1218
|
declare const defaultSizes: SizeScale;
|
|
1219
|
+
declare const defaultTextStyles: TextStyles;
|
|
1220
|
+
declare const defaultRecipes: RecipeCollection;
|
|
542
1221
|
declare const defaultTheme: Theme;
|
|
543
|
-
declare function resolveTokens(tokens: ThemeTokens): ThemeTokens;
|
|
544
1222
|
|
|
545
|
-
declare function tokensToCssVars(tokens:
|
|
1223
|
+
declare function tokensToCssVars(tokens: ResolvedTokens, mode: "light" | "dark", intensity: number): Record<string, string>;
|
|
546
1224
|
|
|
547
1225
|
declare function useTheme(): ThemeContextValue;
|
|
548
1226
|
|
|
@@ -561,11 +1239,21 @@ interface ResolvedSize {
|
|
|
561
1239
|
style: CSSProperties;
|
|
562
1240
|
iconSize?: string;
|
|
563
1241
|
}
|
|
564
|
-
declare function useSizeStyle(size: string): ResolvedSize;
|
|
1242
|
+
declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string): ResolvedSize;
|
|
565
1243
|
|
|
566
1244
|
declare function cn(...inputs: ClassValue[]): string;
|
|
567
1245
|
|
|
568
|
-
|
|
1246
|
+
/**
|
|
1247
|
+
* Converts an RGB color string to a hex color.
|
|
1248
|
+
*
|
|
1249
|
+
* Supports:
|
|
1250
|
+
* - "26 128 230"
|
|
1251
|
+
* - "26, 128, 230"
|
|
1252
|
+
* - "rgb(26, 128, 230)"
|
|
1253
|
+
*
|
|
1254
|
+
* Returns an empty string when the value is not a valid RGB color.
|
|
1255
|
+
*/
|
|
1256
|
+
declare function rgbToHex(value: string): string;
|
|
569
1257
|
declare function hexToRgbString(hex: string): string | null;
|
|
570
1258
|
|
|
571
|
-
export { type BaseTransition, type BaseVariant, Button, type ButtonProps, Checkbox, type CheckboxProps, type ColorMode, type
|
|
1259
|
+
export { type AnimationTokens, type BaseColor, type BaseProps, type BaseTransition, type BaseVariant, Button, type ButtonProps, type CSSPropertiesWithVars, Checkbox, type CheckboxProps, type ClearableProps, type ColorMode, type ColorModeValue, type ColorProps, type ColorScale, type ColorTokens, Combobox, ComboboxContent, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxProps, type DeepPartial, type DesignTokens, type DisabledProps, type FontSizeTokens, type FontTokens, type FontWeightTokens, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, type FormFieldProps, type FullWidthProps, Input, type InputKind, type InputKindDefaults, type InputProps, type InputSize, type InputVariant, type IntensityMap, type LetterSpacingTokens, type LineHeightTokens, type LoadingProps, MultiSelect, MultiSelectContent, MultiSelectContext, type MultiSelectContextValue, MultiSelectItem, type MultiSelectItemMeta, type MultiSelectItemProps, type MultiSelectProps, MultiSelectTrigger, type Orientation, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadioSize, type RadiusTokens, type RecipeCollection, type RecipeCompoundVariant, type RecipeDefinition, type RecipeStyle, type RecipeVariant, type RecipeVariantValue, type ResolvedSize, type ResolvedTokens, Select, SelectContent, type SelectContentProps, SelectContext, type SelectContextValue, SelectGroup, SelectGroupContext, type SelectGroupProps, SelectItem, type SelectItemMeta, type SelectItemProps, type SelectLabelProps, type SelectProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, type SemanticColorTokens, type SemanticToken, type SemanticTokens, type ShadowTokens, type Size, type SizeProps, type SizeScale, type SizeToken, type SizeValue, type SpacingTokens, type StateProps, type Styleable, Switch, type SwitchProps, type TextStyle, type TextStyles, Textarea, type TextareaProps, type TextareaResize, type Theme, ThemeContext, type ThemeContextValue, type ThemeOverride, ThemeToggler, type ThemeTogglerColor, type ThemeTogglerDisplay, type ThemeTogglerProps, type ThemeTogglerVariant, type ThemeTransition, type TokenDefinition, type TokenGroup, type TokenValue, UIProvider, type UIProviderProps, type Variant, type VariantProps, cn, defaultRecipes, defaultSizes, defaultTextStyles, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useMultiSelectContext, useSelectContext, useSizeStyle, useTheme };
|