zenput 1.0.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 +271 -0
- package/dist/cjs/index.js +1126 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/AutoComplete/AutoComplete.d.ts +3 -0
- package/dist/cjs/types/components/AutoComplete/AutoComplete.types.d.ts +27 -0
- package/dist/cjs/types/components/AutoComplete/index.d.ts +2 -0
- package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/cjs/types/components/Checkbox/Checkbox.types.d.ts +6 -0
- package/dist/cjs/types/components/Checkbox/index.d.ts +2 -0
- package/dist/cjs/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -0
- package/dist/cjs/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +20 -0
- package/dist/cjs/types/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/cjs/types/components/ColorInput/ColorInput.d.ts +3 -0
- package/dist/cjs/types/components/ColorInput/ColorInput.types.d.ts +6 -0
- package/dist/cjs/types/components/ColorInput/index.d.ts +2 -0
- package/dist/cjs/types/components/DataTable/DataTable.d.ts +5 -0
- package/dist/cjs/types/components/DataTable/DataTable.types.d.ts +31 -0
- package/dist/cjs/types/components/DataTable/index.d.ts +2 -0
- package/dist/cjs/types/components/DateInput/DateInput.d.ts +3 -0
- package/dist/cjs/types/components/DateInput/DateInput.types.d.ts +8 -0
- package/dist/cjs/types/components/DateInput/index.d.ts +2 -0
- package/dist/cjs/types/components/FileInput/FileInput.d.ts +3 -0
- package/dist/cjs/types/components/FileInput/FileInput.types.d.ts +10 -0
- package/dist/cjs/types/components/FileInput/index.d.ts +2 -0
- package/dist/cjs/types/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/cjs/types/components/NumberInput/NumberInput.types.d.ts +18 -0
- package/dist/cjs/types/components/NumberInput/index.d.ts +2 -0
- package/dist/cjs/types/components/OTPInput/OTPInput.d.ts +3 -0
- package/dist/cjs/types/components/OTPInput/OTPInput.types.d.ts +20 -0
- package/dist/cjs/types/components/OTPInput/index.d.ts +2 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.types.d.ts +10 -0
- package/dist/cjs/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/cjs/types/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/cjs/types/components/PhoneInput/PhoneInput.types.d.ts +20 -0
- package/dist/cjs/types/components/PhoneInput/index.d.ts +2 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.types.d.ts +22 -0
- package/dist/cjs/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/cjs/types/components/RangeInput/RangeInput.d.ts +3 -0
- package/dist/cjs/types/components/RangeInput/RangeInput.types.d.ts +14 -0
- package/dist/cjs/types/components/RangeInput/index.d.ts +2 -0
- package/dist/cjs/types/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/cjs/types/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/cjs/types/components/SearchInput/index.d.ts +2 -0
- package/dist/cjs/types/components/SelectInput/SelectInput.d.ts +3 -0
- package/dist/cjs/types/components/SelectInput/SelectInput.types.d.ts +13 -0
- package/dist/cjs/types/components/SelectInput/index.d.ts +2 -0
- package/dist/cjs/types/components/TextArea/TextArea.d.ts +3 -0
- package/dist/cjs/types/components/TextArea/TextArea.types.d.ts +8 -0
- package/dist/cjs/types/components/TextArea/index.d.ts +2 -0
- package/dist/cjs/types/components/TextInput/TextInput.d.ts +3 -0
- package/dist/cjs/types/components/TextInput/TextInput.types.d.ts +4 -0
- package/dist/cjs/types/components/TextInput/index.d.ts +2 -0
- package/dist/cjs/types/components/TimeInput/TimeInput.d.ts +3 -0
- package/dist/cjs/types/components/TimeInput/TimeInput.types.d.ts +8 -0
- package/dist/cjs/types/components/TimeInput/index.d.ts +2 -0
- package/dist/cjs/types/components/Toggle/Toggle.d.ts +3 -0
- package/dist/cjs/types/components/Toggle/Toggle.types.d.ts +6 -0
- package/dist/cjs/types/components/Toggle/index.d.ts +2 -0
- package/dist/cjs/types/components/index.d.ts +19 -0
- package/dist/cjs/types/context/ThemeProvider.d.ts +27 -0
- package/dist/cjs/types/context/index.d.ts +1 -0
- package/dist/cjs/types/hooks/index.d.ts +2 -0
- package/dist/cjs/types/hooks/useControllable.d.ts +7 -0
- package/dist/cjs/types/hooks/useFormField.d.ts +25 -0
- package/dist/cjs/types/index.d.ts +4 -0
- package/dist/cjs/types/types/common.d.ts +52 -0
- package/dist/cjs/types/types/index.d.ts +1 -0
- package/dist/cjs/types/utils/classNames.d.ts +3 -0
- package/dist/cjs/types/utils/constants.d.ts +9 -0
- package/dist/cjs/types/utils/index.d.ts +3 -0
- package/dist/cjs/types/utils/validation.d.ts +23 -0
- package/dist/esm/index.js +1102 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/AutoComplete/AutoComplete.d.ts +3 -0
- package/dist/esm/types/components/AutoComplete/AutoComplete.types.d.ts +27 -0
- package/dist/esm/types/components/AutoComplete/index.d.ts +2 -0
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/esm/types/components/Checkbox/Checkbox.types.d.ts +6 -0
- package/dist/esm/types/components/Checkbox/index.d.ts +2 -0
- package/dist/esm/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -0
- package/dist/esm/types/components/CheckboxGroup/CheckboxGroup.types.d.ts +20 -0
- package/dist/esm/types/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/esm/types/components/ColorInput/ColorInput.d.ts +3 -0
- package/dist/esm/types/components/ColorInput/ColorInput.types.d.ts +6 -0
- package/dist/esm/types/components/ColorInput/index.d.ts +2 -0
- package/dist/esm/types/components/DataTable/DataTable.d.ts +5 -0
- package/dist/esm/types/components/DataTable/DataTable.types.d.ts +31 -0
- package/dist/esm/types/components/DataTable/index.d.ts +2 -0
- package/dist/esm/types/components/DateInput/DateInput.d.ts +3 -0
- package/dist/esm/types/components/DateInput/DateInput.types.d.ts +8 -0
- package/dist/esm/types/components/DateInput/index.d.ts +2 -0
- package/dist/esm/types/components/FileInput/FileInput.d.ts +3 -0
- package/dist/esm/types/components/FileInput/FileInput.types.d.ts +10 -0
- package/dist/esm/types/components/FileInput/index.d.ts +2 -0
- package/dist/esm/types/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/esm/types/components/NumberInput/NumberInput.types.d.ts +18 -0
- package/dist/esm/types/components/NumberInput/index.d.ts +2 -0
- package/dist/esm/types/components/OTPInput/OTPInput.d.ts +3 -0
- package/dist/esm/types/components/OTPInput/OTPInput.types.d.ts +20 -0
- package/dist/esm/types/components/OTPInput/index.d.ts +2 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.d.ts +3 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.types.d.ts +10 -0
- package/dist/esm/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/esm/types/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/esm/types/components/PhoneInput/PhoneInput.types.d.ts +20 -0
- package/dist/esm/types/components/PhoneInput/index.d.ts +2 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.types.d.ts +22 -0
- package/dist/esm/types/components/RadioGroup/index.d.ts +2 -0
- package/dist/esm/types/components/RangeInput/RangeInput.d.ts +3 -0
- package/dist/esm/types/components/RangeInput/RangeInput.types.d.ts +14 -0
- package/dist/esm/types/components/RangeInput/index.d.ts +2 -0
- package/dist/esm/types/components/SearchInput/SearchInput.d.ts +3 -0
- package/dist/esm/types/components/SearchInput/SearchInput.types.d.ts +10 -0
- package/dist/esm/types/components/SearchInput/index.d.ts +2 -0
- package/dist/esm/types/components/SelectInput/SelectInput.d.ts +3 -0
- package/dist/esm/types/components/SelectInput/SelectInput.types.d.ts +13 -0
- package/dist/esm/types/components/SelectInput/index.d.ts +2 -0
- package/dist/esm/types/components/TextArea/TextArea.d.ts +3 -0
- package/dist/esm/types/components/TextArea/TextArea.types.d.ts +8 -0
- package/dist/esm/types/components/TextArea/index.d.ts +2 -0
- package/dist/esm/types/components/TextInput/TextInput.d.ts +3 -0
- package/dist/esm/types/components/TextInput/TextInput.types.d.ts +4 -0
- package/dist/esm/types/components/TextInput/index.d.ts +2 -0
- package/dist/esm/types/components/TimeInput/TimeInput.d.ts +3 -0
- package/dist/esm/types/components/TimeInput/TimeInput.types.d.ts +8 -0
- package/dist/esm/types/components/TimeInput/index.d.ts +2 -0
- package/dist/esm/types/components/Toggle/Toggle.d.ts +3 -0
- package/dist/esm/types/components/Toggle/Toggle.types.d.ts +6 -0
- package/dist/esm/types/components/Toggle/index.d.ts +2 -0
- package/dist/esm/types/components/index.d.ts +19 -0
- package/dist/esm/types/context/ThemeProvider.d.ts +27 -0
- package/dist/esm/types/context/index.d.ts +1 -0
- package/dist/esm/types/hooks/index.d.ts +2 -0
- package/dist/esm/types/hooks/useControllable.d.ts +7 -0
- package/dist/esm/types/hooks/useFormField.d.ts +25 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/esm/types/types/common.d.ts +52 -0
- package/dist/esm/types/types/index.d.ts +1 -0
- package/dist/esm/types/utils/classNames.d.ts +3 -0
- package/dist/esm/types/utils/constants.d.ts +9 -0
- package/dist/esm/types/utils/index.d.ts +3 -0
- package/dist/esm/types/utils/validation.d.ts +23 -0
- package/dist/index.d.ts +401 -0
- package/package.json +69 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
type InputSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
type InputVariant = 'outlined' | 'filled' | 'underlined';
|
|
6
|
+
type ValidationState = 'default' | 'error' | 'success' | 'warning';
|
|
7
|
+
interface BaseInputProps {
|
|
8
|
+
/** Visual size of the input */
|
|
9
|
+
size?: InputSize;
|
|
10
|
+
/** Visual variant/style */
|
|
11
|
+
variant?: InputVariant;
|
|
12
|
+
/** Validation state */
|
|
13
|
+
validationState?: ValidationState;
|
|
14
|
+
/** Label text */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** Helper text displayed below the input */
|
|
17
|
+
helperText?: string;
|
|
18
|
+
/** Error message (shown when validationState is 'error') */
|
|
19
|
+
errorMessage?: string;
|
|
20
|
+
/** Success message */
|
|
21
|
+
successMessage?: string;
|
|
22
|
+
/** Warning message */
|
|
23
|
+
warningMessage?: string;
|
|
24
|
+
/** Whether the field is required */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Whether the field is disabled */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Whether the field is read-only */
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
/** Prefix icon/element */
|
|
31
|
+
prefixIcon?: React.ReactNode;
|
|
32
|
+
/** Suffix icon/element */
|
|
33
|
+
suffixIcon?: React.ReactNode;
|
|
34
|
+
/** Whether to show the label as floating */
|
|
35
|
+
floatingLabel?: boolean;
|
|
36
|
+
/** Full width mode */
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
/** Custom className for the wrapper element */
|
|
39
|
+
wrapperClassName?: string;
|
|
40
|
+
/** Custom style for the wrapper element */
|
|
41
|
+
wrapperStyle?: React.CSSProperties;
|
|
42
|
+
/** Custom className for the label element */
|
|
43
|
+
labelClassName?: string;
|
|
44
|
+
/** Custom style for the label element */
|
|
45
|
+
labelStyle?: React.CSSProperties;
|
|
46
|
+
/** Custom className for the input element */
|
|
47
|
+
inputClassName?: string;
|
|
48
|
+
/** Custom style for the input element */
|
|
49
|
+
inputStyle?: React.CSSProperties;
|
|
50
|
+
/** Custom className for the helper text element */
|
|
51
|
+
helperTextClassName?: string;
|
|
52
|
+
/** Custom style for the helper text element */
|
|
53
|
+
helperTextStyle?: React.CSSProperties;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>, BaseInputProps {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
60
|
+
|
|
61
|
+
interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>, BaseInputProps {
|
|
62
|
+
/** Auto resize to fit content */
|
|
63
|
+
autoResize?: boolean;
|
|
64
|
+
/** Show character count */
|
|
65
|
+
showCharCount?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
69
|
+
|
|
70
|
+
interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'onChange'>, BaseInputProps {
|
|
71
|
+
/** Current value */
|
|
72
|
+
value?: number;
|
|
73
|
+
/** Default value */
|
|
74
|
+
defaultValue?: number;
|
|
75
|
+
/** Minimum value */
|
|
76
|
+
min?: number;
|
|
77
|
+
/** Maximum value */
|
|
78
|
+
max?: number;
|
|
79
|
+
/** Step increment */
|
|
80
|
+
step?: number;
|
|
81
|
+
/** Hide the increment/decrement buttons */
|
|
82
|
+
hideControls?: boolean;
|
|
83
|
+
/** Called when the value changes */
|
|
84
|
+
onChange?: (value: number | undefined) => void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
88
|
+
|
|
89
|
+
interface PasswordInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
90
|
+
/** Show a password strength indicator */
|
|
91
|
+
showStrengthIndicator?: boolean;
|
|
92
|
+
/** Custom toggle visibility icon when password is visible */
|
|
93
|
+
showIcon?: React.ReactNode;
|
|
94
|
+
/** Custom toggle visibility icon when password is hidden */
|
|
95
|
+
hideIcon?: React.ReactNode;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
99
|
+
|
|
100
|
+
interface SelectOption {
|
|
101
|
+
value: string;
|
|
102
|
+
label: string;
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface SelectInputProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'>, BaseInputProps {
|
|
106
|
+
/** List of options */
|
|
107
|
+
options: SelectOption[];
|
|
108
|
+
/** Placeholder text shown as first disabled option */
|
|
109
|
+
placeholder?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare const SelectInput: React.ForwardRefExoticComponent<SelectInputProps & React.RefAttributes<HTMLSelectElement>>;
|
|
113
|
+
|
|
114
|
+
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, Pick<BaseInputProps, 'size' | 'validationState' | 'label' | 'helperText' | 'errorMessage' | 'required' | 'disabled' | 'wrapperClassName' | 'wrapperStyle' | 'labelClassName' | 'labelStyle' | 'inputClassName' | 'inputStyle' | 'helperTextClassName' | 'helperTextStyle'> {
|
|
115
|
+
/** Whether the checkbox is indeterminate */
|
|
116
|
+
indeterminate?: boolean;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
120
|
+
|
|
121
|
+
interface CheckboxOption {
|
|
122
|
+
value: string;
|
|
123
|
+
label: string;
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface CheckboxGroupProps extends Pick<BaseInputProps, 'size' | 'validationState' | 'label' | 'helperText' | 'errorMessage' | 'required' | 'disabled' | 'wrapperClassName' | 'wrapperStyle' | 'labelClassName' | 'labelStyle' | 'helperTextClassName' | 'helperTextStyle'> {
|
|
127
|
+
/** List of checkbox options */
|
|
128
|
+
options: CheckboxOption[];
|
|
129
|
+
/** Currently selected values (controlled) */
|
|
130
|
+
value?: string[];
|
|
131
|
+
/** Default selected values (uncontrolled) */
|
|
132
|
+
defaultValue?: string[];
|
|
133
|
+
/** Called when selection changes */
|
|
134
|
+
onChange?: (values: string[]) => void;
|
|
135
|
+
/** Layout direction */
|
|
136
|
+
direction?: 'horizontal' | 'vertical';
|
|
137
|
+
/** id for the group */
|
|
138
|
+
id?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
142
|
+
|
|
143
|
+
interface RadioOption {
|
|
144
|
+
value: string;
|
|
145
|
+
label: string;
|
|
146
|
+
disabled?: boolean;
|
|
147
|
+
}
|
|
148
|
+
interface RadioGroupProps extends Pick<BaseInputProps, 'size' | 'validationState' | 'label' | 'helperText' | 'errorMessage' | 'required' | 'disabled' | 'wrapperClassName' | 'wrapperStyle' | 'labelClassName' | 'labelStyle' | 'helperTextClassName' | 'helperTextStyle'> {
|
|
149
|
+
/** Name attribute for radio inputs */
|
|
150
|
+
name: string;
|
|
151
|
+
/** List of radio options */
|
|
152
|
+
options: RadioOption[];
|
|
153
|
+
/** Currently selected value (controlled) */
|
|
154
|
+
value?: string;
|
|
155
|
+
/** Default selected value (uncontrolled) */
|
|
156
|
+
defaultValue?: string;
|
|
157
|
+
/** Called when selection changes */
|
|
158
|
+
onChange?: (value: string) => void;
|
|
159
|
+
/** Layout direction */
|
|
160
|
+
direction?: 'horizontal' | 'vertical';
|
|
161
|
+
/** id for the group */
|
|
162
|
+
id?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
166
|
+
|
|
167
|
+
interface ToggleProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, Pick<BaseInputProps, 'size' | 'validationState' | 'label' | 'helperText' | 'errorMessage' | 'required' | 'disabled' | 'wrapperClassName' | 'wrapperStyle' | 'labelClassName' | 'labelStyle' | 'inputClassName' | 'inputStyle' | 'helperTextClassName' | 'helperTextStyle'> {
|
|
168
|
+
/** Label position relative to the toggle */
|
|
169
|
+
labelPosition?: 'left' | 'right';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
|
|
173
|
+
|
|
174
|
+
interface DateInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
175
|
+
/** Minimum date (YYYY-MM-DD) */
|
|
176
|
+
min?: string;
|
|
177
|
+
/** Maximum date (YYYY-MM-DD) */
|
|
178
|
+
max?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
182
|
+
|
|
183
|
+
interface TimeInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
184
|
+
/** Minimum time (HH:mm) */
|
|
185
|
+
min?: string;
|
|
186
|
+
/** Maximum time (HH:mm) */
|
|
187
|
+
max?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare const TimeInput: React.ForwardRefExoticComponent<TimeInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
191
|
+
|
|
192
|
+
interface FileInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
193
|
+
/** Button label text */
|
|
194
|
+
buttonLabel?: string;
|
|
195
|
+
/** Show selected file names */
|
|
196
|
+
showFileNames?: boolean;
|
|
197
|
+
/** Allow drag-and-drop */
|
|
198
|
+
dropzone?: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
declare const FileInput: React.ForwardRefExoticComponent<FileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
202
|
+
|
|
203
|
+
interface RangeInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
204
|
+
/** Minimum value */
|
|
205
|
+
min?: number;
|
|
206
|
+
/** Maximum value */
|
|
207
|
+
max?: number;
|
|
208
|
+
/** Step increment */
|
|
209
|
+
step?: number;
|
|
210
|
+
/** Show the current numeric value */
|
|
211
|
+
showValue?: boolean;
|
|
212
|
+
/** Format the displayed value */
|
|
213
|
+
formatValue?: (value: number) => string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare const RangeInput: React.ForwardRefExoticComponent<RangeInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
217
|
+
|
|
218
|
+
interface ColorInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
219
|
+
/** Show the hex value text next to the color picker */
|
|
220
|
+
showHexValue?: boolean;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare const ColorInput: React.ForwardRefExoticComponent<ColorInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
224
|
+
|
|
225
|
+
interface SearchInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'>, BaseInputProps {
|
|
226
|
+
/** Called when the user submits the search (Enter key or search button click) */
|
|
227
|
+
onSearch?: (value: string) => void;
|
|
228
|
+
/** Show a clear button when there is a value */
|
|
229
|
+
showClearButton?: boolean;
|
|
230
|
+
/** Whether to show a search icon */
|
|
231
|
+
showSearchIcon?: boolean;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
235
|
+
|
|
236
|
+
interface CountryCode {
|
|
237
|
+
code: string;
|
|
238
|
+
dialCode: string;
|
|
239
|
+
flag: string;
|
|
240
|
+
name: string;
|
|
241
|
+
}
|
|
242
|
+
interface PhoneInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'onChange'>, BaseInputProps {
|
|
243
|
+
/** Selected dial code (e.g. "+1") */
|
|
244
|
+
dialCode?: string;
|
|
245
|
+
/** Default dial code */
|
|
246
|
+
defaultDialCode?: string;
|
|
247
|
+
/** List of country codes to show */
|
|
248
|
+
countries?: CountryCode[];
|
|
249
|
+
/** Called when the full phone value changes */
|
|
250
|
+
onChange?: (phoneNumber: string, dialCode: string) => void;
|
|
251
|
+
/** Current phone number value (without dial code) */
|
|
252
|
+
phoneValue?: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
256
|
+
|
|
257
|
+
type OTPInputType = 'numeric' | 'alphanumeric';
|
|
258
|
+
interface OTPInputProps extends Pick<BaseInputProps, 'size' | 'validationState' | 'label' | 'helperText' | 'errorMessage' | 'required' | 'disabled' | 'wrapperClassName' | 'wrapperStyle' | 'labelClassName' | 'labelStyle' | 'helperTextClassName' | 'helperTextStyle'> {
|
|
259
|
+
/** Number of OTP digits */
|
|
260
|
+
length?: number;
|
|
261
|
+
/** Current value */
|
|
262
|
+
value?: string;
|
|
263
|
+
/** Default value */
|
|
264
|
+
defaultValue?: string;
|
|
265
|
+
/** Called when the OTP value changes */
|
|
266
|
+
onChange?: (value: string) => void;
|
|
267
|
+
/** Called when all digits are filled */
|
|
268
|
+
onComplete?: (value: string) => void;
|
|
269
|
+
/** Input type restriction */
|
|
270
|
+
inputType?: OTPInputType;
|
|
271
|
+
/** Mask the input like a password */
|
|
272
|
+
mask?: boolean;
|
|
273
|
+
/** id prefix */
|
|
274
|
+
id?: string;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare const OTPInput: React.ForwardRefExoticComponent<OTPInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
278
|
+
|
|
279
|
+
interface AutoCompleteOption {
|
|
280
|
+
value: string;
|
|
281
|
+
label: string;
|
|
282
|
+
disabled?: boolean;
|
|
283
|
+
}
|
|
284
|
+
interface AutoCompleteProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'onSelect'>, BaseInputProps {
|
|
285
|
+
/** List of options to display */
|
|
286
|
+
options: AutoCompleteOption[];
|
|
287
|
+
/** Currently selected value (controlled) */
|
|
288
|
+
value?: string;
|
|
289
|
+
/** Default value */
|
|
290
|
+
defaultValue?: string;
|
|
291
|
+
/** Called when the input value changes */
|
|
292
|
+
onChange?: (value: string) => void;
|
|
293
|
+
/** Called when an option is selected */
|
|
294
|
+
onSelect?: (option: AutoCompleteOption) => void;
|
|
295
|
+
/** Called when the user types (for async search) */
|
|
296
|
+
onSearch?: (query: string) => void;
|
|
297
|
+
/** Whether the dropdown is in a loading state */
|
|
298
|
+
loading?: boolean;
|
|
299
|
+
/** Message shown when no options match */
|
|
300
|
+
noOptionsMessage?: string;
|
|
301
|
+
/** Allow entering a custom value not in the options list */
|
|
302
|
+
allowCustomValue?: boolean;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare const AutoComplete: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<HTMLInputElement>>;
|
|
306
|
+
|
|
307
|
+
type DataTableRecord = Record<string, any>;
|
|
308
|
+
interface DataTableColumn<T extends DataTableRecord = DataTableRecord> {
|
|
309
|
+
/** Unique key that maps to a field in the row data */
|
|
310
|
+
key: string;
|
|
311
|
+
/** Text displayed in the column header */
|
|
312
|
+
header: string;
|
|
313
|
+
/** Whether this column supports checkbox-based filtering */
|
|
314
|
+
filterable?: boolean;
|
|
315
|
+
/** Custom cell renderer; receives the raw cell value and the full row */
|
|
316
|
+
render?: (value: unknown, row: T) => React.ReactNode;
|
|
317
|
+
/** Optional column width (e.g. '150px' or '20%') */
|
|
318
|
+
width?: string | number;
|
|
319
|
+
}
|
|
320
|
+
interface DataTableProps<T extends DataTableRecord = DataTableRecord> {
|
|
321
|
+
/** Column definitions */
|
|
322
|
+
columns: DataTableColumn<T>[];
|
|
323
|
+
/** Row data */
|
|
324
|
+
data: T[];
|
|
325
|
+
/**
|
|
326
|
+
* Returns a stable, unique key for each row.
|
|
327
|
+
* When omitted the row's array index is used as a fallback.
|
|
328
|
+
*/
|
|
329
|
+
rowKey?: (row: T, index: number) => string | number;
|
|
330
|
+
/** Additional CSS class applied to the outermost wrapper */
|
|
331
|
+
className?: string;
|
|
332
|
+
/** Additional inline style applied to the outermost wrapper */
|
|
333
|
+
style?: React.CSSProperties;
|
|
334
|
+
/** Message displayed when data array is empty or all rows are filtered out */
|
|
335
|
+
emptyMessage?: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
declare function DataTable<T extends DataTableRecord = DataTableRecord>({ columns, data, rowKey, className, style, emptyMessage, }: Readonly<DataTableProps<T>>): react_jsx_runtime.JSX.Element;
|
|
339
|
+
declare namespace DataTable {
|
|
340
|
+
var displayName: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
interface UseFormFieldOptions {
|
|
344
|
+
id?: string;
|
|
345
|
+
label?: string;
|
|
346
|
+
helperText?: string;
|
|
347
|
+
errorMessage?: string;
|
|
348
|
+
validationState?: ValidationState;
|
|
349
|
+
required?: boolean;
|
|
350
|
+
disabled?: boolean;
|
|
351
|
+
}
|
|
352
|
+
interface UseFormFieldResult {
|
|
353
|
+
inputId: string;
|
|
354
|
+
helperId: string;
|
|
355
|
+
labelProps: {
|
|
356
|
+
htmlFor: string;
|
|
357
|
+
};
|
|
358
|
+
inputAriaProps: {
|
|
359
|
+
'aria-describedby'?: string;
|
|
360
|
+
'aria-invalid'?: boolean;
|
|
361
|
+
'aria-required'?: boolean;
|
|
362
|
+
'aria-disabled'?: boolean;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
declare function useFormField({ id, helperText, errorMessage, validationState, required, disabled, }: UseFormFieldOptions): UseFormFieldResult;
|
|
366
|
+
|
|
367
|
+
type UseControllableOptions<T> = {
|
|
368
|
+
value?: T;
|
|
369
|
+
defaultValue?: T;
|
|
370
|
+
onChange?: (value: T) => void;
|
|
371
|
+
};
|
|
372
|
+
declare function useControllable<T>({ value, defaultValue, onChange, }: UseControllableOptions<T>): [T | undefined, (newValue: T) => void];
|
|
373
|
+
|
|
374
|
+
interface Theme {
|
|
375
|
+
primaryColor?: string;
|
|
376
|
+
errorColor?: string;
|
|
377
|
+
successColor?: string;
|
|
378
|
+
warningColor?: string;
|
|
379
|
+
borderRadius?: string;
|
|
380
|
+
fontFamily?: string;
|
|
381
|
+
fontSize?: string;
|
|
382
|
+
borderColor?: string;
|
|
383
|
+
bgColor?: string;
|
|
384
|
+
textColor?: string;
|
|
385
|
+
placeholderColor?: string;
|
|
386
|
+
focusRingColor?: string;
|
|
387
|
+
disabledBg?: string;
|
|
388
|
+
disabledText?: string;
|
|
389
|
+
}
|
|
390
|
+
interface ThemeContextValue {
|
|
391
|
+
theme: Theme;
|
|
392
|
+
}
|
|
393
|
+
interface ThemeProviderProps {
|
|
394
|
+
theme: Theme;
|
|
395
|
+
children: React.ReactNode;
|
|
396
|
+
}
|
|
397
|
+
declare function ThemeProvider({ theme, children }: ThemeProviderProps): JSX.Element;
|
|
398
|
+
declare function useTheme(): ThemeContextValue;
|
|
399
|
+
|
|
400
|
+
export { AutoComplete, Checkbox, CheckboxGroup, ColorInput, DataTable, DateInput, FileInput, NumberInput, OTPInput, PasswordInput, PhoneInput, RadioGroup, RangeInput, SearchInput, SelectInput, TextArea, TextInput, ThemeProvider, TimeInput, Toggle, useControllable, useFormField, useTheme };
|
|
401
|
+
export type { AutoCompleteOption, AutoCompleteProps, BaseInputProps, CheckboxGroupProps, CheckboxOption, CheckboxProps, ColorInputProps, CountryCode, DataTableColumn, DataTableProps, DataTableRecord, DateInputProps, FileInputProps, InputSize, InputVariant, NumberInputProps, OTPInputProps, OTPInputType, PasswordInputProps, PhoneInputProps, RadioGroupProps, RadioOption, RangeInputProps, SearchInputProps, SelectInputProps, SelectOption, TextAreaProps, TextInputProps, Theme, TimeInputProps, ToggleProps, ValidationState };
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zenput",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Zenput — a production-ready, accessible React TypeScript input components library",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rollup -c",
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"test:coverage": "jest --coverage",
|
|
16
|
+
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
17
|
+
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
|
|
18
|
+
"format": "prettier --write 'src/**/*.{ts,tsx,css}'",
|
|
19
|
+
"type-check": "tsc --noEmit",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": ">=17.0.0",
|
|
24
|
+
"react-dom": ">=17.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
28
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
29
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
30
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
31
|
+
"@testing-library/react": "^14.0.0",
|
|
32
|
+
"@testing-library/user-event": "^14.0.0",
|
|
33
|
+
"@types/react": "^18.2.0",
|
|
34
|
+
"@types/react-dom": "^18.2.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
36
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
37
|
+
"eslint": "^8.0.0",
|
|
38
|
+
"eslint-plugin-react": "^7.0.0",
|
|
39
|
+
"eslint-plugin-react-hooks": "^4.0.0",
|
|
40
|
+
"identity-obj-proxy": "^3.0.0",
|
|
41
|
+
"jest": "^29.0.0",
|
|
42
|
+
"jest-environment-jsdom": "^29.0.0",
|
|
43
|
+
"prettier": "^3.0.0",
|
|
44
|
+
"react": "^18.2.0",
|
|
45
|
+
"react-dom": "^18.2.0",
|
|
46
|
+
"rollup": "^4.0.0",
|
|
47
|
+
"rollup-plugin-dts": "^6.0.0",
|
|
48
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
49
|
+
"rollup-plugin-postcss": "^4.0.0",
|
|
50
|
+
"ts-jest": "^29.0.0",
|
|
51
|
+
"tslib": "^2.8.1",
|
|
52
|
+
"typescript": "^5.3.0"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"react",
|
|
56
|
+
"input",
|
|
57
|
+
"components",
|
|
58
|
+
"typescript",
|
|
59
|
+
"accessible",
|
|
60
|
+
"form",
|
|
61
|
+
"ui"
|
|
62
|
+
],
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/konarsubhojit/zenput"
|
|
67
|
+
},
|
|
68
|
+
"author": "konarsubhojit"
|
|
69
|
+
}
|