@splenddev/kreativ-ui 0.2.0 → 0.2.2

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/dist/index.d.cts CHANGED
@@ -92,6 +92,23 @@ interface StateProps {
92
92
  */
93
93
  success?: boolean;
94
94
  }
95
+ interface ValueProps {
96
+ /**
97
+ * Passed value
98
+ */
99
+ value?: string;
100
+ /**
101
+ * For uncontrolled form control
102
+ */
103
+ defaultValue?: string;
104
+ /**
105
+ * Called when value is changed
106
+ *
107
+ * @param newValue
108
+ * @returns void
109
+ */
110
+ onValueChange?: (newValue: string) => void;
111
+ }
95
112
 
96
113
  type ButtonSize = SizeValue | "icon";
97
114
  type ButtonVariant = BaseVariant | "link";
@@ -816,7 +833,6 @@ type InputSize = "sm" | "md" | "lg";
816
833
  type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "password-current" | "password-new" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
817
834
  interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">, BaseProps, SizeProps, VariantProps<InputVariant>, DisabledProps, LoadingProps, FullWidthProps, ClearableProps, StateProps {
818
835
  inputClassName?: string;
819
- size?: string;
820
836
  kind?: InputKind;
821
837
  rounded?: boolean;
822
838
  startIcon?: ReactNode;
@@ -838,14 +854,13 @@ declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttri
838
854
 
839
855
  declare const inputKindDefaults: InputKindDefaults;
840
856
 
841
- interface FormFieldProps {
842
- children: ReactNode;
857
+ interface FormFieldProps extends Omit<BaseProps, "unstyled"> {
843
858
  id?: string;
844
859
  error?: string;
845
860
  required?: boolean;
846
861
  }
847
862
 
848
- declare function FormField({ id: externalId, error, required, children, }: FormFieldProps): react.JSX.Element;
863
+ declare function FormField({ id: externalId, error, required, className, children, }: FormFieldProps): react.JSX.Element;
849
864
  declare namespace FormField {
850
865
  var Label: typeof FormFieldLabel;
851
866
  var Control: typeof FormFieldControl;
@@ -973,31 +988,39 @@ declare const SelectGroupContext: react.Context<{
973
988
  setHasLabel: (id: string) => void;
974
989
  } | null>;
975
990
 
991
+ type MarkdownEditorTabs = "write" | "preview";
992
+ interface MarkdownEditorProps extends Omit<TextareaCoreProps, "resize" | "autoResize"> {
993
+ /** Renders the Preview tab. Omit and Preview shows raw text with a dev warning. */
994
+ renderMarkdown?: (value: string) => ReactNode;
995
+ tab?: MarkdownEditorTabs;
996
+ defaultTab?: MarkdownEditorTabs;
997
+ onTabChange?: (tab: MarkdownEditorTabs) => void;
998
+ hint?: ReactNode;
999
+ }
1000
+
976
1001
  type TextareaResize = "none" | "both" | "horizontal" | "vertical";
977
- interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> {
978
- value?: string;
979
- defaultValue?: string;
980
- className?: string;
981
- size?: InputSize;
982
- fullWidth?: boolean;
1002
+ interface TextareaCoreProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "defaultValue" | "value">, Omit<BaseProps, "unstyled" | "style">, SizeProps, StateProps, VariantProps<InputVariant>, ClearableProps, ValueProps, FullWidthProps {
983
1003
  resize?: TextareaResize;
984
- variant?: InputVariant;
985
1004
  autoResize?: boolean;
986
1005
  minRows?: number;
987
1006
  maxRows?: number;
988
- clearable?: boolean;
989
- onClear?: () => void;
990
1007
  characterCounter?: boolean;
991
1008
  debounceDelay?: number;
992
1009
  trimOnBlur?: boolean;
993
- error?: boolean;
994
- success?: boolean;
995
1010
  onValidate?: (value: string) => boolean | string;
996
- onValueChange?: (newValue: string) => void;
997
1011
  }
1012
+ type TextareaProps = ({
1013
+ allowMarkdown?: false;
1014
+ } & TextareaCoreProps) | ({
1015
+ allowMarkdown: true;
1016
+ } & Omit<TextareaCoreProps, "resize"> & MarkdownEditorProps);
1017
+
1018
+ declare const TextareaCore: react.ForwardRefExoticComponent<TextareaCoreProps & react.RefAttributes<HTMLTextAreaElement>>;
998
1019
 
999
1020
  declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
1000
1021
 
1022
+ declare const MarkdownEditor: react.ForwardRefExoticComponent<MarkdownEditorProps & react.RefAttributes<HTMLTextAreaElement>>;
1023
+
1001
1024
  interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable {
1002
1025
  checked?: boolean;
1003
1026
  defaultChecked?: boolean;
@@ -1239,7 +1262,10 @@ interface ResolvedSize {
1239
1262
  style: CSSProperties;
1240
1263
  iconSize?: string;
1241
1264
  }
1242
- declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string): ResolvedSize;
1265
+ interface UseSizeStyleOptions {
1266
+ includeHeight?: boolean;
1267
+ }
1268
+ declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string, options?: UseSizeStyleOptions): ResolvedSize;
1243
1269
 
1244
1270
  declare function cn(...inputs: ClassValue[]): string;
1245
1271
 
@@ -1256,4 +1282,4 @@ declare function cn(...inputs: ClassValue[]): string;
1256
1282
  declare function rgbToHex(value: string): string;
1257
1283
  declare function hexToRgbString(hex: string): string | null;
1258
1284
 
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 };
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, type TextStyle, type TextStyles, 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, UIProvider, type UIProviderProps, type UseSizeStyleOptions, type ValueProps, type Variant, type VariantProps, cn, defaultRecipes, defaultSizes, defaultTextStyles, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useMultiSelectContext, useSelectContext, useSizeStyle, useTheme };
package/dist/index.d.ts CHANGED
@@ -92,6 +92,23 @@ interface StateProps {
92
92
  */
93
93
  success?: boolean;
94
94
  }
