@splenddev/kreativ-ui 0.2.9 → 0.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 +143 -1511
- package/dist/index.cjs +2450 -1255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -908
- package/dist/index.d.ts +328 -908
- package/dist/index.js +2306 -1149
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +2 -2
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,177 +1,29 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, CSSProperties, ReactElement, InputHTMLAttributes, TextareaHTMLAttributes, ElementType, ComponentPropsWithoutRef, LabelHTMLAttributes, JSX, RefObject } from 'react';
|
|
3
|
+
import { BaseProps, ColorProps, BaseColor, VariantProps, BaseVariant, DisabledProps, LoadingProps, FullWidthProps, TypographyProps, SizeValue, SizeProps, OrientationProps, Orientation, ThemeTogglerTransition, ClearableProps, UndoRedoProps, ValueProps, StateProps, TrimProps, FormFieldStatus, EmbeddedProps, ValidateProps, Styleable, StatusProps, ControlledProps, Size, ResponsiveValue, RecipeDefinition, RecipeCollection, DeepPartial, DefaultRecipeCollection, Typography, ThemeOverride as ThemeOverride$1, TokenValue, SemanticToken, SemanticTokens, DesignTokens, Theme } from '@splenddev/kreativ-core/types';
|
|
4
|
+
export * from '@splenddev/kreativ-core/types';
|
|
5
|
+
import { FormFieldStatus as FormFieldStatus$1, ThemeOverride, ColorMode } from '@splenddev/kreativ-core';
|
|
6
|
+
export { ThemeContext } from '@splenddev/kreativ-core';
|
|
7
|
+
export * from '@splenddev/kreativ-core/hooks';
|
|
3
8
|
import { ClassValue } from 'clsx';
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
type Orientation = "horizontal" | "vertical";
|
|
7
|
-
type SizeValue = Size | (string & {});
|
|
8
|
-
type BaseVariant = "solid" | "outline" | "ghost" | "soft";
|
|
9
|
-
type BaseColor = "brand" | "destructive" | "success" | "warning" | "info" | "neutral" | "white";
|
|
10
|
-
type Variant = BaseVariant;
|
|
11
|
-
interface Styleable {
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
type BaseTransition = "none" | "fade" | "rotate" | "slide" | "scale";
|
|
15
|
-
type DeepPartial<T> = {
|
|
16
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
17
|
-
};
|
|
18
|
-
type CSSPropertiesWithVars = CSSProperties & {
|
|
19
|
-
[key: `--${string}`]: string | number | undefined;
|
|
20
|
-
};
|
|
21
|
-
type ReportedValidity = {
|
|
22
|
-
invalid: boolean;
|
|
23
|
-
message?: string;
|
|
24
|
-
};
|
|
25
|
-
interface BaseProps {
|
|
26
|
-
/**
|
|
27
|
-
* Additional CSS classes.
|
|
28
|
-
*/
|
|
29
|
-
className?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Inline styles.
|
|
32
|
-
*/
|
|
33
|
-
style?: CSSProperties;
|
|
34
|
-
/**
|
|
35
|
-
* Component content.
|
|
36
|
-
*/
|
|
10
|
+
interface AdornmentProps extends HTMLAttributes<HTMLSpanElement> {
|
|
37
11
|
children?: ReactNode;
|
|
38
|
-
|
|
39
|
-
* Removes the component's default styling.
|
|
40
|
-
*/
|
|
41
|
-
unstyled?: boolean;
|
|
42
|
-
}
|
|
43
|
-
interface SizeProps {
|
|
44
|
-
/**
|
|
45
|
-
* Component size.
|
|
46
|
-
*/
|
|
47
|
-
size?: SizeValue;
|
|
48
|
-
}
|
|
49
|
-
interface ColorProps<Color extends string = string> {
|
|
50
|
-
/**
|
|
51
|
-
* Component color.
|
|
52
|
-
*/
|
|
53
|
-
color?: Color;
|
|
54
|
-
}
|
|
55
|
-
interface VariantProps<Variant extends string = string> {
|
|
56
|
-
/**
|
|
57
|
-
* Visual variant.
|
|
58
|
-
*/
|
|
59
|
-
variant?: Variant;
|
|
60
|
-
}
|
|
61
|
-
interface TypographyProps {
|
|
62
|
-
/**
|
|
63
|
-
* Defines the typography style to apply to the component.
|
|
64
|
-
* The value must match a typography style registered in the theme.
|
|
65
|
-
*/
|
|
66
|
-
typography?: string;
|
|
67
|
-
}
|
|
68
|
-
interface DisabledProps {
|
|
69
|
-
/**
|
|
70
|
-
* Disables the component.
|
|
71
|
-
*/
|
|
72
|
-
disabled?: boolean;
|
|
73
|
-
}
|
|
74
|
-
interface LoadingProps {
|
|
75
|
-
/**
|
|
76
|
-
* Displays a loading state and prevents interaction.
|
|
77
|
-
*/
|
|
78
|
-
isLoading?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface FullWidthProps {
|
|
81
|
-
/**
|
|
82
|
-
* Makes the component span the available width.
|
|
83
|
-
*/
|
|
84
|
-
fullWidth?: boolean;
|
|
85
|
-
}
|
|
86
|
-
interface ClearableProps {
|
|
87
|
-
/**
|
|
88
|
-
* Allows the current value to be cleared.
|
|
89
|
-
*/
|
|
90
|
-
clearable?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Called when the current value is cleared.
|
|
93
|
-
*/
|
|
94
|
-
onClear?: () => void;
|
|
95
|
-
}
|
|
96
|
-
interface StateProps {
|
|
97
|
-
/**
|
|
98
|
-
* Displays an error state.
|
|
99
|
-
*/
|
|
100
|
-
error?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Displays a success state.
|
|
103
|
-
*/
|
|
104
|
-
success?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Displays a warning state.
|
|
107
|
-
*/
|
|
108
|
-
warning?: boolean;
|
|
109
|
-
}
|
|
110
|
-
interface StatusProps {
|
|
111
|
-
/**
|
|
112
|
-
* Can be `'success'` or `'error'` or `'warning'` or `'none'`
|
|
113
|
-
*/
|
|
114
|
-
status?: FormFieldStatus;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Generic controlled/uncontrolled props with custom property names.
|
|
118
|
-
*/
|
|
119
|
-
type ControlledProps<T, TValueProp extends string = "value", TDefaultProp extends string = "defaultValue", TOnChangeProp extends string = "onValueChange"> = {
|
|
120
|
-
[K in TValueProp]?: T;
|
|
121
|
-
} & {
|
|
122
|
-
[K in TDefaultProp]?: T;
|
|
123
|
-
} & {
|
|
124
|
-
[K in TOnChangeProp]?: (value: T) => void;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Props for a string‑based value (e.g. input, select).
|
|
128
|
-
*/
|
|
129
|
-
type ValueProps<T = string> = ControlledProps<T, 'value', 'defaultValue', 'onValueChange'>;
|
|
130
|
-
interface TrimProps {
|
|
131
|
-
/**
|
|
132
|
-
* Removes leading and trailing whitespace from the value
|
|
133
|
-
* when the value is committed.
|
|
134
|
-
*
|
|
135
|
-
* @default false
|
|
136
|
-
*/
|
|
137
|
-
trim?: boolean;
|
|
138
|
-
}
|
|
139
|
-
interface EmbeddedProps {
|
|
140
|
-
/**
|
|
141
|
-
* Renders the component as part of a parent component's visual container.
|
|
142
|
-
*
|
|
143
|
-
* Removes standalone container styling such as borders, radius,
|
|
144
|
-
* and focus ring.
|
|
145
|
-
*/
|
|
146
|
-
embedded?: boolean;
|
|
147
|
-
}
|
|
148
|
-
type ValidationResult = boolean | string;
|
|
149
|
-
type ValidateOn = "change" | "blur" | "both";
|
|
150
|
-
interface ValidateProps<T = string> {
|
|
151
|
-
/**
|
|
152
|
-
* Validates the current value.
|
|
153
|
-
*
|
|
154
|
-
* Return `true` when valid, or `false`/a string when invalid.
|
|
155
|
-
* A returned string is used as the validation message.
|
|
156
|
-
*/
|
|
157
|
-
validate?: (value: T) => ValidationResult;
|
|
158
|
-
/**
|
|
159
|
-
* Determines when validation runs.
|
|
160
|
-
*
|
|
161
|
-
* @default "blur"
|
|
162
|
-
*/
|
|
163
|
-
validateOn?: ValidateOn;
|
|
12
|
+
position?: "start" | "end";
|
|
164
13
|
}
|
|
165
14
|
|
|
15
|
+
declare const Adornment: react.ForwardRefExoticComponent<AdornmentProps & react.RefAttributes<HTMLSpanElement>>;
|
|
16
|
+
|
|
166
17
|
type ButtonSize = SizeValue | "icon";
|
|
167
18
|
type ButtonVariant = BaseVariant | "link";
|
|
168
19
|
type ButtonColor = BaseColor;
|
|
169
|
-
interface ButtonRenderProps {
|
|
20
|
+
interface ButtonRenderProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color"> {
|
|
170
21
|
className?: string;
|
|
171
22
|
style?: CSSProperties;
|
|
172
23
|
disabled?: boolean;
|
|
173
24
|
"aria-disabled"?: boolean;
|
|
174
25
|
"aria-busy"?: boolean;
|
|
26
|
+
"data-kui-responsive"?: string;
|
|
175
27
|
children?: ReactNode;
|
|
176
28
|
}
|
|
177
29
|
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
|
|
@@ -208,686 +60,76 @@ interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onD
|
|
|
208
60
|
|
|
209
61
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
210
62
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
* Typically used to apply styles generated by a styling solution (e.g., CSS Modules, Tailwind, Panda CSS).
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```ts
|
|
217
|
-
* const baseStyle: RecipeStyle = "btn btn-primary";
|
|
218
|
-
* const variantStyle: RecipeStyle = "bg-blue-500 hover:bg-blue-600";
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
type RecipeStyle = string;
|
|
222
|
-
type RecipeVariantValue = string | boolean | number;
|
|
223
|
-
/**
|
|
224
|
-
* A mapping of variant key to a CSS class string.
|
|
225
|
-
* Each variant option maps to a specific style.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```ts
|
|
229
|
-
* const colorVariants: RecipeVariant = {
|
|
230
|
-
* brand: "bg-brand text-white",
|
|
231
|
-
* destructive: "bg-red-500 text-white",
|
|
232
|
-
* outline: "border-2 border-current bg-transparent",
|
|
233
|
-
* };
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
type RecipeVariant = Record<string, RecipeStyle>;
|
|
237
|
-
/**
|
|
238
|
-
* Defines a compound variant: a set of conditions (multiple variant keys)
|
|
239
|
-
* that together produce a specific className.
|
|
240
|
-
*
|
|
241
|
-
* This is useful when you need to apply styles only when two or more
|
|
242
|
-
* variant values are combined (e.g., `variant="solid"` AND `color="brand"`).
|
|
243
|
-
*
|
|
244
|
-
* @property conditions - A record where keys are variant names and values are the variant values.
|
|
245
|
-
* @property className - The style to apply when all conditions match.
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```ts
|
|
249
|
-
* const compound: RecipeCompoundVariant = {
|
|
250
|
-
* conditions: { variant: "solid", color: "brand" },
|
|
251
|
-
* className: "shadow-lg bg-brand-dark",
|
|
252
|
-
* };
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
interface RecipeCompoundVariant {
|
|
256
|
-
conditions: Record<string, RecipeVariantValue>;
|
|
257
|
-
className: RecipeStyle;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Defines the complete styling recipe for a single component.
|
|
261
|
-
*
|
|
262
|
-
* A recipe consists of:
|
|
263
|
-
* - **base**: styles applied to every instance of the component.
|
|
264
|
-
* - **variants**: a set of variant groups (e.g., `size`, `color`, `variant`).
|
|
265
|
-
* - **defaultVariants**: which variant values to use when none are provided.
|
|
266
|
-
* - **compoundVariants**: conditional styles that apply when multiple variant conditions are met.
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* ```ts
|
|
270
|
-
* const buttonRecipe: RecipeDefinition = {
|
|
271
|
-
* base: "inline-flex items-center justify-center rounded font-medium transition-colors",
|
|
272
|
-
* variants: {
|
|
273
|
-
* variant: {
|
|
274
|
-
* solid: "bg-brand text-white hover:bg-brand-dark",
|
|
275
|
-
* outline: "border-2 border-brand text-brand hover:bg-brand/10",
|
|
276
|
-
* ghost: "text-brand hover:bg-brand/10",
|
|
277
|
-
* },
|
|
278
|
-
* size: {
|
|
279
|
-
* sm: "px-3 py-1 text-sm",
|
|
280
|
-
* md: "px-4 py-2 text-base",
|
|
281
|
-
* lg: "px-6 py-3 text-lg",
|
|
282
|
-
* },
|
|
283
|
-
* },
|
|
284
|
-
* defaultVariants: {
|
|
285
|
-
* variant: "solid",
|
|
286
|
-
* size: "md",
|
|
287
|
-
* },
|
|
288
|
-
* compoundVariants: [
|
|
289
|
-
* {
|
|
290
|
-
* conditions: { variant: "solid", size: "lg" },
|
|
291
|
-
* className: "shadow-lg",
|
|
292
|
-
* },
|
|
293
|
-
* ],
|
|
294
|
-
* };
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
interface RecipeDefinition {
|
|
298
|
-
/**
|
|
299
|
-
* Base classes applied to every component.
|
|
300
|
-
* These are combined with the variant classes.
|
|
301
|
-
*
|
|
302
|
-
* @example
|
|
303
|
-
* ```ts
|
|
304
|
-
* base: "flex items-center gap-2"
|
|
305
|
-
* ```
|
|
306
|
-
*/
|
|
307
|
-
base?: RecipeStyle;
|
|
63
|
+
type ButtonGroupSpacing = "none" | "sm" | "md" | "lg";
|
|
64
|
+
interface ButtonGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "color" | "size">, Omit<BaseProps, "unstyled">, SizeProps, OrientationProps {
|
|
308
65
|
/**
|
|
309
|
-
*
|
|
310
|
-
* Each key defines a variant prop name (e.g., `size`, `color`).
|
|
311
|
-
* The value is a map of variant option → CSS classes.
|
|
66
|
+
* Whether adjacent buttons should visually connect.
|
|
312
67
|
*
|
|
313
|
-
* @
|
|
314
|
-
* ```ts
|
|
315
|
-
* variants: {
|
|
316
|
-
* size: {
|
|
317
|
-
* sm: "text-sm px-3 py-1",
|
|
318
|
-
* md: "text-base px-4 py-2",
|
|
319
|
-
* },
|
|
320
|
-
* color: {
|
|
321
|
-
* brand: "bg-brand text-white",
|
|
322
|
-
* destructive: "bg-red-500 text-white",
|
|
323
|
-
* },
|
|
324
|
-
* }
|
|
325
|
-
* ```
|
|
326
|
-
*/
|
|
327
|
-
variants?: Record<string, RecipeVariant>;
|
|
328
|
-
/**
|
|
329
|
-
* Variants used when no explicit prop is provided.
|
|
330
|
-
*
|
|
331
|
-
* Supports string, boolean, and numeric values.
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* ```ts
|
|
335
|
-
* defaultVariants: {
|
|
336
|
-
* size: "md",
|
|
337
|
-
* rounded: false,
|
|
338
|
-
* }
|
|
339
|
-
* ```
|
|
68
|
+
* @default false
|
|
340
69
|
*/
|
|
341
|
-
|
|
70
|
+
attached?: boolean;
|
|
342
71
|
/**
|
|
343
|
-
*
|
|
344
|
-
* This is useful for special combinations that require additional styling.
|
|
72
|
+
* Space between group items when not attached.
|
|
345
73
|
*
|
|
346
|
-
* @
|
|
347
|
-
* ```ts
|
|
348
|
-
* compoundVariants: [
|
|
349
|
-
* {
|
|
350
|
-
* conditions: { variant: "solid", color: "brand" },
|
|
351
|
-
* className: "shadow-lg",
|
|
352
|
-
* },
|
|
353
|
-
* {
|
|
354
|
-
* conditions: { size: "lg", color: "destructive" },
|
|
355
|
-
* className: "uppercase",
|
|
356
|
-
* },
|
|
357
|
-
* ]
|
|
358
|
-
* ```
|
|
74
|
+
* @default "md"
|
|
359
75
|
*/
|
|
360
|
-
|
|
76
|
+
spacing?: ButtonGroupSpacing;
|
|
361
77
|
}
|
|
362
|
-
|
|
363
|
-
* A collection of component recipes, keyed by component name.
|
|
364
|
-
* Each component has its own `RecipeDefinition`.
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* ```ts
|
|
368
|
-
* const recipes: RecipeCollection = {
|
|
369
|
-
* Button: buttonRecipe,
|
|
370
|
-
* Card: cardRecipe,
|
|
371
|
-
* Input: inputRecipe,
|
|
372
|
-
* };
|
|
373
|
-
* ```
|
|
374
|
-
*/
|
|
375
|
-
type RecipeCollection = Record<string, RecipeDefinition>;
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* The primitive value type for any design token.
|
|
379
|
-
* Can be a CSS value as a string (e.g., "16px", "#fff", "1.5rem")
|
|
380
|
-
* or a unitless number (e.g., 0, 1.5, 4).
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```ts
|
|
384
|
-
* const fontSize: TokenValue = "1.25rem";
|
|
385
|
-
* const opacity: TokenValue = 0.8;
|
|
386
|
-
* ```
|
|
387
|
-
*/
|
|
388
|
-
type TokenValue = string | number;
|
|
389
|
-
/**
|
|
390
|
-
* A wrapper around a single design value.
|
|
391
|
-
* @template T - The specific TokenValue type (defaults to string | number).
|
|
392
|
-
*
|
|
393
|
-
* Every leaf in the token tree is a TokenDefinition.
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* ```ts
|
|
397
|
-
* const blue500: TokenDefinition<string> = { value: "#3b82f6" };
|
|
398
|
-
* const spacing4: TokenDefinition<number> = { value: 4 };
|
|
399
|
-
* ```
|
|
400
|
-
*/
|
|
401
|
-
interface TokenDefinition<T extends TokenValue = TokenValue> {
|
|
402
|
-
value: T;
|
|
78
|
+
interface ButtonGroupSeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, "children">, OrientationProps {
|
|
403
79
|
}
|
|
404
|
-
|
|
405
|
-
* A recursive structure that allows nested token collections.
|
|
406
|
-
* Keys are arbitrary strings and values are either a leaf (TokenDefinition)
|
|
407
|
-
* or another nested group.
|
|
408
|
-
*
|
|
409
|
-
* This enables hierarchical paths like:
|
|
410
|
-
* - colors.blue.500
|
|
411
|
-
* - spacing.4
|
|
412
|
-
* - radii.md
|
|
413
|
-
*
|
|
414
|
-
* @example
|
|
415
|
-
* ```ts
|
|
416
|
-
* const tokens: TokenGroup = {
|
|
417
|
-
* colors: {
|
|
418
|
-
* blue: {
|
|
419
|
-
* 50: { value: "#eff6ff" },
|
|
420
|
-
* 500: { value: "#3b82f6" },
|
|
421
|
-
* },
|
|
422
|
-
* red: { value: "#ef4444" }, // direct leaf
|
|
423
|
-
* },
|
|
424
|
-
* spacing: {
|
|
425
|
-
* sm: { value: "8px" },
|
|
426
|
-
* md: { value: "16px" },
|
|
427
|
-
* },
|
|
428
|
-
* };
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
interface TokenGroup {
|
|
432
|
-
[key: string]: TokenDefinition | TokenGroup;
|
|
80
|
+
interface ButtonGroupTextProps extends HTMLAttributes<HTMLSpanElement>, Omit<BaseProps, "unstyled"> {
|
|
433
81
|
}
|
|
434
|
-
|
|
435
|
-
* A flat collection of color values for a single color family.
|
|
436
|
-
* Keys typically represent shades (e.g., "50", "100", "500", "900").
|
|
437
|
-
* Each value is a TokenDefinition<string> representing a CSS color.
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ```ts
|
|
441
|
-
* const blueScale: ColorScale = {
|
|
442
|
-
* 50: { value: "#eff6ff" },
|
|
443
|
-
* 100: { value: "#dbeafe" },
|
|
444
|
-
* 500: { value: "#3b82f6" },
|
|
445
|
-
* 900: { value: "#1e3a8a" },
|
|
446
|
-
* };
|
|
447
|
-
* ```
|
|
448
|
-
*/
|
|
449
|
-
interface ColorScale {
|
|
450
|
-
[key: string]: TokenDefinition<string>;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* A collection of color scales and/or direct color tokens.
|
|
454
|
-
* Keys are colour family names (e.g., "blue", "gray", "brand").
|
|
455
|
-
* Values can be a full ColorScale or a single TokenDefinition<string>.
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```ts
|
|
459
|
-
* const colors: ColorTokens = {
|
|
460
|
-
* blue: { 50: { value: "#eff6ff" }, 500: { value: "#3b82f6" } },
|
|
461
|
-
* gray: { 100: { value: "#f3f4f6" }, 900: { value: "#111827" } },
|
|
462
|
-
* brand: { value: "#2563eb" }, // flat single color
|
|
463
|
-
* };
|
|
464
|
-
* ```
|
|
465
|
-
*/
|
|
466
|
-
interface ColorTokens {
|
|
467
|
-
[key: string]: ColorScale | TokenDefinition<string>;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* A flat map of spacing tokens.
|
|
471
|
-
* Keys describe the spacing size (e.g., "xs", "md", "lg", "4").
|
|
472
|
-
* Values are TokenDefinition<string> containing a CSS length.
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* ```ts
|
|
476
|
-
* const spacing: SpacingTokens = {
|
|
477
|
-
* xs: { value: "4px" },
|
|
478
|
-
* md: { value: "16px" },
|
|
479
|
-
* lg: { value: "24px" },
|
|
480
|
-
* };
|
|
481
|
-
* ```
|
|
482
|
-
*/
|
|
483
|
-
interface SpacingTokens {
|
|
484
|
-
[key: string]: TokenDefinition<string>;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* A flat map of border‑radius tokens.
|
|
488
|
-
* Keys describe the radius size (e.g., "sm", "md", "full").
|
|
489
|
-
* Values are TokenDefinition<string> containing a CSS length.
|
|
490
|
-
*/
|
|
491
|
-
interface RadiusTokens {
|
|
492
|
-
[key: string]: TokenDefinition<string>;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* A flat map of font‑family tokens.
|
|
496
|
-
* Keys describe the font name (e.g., "body", "heading", "mono").
|
|
497
|
-
* Values are TokenDefinition<string> containing a CSS font‑family value.
|
|
498
|
-
*/
|
|
499
|
-
interface FontTokens {
|
|
500
|
-
[key: string]: TokenDefinition<string>;
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* A flat map of font‑size tokens.
|
|
504
|
-
* Keys describe the size name (e.g., "xs", "sm", "base", "xl").
|
|
505
|
-
* Values are TokenDefinition<string> containing a CSS font‑size.
|
|
506
|
-
*/
|
|
507
|
-
interface FontSizeTokens {
|
|
508
|
-
[key: string]: TokenDefinition<string>;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* A flat map of font‑weight tokens.
|
|
512
|
-
* Keys describe the weight name (e.g., "normal", "medium", "bold").
|
|
513
|
-
* Values are TokenDefinition<string> containing a CSS font‑weight (e.g., "400", "700").
|
|
514
|
-
*/
|
|
515
|
-
interface FontWeightTokens {
|
|
516
|
-
[key: string]: TokenDefinition<string>;
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* A flat map of line‑height tokens.
|
|
520
|
-
* Keys describe the line‑height name (e.g., "tight", "normal", "loose").
|
|
521
|
-
* Values are TokenDefinition<string> containing a CSS line‑height.
|
|
522
|
-
*/
|
|
523
|
-
interface LineHeightTokens {
|
|
524
|
-
[key: string]: TokenDefinition<string>;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* A flat map of letter‑spacing tokens.
|
|
528
|
-
* Keys describe the spacing name (e.g., "tight", "wide", "wider").
|
|
529
|
-
* Values are TokenDefinition<string> containing a CSS letter‑spacing.
|
|
530
|
-
*/
|
|
531
|
-
interface LetterSpacingTokens {
|
|
532
|
-
[key: string]: TokenDefinition<string>;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* A flat map of shadow tokens.
|
|
536
|
-
* Keys describe the shadow name (e.g., "sm", "md", "lg", "xl").
|
|
537
|
-
* Values are TokenDefinition<string> containing a CSS box‑shadow value.
|
|
538
|
-
*/
|
|
539
|
-
interface ShadowTokens {
|
|
540
|
-
[key: string]: TokenDefinition<string>;
|
|
82
|
+
interface ButtonGroupLabelProps extends HTMLAttributes<HTMLSpanElement>, Omit<BaseProps, "unstyled"> {
|
|
541
83
|
}
|
|
542
|
-
|
|
543
|
-
* A flat map of animation tokens.
|
|
544
|
-
* Keys describe the animation name (e.g., "fade", "slide", "spin").
|
|
545
|
-
* Values are TokenDefinition<string> containing a CSS animation shorthand or keyframes name.
|
|
546
|
-
*/
|
|
547
|
-
interface AnimationTokens {
|
|
548
|
-
[key: string]: TokenDefinition<string>;
|
|
84
|
+
interface ButtonGroupItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
549
85
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
* to be added as the design system evolves.
|
|
557
|
-
*
|
|
558
|
-
* @example
|
|
559
|
-
* ```ts
|
|
560
|
-
* const tokens: DesignTokens = {
|
|
561
|
-
* colors: {
|
|
562
|
-
* blue: { 50: { value: "#eff6ff" }, 500: { value: "#3b82f6" } },
|
|
563
|
-
* gray: { 100: { value: "#f3f4f6" }, 900: { value: "#111827" } },
|
|
564
|
-
* },
|
|
565
|
-
* spacing: { sm: { value: "8px" }, md: { value: "16px" } },
|
|
566
|
-
* radii: { md: { value: "8px" } },
|
|
567
|
-
* };
|
|
568
|
-
* ```
|
|
569
|
-
*/
|
|
570
|
-
interface DesignTokens {
|
|
571
|
-
colors?: ColorTokens;
|
|
572
|
-
spacing?: SpacingTokens;
|
|
573
|
-
radii?: RadiusTokens;
|
|
574
|
-
fonts?: FontTokens;
|
|
575
|
-
fontSizes?: FontSizeTokens;
|
|
576
|
-
fontWeights?: FontWeightTokens;
|
|
577
|
-
lineHeights?: LineHeightTokens;
|
|
578
|
-
letterSpacings?: LetterSpacingTokens;
|
|
579
|
-
shadows?: ShadowTokens;
|
|
580
|
-
animations?: AnimationTokens;
|
|
581
|
-
[key: string]: unknown;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* A value that can differ between light and dark color modes.
|
|
585
|
-
* @template T - The type of the value (defaults to string).
|
|
586
|
-
*
|
|
587
|
-
* @example
|
|
588
|
-
* ```ts
|
|
589
|
-
* const brandColor: ColorModeValue = {
|
|
590
|
-
* light: "#3b82f6",
|
|
591
|
-
* dark: "#60a5fa",
|
|
592
|
-
* };
|
|
593
|
-
* ```
|
|
594
|
-
*/
|
|
595
|
-
type ColorModeValue<T = string> = {
|
|
596
|
-
light: T;
|
|
597
|
-
dark: T;
|
|
86
|
+
|
|
87
|
+
declare const ButtonGroup: react.ForwardRefExoticComponent<ButtonGroupProps & react.RefAttributes<HTMLDivElement>> & {
|
|
88
|
+
Separator: react.ForwardRefExoticComponent<ButtonGroupSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
Text: react.ForwardRefExoticComponent<ButtonGroupTextProps & react.RefAttributes<HTMLSpanElement>>;
|
|
90
|
+
Label: react.ForwardRefExoticComponent<ButtonGroupLabelProps & react.RefAttributes<HTMLSpanElement>>;
|
|
91
|
+
Item: react.ForwardRefExoticComponent<ButtonGroupItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
598
92
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
*
|
|
606
|
-
* @example
|
|
607
|
-
* ```ts
|
|
608
|
-
* const surfaceToken: SemanticToken = {
|
|
609
|
-
* value: { light: "#ffffff", dark: "#1e293b" }
|
|
610
|
-
* };
|
|
611
|
-
* const dangerToken: SemanticToken = { value: "#ef4444" }; // static
|
|
612
|
-
* ```
|
|
613
|
-
*/
|
|
614
|
-
interface SemanticToken<T extends TokenValue = string> {
|
|
615
|
-
value: T | ColorModeValue<T>;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* A flat record of semantic color tokens.
|
|
619
|
-
* Keys describe the color role (e.g., "brand", "surface", "text", "danger").
|
|
620
|
-
* Values are SemanticToken<string> that resolve to a CSS color.
|
|
621
|
-
*
|
|
622
|
-
* @example
|
|
623
|
-
* ```ts
|
|
624
|
-
* const semanticColors: SemanticColorTokens = {
|
|
625
|
-
* brand: { value: { light: "#3b82f6", dark: "#60a5fa" } },
|
|
626
|
-
* surface: { value: { light: "#ffffff", dark: "#1e293b" } },
|
|
627
|
-
* text: { value: { light: "#111827", dark: "#f1f5f9" } },
|
|
628
|
-
* danger: { value: "#ef4444" }, // static
|
|
629
|
-
* };
|
|
630
|
-
* ```
|
|
631
|
-
*/
|
|
632
|
-
interface SemanticColorTokens {
|
|
633
|
-
[key: string]: SemanticToken<string>;
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Container for all semantic tokens.
|
|
637
|
-
* Currently only `colors` is defined, but the index signature allows
|
|
638
|
-
* future categories like `shadows`, `borders`, or `opacities`.
|
|
639
|
-
*/
|
|
640
|
-
interface SemanticTokens {
|
|
641
|
-
colors?: SemanticColorTokens;
|
|
642
|
-
[key: string]: unknown;
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* A set of CSS properties that define a typography style.
|
|
646
|
-
* All properties are optional – you can compose styles incrementally.
|
|
647
|
-
*
|
|
648
|
-
* @example
|
|
649
|
-
* ```ts
|
|
650
|
-
* const headingStyle: TextStyle = {
|
|
651
|
-
* fontFamily: "Inter, sans-serif",
|
|
652
|
-
* fontSize: "2rem",
|
|
653
|
-
* fontWeight: 700,
|
|
654
|
-
* lineHeight: "1.2",
|
|
655
|
-
* letterSpacing: "-0.02em",
|
|
656
|
-
* };
|
|
657
|
-
* ```
|
|
658
|
-
*/
|
|
659
|
-
interface TypographyStyle {
|
|
660
|
-
fontFamily?: string;
|
|
661
|
-
fontSize?: string;
|
|
662
|
-
fontWeight?: string | number;
|
|
663
|
-
lineHeight?: string;
|
|
664
|
-
letterSpacing?: string;
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* A collection of named text styles.
|
|
668
|
-
* Keys are style names (e.g., "heading", "body", "caption", "label").
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```ts
|
|
672
|
-
* const typography: Typography = {
|
|
673
|
-
* heading: { fontSize: "2rem", fontWeight: 700 },
|
|
674
|
-
* body: { fontSize: "1rem", lineHeight: "1.5" },
|
|
675
|
-
* };
|
|
676
|
-
* ```
|
|
677
|
-
*/
|
|
678
|
-
type Typography = Record<string, TypographyStyle>;
|
|
679
|
-
/**
|
|
680
|
-
* A set of CSS properties that define the dimensions and spacing
|
|
681
|
-
* for a component at a specific size.
|
|
682
|
-
*
|
|
683
|
-
* Used to build size‑variant scales for components (e.g., "sm", "md", "lg").
|
|
684
|
-
*
|
|
685
|
-
* @example
|
|
686
|
-
* ```ts
|
|
687
|
-
* const buttonSize: SizeToken = {
|
|
688
|
-
* height: "40px",
|
|
689
|
-
* paddingX: "16px",
|
|
690
|
-
* fontSize: "1rem",
|
|
691
|
-
* iconSize: "20px",
|
|
692
|
-
* radius: "8px",
|
|
693
|
-
* };
|
|
694
|
-
* ```
|
|
695
|
-
*/
|
|
696
|
-
interface SizeToken {
|
|
697
|
-
height?: string;
|
|
698
|
-
width?: string;
|
|
699
|
-
paddingX?: string;
|
|
700
|
-
paddingY?: string;
|
|
701
|
-
fontSize?: string;
|
|
702
|
-
gap?: string;
|
|
703
|
-
iconSize?: string;
|
|
704
|
-
radius?: string;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* A collection of named size tokens.
|
|
708
|
-
* Keys are size names (e.g., "sm", "md", "lg", "xl").
|
|
709
|
-
*
|
|
710
|
-
* @example
|
|
711
|
-
* ```ts
|
|
712
|
-
* const sizes: SizeScale = {
|
|
713
|
-
* sm: { height: "32px", paddingX: "12px", fontSize: "0.875rem" },
|
|
714
|
-
* md: { height: "40px", paddingX: "16px", fontSize: "1rem" },
|
|
715
|
-
* lg: { height: "48px", paddingX: "24px", fontSize: "1.125rem" },
|
|
716
|
-
* };
|
|
717
|
-
* ```
|
|
718
|
-
*/
|
|
719
|
-
type SizeScale = Record<string, SizeToken>;
|
|
720
|
-
/**
|
|
721
|
-
* Defines the transition properties for a theme change.
|
|
722
|
-
* `type` refers to a base transition key (imported from BaseTransition).
|
|
723
|
-
* `duration` and `delay` are in milliseconds.
|
|
724
|
-
* `easing` is a CSS easing function.
|
|
725
|
-
*/
|
|
726
|
-
interface ThemeTransition {
|
|
727
|
-
type?: BaseTransition;
|
|
728
|
-
duration?: number;
|
|
729
|
-
delay?: number;
|
|
730
|
-
easing?: string;
|
|
93
|
+
|
|
94
|
+
interface ButtonGroupContextValue {
|
|
95
|
+
orientation: Orientation;
|
|
96
|
+
attached: boolean;
|
|
97
|
+
spacing: ButtonGroupSpacing;
|
|
98
|
+
size?: ButtonProps["size"];
|
|
731
99
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
* It combines primitive tokens, semantic tokens, text styles,
|
|
735
|
-
* component recipes, a global intensity, legacy tokens, and size scales.
|
|
736
|
-
*
|
|
737
|
-
* @property tokens - Raw design values (colors, spacing, radii, etc.).
|
|
738
|
-
* @property semanticTokens - Role‑based tokens that adapt to color mode.
|
|
739
|
-
* @property typography - Reusable typography styles.
|
|
740
|
-
* @property recipes - Component‑specific styles (from RecipeCollection).
|
|
741
|
-
* @property intensity - A global multiplier for visual prominence (e.g., 0.8, 1, 1.2).
|
|
742
|
-
* @property light - Legacy theme tokens for light mode (kept for migration).
|
|
743
|
-
* @property dark - Legacy theme tokens for dark mode (kept for migration).
|
|
744
|
-
* @property sizes - Legacy component size scale (will move to recipes).
|
|
745
|
-
*/
|
|
746
|
-
interface Theme {
|
|
747
|
-
tokens: DesignTokens;
|
|
748
|
-
semanticTokens: SemanticTokens;
|
|
749
|
-
typography: Typography;
|
|
750
|
-
recipes: RecipeCollection;
|
|
751
|
-
intensity: number;
|
|
752
|
-
sizes: SizeScale;
|
|
100
|
+
interface ButtonGroupItemContextValue {
|
|
101
|
+
embedded: true;
|
|
753
102
|
}
|
|
103
|
+
declare const ButtonGroupContext: react.Context<ButtonGroupContextValue>;
|
|
104
|
+
declare const ButtonGroupItemContext: react.Context<ButtonGroupItemContextValue | null>;
|
|
754
105
|
/**
|
|
755
|
-
*
|
|
756
|
-
*
|
|
106
|
+
* Hook to consume the button group context.
|
|
107
|
+
* Throws an error if used outside of a `ButtonGroup` provider.
|
|
757
108
|
*/
|
|
758
|
-
|
|
109
|
+
declare function useButtonGroupContext(): ButtonGroupContextValue;
|
|
759
110
|
/**
|
|
760
|
-
*
|
|
761
|
-
*
|
|
111
|
+
* Hook to consume the button group context without throwing.
|
|
112
|
+
* Returns the default context if used outside a provider.
|
|
762
113
|
*/
|
|
763
|
-
|
|
764
|
-
subtle: number;
|
|
765
|
-
default: number;
|
|
766
|
-
bold: number;
|
|
767
|
-
}
|
|
768
|
-
interface ThemeOverride {
|
|
769
|
-
/**
|
|
770
|
-
* Override primitive design tokens.
|
|
771
|
-
* Allows partial updates to raw values like colors, spacing, radii, etc.
|
|
772
|
-
*
|
|
773
|
-
* @example
|
|
774
|
-
* ```ts
|
|
775
|
-
* tokens: {
|
|
776
|
-
* colors: { blue: { 500: { value: "#1d4ed8" } } },
|
|
777
|
-
* spacing: { md: { value: "20px" } },
|
|
778
|
-
* }
|
|
779
|
-
* ```
|
|
780
|
-
*/
|
|
781
|
-
tokens?: DeepPartial<DesignTokens>;
|
|
782
|
-
/**
|
|
783
|
-
* Override semantic tokens.
|
|
784
|
-
* Allows partial updates to role‑based tokens (brand, surface, text, etc.)
|
|
785
|
-
* that can adapt to light/dark modes.
|
|
786
|
-
*
|
|
787
|
-
* @example
|
|
788
|
-
* ```ts
|
|
789
|
-
* semanticTokens: {
|
|
790
|
-
* colors: {
|
|
791
|
-
* brand: { value: { light: "#1d4ed8", dark: "#60a5fa" } },
|
|
792
|
-
* surface: { value: { light: "#ffffff", dark: "#0f172a" } },
|
|
793
|
-
* },
|
|
794
|
-
* }
|
|
795
|
-
* ```
|
|
796
|
-
*/
|
|
797
|
-
semanticTokens?: DeepPartial<SemanticTokens>;
|
|
798
|
-
/**
|
|
799
|
-
* Override reusable text styles.
|
|
800
|
-
* Allows partial updates to typography presets like heading, body, caption, etc.
|
|
801
|
-
*
|
|
802
|
-
* @example
|
|
803
|
-
* ```ts
|
|
804
|
-
* typography: {
|
|
805
|
-
* heading: { fontSize: "2.5rem", fontWeight: 800 },
|
|
806
|
-
* body: { fontSize: "1.125rem", lineHeight: "1.75" },
|
|
807
|
-
* }
|
|
808
|
-
* ```
|
|
809
|
-
*/
|
|
810
|
-
typography?: DeepPartial<Typography>;
|
|
811
|
-
/**
|
|
812
|
-
* Override component recipes.
|
|
813
|
-
* Allows modifying the base styles, variants, default variants, and compound variants
|
|
814
|
-
* for any component (e.g., Button, Card, Input) without rewriting the entire theme.
|
|
815
|
-
*
|
|
816
|
-
* Each key is a component name, and the value is a deep partial of its RecipeDefinition.
|
|
817
|
-
* This means you can override only specific variants or classes while keeping the rest intact.
|
|
818
|
-
*
|
|
819
|
-
* @example
|
|
820
|
-
* ```ts
|
|
821
|
-
* recipes: {
|
|
822
|
-
* Button: {
|
|
823
|
-
* base: "custom-base-class inline-flex items-center",
|
|
824
|
-
* variants: {
|
|
825
|
-
* size: {
|
|
826
|
-
* md: "px-6 py-3 text-lg", // override only the "md" size
|
|
827
|
-
* },
|
|
828
|
-
* },
|
|
829
|
-
* compoundVariants: [
|
|
830
|
-
* {
|
|
831
|
-
* conditions: { variant: "solid", color: "brand" },
|
|
832
|
-
* className: "shadow-lg custom-brand-shadow",
|
|
833
|
-
* },
|
|
834
|
-
* ],
|
|
835
|
-
* },
|
|
836
|
-
* Card: {
|
|
837
|
-
* base: "rounded-xl p-6 bg-surface",
|
|
838
|
-
* },
|
|
839
|
-
* }
|
|
840
|
-
* ```
|
|
841
|
-
*/
|
|
842
|
-
recipes?: DeepPartial<RecipeCollection>;
|
|
843
|
-
/**
|
|
844
|
-
* Override the global visual intensity.
|
|
845
|
-
* A multiplier for effects like shadows, saturation, or contrast.
|
|
846
|
-
* Typical values: 0.8 (subtle), 1.0 (default), 1.2 (bold).
|
|
847
|
-
*
|
|
848
|
-
* @example
|
|
849
|
-
* ```ts
|
|
850
|
-
* intensity: 1.1 // Slightly bolder than default
|
|
851
|
-
* ```
|
|
852
|
-
*/
|
|
853
|
-
intensity?: number;
|
|
854
|
-
/**
|
|
855
|
-
* Override legacy component size scales.
|
|
856
|
-
* Allows updating specific size tokens (height, padding, fontSize, etc.)
|
|
857
|
-
* for a given size name (e.g., "sm", "md", "lg").
|
|
858
|
-
*
|
|
859
|
-
* This will eventually be replaced by component‑specific size variants in recipes.
|
|
860
|
-
*
|
|
861
|
-
* @example
|
|
862
|
-
* ```ts
|
|
863
|
-
* sizes: {
|
|
864
|
-
* md: { height: "44px", paddingX: "20px" }, // override only "md" size
|
|
865
|
-
* lg: { height: "52px", fontSize: "1.25rem" },
|
|
866
|
-
* }
|
|
867
|
-
* ```
|
|
868
|
-
*/
|
|
869
|
-
sizes?: Record<string, Partial<SizeToken>>;
|
|
870
|
-
}
|
|
114
|
+
declare function useOptionalButtonGroupContext(): ButtonGroupContextValue;
|
|
871
115
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
* - "dark": force dark mode.
|
|
875
|
-
* - "system": follow the user's operating system preference.
|
|
116
|
+
* Hook to check if a button is embedded inside a `ButtonGroupItem`.
|
|
117
|
+
* Returns `true` if used inside an item, otherwise `false`.
|
|
876
118
|
*/
|
|
877
|
-
|
|
119
|
+
declare function useButtonGroupItemContext(): boolean;
|
|
120
|
+
declare function useOptionalButtonGroupItemContext(): ButtonGroupItemContextValue | null;
|
|
878
121
|
|
|
879
|
-
type ThemeTogglerVariant = Exclude<ButtonVariant,
|
|
122
|
+
type ThemeTogglerVariant = Exclude<ButtonVariant, "link">;
|
|
880
123
|
type ThemeTogglerDisplay = "buttons" | "cycle";
|
|
881
124
|
type ThemeTogglerColor = Exclude<BaseColor, "destructive" | "warning" | "success" | "white" | "info">;
|
|
882
|
-
interface ThemeTogglerProps extends Omit<BaseProps, "
|
|
883
|
-
variant?:
|
|
884
|
-
activeVariant?: ThemeTogglerVariant;
|
|
125
|
+
interface ThemeTogglerProps extends Omit<BaseProps, "style">, OrientationProps, VariantProps<ButtonVariant> {
|
|
126
|
+
variant?: ButtonVariant;
|
|
885
127
|
color?: ButtonProps["color"];
|
|
128
|
+
activeVariant?: ButtonVariant;
|
|
886
129
|
activeColor?: ButtonProps["color"];
|
|
887
130
|
size?: ButtonProps["size"];
|
|
888
131
|
iconOnly?: boolean;
|
|
889
132
|
allowSystem?: boolean;
|
|
890
|
-
orientation?: Orientation;
|
|
891
133
|
rounded?: boolean;
|
|
892
134
|
labels?: {
|
|
893
135
|
light?: string;
|
|
@@ -895,21 +137,24 @@ interface ThemeTogglerProps extends Omit<BaseProps, "children"> {
|
|
|
895
137
|
system?: string;
|
|
896
138
|
};
|
|
897
139
|
icons?: {
|
|
898
|
-
light?:
|
|
899
|
-
dark?:
|
|
900
|
-
system?:
|
|
140
|
+
light?: ReactNode;
|
|
141
|
+
dark?: ReactNode;
|
|
142
|
+
system?: ReactNode;
|
|
901
143
|
};
|
|
902
|
-
buttonProps?:
|
|
903
|
-
display?:
|
|
904
|
-
|
|
144
|
+
buttonProps?: ButtonProps;
|
|
145
|
+
display?: "buttons" | "cycle";
|
|
146
|
+
animated?: boolean;
|
|
147
|
+
transition?: ThemeTogglerTransition;
|
|
148
|
+
indicatorClassName?: string;
|
|
149
|
+
indicatorStyle?: CSSProperties;
|
|
905
150
|
}
|
|
906
151
|
|
|
907
|
-
declare function ThemeToggler({ variant,
|
|
152
|
+
declare function ThemeToggler({ variant, color, activeVariant, activeColor, size, iconOnly, allowSystem, orientation, rounded, unstyled, labels, icons, className, buttonProps, display, animated, transition, }: ThemeTogglerProps): react.JSX.Element;
|
|
908
153
|
|
|
909
154
|
type InputVariant = "outline" | "filled" | "ghost";
|
|
910
155
|
type InputSize = "xs" | "sm" | "md" | "lg";
|
|
911
156
|
type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "password-current" | "password-new" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
|
|
912
|
-
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue">, BaseProps, SizeProps, VariantProps<InputVariant>, DisabledProps, LoadingProps, FullWidthProps, ClearableProps, ValueProps<string | number | undefined>, StateProps, TrimProps {
|
|
157
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue">, BaseProps, SizeProps, VariantProps<InputVariant>, DisabledProps, LoadingProps, FullWidthProps, ClearableProps, UndoRedoProps, ValueProps<string | number | undefined>, StateProps, TrimProps, TypographyProps {
|
|
913
158
|
inputClassName?: string;
|
|
914
159
|
kind?: InputKind;
|
|
915
160
|
rounded?: boolean;
|
|
@@ -930,7 +175,6 @@ type InputKindDefaults = Record<InputKind, {
|
|
|
930
175
|
|
|
931
176
|
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
932
177
|
|
|
933
|
-
type FormFieldStatus = "none" | "error" | "success" | "warning";
|
|
934
178
|
interface FormFieldProps extends Omit<BaseProps, "unstyled"> {
|
|
935
179
|
id?: string;
|
|
936
180
|
error?: string;
|
|
@@ -1007,7 +251,7 @@ interface SelectLabelProps {
|
|
|
1007
251
|
className?: string;
|
|
1008
252
|
}
|
|
1009
253
|
|
|
1010
|
-
declare function SelectContent({ className, children, ...props }: SelectContentProps): react.JSX.Element
|
|
254
|
+
declare function SelectContent({ className, children, ...props }: SelectContentProps): react.JSX.Element;
|
|
1011
255
|
|
|
1012
256
|
declare function SelectItem({ value, disabled, children, className, ...props }: SelectItemProps): react.JSX.Element;
|
|
1013
257
|
|
|
@@ -1040,7 +284,7 @@ interface MarkdownEditorProps extends Omit<TextareaCoreProps, "resize" | "autoRe
|
|
|
1040
284
|
}
|
|
1041
285
|
|
|
1042
286
|
type TextareaResize = "none" | "both" | "horizontal" | "vertical";
|
|
1043
|
-
interface TextareaCoreProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "defaultValue" | "value">, Omit<BaseProps, "unstyled" | "style">, SizeProps, StateProps, VariantProps<InputVariant>, ClearableProps, ValueProps, FullWidthProps, EmbeddedProps, StateProps, TrimProps, ValidateProps<string
|
|
287
|
+
interface TextareaCoreProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "defaultValue" | "value">, Omit<BaseProps, "unstyled" | "style">, SizeProps, StateProps, VariantProps<InputVariant>, ClearableProps, ValueProps, FullWidthProps, EmbeddedProps, StateProps, TrimProps, ValidateProps<string>, TypographyProps {
|
|
1044
288
|
resize?: TextareaResize;
|
|
1045
289
|
autoResize?: boolean;
|
|
1046
290
|
minRows?: number;
|
|
@@ -1094,39 +338,26 @@ declare function RadioGroup({ value: valueProp, defaultValue, onValueChange, nam
|
|
|
1094
338
|
|
|
1095
339
|
declare function Radio({ value, disabled: itemDisabled, label, description, className, ...props }: RadioProps): react.JSX.Element;
|
|
1096
340
|
|
|
341
|
+
type SwitchSize = "xs" | "sm" | "md" | "lg";
|
|
1097
342
|
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable {
|
|
1098
343
|
checked?: boolean;
|
|
1099
344
|
defaultChecked?: boolean;
|
|
1100
345
|
onCheckedChange?: (checked: boolean) => void;
|
|
1101
|
-
size?:
|
|
346
|
+
size?: SwitchSize;
|
|
1102
347
|
error?: boolean;
|
|
1103
348
|
success?: boolean;
|
|
1104
|
-
required?: boolean;
|
|
1105
|
-
disabled?: boolean;
|
|
1106
349
|
label?: ReactNode;
|
|
1107
350
|
description?: ReactNode;
|
|
1108
351
|
}
|
|
1109
352
|
|
|
1110
|
-
declare
|
|
353
|
+
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLInputElement>>;
|
|
1111
354
|
|
|
1112
|
-
interface ComboboxProps extends
|
|
1113
|
-
value?: string;
|
|
1114
|
-
onValueChange?: (value: string | undefined) => void;
|
|
1115
|
-
inputValue?: string;
|
|
1116
|
-
defaultInputValue?: string;
|
|
1117
|
-
onInputChange?: (input: string) => void;
|
|
1118
|
-
disabled?: boolean;
|
|
355
|
+
interface ComboboxProps extends Omit<BaseProps, "unstyled">, ValueProps<string | undefined>, ControlledProps<string | undefined, "inputValue", "defaultInputValue", "onInputChange">, DisabledProps, VariantProps<BaseVariant>, SizeProps, ClearableProps, StatusProps, StateProps {
|
|
1119
356
|
required?: boolean;
|
|
1120
|
-
error?: boolean;
|
|
1121
|
-
success?: boolean;
|
|
1122
357
|
rounded?: boolean;
|
|
1123
358
|
name?: string;
|
|
1124
|
-
variant?: InputVariant;
|
|
1125
|
-
size?: InputSize;
|
|
1126
359
|
placeholder?: string;
|
|
1127
|
-
clearable?: boolean;
|
|
1128
360
|
allowFreeText?: boolean;
|
|
1129
|
-
children: ReactNode;
|
|
1130
361
|
}
|
|
1131
362
|
interface ComboboxItemProps {
|
|
1132
363
|
value: string;
|
|
@@ -1134,13 +365,8 @@ interface ComboboxItemProps {
|
|
|
1134
365
|
children: ReactNode;
|
|
1135
366
|
className?: string;
|
|
1136
367
|
}
|
|
1137
|
-
interface ComboboxInputProps {
|
|
1138
|
-
variant?: InputVariant;
|
|
1139
|
-
size?: InputSize;
|
|
1140
|
-
placeholder?: string;
|
|
1141
|
-
clearable?: boolean;
|
|
368
|
+
interface ComboboxInputProps extends InputProps {
|
|
1142
369
|
allowFreeText?: boolean;
|
|
1143
|
-
className?: string;
|
|
1144
370
|
}
|
|
1145
371
|
|
|
1146
372
|
declare function ComboboxItem({ value, disabled, children, className, }: ComboboxItemProps): react.JSX.Element | null;
|
|
@@ -1217,6 +443,155 @@ declare const MultiSelectTrigger: react.ForwardRefExoticComponent<{
|
|
|
1217
443
|
className?: string;
|
|
1218
444
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
1219
445
|
|
|
446
|
+
interface ContainerProps extends BaseProps {
|
|
447
|
+
/**
|
|
448
|
+
* Max-width of the container, mapped to the Container recipe's `size` variant.
|
|
449
|
+
* @default "lg"
|
|
450
|
+
*/
|
|
451
|
+
maxWidth?: Size | (string & {});
|
|
452
|
+
/**
|
|
453
|
+
* Horizontal padding. Token-based (Size) or a raw responsive CSS value.
|
|
454
|
+
*/
|
|
455
|
+
padding?: ResponsiveValue<Size | (string & {})>;
|
|
456
|
+
/**
|
|
457
|
+
* Centers the container horizontally via margin-inline: auto.
|
|
458
|
+
* @default true
|
|
459
|
+
*/
|
|
460
|
+
centered?: boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Element type to render as.
|
|
463
|
+
* @default "div"
|
|
464
|
+
*/
|
|
465
|
+
as?: ElementType;
|
|
466
|
+
children?: ReactNode;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLDivElement>>;
|
|
470
|
+
|
|
471
|
+
interface FlexProps extends BaseProps {
|
|
472
|
+
/** @default "row" */
|
|
473
|
+
direction?: ResponsiveValue<CSSProperties["flexDirection"]>;
|
|
474
|
+
/** @default "nowrap" */
|
|
475
|
+
wrap?: ResponsiveValue<CSSProperties["flexWrap"]>;
|
|
476
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
477
|
+
justify?: ResponsiveValue<CSSProperties["justifyContent"]>;
|
|
478
|
+
/** Token-based gap, e.g. "sm" | "md" | raw CSS length */
|
|
479
|
+
gap?: ResponsiveValue<Size | (string & {})>;
|
|
480
|
+
as?: ElementType;
|
|
481
|
+
children?: ReactNode;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
declare const Flex: react.ForwardRefExoticComponent<FlexProps & react.RefAttributes<HTMLDivElement>>;
|
|
485
|
+
|
|
486
|
+
interface StackProps extends BaseProps {
|
|
487
|
+
/**
|
|
488
|
+
* Layout direction of the stack.
|
|
489
|
+
* @default "vertical"
|
|
490
|
+
*/
|
|
491
|
+
orientation?: Orientation;
|
|
492
|
+
gap?: ResponsiveValue<Size | (string & {})>;
|
|
493
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
494
|
+
justify?: ResponsiveValue<CSSProperties["justifyContent"]>;
|
|
495
|
+
wrap?: ResponsiveValue<CSSProperties["flexWrap"]>;
|
|
496
|
+
/** Renders between each child. */
|
|
497
|
+
divider?: ReactNode;
|
|
498
|
+
as?: ElementType;
|
|
499
|
+
children?: ReactNode;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
declare const Stack: react.ForwardRefExoticComponent<StackProps & react.RefAttributes<HTMLDivElement>>;
|
|
503
|
+
|
|
504
|
+
interface GridProps extends BaseProps {
|
|
505
|
+
/**
|
|
506
|
+
* Shorthand for equal-width columns, e.g. `columns={3}` → repeat(3, 1fr).
|
|
507
|
+
* Ignored if `templateColumns` is set.
|
|
508
|
+
*/
|
|
509
|
+
columns?: ResponsiveValue<number>;
|
|
510
|
+
/** Raw escape hatch for gridTemplateColumns, e.g. "200px 1fr 1fr". */
|
|
511
|
+
templateColumns?: ResponsiveValue<string>;
|
|
512
|
+
/** Raw escape hatch for gridTemplateRows. */
|
|
513
|
+
templateRows?: ResponsiveValue<string>;
|
|
514
|
+
/** Raw escape hatch for gridTemplateAreas. Not responsive — rarely varies by breakpoint. */
|
|
515
|
+
templateAreas?: string;
|
|
516
|
+
gap?: ResponsiveValue<Size | (string & {})>;
|
|
517
|
+
columnGap?: ResponsiveValue<Size | (string & {})>;
|
|
518
|
+
rowGap?: ResponsiveValue<Size | (string & {})>;
|
|
519
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
520
|
+
justify?: ResponsiveValue<CSSProperties["justifyContent"]>;
|
|
521
|
+
as?: ElementType;
|
|
522
|
+
children?: ReactNode;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
declare const Grid: react.ForwardRefExoticComponent<GridProps & react.RefAttributes<HTMLDivElement>>;
|
|
526
|
+
|
|
527
|
+
type CardVariant = "solid" | "outline" | "ghost" | "elevated" | "compact";
|
|
528
|
+
type CardSize = "sm" | "md" | "lg";
|
|
529
|
+
interface CardProps extends ComponentPropsWithoutRef<"div"> {
|
|
530
|
+
/**
|
|
531
|
+
* Visual style of the card.
|
|
532
|
+
*/
|
|
533
|
+
variant?: CardVariant;
|
|
534
|
+
/**
|
|
535
|
+
* Controls the card's padding and overall density.
|
|
536
|
+
*/
|
|
537
|
+
size?: CardSize;
|
|
538
|
+
/**
|
|
539
|
+
* Indicates that the card contains an image.
|
|
540
|
+
*/
|
|
541
|
+
hasImage?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Makes the card span the full available width.
|
|
544
|
+
*/
|
|
545
|
+
fullWidth?: boolean;
|
|
546
|
+
/**
|
|
547
|
+
* Removes the card's default padding.
|
|
548
|
+
*/
|
|
549
|
+
noPadding?: boolean;
|
|
550
|
+
/**
|
|
551
|
+
* Card content.
|
|
552
|
+
*/
|
|
553
|
+
children?: ReactNode;
|
|
554
|
+
}
|
|
555
|
+
interface CardHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
556
|
+
children?: ReactNode;
|
|
557
|
+
}
|
|
558
|
+
interface CardBodyProps extends ComponentPropsWithoutRef<"div"> {
|
|
559
|
+
children?: ReactNode;
|
|
560
|
+
}
|
|
561
|
+
interface CardFooterProps extends ComponentPropsWithoutRef<"div"> {
|
|
562
|
+
children?: ReactNode;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
declare function Card({ variant, size, hasImage, fullWidth, noPadding, className, children, ...props }: CardProps): react.JSX.Element;
|
|
566
|
+
declare namespace Card {
|
|
567
|
+
var Header: typeof CardHeader;
|
|
568
|
+
var Body: typeof CardBody;
|
|
569
|
+
var Footer: typeof CardFooter;
|
|
570
|
+
}
|
|
571
|
+
declare function CardHeader({ className, children, ...props }: CardHeaderProps): react.JSX.Element;
|
|
572
|
+
declare function CardBody({ className, children, ...props }: CardBodyProps): react.JSX.Element;
|
|
573
|
+
declare function CardFooter({ className, children, ...props }: CardFooterProps): react.JSX.Element;
|
|
574
|
+
|
|
575
|
+
type SkeletonShape = {
|
|
576
|
+
rows?: number;
|
|
577
|
+
avatar?: boolean | {
|
|
578
|
+
size?: Extract<Size, "xs" | "sm" | "md">;
|
|
579
|
+
shape?: "circle" | "square";
|
|
580
|
+
};
|
|
581
|
+
width?: string | number;
|
|
582
|
+
height?: string | number;
|
|
583
|
+
radius?: string | number;
|
|
584
|
+
gap?: string | number;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
type SkeletonResolver<P = any> = (props: Partial<P>) => SkeletonShape;
|
|
588
|
+
type SkeletonDefinition<P = any> = {
|
|
589
|
+
resolve: SkeletonResolver<P>;
|
|
590
|
+
defaults?: SkeletonShape;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
declare const cardSkeleton: SkeletonDefinition<CardProps>;
|
|
594
|
+
|
|
1220
595
|
/**
|
|
1221
596
|
* Represents the visual state of the field for feedback and styling.
|
|
1222
597
|
*/
|
|
@@ -1251,7 +626,7 @@ interface InputFieldProps extends InputProps {
|
|
|
1251
626
|
*
|
|
1252
627
|
* @default 'none'
|
|
1253
628
|
*/
|
|
1254
|
-
status?: FormFieldStatus;
|
|
629
|
+
status?: FormFieldStatus$1;
|
|
1255
630
|
/**
|
|
1256
631
|
* Feedback message displayed below the input.
|
|
1257
632
|
* Typically paired with `status` to show success confirmations or error details.
|
|
@@ -1334,52 +709,29 @@ interface InputFieldProps extends InputProps {
|
|
|
1334
709
|
|
|
1335
710
|
declare const InputField: react.ForwardRefExoticComponent<InputFieldProps & react.RefAttributes<HTMLInputElement>>;
|
|
1336
711
|
|
|
712
|
+
interface TextProps extends TypographyProps {
|
|
713
|
+
as?: ElementType;
|
|
714
|
+
color?: BaseColor | string;
|
|
715
|
+
align?: "left" | "center" | "right" | "justify";
|
|
716
|
+
truncate?: boolean;
|
|
717
|
+
clampLines?: number;
|
|
718
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
719
|
+
italic?: boolean;
|
|
720
|
+
className?: string;
|
|
721
|
+
style?: CSSProperties;
|
|
722
|
+
children?: ReactNode;
|
|
723
|
+
}
|
|
724
|
+
|
|
1337
725
|
interface UIProviderProps {
|
|
1338
726
|
children: ReactNode;
|
|
1339
727
|
theme?: ThemeOverride;
|
|
1340
728
|
defaultMode?: ColorMode;
|
|
1341
729
|
as?: keyof JSX.IntrinsicElements;
|
|
1342
730
|
fallbackSize?: string;
|
|
731
|
+
themeTransition?: boolean;
|
|
732
|
+
themeTransitionDuration?: number;
|
|
1343
733
|
}
|
|
1344
|
-
declare function UIProvider({ children, theme: themeOverride, defaultMode, as, fallbackSize, }: UIProviderProps): JSX.Element;
|
|
1345
|
-
|
|
1346
|
-
interface ThemeContextValue {
|
|
1347
|
-
theme: Theme;
|
|
1348
|
-
mode: ColorMode;
|
|
1349
|
-
resolvedMode: "light" | "dark";
|
|
1350
|
-
setMode: (mode: ColorMode) => void;
|
|
1351
|
-
fallbackSize: string;
|
|
1352
|
-
tokens: ResolvedTokens;
|
|
1353
|
-
}
|
|
1354
|
-
declare const ThemeContext: react.Context<ThemeContextValue | null>;
|
|
1355
|
-
|
|
1356
|
-
declare function useTheme(): ThemeContextValue;
|
|
1357
|
-
|
|
1358
|
-
declare const BREAKPOINTS: {
|
|
1359
|
-
readonly sm: 640;
|
|
1360
|
-
readonly md: 768;
|
|
1361
|
-
readonly lg: 1024;
|
|
1362
|
-
readonly xl: 1280;
|
|
1363
|
-
readonly "2xl": 1536;
|
|
1364
|
-
};
|
|
1365
|
-
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
1366
|
-
/** Returns whether the viewport is at or above the given breakpoint. */
|
|
1367
|
-
declare function useBreakpoint(breakpoint: Breakpoint): boolean;
|
|
1368
|
-
|
|
1369
|
-
interface ResolvedSize {
|
|
1370
|
-
style: CSSProperties;
|
|
1371
|
-
iconSize?: CSSProperties["width"];
|
|
1372
|
-
fontSize?: CSSProperties["fontSize"];
|
|
1373
|
-
gap?: CSSProperties["gap"];
|
|
1374
|
-
}
|
|
1375
|
-
interface UseSizeStyleOptions {
|
|
1376
|
-
includeHeight?: boolean;
|
|
1377
|
-
widthFromHeight?: boolean;
|
|
1378
|
-
sizeOffset?: string;
|
|
1379
|
-
fontSizeOffset?: string;
|
|
1380
|
-
iconSizeOffset?: string;
|
|
1381
|
-
}
|
|
1382
|
-
declare function useSizeStyle(size: string, iconOnly?: boolean, componentName?: string, options?: UseSizeStyleOptions): ResolvedSize;
|
|
734
|
+
declare function UIProvider({ children, theme: themeOverride, defaultMode, as, fallbackSize, themeTransition, themeTransitionDuration, }: UIProviderProps): JSX.Element;
|
|
1383
735
|
|
|
1384
736
|
declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open: boolean): {
|
|
1385
737
|
contentRef: RefObject<HTMLDivElement | null>;
|
|
@@ -1389,50 +741,118 @@ declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open
|
|
|
1389
741
|
type TransitionStatus = Exclude<FormFieldStatus, "none"> | undefined;
|
|
1390
742
|
declare function useStatusTransition(status: FormFieldStatus): TransitionStatus;
|
|
1391
743
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
744
|
+
type ClearableFieldOptions = {
|
|
745
|
+
onClear?: () => void;
|
|
746
|
+
onUndo?: (value: string) => void;
|
|
747
|
+
onRedo?: (value: string) => void;
|
|
748
|
+
};
|
|
749
|
+
declare function useClearableField<T extends HTMLInputElement | HTMLTextAreaElement>(elementRef: RefObject<T | null>, initialValue: unknown, { onClear, onUndo, onRedo }?: ClearableFieldOptions): {
|
|
1395
750
|
hasValue: boolean;
|
|
1396
751
|
setHasValue: react.Dispatch<react.SetStateAction<boolean>>;
|
|
1397
752
|
clear: () => void;
|
|
753
|
+
undo: () => void;
|
|
754
|
+
redo: () => void;
|
|
755
|
+
canUndo: boolean;
|
|
756
|
+
canRedo: boolean;
|
|
1398
757
|
};
|
|
1399
758
|
|
|
759
|
+
type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
760
|
+
declare function useKeyboardShortcuts(enabled: boolean, shortcuts: Record<string, ShortcutHandler>, deps?: any[]): react.RefObject<HTMLInputElement | null>;
|
|
761
|
+
|
|
1400
762
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1401
763
|
|
|
1402
764
|
/**
|
|
1403
|
-
* Converts an RGB
|
|
765
|
+
* Converts an RGB colour string to a 6‑digit uppercase hex string.
|
|
766
|
+
* Supports the following input formats:
|
|
767
|
+
* - Hex: `"#fff"`, `"#FFFFFF"`
|
|
768
|
+
* - CSS rgb/rgba: `"rgb(255, 0, 0)"`, `"rgba(255, 0, 0, 0.5)"`
|
|
769
|
+
* - Space‑separated numbers: `"255 0 0"`
|
|
770
|
+
* - Comma‑separated numbers: `"255,0,0"`
|
|
1404
771
|
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
* - "rgb(26, 128, 230)"
|
|
1409
|
-
*
|
|
1410
|
-
* Returns an empty string when the value is not a valid RGB color.
|
|
772
|
+
* @param value - The colour string to convert.
|
|
773
|
+
* @returns A 6‑digit uppercase hex string (e.g. `"#FF0000"`).
|
|
774
|
+
* If the input cannot be parsed, returns `"#000000"`.
|
|
1411
775
|
*/
|
|
1412
776
|
declare function rgbToHex(value: string): string;
|
|
1413
777
|
declare function hexToRgbString(hex: string): string | null;
|
|
1414
778
|
|
|
1415
779
|
declare function defineRecipe<T extends RecipeDefinition>(recipe: T): T;
|
|
1416
780
|
|
|
1417
|
-
|
|
781
|
+
/**
|
|
782
|
+
* Overrides a single component's recipe against the built-in default
|
|
783
|
+
* for that component. For overriding just one recipe inline, without
|
|
784
|
+
* constructing a partial keyed-by-component-name object.
|
|
785
|
+
*/
|
|
786
|
+
declare function extendRecipe<K extends keyof RecipeCollection>(name: K, override?: DeepPartial<RecipeCollection[K]>): RecipeCollection[K];
|
|
787
|
+
/**
|
|
788
|
+
* Overrides the theme's full recipe collection against the built-in
|
|
789
|
+
* defaults. Thin wrapper over extendRecipe — the actual merge logic
|
|
790
|
+
* lives in exactly one place.
|
|
791
|
+
*/
|
|
792
|
+
declare function extendRecipes(override?: DeepPartial<RecipeCollection>): RecipeCollection;
|
|
793
|
+
|
|
794
|
+
declare function getRecipeNames(): (keyof DefaultRecipeCollection)[];
|
|
1418
795
|
|
|
1419
796
|
declare function defineTypography<T extends Typography>(typography: T): T;
|
|
1420
797
|
|
|
1421
|
-
declare function extendTypography(override?: ThemeOverride["typography"]): Typography;
|
|
798
|
+
declare function extendTypography(override?: ThemeOverride$1["typography"]): Typography;
|
|
1422
799
|
|
|
1423
|
-
declare function defineToken<T>(value: T): {
|
|
800
|
+
declare function defineToken<T extends TokenValue>(value: T): {
|
|
1424
801
|
value: T;
|
|
1425
802
|
};
|
|
1426
|
-
declare function
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
803
|
+
declare function defineTokens<T extends Record<string, TokenValue>>(tokens: T): { [K in keyof T]: ReturnType<typeof defineToken<T[K]>>; };
|
|
804
|
+
/**
|
|
805
|
+
* Defines a semantic token that shares a single value across both light and dark modes.
|
|
806
|
+
*/
|
|
807
|
+
declare function defineSemanticToken<T extends TokenValue>(value: T): SemanticToken<T>;
|
|
808
|
+
declare function defineSemanticToken<T extends TokenValue>(light: T, dark: T): SemanticToken<T>;
|
|
809
|
+
type SemanticTokenInput<T extends TokenValue> = T | {
|
|
810
|
+
light: T;
|
|
811
|
+
dark: T;
|
|
812
|
+
};
|
|
813
|
+
declare function defineSemanticTokens<T extends Record<string, SemanticTokenInput<TokenValue>>>(tokens: T): {
|
|
814
|
+
[K in keyof T]: SemanticToken<T[K] extends {
|
|
815
|
+
light: infer V;
|
|
816
|
+
dark: infer _;
|
|
817
|
+
} ? V extends TokenValue ? V : never : T[K] extends TokenValue ? T[K] : never>;
|
|
1431
818
|
};
|
|
1432
819
|
|
|
1433
|
-
declare function extendTokens(override?: ThemeOverride["tokens"]): DesignTokens;
|
|
1434
|
-
declare function extendSemanticTokens(override?: ThemeOverride["semanticTokens"]): SemanticTokens;
|
|
820
|
+
declare function extendTokens(override?: ThemeOverride$1["tokens"]): DesignTokens;
|
|
821
|
+
declare function extendSemanticTokens(override?: ThemeOverride$1["semanticTokens"]): SemanticTokens;
|
|
822
|
+
|
|
823
|
+
declare function extendTheme(override?: ThemeOverride$1): Theme;
|
|
1435
824
|
|
|
1436
|
-
|
|
825
|
+
/**
|
|
826
|
+
* Defines a Kreativ UI theme.
|
|
827
|
+
*
|
|
828
|
+
* This function provides a type-safe boundary for creating themes while
|
|
829
|
+
* preserving the exact structure and types of the supplied theme.
|
|
830
|
+
*
|
|
831
|
+
* It does not merge with the default theme or mutate the provided object.
|
|
832
|
+
* Theme extension and resolution are handled separately.
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```ts
|
|
836
|
+
* export const myTheme = defineTheme({
|
|
837
|
+
* tokens: {
|
|
838
|
+
* // ...
|
|
839
|
+
* },
|
|
840
|
+
* semanticTokens: {
|
|
841
|
+
* // ...
|
|
842
|
+
* },
|
|
843
|
+
* typography: {
|
|
844
|
+
* // ...
|
|
845
|
+
* },
|
|
846
|
+
* recipes: {
|
|
847
|
+
* // ...
|
|
848
|
+
* },
|
|
849
|
+
* intensity: 50,
|
|
850
|
+
* sizes: {
|
|
851
|
+
* // ...
|
|
852
|
+
* },
|
|
853
|
+
* });
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
declare function defineTheme<T extends Theme>(theme: T): T;
|
|
1437
857
|
|
|
1438
|
-
export {
|
|
858
|
+
export { Adornment, type AdornmentProps, Button, ButtonGroup, ButtonGroupContext, type ButtonGroupContextValue, ButtonGroupItemContext, type ButtonGroupItemContextValue, type ButtonGroupItemProps, type ButtonGroupLabelProps, type ButtonGroupProps, type ButtonGroupSeparatorProps, type ButtonGroupSpacing, type ButtonGroupTextProps, type ButtonProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, type CardSize, type CardVariant, Checkbox, type CheckboxProps, Combobox, ComboboxContent, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxProps, Container, type ContainerProps, Flex, type FlexProps, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, type FormFieldMessageProps, type FormFieldProps, Grid, type GridProps, Input, InputField, type InputFieldProps, type InputKind, type InputKindDefaults, type InputProps, type InputSize, type InputVariant, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, MultiSelect, MultiSelectContent, MultiSelectItem, type MultiSelectItemProps, type MultiSelectProps, MultiSelectTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadioSize, Select, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectItem, type SelectItemProps, type SelectLabelProps, type SelectProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, Stack, type StackProps, Switch, type SwitchProps, type SwitchSize, type TextProps, Textarea, type TextareaCoreProps, type TextareaProps, type TextareaResize, ThemeToggler, type ThemeTogglerColor, type ThemeTogglerDisplay, type ThemeTogglerProps, type ThemeTogglerVariant, UIProvider, type UIProviderProps, cardSkeleton, cn, defineRecipe, defineSemanticToken, defineSemanticTokens, defineTheme, defineToken, defineTokens, defineTypography, extendRecipe, extendRecipes, extendSemanticTokens, extendTheme, extendTokens, extendTypography, getRecipeNames, hexToRgbString, rgbToHex, useButtonGroupContext, useButtonGroupItemContext, useClearableField, useFloatingSide, useKeyboardShortcuts, useOptionalButtonGroupContext, useOptionalButtonGroupItemContext, useStatusTransition };
|