formik-form-components 0.2.27 → 0.2.28
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/dist/index.d.ts +64 -133
- package/dist/index.js +570 -575
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -544
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactElement, ReactNode, SyntheticEvent, ElementType, SetStateAction } from 'react';
|
|
3
3
|
import { FormikValues, FormikConfig, FormikProps } from 'formik';
|
|
4
|
-
import { SxProps, Theme, AutocompleteProps, AutocompleteChangeReason, AutocompleteChangeDetails, TextFieldProps,
|
|
4
|
+
import { SxProps, Theme, AutocompleteProps, AutocompleteChangeReason, AutocompleteChangeDetails, TextFieldProps, RadioGroupProps, AutocompleteRenderInputParams, AutocompleteRenderOptionState, AutocompleteRenderGroupParams, CheckboxProps, ChipProps, BoxProps } from '@mui/material';
|
|
5
5
|
import { Theme as Theme$1 } from '@mui/material/styles';
|
|
6
|
-
import { SelectProps
|
|
6
|
+
import { SelectProps } from '@mui/material/Select';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
import { Dayjs } from 'dayjs';
|
|
9
9
|
import { DropzoneOptions } from 'react-dropzone';
|
|
@@ -19,7 +19,7 @@ type AppDatePickerProps = {
|
|
|
19
19
|
};
|
|
20
20
|
declare const AppDatePicker: React__default.ForwardRefExoticComponent<AppDatePickerProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
|
|
22
|
-
interface AppSelectOptions$
|
|
22
|
+
interface AppSelectOptions$2 {
|
|
23
23
|
label: string;
|
|
24
24
|
value: string | number;
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ interface Props$8 extends Omit<SelectProps, 'name' | 'label' | 'value' | 'onChan
|
|
|
27
27
|
name: string;
|
|
28
28
|
label?: string;
|
|
29
29
|
placeholder?: string;
|
|
30
|
-
options: AppSelectOptions$
|
|
30
|
+
options: AppSelectOptions$2[];
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
sx?: SxProps<Theme>;
|
|
33
33
|
formControlSx?: SxProps<Theme>;
|
|
@@ -253,73 +253,50 @@ interface Props$3 extends Omit<TextFieldProps, 'variant'> {
|
|
|
253
253
|
}
|
|
254
254
|
declare function AppInputField({ name, label, type, InputProps, required, variant, ...otherProps }: Props$3): React__default.JSX.Element;
|
|
255
255
|
|
|
256
|
-
interface
|
|
257
|
-
/** The label to display for this option */
|
|
256
|
+
interface AppSelectOption$1 {
|
|
258
257
|
label: string;
|
|
259
|
-
/** The value to be used when this option is selected */
|
|
260
258
|
value: string | number;
|
|
261
|
-
/** Whether this option is disabled */
|
|
262
259
|
disabled?: boolean;
|
|
263
|
-
|
|
260
|
+
searchAbleValue1?: string;
|
|
261
|
+
searchAbleValue2?: string;
|
|
262
|
+
searchAbleValue3?: string;
|
|
264
263
|
sx?: SxProps<Theme>;
|
|
265
|
-
/** Custom styles for this specific menu item text */
|
|
266
264
|
textSx?: SxProps<Theme>;
|
|
265
|
+
icon?: ReactNode;
|
|
267
266
|
}
|
|
268
|
-
interface
|
|
269
|
-
/** Field name for formik */
|
|
267
|
+
interface BaseMultiSelectProps {
|
|
270
268
|
name: string;
|
|
271
|
-
/** Label for the multi-selector */
|
|
272
269
|
label?: string;
|
|
273
|
-
|
|
274
|
-
multiple?: boolean;
|
|
275
|
-
/** Array of select options */
|
|
276
|
-
options: AppSelectOptions$3[];
|
|
277
|
-
/** Whether the field is required */
|
|
270
|
+
options: AppSelectOption$1[];
|
|
278
271
|
required?: boolean;
|
|
279
|
-
/** Whether the field is disabled */
|
|
280
272
|
disabled?: boolean;
|
|
281
|
-
/** Maximum number of items that can be selected */
|
|
282
273
|
maxSelections?: number;
|
|
283
|
-
/** Whether to show the selected count in the label */
|
|
284
274
|
showSelectedCount?: boolean;
|
|
285
|
-
/** Whether to show the helper text when no error */
|
|
286
|
-
showHelperText?: boolean;
|
|
287
|
-
/** Variant of the input field */
|
|
288
|
-
variant?: 'outlined' | 'filled' | 'standard';
|
|
289
|
-
/** Custom helper text to display */
|
|
290
275
|
helperText?: string;
|
|
291
|
-
|
|
276
|
+
variant?: "outlined" | "filled" | "standard";
|
|
277
|
+
placeholder?: string;
|
|
292
278
|
sx?: SxProps<Theme>;
|
|
293
|
-
/** Custom styles for the form control */
|
|
294
279
|
formControlSx?: SxProps<Theme>;
|
|
295
|
-
/** Custom styles for the select component */
|
|
296
|
-
selectSx?: SxProps<Theme>;
|
|
297
|
-
/** Custom styles for the label */
|
|
298
280
|
labelSx?: SxProps<Theme>;
|
|
299
|
-
/** Custom styles for the chip components */
|
|
300
281
|
chipSx?: SxProps<Theme>;
|
|
301
|
-
/** Custom styles for the checkbox components */
|
|
302
282
|
checkboxSx?: SxProps<Theme>;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
/** Custom render function for the selected value */
|
|
318
|
-
renderValue?: (selected: Array<string | number>) => ReactNode;
|
|
319
|
-
/** Custom render function for menu items */
|
|
320
|
-
renderMenuItem?: (option: AppSelectOptions$3, isSelected: boolean) => ReactNode;
|
|
283
|
+
onChange?: (value: Array<string | number>) => void;
|
|
284
|
+
onMaxSelectionsReached?: (maxSelections: number) => void;
|
|
285
|
+
}
|
|
286
|
+
interface AutocompleteMultiSelectProps extends BaseMultiSelectProps {
|
|
287
|
+
mode?: "autocomplete";
|
|
288
|
+
onSearchChange?: (query: string) => void;
|
|
289
|
+
searchDebounce?: number;
|
|
290
|
+
clearable?: boolean;
|
|
291
|
+
}
|
|
292
|
+
interface DropdownMultiSelectProps extends BaseMultiSelectProps {
|
|
293
|
+
mode: "dropdown";
|
|
294
|
+
onSearchChange?: never;
|
|
295
|
+
searchDebounce?: never;
|
|
296
|
+
clearable?: never;
|
|
321
297
|
}
|
|
322
|
-
|
|
298
|
+
type AppMultiSelectorProps = AutocompleteMultiSelectProps | DropdownMultiSelectProps;
|
|
299
|
+
declare const AppMultiSelector: React__default.ForwardRefExoticComponent<AppMultiSelectorProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
323
300
|
|
|
324
301
|
interface AppPhoneNoInputProps {
|
|
325
302
|
name: string;
|
|
@@ -478,7 +455,7 @@ interface Props$2 {
|
|
|
478
455
|
}
|
|
479
456
|
declare const AppRichTextEditor: ({ name, label, required, variant, placeholder, sx, editorSx, toolbarSx, contentSx, errorSx, labelSx, buttonSx, activeButtonSx, dialogSx, }: Props$2) => react_jsx_runtime.JSX.Element | null;
|
|
480
457
|
|
|
481
|
-
interface AppSelectOptions$
|
|
458
|
+
interface AppSelectOptions$1 {
|
|
482
459
|
/** Display text for the option */
|
|
483
460
|
label: string;
|
|
484
461
|
/** Unique value for the option */
|
|
@@ -502,7 +479,7 @@ interface AppSelectOptions$2 {
|
|
|
502
479
|
/** Custom props for the option component */
|
|
503
480
|
componentProps?: Record<string, any>;
|
|
504
481
|
}
|
|
505
|
-
type CustomAutocompleteProps = Omit<AutocompleteProps<AppSelectOptions$
|
|
482
|
+
type CustomAutocompleteProps = Omit<AutocompleteProps<AppSelectOptions$1, boolean, boolean, boolean>, "renderInput" | "options" | "renderTags" | "onChange" | "value" | "multiple">;
|
|
506
483
|
interface AppSearchableMultiSelectorProps extends CustomAutocompleteProps {
|
|
507
484
|
/** Field name for formik */
|
|
508
485
|
name: string;
|
|
@@ -511,7 +488,7 @@ interface AppSearchableMultiSelectorProps extends CustomAutocompleteProps {
|
|
|
511
488
|
/** Whether multiple selections are allowed */
|
|
512
489
|
multiple?: boolean;
|
|
513
490
|
/** Available options */
|
|
514
|
-
options: AppSelectOptions$
|
|
491
|
+
options: AppSelectOptions$1[];
|
|
515
492
|
/** Callback when search query changes */
|
|
516
493
|
setSearchQuery: React__default.Dispatch<SetStateAction<string>>;
|
|
517
494
|
/** Whether the field is required */
|
|
@@ -557,9 +534,9 @@ interface AppSearchableMultiSelectorProps extends CustomAutocompleteProps {
|
|
|
557
534
|
/** Custom render function for the input */
|
|
558
535
|
renderInput?: (params: AutocompleteRenderInputParams) => ReactNode;
|
|
559
536
|
/** Custom render function for the option */
|
|
560
|
-
renderOption?: (props: React__default.HTMLAttributes<HTMLLIElement>, option: AppSelectOptions$
|
|
537
|
+
renderOption?: (props: React__default.HTMLAttributes<HTMLLIElement>, option: AppSelectOptions$1, state: AutocompleteRenderOptionState, ownerState: any) => ReactNode;
|
|
561
538
|
/** Custom render function for the selected value */
|
|
562
|
-
renderTags?: (value: AppSelectOptions$
|
|
539
|
+
renderTags?: (value: AppSelectOptions$1[], getTagProps: (params: {
|
|
563
540
|
index: number;
|
|
564
541
|
}) => {
|
|
565
542
|
key: number | string;
|
|
@@ -613,7 +590,7 @@ interface AppSearchableMultiSelectorProps extends CustomAutocompleteProps {
|
|
|
613
590
|
/** Custom class name for the helper text */
|
|
614
591
|
helperTextClassName?: string;
|
|
615
592
|
/** Callback when the selection changes */
|
|
616
|
-
onChange?: (event: React__default.SyntheticEvent, value: AppSelectOptions$
|
|
593
|
+
onChange?: (event: React__default.SyntheticEvent, value: AppSelectOptions$1[], reason: string) => void;
|
|
617
594
|
/** Callback when the input value changes */
|
|
618
595
|
onInputChange?: (event: React__default.SyntheticEvent, value: string, reason: string) => void;
|
|
619
596
|
/** Callback when the dropdown is opened */
|
|
@@ -629,23 +606,23 @@ interface AppSearchableMultiSelectorProps extends CustomAutocompleteProps {
|
|
|
629
606
|
/** Callback when the maximum number of selections is reached */
|
|
630
607
|
onMaxSelectionsReached?: (maxSelections: number) => void;
|
|
631
608
|
/** Callback when a selection is removed */
|
|
632
|
-
onRemove?: (value: AppSelectOptions$
|
|
609
|
+
onRemove?: (value: AppSelectOptions$1) => void;
|
|
633
610
|
/** Callback when a selection is added */
|
|
634
|
-
onAdd?: (value: AppSelectOptions$
|
|
611
|
+
onAdd?: (value: AppSelectOptions$1) => void;
|
|
635
612
|
}
|
|
636
613
|
declare const AppSearchableMultiSelector: React__default.ForwardRefExoticComponent<Omit<AppSearchableMultiSelectorProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
637
614
|
|
|
638
|
-
interface AppSelectOptions
|
|
615
|
+
interface AppSelectOptions {
|
|
639
616
|
label: string;
|
|
640
617
|
value: string | number;
|
|
641
618
|
searchAbleValue1?: string;
|
|
642
619
|
searchAbleValue2?: string;
|
|
643
620
|
searchAbleValue3?: string;
|
|
644
621
|
}
|
|
645
|
-
interface Props$1 extends Omit<AutocompleteProps<AppSelectOptions
|
|
622
|
+
interface Props$1 extends Omit<AutocompleteProps<AppSelectOptions, false, false, false>, "options" | "renderInput" | "value" | "onChange"> {
|
|
646
623
|
name: string;
|
|
647
624
|
label: string;
|
|
648
|
-
options: AppSelectOptions
|
|
625
|
+
options: AppSelectOptions[];
|
|
649
626
|
setSearchQuery?: React__default.Dispatch<SetStateAction<string>> | undefined;
|
|
650
627
|
required?: boolean;
|
|
651
628
|
placeholder?: string;
|
|
@@ -654,93 +631,47 @@ interface Props$1 extends Omit<AutocompleteProps<AppSelectOptions$1, false, fals
|
|
|
654
631
|
}
|
|
655
632
|
declare function AppSearchableSelectInput({ name, label, options, required, variant, placeholder, setSearchQuery, isResetRequired, ...otherProps }: Props$1): React__default.JSX.Element;
|
|
656
633
|
|
|
657
|
-
interface
|
|
658
|
-
/** The label to display for this option */
|
|
634
|
+
interface AppSelectOption {
|
|
659
635
|
label: string;
|
|
660
|
-
/** The value to be used when this option is selected */
|
|
661
636
|
value: string | number;
|
|
662
|
-
/** Whether this option is disabled */
|
|
663
637
|
disabled?: boolean;
|
|
664
|
-
|
|
638
|
+
searchAbleValue1?: string;
|
|
639
|
+
searchAbleValue2?: string;
|
|
640
|
+
searchAbleValue3?: string;
|
|
665
641
|
sx?: SxProps<Theme>;
|
|
666
|
-
/** Custom styles for this specific menu item text */
|
|
667
642
|
textSx?: SxProps<Theme>;
|
|
668
|
-
/** Custom icon for the option */
|
|
669
643
|
icon?: ReactNode;
|
|
670
|
-
/** Custom component to render the option */
|
|
671
|
-
component?: ElementType;
|
|
672
|
-
/** Custom props for the option component */
|
|
673
|
-
componentProps?: Record<string, any>;
|
|
674
644
|
}
|
|
675
|
-
interface
|
|
676
|
-
/** Field name for formik */
|
|
645
|
+
interface BaseSelectProps {
|
|
677
646
|
name: string;
|
|
678
|
-
/** Label for the select */
|
|
679
647
|
label?: string;
|
|
680
|
-
|
|
681
|
-
options: AppSelectOptions[];
|
|
682
|
-
/** Whether the field is required */
|
|
648
|
+
options: AppSelectOption[];
|
|
683
649
|
required?: boolean;
|
|
684
|
-
/** Whether the field is disabled */
|
|
685
650
|
disabled?: boolean;
|
|
686
|
-
/** Whether the field is read-only */
|
|
687
|
-
readOnly?: boolean;
|
|
688
|
-
/** Variant of the select input */
|
|
689
|
-
variant?: "outlined" | "filled" | "standard";
|
|
690
|
-
/** Whether to show a 'None' option */
|
|
691
651
|
showNoneOption?: boolean;
|
|
692
|
-
/** Text to display for the 'None' option */
|
|
693
652
|
noneOptionText?: string;
|
|
694
|
-
/** Whether to show the helper text when no error */
|
|
695
|
-
showHelperText?: boolean;
|
|
696
|
-
/** Custom helper text to display */
|
|
697
653
|
helperText?: string;
|
|
698
|
-
|
|
654
|
+
variant?: "outlined" | "filled" | "standard";
|
|
655
|
+
placeholder?: string;
|
|
699
656
|
sx?: SxProps<Theme>;
|
|
700
|
-
/** Custom styles for the form control */
|
|
701
657
|
formControlSx?: SxProps<Theme>;
|
|
702
|
-
/** Custom styles for the select component */
|
|
703
|
-
selectSx?: SxProps<Theme>;
|
|
704
|
-
/** Custom styles for the input */
|
|
705
|
-
inputSx?: SxProps<Theme>;
|
|
706
|
-
/** Custom styles for the label */
|
|
707
658
|
labelSx?: SxProps<Theme>;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
/** Custom component for the helper text */
|
|
725
|
-
helperTextComponent?: ElementType;
|
|
726
|
-
/** Callback when the value changes */
|
|
727
|
-
onChange?: (event: SelectChangeEvent$1<unknown>, child: ReactNode) => void;
|
|
728
|
-
/** Callback when the menu opens */
|
|
729
|
-
onOpen?: (event: React.SyntheticEvent) => void;
|
|
730
|
-
/** Callback when the menu closes */
|
|
731
|
-
onClose?: (event: React.SyntheticEvent) => void;
|
|
732
|
-
/** Callback when the field is blurred */
|
|
733
|
-
onBlur?: (event: React.FocusEvent) => void;
|
|
734
|
-
/** Custom render function for the selected value */
|
|
735
|
-
renderValue?: (value: unknown) => ReactNode;
|
|
736
|
-
/** Custom render function for menu items */
|
|
737
|
-
renderMenuItem?: (option: AppSelectOptions, index: number) => ReactNode;
|
|
738
|
-
/** Custom props for the MenuProps */
|
|
739
|
-
MenuProps?: any;
|
|
740
|
-
/** Custom props for the input component */
|
|
741
|
-
inputProps?: any;
|
|
742
|
-
}
|
|
743
|
-
declare const AppSelectInput: React$1.ForwardRefExoticComponent<Omit<AppSelectInputProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
659
|
+
onChange?: (value: string | number) => void;
|
|
660
|
+
}
|
|
661
|
+
interface AutocompleteSelectProps extends BaseSelectProps {
|
|
662
|
+
mode?: "autocomplete";
|
|
663
|
+
onSearchChange?: (query: string) => void;
|
|
664
|
+
searchDebounce?: number;
|
|
665
|
+
clearable?: boolean;
|
|
666
|
+
}
|
|
667
|
+
interface DropdownSelectProps extends BaseSelectProps {
|
|
668
|
+
mode: "dropdown";
|
|
669
|
+
onSearchChange?: never;
|
|
670
|
+
searchDebounce?: never;
|
|
671
|
+
clearable?: never;
|
|
672
|
+
}
|
|
673
|
+
type AppSelectInputProps = AutocompleteSelectProps | DropdownSelectProps;
|
|
674
|
+
declare const AppSelectInput: React__default.ForwardRefExoticComponent<AppSelectInputProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
744
675
|
|
|
745
676
|
interface AppSimpleUploadFileProps {
|
|
746
677
|
name: string;
|