95
+ interface ValueProps {
96
+ /**
97
+ * Passed value
98
+ */
99
+ value?: string;
100
+ /**
101
+ * For uncontrolled form control
102
+ */
103
+ defaultValue?: string;
104
+ /**
105
+ * Called when value is changed
106
+ *
107
+ * @param newValue
108
+ * @returns void
109
+ */
110
+ onValueChange?: (newValue: string) => void;
111
+ }
95
112
 
96
113
  type ButtonSize = SizeValue | "icon";
97
114
  type ButtonVariant = BaseVariant | "link";
@@ -816,7 +833,6 @@ type InputSize = "sm" | "md" | "lg";
816
833
  type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "password-current" | "password-new" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
817
834
  interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">, BaseProps, SizeProps, VariantProps<InputVariant>, DisabledProps, LoadingProps, FullWidthProps, ClearableProps, StateProps {
818
835
  inputClassName?: string;
819
- size?: string;
820
836
  kind?: InputKind;
821
837
  rounded?: boolean;
822
838
  startIcon?: ReactNode;
@@ -838,14 +854,13 @@ declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttri
838
854
 
839
855
  declare const inputKindDefaults: InputKindDefaults;
840
856
 
841
- interface FormFieldProps {
842
- children: ReactNode;
857
+ interface FormFieldProps extends Omit<BaseProps, "unstyled"> {
843
858
  id?: string;
844
859
  error?: string;
845
860
  required?: boolean;
846
861
  }
847
862
 
848
- declare function FormField({ id: externalId, error, required, children, }: FormFieldProps): react.JSX.Element;
863
+ declare function FormField({ id: externalId, error, required, className, children, }: FormFieldProps): react.JSX.Element;
849
864
  declare namespace FormField {
850
865
  var Label: typeof FormFieldLabel;
851
866
  var Control: typeof FormFieldControl;
@@ -973,31 +988,39 @@ declare const SelectGroupContext: react.Context<{
973
988
  setHasLabel: (id: string) => void;
974
989
  } | null>;
975
990
 
991
+ type MarkdownEditorTabs = "write" | "preview";
992
+ interface MarkdownEditorProps extends Omit<TextareaCoreProps, "resize" | "autoResize"> {
993
+ /** Renders the Preview tab. Omit and Preview shows raw text with a dev warning. */
994
+ renderMarkdown?: (value: string) => ReactNode;
995
+ tab?: MarkdownEditorTabs;
996
+ defaultTab?: MarkdownEditorTabs;
997
+ onTabChange?: (tab: MarkdownEditorTabs) => void;
998
+ hint?: ReactNode;
999
+ }
1000
+
976
1001
  type TextareaResize = "none" | "both" | "horizontal" | "vertical";
977
- interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> {
978
- value?: string;
979
- defaultValue?: string;
980
- className?: string;
981
- size?: InputSize;
982
- fullWidth?: boolean;
1002
+ interface TextareaCoreProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "defaultValue" | "value">, Omit<BaseProps, "unstyled" | "style">, SizeProps, StateProps, VariantProps<InputVariant>, ClearableProps, ValueProps, FullWidthProps {
983
1003
  resize?: TextareaResize;
984
- variant?: InputVariant;
985
1004
  autoResize?: boolean;
986
1005
  minRows?: number;
987
1006
  maxRows?: number;
988
- clearable?: boolean;
989
- onClear?: () => void;
990
1007
  characterCounter?: boolean;
991
1008
  debounceDelay?: number;
992
1009
  trimOnBlur?: boolean;
993
- error?: boolean;
994
- success?: boolean;
995
1010
  onValidate?: (value: string) => boolean | string;
996
- onValueChange?: (newValue: string) => void;
997
1011
  }
1012
+ type TextareaProps = ({
1013
+ allowMarkdown?: false;
1014
+ } & TextareaCoreProps) | ({
1015
+ allowMarkdown: true;
1016
+ } & Omit<TextareaCoreProps, "resize"> & MarkdownEditorProps);
1017
+
1018
+ declare const TextareaCore: react.ForwardRefExoticComponent<TextareaCoreProps & react.RefAttributes<HTMLTextAreaElement>>;
998
1019
 
999
1020
  declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
1000
1021
 
1022
+ declare const MarkdownEditor: react.ForwardRefExoticComponent<MarkdownEditorProps & react.RefAttributes<HTMLTextAreaElement>>;
1023
+
1001
1024
  interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable {
1002
1025
  checked?: boolean;
1003
1026
  defaultChecked?: boolean;
@@ -1239,7 +1262,10 @@ interface ResolvedSize {
1239
1262
  style: CSSProperties;
1240
1263
  iconSize?: string;
1241
1264
  }
1242
- declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string): ResolvedSize;
1265
+ interface UseSizeStyleOptions {
1266
+ includeHeight?: boolean;
1267
+ }
1268
+ declare function useSizeStyle(size: string, iconOnly?: boolean, component?: string, options?: UseSizeStyleOptions): ResolvedSize;
1243
1269
 
1244
1270
  declare function cn(...inputs: ClassValue[]): string;
1245
1271
 
@@ -1256,4 +1282,4 @@ declare function cn(...inputs: ClassValue[]): string;
1256
1282
  declare function rgbToHex(value: string): string;
1257
1283
  declare function hexToRgbString(hex: string): string | null;
1258
1284
 
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 };
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, type TextStyle, type TextStyles, 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, UIProvider, type UIProviderProps, type UseSizeStyleOptions, type ValueProps, type Variant, type VariantProps, cn, defaultRecipes, defaultSizes, defaultTextStyles, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useMultiSelectContext, useSelectContext, useSizeStyle, useTheme };