@true-tech-team/react-components 0.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.
- package/README.md +586 -0
- package/index.css +1 -0
- package/index.d.ts +15 -0
- package/index.js +1 -0
- package/index.mjs +5224 -0
- package/lib/assets/icons/index.d.ts +105 -0
- package/lib/components/buttons/Button/Button.d.ts +49 -0
- package/lib/components/buttons/Button/index.d.ts +3 -0
- package/lib/components/buttons/IconButton/IconButton.d.ts +48 -0
- package/lib/components/buttons/IconButton/index.d.ts +3 -0
- package/lib/components/buttons/index.d.ts +2 -0
- package/lib/components/display/Icon/Icon.d.ts +43 -0
- package/lib/components/display/Icon/index.d.ts +3 -0
- package/lib/components/display/index.d.ts +1 -0
- package/lib/components/forms/FormBuilder/FormBuilder.d.ts +109 -0
- package/lib/components/forms/FormBuilder/hooks/index.d.ts +2 -0
- package/lib/components/forms/FormBuilder/hooks/useFormState.d.ts +5 -0
- package/lib/components/forms/FormBuilder/hooks/useFormValidation.d.ts +11 -0
- package/lib/components/forms/FormBuilder/index.d.ts +4 -0
- package/lib/components/forms/FormBuilder/types.d.ts +193 -0
- package/lib/components/forms/index.d.ts +1 -0
- package/lib/components/index.d.ts +50 -0
- package/lib/components/inputs/Autocomplete/Autocomplete.d.ts +109 -0
- package/lib/components/inputs/Autocomplete/index.d.ts +2 -0
- package/lib/components/inputs/Checkbox/Checkbox.d.ts +85 -0
- package/lib/components/inputs/Checkbox/index.d.ts +2 -0
- package/lib/components/inputs/ColorPicker/ColorPicker.d.ts +82 -0
- package/lib/components/inputs/ColorPicker/index.d.ts +2 -0
- package/lib/components/inputs/DatePicker/DatePicker.d.ts +81 -0
- package/lib/components/inputs/DatePicker/index.d.ts +2 -0
- package/lib/components/inputs/DateRangePicker/DateRangePicker.d.ts +115 -0
- package/lib/components/inputs/DateRangePicker/index.d.ts +2 -0
- package/lib/components/inputs/FilePicker/FilePicker.d.ts +101 -0
- package/lib/components/inputs/FilePicker/index.d.ts +2 -0
- package/lib/components/inputs/Input/Input.d.ts +171 -0
- package/lib/components/inputs/Input/index.d.ts +3 -0
- package/lib/components/inputs/NumberInput/NumberInput.d.ts +18 -0
- package/lib/components/inputs/NumberInput/index.d.ts +2 -0
- package/lib/components/inputs/PhoneInput/PhoneInput.d.ts +87 -0
- package/lib/components/inputs/PhoneInput/index.d.ts +2 -0
- package/lib/components/inputs/Radio/Radio.d.ts +45 -0
- package/lib/components/inputs/Radio/RadioGroup.d.ts +88 -0
- package/lib/components/inputs/Radio/index.d.ts +4 -0
- package/lib/components/inputs/Rating/Rating.d.ts +22 -0
- package/lib/components/inputs/Rating/index.d.ts +2 -0
- package/lib/components/inputs/Select/Select.d.ts +142 -0
- package/lib/components/inputs/Select/index.d.ts +2 -0
- package/lib/components/inputs/Slider/Slider.d.ts +29 -0
- package/lib/components/inputs/Slider/index.d.ts +2 -0
- package/lib/components/inputs/TagInput/TagInput.d.ts +101 -0
- package/lib/components/inputs/TagInput/index.d.ts +2 -0
- package/lib/components/inputs/Textarea/Textarea.d.ts +90 -0
- package/lib/components/inputs/Textarea/index.d.ts +2 -0
- package/lib/components/inputs/Toggle/Toggle.d.ts +69 -0
- package/lib/components/inputs/Toggle/index.d.ts +2 -0
- package/lib/components/inputs/index.d.ts +16 -0
- package/lib/components/overlays/Dropdown/Dropdown.d.ts +84 -0
- package/lib/components/overlays/Dropdown/index.d.ts +2 -0
- package/lib/components/overlays/Menu/Menu.d.ts +70 -0
- package/lib/components/overlays/Menu/MenuContext.d.ts +68 -0
- package/lib/components/overlays/Menu/MenuDivider.d.ts +10 -0
- package/lib/components/overlays/Menu/MenuGroup.d.ts +20 -0
- package/lib/components/overlays/Menu/MenuItem.d.ts +42 -0
- package/lib/components/overlays/Menu/MenuList.d.ts +16 -0
- package/lib/components/overlays/Menu/index.d.ts +12 -0
- package/lib/components/overlays/Popover/Popover.d.ts +74 -0
- package/lib/components/overlays/Popover/index.d.ts +2 -0
- package/lib/components/overlays/Portal/Portal.d.ts +24 -0
- package/lib/components/overlays/Portal/index.d.ts +2 -0
- package/lib/components/overlays/Tooltip/Tooltip.d.ts +51 -0
- package/lib/components/overlays/Tooltip/index.d.ts +2 -0
- package/lib/components/overlays/index.d.ts +5 -0
- package/lib/contexts/ThemeContext/ThemeContext.d.ts +40 -0
- package/lib/contexts/ThemeContext/index.d.ts +2 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/decorators/ComponentDecorator/ComponentDecorator.d.ts +57 -0
- package/lib/decorators/ComponentDecorator/index.d.ts +3 -0
- package/lib/decorators/index.d.ts +2 -0
- package/lib/hooks/index.d.ts +11 -0
- package/lib/hooks/useClickOutside/index.d.ts +1 -0
- package/lib/hooks/useClickOutside/useClickOutside.d.ts +9 -0
- package/lib/hooks/useDebounce/index.d.ts +1 -0
- package/lib/hooks/useDebounce/useDebounce.d.ts +10 -0
- package/lib/hooks/useEscapeKey/index.d.ts +1 -0
- package/lib/hooks/useEscapeKey/useEscapeKey.d.ts +9 -0
- package/lib/hooks/useFocusTrap/index.d.ts +1 -0
- package/lib/hooks/useFocusTrap/useFocusTrap.d.ts +8 -0
- package/lib/hooks/useHover/index.d.ts +2 -0
- package/lib/hooks/useHover/useHover.d.ts +59 -0
- package/lib/hooks/usePopoverPosition/index.d.ts +2 -0
- package/lib/hooks/usePopoverPosition/usePopoverPosition.d.ts +58 -0
- package/lib/hooks/usePortal/index.d.ts +2 -0
- package/lib/hooks/usePortal/usePortal.d.ts +23 -0
- package/lib/hooks/useTheme/index.d.ts +1 -0
- package/lib/providers/GlobalProvider/GlobalProvider.d.ts +56 -0
- package/lib/providers/GlobalProvider/index.d.ts +3 -0
- package/lib/providers/index.d.ts +2 -0
- package/lib/types/component.types.d.ts +129 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/theme.types.d.ts +139 -0
- package/lib/utils/colorUtils.d.ts +71 -0
- package/lib/utils/dateUtils.d.ts +91 -0
- package/lib/utils/dom.d.ts +50 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/positioning.d.ts +59 -0
- package/lib/utils/theme-utils.d.ts +105 -0
- package/lib/utils/validation.d.ts +120 -0
- package/package.json +55 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { IconName } from '../../../assets/icons';
|
|
3
|
+
import { ComponentVariant, ComponentSize, BaseComponentProps } from '../../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Autocomplete option
|
|
6
|
+
*/
|
|
7
|
+
export interface AutocompleteOption {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Autocomplete component props
|
|
15
|
+
*/
|
|
16
|
+
export interface AutocompleteProps extends Omit<BaseComponentProps, 'children'> {
|
|
17
|
+
/**
|
|
18
|
+
* Input variant
|
|
19
|
+
* @default 'primary'
|
|
20
|
+
*/
|
|
21
|
+
variant?: ComponentVariant;
|
|
22
|
+
/**
|
|
23
|
+
* Input size
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: ComponentSize;
|
|
27
|
+
/**
|
|
28
|
+
* Input label
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Input placeholder
|
|
33
|
+
*/
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Available options
|
|
37
|
+
*/
|
|
38
|
+
options: AutocompleteOption[];
|
|
39
|
+
/**
|
|
40
|
+
* Selected value(s) (controlled)
|
|
41
|
+
*/
|
|
42
|
+
value?: string | string[];
|
|
43
|
+
/**
|
|
44
|
+
* Default value (uncontrolled)
|
|
45
|
+
*/
|
|
46
|
+
defaultValue?: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* Selection mode
|
|
49
|
+
* @default 'single'
|
|
50
|
+
*/
|
|
51
|
+
selectionMode?: 'single' | 'multi';
|
|
52
|
+
/**
|
|
53
|
+
* Callback when selection changes
|
|
54
|
+
*/
|
|
55
|
+
onChange?: (value: string | string[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Callback when input value changes
|
|
58
|
+
*/
|
|
59
|
+
onInputChange?: (value: string) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Custom filter function
|
|
62
|
+
* @default case-insensitive includes
|
|
63
|
+
*/
|
|
64
|
+
filterFunction?: (option: AutocompleteOption, inputValue: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Async data loading function
|
|
67
|
+
*/
|
|
68
|
+
onLoadOptions?: (inputValue: string) => Promise<AutocompleteOption[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Debounce delay for async loading (ms)
|
|
71
|
+
* @default 300
|
|
72
|
+
*/
|
|
73
|
+
debounceDelay?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Loading state
|
|
76
|
+
*/
|
|
77
|
+
loading?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* No options message
|
|
80
|
+
* @default 'No options'
|
|
81
|
+
*/
|
|
82
|
+
noOptionsMessage?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Highlight matching text
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
highlightMatch?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Start icon
|
|
90
|
+
*/
|
|
91
|
+
startIcon?: ReactNode | IconName;
|
|
92
|
+
/**
|
|
93
|
+
* Disabled state
|
|
94
|
+
*/
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Error state
|
|
98
|
+
*/
|
|
99
|
+
error?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Helper text
|
|
102
|
+
*/
|
|
103
|
+
helperText?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Autocomplete component
|
|
107
|
+
* Filterable input with dropdown menu
|
|
108
|
+
*/
|
|
109
|
+
export declare const Autocomplete: React.FC<AutocompleteProps>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ComponentSize, ComponentVariant, InputBaseProps } from '../../../types';
|
|
3
|
+
import { IconName } from '../../../assets/icons';
|
|
4
|
+
export interface CheckboxProps extends Omit<InputBaseProps, 'value' | 'onChange' | 'placeholder'> {
|
|
5
|
+
/**
|
|
6
|
+
* Checkbox variant style
|
|
7
|
+
* @default 'primary'
|
|
8
|
+
*/
|
|
9
|
+
variant?: ComponentVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Checkbox size
|
|
12
|
+
* @default 'md'
|
|
13
|
+
*/
|
|
14
|
+
size?: ComponentSize;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the checkbox is checked
|
|
17
|
+
*/
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Default checked state for uncontrolled component
|
|
21
|
+
*/
|
|
22
|
+
defaultChecked?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the checkbox is in an indeterminate state
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
indeterminate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Callback fired when the checkbox state changes
|
|
30
|
+
* @param checked - The new checked state
|
|
31
|
+
* @param event - The change event
|
|
32
|
+
*/
|
|
33
|
+
onChange?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Label text to display next to checkbox
|
|
36
|
+
*/
|
|
37
|
+
label?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Label placement relative to checkbox
|
|
40
|
+
* @default 'end'
|
|
41
|
+
*/
|
|
42
|
+
labelPlacement?: 'start' | 'end';
|
|
43
|
+
/**
|
|
44
|
+
* Helper text to display below the checkbox
|
|
45
|
+
*/
|
|
46
|
+
helperText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Error message to display when checkbox is in error state
|
|
49
|
+
*/
|
|
50
|
+
errorMessage?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the checkbox is in an error state
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
error?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Custom check icon
|
|
58
|
+
* Can be icon name (string) or React component
|
|
59
|
+
*/
|
|
60
|
+
checkIcon?: React.ReactNode | IconName;
|
|
61
|
+
/**
|
|
62
|
+
* Custom indeterminate icon
|
|
63
|
+
* Can be icon name (string) or React component
|
|
64
|
+
*/
|
|
65
|
+
indeterminateIcon?: React.ReactNode | IconName;
|
|
66
|
+
/**
|
|
67
|
+
* ID for the input element (also used for label[for])
|
|
68
|
+
* Auto-generated if not provided
|
|
69
|
+
*/
|
|
70
|
+
id?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Checkbox component
|
|
74
|
+
* A checkbox input with support for checked, unchecked, and indeterminate states
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Checkbox
|
|
79
|
+
* label="Accept terms and conditions"
|
|
80
|
+
* checked={accepted}
|
|
81
|
+
* onChange={(checked) => setAccepted(checked)}
|
|
82
|
+
* />
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
4
|
+
export interface ColorPickerProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Controlled color value (hex format)
|
|
7
|
+
*/
|
|
8
|
+
value?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Default color value (hex format)
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when color changes
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (color: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when input loses focus
|
|
19
|
+
*/
|
|
20
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Color format for display and output
|
|
23
|
+
*/
|
|
24
|
+
format?: ColorFormat;
|
|
25
|
+
/**
|
|
26
|
+
* Show alpha channel slider
|
|
27
|
+
*/
|
|
28
|
+
showAlpha?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Show preset color palette
|
|
31
|
+
*/
|
|
32
|
+
showPresets?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Preset colors (hex format)
|
|
35
|
+
*/
|
|
36
|
+
presetColors?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Show color input field
|
|
39
|
+
*/
|
|
40
|
+
showInput?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Show color swatch preview
|
|
43
|
+
*/
|
|
44
|
+
showSwatch?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Input label text
|
|
47
|
+
*/
|
|
48
|
+
label?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Helper text displayed below the input
|
|
51
|
+
*/
|
|
52
|
+
helperText?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Error message (shows when error is true)
|
|
55
|
+
*/
|
|
56
|
+
errorMessage?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the input is in an error state
|
|
59
|
+
*/
|
|
60
|
+
error?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the field is required
|
|
63
|
+
*/
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the input is disabled
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* ColorPicker component with HSL/RGB sliders and color canvas
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <ColorPicker
|
|
76
|
+
* label="Choose Color"
|
|
77
|
+
* defaultValue="#FF5733"
|
|
78
|
+
* onChange={(color) => console.log(color)}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
import { IconName } from '../../../assets/icons';
|
|
4
|
+
export interface DatePickerProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Controlled date value
|
|
7
|
+
*/
|
|
8
|
+
value?: Date | null;
|
|
9
|
+
/**
|
|
10
|
+
* Default date value (uncontrolled)
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: Date | null;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when date changes
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (date: Date | null) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when input loses focus
|
|
19
|
+
*/
|
|
20
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum selectable date
|
|
23
|
+
*/
|
|
24
|
+
minDate?: Date;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum selectable date
|
|
27
|
+
*/
|
|
28
|
+
maxDate?: Date;
|
|
29
|
+
/**
|
|
30
|
+
* Array of disabled dates
|
|
31
|
+
*/
|
|
32
|
+
disabledDates?: Date[];
|
|
33
|
+
/**
|
|
34
|
+
* Date format string
|
|
35
|
+
*/
|
|
36
|
+
format?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Show calendar popup
|
|
39
|
+
*/
|
|
40
|
+
showCalendar?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Show clear button
|
|
43
|
+
*/
|
|
44
|
+
showClearButton?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Start icon (calendar icon by default)
|
|
47
|
+
*/
|
|
48
|
+
startIcon?: React.ReactNode | IconName;
|
|
49
|
+
/**
|
|
50
|
+
* Input label text
|
|
51
|
+
*/
|
|
52
|
+
label?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Helper text displayed below the input
|
|
55
|
+
*/
|
|
56
|
+
helperText?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Error message (shows when error is true)
|
|
59
|
+
*/
|
|
60
|
+
errorMessage?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the input is in an error state
|
|
63
|
+
*/
|
|
64
|
+
error?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the field is required
|
|
67
|
+
*/
|
|
68
|
+
required?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the input is disabled
|
|
71
|
+
*/
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Placeholder text
|
|
75
|
+
*/
|
|
76
|
+
placeholder?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* DatePicker component with custom calendar UI built from scratch
|
|
80
|
+
*/
|
|
81
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface DateRangePreset {
|
|
4
|
+
label: string;
|
|
5
|
+
getValue: () => {
|
|
6
|
+
startDate: Date;
|
|
7
|
+
endDate: Date;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface DateRangePickerProps extends Omit<BaseComponentProps, 'children'> {
|
|
11
|
+
/**
|
|
12
|
+
* Controlled start date value
|
|
13
|
+
*/
|
|
14
|
+
startDate?: Date | null;
|
|
15
|
+
/**
|
|
16
|
+
* Controlled end date value
|
|
17
|
+
*/
|
|
18
|
+
endDate?: Date | null;
|
|
19
|
+
/**
|
|
20
|
+
* Default start date (uncontrolled)
|
|
21
|
+
*/
|
|
22
|
+
defaultStartDate?: Date | null;
|
|
23
|
+
/**
|
|
24
|
+
* Default end date (uncontrolled)
|
|
25
|
+
*/
|
|
26
|
+
defaultEndDate?: Date | null;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when date range changes
|
|
29
|
+
*/
|
|
30
|
+
onChange?: (startDate: Date | null, endDate: Date | null) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when input loses focus
|
|
33
|
+
*/
|
|
34
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Minimum selectable date
|
|
37
|
+
*/
|
|
38
|
+
minDate?: Date;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum selectable date
|
|
41
|
+
*/
|
|
42
|
+
maxDate?: Date;
|
|
43
|
+
/**
|
|
44
|
+
* Minimum number of days in range
|
|
45
|
+
*/
|
|
46
|
+
minDays?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Maximum number of days in range
|
|
49
|
+
*/
|
|
50
|
+
maxDays?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Date format string
|
|
53
|
+
*/
|
|
54
|
+
format?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Separator between start and end dates
|
|
57
|
+
*/
|
|
58
|
+
separator?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Show calendar popup
|
|
61
|
+
*/
|
|
62
|
+
showCalendar?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Show clear button
|
|
65
|
+
*/
|
|
66
|
+
showClearButton?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Show preset ranges
|
|
69
|
+
*/
|
|
70
|
+
showPresets?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Custom preset ranges
|
|
73
|
+
*/
|
|
74
|
+
presets?: DateRangePreset[];
|
|
75
|
+
/**
|
|
76
|
+
* Input label text
|
|
77
|
+
*/
|
|
78
|
+
label?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Helper text displayed below the input
|
|
81
|
+
*/
|
|
82
|
+
helperText?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Error message (shows when error is true)
|
|
85
|
+
*/
|
|
86
|
+
errorMessage?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the input is in an error state
|
|
89
|
+
*/
|
|
90
|
+
error?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the field is required
|
|
93
|
+
*/
|
|
94
|
+
required?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the input is disabled
|
|
97
|
+
*/
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Placeholder text
|
|
101
|
+
*/
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* DateRangePicker component with custom dual calendar UI
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <DateRangePicker
|
|
110
|
+
* label="Select Date Range"
|
|
111
|
+
* onChange={(start, end) => console.log(start, end)}
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare const DateRangePicker: React.ForwardRefExoticComponent<DateRangePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface FileError {
|
|
4
|
+
file: File;
|
|
5
|
+
error: 'size' | 'type' | 'count';
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FilePickerProps extends Omit<BaseComponentProps, 'children'> {
|
|
9
|
+
/**
|
|
10
|
+
* Accepted file types (e.g., "image/*", ".pdf", "image/png,image/jpeg")
|
|
11
|
+
*/
|
|
12
|
+
accept?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Allow multiple file selection
|
|
15
|
+
*/
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum number of files (only applies when multiple is true)
|
|
19
|
+
*/
|
|
20
|
+
maxFiles?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum file size in bytes
|
|
23
|
+
*/
|
|
24
|
+
maxSize?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when files change
|
|
27
|
+
*/
|
|
28
|
+
onChange?: (files: File[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback when file validation error occurs
|
|
31
|
+
*/
|
|
32
|
+
onError?: (errors: FileError[]) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Callback when input loses focus
|
|
35
|
+
*/
|
|
36
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Input label text
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Helper text displayed below the input
|
|
43
|
+
*/
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Error message (shows when error is true)
|
|
47
|
+
*/
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the input is in an error state
|
|
51
|
+
*/
|
|
52
|
+
error?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the field is required
|
|
55
|
+
*/
|
|
56
|
+
required?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the input is disabled
|
|
59
|
+
*/
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Enable drag and drop
|
|
63
|
+
*/
|
|
64
|
+
dragAndDrop?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Show file preview for images
|
|
67
|
+
*/
|
|
68
|
+
showPreview?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Show list of selected files
|
|
71
|
+
*/
|
|
72
|
+
showFileList?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Custom button text
|
|
75
|
+
*/
|
|
76
|
+
buttonText?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Custom dropzone text
|
|
79
|
+
*/
|
|
80
|
+
dropzoneText?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Icon to display in button/dropzone
|
|
83
|
+
*/
|
|
84
|
+
icon?: React.ReactNode;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* FilePicker component with drag & drop and file preview
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <FilePicker
|
|
92
|
+
* label="Upload Files"
|
|
93
|
+
* accept="image/*"
|
|
94
|
+
* multiple
|
|
95
|
+
* dragAndDrop
|
|
96
|
+
* showPreview
|
|
97
|
+
* onChange={(files) => console.log(files)}
|
|
98
|
+
* />
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare const FilePicker: React.ForwardRefExoticComponent<FilePickerProps & React.RefAttributes<HTMLInputElement>>;
|