formik-form-components 0.2.26 → 0.2.27
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 +70 -94
- package/dist/index.js +186 -542
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -544
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -679,25 +679,30 @@ function AppSwitchInput({
|
|
|
679
679
|
material.Box,
|
|
680
680
|
{
|
|
681
681
|
className,
|
|
682
|
-
sx: [
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
682
|
+
sx: [
|
|
683
|
+
{
|
|
684
|
+
display: "flex",
|
|
685
|
+
flexDirection: labelPlacement === "start" || labelPlacement === "end" ? "row" : "column",
|
|
686
|
+
alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
|
|
687
|
+
justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
|
|
688
|
+
gap: 1,
|
|
689
|
+
my: 1,
|
|
690
|
+
...containerSx
|
|
691
|
+
},
|
|
692
|
+
sx
|
|
693
|
+
],
|
|
691
694
|
children: [
|
|
692
695
|
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
693
696
|
material.Typography,
|
|
694
697
|
{
|
|
695
698
|
variant: "body2",
|
|
696
|
-
sx: [
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
699
|
+
sx: [
|
|
700
|
+
{
|
|
701
|
+
color: "text.primary",
|
|
702
|
+
order: labelPlacement === "start" ? 0 : 1,
|
|
703
|
+
...labelSx
|
|
704
|
+
}
|
|
705
|
+
],
|
|
701
706
|
children: label
|
|
702
707
|
}
|
|
703
708
|
),
|
|
@@ -710,25 +715,27 @@ function AppSwitchInput({
|
|
|
710
715
|
onChange: () => {
|
|
711
716
|
setFieldValue(name, !values[name], true);
|
|
712
717
|
},
|
|
713
|
-
sx: [
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
718
|
+
sx: [
|
|
719
|
+
{
|
|
720
|
+
"& .MuiSwitch-switchBase": {
|
|
721
|
+
color: "text.secondary",
|
|
722
|
+
"&.Mui-checked": {
|
|
723
|
+
color: "primary.main",
|
|
724
|
+
"& + .MuiSwitch-track": {
|
|
725
|
+
backgroundColor: "primary.main",
|
|
726
|
+
opacity: 0.5
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
"&.Mui-disabled": {
|
|
730
|
+
color: "action.disabled",
|
|
731
|
+
"& + .MuiSwitch-track": {
|
|
732
|
+
backgroundColor: "action.disabledBackground"
|
|
733
|
+
}
|
|
721
734
|
}
|
|
722
735
|
},
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
backgroundColor: "action.disabledBackground"
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
|
-
...switchSx
|
|
731
|
-
}],
|
|
736
|
+
...switchSx
|
|
737
|
+
}
|
|
738
|
+
],
|
|
732
739
|
...otherProps
|
|
733
740
|
}
|
|
734
741
|
),
|
|
@@ -736,12 +743,14 @@ function AppSwitchInput({
|
|
|
736
743
|
material.Typography,
|
|
737
744
|
{
|
|
738
745
|
variant: "caption",
|
|
739
|
-
sx: [
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
746
|
+
sx: [
|
|
747
|
+
{
|
|
748
|
+
color: "error.main",
|
|
749
|
+
display: "block",
|
|
750
|
+
mt: 0.5,
|
|
751
|
+
...errorSx
|
|
752
|
+
}
|
|
753
|
+
],
|
|
745
754
|
gutterBottom: true,
|
|
746
755
|
children: fieldError
|
|
747
756
|
}
|
|
@@ -773,21 +782,26 @@ function AppSwitch({
|
|
|
773
782
|
alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
|
|
774
783
|
justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
|
|
775
784
|
spacing: 1,
|
|
776
|
-
sx: [
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
785
|
+
sx: [
|
|
786
|
+
{
|
|
787
|
+
width: "100%",
|
|
788
|
+
...labelPlacement === "top" || labelPlacement === "bottom" ? { alignItems: "flex-start" } : {},
|
|
789
|
+
...containerSx
|
|
790
|
+
},
|
|
791
|
+
sx
|
|
792
|
+
],
|
|
781
793
|
children: [
|
|
782
794
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
783
795
|
material.Typography,
|
|
784
796
|
{
|
|
785
797
|
variant: "body2",
|
|
786
|
-
sx: [
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
798
|
+
sx: [
|
|
799
|
+
{
|
|
800
|
+
color: "text.primary",
|
|
801
|
+
order: labelPlacement === "start" ? 0 : 1,
|
|
802
|
+
...labelSx
|
|
803
|
+
}
|
|
804
|
+
],
|
|
791
805
|
children: label
|
|
792
806
|
}
|
|
793
807
|
),
|
|
@@ -799,25 +813,27 @@ function AppSwitch({
|
|
|
799
813
|
onChange: () => {
|
|
800
814
|
setFieldValue(name, !fieldValue, true);
|
|
801
815
|
},
|
|
802
|
-
sx: [
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
816
|
+
sx: [
|
|
817
|
+
{
|
|
818
|
+
"& .MuiSwitch-switchBase": {
|
|
819
|
+
color: "text.secondary",
|
|
820
|
+
"&.Mui-checked": {
|
|
821
|
+
color: "primary.main",
|
|
822
|
+
"& + .MuiSwitch-track": {
|
|
823
|
+
backgroundColor: "primary.main",
|
|
824
|
+
opacity: 0.5
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
"&.Mui-disabled": {
|
|
828
|
+
color: "action.disabled",
|
|
829
|
+
"& + .MuiSwitch-track": {
|
|
830
|
+
backgroundColor: "action.disabledBackground"
|
|
831
|
+
}
|
|
810
832
|
}
|
|
811
833
|
},
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
backgroundColor: "action.disabledBackground"
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
},
|
|
819
|
-
...switchSx
|
|
820
|
-
}],
|
|
834
|
+
...switchSx
|
|
835
|
+
}
|
|
836
|
+
],
|
|
821
837
|
...otherProps
|
|
822
838
|
}
|
|
823
839
|
),
|
|
@@ -825,12 +841,14 @@ function AppSwitch({
|
|
|
825
841
|
material.Typography,
|
|
826
842
|
{
|
|
827
843
|
variant: "caption",
|
|
828
|
-
sx: [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
844
|
+
sx: [
|
|
845
|
+
{
|
|
846
|
+
color: "error.main",
|
|
847
|
+
display: "block",
|
|
848
|
+
mt: 0.5,
|
|
849
|
+
...errorSx
|
|
850
|
+
}
|
|
851
|
+
],
|
|
834
852
|
gutterBottom: true,
|
|
835
853
|
children: fieldError
|
|
836
854
|
}
|
|
@@ -11868,447 +11886,106 @@ var AppSearchableMultiSelector = react.forwardRef(
|
|
|
11868
11886
|
);
|
|
11869
11887
|
AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
|
|
11870
11888
|
var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
helperText,
|
|
11884
|
-
maxSelections,
|
|
11885
|
-
showSelectedCount = false,
|
|
11886
|
-
sx,
|
|
11887
|
-
formControlSx,
|
|
11888
|
-
labelSx,
|
|
11889
|
-
inputSx,
|
|
11890
|
-
textFieldSx,
|
|
11891
|
-
autocompleteSx,
|
|
11892
|
-
listboxSx,
|
|
11893
|
-
optionSx,
|
|
11894
|
-
chipSx,
|
|
11895
|
-
errorSx,
|
|
11896
|
-
helperTextSx,
|
|
11897
|
-
selectedCountSx,
|
|
11898
|
-
renderInput: externalRenderInput,
|
|
11899
|
-
renderOption: externalRenderOption,
|
|
11900
|
-
renderTags: externalRenderTags,
|
|
11901
|
-
renderGroup: externalRenderGroup,
|
|
11902
|
-
labelComponent: LabelComponent = material.InputLabel,
|
|
11903
|
-
inputComponent: InputComponent = "input",
|
|
11904
|
-
errorComponent: ErrorComponent = material.Typography,
|
|
11905
|
-
helperTextComponent: HelperTextComponent = material.FormHelperText,
|
|
11906
|
-
labelProps = {},
|
|
11907
|
-
inputProps = {},
|
|
11908
|
-
textFieldProps = {},
|
|
11909
|
-
autocompleteProps = {},
|
|
11910
|
-
checkboxProps = {},
|
|
11911
|
-
chipProps = {},
|
|
11912
|
-
errorProps = {},
|
|
11913
|
-
helperTextProps = {},
|
|
11914
|
-
className = "",
|
|
11915
|
-
formControlClassName = "",
|
|
11916
|
-
labelClassName = "",
|
|
11917
|
-
inputClassName = "",
|
|
11918
|
-
textFieldClassName = "",
|
|
11919
|
-
autocompleteClassName = "",
|
|
11920
|
-
listboxClassName = "",
|
|
11921
|
-
optionClassName = "",
|
|
11922
|
-
chipClassName = "",
|
|
11923
|
-
errorClassName = "",
|
|
11924
|
-
helperTextClassName = "",
|
|
11925
|
-
onInputChange: externalOnInputChange,
|
|
11926
|
-
onChange: externalOnChange,
|
|
11927
|
-
onOpen,
|
|
11928
|
-
onClose,
|
|
11929
|
-
onBlur: externalOnBlur,
|
|
11930
|
-
onFocus: externalOnFocus,
|
|
11931
|
-
onClear,
|
|
11932
|
-
onMaxSelectionsReached,
|
|
11933
|
-
onRemove,
|
|
11934
|
-
onAdd,
|
|
11935
|
-
...otherProps
|
|
11936
|
-
} = props;
|
|
11937
|
-
material.useTheme();
|
|
11938
|
-
const { values, setFieldValue, errors, touched, setFieldTouched } = formik.useFormikContext();
|
|
11889
|
+
function AppSearchableSelectInput({
|
|
11890
|
+
name,
|
|
11891
|
+
label,
|
|
11892
|
+
options = [],
|
|
11893
|
+
required = false,
|
|
11894
|
+
variant = "outlined",
|
|
11895
|
+
placeholder,
|
|
11896
|
+
setSearchQuery,
|
|
11897
|
+
isResetRequired,
|
|
11898
|
+
...otherProps
|
|
11899
|
+
}) {
|
|
11900
|
+
const { errors, touched, setFieldValue, values } = formik.useFormikContext();
|
|
11939
11901
|
const fieldError = _19__default.default.get(errors, name);
|
|
11940
|
-
const isTouched =
|
|
11941
|
-
const hasError = Boolean(fieldError) && isTouched;
|
|
11902
|
+
const isTouched = _19__default.default.get(touched, name);
|
|
11942
11903
|
const val = _19__default.default.get(values, name);
|
|
11943
|
-
const
|
|
11944
|
-
const
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
return;
|
|
11958
|
-
}
|
|
11959
|
-
if (reason === "selectOption" || reason === "removeOption") {
|
|
11960
|
-
const added = normalizedValue.filter(
|
|
11961
|
-
(item) => !selectedValues.some((v) => v.value === item.value)
|
|
11962
|
-
);
|
|
11963
|
-
const removed = selectedValues.filter(
|
|
11964
|
-
(item) => !normalizedValue.some((v) => v.value === item.value)
|
|
11965
|
-
);
|
|
11966
|
-
added.forEach((item) => onAdd == null ? void 0 : onAdd(item));
|
|
11967
|
-
removed.forEach((item) => onRemove == null ? void 0 : onRemove(item));
|
|
11968
|
-
}
|
|
11969
|
-
setFieldValue(name, normalizedValue, true);
|
|
11970
|
-
externalOnChange == null ? void 0 : externalOnChange(event, normalizedValue, reason);
|
|
11971
|
-
},
|
|
11972
|
-
[
|
|
11973
|
-
maxSelections,
|
|
11974
|
-
selectedValues,
|
|
11975
|
-
setFieldValue,
|
|
11976
|
-
name,
|
|
11977
|
-
onMaxSelectionsReached,
|
|
11978
|
-
onAdd,
|
|
11979
|
-
onRemove,
|
|
11980
|
-
externalOnChange
|
|
11981
|
-
]
|
|
11982
|
-
);
|
|
11983
|
-
const handleInputChange = react.useCallback(
|
|
11984
|
-
(event, value, reason) => {
|
|
11985
|
-
setSearchQuery == null ? void 0 : setSearchQuery(value);
|
|
11986
|
-
externalOnInputChange == null ? void 0 : externalOnInputChange(event, value, reason);
|
|
11987
|
-
},
|
|
11988
|
-
[setSearchQuery, externalOnInputChange]
|
|
11989
|
-
);
|
|
11990
|
-
const handleBlur = react.useCallback(
|
|
11991
|
-
(event) => {
|
|
11992
|
-
setFieldTouched(name, true, true);
|
|
11993
|
-
externalOnBlur == null ? void 0 : externalOnBlur(event);
|
|
11994
|
-
},
|
|
11995
|
-
[name, setFieldTouched, externalOnBlur]
|
|
11996
|
-
);
|
|
11997
|
-
const handleFocus = react.useCallback(
|
|
11998
|
-
(event) => {
|
|
11999
|
-
externalOnFocus == null ? void 0 : externalOnFocus(event);
|
|
12000
|
-
},
|
|
12001
|
-
[externalOnFocus]
|
|
12002
|
-
);
|
|
12003
|
-
const filterOptions = react.useCallback(
|
|
12004
|
-
(options2, { inputValue }) => {
|
|
12005
|
-
if (!inputValue)
|
|
12006
|
-
return options2;
|
|
12007
|
-
const inputValueLower = inputValue.toLowerCase();
|
|
12008
|
-
return options2.filter(
|
|
12009
|
-
(option) => {
|
|
12010
|
-
var _a, _b, _c, _d;
|
|
12011
|
-
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValueLower)) || String(option.value).toLowerCase().includes(inputValueLower) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValueLower)) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValueLower)) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValueLower));
|
|
12012
|
-
}
|
|
12013
|
-
);
|
|
12014
|
-
},
|
|
12015
|
-
[]
|
|
12016
|
-
);
|
|
12017
|
-
const defaultRenderInput = react.useCallback(
|
|
12018
|
-
(params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12019
|
-
material.TextField,
|
|
12020
|
-
{
|
|
12021
|
-
...params,
|
|
12022
|
-
variant,
|
|
12023
|
-
error: hasError,
|
|
12024
|
-
helperText: "",
|
|
12025
|
-
placeholder: "",
|
|
12026
|
-
inputRef: inputProps.ref,
|
|
12027
|
-
inputProps: {
|
|
12028
|
-
...params.inputProps,
|
|
12029
|
-
...inputProps,
|
|
12030
|
-
className: `${params.inputProps.className || ""} ${inputClassName}`.trim()
|
|
12031
|
-
},
|
|
12032
|
-
InputProps: {
|
|
12033
|
-
...params.InputProps,
|
|
12034
|
-
...textFieldProps.InputProps,
|
|
12035
|
-
className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
|
|
12036
|
-
},
|
|
12037
|
-
sx: [
|
|
12038
|
-
{
|
|
12039
|
-
"& .MuiOutlinedInput-root": {
|
|
12040
|
-
borderRadius: "8px",
|
|
12041
|
-
"& fieldset": {
|
|
12042
|
-
borderColor: hasError ? "error.main" : "divider"
|
|
12043
|
-
},
|
|
12044
|
-
"&:hover fieldset": {
|
|
12045
|
-
borderColor: hasError ? "error.main" : "text.primary"
|
|
12046
|
-
},
|
|
12047
|
-
"&.Mui-focused fieldset": {
|
|
12048
|
-
borderColor: hasError ? "error.main" : "primary.main"
|
|
12049
|
-
}
|
|
12050
|
-
}
|
|
12051
|
-
},
|
|
12052
|
-
...Array.isArray(textFieldSx) ? textFieldSx : textFieldSx ? [textFieldSx] : []
|
|
12053
|
-
],
|
|
12054
|
-
...textFieldProps
|
|
12055
|
-
}
|
|
12056
|
-
),
|
|
12057
|
-
[
|
|
11904
|
+
const selectedOption = options.find((option) => option.value === val) || null;
|
|
11905
|
+
const handleChange = (event, newValue) => {
|
|
11906
|
+
setFieldValue(name, newValue ? newValue.value : "");
|
|
11907
|
+
};
|
|
11908
|
+
const handleSearchChange = (event) => {
|
|
11909
|
+
const { value } = event.target;
|
|
11910
|
+
if (setSearchQuery) {
|
|
11911
|
+
setSearchQuery(value);
|
|
11912
|
+
}
|
|
11913
|
+
};
|
|
11914
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11915
|
+
material.FormControl,
|
|
11916
|
+
{
|
|
11917
|
+
fullWidth: true,
|
|
12058
11918
|
variant,
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
{
|
|
12071
|
-
...props2,
|
|
12072
|
-
key: option.value,
|
|
12073
|
-
className: `${props2.className || ""} ${optionClassName}`.trim(),
|
|
12074
|
-
style: {
|
|
12075
|
-
...props2.style,
|
|
12076
|
-
opacity: option.disabled ? 0.5 : 1,
|
|
12077
|
-
pointerEvents: option.disabled ? "none" : "auto"
|
|
11919
|
+
error: isTouched && Boolean(fieldError),
|
|
11920
|
+
sx: {
|
|
11921
|
+
padding: "0px !important",
|
|
11922
|
+
".MuiAutocomplete-endAdornment": { right: "0 !important" },
|
|
11923
|
+
".MuiInputBase-root": {
|
|
11924
|
+
padding: "0px !important",
|
|
11925
|
+
pr: "39px !important",
|
|
11926
|
+
pl: "10px !important"
|
|
11927
|
+
},
|
|
11928
|
+
".MuiOutlinedInput-root": {
|
|
11929
|
+
backgroundColor: (theme) => `${theme.palette.common.white} !important`
|
|
12078
11930
|
}
|
|
12079
11931
|
},
|
|
12080
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12081
|
-
material.
|
|
12082
|
-
{
|
|
12083
|
-
checked: selected,
|
|
12084
|
-
disabled: option.disabled,
|
|
12085
|
-
sx: {
|
|
12086
|
-
color: "text.secondary",
|
|
12087
|
-
"&.Mui-checked": {
|
|
12088
|
-
color: "primary.main"
|
|
12089
|
-
},
|
|
12090
|
-
"&.Mui-disabled": {
|
|
12091
|
-
color: "text.disabled"
|
|
12092
|
-
},
|
|
12093
|
-
mr: 1,
|
|
12094
|
-
...checkboxProps.sx
|
|
12095
|
-
},
|
|
12096
|
-
...checkboxProps
|
|
12097
|
-
}
|
|
12098
|
-
),
|
|
12099
|
-
option.icon && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
12100
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12101
|
-
material.Typography,
|
|
11932
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11933
|
+
material.Autocomplete,
|
|
12102
11934
|
{
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
)
|
|
12114
|
-
),
|
|
12115
|
-
[optionClassName, checkboxProps, optionSx]
|
|
12116
|
-
);
|
|
12117
|
-
const defaultRenderTags = react.useCallback(
|
|
12118
|
-
(value, getTagProps) => /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
|
|
12119
|
-
const { key, ...tagProps } = getTagProps({ index });
|
|
12120
|
-
return /* @__PURE__ */ react.createElement(
|
|
12121
|
-
material.Chip,
|
|
12122
|
-
{
|
|
12123
|
-
...tagProps,
|
|
12124
|
-
key: option.value,
|
|
12125
|
-
label: option.label,
|
|
12126
|
-
disabled: disabled || option.disabled,
|
|
12127
|
-
sx: [
|
|
12128
|
-
{
|
|
12129
|
-
height: "24px",
|
|
12130
|
-
borderRadius: "4px",
|
|
12131
|
-
"& .MuiChip-deleteIcon": {
|
|
12132
|
-
color: "text.secondary",
|
|
12133
|
-
"&:hover": {
|
|
12134
|
-
color: "text.primary"
|
|
12135
|
-
}
|
|
11935
|
+
options,
|
|
11936
|
+
getOptionLabel: (option) => option.label || String(option.value),
|
|
11937
|
+
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
11938
|
+
value: selectedOption,
|
|
11939
|
+
onChange: handleChange,
|
|
11940
|
+
filterOptions: (options2, { inputValue }) => {
|
|
11941
|
+
return options2.filter(
|
|
11942
|
+
(option) => {
|
|
11943
|
+
var _a, _b, _c, _d;
|
|
11944
|
+
return ((_a = option == null ? void 0 : option.label) == null ? void 0 : _a.toLowerCase().includes(inputValue.toLowerCase())) || String(option.value).toLowerCase().includes(inputValue.toLowerCase()) || ((_b = option == null ? void 0 : option.searchAbleValue1) == null ? void 0 : _b.toLowerCase().includes(inputValue.toLowerCase())) || ((_c = option == null ? void 0 : option.searchAbleValue2) == null ? void 0 : _c.toLowerCase().includes(inputValue.toLowerCase())) || ((_d = option == null ? void 0 : option.searchAbleValue3) == null ? void 0 : _d.toLowerCase().includes(inputValue.toLowerCase()));
|
|
12136
11945
|
}
|
|
12137
|
-
|
|
12138
|
-
...Array.isArray(chipSx) ? chipSx : [chipSx]
|
|
12139
|
-
],
|
|
12140
|
-
className: `${chipClassName} ${option.disabled ? "Mui-disabled" : ""}`.trim(),
|
|
12141
|
-
...chipProps
|
|
12142
|
-
}
|
|
12143
|
-
);
|
|
12144
|
-
}) }),
|
|
12145
|
-
[disabled, chipSx, chipClassName, chipProps]
|
|
12146
|
-
);
|
|
12147
|
-
const renderSelectedCount = react.useCallback(() => {
|
|
12148
|
-
if (!showSelectedCount || !multiple)
|
|
12149
|
-
return null;
|
|
12150
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12151
|
-
material.Typography,
|
|
12152
|
-
{
|
|
12153
|
-
variant: "caption",
|
|
12154
|
-
sx: [
|
|
12155
|
-
{
|
|
12156
|
-
mt: 0.5,
|
|
12157
|
-
color: "text.secondary"
|
|
11946
|
+
);
|
|
12158
11947
|
},
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
children: [
|
|
12162
|
-
`${selectedCount} selected`,
|
|
12163
|
-
maxSelections ? ` (max ${maxSelections})` : ""
|
|
12164
|
-
]
|
|
12165
|
-
}
|
|
12166
|
-
);
|
|
12167
|
-
}, [
|
|
12168
|
-
showSelectedCount,
|
|
12169
|
-
multiple,
|
|
12170
|
-
selectedCount,
|
|
12171
|
-
maxSelections,
|
|
12172
|
-
selectedCountSx
|
|
12173
|
-
]);
|
|
12174
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12175
|
-
material.Box,
|
|
12176
|
-
{
|
|
12177
|
-
ref,
|
|
12178
|
-
className: `app-searchable-multi-selector ${className}`.trim(),
|
|
12179
|
-
sx: [{ width: "100%" }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
12180
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12181
|
-
material.FormControl,
|
|
12182
|
-
{
|
|
12183
|
-
fullWidth: true,
|
|
12184
|
-
error: hasError,
|
|
12185
|
-
disabled,
|
|
12186
|
-
className: `app-searchable-multi-selector-form-control ${formControlClassName}`.trim(),
|
|
12187
|
-
sx: [
|
|
11948
|
+
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11949
|
+
material.TextField,
|
|
12188
11950
|
{
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
11951
|
+
...params,
|
|
11952
|
+
onChange: handleSearchChange,
|
|
11953
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11954
|
+
label,
|
|
11955
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { color: "red" }, component: "span", children: " *" })
|
|
11956
|
+
] }),
|
|
11957
|
+
variant,
|
|
11958
|
+
placeholder,
|
|
11959
|
+
error: Boolean(fieldError) && isTouched,
|
|
11960
|
+
helperText: isTouched && fieldError ? fieldError : "",
|
|
11961
|
+
FormHelperTextProps: {
|
|
11962
|
+
sx: { color: "#FF5630" }
|
|
11963
|
+
},
|
|
11964
|
+
sx: {
|
|
11965
|
+
"& .MuiInputLabel-root": {
|
|
11966
|
+
color: "text.primary"
|
|
12192
11967
|
},
|
|
12193
|
-
"& .
|
|
12194
|
-
|
|
12195
|
-
}
|
|
12196
|
-
}
|
|
12197
|
-
},
|
|
12198
|
-
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
12199
|
-
],
|
|
12200
|
-
children: [
|
|
12201
|
-
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12202
|
-
LabelComponent,
|
|
12203
|
-
{
|
|
12204
|
-
shrink: true,
|
|
12205
|
-
htmlFor: `autocomplete-${name}`,
|
|
12206
|
-
className: `app-searchable-multi-selector-label ${labelClassName}`.trim(),
|
|
12207
|
-
sx: [
|
|
12208
|
-
{
|
|
12209
|
-
mb: 1,
|
|
12210
|
-
color: hasError ? "error.main" : "text.primary",
|
|
12211
|
-
"&.Mui-focused": {
|
|
12212
|
-
color: hasError ? "error.main" : "primary.main"
|
|
12213
|
-
}
|
|
12214
|
-
},
|
|
12215
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
12216
|
-
],
|
|
12217
|
-
...labelProps,
|
|
12218
|
-
children: [
|
|
12219
|
-
label,
|
|
12220
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
|
|
12221
|
-
]
|
|
12222
|
-
}
|
|
12223
|
-
),
|
|
12224
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12225
|
-
material.Autocomplete,
|
|
12226
|
-
{
|
|
12227
|
-
multiple,
|
|
12228
|
-
id: `autocomplete-${name}`,
|
|
12229
|
-
options,
|
|
12230
|
-
value: selectedValues,
|
|
12231
|
-
filterOptions,
|
|
12232
|
-
onInputChange: handleInputChange,
|
|
12233
|
-
onChange: handleChange,
|
|
12234
|
-
onOpen,
|
|
12235
|
-
onClose,
|
|
12236
|
-
onBlur: handleBlur,
|
|
12237
|
-
onFocus: handleFocus,
|
|
12238
|
-
disableCloseOnSelect: multiple,
|
|
12239
|
-
readOnly,
|
|
12240
|
-
disabled,
|
|
12241
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
12242
|
-
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
12243
|
-
getOptionDisabled: (option) => !!option.disabled,
|
|
12244
|
-
renderInput: externalRenderInput || defaultRenderInput,
|
|
12245
|
-
renderOption: externalRenderOption || defaultRenderOption,
|
|
12246
|
-
renderTags: externalRenderTags || defaultRenderTags,
|
|
12247
|
-
renderGroup: externalRenderGroup,
|
|
12248
|
-
ListboxProps: {
|
|
12249
|
-
className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
|
|
12250
|
-
sx: [
|
|
12251
|
-
{
|
|
12252
|
-
"& .MuiAutocomplete-option": {
|
|
12253
|
-
px: 2,
|
|
12254
|
-
py: 1,
|
|
12255
|
-
'&[aria-selected="true"]': {
|
|
12256
|
-
backgroundColor: "action.selected",
|
|
12257
|
-
"&.Mui-focused": {
|
|
12258
|
-
backgroundColor: "action.hover"
|
|
12259
|
-
}
|
|
12260
|
-
},
|
|
12261
|
-
"&.Mui-focused": {
|
|
12262
|
-
backgroundColor: "action.hover"
|
|
12263
|
-
}
|
|
12264
|
-
}
|
|
12265
|
-
},
|
|
12266
|
-
...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
|
|
12267
|
-
...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
|
|
12268
|
-
]
|
|
11968
|
+
"& .MuiInputLabel-root.Mui-focused": {
|
|
11969
|
+
color: "text.primary"
|
|
12269
11970
|
},
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
}
|
|
12280
|
-
},
|
|
12281
|
-
...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
|
|
12282
|
-
],
|
|
12283
|
-
...autocompleteProps,
|
|
12284
|
-
...otherProps
|
|
12285
|
-
}
|
|
12286
|
-
),
|
|
12287
|
-
(showHelperText || hasError) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12288
|
-
HelperTextComponent,
|
|
12289
|
-
{
|
|
12290
|
-
error: hasError,
|
|
12291
|
-
sx: [
|
|
12292
|
-
{
|
|
12293
|
-
mx: 0,
|
|
12294
|
-
mt: 0.5,
|
|
12295
|
-
...hasError ? { color: "error.main", ...errorSx } : { color: "text.secondary", ...helperTextSx }
|
|
12296
|
-
}
|
|
12297
|
-
],
|
|
12298
|
-
className: `app-searchable-multi-selector-helper-text ${helperTextClassName} ${hasError ? "Mui-error" : ""}`.trim(),
|
|
12299
|
-
...helperTextProps,
|
|
12300
|
-
children: hasError ? fieldError : helperText
|
|
11971
|
+
"& .MuiOutlinedInput-input": {
|
|
11972
|
+
color: "common.black"
|
|
11973
|
+
},
|
|
11974
|
+
"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
11975
|
+
borderColor: "common.white"
|
|
11976
|
+
},
|
|
11977
|
+
"& .MuiSvgIcon-root": {
|
|
11978
|
+
color: "common.black"
|
|
11979
|
+
}
|
|
12301
11980
|
}
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
11981
|
+
}
|
|
11982
|
+
),
|
|
11983
|
+
...otherProps
|
|
12305
11984
|
}
|
|
12306
11985
|
)
|
|
12307
11986
|
}
|
|
12308
11987
|
);
|
|
12309
|
-
}
|
|
12310
|
-
AppSearchableMultiSelector2.displayName = "AppSearchableMultiSelector";
|
|
12311
|
-
var AppSearchableSelect_default = AppSearchableMultiSelector2;
|
|
11988
|
+
}
|
|
12312
11989
|
var AppSelectInput = react.forwardRef(
|
|
12313
11990
|
({
|
|
12314
11991
|
name,
|
|
@@ -12419,9 +12096,16 @@ var AppSelectInput = react.forwardRef(
|
|
|
12419
12096
|
className: "app-select-input",
|
|
12420
12097
|
sx: [
|
|
12421
12098
|
{
|
|
12422
|
-
|
|
12099
|
+
"& .MuiInputLabel-root": {
|
|
12100
|
+
"&.Mui-focused": {
|
|
12101
|
+
color: hasError ? "error.main" : "primary.main"
|
|
12102
|
+
},
|
|
12103
|
+
"&.Mui-disabled": {
|
|
12104
|
+
color: "text.disabled"
|
|
12105
|
+
}
|
|
12106
|
+
}
|
|
12423
12107
|
},
|
|
12424
|
-
...Array.isArray(
|
|
12108
|
+
...Array.isArray(formControlSx) ? formControlSx : [formControlSx].filter(Boolean)
|
|
12425
12109
|
],
|
|
12426
12110
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12427
12111
|
material.FormControl,
|
|
@@ -12433,24 +12117,13 @@ var AppSelectInput = react.forwardRef(
|
|
|
12433
12117
|
className: "app-select-form-control",
|
|
12434
12118
|
sx: [
|
|
12435
12119
|
{
|
|
12436
|
-
position: "relative",
|
|
12437
|
-
"& .MuiOutlinedInput-notchedOutline": {
|
|
12438
|
-
borderWidth: "1px"
|
|
12439
|
-
},
|
|
12440
12120
|
"& .MuiInputLabel-root": {
|
|
12441
|
-
position: "relative",
|
|
12442
|
-
transform: "none",
|
|
12443
|
-
fontSize: "0.875rem",
|
|
12444
|
-
mb: 1,
|
|
12445
12121
|
"&.Mui-focused": {
|
|
12446
12122
|
color: hasError ? "error.main" : "primary.main"
|
|
12447
12123
|
},
|
|
12448
12124
|
"&.Mui-disabled": {
|
|
12449
12125
|
color: "text.disabled"
|
|
12450
12126
|
}
|
|
12451
|
-
},
|
|
12452
|
-
"& .MuiInputLabel-shrink": {
|
|
12453
|
-
transform: "none"
|
|
12454
12127
|
}
|
|
12455
12128
|
},
|
|
12456
12129
|
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
@@ -12462,23 +12135,15 @@ var AppSelectInput = react.forwardRef(
|
|
|
12462
12135
|
id: `select-${name}-label`,
|
|
12463
12136
|
htmlFor: `select-${name}`,
|
|
12464
12137
|
className: "app-select-label",
|
|
12465
|
-
shrink: false,
|
|
12466
12138
|
sx: [
|
|
12467
12139
|
{
|
|
12468
|
-
position: "relative",
|
|
12469
|
-
transform: "none",
|
|
12470
|
-
fontSize: "0.875rem",
|
|
12471
|
-
fontWeight: 500,
|
|
12472
12140
|
color: hasError ? "error.main" : "text.secondary",
|
|
12473
|
-
mb: 1,
|
|
12474
12141
|
"&.Mui-focused": {
|
|
12475
12142
|
color: hasError ? "error.main" : "primary.main"
|
|
12476
12143
|
},
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
},
|
|
12481
|
-
...Array.isArray(labelSx) ? labelSx : [labelSx].filter(Boolean)
|
|
12144
|
+
mb: 1,
|
|
12145
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
12146
|
+
}
|
|
12482
12147
|
],
|
|
12483
12148
|
children: [
|
|
12484
12149
|
label,
|
|
@@ -12509,8 +12174,6 @@ var AppSelectInput = react.forwardRef(
|
|
|
12509
12174
|
onOpen,
|
|
12510
12175
|
onClose,
|
|
12511
12176
|
renderValue,
|
|
12512
|
-
label: void 0,
|
|
12513
|
-
displayEmpty: true,
|
|
12514
12177
|
inputProps: {
|
|
12515
12178
|
readOnly,
|
|
12516
12179
|
...inputProps
|
|
@@ -12521,7 +12184,6 @@ var AppSelectInput = react.forwardRef(
|
|
|
12521
12184
|
{
|
|
12522
12185
|
mt: 1,
|
|
12523
12186
|
boxShadow: theme.shadows[3],
|
|
12524
|
-
maxHeight: 300,
|
|
12525
12187
|
"& .MuiMenuItem-root": {
|
|
12526
12188
|
px: 2,
|
|
12527
12189
|
py: 1,
|
|
@@ -12540,24 +12202,7 @@ var AppSelectInput = react.forwardRef(
|
|
|
12540
12202
|
},
|
|
12541
12203
|
sx: [
|
|
12542
12204
|
{
|
|
12543
|
-
|
|
12544
|
-
minHeight: "1.4375em",
|
|
12545
|
-
padding: "16.5px 14px",
|
|
12546
|
-
"&.MuiInputBase-input": {
|
|
12547
|
-
padding: "16.5px 14px"
|
|
12548
|
-
}
|
|
12549
|
-
},
|
|
12550
|
-
"&.MuiOutlinedInput-root": {
|
|
12551
|
-
"& fieldset": {
|
|
12552
|
-
borderWidth: "1px"
|
|
12553
|
-
},
|
|
12554
|
-
"&:hover fieldset": {
|
|
12555
|
-
borderWidth: "1px"
|
|
12556
|
-
},
|
|
12557
|
-
"&.Mui-focused fieldset": {
|
|
12558
|
-
borderWidth: "2px"
|
|
12559
|
-
}
|
|
12560
|
-
},
|
|
12205
|
+
// Your base styles here
|
|
12561
12206
|
"&.Mui-disabled": {
|
|
12562
12207
|
backgroundColor: "action.disabledBackground",
|
|
12563
12208
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
@@ -12587,7 +12232,6 @@ var AppSelectInput = react.forwardRef(
|
|
|
12587
12232
|
{
|
|
12588
12233
|
mx: 0,
|
|
12589
12234
|
mt: 0.5,
|
|
12590
|
-
fontSize: "0.75rem",
|
|
12591
12235
|
...hasError ? {
|
|
12592
12236
|
color: "error.main",
|
|
12593
12237
|
...errorSx
|
|
@@ -14382,7 +14026,7 @@ exports.AppRadioGroup = AppRadioGroup_default;
|
|
|
14382
14026
|
exports.AppRating = AppRating_default;
|
|
14383
14027
|
exports.AppRichTextEditor = AppRichTextEditor_default;
|
|
14384
14028
|
exports.AppSearchableMultiSelector = AppSearchableMultiSelector_default;
|
|
14385
|
-
exports.AppSearchableSelectInput =
|
|
14029
|
+
exports.AppSearchableSelectInput = AppSearchableSelectInput;
|
|
14386
14030
|
exports.AppSelectInput = AppSelectInput_default;
|
|
14387
14031
|
exports.AppSimpleUploadFile = AppSimpleUploadFile_default;
|
|
14388
14032
|
exports.AppSwitch = AppSwitch;
|