formik-form-components 0.2.24 → 0.2.26
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 +98 -72
- package/dist/index.js +515 -131
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +516 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
|
|
2
|
-
import { forwardRef,
|
|
3
|
-
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete,
|
|
2
|
+
import { forwardRef, useCallback, createElement, memo, useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, Checkbox, Chip, MenuItem, Switch, InputAdornment, IconButton, Tooltip, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Paper, Menu } from '@mui/material';
|
|
4
4
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
5
5
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
6
6
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
@@ -12,8 +12,8 @@ import Autocomplete3 from '@mui/material/Autocomplete';
|
|
|
12
12
|
import Typography9 from '@mui/material/Typography';
|
|
13
13
|
import { Icon } from '@iconify/react';
|
|
14
14
|
import Select from '@mui/material/Select';
|
|
15
|
-
import
|
|
16
|
-
import 'react-phone-input
|
|
15
|
+
import PhoneInput from 'react-phone-number-input';
|
|
16
|
+
import 'react-phone-number-input/style.css';
|
|
17
17
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
18
18
|
import StarterKit from '@tiptap/starter-kit';
|
|
19
19
|
import Link from '@tiptap/extension-link';
|
|
@@ -64,14 +64,16 @@ var AppDatePicker = forwardRef(
|
|
|
64
64
|
onChange: handleChange,
|
|
65
65
|
format,
|
|
66
66
|
disabled,
|
|
67
|
+
slots: {
|
|
68
|
+
openPickerIcon: CalendarMonthIcon
|
|
69
|
+
},
|
|
67
70
|
slotProps: {
|
|
68
71
|
textField: {
|
|
69
72
|
variant: "outlined",
|
|
70
73
|
fullWidth: true,
|
|
71
74
|
error: isTouched && Boolean(fieldError),
|
|
72
75
|
helperText: isTouched && fieldError ? fieldError : void 0,
|
|
73
|
-
sx: textFieldSx
|
|
74
|
-
openPickerIcon: CalendarMonthIcon
|
|
76
|
+
sx: textFieldSx
|
|
75
77
|
}
|
|
76
78
|
},
|
|
77
79
|
...otherProps
|
|
@@ -1475,18 +1477,19 @@ var AppMultiSelector = forwardRef(
|
|
|
1475
1477
|
);
|
|
1476
1478
|
AppMultiSelector.displayName = "AppMultiSelector";
|
|
1477
1479
|
var AppMultiSelector_default = AppMultiSelector;
|
|
1478
|
-
var PhoneInput = PhoneInputComponent;
|
|
1479
1480
|
var AppPhoneNoInput = ({
|
|
1480
1481
|
name,
|
|
1481
1482
|
label,
|
|
1482
1483
|
required = false,
|
|
1483
|
-
defaultCountry = "
|
|
1484
|
-
placeholder,
|
|
1484
|
+
defaultCountry = "US",
|
|
1485
|
+
placeholder = "Enter phone number",
|
|
1485
1486
|
sx,
|
|
1486
1487
|
containerSx,
|
|
1487
1488
|
labelSx,
|
|
1488
1489
|
inputSx,
|
|
1489
|
-
errorSx
|
|
1490
|
+
errorSx,
|
|
1491
|
+
international = true,
|
|
1492
|
+
withCountryCallingCode = true
|
|
1490
1493
|
}) => {
|
|
1491
1494
|
const { values, errors, touched, setFieldValue, setFieldTouched } = useFormikContext();
|
|
1492
1495
|
const fieldError = useMemo(() => _19.get(errors, name), [errors, name]);
|
|
@@ -1525,32 +1528,39 @@ var AppPhoneNoInput = ({
|
|
|
1525
1528
|
}
|
|
1526
1529
|
),
|
|
1527
1530
|
/* @__PURE__ */ jsx(
|
|
1528
|
-
|
|
1531
|
+
Box,
|
|
1529
1532
|
{
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
},
|
|
1548
|
-
containerStyle: {
|
|
1549
|
-
width: "100%"
|
|
1533
|
+
sx: {
|
|
1534
|
+
"& .PhoneInput": {
|
|
1535
|
+
width: "100%"
|
|
1536
|
+
},
|
|
1537
|
+
"& .PhoneInputInput": {
|
|
1538
|
+
width: "100%",
|
|
1539
|
+
border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
|
|
1540
|
+
padding: "10px",
|
|
1541
|
+
borderRadius: "4px",
|
|
1542
|
+
fontFamily: "inherit",
|
|
1543
|
+
fontSize: "inherit",
|
|
1544
|
+
...inputSx
|
|
1545
|
+
},
|
|
1546
|
+
"& .PhoneInputCountrySelect": {
|
|
1547
|
+
border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
|
|
1548
|
+
borderRadius: "4px"
|
|
1549
|
+
}
|
|
1550
1550
|
},
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1551
|
+
children: /* @__PURE__ */ jsx(
|
|
1552
|
+
PhoneInput,
|
|
1553
|
+
{
|
|
1554
|
+
international,
|
|
1555
|
+
withCountryCallingCode,
|
|
1556
|
+
defaultCountry,
|
|
1557
|
+
placeholder,
|
|
1558
|
+
value: values[name],
|
|
1559
|
+
onChange: (value) => setFieldValue(name, value || ""),
|
|
1560
|
+
onBlur: () => setFieldTouched(name, true),
|
|
1561
|
+
error: fieldError ? "Invalid phone number" : void 0
|
|
1562
|
+
}
|
|
1563
|
+
)
|
|
1554
1564
|
}
|
|
1555
1565
|
),
|
|
1556
1566
|
isTouched && fieldError && /* @__PURE__ */ jsx(
|
|
@@ -11830,106 +11840,447 @@ var AppSearchableMultiSelector = forwardRef(
|
|
|
11830
11840
|
);
|
|
11831
11841
|
AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
|
|
11832
11842
|
var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11843
|
+
var AppSearchableMultiSelector2 = forwardRef((props, ref) => {
|
|
11844
|
+
const {
|
|
11845
|
+
name,
|
|
11846
|
+
label,
|
|
11847
|
+
multiple = true,
|
|
11848
|
+
options = [],
|
|
11849
|
+
setSearchQuery,
|
|
11850
|
+
required = false,
|
|
11851
|
+
variant = "outlined",
|
|
11852
|
+
disabled = false,
|
|
11853
|
+
readOnly = false,
|
|
11854
|
+
showHelperText = false,
|
|
11855
|
+
helperText,
|
|
11856
|
+
maxSelections,
|
|
11857
|
+
showSelectedCount = false,
|
|
11858
|
+
sx,
|
|
11859
|
+
formControlSx,
|
|
11860
|
+
labelSx,
|
|
11861
|
+
inputSx,
|
|
11862
|
+
textFieldSx,
|
|
11863
|
+
autocompleteSx,
|
|
11864
|
+
listboxSx,
|
|
11865
|
+
optionSx,
|
|
11866
|
+
chipSx,
|
|
11867
|
+
errorSx,
|
|
11868
|
+
helperTextSx,
|
|
11869
|
+
selectedCountSx,
|
|
11870
|
+
renderInput: externalRenderInput,
|
|
11871
|
+
renderOption: externalRenderOption,
|
|
11872
|
+
renderTags: externalRenderTags,
|
|
11873
|
+
renderGroup: externalRenderGroup,
|
|
11874
|
+
labelComponent: LabelComponent = InputLabel,
|
|
11875
|
+
inputComponent: InputComponent = "input",
|
|
11876
|
+
errorComponent: ErrorComponent = Typography,
|
|
11877
|
+
helperTextComponent: HelperTextComponent = FormHelperText,
|
|
11878
|
+
labelProps = {},
|
|
11879
|
+
inputProps = {},
|
|
11880
|
+
textFieldProps = {},
|
|
11881
|
+
autocompleteProps = {},
|
|
11882
|
+
checkboxProps = {},
|
|
11883
|
+
chipProps = {},
|
|
11884
|
+
errorProps = {},
|
|
11885
|
+
helperTextProps = {},
|
|
11886
|
+
className = "",
|
|
11887
|
+
formControlClassName = "",
|
|
11888
|
+
labelClassName = "",
|
|
11889
|
+
inputClassName = "",
|
|
11890
|
+
textFieldClassName = "",
|
|
11891
|
+
autocompleteClassName = "",
|
|
11892
|
+
listboxClassName = "",
|
|
11893
|
+
optionClassName = "",
|
|
11894
|
+
chipClassName = "",
|
|
11895
|
+
errorClassName = "",
|
|
11896
|
+
helperTextClassName = "",
|
|
11897
|
+
onInputChange: externalOnInputChange,
|
|
11898
|
+
onChange: externalOnChange,
|
|
11899
|
+
onOpen,
|
|
11900
|
+
onClose,
|
|
11901
|
+
onBlur: externalOnBlur,
|
|
11902
|
+
onFocus: externalOnFocus,
|
|
11903
|
+
onClear,
|
|
11904
|
+
onMaxSelectionsReached,
|
|
11905
|
+
onRemove,
|
|
11906
|
+
onAdd,
|
|
11907
|
+
...otherProps
|
|
11908
|
+
} = props;
|
|
11909
|
+
useTheme();
|
|
11910
|
+
const { values, setFieldValue, errors, touched, setFieldTouched } = useFormikContext();
|
|
11845
11911
|
const fieldError = _19.get(errors, name);
|
|
11846
|
-
const isTouched = _19.get(touched, name);
|
|
11912
|
+
const isTouched = Boolean(_19.get(touched, name));
|
|
11913
|
+
const hasError = Boolean(fieldError) && isTouched;
|
|
11847
11914
|
const val = _19.get(values, name);
|
|
11848
|
-
const
|
|
11849
|
-
const
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11915
|
+
const selectedValues = Array.isArray(val) ? val : [];
|
|
11916
|
+
const selectedCount = selectedValues.length;
|
|
11917
|
+
const handleChange = useCallback(
|
|
11918
|
+
(event, value, reason, details) => {
|
|
11919
|
+
const normalizedValue = (() => {
|
|
11920
|
+
if (value === null)
|
|
11921
|
+
return [];
|
|
11922
|
+
const arr = Array.isArray(value) ? value : [value];
|
|
11923
|
+
return arr.map(
|
|
11924
|
+
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
11925
|
+
);
|
|
11926
|
+
})();
|
|
11927
|
+
if (maxSelections && normalizedValue.length > maxSelections) {
|
|
11928
|
+
onMaxSelectionsReached == null ? void 0 : onMaxSelectionsReached(maxSelections);
|
|
11929
|
+
return;
|
|
11930
|
+
}
|
|
11931
|
+
if (reason === "selectOption" || reason === "removeOption") {
|
|
11932
|
+
const added = normalizedValue.filter(
|
|
11933
|
+
(item) => !selectedValues.some((v) => v.value === item.value)
|
|
11934
|
+
);
|
|
11935
|
+
const removed = selectedValues.filter(
|
|
11936
|
+
(item) => !normalizedValue.some((v) => v.value === item.value)
|
|
11937
|
+
);
|
|
11938
|
+
added.forEach((item) => onAdd == null ? void 0 : onAdd(item));
|
|
11939
|
+
removed.forEach((item) => onRemove == null ? void 0 : onRemove(item));
|
|
11940
|
+
}
|
|
11941
|
+
setFieldValue(name, normalizedValue, true);
|
|
11942
|
+
externalOnChange == null ? void 0 : externalOnChange(event, normalizedValue, reason);
|
|
11943
|
+
},
|
|
11944
|
+
[
|
|
11945
|
+
maxSelections,
|
|
11946
|
+
selectedValues,
|
|
11947
|
+
setFieldValue,
|
|
11948
|
+
name,
|
|
11949
|
+
onMaxSelectionsReached,
|
|
11950
|
+
onAdd,
|
|
11951
|
+
onRemove,
|
|
11952
|
+
externalOnChange
|
|
11953
|
+
]
|
|
11954
|
+
);
|
|
11955
|
+
const handleInputChange = useCallback(
|
|
11956
|
+
(event, value, reason) => {
|
|
11957
|
+
setSearchQuery == null ? void 0 : setSearchQuery(value);
|
|
11958
|
+
externalOnInputChange == null ? void 0 : externalOnInputChange(event, value, reason);
|
|
11959
|
+
},
|
|
11960
|
+
[setSearchQuery, externalOnInputChange]
|
|
11961
|
+
);
|
|
11962
|
+
const handleBlur = useCallback(
|
|
11963
|
+
(event) => {
|
|
11964
|
+
setFieldTouched(name, true, true);
|
|
11965
|
+
externalOnBlur == null ? void 0 : externalOnBlur(event);
|
|
11966
|
+
},
|
|
11967
|
+
[name, setFieldTouched, externalOnBlur]
|
|
11968
|
+
);
|
|
11969
|
+
const handleFocus = useCallback(
|
|
11970
|
+
(event) => {
|
|
11971
|
+
externalOnFocus == null ? void 0 : externalOnFocus(event);
|
|
11972
|
+
},
|
|
11973
|
+
[externalOnFocus]
|
|
11974
|
+
);
|
|
11975
|
+
const filterOptions = useCallback(
|
|
11976
|
+
(options2, { inputValue }) => {
|
|
11977
|
+
if (!inputValue)
|
|
11978
|
+
return options2;
|
|
11979
|
+
const inputValueLower = inputValue.toLowerCase();
|
|
11980
|
+
return options2.filter(
|
|
11981
|
+
(option) => {
|
|
11982
|
+
var _a, _b, _c, _d;
|
|
11983
|
+
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));
|
|
11984
|
+
}
|
|
11985
|
+
);
|
|
11986
|
+
},
|
|
11987
|
+
[]
|
|
11988
|
+
);
|
|
11989
|
+
const defaultRenderInput = useCallback(
|
|
11990
|
+
(params) => /* @__PURE__ */ jsx(
|
|
11991
|
+
TextField,
|
|
11992
|
+
{
|
|
11993
|
+
...params,
|
|
11994
|
+
variant,
|
|
11995
|
+
error: hasError,
|
|
11996
|
+
helperText: "",
|
|
11997
|
+
placeholder: "",
|
|
11998
|
+
inputRef: inputProps.ref,
|
|
11999
|
+
inputProps: {
|
|
12000
|
+
...params.inputProps,
|
|
12001
|
+
...inputProps,
|
|
12002
|
+
className: `${params.inputProps.className || ""} ${inputClassName}`.trim()
|
|
11871
12003
|
},
|
|
11872
|
-
|
|
11873
|
-
|
|
12004
|
+
InputProps: {
|
|
12005
|
+
...params.InputProps,
|
|
12006
|
+
...textFieldProps.InputProps,
|
|
12007
|
+
className: `${params.InputProps.className || ""} ${textFieldClassName}`.trim()
|
|
12008
|
+
},
|
|
12009
|
+
sx: [
|
|
12010
|
+
{
|
|
12011
|
+
"& .MuiOutlinedInput-root": {
|
|
12012
|
+
borderRadius: "8px",
|
|
12013
|
+
"& fieldset": {
|
|
12014
|
+
borderColor: hasError ? "error.main" : "divider"
|
|
12015
|
+
},
|
|
12016
|
+
"&:hover fieldset": {
|
|
12017
|
+
borderColor: hasError ? "error.main" : "text.primary"
|
|
12018
|
+
},
|
|
12019
|
+
"&.Mui-focused fieldset": {
|
|
12020
|
+
borderColor: hasError ? "error.main" : "primary.main"
|
|
12021
|
+
}
|
|
12022
|
+
}
|
|
12023
|
+
},
|
|
12024
|
+
...Array.isArray(textFieldSx) ? textFieldSx : textFieldSx ? [textFieldSx] : []
|
|
12025
|
+
],
|
|
12026
|
+
...textFieldProps
|
|
12027
|
+
}
|
|
12028
|
+
),
|
|
12029
|
+
[
|
|
12030
|
+
variant,
|
|
12031
|
+
hasError,
|
|
12032
|
+
inputProps,
|
|
12033
|
+
inputClassName,
|
|
12034
|
+
textFieldProps,
|
|
12035
|
+
textFieldClassName,
|
|
12036
|
+
textFieldSx
|
|
12037
|
+
]
|
|
12038
|
+
);
|
|
12039
|
+
const defaultRenderOption = useCallback(
|
|
12040
|
+
(props2, option, { selected }) => /* @__PURE__ */ createElement(
|
|
12041
|
+
"li",
|
|
12042
|
+
{
|
|
12043
|
+
...props2,
|
|
12044
|
+
key: option.value,
|
|
12045
|
+
className: `${props2.className || ""} ${optionClassName}`.trim(),
|
|
12046
|
+
style: {
|
|
12047
|
+
...props2.style,
|
|
12048
|
+
opacity: option.disabled ? 0.5 : 1,
|
|
12049
|
+
pointerEvents: option.disabled ? "none" : "auto"
|
|
11874
12050
|
}
|
|
11875
12051
|
},
|
|
11876
|
-
|
|
11877
|
-
|
|
12052
|
+
/* @__PURE__ */ jsx(
|
|
12053
|
+
Checkbox,
|
|
11878
12054
|
{
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
12055
|
+
checked: selected,
|
|
12056
|
+
disabled: option.disabled,
|
|
12057
|
+
sx: {
|
|
12058
|
+
color: "text.secondary",
|
|
12059
|
+
"&.Mui-checked": {
|
|
12060
|
+
color: "primary.main"
|
|
12061
|
+
},
|
|
12062
|
+
"&.Mui-disabled": {
|
|
12063
|
+
color: "text.disabled"
|
|
12064
|
+
},
|
|
12065
|
+
mr: 1,
|
|
12066
|
+
...checkboxProps.sx
|
|
11891
12067
|
},
|
|
11892
|
-
|
|
11893
|
-
|
|
12068
|
+
...checkboxProps
|
|
12069
|
+
}
|
|
12070
|
+
),
|
|
12071
|
+
option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
|
|
12072
|
+
/* @__PURE__ */ jsx(
|
|
12073
|
+
Typography,
|
|
12074
|
+
{
|
|
12075
|
+
variant: "body2",
|
|
12076
|
+
sx: [
|
|
11894
12077
|
{
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
12078
|
+
color: option.disabled ? "text.disabled" : "text.primary",
|
|
12079
|
+
...option.textSx
|
|
12080
|
+
},
|
|
12081
|
+
...Array.isArray(optionSx) ? optionSx : [optionSx]
|
|
12082
|
+
],
|
|
12083
|
+
children: option.label
|
|
12084
|
+
}
|
|
12085
|
+
)
|
|
12086
|
+
),
|
|
12087
|
+
[optionClassName, checkboxProps, optionSx]
|
|
12088
|
+
);
|
|
12089
|
+
const defaultRenderTags = useCallback(
|
|
12090
|
+
(value, getTagProps) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.5, mt: 0.5 }, children: value.map((option, index) => {
|
|
12091
|
+
const { key, ...tagProps } = getTagProps({ index });
|
|
12092
|
+
return /* @__PURE__ */ createElement(
|
|
12093
|
+
Chip,
|
|
12094
|
+
{
|
|
12095
|
+
...tagProps,
|
|
12096
|
+
key: option.value,
|
|
12097
|
+
label: option.label,
|
|
12098
|
+
disabled: disabled || option.disabled,
|
|
12099
|
+
sx: [
|
|
12100
|
+
{
|
|
12101
|
+
height: "24px",
|
|
12102
|
+
borderRadius: "4px",
|
|
12103
|
+
"& .MuiChip-deleteIcon": {
|
|
12104
|
+
color: "text.secondary",
|
|
12105
|
+
"&:hover": {
|
|
11913
12106
|
color: "text.primary"
|
|
12107
|
+
}
|
|
12108
|
+
}
|
|
12109
|
+
},
|
|
12110
|
+
...Array.isArray(chipSx) ? chipSx : [chipSx]
|
|
12111
|
+
],
|
|
12112
|
+
className: `${chipClassName} ${option.disabled ? "Mui-disabled" : ""}`.trim(),
|
|
12113
|
+
...chipProps
|
|
12114
|
+
}
|
|
12115
|
+
);
|
|
12116
|
+
}) }),
|
|
12117
|
+
[disabled, chipSx, chipClassName, chipProps]
|
|
12118
|
+
);
|
|
12119
|
+
const renderSelectedCount = useCallback(() => {
|
|
12120
|
+
if (!showSelectedCount || !multiple)
|
|
12121
|
+
return null;
|
|
12122
|
+
return /* @__PURE__ */ jsxs(
|
|
12123
|
+
Typography,
|
|
12124
|
+
{
|
|
12125
|
+
variant: "caption",
|
|
12126
|
+
sx: [
|
|
12127
|
+
{
|
|
12128
|
+
mt: 0.5,
|
|
12129
|
+
color: "text.secondary"
|
|
12130
|
+
},
|
|
12131
|
+
...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
|
|
12132
|
+
],
|
|
12133
|
+
children: [
|
|
12134
|
+
`${selectedCount} selected`,
|
|
12135
|
+
maxSelections ? ` (max ${maxSelections})` : ""
|
|
12136
|
+
]
|
|
12137
|
+
}
|
|
12138
|
+
);
|
|
12139
|
+
}, [
|
|
12140
|
+
showSelectedCount,
|
|
12141
|
+
multiple,
|
|
12142
|
+
selectedCount,
|
|
12143
|
+
maxSelections,
|
|
12144
|
+
selectedCountSx
|
|
12145
|
+
]);
|
|
12146
|
+
return /* @__PURE__ */ jsx(
|
|
12147
|
+
Box,
|
|
12148
|
+
{
|
|
12149
|
+
ref,
|
|
12150
|
+
className: `app-searchable-multi-selector ${className}`.trim(),
|
|
12151
|
+
sx: [{ width: "100%" }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
12152
|
+
children: /* @__PURE__ */ jsxs(
|
|
12153
|
+
FormControl,
|
|
12154
|
+
{
|
|
12155
|
+
fullWidth: true,
|
|
12156
|
+
error: hasError,
|
|
12157
|
+
disabled,
|
|
12158
|
+
className: `app-searchable-multi-selector-form-control ${formControlClassName}`.trim(),
|
|
12159
|
+
sx: [
|
|
12160
|
+
{
|
|
12161
|
+
"& .MuiAutocomplete-root": {
|
|
12162
|
+
"& .MuiOutlinedInput-root": {
|
|
12163
|
+
padding: "4px"
|
|
11914
12164
|
},
|
|
11915
|
-
"& .
|
|
11916
|
-
|
|
11917
|
-
},
|
|
11918
|
-
"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
11919
|
-
borderColor: "common.white"
|
|
11920
|
-
},
|
|
11921
|
-
"& .MuiSvgIcon-root": {
|
|
11922
|
-
color: "common.black"
|
|
12165
|
+
"& .MuiAutocomplete-input": {
|
|
12166
|
+
padding: "8.5px 4px"
|
|
11923
12167
|
}
|
|
11924
12168
|
}
|
|
11925
|
-
}
|
|
11926
|
-
|
|
11927
|
-
|
|
12169
|
+
},
|
|
12170
|
+
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
12171
|
+
],
|
|
12172
|
+
children: [
|
|
12173
|
+
label && /* @__PURE__ */ jsxs(
|
|
12174
|
+
LabelComponent,
|
|
12175
|
+
{
|
|
12176
|
+
shrink: true,
|
|
12177
|
+
htmlFor: `autocomplete-${name}`,
|
|
12178
|
+
className: `app-searchable-multi-selector-label ${labelClassName}`.trim(),
|
|
12179
|
+
sx: [
|
|
12180
|
+
{
|
|
12181
|
+
mb: 1,
|
|
12182
|
+
color: hasError ? "error.main" : "text.primary",
|
|
12183
|
+
"&.Mui-focused": {
|
|
12184
|
+
color: hasError ? "error.main" : "primary.main"
|
|
12185
|
+
}
|
|
12186
|
+
},
|
|
12187
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx]
|
|
12188
|
+
],
|
|
12189
|
+
...labelProps,
|
|
12190
|
+
children: [
|
|
12191
|
+
label,
|
|
12192
|
+
required && /* @__PURE__ */ jsx(Box, { component: "span", sx: { color: "error.main", ml: 0.5 }, children: "*" })
|
|
12193
|
+
]
|
|
12194
|
+
}
|
|
12195
|
+
),
|
|
12196
|
+
/* @__PURE__ */ jsx(
|
|
12197
|
+
Autocomplete,
|
|
12198
|
+
{
|
|
12199
|
+
multiple,
|
|
12200
|
+
id: `autocomplete-${name}`,
|
|
12201
|
+
options,
|
|
12202
|
+
value: selectedValues,
|
|
12203
|
+
filterOptions,
|
|
12204
|
+
onInputChange: handleInputChange,
|
|
12205
|
+
onChange: handleChange,
|
|
12206
|
+
onOpen,
|
|
12207
|
+
onClose,
|
|
12208
|
+
onBlur: handleBlur,
|
|
12209
|
+
onFocus: handleFocus,
|
|
12210
|
+
disableCloseOnSelect: multiple,
|
|
12211
|
+
readOnly,
|
|
12212
|
+
disabled,
|
|
12213
|
+
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
12214
|
+
getOptionLabel: (option) => typeof option === "string" ? option : option.label,
|
|
12215
|
+
getOptionDisabled: (option) => !!option.disabled,
|
|
12216
|
+
renderInput: externalRenderInput || defaultRenderInput,
|
|
12217
|
+
renderOption: externalRenderOption || defaultRenderOption,
|
|
12218
|
+
renderTags: externalRenderTags || defaultRenderTags,
|
|
12219
|
+
renderGroup: externalRenderGroup,
|
|
12220
|
+
ListboxProps: {
|
|
12221
|
+
className: `app-searchable-multi-selector-listbox ${listboxClassName}`.trim(),
|
|
12222
|
+
sx: [
|
|
12223
|
+
{
|
|
12224
|
+
"& .MuiAutocomplete-option": {
|
|
12225
|
+
px: 2,
|
|
12226
|
+
py: 1,
|
|
12227
|
+
'&[aria-selected="true"]': {
|
|
12228
|
+
backgroundColor: "action.selected",
|
|
12229
|
+
"&.Mui-focused": {
|
|
12230
|
+
backgroundColor: "action.hover"
|
|
12231
|
+
}
|
|
12232
|
+
},
|
|
12233
|
+
"&.Mui-focused": {
|
|
12234
|
+
backgroundColor: "action.hover"
|
|
12235
|
+
}
|
|
12236
|
+
}
|
|
12237
|
+
},
|
|
12238
|
+
...Array.isArray(optionSx) ? optionSx : optionSx ? [optionSx] : [],
|
|
12239
|
+
...Array.isArray(listboxSx) ? listboxSx : listboxSx ? [listboxSx] : []
|
|
12240
|
+
]
|
|
12241
|
+
},
|
|
12242
|
+
className: `app-searchable-multi-selector-autocomplete ${autocompleteClassName}`.trim(),
|
|
12243
|
+
sx: [
|
|
12244
|
+
{
|
|
12245
|
+
"& .MuiAutocomplete-tag": {
|
|
12246
|
+
margin: 0,
|
|
12247
|
+
height: "auto"
|
|
12248
|
+
},
|
|
12249
|
+
"& .MuiAutocomplete-endAdornment": {
|
|
12250
|
+
right: 8
|
|
12251
|
+
}
|
|
12252
|
+
},
|
|
12253
|
+
...Array.isArray(autocompleteSx) ? autocompleteSx : autocompleteSx ? [autocompleteSx] : []
|
|
12254
|
+
],
|
|
12255
|
+
...autocompleteProps,
|
|
12256
|
+
...otherProps
|
|
12257
|
+
}
|
|
12258
|
+
),
|
|
12259
|
+
(showHelperText || hasError) && /* @__PURE__ */ jsx(
|
|
12260
|
+
HelperTextComponent,
|
|
12261
|
+
{
|
|
12262
|
+
error: hasError,
|
|
12263
|
+
sx: [
|
|
12264
|
+
{
|
|
12265
|
+
mx: 0,
|
|
12266
|
+
mt: 0.5,
|
|
12267
|
+
...hasError ? { color: "error.main", ...errorSx } : { color: "text.secondary", ...helperTextSx }
|
|
12268
|
+
}
|
|
12269
|
+
],
|
|
12270
|
+
className: `app-searchable-multi-selector-helper-text ${helperTextClassName} ${hasError ? "Mui-error" : ""}`.trim(),
|
|
12271
|
+
...helperTextProps,
|
|
12272
|
+
children: hasError ? fieldError : helperText
|
|
12273
|
+
}
|
|
12274
|
+
),
|
|
12275
|
+
renderSelectedCount()
|
|
12276
|
+
]
|
|
11928
12277
|
}
|
|
11929
12278
|
)
|
|
11930
12279
|
}
|
|
11931
12280
|
);
|
|
11932
|
-
}
|
|
12281
|
+
});
|
|
12282
|
+
AppSearchableMultiSelector2.displayName = "AppSearchableMultiSelector";
|
|
12283
|
+
var AppSearchableSelect_default = AppSearchableMultiSelector2;
|
|
11933
12284
|
var AppSelectInput = forwardRef(
|
|
11934
12285
|
({
|
|
11935
12286
|
name,
|
|
@@ -12040,16 +12391,9 @@ var AppSelectInput = forwardRef(
|
|
|
12040
12391
|
className: "app-select-input",
|
|
12041
12392
|
sx: [
|
|
12042
12393
|
{
|
|
12043
|
-
"
|
|
12044
|
-
"&.Mui-focused": {
|
|
12045
|
-
color: hasError ? "error.main" : "primary.main"
|
|
12046
|
-
},
|
|
12047
|
-
"&.Mui-disabled": {
|
|
12048
|
-
color: "text.disabled"
|
|
12049
|
-
}
|
|
12050
|
-
}
|
|
12394
|
+
width: fullWidth ? "100%" : "auto"
|
|
12051
12395
|
},
|
|
12052
|
-
...Array.isArray(
|
|
12396
|
+
...Array.isArray(sx) ? sx : [sx].filter(Boolean)
|
|
12053
12397
|
],
|
|
12054
12398
|
children: /* @__PURE__ */ jsxs(
|
|
12055
12399
|
FormControl,
|
|
@@ -12061,13 +12405,24 @@ var AppSelectInput = forwardRef(
|
|
|
12061
12405
|
className: "app-select-form-control",
|
|
12062
12406
|
sx: [
|
|
12063
12407
|
{
|
|
12408
|
+
position: "relative",
|
|
12409
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
12410
|
+
borderWidth: "1px"
|
|
12411
|
+
},
|
|
12064
12412
|
"& .MuiInputLabel-root": {
|
|
12413
|
+
position: "relative",
|
|
12414
|
+
transform: "none",
|
|
12415
|
+
fontSize: "0.875rem",
|
|
12416
|
+
mb: 1,
|
|
12065
12417
|
"&.Mui-focused": {
|
|
12066
12418
|
color: hasError ? "error.main" : "primary.main"
|
|
12067
12419
|
},
|
|
12068
12420
|
"&.Mui-disabled": {
|
|
12069
12421
|
color: "text.disabled"
|
|
12070
12422
|
}
|
|
12423
|
+
},
|
|
12424
|
+
"& .MuiInputLabel-shrink": {
|
|
12425
|
+
transform: "none"
|
|
12071
12426
|
}
|
|
12072
12427
|
},
|
|
12073
12428
|
...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
|
|
@@ -12079,15 +12434,23 @@ var AppSelectInput = forwardRef(
|
|
|
12079
12434
|
id: `select-${name}-label`,
|
|
12080
12435
|
htmlFor: `select-${name}`,
|
|
12081
12436
|
className: "app-select-label",
|
|
12437
|
+
shrink: false,
|
|
12082
12438
|
sx: [
|
|
12083
12439
|
{
|
|
12440
|
+
position: "relative",
|
|
12441
|
+
transform: "none",
|
|
12442
|
+
fontSize: "0.875rem",
|
|
12443
|
+
fontWeight: 500,
|
|
12084
12444
|
color: hasError ? "error.main" : "text.secondary",
|
|
12445
|
+
mb: 1,
|
|
12085
12446
|
"&.Mui-focused": {
|
|
12086
12447
|
color: hasError ? "error.main" : "primary.main"
|
|
12087
12448
|
},
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12449
|
+
"&.Mui-disabled": {
|
|
12450
|
+
color: "text.disabled"
|
|
12451
|
+
}
|
|
12452
|
+
},
|
|
12453
|
+
...Array.isArray(labelSx) ? labelSx : [labelSx].filter(Boolean)
|
|
12091
12454
|
],
|
|
12092
12455
|
children: [
|
|
12093
12456
|
label,
|
|
@@ -12118,6 +12481,8 @@ var AppSelectInput = forwardRef(
|
|
|
12118
12481
|
onOpen,
|
|
12119
12482
|
onClose,
|
|
12120
12483
|
renderValue,
|
|
12484
|
+
label: void 0,
|
|
12485
|
+
displayEmpty: true,
|
|
12121
12486
|
inputProps: {
|
|
12122
12487
|
readOnly,
|
|
12123
12488
|
...inputProps
|
|
@@ -12128,6 +12493,7 @@ var AppSelectInput = forwardRef(
|
|
|
12128
12493
|
{
|
|
12129
12494
|
mt: 1,
|
|
12130
12495
|
boxShadow: theme.shadows[3],
|
|
12496
|
+
maxHeight: 300,
|
|
12131
12497
|
"& .MuiMenuItem-root": {
|
|
12132
12498
|
px: 2,
|
|
12133
12499
|
py: 1,
|
|
@@ -12146,7 +12512,24 @@ var AppSelectInput = forwardRef(
|
|
|
12146
12512
|
},
|
|
12147
12513
|
sx: [
|
|
12148
12514
|
{
|
|
12149
|
-
|
|
12515
|
+
"& .MuiSelect-select": {
|
|
12516
|
+
minHeight: "1.4375em",
|
|
12517
|
+
padding: "16.5px 14px",
|
|
12518
|
+
"&.MuiInputBase-input": {
|
|
12519
|
+
padding: "16.5px 14px"
|
|
12520
|
+
}
|
|
12521
|
+
},
|
|
12522
|
+
"&.MuiOutlinedInput-root": {
|
|
12523
|
+
"& fieldset": {
|
|
12524
|
+
borderWidth: "1px"
|
|
12525
|
+
},
|
|
12526
|
+
"&:hover fieldset": {
|
|
12527
|
+
borderWidth: "1px"
|
|
12528
|
+
},
|
|
12529
|
+
"&.Mui-focused fieldset": {
|
|
12530
|
+
borderWidth: "2px"
|
|
12531
|
+
}
|
|
12532
|
+
},
|
|
12150
12533
|
"&.Mui-disabled": {
|
|
12151
12534
|
backgroundColor: "action.disabledBackground",
|
|
12152
12535
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
@@ -12176,6 +12559,7 @@ var AppSelectInput = forwardRef(
|
|
|
12176
12559
|
{
|
|
12177
12560
|
mx: 0,
|
|
12178
12561
|
mt: 0.5,
|
|
12562
|
+
fontSize: "0.75rem",
|
|
12179
12563
|
...hasError ? {
|
|
12180
12564
|
color: "error.main",
|
|
12181
12565
|
...errorSx
|
|
@@ -13957,6 +14341,6 @@ var SubmitButton = ({
|
|
|
13957
14341
|
};
|
|
13958
14342
|
var SubmitButton_default = SubmitButton;
|
|
13959
14343
|
|
|
13960
|
-
export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor, AppSearchableMultiSelector_default as AppSearchableMultiSelector, AppSearchableSelectInput, AppSelectInput_default as AppSelectInput, AppSimpleUploadFile_default as AppSimpleUploadFile, AppSwitch, AppSwitchInput, AppTagsCreator, AppTextArea_default as AppTextArea, AppUploadFile_default as AppUploadFile, Form_default as Form, Iconify_default as Iconify, SubmitButton_default as SubmitButton };
|
|
14344
|
+
export { AppAutoComplete, AppAutoCompleter, AppCheckBox_default as AppCheckBox, AppDateAndTimePicker_default as AppDateAndTimePicker, AppDatePicker_default as AppDatePicker, AppFormErrorMessage_default as AppFormErrorMessage, AppInputField, AppMultiSelector_default as AppMultiSelector, AppPhoneNoInput_default as AppPhoneNoInput, AppRadioGroup_default as AppRadioGroup, AppRating_default as AppRating, AppRichTextEditor_default as AppRichTextEditor, AppSearchableMultiSelector_default as AppSearchableMultiSelector, AppSearchableSelect_default as AppSearchableSelectInput, AppSelectInput_default as AppSelectInput, AppSimpleUploadFile_default as AppSimpleUploadFile, AppSwitch, AppSwitchInput, AppTagsCreator, AppTextArea_default as AppTextArea, AppUploadFile_default as AppUploadFile, Form_default as Form, Iconify_default as Iconify, SubmitButton_default as SubmitButton };
|
|
13961
14345
|
//# sourceMappingURL=out.js.map
|
|
13962
14346
|
//# sourceMappingURL=index.mjs.map
|