@splenddev/kreativ-ui 0.2.4 → 0.2.6
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 +1586 -128
- package/dist/index.cjs +327 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -10
- package/dist/index.d.ts +27 -10
- package/dist/index.js +325 -338
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -54,6 +54,13 @@ interface VariantProps<Variant extends string = string> {
|
|
|
54
54
|
*/
|
|
55
55
|
variant?: Variant;
|
|
56
56
|
}
|
|
57
|
+
interface TypographyProps {
|
|
58
|
+
/**
|
|
59
|
+
* Defines the typography style to apply to the component.
|
|
60
|
+
* The value must match a typography style registered in the theme.
|
|
61
|
+
*/
|
|
62
|
+
typography?: string;
|
|
63
|
+
}
|
|
57
64
|
interface DisabledProps {
|
|
58
65
|
/**
|
|
59
66
|
* Disables the component.
|
|
@@ -120,7 +127,7 @@ interface ButtonRenderProps {
|
|
|
120
127
|
"aria-busy"?: boolean;
|
|
121
128
|
children?: React.ReactNode;
|
|
122
129
|
}
|
|
123
|
-
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps {
|
|
130
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
|
|
124
131
|
size?: ButtonSize;
|
|
125
132
|
leftIcon?: ReactNode;
|
|
126
133
|
rightIcon?: ReactNode;
|
|
@@ -578,7 +585,7 @@ interface SemanticTokens {
|
|
|
578
585
|
* };
|
|
579
586
|
* ```
|
|
580
587
|
*/
|
|
581
|
-
interface
|
|
588
|
+
interface TypographyStyle {
|
|
582
589
|
fontFamily?: string;
|
|
583
590
|
fontSize?: string;
|
|
584
591
|
fontWeight?: string | number;
|
|
@@ -591,13 +598,13 @@ interface TextStyle {
|
|
|
591
598
|
*
|
|
592
599
|
* @example
|
|
593
600
|
* ```ts
|
|
594
|
-
* const
|
|
601
|
+
* const typography: Typography = {
|
|
595
602
|
* heading: { fontSize: "2rem", fontWeight: 700 },
|
|
596
603
|
* body: { fontSize: "1rem", lineHeight: "1.5" },
|
|
597
604
|
* };
|
|
598
605
|
* ```
|
|
599
606
|
*/
|
|
600
|
-
type
|
|
607
|
+
type Typography = Record<string, TypographyStyle>;
|
|
601
608
|
/**
|
|
602
609
|
* A set of CSS properties that define the dimensions and spacing
|
|
603
610
|
* for a component at a specific size.
|
|
@@ -658,7 +665,7 @@ interface ThemeTransition {
|
|
|
658
665
|
*
|
|
659
666
|
* @property tokens - Raw design values (colors, spacing, radii, etc.).
|
|
660
667
|
* @property semanticTokens - Role‑based tokens that adapt to color mode.
|
|
661
|
-
* @property
|
|
668
|
+
* @property typography - Reusable typography styles.
|
|
662
669
|
* @property recipes - Component‑specific styles (from RecipeCollection).
|
|
663
670
|
* @property intensity - A global multiplier for visual prominence (e.g., 0.8, 1, 1.2).
|
|
664
671
|
* @property light - Legacy theme tokens for light mode (kept for migration).
|
|
@@ -668,7 +675,7 @@ interface ThemeTransition {
|
|
|
668
675
|
interface Theme {
|
|
669
676
|
tokens: DesignTokens;
|
|
670
677
|
semanticTokens: SemanticTokens;
|
|
671
|
-
|
|
678
|
+
typography: Typography;
|
|
672
679
|
recipes: RecipeCollection;
|
|
673
680
|
intensity: number;
|
|
674
681
|
sizes: SizeScale;
|
|
@@ -723,13 +730,13 @@ interface ThemeOverride {
|
|
|
723
730
|
*
|
|
724
731
|
* @example
|
|
725
732
|
* ```ts
|
|
726
|
-
*
|
|
733
|
+
* typography: {
|
|
727
734
|
* heading: { fontSize: "2.5rem", fontWeight: 800 },
|
|
728
735
|
* body: { fontSize: "1.125rem", lineHeight: "1.75" },
|
|
729
736
|
* }
|
|
730
737
|
* ```
|
|
731
738
|
*/
|
|
732
|
-
|
|
739
|
+
typography?: DeepPartial<Typography>;
|
|
733
740
|
/**
|
|
734
741
|
* Override component recipes.
|
|
735
742
|
* Allows modifying the base styles, variants, default variants, and compound variants
|
|
@@ -1239,7 +1246,6 @@ interface ThemeContextValue {
|
|
|
1239
1246
|
declare const ThemeContext: react.Context<ThemeContextValue | null>;
|
|
1240
1247
|
|
|
1241
1248
|
declare const defaultSizes: SizeScale;
|
|
1242
|
-
declare const defaultTextStyles: TextStyles;
|
|
1243
1249
|
declare const defaultRecipes: RecipeCollection;
|
|
1244
1250
|
declare const defaultTheme: Theme;
|
|
1245
1251
|
|
|
@@ -1267,6 +1273,17 @@ interface UseSizeStyleOptions {
|
|
|
1267
1273
|
}
|
|
1268
1274
|
declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string, options?: UseSizeStyleOptions): ResolvedSize;
|
|
1269
1275
|
|
|
1276
|
+
declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open: boolean): {
|
|
1277
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
1278
|
+
side: "bottom" | "top";
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
type State = "none" | "error" | "success";
|
|
1282
|
+
type TransitionState = Exclude<State, "none"> | undefined;
|
|
1283
|
+
declare function useStateTransition(state: State): TransitionState;
|
|
1284
|
+
|
|
1285
|
+
declare function useTypography(name?: string): react.CSSProperties;
|
|
1286
|
+
|
|
1270
1287
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1271
1288
|
|
|
1272
1289
|
/**
|
|
@@ -1282,4 +1299,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1282
1299
|
declare function rgbToHex(value: string): string;
|
|
1283
1300
|
declare function hexToRgbString(hex: string): string | null;
|
|
1284
1301
|
|
|
1285
|
-
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, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, 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,
|
|
1302
|
+
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, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, 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, Textarea, TextareaCore, type TextareaCoreProps, 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, type Typography, type TypographyProps, type TypographyStyle, UIProvider, type UIProviderProps, type UseSizeStyleOptions, type ValueProps, type Variant, type VariantProps, cn, defaultRecipes, defaultSizes, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useFloatingSide, useMultiSelectContext, useSelectContext, useSizeStyle, useStateTransition, useTheme, useTypography };
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,13 @@ interface VariantProps<Variant extends string = string> {
|
|
|
54
54
|
*/
|
|
55
55
|
variant?: Variant;
|
|
56
56
|
}
|
|
57
|
+
interface TypographyProps {
|
|
58
|
+
/**
|
|
59
|
+
* Defines the typography style to apply to the component.
|
|
60
|
+
* The value must match a typography style registered in the theme.
|
|
61
|
+
*/
|
|
62
|
+
typography?: string;
|
|
63
|
+
}
|
|
57
64
|
interface DisabledProps {
|
|
58
65
|
/**
|
|
59
66
|
* Disables the component.
|
|
@@ -120,7 +127,7 @@ interface ButtonRenderProps {
|
|
|
120
127
|
"aria-busy"?: boolean;
|
|
121
128
|
children?: React.ReactNode;
|
|
122
129
|
}
|
|
123
|
-
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps {
|
|
130
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
|
|
124
131
|
size?: ButtonSize;
|
|
125
132
|
leftIcon?: ReactNode;
|
|
126
133
|
rightIcon?: ReactNode;
|
|
@@ -578,7 +585,7 @@ interface SemanticTokens {
|
|
|
578
585
|
* };
|
|
579
586
|
* ```
|
|
580
587
|
*/
|
|
581
|
-
interface
|
|
588
|
+
interface TypographyStyle {
|
|
582
589
|
fontFamily?: string;
|
|
583
590
|
fontSize?: string;
|
|
584
591
|
fontWeight?: string | number;
|
|
@@ -591,13 +598,13 @@ interface TextStyle {
|
|
|
591
598
|
*
|
|
592
599
|
* @example
|
|
593
600
|
* ```ts
|
|
594
|
-
* const
|
|
601
|
+
* const typography: Typography = {
|
|
595
602
|
* heading: { fontSize: "2rem", fontWeight: 700 },
|
|
596
603
|
* body: { fontSize: "1rem", lineHeight: "1.5" },
|
|
597
604
|
* };
|
|
598
605
|
* ```
|
|
599
606
|
*/
|
|
600
|
-
type
|
|
607
|
+
type Typography = Record<string, TypographyStyle>;
|
|
601
608
|
/**
|
|
602
609
|
* A set of CSS properties that define the dimensions and spacing
|
|
603
610
|
* for a component at a specific size.
|
|
@@ -658,7 +665,7 @@ interface ThemeTransition {
|
|
|
658
665
|
*
|
|
659
666
|
* @property tokens - Raw design values (colors, spacing, radii, etc.).
|
|
660
667
|
* @property semanticTokens - Role‑based tokens that adapt to color mode.
|
|
661
|
-
* @property
|
|
668
|
+
* @property typography - Reusable typography styles.
|
|
662
669
|
* @property recipes - Component‑specific styles (from RecipeCollection).
|
|
663
670
|
* @property intensity - A global multiplier for visual prominence (e.g., 0.8, 1, 1.2).
|
|
664
671
|
* @property light - Legacy theme tokens for light mode (kept for migration).
|
|
@@ -668,7 +675,7 @@ interface ThemeTransition {
|
|
|
668
675
|
interface Theme {
|
|
669
676
|
tokens: DesignTokens;
|
|
670
677
|
semanticTokens: SemanticTokens;
|
|
671
|
-
|
|
678
|
+
typography: Typography;
|
|
672
679
|
recipes: RecipeCollection;
|
|
673
680
|
intensity: number;
|
|
674
681
|
sizes: SizeScale;
|
|
@@ -723,13 +730,13 @@ interface ThemeOverride {
|
|
|
723
730
|
*
|
|
724
731
|
* @example
|
|
725
732
|
* ```ts
|
|
726
|
-
*
|
|
733
|
+
* typography: {
|
|
727
734
|
* heading: { fontSize: "2.5rem", fontWeight: 800 },
|
|
728
735
|
* body: { fontSize: "1.125rem", lineHeight: "1.75" },
|
|
729
736
|
* }
|
|
730
737
|
* ```
|
|
731
738
|
*/
|
|
732
|
-
|
|
739
|
+
typography?: DeepPartial<Typography>;
|
|
733
740
|
/**
|
|
734
741
|
* Override component recipes.
|
|
735
742
|
* Allows modifying the base styles, variants, default variants, and compound variants
|
|
@@ -1239,7 +1246,6 @@ interface ThemeContextValue {
|
|
|
1239
1246
|
declare const ThemeContext: react.Context<ThemeContextValue | null>;
|
|
1240
1247
|
|
|
1241
1248
|
declare const defaultSizes: SizeScale;
|
|
1242
|
-
declare const defaultTextStyles: TextStyles;
|
|
1243
1249
|
declare const defaultRecipes: RecipeCollection;
|
|
1244
1250
|
declare const defaultTheme: Theme;
|
|
1245
1251
|
|
|
@@ -1267,6 +1273,17 @@ interface UseSizeStyleOptions {
|
|
|
1267
1273
|
}
|
|
1268
1274
|
declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string, options?: UseSizeStyleOptions): ResolvedSize;
|
|
1269
1275
|
|
|
1276
|
+
declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open: boolean): {
|
|
1277
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
1278
|
+
side: "bottom" | "top";
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
type State = "none" | "error" | "success";
|
|
1282
|
+
type TransitionState = Exclude<State, "none"> | undefined;
|
|
1283
|
+
declare function useStateTransition(state: State): TransitionState;
|
|
1284
|
+
|
|
1285
|
+
declare function useTypography(name?: string): react.CSSProperties;
|
|
1286
|
+
|
|
1270
1287
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1271
1288
|
|
|
1272
1289
|
/**
|
|
@@ -1282,4 +1299,4 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
1282
1299
|
declare function rgbToHex(value: string): string;
|
|
1283
1300
|
declare function hexToRgbString(hex: string): string | null;
|
|
1284
1301
|
|
|
1285
|
-
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, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, 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,
|
|
1302
|
+
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, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, 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, Textarea, TextareaCore, type TextareaCoreProps, 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, type Typography, type TypographyProps, type TypographyStyle, UIProvider, type UIProviderProps, type UseSizeStyleOptions, type ValueProps, type Variant, type VariantProps, cn, defaultRecipes, defaultSizes, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useFloatingSide, useMultiSelectContext, useSelectContext, useSizeStyle, useStateTransition, useTheme, useTypography };
|