@react-fabric/form 1.0.0-beta.8 → 1.0.1

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 (215) hide show
  1. package/{src/input/ArrayInput.module.css → css/_arrayInput.css} +8 -8
  2. package/css/_colorPicker.css +95 -0
  3. package/{src/internal/Field.module.css → css/_field.css} +94 -33
  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 +107 -78
  7. package/dist/cjs/builder/FormField.js +60 -39
  8. package/dist/cjs/builder/SchemaEditor.js +72 -0
  9. package/dist/cjs/builder/components/AddSchemaFields.js +64 -0
  10. package/dist/cjs/builder/components/SchemaArrayForm.js +146 -0
  11. package/dist/cjs/builder/components/SchemaField.js +423 -0
  12. package/dist/cjs/form/Controller.js +66 -19
  13. package/dist/cjs/form/Form.js +97 -39
  14. package/dist/cjs/form/useForm.js +32 -0
  15. package/dist/cjs/hooks/useFileUploader.js +74 -45
  16. package/dist/cjs/hooks/useFormBuilder.js +85 -31
  17. package/dist/cjs/i18n/{ar.json.js → ar/form.json.js} +5 -4
  18. package/dist/cjs/i18n/{en.json.js → en/form.json.js} +5 -5
  19. package/dist/cjs/i18n/index.js +4 -4
  20. package/dist/cjs/index.js +41 -2
  21. package/dist/cjs/input/ArrayInput.js +259 -135
  22. package/dist/cjs/input/AvatarInput.js +99 -63
  23. package/dist/cjs/input/Checkbox.js +24 -25
  24. package/dist/cjs/input/ColorInput.js +138 -81
  25. package/dist/cjs/input/ColorPicker.js +78 -95
  26. package/dist/cjs/input/DateInput.js +192 -0
  27. package/dist/cjs/input/Field.js +21 -20
  28. package/dist/cjs/input/File.js +85 -80
  29. package/dist/cjs/input/Hidden.js +27 -13
  30. package/dist/cjs/input/Input.js +49 -48
  31. package/dist/cjs/input/Number.js +46 -44
  32. package/dist/cjs/input/Password.js +51 -49
  33. package/dist/cjs/input/Radio.js +26 -16
  34. package/dist/cjs/input/RadioGroup.js +26 -11
  35. package/dist/cjs/input/{Range.js → RangeSlider.js} +61 -66
  36. package/dist/cjs/input/Search.js +58 -64
  37. package/dist/cjs/input/Slider.js +57 -66
  38. package/dist/cjs/input/Switch.js +29 -27
  39. package/dist/cjs/input/Textarea.js +65 -53
  40. package/dist/cjs/internal/ErrorIcon.js +9 -9
  41. package/dist/cjs/internal/FieldWrapper.js +23 -13
  42. package/dist/cjs/internal/InputWrapper.js +85 -87
  43. package/dist/cjs/ranger/index.js +7 -7
  44. package/dist/cjs/ranger/utils.js +9 -4
  45. package/dist/cjs/select/AutoComplete.js +93 -76
  46. package/dist/cjs/select/DualList.js +235 -154
  47. package/dist/cjs/select/List.js +122 -89
  48. package/dist/cjs/select/Options.js +58 -54
  49. package/dist/cjs/select/Select.js +119 -89
  50. package/dist/cjs/select/helpers.js +5 -5
  51. package/dist/cjs/select/useSelect.js +83 -58
  52. package/dist/cjs/types/schema.js +43 -0
  53. package/dist/cjs/utils/eventHandlers.js +16 -6
  54. package/dist/cjs/utils/getColor.js +6 -6
  55. package/dist/cjs/utils/getProps.js +49 -0
  56. package/dist/esm/builder/FileField.js +109 -80
  57. package/dist/esm/builder/FormField.js +60 -39
  58. package/dist/esm/builder/SchemaEditor.js +72 -0
  59. package/dist/esm/builder/components/AddSchemaFields.js +64 -0
  60. package/dist/esm/builder/components/SchemaArrayForm.js +146 -0
  61. package/dist/esm/builder/components/SchemaField.js +423 -0
  62. package/dist/esm/form/Controller.js +66 -19
  63. package/dist/esm/form/Form.js +97 -39
  64. package/dist/esm/form/useForm.js +32 -0
  65. package/dist/esm/hooks/useFileUploader.js +75 -46
  66. package/dist/esm/hooks/useFormBuilder.js +84 -30
  67. package/dist/esm/i18n/{ar.json.js → ar/form.json.js} +5 -4
  68. package/dist/esm/i18n/{en.json.js → en/form.json.js} +5 -5
  69. package/dist/esm/i18n/index.js +2 -2
  70. package/dist/esm/index.js +36 -1
  71. package/dist/esm/input/ArrayInput.js +260 -136
  72. package/dist/esm/input/AvatarInput.js +99 -63
  73. package/dist/esm/input/Checkbox.js +26 -27
  74. package/dist/esm/input/ColorInput.js +141 -84
  75. package/dist/esm/input/ColorPicker.js +80 -97
  76. package/dist/esm/input/DateInput.js +192 -0
  77. package/dist/esm/input/Field.js +21 -20
  78. package/dist/esm/input/File.js +89 -84
  79. package/dist/esm/input/Hidden.js +28 -14
  80. package/dist/esm/input/Input.js +51 -50
  81. package/dist/esm/input/Number.js +48 -46
  82. package/dist/esm/input/Password.js +54 -52
  83. package/dist/esm/input/Radio.js +27 -17
  84. package/dist/esm/input/RadioGroup.js +27 -12
  85. package/dist/esm/input/{Range.js → RangeSlider.js} +62 -67
  86. package/dist/esm/input/Search.js +61 -67
  87. package/dist/esm/input/Slider.js +58 -67
  88. package/dist/esm/input/Switch.js +31 -29
  89. package/dist/esm/input/Textarea.js +67 -55
  90. package/dist/esm/internal/ErrorIcon.js +11 -11
  91. package/dist/esm/internal/FieldWrapper.js +23 -13
  92. package/dist/esm/internal/InputWrapper.js +88 -90
  93. package/dist/esm/ranger/index.js +7 -7
  94. package/dist/esm/ranger/utils.js +9 -4
  95. package/dist/esm/select/AutoComplete.js +95 -78
  96. package/dist/esm/select/DualList.js +233 -152
  97. package/dist/esm/select/List.js +125 -92
  98. package/dist/esm/select/Options.js +58 -54
  99. package/dist/esm/select/Select.js +122 -92
  100. package/dist/esm/select/helpers.js +5 -5
  101. package/dist/esm/select/useSelect.js +84 -59
  102. package/{src/input/ColorPicker.module.css → dist/esm/types/schema.js} +18 -27
  103. package/dist/esm/utils/eventHandlers.js +16 -6
  104. package/dist/esm/utils/getColor.js +6 -6
  105. package/dist/esm/utils/getProps.js +49 -0
  106. package/dist/types/builder/FileField.d.ts +7 -4
  107. package/dist/types/builder/FormField.d.ts +4 -2
  108. package/dist/types/builder/SchemaEditor.d.ts +6 -0
  109. package/dist/types/builder/components/AddSchemaFields.d.ts +2 -0
  110. package/dist/types/builder/components/SchemaArrayForm.d.ts +2 -0
  111. package/dist/types/builder/components/SchemaField.d.ts +12 -0
  112. package/dist/types/form/Controller.d.ts +45 -3
  113. package/dist/types/form/Form.d.ts +38 -7
  114. package/dist/types/form/useForm.d.ts +6 -0
  115. package/dist/types/hooks/useFileUploader.d.ts +24 -3
  116. package/dist/types/hooks/useFormBuilder.d.ts +41 -3
  117. package/dist/types/index.d.ts +32 -2
  118. package/dist/types/input/ArrayInput.d.ts +68 -13
  119. package/dist/types/input/AvatarInput.d.ts +23 -6
  120. package/dist/types/input/Checkbox.d.ts +12 -10
  121. package/dist/types/input/ColorInput.d.ts +15 -5
  122. package/dist/types/input/ColorPicker.d.ts +10 -2
  123. package/dist/types/input/DateInput.d.ts +21 -0
  124. package/dist/types/input/Field.d.ts +9 -36
  125. package/dist/types/input/File.d.ts +16 -4
  126. package/dist/types/input/Hidden.d.ts +7 -6
  127. package/dist/types/input/Input.d.ts +11 -4
  128. package/dist/types/input/Number.d.ts +9 -4
  129. package/dist/types/input/Password.d.ts +9 -4
  130. package/dist/types/input/Radio.d.ts +9 -4
  131. package/dist/types/input/RadioGroup.d.ts +14 -6
  132. package/dist/types/input/{Range.d.ts → RangeSlider.d.ts} +11 -6
  133. package/dist/types/input/Search.d.ts +14 -4
  134. package/dist/types/input/Slider.d.ts +9 -6
  135. package/dist/types/input/Switch.d.ts +13 -8
  136. package/dist/types/input/Textarea.d.ts +15 -4
  137. package/dist/types/internal/ErrorIcon.d.ts +4 -1
  138. package/dist/types/internal/FieldWrapper.d.ts +10 -1
  139. package/dist/types/internal/InputWrapper.d.ts +19 -1
  140. package/dist/types/ranger/index.d.ts +7 -3
  141. package/dist/types/ranger/utils.d.ts +2 -2
  142. package/dist/types/select/AutoComplete.d.ts +7 -2
  143. package/dist/types/select/DualList.d.ts +11 -37
  144. package/dist/types/select/List.d.ts +7 -2
  145. package/dist/types/select/Options.d.ts +8 -7
  146. package/dist/types/select/Select.d.ts +7 -2
  147. package/dist/types/select/helpers.d.ts +2 -2
  148. package/dist/types/select/useSelect.d.ts +10 -28
  149. package/dist/types/types/index.d.ts +73 -39
  150. package/dist/types/types/schema.d.ts +78 -32
  151. package/dist/types/utils/eventHandlers.d.ts +4 -4
  152. package/dist/types/utils/getColor.d.ts +4 -4
  153. package/dist/types/utils/getProps.d.ts +26 -0
  154. package/dist/types/utils/index.d.ts +1 -0
  155. package/package.json +25 -25
  156. package/src/builder/FileField.tsx +73 -56
  157. package/src/builder/FormField.tsx +66 -58
  158. package/src/builder/SchemaEditor.tsx +78 -0
  159. package/src/builder/components/AddSchemaFields.tsx +64 -0
  160. package/src/builder/components/SchemaArrayForm.tsx +146 -0
  161. package/src/builder/components/SchemaField.tsx +405 -0
  162. package/src/form/Controller.tsx +61 -24
  163. package/src/form/Form.tsx +74 -50
  164. package/src/form/useForm.ts +53 -0
  165. package/src/hooks/useFileUploader.ts +115 -84
  166. package/src/hooks/useFormBuilder.tsx +80 -41
  167. package/src/i18n/{ar.json → ar/form.json} +5 -4
  168. package/src/i18n/{en.json → en/form.json} +5 -5
  169. package/src/i18n/index.ts +2 -2
  170. package/src/index.ts +34 -20
  171. package/src/input/ArrayInput.tsx +255 -173
  172. package/src/input/AvatarInput.tsx +82 -39
  173. package/src/input/Checkbox.tsx +30 -54
  174. package/src/input/ColorInput.tsx +146 -105
  175. package/src/input/ColorPicker.tsx +76 -102
  176. package/src/input/DateInput.tsx +225 -0
  177. package/src/input/Field.tsx +23 -65
  178. package/src/input/File.tsx +76 -98
  179. package/src/input/Hidden.tsx +36 -24
  180. package/src/input/Input.tsx +55 -53
  181. package/src/input/Number.tsx +49 -54
  182. package/src/input/Password.tsx +61 -66
  183. package/src/input/Radio.tsx +28 -37
  184. package/src/input/RadioGroup.tsx +30 -25
  185. package/src/input/{Range.tsx → RangeSlider.tsx} +81 -109
  186. package/src/input/Search.tsx +64 -77
  187. package/src/input/Slider.tsx +80 -109
  188. package/src/input/Switch.tsx +39 -53
  189. package/src/input/Textarea.tsx +72 -59
  190. package/src/internal/ErrorIcon.tsx +22 -21
  191. package/src/internal/FieldWrapper.tsx +33 -23
  192. package/src/internal/InputWrapper.tsx +132 -143
  193. package/src/ranger/index.tsx +37 -117
  194. package/src/ranger/utils.ts +12 -11
  195. package/src/select/AutoComplete.tsx +113 -123
  196. package/src/select/DualList.tsx +218 -204
  197. package/src/select/List.tsx +130 -97
  198. package/src/select/Options.tsx +59 -57
  199. package/src/select/Select.tsx +148 -122
  200. package/src/select/helpers.ts +13 -8
  201. package/src/select/useSelect.tsx +110 -127
  202. package/src/types/index.ts +76 -45
  203. package/src/types/schema.ts +97 -40
  204. package/src/utils/eventHandlers.ts +24 -26
  205. package/src/utils/getColor.ts +9 -8
  206. package/src/utils/getProps.ts +47 -0
  207. package/src/utils/index.ts +1 -0
  208. package/dist/cjs/input/ArrayInput.module.css +0 -1
  209. package/dist/cjs/input/ColorPicker.module.css +0 -1
  210. package/dist/cjs/input/File.module.css +0 -1
  211. package/dist/cjs/internal/Field.module.css +0 -1
  212. package/dist/esm/input/ArrayInput.module.css +0 -1
  213. package/dist/esm/input/ColorPicker.module.css +0 -1
  214. package/dist/esm/input/File.module.css +0 -1
  215. package/dist/esm/internal/Field.module.css +0 -1
