@react-fabric/form 1.0.0-beta.6 → 1.0.0-beta.60

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 (187) hide show
  1. package/{src/input/ArrayInput.module.css → css/_arrayInput.css} +8 -8
  2. package/css/_colorPicker.css +65 -0
  3. package/{src/internal/Field.module.css → css/_field.css} +66 -30
  4. package/{src/input/File.module.css → css/_file.css} +21 -6
  5. package/css/styles.css +27 -0
  6. package/dist/cjs/builder/FileField.js +40 -28
  7. package/dist/cjs/builder/FormField.js +50 -34
  8. package/dist/cjs/builder/SchemaEditor.js +72 -0
  9. package/dist/cjs/builder/components/AddSchemaFields.js +62 -0
  10. package/dist/cjs/builder/components/SchemaArrayForm.js +145 -0
  11. package/dist/cjs/builder/components/SchemaField.js +414 -0
  12. package/dist/cjs/form/Controller.js +46 -1
  13. package/dist/cjs/form/Form.js +70 -9
  14. package/dist/cjs/hooks/useFileUploader.js +16 -0
  15. package/dist/cjs/hooks/useFormBuilder.js +57 -15
  16. package/dist/cjs/i18n/ar.json.js +5 -4
  17. package/dist/cjs/i18n/en.json.js +5 -5
  18. package/dist/cjs/index.js +12 -2
  19. package/dist/cjs/input/ArrayInput.js +126 -36
  20. package/dist/cjs/input/AvatarInput.js +43 -23
  21. package/dist/cjs/input/Checkbox.js +16 -6
  22. package/dist/cjs/input/ColorInput.js +113 -58
  23. package/dist/cjs/input/ColorPicker.js +60 -76
  24. package/dist/cjs/input/DateInput.js +197 -0
  25. package/dist/cjs/input/Field.js +10 -4
  26. package/dist/cjs/input/File.js +14 -7
  27. package/dist/cjs/input/Hidden.js +13 -2
  28. package/dist/cjs/input/Input.js +24 -10
  29. package/dist/cjs/input/Number.js +22 -10
  30. package/dist/cjs/input/Password.js +22 -12
  31. package/dist/cjs/input/Radio.js +12 -3
  32. package/dist/cjs/input/RadioGroup.js +10 -1
  33. package/dist/cjs/input/{Range.js → RangeSlider.js} +16 -8
  34. package/dist/cjs/input/Search.js +30 -19
  35. package/dist/cjs/input/Slider.js +12 -6
  36. package/dist/cjs/input/Switch.js +20 -9
  37. package/dist/cjs/input/Textarea.js +29 -8
  38. package/dist/cjs/internal/ErrorIcon.js +1 -1
  39. package/dist/cjs/internal/FieldWrapper.js +11 -4
  40. package/dist/cjs/internal/InputWrapper.js +27 -20
  41. package/dist/cjs/select/AutoComplete.js +21 -11
  42. package/dist/cjs/select/DualList.js +34 -12
  43. package/dist/cjs/select/List.js +68 -22
  44. package/dist/cjs/select/Options.js +49 -42
  45. package/dist/cjs/select/Select.js +40 -10
  46. package/dist/cjs/select/useSelect.js +22 -11
  47. package/dist/cjs/types/schema.js +43 -0
  48. package/dist/cjs/utils/eventHandlers.js +15 -5
  49. package/dist/esm/builder/FileField.js +42 -30
  50. package/dist/esm/builder/FormField.js +50 -34
  51. package/dist/esm/builder/SchemaEditor.js +72 -0
  52. package/dist/esm/builder/components/AddSchemaFields.js +62 -0
  53. package/dist/esm/builder/components/SchemaArrayForm.js +145 -0
  54. package/dist/esm/builder/components/SchemaField.js +414 -0
  55. package/dist/esm/form/Controller.js +46 -1
  56. package/dist/esm/form/Form.js +72 -12
  57. package/dist/esm/hooks/useFileUploader.js +16 -0
  58. package/dist/esm/hooks/useFormBuilder.js +55 -13
  59. package/dist/esm/i18n/ar.json.js +5 -4
  60. package/dist/esm/i18n/en.json.js +5 -5
  61. package/dist/esm/index.js +6 -2
  62. package/dist/esm/input/ArrayInput.js +126 -36
  63. package/dist/esm/input/AvatarInput.js +44 -24
  64. package/dist/esm/input/Checkbox.js +16 -6
  65. package/dist/esm/input/ColorInput.js +115 -60
  66. package/dist/esm/input/ColorPicker.js +60 -76
  67. package/dist/esm/input/DateInput.js +197 -0
  68. package/dist/esm/input/Field.js +11 -5
  69. package/dist/esm/input/File.js +16 -9
  70. package/dist/esm/input/Hidden.js +13 -2
  71. package/dist/esm/input/Input.js +26 -12
  72. package/dist/esm/input/Number.js +24 -12
  73. package/dist/esm/input/Password.js +24 -14
  74. package/dist/esm/input/Radio.js +12 -3
  75. package/dist/esm/input/RadioGroup.js +11 -2
  76. package/dist/esm/input/{Range.js → RangeSlider.js} +16 -8
  77. package/dist/esm/input/Search.js +32 -21
  78. package/dist/esm/input/Slider.js +12 -6
  79. package/dist/esm/input/Switch.js +20 -9
  80. package/dist/esm/input/Textarea.js +30 -9
  81. package/dist/esm/internal/ErrorIcon.js +1 -1
  82. package/dist/esm/internal/FieldWrapper.js +11 -4
  83. package/dist/esm/internal/InputWrapper.js +27 -20
  84. package/dist/esm/select/AutoComplete.js +21 -11
  85. package/dist/esm/select/DualList.js +34 -12
  86. package/dist/esm/select/List.js +69 -23
  87. package/dist/esm/select/Options.js +49 -42
  88. package/dist/esm/select/Select.js +40 -10
  89. package/dist/esm/select/useSelect.js +23 -12
  90. package/{src/input/ColorPicker.module.css → dist/esm/types/schema.js} +18 -27
  91. package/dist/esm/utils/eventHandlers.js +15 -5
  92. package/dist/types/builder/FileField.d.ts +4 -2
  93. package/dist/types/builder/FormField.d.ts +3 -1
  94. package/dist/types/builder/SchemaEditor.d.ts +9 -0
  95. package/dist/types/builder/components/AddSchemaFields.d.ts +2 -0
  96. package/dist/types/builder/components/SchemaArrayForm.d.ts +2 -0
  97. package/dist/types/builder/components/SchemaField.d.ts +10 -0
  98. package/dist/types/form/Controller.d.ts +47 -2
  99. package/dist/types/form/Form.d.ts +48 -2
  100. package/dist/types/hooks/useFileUploader.d.ts +16 -0
  101. package/dist/types/hooks/useFormBuilder.d.ts +32 -1
  102. package/dist/types/index.d.ts +6 -3
  103. package/dist/types/input/ArrayInput.d.ts +69 -12
  104. package/dist/types/input/AvatarInput.d.ts +23 -3
  105. package/dist/types/input/Checkbox.d.ts +13 -4
  106. package/dist/types/input/ColorInput.d.ts +15 -2
  107. package/dist/types/input/ColorPicker.d.ts +11 -1
  108. package/dist/types/input/DateInput.d.ts +28 -0
  109. package/dist/types/input/Field.d.ts +5 -1
  110. package/dist/types/input/File.d.ts +9 -0
  111. package/dist/types/input/Hidden.d.ts +13 -1
  112. package/dist/types/input/Input.d.ts +9 -1
  113. package/dist/types/input/Number.d.ts +9 -1
  114. package/dist/types/input/Password.d.ts +7 -1
  115. package/dist/types/input/Radio.d.ts +9 -1
  116. package/dist/types/input/RadioGroup.d.ts +8 -1
  117. package/dist/types/input/RangeSlider.d.ts +67 -0
  118. package/dist/types/input/Search.d.ts +14 -1
  119. package/dist/types/input/Slider.d.ts +8 -2
  120. package/dist/types/input/Switch.d.ts +10 -2
  121. package/dist/types/input/Textarea.d.ts +15 -1
  122. package/dist/types/internal/FieldWrapper.d.ts +1 -1
  123. package/dist/types/internal/InputWrapper.d.ts +1 -1
  124. package/dist/types/ranger/index.d.ts +2 -2
  125. package/dist/types/select/AutoComplete.d.ts +8 -1
  126. package/dist/types/select/DualList.d.ts +17 -2
  127. package/dist/types/select/List.d.ts +9 -1
  128. package/dist/types/select/Options.d.ts +4 -3
  129. package/dist/types/select/Select.d.ts +9 -1
  130. package/dist/types/select/useSelect.d.ts +10 -6
  131. package/dist/types/types/index.d.ts +34 -5
  132. package/dist/types/types/schema.d.ts +78 -33
  133. package/dist/types/utils/eventHandlers.d.ts +2 -2
  134. package/package.json +22 -20
  135. package/src/builder/FileField.tsx +62 -30
  136. package/src/builder/FormField.tsx +52 -32
  137. package/src/builder/SchemaEditor.tsx +79 -0
  138. package/src/builder/components/AddSchemaFields.tsx +74 -0
  139. package/src/builder/components/SchemaArrayForm.tsx +161 -0
  140. package/src/builder/components/SchemaField.tsx +436 -0
  141. package/src/form/Controller.tsx +48 -3
  142. package/src/form/Form.tsx +80 -8
  143. package/src/hooks/useFileUploader.ts +16 -0
  144. package/src/hooks/useFormBuilder.tsx +58 -15
  145. package/src/i18n/ar.json +5 -4
  146. package/src/i18n/en.json +5 -5
  147. package/src/index.ts +12 -3
  148. package/src/input/ArrayInput.tsx +199 -64
  149. package/src/input/AvatarInput.tsx +67 -19
  150. package/src/input/Checkbox.tsx +16 -6
  151. package/src/input/ColorInput.tsx +131 -71
  152. package/src/input/ColorPicker.tsx +54 -72
  153. package/src/input/DateInput.tsx +260 -0
  154. package/src/input/Field.tsx +15 -11
  155. package/src/input/File.tsx +16 -14
  156. package/src/input/Hidden.tsx +17 -2
  157. package/src/input/Input.tsx +27 -13
  158. package/src/input/Number.tsx +22 -13
  159. package/src/input/Password.tsx +24 -16
  160. package/src/input/Radio.tsx +12 -3
  161. package/src/input/RadioGroup.tsx +12 -3
  162. package/src/input/{Range.tsx → RangeSlider.tsx} +17 -9
  163. package/src/input/Search.tsx +33 -22
  164. package/src/input/Slider.tsx +20 -11
  165. package/src/input/Switch.tsx +17 -6
  166. package/src/input/Textarea.tsx +34 -9
  167. package/src/internal/ErrorIcon.tsx +1 -1
  168. package/src/internal/FieldWrapper.tsx +8 -4
  169. package/src/internal/InputWrapper.tsx +49 -27
  170. package/src/select/AutoComplete.tsx +14 -3
  171. package/src/select/DualList.tsx +31 -16
  172. package/src/select/List.tsx +52 -8
  173. package/src/select/Options.tsx +50 -46
  174. package/src/select/Select.tsx +25 -5
  175. package/src/select/useSelect.tsx +26 -9
  176. package/src/types/index.ts +37 -6
  177. package/src/types/schema.ts +96 -41
  178. package/src/utils/eventHandlers.ts +14 -4
  179. package/dist/cjs/input/ArrayInput.module.css +0 -1
  180. package/dist/cjs/input/ColorPicker.module.css +0 -1
  181. package/dist/cjs/input/File.module.css +0 -1
  182. package/dist/cjs/internal/Field.module.css +0 -1
  183. package/dist/esm/input/ArrayInput.module.css +0 -1
  184. package/dist/esm/input/ColorPicker.module.css +0 -1
  185. package/dist/esm/input/File.module.css +0 -1
  186. package/dist/esm/internal/Field.module.css +0 -1
  187. package/dist/types/input/Range.d.ts +0 -59
