@kroo-web/design-system 1.1.104 → 1.1.106

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.
Files changed (48) hide show
  1. package/dist/cjs/examples/CheckboxWithController/index.d.ts +6 -0
  2. package/dist/cjs/examples/ComboBoxWithController/index.d.ts +6 -0
  3. package/dist/cjs/examples/MagicForm/index.d.ts +7 -0
  4. package/dist/cjs/examples/NumberFieldWithController/index.d.ts +6 -0
  5. package/dist/cjs/examples/PhoneFieldWithController/index.d.ts +6 -0
  6. package/dist/cjs/examples/PinInputWithController/index.d.ts +6 -0
  7. package/dist/cjs/examples/RadioGroupWithController/index.d.ts +8 -0
  8. package/dist/cjs/examples/form/index.d.ts +34 -1
  9. package/dist/cjs/index.js +12 -12
  10. package/dist/cjs/src/components/Checkbox/index.d.ts +5 -4
  11. package/dist/cjs/src/components/ComboBox/index.d.ts +6 -5
  12. package/dist/cjs/src/components/DatePicker/index.d.ts +16 -7
  13. package/dist/cjs/src/components/Form/index.d.ts +3 -7
  14. package/dist/cjs/src/components/NumberField/index.d.ts +18 -8
  15. package/dist/cjs/src/components/PhoneField/index.d.ts +24 -4
  16. package/dist/cjs/src/components/PinInput/index.d.ts +4 -4
  17. package/dist/cjs/src/components/RadioGroup/index.d.ts +14 -6
  18. package/dist/cjs/src/components/Range/index.d.ts +19 -9
  19. package/dist/cjs/src/components/Select/index.d.ts +7 -6
  20. package/dist/cjs/src/components/TextField/index.d.ts +5 -4
  21. package/dist/cjs/src/components/Typography/index.d.ts +3 -2
  22. package/dist/cjs/src/utils/composeRefs.d.ts +2 -0
  23. package/dist/cjs/src/utils/parseInt.d.ts +1 -0
  24. package/dist/esm/examples/CheckboxWithController/index.d.ts +6 -0
  25. package/dist/esm/examples/ComboBoxWithController/index.d.ts +6 -0
  26. package/dist/esm/examples/MagicForm/index.d.ts +7 -0
  27. package/dist/esm/examples/NumberFieldWithController/index.d.ts +6 -0
  28. package/dist/esm/examples/PhoneFieldWithController/index.d.ts +6 -0
  29. package/dist/esm/examples/PinInputWithController/index.d.ts +6 -0
  30. package/dist/esm/examples/RadioGroupWithController/index.d.ts +8 -0
  31. package/dist/esm/examples/form/index.d.ts +34 -1
  32. package/dist/esm/index.js +12 -12
  33. package/dist/esm/src/components/Checkbox/index.d.ts +5 -4
  34. package/dist/esm/src/components/ComboBox/index.d.ts +6 -5
  35. package/dist/esm/src/components/DatePicker/index.d.ts +16 -7
  36. package/dist/esm/src/components/Form/index.d.ts +3 -7
  37. package/dist/esm/src/components/NumberField/index.d.ts +18 -8
  38. package/dist/esm/src/components/PhoneField/index.d.ts +24 -4
  39. package/dist/esm/src/components/PinInput/index.d.ts +4 -4
  40. package/dist/esm/src/components/RadioGroup/index.d.ts +14 -6
  41. package/dist/esm/src/components/Range/index.d.ts +19 -9
  42. package/dist/esm/src/components/Select/index.d.ts +7 -6
  43. package/dist/esm/src/components/TextField/index.d.ts +5 -4
  44. package/dist/esm/src/components/Typography/index.d.ts +3 -2
  45. package/dist/esm/src/utils/composeRefs.d.ts +2 -0
  46. package/dist/esm/src/utils/parseInt.d.ts +1 -0
  47. package/dist/types.d.ts +123 -55
  48. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TCheckboxProps<T extends FieldValues> = {
2
+ export type TCheckboxProps = {
4
3
  id: string;
5
- name: Path<T>;
6
4
  label: string | ReactNode;
7
5
  disabled?: boolean;
8
6
  className?: string;
9
7
  variant?: 'radio' | 'checkbox';
8
+ onChange?: (value: boolean) => void;
9
+ onBlur?: () => void;
10
+ value?: boolean;
10
11
  };
11
- export declare const Checkbox: <T extends FieldValues>(props: TCheckboxProps<T>) => React.JSX.Element;
12
+ export declare const Checkbox: ({ id, label, variant, value, onChange, onBlur }: TCheckboxProps) => React.JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { ControllerRenderProps, FieldValues } from 'react-hook-form';
3
2
  export type TComboBoxItem = {
4
3
  text: string;
5
4
  img?: string;
@@ -7,11 +6,13 @@ export type TComboBoxItem = {
7
6
  };
8
7
  export type TComboBoxProps = {
9
8
  label: string;
10
- name: string;
11
9
  options: TComboBoxItem[];
12
10
  onSelect?: (item: TComboBoxItem) => void;
13
11
  alwaysOpen?: boolean;
14
- field: ControllerRenderProps<FieldValues>;
12
+ field: {
13
+ value: string;
14
+ onChange: (value: string) => void;
15
+ onBlur: () => void;
16
+ };
15
17
  };
16
- export declare const ComboBox: (props: Omit<TComboBoxProps, "field">) => React.JSX.Element;
17
- export declare const Field: ({ label, options, onSelect, alwaysOpen, field: { onBlur, ...restField } }: TComboBoxProps) => React.JSX.Element;
18
+ export declare const ComboBox: (props: TComboBoxProps) => React.JSX.Element;
@@ -1,14 +1,23 @@
1
1
  import React from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TDatePicker<T extends FieldValues> = {
2
+ export type TDatePickerProps = {
4
3
  id: string;
5
- name: Path<T>;
6
4
  label: string;
7
5
  helper?: {
8
6
  message: string;
9
7
  };
10
- min?: string;
11
- max?: string;
12
8
  disabled?: boolean;
13
- };
14
- export declare const DatePicker: <T extends FieldValues>(props: TDatePicker<T>) => React.JSX.Element;
9
+ error?: {
10
+ message: string;
11
+ };
12
+ } & React.InputHTMLAttributes<HTMLInputElement>;
13
+ export declare const DatePicker: React.ForwardRefExoticComponent<{
14
+ id: string;
15
+ label: string;
16
+ helper?: {
17
+ message: string;
18
+ };
19
+ disabled?: boolean;
20
+ error?: {
21
+ message: string;
22
+ };
23
+ } & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
@@ -1,8 +1,4 @@
1
- import React, { PropsWithChildren, HTMLProps } from 'react';
2
- import { FieldValues, UseFormReturn } from 'react-hook-form';
3
- type TFormProps<T extends FieldValues> = PropsWithChildren<HTMLProps<HTMLFormElement>> & {
4
- methods: UseFormReturn<T>;
5
- onSubmit: (values: T) => void;
6
- };
7
- export declare const Form: <T extends FieldValues>({ methods, children, onSubmit, ...rest }: TFormProps<T>) => React.JSX.Element;
1
+ import React, { PropsWithChildren, DetailedHTMLProps, InputHTMLAttributes } from 'react';
2
+ type TFormProps = PropsWithChildren<DetailedHTMLProps<InputHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
3
+ export declare const Form: ({ children, ...rest }: TFormProps) => React.JSX.Element;
8
4
  export {};
@@ -1,13 +1,23 @@
1
- import React from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TNumberFieldProps<T extends FieldValues> = {
1
+ import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
2
+ export type TNumberFieldProps = {
3
+ id: string;
4
4
  label: string;
5
- name: Path<T>;
6
- min?: number;
7
- max?: number;
8
5
  width?: number;
9
6
  helper?: {
10
7
  message: string;
11
8
  };
12
- };
13
- export declare const NumberField: <T extends FieldValues>(props: TNumberFieldProps<T>) => React.JSX.Element;
9
+ error?: {
10
+ message: string;
11
+ };
12
+ onChange?: (value: number) => void;
13
+ onBlur?: () => void;
14
+ } & DetailedHTMLProps<InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>;
15
+ /**
16
+ * NumberField - A component for rendering a number input field.
17
+ *
18
+ * @param {TNumberFieldProps} props - The properties for the number field component.
19
+ * @returns {JSX.Element} The rendered number field component.
20
+ *
21
+ * !!! If using this component with react-hook-form, you will need to wrap this component in a Controller component.
22
+ */
23
+ export declare const NumberField: (props: TNumberFieldProps) => React.JSX.Element;
@@ -1,13 +1,33 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TPhoneFieldProps<T extends FieldValues> = {
2
+ export type TPhoneFieldProps = {
4
3
  id: string;
5
- name: Path<T>;
6
4
  disabled?: boolean;
5
+ error?: {
6
+ message: string;
7
+ };
7
8
  helper?: {
8
9
  message: ReactNode | string;
9
10
  };
10
11
  className?: string;
11
12
  placeholder?: string;
13
+ onChange?: (value: {
14
+ code: string;
15
+ number: string;
16
+ formatted: string;
17
+ }) => void;
18
+ onBlur?: () => void;
19
+ value?: {
20
+ code: string;
21
+ number: string;
22
+ formatted: string;
23
+ };
12
24
  };
13
- export declare const PhoneField: <T extends FieldValues>(props: TPhoneFieldProps<T>) => React.JSX.Element;
25
+ /**
26
+ * PhoneField - A component for rendering a number input field.
27
+ *
28
+ * @param {TPhoneFieldProps} props - The properties for the phone field component.
29
+ * @returns {JSX.Element} The rendered number field component.
30
+ *
31
+ * !!! If using this component with react-hook-form, you will need to wrap this component in a Controller component.
32
+ */
33
+ export declare const PhoneField: (props: TPhoneFieldProps) => React.JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export interface TPinInputProps<T extends FieldValues> {
4
- name: Path<T>;
2
+ export interface TPinInputProps {
5
3
  length: number;
6
4
  label: string;
7
5
  isOTP?: boolean;
8
6
  isPassword?: boolean;
9
7
  isNumeric?: boolean;
8
+ onChange: (value: string) => void;
9
+ onBlur?: () => void;
10
10
  }
11
- export declare const PinInput: <T extends FieldValues>(props: TPinInputProps<T>) => React.JSX.Element;
11
+ export declare const PinInput: ({ length, label, isOTP, isPassword, isNumeric, onChange, onBlur }: TPinInputProps) => React.JSX.Element;
@@ -1,14 +1,22 @@
1
1
  import React from 'react';
2
2
  import * as RadixRadioGroup from '@radix-ui/react-radio-group';
3
- import { FieldError, FieldValues, Path } from 'react-hook-form';
4
- export type TRadioGroupProps<T extends FieldValues> = {
5
- name: Path<T>;
3
+ export type TRadioGroupProps = {
4
+ className?: string;
5
+ name?: string;
6
6
  label: string;
7
7
  variant?: 'cards' | 'circle';
8
- error?: FieldError;
9
- } & Omit<RadixRadioGroup.RadioGroupProps, 'name'>;
8
+ error?: {
9
+ message: string;
10
+ };
11
+ onChange?: (value: string) => void;
12
+ onBlur?: () => void;
13
+ disabled?: boolean;
14
+ value?: string;
15
+ };
10
16
  export declare const RadioGroup: {
11
- Root: <T extends FieldValues>({ children, className, name, label, variant, disabled, ...props }: TRadioGroupProps<T>) => React.JSX.Element;
17
+ Root: React.ForwardRefExoticComponent<TRadioGroupProps & {
18
+ children?: React.ReactNode | undefined;
19
+ } & React.RefAttributes<HTMLDivElement>>;
12
20
  Item: ({ children, className, variant, ...props }: RadixRadioGroup.RadioGroupItemProps & {
13
21
  variant?: "circle" | "cards";
14
22
  }) => React.JSX.Element;
@@ -1,15 +1,25 @@
1
- import React from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TRangeProps<T extends FieldValues> = {
1
+ import React, { ChangeEvent } from 'react';
2
+ export type TRangeProps = {
4
3
  id: string;
5
4
  label: string;
6
- name: Path<T>;
7
- min?: number;
8
- max?: number;
9
5
  step?: number;
10
- showValue?: boolean;
11
6
  helper?: {
12
7
  message: string;
13
8
  };
14
- };
15
- export declare const Range: <T extends FieldValues>(props: TRangeProps<T>) => React.JSX.Element;
9
+ error?: {
10
+ message: string;
11
+ };
12
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
13
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>;
14
+ export declare const Range: React.ForwardRefExoticComponent<{
15
+ id: string;
16
+ label: string;
17
+ step?: number;
18
+ helper?: {
19
+ message: string;
20
+ };
21
+ error?: {
22
+ message: string;
23
+ };
24
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
25
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & React.RefAttributes<HTMLInputElement>>;
@@ -1,13 +1,11 @@
1
- import React, { OptionHTMLAttributes, ReactNode } from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
1
+ import React, { DetailedHTMLProps, OptionHTMLAttributes, ReactNode } from 'react';
3
2
  export type TItem = {
4
3
  id: string;
5
4
  title: string;
6
5
  };
7
- export type TSelectProps<T extends FieldValues> = {
6
+ export type TSelectProps = {
8
7
  id: string;
9
8
  label: string;
10
- name: Path<T>;
11
9
  helper?: {
12
10
  message: string;
13
11
  };
@@ -21,5 +19,8 @@ export type TSelectProps<T extends FieldValues> = {
21
19
  defaultValue?: string;
22
20
  missing?: boolean;
23
21
  children?: ReactNode;
24
- };
25
- export declare const Select: <T extends FieldValues>(props: TSelectProps<T>) => React.JSX.Element;
22
+ error?: {
23
+ message: string;
24
+ };
25
+ } & DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
26
+ export declare const Select: React.ForwardRefExoticComponent<Omit<TSelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
@@ -1,9 +1,7 @@
1
1
  import React, { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from 'react';
2
- import { FieldValues, Path } from 'react-hook-form';
3
- export type TTextFieldProps<T extends FieldValues> = {
2
+ export type TTextFieldProps = {
4
3
  id: string;
5
4
  label: string;
6
- name: Path<T>;
7
5
  disabled?: boolean;
8
6
  helper?: {
9
7
  message: ReactNode | string;
@@ -16,5 +14,8 @@ export type TTextFieldProps<T extends FieldValues> = {
16
14
  leftContent?: ReactNode | string;
17
15
  missing?: boolean;
18
16
  disableError?: boolean;
17
+ error?: {
18
+ message: ReactNode | string;
19
+ };
19
20
  } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
20
- export declare const TextField: React.ForwardRefExoticComponent<Omit<TTextFieldProps<FieldValues>, "ref"> & React.RefAttributes<HTMLInputElement>>;
21
+ export declare const TextField: React.ForwardRefExoticComponent<Omit<TTextFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ForwardedRef } from 'react';
2
2
  export type TLegacyMarketingText = 'marketing-text-light' | 'marketing-text-regular' | 'marketing-text-semi-bold' | 'marketing-quote-light' | 'marketing-quote-regular' | 'marketing-quote-semi-bold' | 'marketing-small-light' | 'marketing-small-regular' | 'marketing-small-semi-bold' | 'marketing-medium-light' | 'marketing-medium-regular' | 'marketing-medium-semi-bold' | 'marketing-large-light' | 'marketing-large-regular' | 'marketing-large-semi-bold' | 'marketing-tag-light' | 'marketing-tag-regular' | 'marketing-tag-semi-bold';
3
3
  export type TLegacyMarketingHeading = 'marketing-heading-1' | 'marketing-heading-2' | 'marketing-heading-3' | 'marketing-heading-4' | 'marketing-heading-5' | 'marketing-heading-6' | 'marketing-heading-7';
4
4
  export type TLegacyMarketingFooter = 'footer-regular' | 'footer-semi-bold';
@@ -10,4 +10,5 @@ export type TTypographyProps<C extends React.ElementType = 'p'> = {
10
10
  children?: React.ReactNode;
11
11
  className?: string;
12
12
  } & React.ComponentPropsWithoutRef<C>;
13
- export declare const Typography: <C extends React.ElementType = "p">({ as, variant, children, className, ...rest }: TTypographyProps<C>) => React.JSX.Element;
13
+ export declare const TypographyComponent: <C extends React.ElementType = "p">(props: TTypographyProps<C>, forwardRef: ForwardedRef<C>) => React.JSX.Element;
14
+ export declare const Typography: React.ForwardRefExoticComponent<Omit<TTypographyProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
@@ -0,0 +1,2 @@
1
+ import { ForwardedRef } from "react";
2
+ export declare const composeRefs: <T extends unknown>(refs: ForwardedRef<T>[]) => (value: T) => void;
@@ -0,0 +1 @@
1
+ export declare const parseIntSafe: (value: string) => number;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import React$1, { PropsWithChildren, ReactNode, HTMLProps, ElementType, ButtonHTMLAttributes, OptionHTMLAttributes, DetailedHTMLProps, InputHTMLAttributes } from 'react';
1
+ import React$1, { PropsWithChildren, ForwardedRef, ReactNode, DetailedHTMLProps, InputHTMLAttributes, ElementType, ButtonHTMLAttributes, ChangeEvent, OptionHTMLAttributes } from 'react';
2
2
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
3
3
  import { MaterialSymbolProps } from 'react-material-symbols';
4
- import { FieldValues, Path, ControllerRenderProps, UseFormReturn, FieldError } from 'react-hook-form';
5
4
  import * as zustand from 'zustand';
6
5
  import * as RadixPopover from '@radix-ui/react-popover';
7
6
  import * as RadixRadioGroup from '@radix-ui/react-radio-group';
@@ -73,7 +72,8 @@ type TTypographyProps<C extends React$1.ElementType = 'p'> = {
73
72
  children?: React$1.ReactNode;
74
73
  className?: string;
75
74
  } & React$1.ComponentPropsWithoutRef<C>;
76
- declare const Typography: <C extends React$1.ElementType = "p">({ as, variant, children, className, ...rest }: TTypographyProps<C>) => React$1.JSX.Element;
75
+ declare const TypographyComponent: <C extends React$1.ElementType = "p">(props: TTypographyProps<C>, forwardRef: ForwardedRef<C>) => React$1.JSX.Element;
76
+ declare const Typography: React$1.ForwardRefExoticComponent<Omit<TTypographyProps<React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements>>, "ref"> & React$1.RefAttributes<React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements>>>;
77
77
 
78
78
  type TCalloutRootProps = {
79
79
  type?: 'primary' | 'secondary' | 'warning' | 'error' | 'positive';
@@ -113,15 +113,17 @@ interface ICardsProps extends PropsWithChildren {
113
113
  }
114
114
  declare const Cards: ({ as, children, variants }: ICardsProps) => React$1.JSX.Element;
115
115
 
116
- type TCheckboxProps<T extends FieldValues> = {
116
+ type TCheckboxProps = {
117
117
  id: string;
118
- name: Path<T>;
119
118
  label: string | ReactNode;
120
119
  disabled?: boolean;
121
120
  className?: string;
122
121
  variant?: 'radio' | 'checkbox';
122
+ onChange?: (value: boolean) => void;
123
+ onBlur?: () => void;
124
+ value?: boolean;
123
125
  };
124
- declare const Checkbox: <T extends FieldValues>(props: TCheckboxProps<T>) => React$1.JSX.Element;
126
+ declare const Checkbox: ({ id, label, variant, value, onChange, onBlur }: TCheckboxProps) => React$1.JSX.Element;
125
127
 
126
128
  type TColumnsProps = {
127
129
  cols: number;
@@ -136,27 +138,39 @@ type TComboBoxItem = {
136
138
  };
137
139
  type TComboBoxProps = {
138
140
  label: string;
139
- name: string;
140
141
  options: TComboBoxItem[];
141
142
  onSelect?: (item: TComboBoxItem) => void;
142
143
  alwaysOpen?: boolean;
143
- field: ControllerRenderProps<FieldValues>;
144
+ field: {
145
+ value: string;
146
+ onChange: (value: string) => void;
147
+ onBlur: () => void;
148
+ };
144
149
  };
145
- declare const ComboBox: (props: Omit<TComboBoxProps, "field">) => React$1.JSX.Element;
146
- declare const Field: ({ label, options, onSelect, alwaysOpen, field: { onBlur, ...restField } }: TComboBoxProps) => React$1.JSX.Element;
150
+ declare const ComboBox: (props: TComboBoxProps) => React$1.JSX.Element;
147
151
 
148
- type TDatePicker<T extends FieldValues> = {
152
+ type TDatePickerProps = {
149
153
  id: string;
150
- name: Path<T>;
151
154
  label: string;
152
155
  helper?: {
153
156
  message: string;
154
157
  };
155
- min?: string;
156
- max?: string;
157
158
  disabled?: boolean;
158
- };
159
- declare const DatePicker: <T extends FieldValues>(props: TDatePicker<T>) => React$1.JSX.Element;
159
+ error?: {
160
+ message: string;
161
+ };
162
+ } & React$1.InputHTMLAttributes<HTMLInputElement>;
163
+ declare const DatePicker: React$1.ForwardRefExoticComponent<{
164
+ id: string;
165
+ label: string;
166
+ helper?: {
167
+ message: string;
168
+ };
169
+ disabled?: boolean;
170
+ error?: {
171
+ message: string;
172
+ };
173
+ } & React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
160
174
 
161
175
  type TDisclosureProps = {
162
176
  condition: boolean;
@@ -164,11 +178,8 @@ type TDisclosureProps = {
164
178
  };
165
179
  declare const Disclosure: ({ condition, children }: TDisclosureProps) => React$1.JSX.Element;
166
180
 
167
- type TFormProps<T extends FieldValues> = PropsWithChildren<HTMLProps<HTMLFormElement>> & {
168
- methods: UseFormReturn<T>;
169
- onSubmit: (values: T) => void;
170
- };
171
- declare const Form: <T extends FieldValues>({ methods, children, onSubmit, ...rest }: TFormProps<T>) => React$1.JSX.Element;
181
+ type TFormProps = PropsWithChildren<DetailedHTMLProps<InputHTMLAttributes<HTMLFormElement>, HTMLFormElement>>;
182
+ declare const Form: ({ children, ...rest }: TFormProps) => React$1.JSX.Element;
172
183
 
173
184
  type PolymorphicLink<T extends ElementType> = {
174
185
  as?: T;
@@ -223,39 +234,72 @@ declare const Modal: {
223
234
  Buttons: ({ children }: TModalButtonProps) => React$1.JSX.Element;
224
235
  };
225
236
 
226
- type TNumberFieldProps<T extends FieldValues> = {
237
+ type TNumberFieldProps = {
238
+ id: string;
227
239
  label: string;
228
- name: Path<T>;
229
- min?: number;
230
- max?: number;
231
240
  width?: number;
232
241
  helper?: {
233
242
  message: string;
234
243
  };
235
- };
236
- declare const NumberField: <T extends FieldValues>(props: TNumberFieldProps<T>) => React$1.JSX.Element;
237
-
238
- type TPhoneFieldProps<T extends FieldValues> = {
244
+ error?: {
245
+ message: string;
246
+ };
247
+ onChange?: (value: number) => void;
248
+ onBlur?: () => void;
249
+ } & DetailedHTMLProps<InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>;
250
+ /**
251
+ * NumberField - A component for rendering a number input field.
252
+ *
253
+ * @param {TNumberFieldProps} props - The properties for the number field component.
254
+ * @returns {JSX.Element} The rendered number field component.
255
+ *
256
+ * !!! If using this component with react-hook-form, you will need to wrap this component in a Controller component.
257
+ */
258
+ declare const NumberField: (props: TNumberFieldProps) => React$1.JSX.Element;
259
+
260
+ type TPhoneFieldProps = {
239
261
  id: string;
240
- name: Path<T>;
241
262
  disabled?: boolean;
263
+ error?: {
264
+ message: string;
265
+ };
242
266
  helper?: {
243
267
  message: ReactNode | string;
244
268
  };
245
269
  className?: string;
246
270
  placeholder?: string;
271
+ onChange?: (value: {
272
+ code: string;
273
+ number: string;
274
+ formatted: string;
275
+ }) => void;
276
+ onBlur?: () => void;
277
+ value?: {
278
+ code: string;
279
+ number: string;
280
+ formatted: string;
281
+ };
247
282
  };
248
- declare const PhoneField: <T extends FieldValues>(props: TPhoneFieldProps<T>) => React$1.JSX.Element;
249
-
250
- interface TPinInputProps<T extends FieldValues> {
251
- name: Path<T>;
283
+ /**
284
+ * PhoneField - A component for rendering a number input field.
285
+ *
286
+ * @param {TPhoneFieldProps} props - The properties for the phone field component.
287
+ * @returns {JSX.Element} The rendered number field component.
288
+ *
289
+ * !!! If using this component with react-hook-form, you will need to wrap this component in a Controller component.
290
+ */
291
+ declare const PhoneField: (props: TPhoneFieldProps) => React$1.JSX.Element;
292
+
293
+ interface TPinInputProps {
252
294
  length: number;
253
295
  label: string;
254
296
  isOTP?: boolean;
255
297
  isPassword?: boolean;
256
298
  isNumeric?: boolean;
299
+ onChange: (value: string) => void;
300
+ onBlur?: () => void;
257
301
  }
258
- declare const PinInput: <T extends FieldValues>(props: TPinInputProps<T>) => React$1.JSX.Element;
302
+ declare const PinInput: ({ length, label, isOTP, isPassword, isNumeric, onChange, onBlur }: TPinInputProps) => React$1.JSX.Element;
259
303
 
260
304
  type TPopoverRootProps = React$1.ComponentPropsWithoutRef<typeof RadixPopover.Root>;
261
305
  type TPopoverTriggerProps = React$1.ComponentPropsWithoutRef<typeof RadixPopover.Trigger>;
@@ -274,42 +318,61 @@ type TProgressIndicatorProps = {
274
318
  };
275
319
  declare const ProgressIndicator: ({ label, size, current, max }: TProgressIndicatorProps) => React$1.JSX.Element;
276
320
 
277
- type TRadioGroupProps<T extends FieldValues> = {
278
- name: Path<T>;
321
+ type TRadioGroupProps = {
322
+ className?: string;
323
+ name?: string;
279
324
  label: string;
280
325
  variant?: 'cards' | 'circle';
281
- error?: FieldError;
282
- } & Omit<RadixRadioGroup.RadioGroupProps, 'name'>;
326
+ error?: {
327
+ message: string;
328
+ };
329
+ onChange?: (value: string) => void;
330
+ onBlur?: () => void;
331
+ disabled?: boolean;
332
+ value?: string;
333
+ };
283
334
  declare const RadioGroup: {
284
- Root: <T extends FieldValues>({ children, className, name, label, variant, disabled, ...props }: TRadioGroupProps<T>) => React$1.JSX.Element;
335
+ Root: React$1.ForwardRefExoticComponent<TRadioGroupProps & {
336
+ children?: React$1.ReactNode | undefined;
337
+ } & React$1.RefAttributes<HTMLDivElement>>;
285
338
  Item: ({ children, className, variant, ...props }: RadixRadioGroup.RadioGroupItemProps & {
286
339
  variant?: "circle" | "cards";
287
340
  }) => React$1.JSX.Element;
288
341
  Indicator: ({ className, ...props }: RadixRadioGroup.RadioGroupIndicatorProps) => React$1.JSX.Element;
289
342
  };
290
343
 
291
- type TRangeProps<T extends FieldValues> = {
344
+ type TRangeProps = {
292
345
  id: string;
293
346
  label: string;
294
- name: Path<T>;
295
- min?: number;
296
- max?: number;
297
347
  step?: number;
298
- showValue?: boolean;
299
348
  helper?: {
300
349
  message: string;
301
350
  };
302
- };
303
- declare const Range: <T extends FieldValues>(props: TRangeProps<T>) => React$1.JSX.Element;
351
+ error?: {
352
+ message: string;
353
+ };
354
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
355
+ } & Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'type'>;
356
+ declare const Range: React$1.ForwardRefExoticComponent<{
357
+ id: string;
358
+ label: string;
359
+ step?: number;
360
+ helper?: {
361
+ message: string;
362
+ };
363
+ error?: {
364
+ message: string;
365
+ };
366
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
367
+ } & Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "type"> & React$1.RefAttributes<HTMLInputElement>>;
304
368
 
305
369
  type TItem = {
306
370
  id: string;
307
371
  title: string;
308
372
  };
309
- type TSelectProps<T extends FieldValues> = {
373
+ type TSelectProps = {
310
374
  id: string;
311
375
  label: string;
312
- name: Path<T>;
313
376
  helper?: {
314
377
  message: string;
315
378
  };
@@ -323,8 +386,11 @@ type TSelectProps<T extends FieldValues> = {
323
386
  defaultValue?: string;
324
387
  missing?: boolean;
325
388
  children?: ReactNode;
326
- };
327
- declare const Select: <T extends FieldValues>(props: TSelectProps<T>) => React$1.JSX.Element;
389
+ error?: {
390
+ message: string;
391
+ };
392
+ } & DetailedHTMLProps<React$1.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
393
+ declare const Select: React$1.ForwardRefExoticComponent<Omit<TSelectProps, "ref"> & React$1.RefAttributes<HTMLSelectElement>>;
328
394
 
329
395
  type TSkeletonProps = {
330
396
  width?: string;
@@ -374,10 +440,9 @@ declare const Tag: {
374
440
  Content: ({ children, ...rest }: TTypographyProps) => React$1.JSX.Element;
375
441
  };
376
442
 
377
- type TTextFieldProps<T extends FieldValues> = {
443
+ type TTextFieldProps = {
378
444
  id: string;
379
445
  label: string;
380
- name: Path<T>;
381
446
  disabled?: boolean;
382
447
  helper?: {
383
448
  message: ReactNode | string;
@@ -390,8 +455,11 @@ type TTextFieldProps<T extends FieldValues> = {
390
455
  leftContent?: ReactNode | string;
391
456
  missing?: boolean;
392
457
  disableError?: boolean;
458
+ error?: {
459
+ message: ReactNode | string;
460
+ };
393
461
  } & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
394
- declare const TextField: React$1.ForwardRefExoticComponent<Omit<TTextFieldProps<FieldValues>, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
462
+ declare const TextField: React$1.ForwardRefExoticComponent<Omit<TTextFieldProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
395
463
 
396
464
  type TToastRootProps = {
397
465
  children: React$1.ReactNode;
@@ -436,4 +504,4 @@ type WrapperVariants = {
436
504
  };
437
505
  declare const Wrapper: ({ as, className, variants, children }: WrapperProps) => React$1.JSX.Element;
438
506
 
439
- export { Accordion, Button, Buttons, Callout, Card, Cards, type CardsVariants, Checkbox, Columns, ComboBox, DatePicker, Disclosure, Field, Form, type ICardOwnProps, type ICardProps, type ICardsProps, Icon, Link, Loading, Modal, NumberField, PhoneField, PinInput, Popover, ProgressIndicator, RadioGroup, Range, Select, Skeleton, type TAccordionRootProps, type TAccordionTriggerProps, type TButtonProps, type TCalloutRootProps, type TCalloutTextProps, type TCardVariants, type TCheckboxProps, type TColumnsProps, type TComboBoxItem, type TComboBoxProps, type TDatePicker, type TDisclosureProps, type TIconProps, type TItem, type TLegacyMarketingFooter, type TLegacyMarketingHeading, type TLegacyMarketingText, type TLink, type TLoadingProps, type TModalButtonProps, type TModalContentProps, type TModalControlProps, type TModalHeaderProps, type TNumberFieldProps, type TPhoneFieldProps, type TPinInputProps, type TPopoverContentProps, type TPopoverRootProps, type TPopoverTriggerProps, type TProgressIndicatorProps, type TRadioGroupProps, type TRangeProps, type TSelectProps, type TSkeletonProps, type TTabsContent, type TTabsList, type TTabsRoot, type TTabsTrigger, type TTagProps, type TTextFieldProps, type TToastDescriptionProps, type TToastIconProps, type TToastRootProps, type TToastTitleProps, type TTooltipContentProps, type TTooltipRootProps, type TTooltipTriggerProps, type TTypography, type TTypographyProps, type TTypographyVariants, type TUseModalProps, Table, TableBody, TableData, TableFooter, TableHead, TableHeader, TableRoot, TableRow, Tabs, Tag, TextField, Toast, Tooltip, Typography, Wrapper, type WrapperProps, type WrapperVariants, useModal };
507
+ export { Accordion, Button, Buttons, Callout, Card, Cards, type CardsVariants, Checkbox, Columns, ComboBox, DatePicker, Disclosure, Form, type ICardOwnProps, type ICardProps, type ICardsProps, Icon, Link, Loading, Modal, NumberField, PhoneField, PinInput, Popover, ProgressIndicator, RadioGroup, Range, Select, Skeleton, type TAccordionRootProps, type TAccordionTriggerProps, type TButtonProps, type TCalloutRootProps, type TCalloutTextProps, type TCardVariants, type TCheckboxProps, type TColumnsProps, type TComboBoxItem, type TComboBoxProps, type TDatePickerProps, type TDisclosureProps, type TIconProps, type TItem, type TLegacyMarketingFooter, type TLegacyMarketingHeading, type TLegacyMarketingText, type TLink, type TLoadingProps, type TModalButtonProps, type TModalContentProps, type TModalControlProps, type TModalHeaderProps, type TNumberFieldProps, type TPhoneFieldProps, type TPinInputProps, type TPopoverContentProps, type TPopoverRootProps, type TPopoverTriggerProps, type TProgressIndicatorProps, type TRadioGroupProps, type TRangeProps, type TSelectProps, type TSkeletonProps, type TTabsContent, type TTabsList, type TTabsRoot, type TTabsTrigger, type TTagProps, type TTextFieldProps, type TToastDescriptionProps, type TToastIconProps, type TToastRootProps, type TToastTitleProps, type TTooltipContentProps, type TTooltipRootProps, type TTooltipTriggerProps, type TTypography, type TTypographyProps, type TTypographyVariants, type TUseModalProps, Table, TableBody, TableData, TableFooter, TableHead, TableHeader, TableRoot, TableRow, Tabs, Tag, TextField, Toast, Tooltip, Typography, TypographyComponent, Wrapper, type WrapperProps, type WrapperVariants, useModal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kroo-web/design-system",
3
- "version": "1.1.104",
3
+ "version": "1.1.106",
4
4
  "description": "Web design system for Kroo including the components for the marketing site and the product side.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",