@delightui/components 0.1.76 → 0.1.78

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 (128) hide show
  1. package/dist/cjs/components/atoms/Checkbox/Checkbox.d.ts +2 -8
  2. package/dist/cjs/components/atoms/Checkbox/Checkbox.presenter.d.ts +303 -0
  3. package/dist/cjs/components/atoms/Checkbox/Checkbox.types.d.ts +2 -24
  4. package/dist/cjs/components/atoms/CheckboxItem/CheckboxItem.d.ts +7 -2
  5. package/dist/cjs/components/atoms/CheckboxItem/CheckboxItem.presenter.d.ts +311 -0
  6. package/dist/cjs/components/atoms/CheckboxItem/CheckboxItem.types.d.ts +1 -6
  7. package/dist/cjs/components/atoms/CustomToggle/CustomToggle.d.ts +5 -3
  8. package/dist/cjs/components/atoms/CustomToggle/CustomToggle.presenter.d.ts +16 -0
  9. package/dist/cjs/components/atoms/CustomToggle/CustomToggle.types.d.ts +3 -26
  10. package/dist/cjs/components/atoms/Input/Input.d.ts +2 -7
  11. package/dist/cjs/components/atoms/Input/Input.presenter.d.ts +311 -0
  12. package/dist/cjs/components/atoms/Input/Input.types.d.ts +2 -20
  13. package/dist/cjs/components/atoms/Password/Password.presenter.d.ts +311 -0
  14. package/dist/cjs/components/atoms/RadioButton/RadioButton.d.ts +2 -7
  15. package/dist/cjs/components/atoms/RadioButton/RadioButton.types.d.ts +2 -19
  16. package/dist/cjs/components/atoms/RadioButtonItem/RadioButtonItem.d.ts +5 -2
  17. package/dist/cjs/components/atoms/RadioButtonItem/RadioButtonItem.presenter.d.ts +311 -0
  18. package/dist/cjs/components/atoms/RadioButtonItem/RadioButtonItem.types.d.ts +1 -6
  19. package/dist/cjs/components/atoms/Slider/Slider.d.ts +1 -2
  20. package/dist/cjs/components/atoms/Slider/Slider.presenter.d.ts +289 -0
  21. package/dist/cjs/components/atoms/Slider/Slider.types.d.ts +2 -16
  22. package/dist/cjs/components/atoms/TextArea/TextArea.d.ts +1 -7
  23. package/dist/cjs/components/atoms/TextArea/TextArea.presenter.d.ts +293 -0
  24. package/dist/cjs/components/atoms/TextArea/TextArea.types.d.ts +2 -20
  25. package/dist/cjs/components/atoms/Toggle/Toggle.d.ts +2 -7
  26. package/dist/cjs/components/atoms/Toggle/Toggle.presenter.d.ts +306 -0
  27. package/dist/cjs/components/atoms/Toggle/Toggle.types.d.ts +2 -20
  28. package/dist/cjs/components/atoms/ToggleButton/ToggleButton.d.ts +1 -6
  29. package/dist/cjs/components/atoms/ToggleButton/ToggleButton.presenter.d.ts +281 -0
  30. package/dist/cjs/components/atoms/ToggleButton/ToggleButton.types.d.ts +2 -21
  31. package/dist/cjs/components/molecules/ChipInput/ChipInput.presenter.d.ts +28 -0
  32. package/dist/cjs/components/molecules/ChipInput/ChipInput.types.d.ts +2 -3
  33. package/dist/cjs/components/molecules/DatePicker/DatePicker.d.ts +1 -1
  34. package/dist/cjs/components/molecules/DatePicker/DatePicker.presenter.d.ts +39 -0
  35. package/dist/cjs/components/molecules/DatePicker/DatePicker.types.d.ts +2 -7
  36. package/dist/cjs/components/molecules/FormField/FormField.d.ts +2 -3
  37. package/dist/cjs/components/molecules/FormField/FormField.presenter.d.ts +15 -0
  38. package/dist/cjs/components/molecules/FormField/FormField.types.d.ts +36 -85
  39. package/dist/cjs/components/molecules/FormField/FormField.utils.d.ts +11 -0
  40. package/dist/cjs/components/molecules/FormField/index.d.ts +3 -7
  41. package/dist/cjs/components/molecules/RadioGroup/RadioGroup.d.ts +1 -2
  42. package/dist/cjs/components/molecules/RadioGroup/RadioGroup.presenter.d.ts +9 -0
  43. package/dist/cjs/components/molecules/RadioGroup/RadioGroup.types.d.ts +5 -27
  44. package/dist/cjs/components/molecules/RadioGroup/RadioGroup.utils.d.ts +3 -0
  45. package/dist/cjs/components/molecules/Select/Select.Context.d.ts +1 -1
  46. package/dist/cjs/components/molecules/Select/Select.d.ts +1 -2
  47. package/dist/cjs/components/molecules/Select/Select.presenter.d.ts +292 -0
  48. package/dist/cjs/components/molecules/Select/Select.types.d.ts +4 -25
  49. package/dist/cjs/components/organisms/Dropzone/Dropzone.d.ts +1 -2
  50. package/dist/cjs/components/organisms/Dropzone/Dropzone.presenter.d.ts +19 -0
  51. package/dist/cjs/components/organisms/Dropzone/Dropzone.types.d.ts +2 -7
  52. package/dist/cjs/components/organisms/Form/UpdatedFormExample.d.ts +23 -0
  53. package/dist/cjs/library.css +407 -411
  54. package/dist/cjs/library.js +3 -3
  55. package/dist/cjs/library.js.map +1 -1
  56. package/dist/esm/components/atoms/Checkbox/Checkbox.d.ts +2 -8
  57. package/dist/esm/components/atoms/Checkbox/Checkbox.presenter.d.ts +303 -0
  58. package/dist/esm/components/atoms/Checkbox/Checkbox.types.d.ts +2 -24
  59. package/dist/esm/components/atoms/CheckboxItem/CheckboxItem.d.ts +7 -2
  60. package/dist/esm/components/atoms/CheckboxItem/CheckboxItem.presenter.d.ts +311 -0
  61. package/dist/esm/components/atoms/CheckboxItem/CheckboxItem.types.d.ts +1 -6
  62. package/dist/esm/components/atoms/CustomToggle/CustomToggle.d.ts +5 -3
  63. package/dist/esm/components/atoms/CustomToggle/CustomToggle.presenter.d.ts +16 -0
  64. package/dist/esm/components/atoms/CustomToggle/CustomToggle.types.d.ts +3 -26
  65. package/dist/esm/components/atoms/Input/Input.d.ts +2 -7
  66. package/dist/esm/components/atoms/Input/Input.presenter.d.ts +311 -0
  67. package/dist/esm/components/atoms/Input/Input.types.d.ts +2 -20
  68. package/dist/esm/components/atoms/Password/Password.presenter.d.ts +311 -0
  69. package/dist/esm/components/atoms/RadioButton/RadioButton.d.ts +2 -7
  70. package/dist/esm/components/atoms/RadioButton/RadioButton.types.d.ts +2 -19
  71. package/dist/esm/components/atoms/RadioButtonItem/RadioButtonItem.d.ts +5 -2
  72. package/dist/esm/components/atoms/RadioButtonItem/RadioButtonItem.presenter.d.ts +311 -0
  73. package/dist/esm/components/atoms/RadioButtonItem/RadioButtonItem.types.d.ts +1 -6
  74. package/dist/esm/components/atoms/Slider/Slider.d.ts +1 -2
  75. package/dist/esm/components/atoms/Slider/Slider.presenter.d.ts +289 -0
  76. package/dist/esm/components/atoms/Slider/Slider.types.d.ts +2 -16
  77. package/dist/esm/components/atoms/TextArea/TextArea.d.ts +1 -7
  78. package/dist/esm/components/atoms/TextArea/TextArea.presenter.d.ts +293 -0
  79. package/dist/esm/components/atoms/TextArea/TextArea.types.d.ts +2 -20
  80. package/dist/esm/components/atoms/Toggle/Toggle.d.ts +2 -7
  81. package/dist/esm/components/atoms/Toggle/Toggle.presenter.d.ts +306 -0
  82. package/dist/esm/components/atoms/Toggle/Toggle.types.d.ts +2 -20
  83. package/dist/esm/components/atoms/ToggleButton/ToggleButton.d.ts +1 -6
  84. package/dist/esm/components/atoms/ToggleButton/ToggleButton.presenter.d.ts +281 -0
  85. package/dist/esm/components/atoms/ToggleButton/ToggleButton.types.d.ts +2 -21
  86. package/dist/esm/components/molecules/ChipInput/ChipInput.presenter.d.ts +28 -0
  87. package/dist/esm/components/molecules/ChipInput/ChipInput.types.d.ts +2 -3
  88. package/dist/esm/components/molecules/DatePicker/DatePicker.d.ts +1 -1
  89. package/dist/esm/components/molecules/DatePicker/DatePicker.presenter.d.ts +39 -0
  90. package/dist/esm/components/molecules/DatePicker/DatePicker.types.d.ts +2 -7
  91. package/dist/esm/components/molecules/FormField/FormField.d.ts +2 -3
  92. package/dist/esm/components/molecules/FormField/FormField.presenter.d.ts +15 -0
  93. package/dist/esm/components/molecules/FormField/FormField.types.d.ts +36 -85
  94. package/dist/esm/components/molecules/FormField/FormField.utils.d.ts +11 -0
  95. package/dist/esm/components/molecules/FormField/index.d.ts +3 -7
  96. package/dist/esm/components/molecules/RadioGroup/RadioGroup.d.ts +1 -2
  97. package/dist/esm/components/molecules/RadioGroup/RadioGroup.presenter.d.ts +9 -0
  98. package/dist/esm/components/molecules/RadioGroup/RadioGroup.types.d.ts +5 -27
  99. package/dist/esm/components/molecules/RadioGroup/RadioGroup.utils.d.ts +3 -0
  100. package/dist/esm/components/molecules/Select/Select.Context.d.ts +1 -1
  101. package/dist/esm/components/molecules/Select/Select.d.ts +1 -2
  102. package/dist/esm/components/molecules/Select/Select.presenter.d.ts +292 -0
  103. package/dist/esm/components/molecules/Select/Select.types.d.ts +4 -25
  104. package/dist/esm/components/organisms/Dropzone/Dropzone.d.ts +1 -2
  105. package/dist/esm/components/organisms/Dropzone/Dropzone.presenter.d.ts +19 -0
  106. package/dist/esm/components/organisms/Dropzone/Dropzone.types.d.ts +2 -7
  107. package/dist/esm/components/organisms/Form/UpdatedFormExample.d.ts +23 -0
  108. package/dist/esm/library.css +407 -411
  109. package/dist/esm/library.js +3 -3
  110. package/dist/esm/library.js.map +1 -1
  111. package/dist/index.d.ts +272 -510
  112. package/package.json +1 -1
  113. package/dist/cjs/components/molecules/CheckboxGroup/CheckboxGroup.Context.d.ts +0 -4
  114. package/dist/cjs/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +0 -4
  115. package/dist/cjs/components/molecules/CheckboxGroup/CheckboxGroup.types.d.ts +0 -53
  116. package/dist/cjs/components/molecules/CheckboxGroup/index.d.ts +0 -3
  117. package/dist/cjs/components/molecules/FormField/FormFieldContext.d.ts +0 -5
  118. package/dist/cjs/components/molecules/FormField/useField.d.ts +0 -12
  119. package/dist/cjs/components/molecules/RadioGroup/RadioGroup.Context.d.ts +0 -21
  120. package/dist/cjs/components/organisms/Form/FormExample.d.ts +0 -24
  121. package/dist/esm/components/molecules/CheckboxGroup/CheckboxGroup.Context.d.ts +0 -4
  122. package/dist/esm/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +0 -4
  123. package/dist/esm/components/molecules/CheckboxGroup/CheckboxGroup.types.d.ts +0 -53
  124. package/dist/esm/components/molecules/CheckboxGroup/index.d.ts +0 -3
  125. package/dist/esm/components/molecules/FormField/FormFieldContext.d.ts +0 -5
  126. package/dist/esm/components/molecules/FormField/useField.d.ts +0 -12
  127. package/dist/esm/components/molecules/RadioGroup/RadioGroup.Context.d.ts +0 -21
  128. package/dist/esm/components/organisms/Form/FormExample.d.ts +0 -24
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ImgHTMLAttributes, SyntheticEvent, HTMLAttributes, ReactNode, MouseEvent, InputHTMLAttributes, TextareaHTMLAttributes, Dispatch, SetStateAction, Ref, FormHTMLAttributes, LiHTMLAttributes, CSSProperties, RefObject, TableHTMLAttributes, TdHTMLAttributes } from 'react';
2
+ import React__default, { ImgHTMLAttributes, SyntheticEvent, HTMLAttributes, ReactNode, MouseEvent, Ref, FormHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, Dispatch, SetStateAction, LiHTMLAttributes, CSSProperties, RefObject, TableHTMLAttributes, TdHTMLAttributes } from 'react';
3
3
  import { LinkProps } from 'react-router-dom';