@@ -1,6 +1,7 @@
1
- import { type RefProp } from "@react-fabric/core/dist/types/types";
2
- import { type InputProps } from "../types";
3
- export interface PasswordProps extends InputProps, RefProp<HTMLInputElement> {
1
+ import type { RefProp } from "@react-fabric/core/dist/types/types";
2
+ import type { InputHTMLAttributes } from "react";
3
+ import type { InputProps, WrapperProps } from "../types";
4
+ export interface PasswordProps extends InputProps, WrapperProps, RefProp<HTMLInputElement> {
4
5
  /**
5
6
  * show password toggle
6
7
  */
@@ -9,5 +10,9 @@ export interface PasswordProps extends InputProps, RefProp<HTMLInputElement> {
9
10
  * password strength meter (0-1)
10
11
  */
11
12
  strength?: number;
13
+ autoComplete?: InputHTMLAttributes<HTMLInputElement>["autoComplete"];
12
14
  }
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;
15
+ /**
16
+ * Password input component with optional strength meter and toggle visibility.
17
+ */
18
+ export declare function Password(props: PasswordProps): import("react").JSX.Element;
@@ -1,11 +1,10 @@
1
- /// <reference types="react" />
2
- import { type RefProp } from "@react-fabric/core/dist/types/types";
1
+ import type { RefProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface RadioProps extends RefProp<HTMLInputElement> {
4
3
  name?: string;
5
4
  /**
6
5
  * radio label
7
6
  */
8
- label?: JSX.Element | string;
7
+ label?: React.ReactElement | string;
9
8
  /**
10
9
  * value
11
10
  */
@@ -39,4 +38,10 @@ export interface RadioProps extends RefProp<HTMLInputElement> {
39
38
  */
40
39
  iconChecked?: string;
41
40
  }
42
- export declare const Radio: ({ ref, name, label, value, invalid, disabled, error, width, icon, iconChecked, onChange, ...rest }: RadioProps) => import("react/jsx-runtime").JSX.Element;
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
+ export declare function Radio({ ref, name, label, value, invalid, disabled, width, icon, error, iconChecked, onChange, ...rest }: RadioProps): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
- import { type ChildrenProp, type CssProp } from "@react-fabric/core/dist/types/types";
3
- import { type Radio } from "./Radio";
4
- export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
1
+ import type { ChildrenProp, CssProp } from "@react-fabric/core/dist/types/types";
2
+ import type { RadioProps } from "./Radio";
3
+ export interface RadioGroupProps extends ChildrenProp<RadioProps>, CssProp {
5
4
  /**
6
5
  * input label
7
6
  */
@@ -9,7 +8,7 @@ export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
9
8
  /**
10
9
  * append to label end
11
10
  */
12
- appendLabel?: JSX.Element | string | number | boolean;
11
+ appendLabel?: React.ReactElement | string | number | boolean;
13
12
  /**
14
13
  * field info
15
14
  */
@@ -38,9 +37,18 @@ export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
38
37
  * vertical orientation
39
38
  */
40
39
  vertical?: boolean;
40
+ /**
41
+ * value
42
+ */
43
+ value?: string | number;
41
44
  /**
42
45
  * change handler
43
46
  */
44
47
  onChange?: (value: AnyObject) => void;
45
48
  }
46
- export declare const RadioGroup: ({ children, name, className, optionWidth, onChange, ...rest }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
49
+ /**
50
+ * RadioGroup component for rendering a group of radio buttons.
51
+ * It allows for customization of the label, options, and layout.
52
+ * The component supports inline and vertical orientations, and can handle change events.
53
+ */
54
+ export declare function RadioGroup({ children, name, className, optionWidth, vertical, value, onChange, ...rest }: RadioGroupProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { type InputProps } from "../types";
2
- export interface RangeProps extends Omit<InputProps<[number, number]>, "placeholder" | "allowClear" | "children"> {
1
+ import type { InputProps, WrapperProps } from "../types";
2
+ export interface RangeProps extends Omit<InputProps<[number, number]>, "placeholder" | "allowClear" | "children" | "defaultValue">, WrapperProps {
3
3
  /**
4
4
  * min value
5
5
  */
@@ -35,11 +35,11 @@ export interface RangeProps extends Omit<InputProps<[number, number]>, "placehol
35
35
  /**
36
36
  * custom min label
37
37
  */
38
- minLabel?: string;
38
+ minLabel?: string | React.ReactElement;
39
39
  /**
40
40
  * custom max label
41
41
  */
42
- maxLabel?: string;
42
+ maxLabel?: string | React.ReactElement;
43
43
  /**
44
44
  * step ranges
45
45
  */
@@ -54,6 +54,11 @@ export interface RangeProps extends Omit<InputProps<[number, number]>, "placehol
54
54
  onSlide?: (val: number) => void;
55
55
  }
56
56
  /**
57
- * Number Range input
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.
58
63
  */
59
- export declare const Range: ({ 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;
64
+ export declare function RangeSlider(props: RangeProps): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
- import { type RefProp } from "@react-fabric/core/dist/types/types";
2
- import { type InputProps } from "../types";
3
- export interface SearchProps extends InputProps, RefProp<HTMLInputElement> {
1
+ import type { RefProp } from "@react-fabric/core/dist/types/types";
2
+ import type { InputProps, WrapperProps } from "../types";
3
+ export interface SearchProps extends InputProps, WrapperProps, RefProp<HTMLInputElement> {
4
4
  /**
5
5
  * is searching
6
6
  */
@@ -9,9 +9,19 @@ 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
+ export declare function Search(props: SearchProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { type InputProps } from "../types";
2
- export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "allowClear" | "children"> {
1
+ import type { InputProps, WrapperProps } from "../types";
2
+ export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "allowClear" | "children" | "defaultValue">, WrapperProps {
3
3
  /**
4
4
  * min value
5
5
  */
@@ -35,11 +35,11 @@ export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "a
35
35
  /**
36
36
  * custom min label
37
37
  */
38
- minLabel?: string;
38
+ minLabel?: string | React.ReactElement;
39
39
  /**
40
40
  * custom max label
41
41
  */
42
- maxLabel?: string;
42
+ maxLabel?: string | React.ReactElement;
43
43
  /**
44
44
  * step ranges
45
45
  */
@@ -58,6 +58,9 @@ 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.
62
65
  */
63
- 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;
66
+ export declare function Slider(props: SliderProps): import("react").JSX.Element;
@@ -1,10 +1,9 @@
1
- /// <reference types="react" />
2
- import { type ColorType, type RefProp } from "@react-fabric/core/dist/types/types";
1
+ import type { ColorUnion, RefProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface SwitchProps extends RefProp<HTMLInputElement> {
4
3
  /**
5
4
  * Switch label
6
5
  */
7
- label?: JSX.Element | string;
6
+ label?: React.ReactElement | string;
8
7
  /**
9
8
  * checked
10
9
  */
@@ -32,15 +31,21 @@ export interface SwitchProps extends RefProp<HTMLInputElement> {
32
31
  /**
33
32
  * cutom Switch icon
34
33
  */
35
- color?: string | ColorType;
34
+ color?: ColorUnion;
36
35
  /**
37
36
  * cutom Switch icon
38
37
  */
39
- defaultColor?: string | ColorType;
38
+ defaultColor?: ColorUnion;
40
39
  name?: string;
41
40
  onLabel?: string;
42
- onLabelColor?: string | ColorType;
41
+ onLabelColor?: ColorUnion;
43
42
  offLabel?: string;
44
- offLabelColor?: string | ColorType;
43
+ offLabelColor?: ColorUnion;
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
+ export declare function Switch({ ref, label, checked, invalid, disabled, error, width, color, name, onLabel, offLabel, onLabelColor, offLabelColor, defaultColor, onChange, ...rest }: SwitchProps): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
- import { type RefProp } from "@react-fabric/core/dist/types/types";
2
- import { type InputProps } from "../types";
3
- export interface TextareaProps extends InputProps, RefProp<HTMLTextAreaElement> {
1
+ import type { RefProp } from "@react-fabric/core/dist/types/types";
2
+ import type { InputProps, WrapperProps } from "../types";
3
+ export interface TextareaProps extends InputProps, WrapperProps, RefProp<HTMLTextAreaElement> {
4
4
  /**
5
5
  * textarae rows
6
6
  */
@@ -13,5 +13,16 @@ 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
+ export declare function Textarea(props: TextareaProps): import("react").JSX.Element;
@@ -1 +1,4 @@
1
- export declare const ErrorIcon: ({ error, invalid }: KeyValue) => any;
1
+ export declare function ErrorIcon({ error, invalid }: {
2
+ error?: string | KeyValue;
3
+ invalid?: boolean;
4
+ }): false | "" | import("react").JSX.Element | undefined;
@@ -1 +1,10 @@
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
+ import type { CssProp } from "@react-fabric/core/dist/types/types";
2
+ import type { ReactNode } from "react";
3
+ import type { WrapperProps } from "../types";
4
+ export interface FieldProps extends CssProp, WrapperProps {
5
+ id?: string;
6
+ children: ReactNode;
7
+ showError?: boolean;
8
+ listing?: ReactNode;
9
+ }
10
+ export declare function FieldWrapper({ id, name, label, appendLabel, width, labelWidth, inline, info, required, children, listing, invalid, disabled, error, showError, }: FieldProps): import("react").JSX.Element;
@@ -1 +1,19 @@
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
+ import type { CssProp } from "@react-fabric/core/dist/types/types";
2
+ import type { ReactNode } from "react";
3
+ import type { WrapperProps } from "../types";
4
+ export interface InputWrapperProps extends CssProp, WrapperProps {
5
+ id?: string;
6
+ children: ReactNode;
7
+ showClear?: boolean;
8
+ onClear?: () => void;
9
+ textarea?: boolean;
10
+ hasStepper?: boolean;
11
+ actionButton?: ReactNode;
12
+ textareaExpandable?: boolean;
13
+ isOpen?: boolean;
14
+ focusRing?: boolean;
15
+ floatingExpand?: boolean;
16
+ listing?: ReactNode;
17
+ ref?: React.Ref<HTMLDivElement | null>;
18
+ }
19
+ export declare function InputWrapper(props: InputWrapperProps): import("react").JSX.Element;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * react-ranger
3
+ * https://github.com/TanStack/ranger
4
+ */
1
5
  import { type KeyboardEvent as KE, type MouseEvent as ME, type TouchEvent as TE } from "react";
2
6
  type RangerChangeEvent = (newValue: readonly number[]) => void;
3
7
  type RangerConfig = {
@@ -17,8 +21,8 @@ type RangerConfig = {
17
21
  } | {
18
22
  steps: number[];
19
23
  });
20
- export declare const useRanger: (opts: RangerConfig) => {
21
- trackElRef: import("react").RefObject<HTMLDivElement>;
24
+ export declare function useRanger(opts: RangerConfig): {
25
+ trackElRef: import("react").RefObject<HTMLDivElement | null>;
22
26
  activeHandleIndex: number | undefined;
23
27
  ticks: {
24
28
  key: number;
@@ -33,7 +37,7 @@ export declare const useRanger: (opts: RangerConfig) => {
33
37
  value: number;
34
38
  active: boolean;
35
39
  props: {
36
- ref: import("react").RefObject<HTMLDivElement>;
40
+ ref: import("react").RefObject<HTMLDivElement | null>;
37
41
  onMouseDownCapture: (e: ME) => void;
38
42
  onTouchStartCapture: (e: TE) => void;
39
43
  } | {
@@ -2,7 +2,7 @@
2
2
  * react-ranger
3
3
  * https://github.com/TanStack/ranger
4
4
  */
5
- export declare const getBoundingClientRect: (element: any) => {
5
+ export declare function getBoundingClientRect(element: AnyObject): {
6
6
  top: number;
7
7
  left: number;
8
8
  right: number;
@@ -10,7 +10,7 @@ export declare const getBoundingClientRect: (element: any) => {
10
10
  bottom: number;
11
11
  height: number;
12
12
  };
13
- export declare const sortNumList: (arr: ReadonlyArray<number | string>) => number[];
13
+ export declare function sortNumList(arr: ReadonlyArray<number | string>): number[];
14
14
  export declare const linearInterpolator: {
15
15
  getPercentageForValue: (val: number, min: number, max: number) => number;
16
16
  getValueForClientX: (clientX: number, trackDims: {
@@ -1,5 +1,6 @@
1
+ import type { RefProp } from "@react-fabric/core/dist/types/types";
1
2
  import { type SelectProps } from "../types";
2
- type AutoCompleteProps = Omit<SelectProps<string>, "options" | "allowCreate" | "createOption"> & {
3
+ type AutoCompleteProps = Omit<SelectProps<string>, "ref" | "options" | "allowCreate" | "createOption"> & RefProp<HTMLTextAreaElement> & {
3
4
  /**
4
5
  * auto-complete history
5
6
  */
@@ -13,5 +14,9 @@ type AutoCompleteProps = Omit<SelectProps<string>, "options" | "allowCreate" | "
13
14
  */
14
15
  onInput?: (query: string) => void;
15
16
  };
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;
17
+ /**
18
+ * AutoComplete component for selecting or entering values with history suggestions.
19
+ * It supports multiple selections, history suggestions, and custom styling.
20
+ */
21
+ export declare function AutoComplete(props: AutoCompleteProps): import("react").JSX.Element;
17
22
  export {};
@@ -1,38 +1,12 @@
1
- /// <reference types="react" />
2
- import { type RefProp } from "@react-fabric/core/dist/types/types";
3
- import { type FieldProps } from "../input/Field";
4
- export interface DualListProps<T> extends Omit<FieldProps, "children">, RefProp<HTMLInputElement> {
5
- /**
6
- * list height
7
- */
1
+ import type { DualSelectProps } from "../types";
2
+ /**
3
+ * DualList component allows users to select items from two lists.
4
+ * It displays two lists side by side, one for unselected items and one for selected items.
5
+ * Users can move items between the lists using buttons or drag-and-drop functionality.
6
+ * It supports multiple selections and provides options for grouping, labeling, and rendering items.
7
+ * It also includes features for handling empty states and custom rendering of items.
8
+ * This component is useful for scenarios where users need to manage selections from a larger set of options, such as in forms or settings.
9
+ */
10
+ export declare function DualList<T extends AnyObject = string>(props: DualSelectProps<T> & {
8
11
  height?: string | number;
9
- /**
10
- * list options
11
- */
12
- options: T[];
13
- /**
14
- * selected value
15
- */
16
- value?: string[];
17
- /**
18
- * group by property name
19
- */
20
- groupProperty?: keyof T;
21
- /**
22
- * label property name
23
- */
24
- labelProperty?: keyof T;
25
- /**
26
- * value property name
27
- */
28
- valueProperty?: keyof T;
29
- /**
30
- * item renderer
31
- */
32
- renderer?: (option: T) => React.ReactNode;
33
- /**
34
- * change handler
35
- */
36
- onChange?: (value?: string[]) => void;
37
- }
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;
12
+ }): import("react").JSX.Element;
@@ -1,4 +1,9 @@
1
1
  import { type SelectProps } from "../types";
2
- export declare const List: <T extends unknown = string>({ ref, name, value, readOnly, disabled, required, placeholder, autoFocus, options, height, groupProperty, labelProperty, valueProperty, multiple, allowCreate, createOption, matcher, renderer, onQuery, onChange, onSelect, onEnterPressed, invalid, error, allowClear, decorateStart, decorateEnd, "data-inner": isInner, "data-hide-selected": hideSelected, ...rest }: SelectProps<T> & {
2
+ /**
3
+ * List component for selecting items from a list.
4
+ * It supports single and multiple selections, searching, creating new options,
5
+ * and custom rendering of options.
6
+ */
7
+ export declare function List<T extends AnyObject = string>(props: Omit<SelectProps<T>, "defaultOpen" | "hideHandle"> & {
3
8
  height?: string | number;
4
- }) => import("react/jsx-runtime").JSX.Element;
9
+ }): import("react").JSX.Element;
@@ -1,14 +1,15 @@
1
- import { type ReactElement, type ReactNode } from "react";
2
- export declare const Options: ({ ref, style, items, active, className, itemRef, empty, valueProperty, labelProperty, itemProps, children, ...rest }: {
3
- ref: AnyObject;
1
+ export declare function Options({ ref, style, items, active, className, itemRef, empty, info, labelProperty, itemProps, children, onMouseOut, }: {
2
+ ref: React.Ref<HTMLDivElement | null>;
3
+ info?: AnyObject;
4
4
  itemRef: AnyObject;
5
- style?: AnyObject;
5
+ style?: React.CSSProperties;
6
6
  items: AnyObject[];
7
7
  active: number | null;
8
8
  className?: string;
9
- empty?: ReactElement;
9
+ empty?: React.ReactNode;
10
10
  valueProperty?: AnyObject;
11
11
  labelProperty?: AnyObject;
12
+ onMouseOut?: () => void;
12
13
  itemProps: (item: AnyObject) => AnyObject;
13
- children: (item: AnyObject, label: string) => ReactNode;
14
- } & KeyValue) => import("react/jsx-runtime").JSX.Element;
14
+ children: (item: AnyObject, label: string) => React.ReactNode;
15
+ }): import("react").JSX.Element;
@@ -1,2 +1,7 @@
1
- import { type SelectProps } from "../types";
2
- export declare const Select: <T extends unknown = string>({ ref, name, value, invalid, readOnly, disabled, required, placeholder, autoFocus, error, options, groupProperty, labelProperty, valueProperty, multiple, searchable, allowCreate, createOption, matcher, renderer, onQuery, onChange, onSelect, onEnterPressed, ...rest }: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
1
+ import type { SelectProps } from "../types";
2
+ /**
3
+ * Select component for selecting items from a dropdown list.
4
+ * It supports single and multiple selections, searching, creating new options,
5
+ * and custom rendering of options.
6
+ */
7
+ export declare function Select<T extends AnyObject = string>(props: SelectProps<T>): import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
- export declare const makeOption: (query: string) => string;
2
- export declare const getSelectedValue: (value: AnyObject, emptyValue: AnyObject, valueProperty?: AnyObject) => any;
1
+ export declare function makeOption(query: string): string;
2
+ export declare function getSelectedValue(value: AnyObject, emptyValue: string | string[], valueProperty?: string): string | string[];
@@ -1,47 +1,29 @@
1
- /// <reference types="react" />
1
+ import type { SelectProps } from "../types";
2
2
  interface State {
3
3
  multiple: boolean;
4
4
  emptyValue: AnyObject;
5
5
  open: boolean;
6
6
  loading: boolean;
7
7
  activeIndex: number | null;
8
+ activeItem: AnyObject;
8
9
  selectedIndex: number | null;
9
10
  value: AnyObject;
10
11
  query?: string;
11
12
  items: AnyObject[];
12
13
  }
13
- export declare const useSelect: ({ options, value, autoComplete, multiple, allowCreate, groupProperty, valueProperty, labelProperty, createOption, matcher, onQuery, onChange, onSelect, }: {
14
- value?: AnyObject;
15
- options?: AnyObject[];
14
+ export declare function useSelect(props: Omit<SelectProps<AnyObject>, "multiple"> & {
16
15
  multiple?: boolean;
17
- allowCreate?: boolean;
18
- groupProperty?: AnyObject;
19
- valueProperty?: AnyObject;
20
- labelProperty?: AnyObject;
21
16
  autoComplete?: boolean;
22
- matcher?: (item: AnyObject, query: string) => boolean;
23
- createOption?: (query: string) => AnyObject;
24
- onQuery?: (query: string) => AnyObject;
25
- onSelect?: (item: AnyObject) => void;
26
- onChange?: (value: AnyObject) => void;
27
- }) => {
28
- state: State | {
29
- value: any;
30
- activeIndex: null;
31
- selectedIndex: any;
32
- multiple: boolean;
33
- emptyValue: AnyObject;
34
- open: boolean;
35
- loading: boolean;
36
- query?: string | undefined;
37
- items: AnyObject[];
38
- };
39
- listRef: import("react").MutableRefObject<HTMLElement[]>;
40
- focusableRef: import("react").RefObject<HTMLElement>;
41
- listContentRef: import("react").MutableRefObject<any[]>;
17
+ alwaysOpen?: boolean;
18
+ }): {
19
+ state: State;
20
+ listRef: import("react").RefObject<HTMLElement[]>;
21
+ focusableRef: import("react").RefObject<HTMLElement | null>;
22
+ listContentRef: import("react").RefObject<any[]>;
42
23
  handleChange: (value?: AnyObject) => void;
43
24
  handleRemove: (index?: number) => void;
44
25
  handleQuery: (query: string) => void;
26
+ clearActiveIndex: () => void;
45
27
  macthOption: (item: AnyObject, query: string) => boolean;
46
28
  setActiveIndex: (index: number | null) => void;
47
29
  setOpen: (open: boolean) => void;