@react-fabric/form 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/cjs/builder/FileField.js +131 -0
- package/dist/cjs/builder/FormField.js +119 -0
- package/dist/cjs/form/Controller.js +64 -0
- package/dist/cjs/form/Form.js +128 -0
- package/dist/cjs/hooks/useFileUploader.js +204 -0
- package/dist/cjs/hooks/useFormBuilder.js +87 -0
- package/dist/cjs/i18n/ar.json.js +37 -0
- package/dist/cjs/i18n/en.json.js +38 -0
- package/dist/cjs/i18n/index.js +33 -0
- package/dist/cjs/index.js +56 -0
- package/dist/cjs/input/ArrayInput.js +189 -0
- package/dist/cjs/input/ArrayInput.module.css +1 -0
- package/dist/cjs/input/AvatarInput.js +141 -0
- package/dist/cjs/input/Checkbox.js +83 -0
- package/dist/cjs/input/ColorInput.js +100 -0
- package/dist/cjs/input/ColorPicker.js +122 -0
- package/dist/cjs/input/ColorPicker.module.css +1 -0
- package/dist/cjs/input/Field.js +31 -0
- package/dist/cjs/input/File.js +165 -0
- package/dist/cjs/input/File.module.css +1 -0
- package/dist/cjs/input/Hidden.js +54 -0
- package/dist/cjs/input/Input.js +79 -0
- package/dist/cjs/input/Number.js +80 -0
- package/dist/cjs/input/Password.js +104 -0
- package/dist/cjs/input/Radio.js +70 -0
- package/dist/cjs/input/RadioGroup.js +31 -0
- package/dist/cjs/input/Range.js +169 -0
- package/dist/cjs/input/Search.js +109 -0
- package/dist/cjs/input/Slider.js +172 -0
- package/dist/cjs/input/Switch.js +79 -0
- package/dist/cjs/input/Textarea.js +87 -0
- package/dist/cjs/internal/ErrorIcon.js +32 -0
- package/dist/cjs/internal/Field.module.css +1 -0
- package/dist/cjs/internal/FieldWrapper.js +78 -0
- package/dist/cjs/internal/InputWrapper.js +113 -0
- package/dist/cjs/ranger/index.js +352 -0
- package/dist/cjs/ranger/utils.js +49 -0
- package/dist/cjs/select/AutoComplete.js +268 -0
- package/dist/cjs/select/DualList.js +238 -0
- package/dist/cjs/select/List.js +241 -0
- package/dist/cjs/select/Options.js +76 -0
- package/dist/cjs/select/Select.js +283 -0
- package/dist/cjs/select/helpers.js +41 -0
- package/dist/cjs/select/useSelect.js +337 -0
- package/dist/cjs/utils/eventHandlers.js +50 -0
- package/dist/cjs/utils/getColor.js +40 -0
- package/dist/esm/builder/FileField.js +131 -0
- package/dist/esm/builder/FormField.js +119 -0
- package/dist/esm/form/Controller.js +64 -0
- package/dist/esm/form/Form.js +128 -0
- package/dist/esm/hooks/useFileUploader.js +204 -0
- package/dist/esm/hooks/useFormBuilder.js +87 -0
- package/dist/esm/i18n/ar.json.js +31 -0
- package/dist/esm/i18n/en.json.js +32 -0
- package/dist/esm/i18n/index.js +33 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/input/ArrayInput.js +189 -0
- package/dist/esm/input/ArrayInput.module.css +1 -0
- package/dist/esm/input/AvatarInput.js +141 -0
- package/dist/esm/input/Checkbox.js +83 -0
- package/dist/esm/input/ColorInput.js +100 -0
- package/dist/esm/input/ColorPicker.js +122 -0
- package/dist/esm/input/ColorPicker.module.css +1 -0
- package/dist/esm/input/Field.js +31 -0
- package/dist/esm/input/File.js +165 -0
- package/dist/esm/input/File.module.css +1 -0
- package/dist/esm/input/Hidden.js +54 -0
- package/dist/esm/input/Input.js +79 -0
- package/dist/esm/input/Number.js +80 -0
- package/dist/esm/input/Password.js +104 -0
- package/dist/esm/input/Radio.js +70 -0
- package/dist/esm/input/RadioGroup.js +31 -0
- package/dist/esm/input/Range.js +169 -0
- package/dist/esm/input/Search.js +109 -0
- package/dist/esm/input/Slider.js +172 -0
- package/dist/esm/input/Switch.js +79 -0
- package/dist/esm/input/Textarea.js +87 -0
- package/dist/esm/internal/ErrorIcon.js +32 -0
- package/dist/esm/internal/Field.module.css +1 -0
- package/dist/esm/internal/FieldWrapper.js +78 -0
- package/dist/esm/internal/InputWrapper.js +113 -0
- package/dist/esm/ranger/index.js +352 -0
- package/dist/esm/ranger/utils.js +47 -0
- package/dist/esm/select/AutoComplete.js +268 -0
- package/dist/esm/select/DualList.js +238 -0
- package/dist/esm/select/List.js +241 -0
- package/dist/esm/select/Options.js +76 -0
- package/dist/esm/select/Select.js +283 -0
- package/dist/esm/select/helpers.js +40 -0
- package/dist/esm/select/useSelect.js +337 -0
- package/dist/esm/utils/eventHandlers.js +50 -0
- package/dist/esm/utils/getColor.js +39 -0
- package/dist/types/builder/FileField.d.ts +8 -0
- package/dist/types/builder/FormField.d.ts +9 -0
- package/dist/types/form/Controller.d.ts +20 -0
- package/dist/types/form/Form.d.ts +33 -0
- package/dist/types/hooks/useFileUploader.d.ts +23 -0
- package/dist/types/hooks/useFormBuilder.d.ts +16 -0
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/input/ArrayInput.d.ts +64 -0
- package/dist/types/input/AvatarInput.d.ts +31 -0
- package/dist/types/input/Checkbox.d.ts +46 -0
- package/dist/types/input/ColorInput.d.ts +10 -0
- package/dist/types/input/ColorPicker.d.ts +24 -0
- package/dist/types/input/Field.d.ts +41 -0
- package/dist/types/input/File.d.ts +17 -0
- package/dist/types/input/Hidden.d.ts +16 -0
- package/dist/types/input/Input.d.ts +9 -0
- package/dist/types/input/Number.d.ts +17 -0
- package/dist/types/input/Password.d.ts +13 -0
- package/dist/types/input/Radio.d.ts +42 -0
- package/dist/types/input/RadioGroup.d.ts +30 -0
- package/dist/types/input/Range.d.ts +59 -0
- package/dist/types/input/Search.d.ts +17 -0
- package/dist/types/input/Slider.d.ts +63 -0
- package/dist/types/input/Switch.d.ts +42 -0
- package/dist/types/input/Textarea.d.ts +17 -0
- package/dist/types/internal/ErrorIcon.d.ts +1 -0
- package/dist/types/internal/FieldWrapper.d.ts +1 -0
- package/dist/types/internal/InputWrapper.d.ts +1 -0
- package/dist/types/ranger/index.d.ts +70 -0
- package/dist/types/ranger/utils.d.ts +25 -0
- package/dist/types/select/AutoComplete.d.ts +17 -0
- package/dist/types/select/DualList.d.ts +38 -0
- package/dist/types/select/List.d.ts +4 -0
- package/dist/types/select/Options.d.ts +14 -0
- package/dist/types/select/Select.d.ts +2 -0
- package/dist/types/select/helpers.d.ts +2 -0
- package/dist/types/select/useSelect.d.ts +50 -0
- package/dist/types/types/index.d.ts +169 -0
- package/dist/types/types/schema.d.ts +59 -0
- package/dist/types/utils/eventHandlers.d.ts +11 -0
- package/dist/types/utils/getColor.d.ts +4 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +64 -0
- package/src/builder/FileField.tsx +122 -0
- package/src/builder/FormField.tsx +161 -0
- package/src/form/Controller.tsx +103 -0
- package/src/form/Form.tsx +160 -0
- package/src/hooks/useFileUploader.ts +234 -0
- package/src/hooks/useFormBuilder.tsx +128 -0
- package/src/i18n/ar.json +23 -0
- package/src/i18n/en.json +24 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +54 -0
- package/src/input/ArrayInput.module.css +41 -0
- package/src/input/ArrayInput.tsx +318 -0
- package/src/input/AvatarInput.tsx +150 -0
- package/src/input/Checkbox.tsx +165 -0
- package/src/input/ColorInput.tsx +157 -0
- package/src/input/ColorPicker.module.css +51 -0
- package/src/input/ColorPicker.tsx +210 -0
- package/src/input/Field.tsx +96 -0
- package/src/input/File.module.css +42 -0
- package/src/input/File.tsx +224 -0
- package/src/input/Hidden.tsx +65 -0
- package/src/input/Input.tsx +114 -0
- package/src/input/Number.tsx +126 -0
- package/src/input/Password.tsx +150 -0
- package/src/input/Radio.tsx +146 -0
- package/src/input/RadioGroup.tsx +75 -0
- package/src/input/Range.tsx +276 -0
- package/src/input/Search.tsx +160 -0
- package/src/input/Slider.tsx +282 -0
- package/src/input/Switch.tsx +168 -0
- package/src/input/Textarea.tsx +127 -0
- package/src/internal/ErrorIcon.tsx +61 -0
- package/src/internal/Field.module.css +139 -0
- package/src/internal/FieldWrapper.tsx +84 -0
- package/src/internal/InputWrapper.tsx +187 -0
- package/src/ranger/index.tsx +514 -0
- package/src/ranger/utils.ts +48 -0
- package/src/select/AutoComplete.tsx +354 -0
- package/src/select/DualList.tsx +286 -0
- package/src/select/List.tsx +288 -0
- package/src/select/Options.tsx +121 -0
- package/src/select/Select.tsx +350 -0
- package/src/select/helpers.ts +36 -0
- package/src/select/useSelect.tsx +413 -0
- package/src/types/index.ts +203 -0
- package/src/types/schema.ts +100 -0
- package/src/utils/eventHandlers.ts +72 -0
- package/src/utils/getColor.ts +47 -0
- package/src/utils/index.ts +25 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
export interface CheckboxProps extends RefProp<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* checkbox label
|
|
6
|
+
*/
|
|
7
|
+
label?: JSX.Element | string;
|
|
8
|
+
/**
|
|
9
|
+
* checked
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* value
|
|
14
|
+
*/
|
|
15
|
+
value?: string | number;
|
|
16
|
+
/**
|
|
17
|
+
* on checked change
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (checked: boolean | string | number) => void;
|
|
20
|
+
/**
|
|
21
|
+
* disabled input
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* invalid value input
|
|
26
|
+
*/
|
|
27
|
+
invalid?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* error message
|
|
30
|
+
*/
|
|
31
|
+
error?: string;
|
|
32
|
+
/**
|
|
33
|
+
* field width
|
|
34
|
+
*/
|
|
35
|
+
width?: number | string;
|
|
36
|
+
/**
|
|
37
|
+
* cutom checkbox icon
|
|
38
|
+
*/
|
|
39
|
+
icon?: string;
|
|
40
|
+
/**
|
|
41
|
+
* cutom checkbox checked icon
|
|
42
|
+
*/
|
|
43
|
+
iconChecked?: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type InputProps } from "../types";
|
|
3
|
+
import { type ColorProps } from "./ColorPicker";
|
|
4
|
+
export interface ColorInputProps extends InputProps, ColorProps, RefProp {
|
|
5
|
+
/**
|
|
6
|
+
* show eydrop picker
|
|
7
|
+
*/
|
|
8
|
+
showPicker?: boolean;
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
export interface ColorProps {
|
|
3
|
+
/**
|
|
4
|
+
* color swatches
|
|
5
|
+
*/
|
|
6
|
+
swatches?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* default color
|
|
9
|
+
*/
|
|
10
|
+
defaultColor?: string;
|
|
11
|
+
/**
|
|
12
|
+
* hide alpha value
|
|
13
|
+
*/
|
|
14
|
+
hideAlpha?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* color value
|
|
17
|
+
*/
|
|
18
|
+
value?: string;
|
|
19
|
+
/**
|
|
20
|
+
* change handler
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (color?: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const ColorPicker: FC<ColorProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ChildrenProp, type CssProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
export interface FieldProps extends ChildrenProp, CssProp {
|
|
4
|
+
/**
|
|
5
|
+
* input label
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* append to label end
|
|
10
|
+
*/
|
|
11
|
+
appendLabel?: JSX.Element | string | number | boolean;
|
|
12
|
+
/**
|
|
13
|
+
* info label at bottom
|
|
14
|
+
*/
|
|
15
|
+
info?: string;
|
|
16
|
+
/**
|
|
17
|
+
* required
|
|
18
|
+
*/
|
|
19
|
+
required?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* hide outline
|
|
22
|
+
*/
|
|
23
|
+
noOutline?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* field width
|
|
26
|
+
*/
|
|
27
|
+
width?: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* inline label and input
|
|
30
|
+
*/
|
|
31
|
+
inline?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* label width for inline
|
|
34
|
+
*/
|
|
35
|
+
labelWidth?: string;
|
|
36
|
+
/**
|
|
37
|
+
* dont apply bg and outline
|
|
38
|
+
*/
|
|
39
|
+
plain?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const Field: ({ children, noOutline, plain, ...rest }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type InputProps } from "../types";
|
|
3
|
+
export interface FileInputProps extends InputProps<AnyObject>, RefProp<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* allow selecting mutiple files
|
|
6
|
+
*/
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* show selected file list
|
|
10
|
+
*/
|
|
11
|
+
showList?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* acceptable file types
|
|
14
|
+
*/
|
|
15
|
+
accept?: string;
|
|
16
|
+
}
|
|
17
|
+
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/**
|
|
3
|
+
* field name
|
|
4
|
+
*/
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* hidden value will fire change for form update
|
|
8
|
+
*/
|
|
9
|
+
hiddenValue?: AnyObject;
|
|
10
|
+
/**
|
|
11
|
+
* form onChange handler
|
|
12
|
+
*/
|
|
13
|
+
onChange?: (value: AnyObject) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const HiddenInput: ({ hiddenValue, onChange, invalid, error, value, name, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type InputProps } from "../types";
|
|
3
|
+
export interface TextInputProps extends InputProps, RefProp<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* input type
|
|
6
|
+
*/
|
|
7
|
+
type?: "email" | "file" | "search" | "tel" | "text" | "url";
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type InputProps } from "../types";
|
|
3
|
+
export interface NumberProps extends InputProps<number>, RefProp<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* minimum value
|
|
6
|
+
*/
|
|
7
|
+
min?: number;
|
|
8
|
+
/**
|
|
9
|
+
* maximum value
|
|
10
|
+
*/
|
|
11
|
+
max?: number;
|
|
12
|
+
/**
|
|
13
|
+
* increment step
|
|
14
|
+
*/
|
|
15
|
+
step?: number;
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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> {
|
|
4
|
+
/**
|
|
5
|
+
* show password toggle
|
|
6
|
+
*/
|
|
7
|
+
showToggle?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* password strength meter (0-1)
|
|
10
|
+
*/
|
|
11
|
+
strength?: number;
|
|
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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
export interface RadioProps extends RefProp<HTMLInputElement> {
|
|
4
|
+
name?: string;
|
|
5
|
+
/**
|
|
6
|
+
* radio label
|
|
7
|
+
*/
|
|
8
|
+
label?: JSX.Element | string;
|
|
9
|
+
/**
|
|
10
|
+
* value
|
|
11
|
+
*/
|
|
12
|
+
value: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* on checked change
|
|
15
|
+
*/
|
|
16
|
+
onChange?: ((value: string) => void) | ((value: number) => void);
|
|
17
|
+
/**
|
|
18
|
+
* disabled input
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* invalid value input
|
|
23
|
+
*/
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* error message
|
|
27
|
+
*/
|
|
28
|
+
error?: string;
|
|
29
|
+
/**
|
|
30
|
+
* field width
|
|
31
|
+
*/
|
|
32
|
+
width?: number | string;
|
|
33
|
+
/**
|
|
34
|
+
* cutom checkbox icon
|
|
35
|
+
*/
|
|
36
|
+
icon?: string;
|
|
37
|
+
/**
|
|
38
|
+
* cutom checkbox checked icon
|
|
39
|
+
*/
|
|
40
|
+
iconChecked?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare const Radio: ({ ref, name, label, value, invalid, disabled, error, width, icon, iconChecked, onChange, ...rest }: RadioProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type CssProp, type ChildrenProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
import { type Radio } from "./Radio";
|
|
4
|
+
export interface RadioGroupProps extends ChildrenProp<typeof Radio>, CssProp {
|
|
5
|
+
/**
|
|
6
|
+
* input label
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* append to label end
|
|
11
|
+
*/
|
|
12
|
+
appendLabel?: JSX.Element | string | number | boolean;
|
|
13
|
+
/**
|
|
14
|
+
* field info
|
|
15
|
+
*/
|
|
16
|
+
info?: string;
|
|
17
|
+
/**
|
|
18
|
+
* field name
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* vertical orientation
|
|
23
|
+
*/
|
|
24
|
+
vertical?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* change handler
|
|
27
|
+
*/
|
|
28
|
+
onChange?: (value: AnyObject) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const RadioGroup: ({ children, name, className, onChange, ...rest }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type InputProps } from "../types";
|
|
2
|
+
export interface RangeProps extends Omit<InputProps<[number, number]>, "placeholder" | "allowClear" | "children"> {
|
|
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
|
+
* Number Range input
|
|
58
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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> {
|
|
4
|
+
/**
|
|
5
|
+
* is searching
|
|
6
|
+
*/
|
|
7
|
+
searching?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* search on value change
|
|
10
|
+
*/
|
|
11
|
+
searchOnChange?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* search handler
|
|
14
|
+
*/
|
|
15
|
+
onSearch?: (query?: string) => void;
|
|
16
|
+
}
|
|
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;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type InputProps } from "../types";
|
|
2
|
+
export interface SliderProps extends Omit<InputProps<number>, "placeholder" | "allowClear" | "children"> {
|
|
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
|
+
* slider color
|
|
17
|
+
*/
|
|
18
|
+
color?: string;
|
|
19
|
+
/**
|
|
20
|
+
* slider 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
|
+
* infinity max value
|
|
49
|
+
*/
|
|
50
|
+
useInfinity?: true;
|
|
51
|
+
/**
|
|
52
|
+
* format value
|
|
53
|
+
*/
|
|
54
|
+
format?: string;
|
|
55
|
+
/**
|
|
56
|
+
* slide event handler
|
|
57
|
+
*/
|
|
58
|
+
onSlide?: (val: number) => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Number slider input
|
|
62
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ColorType, type RefProp } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
export interface SwitchProps extends RefProp<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Switch label
|
|
6
|
+
*/
|
|
7
|
+
label?: JSX.Element | string;
|
|
8
|
+
/**
|
|
9
|
+
* checked
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* on checked change
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (checked: boolean) => void;
|
|
16
|
+
/**
|
|
17
|
+
* disabled input
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* invalid value input
|
|
22
|
+
*/
|
|
23
|
+
invalid?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* error message
|
|
26
|
+
*/
|
|
27
|
+
error?: string;
|
|
28
|
+
/**
|
|
29
|
+
* field width
|
|
30
|
+
*/
|
|
31
|
+
width?: number | string;
|
|
32
|
+
/**
|
|
33
|
+
* cutom Switch icon
|
|
34
|
+
*/
|
|
35
|
+
color?: ColorType;
|
|
36
|
+
/**
|
|
37
|
+
* cutom Switch icon
|
|
38
|
+
*/
|
|
39
|
+
defaultColor?: ColorType;
|
|
40
|
+
name?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare const Switch: ({ ref, label, checked, invalid, disabled, error, width, color, name, defaultColor, onChange, ...rest }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
2
|
+
import { type InputProps } from "../types";
|
|
3
|
+
export interface TextareaProps extends Omit<InputProps, "onEnterPressed">, RefProp<HTMLTextAreaElement> {
|
|
4
|
+
/**
|
|
5
|
+
* textarae rows
|
|
6
|
+
*/
|
|
7
|
+
rows?: number;
|
|
8
|
+
/**
|
|
9
|
+
* maximum rows
|
|
10
|
+
*/
|
|
11
|
+
maxRows?: number;
|
|
12
|
+
/**
|
|
13
|
+
* increment rows on value change
|
|
14
|
+
*/
|
|
15
|
+
variableRows?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const Textarea: ({ ref, value, name, invalid, readOnly, disabled, required, placeholder, autoFocus, rows, maxRows, variableRows, onChange, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ErrorIcon: ({ error, invalid }: KeyValue) => any;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type KeyboardEvent as KE, type MouseEvent as ME, type TouchEvent as TE } from "react";
|
|
2
|
+
type RangerChangeEvent = (newValue: readonly number[]) => void;
|
|
3
|
+
type RangerConfig = {
|
|
4
|
+
values: readonly number[];
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
tickSize: number;
|
|
8
|
+
ticks?: number[];
|
|
9
|
+
vertical?: boolean;
|
|
10
|
+
onChange: RangerChangeEvent;
|
|
11
|
+
onDrag?: RangerChangeEvent;
|
|
12
|
+
onDragStart?: () => void;
|
|
13
|
+
onDragEnd?: () => void;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
} & ({
|
|
16
|
+
stepSize: number;
|
|
17
|
+
} | {
|
|
18
|
+
steps: number[];
|
|
19
|
+
});
|
|
20
|
+
export declare const useRanger: (opts: RangerConfig) => {
|
|
21
|
+
trackElRef: import("react").RefObject<HTMLDivElement>;
|
|
22
|
+
activeHandleIndex: number | undefined;
|
|
23
|
+
ticks: {
|
|
24
|
+
key: number;
|
|
25
|
+
value: number;
|
|
26
|
+
percentage: number;
|
|
27
|
+
styles: {
|
|
28
|
+
[x: string]: string;
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
segments: {
|
|
32
|
+
key: number;
|
|
33
|
+
value: number;
|
|
34
|
+
active: boolean;
|
|
35
|
+
props: {
|
|
36
|
+
ref: import("react").RefObject<HTMLDivElement>;
|
|
37
|
+
onMouseDownCapture: (e: ME) => void;
|
|
38
|
+
onTouchStartCapture: (e: TE) => void;
|
|
39
|
+
} | {
|
|
40
|
+
ref?: undefined;
|
|
41
|
+
onMouseDownCapture?: undefined;
|
|
42
|
+
onTouchStartCapture?: undefined;
|
|
43
|
+
};
|
|
44
|
+
styles: {
|
|
45
|
+
[x: string]: string;
|
|
46
|
+
};
|
|
47
|
+
}[];
|
|
48
|
+
handles: {
|
|
49
|
+
key: number;
|
|
50
|
+
value: number;
|
|
51
|
+
percentage: number;
|
|
52
|
+
active: boolean;
|
|
53
|
+
props: {
|
|
54
|
+
role: string;
|
|
55
|
+
"aria-valuemin": number;
|
|
56
|
+
"aria-valuemax": number;
|
|
57
|
+
"aria-valuenow": number;
|
|
58
|
+
onKeyDown: (e: KE) => void;
|
|
59
|
+
onMouseDownCapture: (e: ME) => void;
|
|
60
|
+
onTouchStartCapture: (e: TE) => void;
|
|
61
|
+
};
|
|
62
|
+
styles: {
|
|
63
|
+
[x: string]: string;
|
|
64
|
+
};
|
|
65
|
+
valueStyles: {
|
|
66
|
+
[x: string]: string;
|
|
67
|
+
};
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-ranger
|
|
3
|
+
* https://github.com/TanStack/ranger
|
|
4
|
+
*/
|
|
5
|
+
export declare const getBoundingClientRect: (element: any) => {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
right: number;
|
|
9
|
+
width: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const sortNumList: (arr: ReadonlyArray<number | string>) => number[];
|
|
14
|
+
export declare const linearInterpolator: {
|
|
15
|
+
getPercentageForValue: (val: number, min: number, max: number) => number;
|
|
16
|
+
getValueForClientX: (clientX: number, trackDims: {
|
|
17
|
+
width: number;
|
|
18
|
+
left: number;
|
|
19
|
+
right: number;
|
|
20
|
+
}, min: number, max: number, isRtl: boolean) => number;
|
|
21
|
+
getValueForClientY: (clientY: number, trackDims: {
|
|
22
|
+
height: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
}, min: number, max: number) => number;
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type SelectProps } from "../types";
|
|
2
|
+
type AutoCompleteProps = Omit<SelectProps<string>, "options" | "allowCreate" | "createOption"> & {
|
|
3
|
+
/**
|
|
4
|
+
* auto-complete history
|
|
5
|
+
*/
|
|
6
|
+
history?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* expand input on edit
|
|
9
|
+
*/
|
|
10
|
+
expandOnEdit?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* input change handler
|
|
13
|
+
*/
|
|
14
|
+
onInput?: (query: string) => void;
|
|
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;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
*/
|
|
8
|
+
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;
|
|
@@ -0,0 +1,4 @@
|
|
|
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> & {
|
|
3
|
+
height?: string | number;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
4
|
+
itemRef: AnyObject;
|
|
5
|
+
style?: AnyObject;
|
|
6
|
+
items: AnyObject[];
|
|
7
|
+
active: number | null;
|
|
8
|
+
className?: string;
|
|
9
|
+
empty?: ReactElement;
|
|
10
|
+
valueProperty?: AnyObject;
|
|
11
|
+
labelProperty?: AnyObject;
|
|
12
|
+
itemProps: (item: AnyObject) => AnyObject;
|
|
13
|
+
children: (item: AnyObject, label: string) => ReactNode;
|
|
14
|
+
} & KeyValue) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
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;
|