4
4
  import { Plugin } from 'flatpickr/dist/types/options';
5
5
  import FlatPickr from 'react-flatpickr';
@@ -179,29 +179,236 @@ interface IconButtonProps extends Omit<ButtonProps, 'leadingIcon' | 'trailingIco
179
179
  declare const IconButton: (props: IconButtonProps) => React__default.JSX.Element;
180
180
 
181
181
  /**
182
- * Enum for different input types.
182
+ * Type representing the allowed values for form fields
183
183
  */
184
- type InputTypeEnum = 'Text' | 'Number' | 'Email' | 'Password';
185
- type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> & {
184
+ type FieldValue = string | number | Date | boolean | File | Array<string | number | Date | File>;
185
+ /**
186
+ * Type representing the form values as a partial record of field names to field values
187
+ * @example
188
+ * ```typescript
189
+ * const formState: FormState = {
190
+ * name: 'John Doe',
191
+ * age: 30,
192
+ * dob: new Date('1990-01-01')
193
+ * };
194
+ * ```
195
+ */
196
+ type FormState<T extends FieldValue = FieldValue> = Partial<Record<string, T>>;
197
+ /**
198
+ * Type representing the form errors as a partial record of field names to error messages
199
+ */
200
+ type FormErrors<T extends FormState = FormState> = Partial<Record<keyof T, string>>;
201
+ /**
202
+ * Type representing a validation function for a form field
203
+ * It takes an error setter function and the field value (optional) and returns a boolean indicating if the value is valid
204
+ * @example
205
+ * ```typescript
206
+ * const nameValidator: FieldValidationFunction = (setError, value) => {
207
+ * if (!value) {
208
+ * setError('Name is required');
209
+ * return false;
210
+ * }
211
+ * return true;
212
+ * };
213
+ * ```
214
+ */
215
+ type FieldValidationFunction<T extends FieldValue = FieldValue> = (setError: (message: string) => void, value?: T) => boolean;
216
+ /**
217
+ * Type representing the required fields in a form
218
+ * It's a partial record of field names to a boolean indicating if the field is required
219
+ */
220
+ type RequiredFields<T extends FormState = FormState> = Partial<Record<keyof T, boolean>>;
221
+ /**
222
+ * Type representing the validation functions for each field in a form
223
+ * It's a partial record of field names to validation functions (or undefined)
224
+ * @example
225
+ * ```typescript
226
+ * const nameValidator: FieldValidationFunction = (setError, value) => {
227
+ * if (!value) {
228
+ * setError('Name is required');
229
+ * return false;
230
+ * }
231
+ * return true;
232
+ * };
233
+ * const fieldValidators: FieldValidators = {
234
+ * name: nameValidator,
235
+ * age: undefined,
236
+ * };
237
+ * ```
238
+ */
239
+ type FieldValidators<T extends FormState = FormState> = Partial<Record<keyof T, FieldValidationFunction | undefined>>;
240
+ /**
241
+ * Type representing a function that handles form state changes
242
+ * It takes the new form state and an error setter function and doesn't return anything
243
+ * @example
244
+ * ```typescript
245
+ * const handleFormStateChange: FormStateChangeHandler = (state, setError) => {
246
+ * // Validate form state and set errors
247
+ * if (!state.name) {
248
+ * setError('name', 'Name is required');
249
+ * }
250
+ * };
251
+ * ```
252
+ */
253
+ type FormStateChangeHandler<T extends FormState = FormState> = (state: T, setError: (field: keyof T, errorMessage: string) => void) => void;
254
+ /**
255
+ * Type representing a function that validates the entire form
256
+ * It takes the form values and an error setter function and returns a boolean indicating if the form is valid
257
+ * @example
258
+ * ```typescript
259
+ * const validateForm: FormValidator = (state, setError) => {
260
+ * let isValid = true;
261
+ * if (!state.name) {
262
+ * setError('name', 'Name is required');
263
+ * isValid = false;
264
+ * }
265
+ * if (!state.age || typeof state.age !== 'number') {
266
+ * setError('age', 'Age must be a number');
267
+ * isValid = false;
268
+ * }
269
+ * return isValid;
270
+ * };
271
+ * ```
272
+ */
273
+ type FormValidator<T extends FormState = FormState> = (state: T, setError: (field: keyof T, errorMessage: string) => void) => boolean;
274
+ /**
275
+ * Type representing a function that handles form submission.
276
+ * It takes updated form state and a function to set error messages for specific fields.
277
+ *
278
+ * @template T - The type of the form state, defaulting to `FormState`.
279
+ *
280
+ * @param {T} values - The updated form state values.
281
+ * @param {(field: keyof T, errorMessage: string) => void} setError - A function to set error messages for specific fields.
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * const handleFormSubmit: FormSubmitHandler = (values, setError) => {
286
+ * // Submit form data
287
+ * console.log(values);
288
+ * };
289
+ * ```
290
+ */
291
+ type FormSubmitHandler<T extends FormState = FormState> = (values: T, setError: (field: keyof T, errorMessage: string) => void) => void;
292
+ type FormProps = Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> & {
293
+ formRef?: Ref<HTMLFormElement>;
294
+ };
295
+ type FormContextValues<T extends FormState = FormState> = {
296
+ formRef?: Ref<HTMLFormElement>;
297
+ formState?: T;
298
+ updateFieldValue: (name: string, value: FieldValue) => void;
299
+ formErrors: FormErrors<T>;
300
+ updateFieldError: (name: keyof T, errorMessage: string) => void;
301
+ onFormSubmit: React__default.FormEventHandler<HTMLFormElement>;
302
+ updateFieldValidators: (name: keyof T, validate?: FieldValidationFunction) => void;
303
+ updateRequiredFields: (name: keyof T, required?: boolean) => void;
304
+ };
305
+ type FormProviderProps<T extends FormState = FormState> = {
306
+ formRef?: Ref<HTMLFormElement>;
307
+ children?: React__default.ReactNode;
308
+ formState?: T;
309
+ onFormStateChange?: FormStateChangeHandler<T>;
310
+ formValidator?: FormValidator<T>;
311
+ onSubmit?: FormSubmitHandler<T>;
312
+ validateOnChange?: boolean;
313
+ };
314
+
315
+ /**
316
+ * Props for the FormField component.
317
+ */
318
+ type FormFieldProps = HTMLAttributes<HTMLDivElement> & {
186
319
  /**
187
- * The type of input.
188
- * @default 'Text'
320
+ * Name of the form field
189
321
  */
190
- inputType?: InputTypeEnum;
322
+ name: string;
191
323
  /**
192
- * The value of the input.
324
+ * Label for the form field
193
325
  */
194
- value?: string;
326
+ label?: string;
195
327
  /**
196
- * Callback function when the input value changes.
197
- * @param value - The new value of the input.
328
+ * Children for the form field
198
329
  */
199
- onValueChanged?: (value: string) => void;
330
+ children: React.ReactNode;
331
+ /**
332
+ * Message for the form field
333
+ */
334
+ message?: string;
335
+ /**
336
+ * There is a message/error for the form field
337
+ */
338
+ hasMessage?: boolean;
339
+ /**
340
+ * Info icon for the form field
341
+ */
342
+ infoIcon?: React.ReactNode;
200
343
  /**
201
- * Indicates if the input is invalid.
344
+ * Indicates if the form field is required
345
+ */
346
+ required?: boolean;
347
+ /**
348
+ * Validation function for the form field
349
+ */
350
+ validate?: FieldValidationFunction;
351
+ /**
352
+ * Indicates if the form field is disabled
353
+ */
354
+ disabled?: boolean;
355
+ /**
356
+ * Indicates if the form field is invalid
357
+ */
358
+ invalid?: boolean;
359
+ /**
360
+ * Id for the form field
361
+ */
362
+ id?: string;
363
+ };
364
+ /**
365
+ * Props that must be implemented by all form field components that are controlled inputs
366
+ */
367
+ type ControlledFormComponentProps<T extends FieldValue> = {
368
+ /**
369
+ * the initial value for the field
370
+ */
371
+ initialValue?: T;
372
+ /**
373
+ * the initial value for the field
374
+ */
375
+ checked?: boolean;
376
+ /**
377
+ * The current value of the form field
378
+ */
379
+ value?: T;
380
+ /**
381
+ * Callback function that is called when the field value changes
382
+ * @param value - The new value of the form field
383
+ */
384
+ onValueChange?: (value: T) => void;
385
+ /**
386
+ * Whether the form field is disabled and cannot be interacted with
387
+ * @default false
388
+ */
389
+ disabled?: boolean;
390
+ /**
391
+ * Whether the form field must have a value
392
+ * @default false
393
+ */
394
+ required?: boolean;
395
+ /**
396
+ * Whether the form field's current value is invalid
202
397
  * @default false
203
398
  */
204
399
  invalid?: boolean;
400
+ };
401
+
402
+ /**
403
+ * Enum for different input types.
404
+ */
405
+ type InputTypeEnum = 'Text' | 'Number' | 'Email' | 'Password';
406
+ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> & ControlledFormComponentProps<string> & {
407
+ /**
408
+ * The type of input.
409
+ * @default 'Text'
410
+ */
411
+ inputType?: InputTypeEnum;
205
412
  /**
206
413
  * Icon to be displayed before the input.
207
414
  */
@@ -214,23 +421,14 @@ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'>
214
421
  * provide a way to override the styling
215
422
  */
216
423
  'component-variant'?: string;
217
- /**
218
- * The input is independent of the parent form field context.
219
- * @default false
220
- */
221
- independent?: boolean;
222
424
  };
223
425
 
224
- declare const Input: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "value" | "type"> & {
426
+ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "value" | "type"> & ControlledFormComponentProps<string> & {
225
427
  inputType?: InputTypeEnum;
226
- value?: string;
227
- onValueChanged?: (value: string) => void;
228
- invalid?: boolean;
229
- leadingIcon?: React__default.ReactNode;
230
- trailingIcon?: React__default.ReactNode;
428
+ leadingIcon?: React.ReactNode;
429
+ trailingIcon?: React.ReactNode;
231
430
  'component-variant'?: string;
232
- independent?: boolean;
233
- } & React__default.RefAttributes<HTMLInputElement>>;
431
+ } & React$1.RefAttributes<HTMLInputElement>>;
234
432
 
235
433
  type PasswordProps = Omit<InputProps, 'inputType' | 'trailingIcon'> & {
236
434
  hideTrailingIcon?: boolean;
@@ -324,33 +522,9 @@ interface TextProps {
324
522
  */
325
523
  declare const Text: (props: TextProps) => React__default.JSX.Element;
326
524
 
327
- type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'> & {
328
- /**
329
- * The value of the text area.
330
- */
331
- value?: string;
332
- /**
333
- * Callback function when the value of the text area changes.
334
- * @param value - The new value of the text area.
335
- */
336
- onValueChanged?: (value: string) => void;
337
- /**
338
- * Indicates if the text area is in an invalid state.
339
- * @default false
340
- */
341
- invalid?: boolean;
342
- /**
343
- * Additional class for styling.
344
- */
345
- className?: string;
346
- };
525
+ type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'> & ControlledFormComponentProps<string>;
347
526
 
348
- declare const TextArea: React__default.ForwardRefExoticComponent<Omit<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "value"> & {
349
- value?: string;
350
- onValueChanged?: (value: string) => void;
351
- invalid?: boolean;
352
- className?: string;
353
- } & React__default.RefAttributes<HTMLTextAreaElement>>;
527
+ declare const TextArea: React$1.ForwardRefExoticComponent<Omit<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, "value"> & ControlledFormComponentProps<string> & React$1.RefAttributes<HTMLTextAreaElement>>;
354
528
 
355
529
  type ResponsiveComponentProps<T> = {
356
530
  className?: string;
@@ -424,30 +598,11 @@ type SelectListItemProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
424
598
  declare const SelectListItem: (props: SelectListItemProps) => React__default.JSX.Element;
425
599
 
426
600
  type ToggleLabelAlignmentEnum = 'Left' | 'Right';
427
- type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'checked'> & {
601
+ type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'checked'> & ControlledFormComponentProps<boolean> & {
428
602
  /**
429
603
  * The label of the toggle.
430
604
  */
431
605
  children?: React.ReactNode;
432
- /**
433
- * The checked state of the toggle.
434
- */
435
- checked?: boolean;
436
- /**
437
- * Callback function when the toggle state changes.
438
- * @param value - The new checked state of the toggle.
439
- */
440
- onValueChanged?: (value: boolean) => void;
441
- /**
442
- * Default checked state of the toggle.
443
- * @default false
444
- */
445
- defaultChecked?: boolean;
446
- /**
447
- * Indicates if the toggle is invalid.
448
- * @default false
449
- */
450
- invalid?: boolean;
451
606
  /**
452
607
  * Alignment of the label.
453
608
  * @default 'Left'
@@ -455,51 +610,22 @@ type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'
455
610
  labelAlignment?: ToggleLabelAlignmentEnum;
456
611
  };
457
612
 
458
- declare const Toggle: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "checked" | "value" | "type"> & {
459
- children?: React__default.ReactNode;
460
- checked?: boolean;
461
- onValueChanged?: (value: boolean) => void;
462
- defaultChecked?: boolean;
463
- invalid?: boolean;
613
+ declare const Toggle: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "checked" | "value" | "type"> & ControlledFormComponentProps<boolean> & {
614
+ children?: React.ReactNode;
464
615
  labelAlignment?: ToggleLabelAlignmentEnum;
465
- } & React__default.RefAttributes<HTMLInputElement>>;
616
+ } & React$1.RefAttributes<HTMLInputElement>>;
466
617
 
467
- declare const ToggleButton: React__default.ForwardRefExoticComponent<Omit<ButtonProps, "type" | "actionType"> & {
468
- checked?: boolean;
618
+ declare const ToggleButton: React__default.ForwardRefExoticComponent<Omit<ButtonProps, "type" | "actionType"> & ControlledFormComponentProps<boolean> & {
469
619
  defaultChecked?: boolean;
470
- onValueChanged?: (value: boolean) => void;
471
- disabled?: boolean;
472
- required?: boolean;
473
- invalid?: boolean;
474
620
  children?: React__default.ReactNode;
475
621
  className?: string;
476
622
  } & React__default.RefAttributes<HTMLInputElement>>;
477
623
 
478
- type ToggleButtonProps = Omit<ButtonProps, 'type' | 'actionType'> & {
479
- /**
480
- * Controlled state of the toggle
481
- */
482
- checked?: boolean;
624
+ type ToggleButtonProps = Omit<ButtonProps, 'type' | 'actionType'> & ControlledFormComponentProps<boolean> & {
483
625
  /**
484
626
  * Default value for uncontrolled component
485
627
  */
486
628
  defaultChecked?: boolean;
487
- /**
488
- * Callback function when toggle state changes
489
- */
490
- onValueChanged?: (value: boolean) => void;
491
- /**
492
- * Disable the toggle
493
- */
494
- disabled?: boolean;
495
- /**
496
- * Make the toggle required
497
- */
498
- required?: boolean;
499
- /**
500
- * Show invalid state
501
- */
502
- invalid?: boolean;
503
629
  /**
504
630
  * Content of the button
505
631
  */
@@ -571,31 +697,13 @@ type TooltipProps = {
571
697
 
572
698
  declare const Tooltip: ({ children, direction, alignment, action, style, isVisible, target, className, }: TooltipProps) => React__default.JSX.Element;
573
699
 
574
- interface CustomToggleProps {
575
- /**
576
- * Controlled state of the toggle
577
- */
578
- checked?: boolean;
579
- /**
580
- * Default value for uncontrolled component
581
- */
582
- defaultChecked?: boolean;
583
- /**
584
- * Callback function when toggle state changes
585
- */
586
- onValueChanged?: (value: boolean) => void;
587
- /**
588
- * Disable the toggle
589
- */
590
- disabled?: boolean;
591
- /**
592
- * Make the toggle required
593
- */
594
- required?: boolean;
595
- /**
596
- * Show invalid state
597
- */
598
- invalid?: boolean;
700
+ declare const CustomToggle: React$1.ForwardRefExoticComponent<ControlledFormComponentProps<boolean> & {
701
+ offContent?: React$1.ReactNode;
702
+ onContent?: React$1.ReactNode;
703
+ className?: string;
704
+ } & React$1.RefAttributes<HTMLInputElement>>;
705
+
706
+ type CustomToggleProps = ControlledFormComponentProps<boolean> & {
599
707
  /**
600
708
  * Content to show when toggle is off
601
709
  */
@@ -608,9 +716,7 @@ interface CustomToggleProps {
608
716
  * Additional className for the toggle
609
717
  */
610
718
  className?: string;
611
- }
612
-
613
- declare const CustomToggle: React__default.ForwardRefExoticComponent<CustomToggleProps & React__default.RefAttributes<HTMLInputElement>>;
719
+ };
614
720
 
615
721
  type ChipTypeEnum = 'Bright' | 'BrightOutline' | 'Subdued' | 'SubduedOutline';
616
722
  type ChipStyleEnum = 'A' | 'B' | 'C' | 'D' | 'E' | 'F';
@@ -681,7 +787,7 @@ declare const Chip: (props: ChipProps) => React__default.JSX.Element;
681
787
  type CheckboxSizeEnum = 'Small' | 'Medium' | 'Large';
682
788
  type CheckboxLabelAlignmentEnum = 'Left' | 'Right';
683
789
  type CheckboxTypeEnum = 'Default' | 'Inverse';
684
- type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'value' | 'size'> & {
790
+ type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> & ControlledFormComponentProps<boolean> & {
685
791
  /**
686
792
  * The label of the checkbox.
687
793
  */
@@ -696,66 +802,38 @@ type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'check
696
802
  * @default 'Default'
697
803
  */
698
804
  type?: CheckboxTypeEnum;
699
- /**
700
- * The checked state of the checkbox.
701
- */
702
- checked?: boolean;
703
- /**
704
- * Callback function when the checkbox state changes.
705
- * @param value - The new checked state of the checkbox.
706
- */
707
- onValueChanged?: (value: boolean) => void;
708
805
  /**
709
806
  * Default checked state of the checkbox.
710
807
  * @default false
711
808
  */
712
809
  defaultChecked?: boolean;
713
- /**
714
- * Indicates if the checkbox is invalid.
715
- * @default false
716
- */
717
- invalid?: boolean;
718
- /**
719
- * The value of the checkbox.
720
- */
721
- value?: string | number;
722
810
  /**
723
811
  * The alignment of the label.
724
812
  */
725
813
  labelAlignment?: CheckboxLabelAlignmentEnum;
726
- /**
727
- * The checkbox is independent of the parent form field context.
728
- * @default false
729
- */
730
- independent?: boolean;
731
814
  };
732
815
 
733
- declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "checked" | "value" | "type" | "size"> & {
734
- children?: React__default.ReactNode;
816
+ declare const Checkbox: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & ControlledFormComponentProps<boolean> & {
817
+ children?: React.ReactNode;
735
818
  size?: CheckboxSizeEnum;
736
819
  type?: CheckboxTypeEnum;
737
- checked?: boolean;
738
- onValueChanged?: (value: boolean) => void;
739
820
  defaultChecked?: boolean;
740
- invalid?: boolean;
741
- value?: string | number;
742
821
  labelAlignment?: CheckboxLabelAlignmentEnum;
743
- independent?: boolean;
744
- } & React__default.RefAttributes<HTMLInputElement>>;
822
+ } & React$1.RefAttributes<HTMLInputElement>>;
745
823
 
746
- declare const CheckboxItem: React__default.ForwardRefExoticComponent<Omit<CheckboxProps, "onValueChanged"> & {
747
- onChange?: (value: boolean) => void;
824
+ declare const CheckboxItem: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & ControlledFormComponentProps<boolean> & {
825
+ children?: React__default.ReactNode;
826
+ size?: CheckboxSizeEnum;
827
+ type?: CheckboxTypeEnum;
828
+ defaultChecked?: boolean;
829
+ labelAlignment?: CheckboxLabelAlignmentEnum;
830
+ } & {
748
831
  showRightButton?: boolean;
749
832
  onRightButtonClick?: () => void;
750
833
  rightButtonIcon?: React__default.ReactNode;
751
834
  } & React__default.RefAttributes<HTMLInputElement>>;
752
835
 
753
- type CheckboxItemProps = Omit<CheckboxProps, 'onValueChanged'> & {
754
- /**
755
- * Callback function when the checkbox state changes.
756
- * @param value: boolean - The new checked state of the checkbox.
757
- */
758
- onChange?: (value: boolean) => void;
836
+ type CheckboxItemProps = CheckboxProps & {
759
837
  /**
760
838
  * Flag to show right button.
761
839
  * @default false
@@ -771,7 +849,7 @@ type CheckboxItemProps = Omit<CheckboxProps, 'onValueChanged'> & {
771
849
  rightButtonIcon?: ReactNode;
772
850
  };
773
851
 
774
- type SliderProps = React.HTMLAttributes<HTMLDivElement> & {
852
+ type SliderProps = React.HTMLAttributes<HTMLDivElement> & ControlledFormComponentProps<number | [number, number]> & {
775
853
  /**
776
854
  * The minimum value of the slider.
777
855
  * @default 0
@@ -787,16 +865,6 @@ type SliderProps = React.HTMLAttributes<HTMLDivElement> & {
787
865
  * @default 1
788
866
  */
789
867
  step?: number;
790
- /**
791
- * The current value of the slider.
792
- * Can be a single number or an array with exactly two numbers for range selection.
793
- */
794
- value?: number | [number, number];
795
- /**
796
- * Callback function triggered when the slider value changes.
797
- * @param value - The new value of the slider.
798
- */
799
- onValueChange?: (value: number | [number, number]) => void;
800
868
  /**
801
869
  * Whether to display the minimum value label.
802
870
  * @default false
@@ -817,19 +885,14 @@ type SliderProps = React.HTMLAttributes<HTMLDivElement> & {
817
885
  * @default false
818
886
  */
819
887
  enableRange?: boolean;
820
- /**
821
- * Flag to disabled slider.
822
- * @default false
823
- */
824
- disabled?: boolean;
825
888
  className?: string;
826
889
  };
827
890
 
828
- declare const Slider: (props: SliderProps) => React__default.JSX.Element;
891
+ declare const Slider: (props: SliderProps) => React$1.JSX.Element;
829
892
 
830
893
  type RadioButtonSizeEnum = 'Small' | 'Medium' | 'Large';
831
894
  type RadioButtonLabelAlignmentEnum = 'Left' | 'Right';
832
- type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'value' | 'size'> & {
895
+ type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'value'> & ControlledFormComponentProps<string | number> & {
833
896
  /**
834
897
  * The label of the radio button.
835
898
  */
@@ -839,54 +902,30 @@ type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'ch
839
902
  * @default 'Medium'
840
903
  */
841
904
  size?: RadioButtonSizeEnum;
842
- /**
843
- * The checked state of the radio button.
844
- */
845
- checked?: boolean;
846
- /**
847
- * Callback function when the radio button state changes.
848
- * @param value - The new checked state of the radio button.
849
- */
850
- onValueChanged?: (value: string | number) => void;
851
- /**
852
- * Indicates if the radio button is invalid.
853
- * @default false
854
- */
855
- invalid?: boolean;
856
905
  /**
857
906
  * Flag to show the label on the right side of the radio button.
858
907
  * @default false
859
908
  */
860
909
  labelAlignment?: RadioButtonLabelAlignmentEnum;
861
- /**
862
- * The value of the radio button.
863
- */
864
- value?: string | number;
865
910
  };
866
911
 
867
- declare const RadioButton: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "checked" | "value" | "type" | "size"> & {
868
- children?: React__default.ReactNode;
912
+ declare const RadioButton: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "size"> & ControlledFormComponentProps<string | number> & {
913
+ children?: React.ReactNode;
869
914
  size?: RadioButtonSizeEnum;
870
- checked?: boolean;
871
- onValueChanged?: (value: string | number) => void;
872
- invalid?: boolean;
873
915
  labelAlignment?: RadioButtonLabelAlignmentEnum;
874
- value?: string | number;
875
- } & React__default.RefAttributes<HTMLInputElement>>;
916
+ } & React$1.RefAttributes<HTMLInputElement>>;
876
917
 
877
- declare const RadioButtonItem: React__default.ForwardRefExoticComponent<Omit<RadioButtonProps, "onValueChanged"> & {
878
- onChange?: (value: string | number) => void;
918
+ declare const RadioButtonItem: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "size"> & ControlledFormComponentProps<string | number> & {
919
+ children?: React__default.ReactNode;
920
+ size?: RadioButtonSizeEnum;
921
+ labelAlignment?: RadioButtonLabelAlignmentEnum;
922
+ } & {
879
923
  showRightButton?: boolean;
880
924
  onRightButtonClick?: () => void;
881
925
  rightButtonIcon?: React__default.ReactNode;
882
926
  } & React__default.RefAttributes<HTMLInputElement>>;
883
927
 
884
- type RadioButtonItemProps = Omit<RadioButtonProps, 'onValueChanged'> & {
885
- /**
886
- * Callback function when the radio button state changes.
887
- * @param value: string | number - The value of the selected radio button.
888
- */
889
- onChange?: (value: string | number) => void;
928
+ type RadioButtonItemProps = RadioButtonProps & {
890
929
  /**
891
930
  * Flag to show right button.
892
931
  * @default false
@@ -1229,7 +1268,7 @@ type ContextMenuProps<T extends ListItemType> = ListProps<T>;
1229
1268
  declare const ContextMenu: <T extends ListItemType>(props: ContextMenuProps<T>) => React__default.JSX.Element;
1230
1269
 
1231
1270
  type DatePickerPosition = 'auto' | 'above' | 'below' | 'auto left' | 'auto center' | 'auto right' | 'above left' | 'above center' | 'above right' | 'below left' | 'below center' | 'below right';
1232
- type DatePickerProps = {
1271
+ type DatePickerProps = ControlledFormComponentProps<string | Date | (string | Date)[]> & {
1233
1272
  /**
1234
1273
  * Additional class for styling.
1235
1274
  */
@@ -1262,12 +1301,6 @@ type DatePickerProps = {
1262
1301
  * For info about what formats exist, refer to the flatpickr documentation
1263
1302
  */
1264
1303
  dateFormat?: string;
1265
- /**
1266
- * Callback function when the date(s) are changed.
1267
- * @param dates - Array of selected dates.
1268
- * @param dateStr - String representation of the selected date(s). Will match the date format.
1269
- */
1270
- onChange?: (dates: Date[], dateStr: string) => void;
1271
1304
  /**
1272
1305
  * Callback function when the date picker is opened.
1273
1306
  * @param dates - Array of selected dates.
@@ -1331,248 +1364,7 @@ type CustomTimePickerConfig = {
1331
1364
 
1332
1365
  declare const DatePicker: (props: DatePickerProps) => React__default.JSX.Element;
1333
1366
 
1334
- /**
1335
- * Type representing the allowed values for form fields
1336
- */
1337
- type FieldValue = string | number | Date | boolean | File | Array<string | number | Date | File>;
1338
- /**
1339
- * Type representing the form values as a partial record of field names to field values
1340
- * @example
1341
- * ```typescript
1342
- * const formState: FormState = {
1343
- * name: 'John Doe',
1344
- * age: 30,
1345
- * dob: new Date('1990-01-01')
1346
- * };
1347
- * ```
1348
- */
1349
- type FormState<T extends FieldValue = FieldValue> = Partial<Record<string, T>>;
1350
- /**
1351
- * Type representing the form errors as a partial record of field names to error messages
1352
- */
1353
- type FormErrors<T extends FormState = FormState> = Partial<Record<keyof T, string>>;
1354
- /**
1355
- * Type representing a validation function for a form field
1356
- * It takes an error setter function and the field value (optional) and returns a boolean indicating if the value is valid
1357
- * @example
1358
- * ```typescript
1359
- * const nameValidator: FieldValidationFunction = (setError, value) => {
1360
- * if (!value) {
1361
- * setError('Name is required');
1362
- * return false;
1363
- * }
1364
- * return true;
1365
- * };
1366
- * ```
1367
- */
1368
- type FieldValidationFunction<T extends FieldValue = FieldValue> = (setError: (message: string) => void, value?: T) => boolean;
1369
- /**
1370
- * Type representing the required fields in a form
1371
- * It's a partial record of field names to a boolean indicating if the field is required
1372
- */
1373
- type RequiredFields<T extends FormState = FormState> = Partial<Record<keyof T, boolean>>;
1374
- /**
1375
- * Type representing the validation functions for each field in a form
1376
- * It's a partial record of field names to validation functions (or undefined)
1377
- * @example
1378
- * ```typescript
1379
- * const nameValidator: FieldValidationFunction = (setError, value) => {
1380
- * if (!value) {
1381
- * setError('Name is required');
1382
- * return false;
1383
- * }
1384
- * return true;
1385
- * };
1386
- * const fieldValidators: FieldValidators = {
1387
- * name: nameValidator,
1388
- * age: undefined,
1389
- * };
1390
- * ```
1391
- */
1392
- type FieldValidators<T extends FormState = FormState> = Partial<Record<keyof T, FieldValidationFunction | undefined>>;
1393
- /**
1394
- * Type representing a function that handles form state changes
1395
- * It takes the new form state and an error setter function and doesn't return anything
1396
- * @example
1397
- * ```typescript
1398
- * const handleFormStateChange: FormStateChangeHandler = (state, setError) => {
1399
- * // Validate form state and set errors
1400
- * if (!state.name) {
1401
- * setError('name', 'Name is required');
1402
- * }
1403
- * };
1404
- * ```
1405
- */
1406
- type FormStateChangeHandler<T extends FormState = FormState> = (state: T, setError: (field: keyof T, errorMessage: string) => void) => void;
1407
- /**
1408
- * Type representing a function that validates the entire form
1409
- * It takes the form values and an error setter function and returns a boolean indicating if the form is valid
1410
- * @example
1411
- * ```typescript
1412
- * const validateForm: FormValidator = (state, setError) => {
1413
- * let isValid = true;
1414
- * if (!state.name) {
1415
- * setError('name', 'Name is required');
1416
- * isValid = false;
1417
- * }
1418
- * if (!state.age || typeof state.age !== 'number') {
1419
- * setError('age', 'Age must be a number');
1420
- * isValid = false;
1421
- * }
1422
- * return isValid;
1423
- * };
1424
- * ```
1425
- */
1426
- type FormValidator<T extends FormState = FormState> = (state: T, setError: (field: keyof T, errorMessage: string) => void) => boolean;
1427
- /**
1428
- * Type representing a function that handles form submission.
1429
- * It takes updated form state and a function to set error messages for specific fields.
1430
- *
1431
- * @template T - The type of the form state, defaulting to `FormState`.
1432
- *
1433
- * @param {T} values - The updated form state values.
1434
- * @param {(field: keyof T, errorMessage: string) => void} setError - A function to set error messages for specific fields.
1435
- *
1436
- * @example
1437
- * ```typescript
1438
- * const handleFormSubmit: FormSubmitHandler = (values, setError) => {
1439
- * // Submit form data
1440
- * console.log(values);
1441
- * };
1442
- * ```
1443
- */
1444
- type FormSubmitHandler<T extends FormState = FormState> = (values: T, setError: (field: keyof T, errorMessage: string) => void) => void;
1445
- type FormProps = Omit<FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> & {
1446
- formRef?: Ref<HTMLFormElement>;
1447
- };
1448
- type FormContextValues<T extends FormState = FormState> = {
1449
- formRef?: Ref<HTMLFormElement>;
1450
- formState?: T;
1451
- updateFieldValue: (name: string, value: FieldValue) => void;
1452
- formErrors: FormErrors<T>;
1453
- updateFieldError: (name: keyof T, errorMessage: string) => void;
1454
- onFormSubmit: React__default.FormEventHandler<HTMLFormElement>;
1455
- updateFieldValidators: (name: keyof T, validate?: FieldValidationFunction) => void;
1456
- updateRequiredFields: (name: keyof T, required?: boolean) => void;
1457
- };
1458
- type FormProviderProps<T extends FormState = FormState> = {
1459
- formRef?: Ref<HTMLFormElement>;
1460
- children?: React__default.ReactNode;
1461
- formState?: T;
1462
- onFormStateChange?: FormStateChangeHandler<T>;
1463
- formValidator?: FormValidator<T>;
1464
- onSubmit?: FormSubmitHandler<T>;
1465
- validateOnChange?: boolean;
1466
- };
1467
-
1468
- /**
1469
- * Props for the FormField component.
1470
- */
1471
- type FormFieldProps = HTMLAttributes<HTMLDivElement> & {
1472
- /**
1473
- * The label for the form field
1474
- */
1475
- label?: string;
1476
- /**
1477
- * Optional message for the form field
1478
- */
1479
- message?: string;
1480
- /**
1481
- * Info icon for message
1482
- */
1483
- infoIcon?: React.ReactNode;
1484
- /**
1485
- * Optional field for possible error message
1486
- */
1487
- hasMessage?: boolean;
1488
- };
1489
- /**
1490
- * Props for the FormFieldProvider component.
1491
- */
1492
- type FormFieldProviderProps = {
1493
- /**
1494
- * Child components
1495
- */
1496
- children: React.ReactNode;
1497
- /**
1498
- * Name of the form field
1499
- */
1500
- name: string;
1501
- /**
1502
- * Indicates if the field is disabled
1503
- * @default false
1504
- */
1505
- disabled?: boolean;
1506
- /**
1507
- * Indicates if the field is invalid
1508
- * @default false
1509
- */
1510
- invalid?: boolean;
1511
- /**
1512
- * Indicates if the field is required
1513
- * @default false
1514
- */
1515
- required?: boolean;
1516
- /**
1517
- * Validation function for the field
1518
- */
1519
- validate?: FieldValidationFunction;
1520
- /**
1521
- * id attribute to connect label and field of form field
1522
- * note:- this is optional as FormFieldContext will generate an id
1523
- */
1524
- id?: string;
1525
- };
1526
- /**
1527
- * Props for the UseField hook.
1528
- */
1529
- type UseFieldProps<T extends FieldValue = FieldValue> = {
1530
- /**
1531
- * The value of the field
1532
- */
1533
- value?: T;
1534
- /**
1535
- * Indicates if the field is invalid
1536
- * @default false
1537
- */
1538
- invalid?: boolean;
1539
- /**
1540
- * Callback when the field value changes
1541
- */
1542
- onValueChanged?: (value: T) => void;
1543
- /**
1544
- * Indicates if the field is disabled
1545
- * @default false
1546
- */
1547
- disabled?: boolean;
1548
- /**
1549
- * Indicates if the field is required
1550
- * @default false
1551
- */
1552
- required?: boolean;
1553
- /**
1554
- * Default value for the field
1555
- */
1556
- defaultValue?: T;
1557
- /**
1558
- * the field is independent of the parent form field contexts
1559
- * @default false
1560
- */
1561
- independent?: boolean;
1562
- };
1563
-
1564
- declare const useField: <T extends FieldValue = FieldValue>(props: UseFieldProps<T>) => {
1565
- fieldValue: T;
1566
- updateFieldValue: (newValue: T) => void;
1567
- disabledField: boolean | undefined;
1568
- requiredField: boolean | undefined;
1569
- invalidField: boolean | undefined;
1570
- formFieldId: string | undefined;
1571
- name: string | undefined;
1572
- };
1573
-
1574
- type FormFieldPropsWithProvider = FormFieldProviderProps & FormFieldProps;
1575
- declare const FormField: (props: FormFieldPropsWithProvider) => React__default.JSX.Element;
1367
+ declare const FormField: (props: FormFieldProps) => React$1.JSX.Element;
1576
1368
 
1577
1369
  type GridProps = HTMLAttributes<HTMLDivElement> & {
1578
1370
  columns?: number;
@@ -1959,42 +1751,20 @@ type SelectContextType = {
1959
1751
  * Indicates whether the field is disabled.
1960
1752
  */
1961
1753
  disabledField?: boolean;
1962
- /**
1963
- * id to use as htmlFor for label, which will be fetched from FormFieldContext
1964
- */
1965
- formFieldId: string;
1966
1754
  };
1967
1755
  /**
1968
1756
  * Props for the SelectProvider component, which manages state and provides context for Select.
1969
1757
  */
1970
- type SelectProviderProps = {
1758
+ type SelectProviderProps = ControlledFormComponentProps<FieldValue> & {
1971
1759
  /**
1972
1760
  * Child elements to be rendered within the SelectProvider.
1973
1761
  */
1974
1762
  children: ReactNode;
1975
- /**
1976
- * Currently selected value (if controlled).
1977
- */
1978
- value?: FieldValue;
1979
1763
  /**
1980
1764
  * Indicates if multiple options can be selected.
1981
1765
  * @default false
1982
1766
  */
1983
1767
  multiple?: boolean;
1984
- /**
1985
- * Default selected value (if uncontrolled).
1986
- */
1987
- defaultValue?: FieldValue;
1988
- /**
1989
- * Indicates whether the Select is disabled.
1990
- * @default false
1991
- */
1992
- disabled?: boolean;
1993
- /**
1994
- * Callback function invoked when the selected value changes.
1995
- * @param event - Optional event containing the new field value.
1996
- */
1997
- onValueChanged?: (event?: FieldValue) => void;
1998
1768
  /**
1999
1769
  * Indicates whether the selected field is hasDefaultOption or not.
2000
1770
  * @default false
@@ -2087,7 +1857,7 @@ declare const useSelectContext: () => SelectContextType;
2087
1857
  * @param props - Props for configuring the SelectProvider.
2088
1858
  * @returns JSX element that provides context to its children.
2089
1859
  */
2090
- declare const SelectProvider: ({ children, value, defaultValue, multiple, disabled, onValueChanged, }: SelectProviderProps) => React__default.JSX.Element;
1860
+ declare const SelectProvider: ({ children, value, multiple, disabled, invalid, onValueChange, }: SelectProviderProps) => React__default.JSX.Element;
2091
1861
 
2092
1862
  /**
2093
1863
  * Select component that wraps SelectComponent with SelectProvider.
@@ -2104,15 +1874,13 @@ type ChipListItemProps = {
2104
1874
  props: ChipProps | InputProps;
2105
1875
  inputRef?: RefObject<HTMLInputElement>;
2106
1876
  };
2107
- type ChipInputProps = {
1877
+ type ChipInputProps = ControlledFormComponentProps<string[]> & {
2108
1878
  inputValue?: string;
2109
1879
  onInputChange?: (value: string) => void;
2110
1880
  options?: string[];
2111
1881
  placeholder?: string;
2112
1882
  className?: string;
2113
- onValueChanged?: (value: string[]) => void;
2114
1883
  onAddNewOption?: (value: string) => void;
2115
- selectedValues?: string[];
2116
1884
  };
2117
1885
 
2118
1886
  declare const _default: React__default.NamedExoticComponent<ChipInputProps>;
@@ -2129,7 +1897,7 @@ type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
2129
1897
  * @param onFilesUpload (file: File) => void - callback when files are selected
2130
1898
  * @param onFilesReset () => void - callback when files are reset
2131
1899
  */
2132
- type DropzoneProps = {
1900
+ type DropzoneProps = ControlledFormComponentProps<File[]> & {
2133
1901
  className?: string;
2134
1902
  /**
2135
1903
  * The empty state of the dropzone.
@@ -2162,12 +1930,6 @@ type DropzoneProps = {
2162
1930
  * @default 1
2163
1931
  */
2164
1932
  maxFiles?: number;
2165
- disabled?: boolean;
2166
- required?: boolean;
2167
- /**
2168
- * callback when files are selected
2169
- */
2170
- onFilesSelected?: (files: File[]) => Promise<void> | void;
2171
1933
  /**
2172
1934
  * callback when files are reset
2173
1935
  */
@@ -2220,7 +1982,7 @@ type DropzoneFilenameProps = TextProps & {
2220
1982
  fileIndex?: number;
2221
1983
  };
2222
1984
 
2223
- declare const Dropzone: (props: DropzoneProps) => React__default.JSX.Element;
1985
+ declare const Dropzone: (props: DropzoneProps) => React$1.JSX.Element;
2224
1986
  declare const useDropzoneContext: () => DropzoneContextType;
2225
1987
 
2226
1988
  declare const DropzoneClear: (props: DropzoneClearProps) => React__default.JSX.Element;
@@ -2451,4 +2213,4 @@ declare const NotificationContext: React__default.Context<NotificationContextVal
2451
2213
  declare const NotificationProvider: React__default.FC<NotificationProviderProps>;
2452
2214
  declare const useNotification: () => NotificationContextValue;
2453
2215
 
2454
- export { Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, _default as ChipInput, type ChipInputProps, type ChipListItemProps, type ChipListItemTypeEnum, type ChipProps, ContextMenu, type ContextMenuProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValidators, type FieldValue, Form, type FormContextValues, type FormErrors, FormField, type FormFieldProps, type FormFieldPropsWithProvider, type FormProps, type FormProviderProps, type FormState, type FormStateChangeHandler, type FormSubmitHandler, type FormValidator, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type NotificationContainerProps, NotificationContext, NotificationProvider, Option, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RepeaterList, type RepeaterListProps, type RequiredFields, ResponsiveComponent, type ResponsiveComponentProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, useDropzoneContext, useField, useNotification, useSelectContext, useTab };
2216
+ export { Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, _default as ChipInput, type ChipInputProps, type ChipListItemProps, type ChipListItemTypeEnum, type ChipProps, ContextMenu, type ContextMenuProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValidators, type FieldValue, Form, type FormContextValues, type FormErrors, FormField, type FormFieldProps, type FormProps, type FormProviderProps, type FormState, type FormStateChangeHandler, type FormSubmitHandler, type FormValidator, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type NotificationContainerProps, NotificationContext, NotificationProvider, Option, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RepeaterList, type RepeaterListProps, type RequiredFields, ResponsiveComponent, type ResponsiveComponentProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, useDropzoneContext, useNotification, useSelectContext, useTab };