@@ -1,5 +1,5 @@
1
- import { type ReactNode, type RefObject } from "react";
2
- export interface ArrayInputProps {
1
+ import { type Ref } from "react";
2
+ export interface ArrayInputProps<T extends AnyObject = string> {
3
3
  /**
4
4
  * input label
5
5
  */
@@ -32,6 +32,10 @@ export interface ArrayInputProps {
32
32
  * minimum required length
33
33
  */
34
34
  minItems?: number;
35
+ /**
36
+ * maximum length
37
+ */
38
+ maxItems?: number;
35
39
  /**
36
40
  * field name to focus on add
37
41
  */
@@ -43,23 +47,37 @@ export interface ArrayInputProps {
43
47
  children: React.ReactNode | ((props: {
44
48
  index: number;
45
49
  name: string;
46
- }) => ReactNode);
50
+ item: T;
51
+ }) => React.ReactNode);
47
52
  /**
48
53
  * add item button label
49
54
  */
50
55
  addLabel?: string;
51
- /**
52
- * fixed length list
53
- */
54
- fixedList?: boolean;
55
- arrayRef?: RefObject<{
56
- addItem: (item: AnyObject) => void;
56
+ buttonPosition?: "top" | "bottom" | "both";
57
+ arrayRef?: Ref<{
58
+ addItem: (item: T) => void;
57
59
  removeItem: (idx: number) => void;
58
60
  }>;
59
61
  /**
60
- * Add item
62
+ * add new item
63
+ */
64
+ onAdd?: () => T;
65
+ /**
66
+ * on item remove
61
67
  */
62
- onAdd?: () => AnyObject;
68
+ onRemove?: (item: T, idx: number) => void;
69
+ /**
70
+ * before item remove
71
+ */
72
+ onBeforeRemove?: (item: T, idx: number) => Promise<boolean> | boolean;
73
+ /**
74
+ * can remove item
75
+ */
76
+ canRemove?: false | "newonly" | ((props: {
77
+ item: T;
78
+ index: number;
79
+ lastItem: boolean;
80
+ }) => boolean);
63
81
  /**
64
82
  * field width
65
83
  */
@@ -73,4 +91,43 @@ export interface ArrayInputProps {
73
91
  */
74
92
  labelWidth?: string;
75
93
  }
76
- export declare const ArrayInput: ({ name, children, addLabel, fixedList, focusName, onAdd, arrayRef, enableSorting, disabled, readOnly, minItems, ...rest }: ArrayInputProps) => import("react/jsx-runtime").JSX.Element;
94
+ /**
95
+ * ArrayInput component for managing an array of items in a form.
96
+ * It allows adding, removing, and sorting items within the array.
97
+ * It integrates with react-hook-form for form state management and validation.
98
+ * It supports fixed-length lists, custom add/remove handlers, and can display validation errors.
99
+ * It also provides options for inline display and custom button positioning.
100
+ *
101
+ * It uses the `useFieldArray` hook from `react-hook-form` to manage the array state and provides a simple interface for adding and removing items.
102
+ *
103
+ * It also supports drag-and-drop sorting using `@dnd-kit/core` and `@dnd-kit/sortable` for a better user experience when reordering items.
104
+ *
105
+ * @param {ArrayInputProps<T>} props - The properties for the ArrayInput component.
106
+ * @returns {JSX.Element} The rendered ArrayInput component.
107
+ *
108
+ * @example
109
+ * ```jsx
110
+ * <ArrayInput
111
+ * name="items"
112
+ * label="Items"
113
+ * addLabel="Add Item"
114
+ * onAdd={() => ({ name: "", value: "" })}
115
+ * onRemove={(item, index) => console.log("Removed item:", item, "at index:", index)}
116
+ * onBeforeRemove={(item, index) => confirm(`Are you sure you want to remove item at index ${index}?`)}
117
+ * canRemove={({ item, index, lastItem }) => !lastItem} // Prevent removing the last item
118
+ * >
119
+ * {({ index, name }) => (
120
+ * <Input
121
+ * name={name}
122
+ * label={`Item ${index + 1}`}
123
+ * placeholder="Enter item value"
124
+ * required={index === 0} // Make the first item required
125
+ * />
126
+ * )}
127
+ * </ArrayInput>
128
+ * ```
129
+ *
130
+ * @see {@link https://react-hook-form.com/api/usefieldarray} for more details on `useFieldArray`.
131
+ * @see {@link https://react-dnd.github.io/react-dnd/about} for more details on DnD context and sorting.
132
+ */
133
+ export declare const ArrayInput: <T extends AnyObject = string>({ name, children, addLabel, focusName, buttonPosition, onAdd, onRemove, onBeforeRemove, canRemove, arrayRef, enableSorting, disabled, readOnly, minItems, maxItems, ...rest }: ArrayInputProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
2
2
  import { type UploadHandler } from "../hooks/useFileUploader";
3
+ import { type AvatarProps } from "@react-fabric/core/dist/types/components/avatar/Avatar";
3
4
  export interface Props extends RefProp {
4
5
  /**
5
6
  * field name
@@ -10,14 +11,25 @@ export interface Props extends RefProp {
10
11
  */
11
12
  value?: string;
12
13
  /**
13
- * avatar stream src
14
+ * default avatar image
14
15
  */
15
- src?: string;
16
+ defaultValue?: string;
17
+ /**
18
+ * avatar name
19
+ */
20
+ avatarName?: string;
21
+ rounded?: boolean;
22
+ variant?: AvatarProps["variant"];
23
+ fallbackIcon?: AvatarProps["fallbackIcon"];
24
+ avatarClassName?: AvatarProps["className"];
16
25
  size?: string | number;
17
26
  /**
18
27
  * upload handler to store file in temp storage
19
28
  */
20
29
  uploadHandler: UploadHandler;
30
+ /**
31
+ * file stream path
32
+ */
21
33
  fileUrl?: (path: string) => string;
22
34
  /**
23
35
  * change handler
@@ -28,4 +40,12 @@ export interface Props extends RefProp {
28
40
  */
29
41
  onChange?: (path: string) => void;
30
42
  }
31
- export declare const AvatarInput: ({ src, size, fileUrl, uploadHandler, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
43
+ /**
44
+ * Avatar input component for uploading and displaying user avatars.
45
+ * It allows users to select an image file, upload it, and display the avatar.
46
+ * It also provides a way to remove the uploaded file and shows upload progress.
47
+ *
48
+ * @param {Props} props - The properties for the AvatarInput component.
49
+ * @returns {JSX.Element} - The rendered AvatarInput component.
50
+ */
51
+ export declare const AvatarInput: ({ size, avatarName, avatarClassName, value, rounded, defaultValue, fallbackIcon, variant, fileUrl, uploadHandler, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
3
- export interface CheckboxProps extends RefProp<HTMLInputElement> {
2
+ interface CheckboxProps extends RefProp<HTMLInputElement> {
4
3
  /**
5
4
  * checkbox label
6
5
  */
@@ -16,7 +15,7 @@ export interface CheckboxProps extends RefProp<HTMLInputElement> {
16
15
  /**
17
16
  * on checked change
18
17
  */
19
- onChange?: (checked: boolean | string | number) => void;
18
+ onChange?: (checked: boolean) => void;
20
19
  /**
21
20
  * disabled input
22
21
  */
@@ -43,4 +42,14 @@ export interface CheckboxProps extends RefProp<HTMLInputElement> {
43
42
  iconChecked?: string;
44
43
  name?: string;
45
44
  }
46
- export declare const Checkbox: ({ ref, label, value, name, checked, invalid, disabled, error, width, icon, iconChecked, onChange, ...rest }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
45
+ /**
46
+ * Checkbox component for rendering a checkbox input with label and error handling.
47
+ * It supports custom icons for checked and unchecked states, and handles disabled and invalid states.
48
+ * The component uses a deferred value to manage the checked state, ensuring smooth updates.
49
+ * It also provides an error icon to indicate validation errors.
50
+ *
51
+ * @param {CheckboxProps} props - The properties for the Checkbox component.
52
+ * @returns {JSX.Element} The rendered Checkbox component.
53
+ */
54
+ export declare const Checkbox: ({ ref, label, value, name, checked, invalid, disabled, error, width, icon, iconChecked, required, onChange, ...rest }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
55
+ export {};
@@ -1,10 +1,23 @@
1
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
2
2
  import { type InputProps } from "../types";
3
3
  import { type ColorProps } from "./ColorPicker";
4
- export interface ColorInputProps extends InputProps, ColorProps, RefProp {
4
+ export interface ColorInputProps extends InputProps, Omit<ColorProps, "onChange">, RefProp {
5
5
  /**
6
6
  * show eydrop picker
7
7
  */
8
8
  showPicker?: boolean;
9
9
  }
10
- export declare const ColorInput: ({ ref, required, disabled, allowClear, invalid, error, value, showPicker, defaultColor, decorateEnd, decorateStart, onChange, noOutline, ...rest }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ * Color input component that allows users to select a color
12
+ * and optionally use an eye dropper to pick a color from the screen.
13
+ * It uses the Floating UI library for positioning the color picker.
14
+ * It also provides a button to clear the selected color.
15
+ *
16
+ * This component is a wrapper around the `ColorPicker` component
17
+ * and provides additional functionality such as showing an eye dropper
18
+ * and handling the color selection state.
19
+ *
20
+ * @param {ColorInputProps} props - The properties for the ColorInput component.
21
+ * @returns {JSX.Element} - The rendered ColorInput component.
22
+ */
23
+ export declare const ColorInput: ({ ref, required, disabled, readOnly, invalid, error, value, showPicker, defaultColor, onBlur, onFocus, onChange, noOutline, ...rest }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -15,10 +15,20 @@ export interface ColorProps {
15
15
  /**
16
16
  * color value
17
17
  */
18
- value?: string;
18
+ value?: string | null;
19
19
  /**
20
20
  * change handler
21
21
  */
22
22
  onChange?: (color?: string) => void;
23
23
  }
24
+ /**
25
+ * ColorPicker component allows users to select a color using a color picker UI.
26
+ * It supports swatches, alpha transparency, and custom styles.
27
+ * The component uses the `react-color` library for the color picker functionality.
28
+ *
29
+ * @param {ColorProps} props - The properties for the ColorPicker component.
30
+ * @returns {JSX.Element} The rendered ColorPicker component.
31
+ *
32
+ * @see {@link https://react-color.github.io/react-color/} for more details on the color picker library.
33
+ */
24
34
  export declare const ColorPicker: FC<ColorProps>;
@@ -0,0 +1,28 @@
1
+ import { type RefProp } from "@react-fabric/core/dist/types/types";
2
+ import { type DateLike } from "@react-fabric/date";
3
+ import { type InputProps } from "../types";
4
+ export interface DateProps extends InputProps<string>, RefProp<HTMLInputElement> {
5
+ type?: "date" | "datetime";
6
+ /**
7
+ * date format
8
+ */
9
+ format?: string;
10
+ /**
11
+ * minimum value
12
+ */
13
+ min?: DateLike;
14
+ /**
15
+ * maximum value
16
+ */
17
+ max?: DateLike;
18
+ }
19
+ /**
20
+ * Date input component that allows users to select a date or datetime.
21
+ * It uses the Floating UI library for positioning the date picker.
22
+ * It also provides a button to clear the selected date.
23
+ * The component supports both date and datetime types, with appropriate formatting.
24
+ *
25
+ * @param {DateProps} props - The properties for the DateInput component.
26
+ * @returns {JSX.Element} - The rendered DateInput component.
27
+ */
28
+ export declare const DateInput: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, defaultValue, autoFocus, error, type, onBlur, onFocus, onChange, onEnterPressed, format, min, max, ...rest }: DateProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenProp, type CssProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface FieldProps extends ChildrenProp, CssProp {
4
3
  /**
@@ -39,4 +38,9 @@ export interface FieldProps extends ChildrenProp, CssProp {
39
38
  plain?: boolean;
40
39
  vertical?: boolean;
41
40
  }
41
+ /**
42
+ * Field component for rendering multiple form fields under a single label.
43
+ * It supports various properties for customization, including label, info, required state,
44
+ * and styling options.
45
+ */
42
46
  export declare const Field: ({ children, vertical, noOutline, plain, ...rest }: FieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -14,4 +14,13 @@ export interface FileInputProps extends InputProps<AnyObject>, RefProp<HTMLInput
14
14
  */
15
15
  accept?: string;
16
16
  }
17
+ /**
18
+ * File input component that allows users to select files from their system.
19
+ * It supports multiple file selection and displays a list of selected files.
20
+ * The component also provides functionality to remove files from the list.
21
+ * It handles file changes, invalid states, and read-only or disabled states.
22
+ *
23
+ * @param {FileInputProps} props - The properties for the FileInput component.
24
+ * @returns {JSX.Element} - The rendered FileInput component.
25
+ */
17
26
  export declare const FileInput: ({ ref, value, invalid, readOnly, disabled, required, placeholder, autoFocus, error, name, accept, showList, multiple, onChange, onEnterPressed, ...rest }: FileInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,10 +7,22 @@ interface Props {
7
7
  * hidden value will fire change for form update
8
8
  */
9
9
  hiddenValue?: AnyObject;
10
+ /**
11
+ * default avatar image
12
+ */
13
+ defaultValue?: string;
10
14
  /**
11
15
  * form onChange handler
12
16
  */
13
17
  onChange?: (value: AnyObject) => void;
14
18
  }
15
- export declare const HiddenInput: ({ hiddenValue, onChange, invalid, error, value, name, }: Props) => import("react/jsx-runtime").JSX.Element;
19
+ /**
20
+ * Hidden input component to handle hidden values in forms.
21
+ * It will trigger the onChange handler with the hidden value after a short delay.
22
+ * This is useful for cases where you need to update the form state without user interaction.
23
+ *
24
+ * @param {Object} props - Component properties.
25
+ * @returns {JSX.Element} The rendered hidden input field and error icon.
26
+ */
27
+ export declare const HiddenInput: ({ hiddenValue, defaultValue, onChange, invalid, error, value, name, }: Props) => import("react/jsx-runtime").JSX.Element;
16
28
  export {};
@@ -6,4 +6,12 @@ export interface TextInputProps extends InputProps, RefProp<HTMLInputElement> {
6
6
  */
7
7
  type?: "email" | "file" | "search" | "tel" | "text" | "url";
8
8
  }
9
- export declare const Input: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, autoFocus, error, type, onChange, onEnterPressed, ...rest }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
9
+ /**
10
+ * This component is used to render a text input field with various properties such as name, value, invalid state, read-only, disabled, required, placeholder, autoFocus, error message, monospace font option, and event handlers for blur, focus, change, and enter key press.
11
+ * It also includes a clear button that appears when there is a value in the input field, allowing users to clear the input easily.
12
+ * The component uses a wrapper to handle the clear button and styling, and it supports deferred value updates to optimize performance.
13
+ *
14
+ * @param {TextInputProps} props - The properties for the text input component.
15
+ * @returns {JSX.Element} - A JSX element representing the text input field.
16
+ */
17
+ export declare const Input: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, defaultValue, autoFocus, error, monospace, type, onBlur, onFocus, onChange, onEnterPressed, ...rest }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -14,4 +14,12 @@ export interface NumberProps extends InputProps<number>, RefProp<HTMLInputElemen
14
14
  */
15
15
  step?: number;
16
16
  }
17
- export declare const Number: ({ ref, value, invalid, readOnly, disabled, required, placeholder, autoFocus, name, min, max, step, onChange, onEnterPressed, ...rest }: NumberProps) => import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * This component allows users to input numeric values with optional minimum, maximum, and step constraints.
19
+ * It provides a clear interface for entering numbers, with support for validation and accessibility features.
20
+ * It also includes a clear button to reset the input value.
21
+ *
22
+ * @param {NumberProps} props - The properties for the Number input component.
23
+ * @returns {JSX.Element} The rendered Number input component.
24
+ */
25
+ export declare const Number: ({ ref, value, invalid, readOnly, disabled, required, placeholder, defaultValue, autoFocus, name, min, max, step, onBlur, onFocus, onChange, onEnterPressed, ...rest }: NumberProps) => import("react/jsx-runtime").JSX.Element;
@@ -10,4 +10,10 @@ export interface PasswordProps extends InputProps, RefProp<HTMLInputElement> {
10
10
  */
11
11
  strength?: number;
12
12
  }
13
- export declare const Password: ({ ref, value, name, strength, invalid, readOnly, disabled, required, placeholder, autoFocus, showToggle, onChange, onEnterPressed, ...rest }: PasswordProps) => import("react/jsx-runtime").JSX.Element;
13
+ /**
14
+ * Password input component with optional strength meter and toggle visibility.
15
+ *
16
+ * @param {PasswordProps} props - The properties for the Password component.
17
+ * @returns {JSX.Element} The rendered Password input component.
18
+ */
19
+ export declare const Password: ({ ref, value, name, strength, invalid, readOnly, disabled, required, placeholder, defaultValue, autoFocus, showToggle, onBlur, onFocus, onChange, onEnterPressed, ...rest }: PasswordProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface RadioProps extends RefProp<HTMLInputElement> {
4
3
  name?: string;
@@ -39,4 +38,13 @@ export interface RadioProps extends RefProp<HTMLInputElement> {
39
38
  */
40
39
  iconChecked?: string;
41
40
  }
41
+ /**
42
+ * Radio input component with custom icons and label.
43
+ *
44
+ * This component renders a radio button with an optional label and custom icons for checked and unchecked states.
45
+ * It supports disabled and invalid states, and allows for custom width.
46
+ *
47
+ * @param {RadioProps} props - The properties for the Radio component.
48
+ * @returns {JSX.Element} The rendered Radio input component.
49
+ */
42
50
  export declare const Radio: ({ ref, name, label, value, invalid, disabled, error, width, icon, iconChecked, onChange, ...rest }: RadioProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ChildrenProp, type CssProp } from "@react-fabric/core/dist/types/types";
3
2
  import { type Radio } from "./Radio";
4
3
  export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
@@ -43,4 +42,12 @@ export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
43
42
  */
44
43
  onChange?: (value: AnyObject) => void;
45
44
  }
45
+ /**
46
+ * RadioGroup component for rendering a group of radio buttons.
47
+ * It allows for customization of the label, options, and layout.
48
+ * The component supports inline and vertical orientations, and can handle change events.
49
+ *
50
+ * @param {RadioGroupProps} props - The properties for the RadioGroup component.
51
+ * @returns {JSX.Element} The rendered RadioGroup component.
52
+ */
46
53
  export declare const RadioGroup: ({ children, name, className, optionWidth, onChange, ...rest }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import { type InputProps } from "../types";
2
+ export interface RangeProps extends Omit<InputProps<[number, number]>, "placeholder" | "allowClear" | "children" | "defaultValue"> {
3
+ /**
4
+ * min value
5
+ */
6
+ min?: number;
7
+ /**
8
+ * max value
9
+ */
10
+ max?: number;
11
+ /**
12
+ * increment step
13
+ */
14
+ step?: number;
15
+ /**
16
+ * Range color
17
+ */
18
+ color?: string;
19
+ /**
20
+ * Range height (only vertical)
21
+ */
22
+ height?: number;
23
+ /**
24
+ * vertical orientation
25
+ */
26
+ vertical?: boolean;
27
+ /**
28
+ * display value tooltip
29
+ */
30
+ showValue?: boolean;
31
+ /**
32
+ * display min/max labels
33
+ */
34
+ showLabels?: boolean;
35
+ /**
36
+ * custom min label
37
+ */
38
+ minLabel?: string;
39
+ /**
40
+ * custom max label
41
+ */
42
+ maxLabel?: string;
43
+ /**
44
+ * step ranges
45
+ */
46
+ ranges?: number[];
47
+ /**
48
+ * format value
49
+ */
50
+ format?: string;
51
+ /**
52
+ * slide event handler
53
+ */
54
+ onSlide?: (val: number) => void;
55
+ }
56
+ /**
57
+ * RangeSlider component for rendering a range slider input.
58
+ * It supports vertical orientation, custom colors, step increments,
59
+ * min/max values, and display of labels and value tooltips.
60
+ * The component uses the Ranger library for handling the slider functionality.
61
+ * It also provides error handling and supports disabled and read-only states.
62
+ * The component is designed to be flexible and customizable, allowing for various configurations.
63
+ *
64
+ * @param {RangeProps} props - The properties for the RangeSlider component.
65
+ * @returns {JSX.Element} The rendered RangeSlider component.
66
+ */
67
+ export declare const RangeSlider: ({ error, name, value, step, min, max, height, color, vertical, showLabels, showValue, minLabel, maxLabel, ranges, format, autoFocus, disabled, readOnly, onBlur, onChange, onEnterPressed, onFocus, onSlide, invalid, ...rest }: RangeProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,9 +9,22 @@ export interface SearchProps extends InputProps, RefProp<HTMLInputElement> {
9
9
  * search on value change
10
10
  */
11
11
  searchOnChange?: boolean;
12
+ /**
13
+ * hide search action handle
14
+ */
15
+ hideHandle?: boolean;
12
16
  /**
13
17
  * search handler
14
18
  */
15
19
  onSearch?: (query?: string) => void;
16
20
  }
17
- export declare const Search: ({ ref, value, name, invalid, readOnly, disabled, required, searching, placeholder, autoFocus, allowClear, searchOnChange, decorateEnd, decorateStart, onSearch, onChange, onEnterPressed, ...rest }: SearchProps) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Search input component with optional searching state and search handler.
23
+ * This component allows users to input search queries and trigger a search action.
24
+ * It supports features like searching on value change, showing a search handle,
25
+ * and handling search actions with a debounce mechanism.
26
+ *
27
+ * @param {SearchProps} props - The properties for the Search component.
28
+ * @returns {JSX.Element} The rendered Search input component.
29
+ */
30
+ export declare const Search: ({ ref, value, name, invalid, readOnly, disabled, required, searching, placeholder, defaultValue, autoFocus, hideHandle, allowClear, searchOnChange, onBlur, onFocus, onSearch, onChange, onEnterPressed, ...rest }: SearchProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { type InputProps } from "../types";
2
- export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "allowClear" | "children"> {
2
+ export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "allowClear" | "children" | "defaultValue"> {
3
3
  /**
4
4
  * min value
5
5
  */
@@ -58,6 +58,12 @@ export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "a
58
58
  onSlide?: (val: number) => void;
59
59
  }
60
60
  /**
61
- * Number slider input
61
+ * Slider component for rendering a slider input with labels and value display.
62
+ * It supports vertical orientation, custom min/max labels, and step ranges.
63
+ * The component handles value changes, displays tooltips, and integrates with ranger for slider functionality.
64
+ * It also supports deferred value updates for smoother interactions.
65
+ *
66
+ * @param {SliderProps} props - The properties for the Slider component.
67
+ * @returns {JSX.Element} The rendered Slider component.
62
68
  */
63
69
  export declare const Slider: ({ error, name, value, step, min, max, height, color, vertical, showLabels, showValue, minLabel, maxLabel, ranges, useInfinity, format, invalid, autoFocus, disabled, readOnly, onBlur, onChange, onEnterPressed, onFocus, onSlide, ...rest }: SliderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ColorType, type RefProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface SwitchProps extends RefProp<HTMLInputElement> {
4
3
  /**
@@ -43,4 +42,13 @@ export interface SwitchProps extends RefProp<HTMLInputElement> {
43
42
  offLabel?: string;
44
43
  offLabelColor?: string | ColorType;
45
44
  }
46
- export declare const Switch: ({ ref, label, checked, invalid, disabled, error, width, color, name, onLabel, offLabel, onLabelColor, offLabelColor, defaultColor, onChange, ...rest }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
45
+ /**
46
+ * Switch input component with custom labels and colors.
47
+ * This component renders a switch input with optional labels for the "on" and "off" states,
48
+ * and allows for custom colors for the switch background and labels.
49
+ * It supports disabled and invalid states, and handles change events.
50
+ *
51
+ * @param {SwitchProps} props - The properties for the Switch component.
52
+ * @returns {JSX.Element} The rendered Switch input component.
53
+ */
54
+ export declare const Switch: ({ ref, label, checked, invalid, disabled, error, width, color, name, onLabel, offLabel, onLabelColor, offLabelColor, defaultColor, required, onChange, ...rest }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,19 @@ export interface TextareaProps extends InputProps, RefProp<HTMLTextAreaElement>
13
13
  * increment rows on value change
14
14
  */
15
15
  variableRows?: boolean;
16
+ /**
17
+ * expandable textarea
18
+ */
19
+ expandable?: boolean;
16
20
  }
17
- export declare const Textarea: ({ ref, value, name, invalid, readOnly, disabled, required, placeholder, autoFocus, rows, maxRows, variableRows, onChange, onEnterPressed, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * Textarea component that allows users to input multi-line text.
23
+ * It supports features like variable row count, expandable behavior,
24
+ * and handling of focus, blur, and change events.
25
+ * This component is designed to be flexible and user-friendly,
26
+ * providing a clear interface for text input with optional validation and accessibility features.
27
+ *
28
+ * @param {TextareaProps} props - The properties for the Textarea component.
29
+ * @returns {JSX.Element} The rendered Textarea component.
30
+ */
31
+ export declare const Textarea: ({ ref, value, name, invalid, readOnly, disabled, required, placeholder, defaultValue, autoFocus, rows, maxRows, variableRows, expandable, onBlur, onFocus, onChange, onEnterPressed, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const FieldWrapper: ({ label, appendLabel, width, labelWidth, inline, info, disabled, required, children, listing, className, "data-inner": isInner, }: KeyValue) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const FieldWrapper: ({ label, appendLabel, width, labelWidth, inline, info, disabled, required, children, listing, className, invalid, error, "data-inner": isInner, }: KeyValue) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const InputWrapper: ({ invalid, error, allowClear, showClear, decorateStart, decorateEnd, children, onClear, noOutline, noBorder, textarea, "data-inner": isInner, "data-open": isOpen, floatingExpand, wrapperRef, width, ...rest }: KeyValue) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const InputWrapper: ({ invalid, error, allowClear, showClear, decorateStart, decorateEnd, decorateEndShowWhenEmpty, decorateEndHideWhenEmpty, children, onClear, noOutline, noBorder, actionButton, textarea, textareaExpandable, "data-inner": isInner, "data-open": isOpen, floatingExpand, wrapperRef, width, ...rest }: KeyValue) => import("react/jsx-runtime").JSX.Element;
@@ -18,7 +18,7 @@ type RangerConfig = {
18
18
  steps: number[];
19
19
  });
20
20
  export declare const useRanger: (opts: RangerConfig) => {
21
- trackElRef: import("react").RefObject<HTMLDivElement>;
21
+ trackElRef: import("react").RefObject<HTMLDivElement | null>;
22
22
  activeHandleIndex: number | undefined;
23
23
  ticks: {
24
24
  key: number;
@@ -33,7 +33,7 @@ export declare const useRanger: (opts: RangerConfig) => {
33
33
  value: number;
34
34
  active: boolean;
35
35
  props: {
36
- ref: import("react").RefObject<HTMLDivElement>;
36
+ ref: import("react").RefObject<HTMLDivElement | null>;
37
37
  onMouseDownCapture: (e: ME) => void;
38
38
  onTouchStartCapture: (e: TE) => void;
39
39
  } | {
@@ -13,5 +13,12 @@ type AutoCompleteProps = Omit<SelectProps<string>, "options" | "allowCreate" | "
13
13
  */
14
14
  onInput?: (query: string) => void;
15
15
  };
16
- export declare const AutoComplete: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, autoFocus, expandOnEdit, error, history, multiple, onChange, onSelect, onInput, onFocus, onBlur, onEnterPressed, ...rest }: AutoCompleteProps) => import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * AutoComplete component for selecting or entering values with history suggestions.
18
+ * It supports multiple selections, history suggestions, and custom styling.
19
+ *
20
+ * @param {AutoCompleteProps} props - The properties for the AutoComplete component.
21
+ * @returns {JSX.Element} The rendered AutoComplete component.
22
+ */
23
+ export declare const AutoComplete: ({ ref, name, value, invalid, readOnly, disabled, required, placeholder, autoFocus, expandOnEdit, error, history, multiple, onChange, onSelect, onInput, onFocus, onBlur, onQuery, onEnterPressed, ...rest }: AutoCompleteProps) => import("react/jsx-runtime").JSX.Element;
17
24
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { type RefProp } from "@react-fabric/core/dist/types/types";
2
+ import { type ReactElement } from "react";
3
3
  import { type FieldProps } from "../input/Field";
4
4
  export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<HTMLInputElement> {
5
5
  /**
@@ -26,6 +26,10 @@ export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<
26
26
  * value property name
27
27
  */
28
28
  valueProperty?: keyof T;
29
+ /**
30
+ * empty list display
31
+ */
32
+ emptyDisplay?: ReactElement;
29
33
  /**
30
34
  * item renderer
31
35
  */
@@ -35,4 +39,15 @@ export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<
35
39
  */
36
40
  onChange?: (value?: string[]) => void;
37
41
  }
38
- export declare const DualList: <T extends unknown = string>({ ref, value, options, groupProperty, height, labelProperty, valueProperty, renderer, onChange, name, invalid, readOnly, disabled, placeholder, autoFocus, error, ...rest }: DualListProps<T>) => import("react/jsx-runtime").JSX.Element;
42
+ /**
43
+ * DualList component allows users to select items from two lists.
44
+ * It displays two lists side by side, one for unselected items and one for selected items.
45
+ * Users can move items between the lists using buttons or drag-and-drop functionality.
46
+ * It supports multiple selections and provides options for grouping, labeling, and rendering items.
47
+ * It also includes features for handling empty states and custom rendering of items.
48
+ * This component is useful for scenarios where users need to manage selections from a larger set of options, such as in forms or settings.
49
+ *
50
+ * @param {DualListProps<T>} props - The properties for the DualList component.
51
+ * @returns {JSX.Element} The rendered DualList component.
52
+ */
53
+ export declare const DualList: <T extends AnyObject = string>({ ref, value, options, emptyDisplay, groupProperty, height, labelProperty, valueProperty, renderer, onChange, name, invalid, readOnly, disabled, placeholder, autoFocus, error, ...rest }: DualListProps<T>) => import("react/jsx-runtime").JSX.Element;