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.js CHANGED
@@ -14,8 +14,8 @@ var Autocomplete3 = require('@mui/material/Autocomplete');
14
14
  var Typography9 = require('@mui/material/Typography');
15
15
  var react$1 = require('@iconify/react');
16
16
  var Select = require('@mui/material/Select');
17
- var PhoneInputComponent = require('react-phone-input-2');
18
- require('react-phone-input-2/lib/style.css');
17
+ var PhoneInput = require('react-phone-number-input');
18
+ require('react-phone-number-input/style.css');
19
19
  var react$2 = require('@tiptap/react');
20
20
  var StarterKit = require('@tiptap/starter-kit');
21
21
  var Link = require('@tiptap/extension-link');
@@ -47,7 +47,7 @@ var _19__default = /*#__PURE__*/_interopDefault(_19);
47
47
  var Autocomplete3__default = /*#__PURE__*/_interopDefault(Autocomplete3);
48
48
  var Typography9__default = /*#__PURE__*/_interopDefault(Typography9);
49
49
  var Select__default = /*#__PURE__*/_interopDefault(Select);
50
- var PhoneInputComponent__default = /*#__PURE__*/_interopDefault(PhoneInputComponent);
50
+ var PhoneInput__default = /*#__PURE__*/_interopDefault(PhoneInput);
51
51
  var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
52
52
  var Link__default = /*#__PURE__*/_interopDefault(Link);
53
53
  var TextAlign__default = /*#__PURE__*/_interopDefault(TextAlign);
@@ -92,14 +92,16 @@ var AppDatePicker = react.forwardRef(
92
92
  onChange: handleChange,
93
93
  format,
94
94
  disabled,
95
+ slots: {
96
+ openPickerIcon: CalendarMonthIcon__default.default
97
+ },
95
98
  slotProps: {
96
99
  textField: {
97
100
  variant: "outlined",
98
101
  fullWidth: true,
99
102
  error: isTouched && Boolean(fieldError),
100
103
  helperText: isTouched && fieldError ? fieldError : void 0,
101
- sx: textFieldSx,
102
- openPickerIcon: CalendarMonthIcon__default.default
104
+ sx: textFieldSx
103
105
  }
104
106
  },
105
107
  ...otherProps
@@ -1503,18 +1505,19 @@ var AppMultiSelector = react.forwardRef(
1503
1505
  );
1504
1506
  AppMultiSelector.displayName = "AppMultiSelector";
1505
1507
  var AppMultiSelector_default = AppMultiSelector;
1506
- var PhoneInput = PhoneInputComponent__default.default;
1507
1508
  var AppPhoneNoInput = ({
1508
1509
  name,
1509
1510
  label,
1510
1511
  required = false,
1511
- defaultCountry = "us",
1512
- placeholder,
1512
+ defaultCountry = "US",
1513
+ placeholder = "Enter phone number",
1513
1514
  sx,
1514
1515
  containerSx,
1515
1516
  labelSx,
1516
1517
  inputSx,
1517
- errorSx
1518
+ errorSx,
1519
+ international = true,
1520
+ withCountryCallingCode = true
1518
1521
  }) => {
1519
1522
  const { values, errors, touched, setFieldValue, setFieldTouched } = formik.useFormikContext();
1520
1523
  const fieldError = react.useMemo(() => _19__default.default.get(errors, name), [errors, name]);
@@ -1553,32 +1556,39 @@ var AppPhoneNoInput = ({
1553
1556
  }
1554
1557
  ),
1555
1558
  /* @__PURE__ */ jsxRuntime.jsx(
1556
- PhoneInput,
1559
+ material.Box,
1557
1560
  {
1558
- country: defaultCountry,
1559
- specialLabel: "",
1560
- placeholder,
1561
- inputProps: {
1562
- name,
1563
- id: name,
1564
- required,
1565
- "aria-describedby": fieldError ? `${name}-error` : void 0,
1566
- "aria-invalid": !!fieldError,
1567
- "aria-required": required
1568
- },
1569
- inputStyle: {
1570
- width: "100%",
1571
- border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1572
- padding: "10px",
1573
- borderRadius: "4px",
1574
- ...inputSx
1575
- },
1576
- containerStyle: {
1577
- width: "100%"
1561
+ sx: {
1562
+ "& .PhoneInput": {
1563
+ width: "100%"
1564
+ },
1565
+ "& .PhoneInputInput": {
1566
+ width: "100%",
1567
+ border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1568
+ padding: "10px",
1569
+ borderRadius: "4px",
1570
+ fontFamily: "inherit",
1571
+ fontSize: "inherit",
1572
+ ...inputSx
1573
+ },
1574
+ "& .PhoneInputCountrySelect": {
1575
+ border: isTouched && fieldError ? "1px solid #f44336" : "1px solid #ccc",
1576
+ borderRadius: "4px"
1577
+ }
1578
1578
  },
1579
- value: values[name],
1580
- onChange: (value) => setFieldValue(name, value),
1581
- onBlur: () => setFieldTouched(name, true)
1579
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1580
+ PhoneInput__default.default,
1581
+ {
1582
+ international,
1583
+ withCountryCallingCode,
1584
+ defaultCountry,
1585
+ placeholder,
1586
+ value: values[name],
1587
+ onChange: (value) => setFieldValue(name, value || ""),
1588
+ onBlur: () => setFieldTouched(name, true),
1589
+ error: fieldError ? "Invalid phone number" : void 0
1590
+ }
1591
+ )
1582
1592
  }
1583
1593
  ),
1584
1594
  isTouched && fieldError && /* @__PURE__ */ jsxRuntime.jsx(
@@ -11858,106 +11868,447 @@ var AppSearchableMultiSelector = react.forwardRef(
11858
11868
  );
11859
11869
  AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
11860
11870
  var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
11861
- function AppSearchableSelectInput({
11862
- name,
11863
- label,
11864
- options = [],
11865
- required = false,
11866
- variant = "outlined",
11867
- placeholder,
11868
- setSearchQuery,
11869
- isResetRequired,
11870
- ...otherProps
11871
- }) {
11872
- const { errors, touched, setFieldValue, values } = formik.useFormikContext();
11871
+ var AppSearchableMultiSelector2 = react.forwardRef((props, ref) => {
11872
+ const {
11873
+ name,
11874
+ label,
11875
+ multiple = true,
11876
+ options = [],
11877
+ setSearchQuery,
11878
+ required = false,
11879
+ variant = "outlined",
11880
+ disabled = false,
11881
+ readOnly = false,
11882
+ showHelperText = false,
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();
11873
11939
  const fieldError = _19__default.default.get(errors, name);
11874
- const isTouched = _19__default.default.get(touched, name);
11940
+ const isTouched = Boolean(_19__default.default.get(touched, name));
11941
+ const hasError = Boolean(fieldError) && isTouched;
11875
11942
  const val = _19__default.default.get(values, name);
11876
- const selectedOption = options.find((option) => option.value === val) || null;
11877
- const handleChange = (event, newValue) => {
11878
- setFieldValue(name, newValue ? newValue.value : "");
11879
- };
11880
- const handleSearchChange = (event) => {
11881
- const { value } = event.target;
11882
- if (setSearchQuery) {
11883
- setSearchQuery(value);
11884
- }
11885
- };
11886
- return /* @__PURE__ */ jsxRuntime.jsx(
11887
- material.FormControl,
11888
- {
11889
- fullWidth: true,
11890
- variant,
11891
- error: isTouched && Boolean(fieldError),
11892
- sx: {
11893
- padding: "0px !important",
11894
- ".MuiAutocomplete-endAdornment": { right: "0 !important" },
11895
- ".MuiInputBase-root": {
11896
- padding: "0px !important",
11897
- pr: "39px !important",
11898
- pl: "10px !important"
11943
+ const selectedValues = Array.isArray(val) ? val : [];
11944
+ const selectedCount = selectedValues.length;
11945
+ const handleChange = react.useCallback(
11946
+ (event, value, reason, details) => {
11947
+ const normalizedValue = (() => {
11948
+ if (value === null)
11949
+ return [];
11950
+ const arr = Array.isArray(value) ? value : [value];
11951
+ return arr.map(
11952
+ (item) => typeof item === "string" ? { value: item, label: item } : item
11953
+ );
11954
+ })();
11955
+ if (maxSelections && normalizedValue.length > maxSelections) {
11956
+ onMaxSelectionsReached == null ? void 0 : onMaxSelectionsReached(maxSelections);
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()
11899
12031
  },
11900
- ".MuiOutlinedInput-root": {
11901
- backgroundColor: (theme) => `${theme.palette.common.white} !important`
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
+ [
12058
+ variant,
12059
+ hasError,
12060
+ inputProps,
12061
+ inputClassName,
12062
+ textFieldProps,
12063
+ textFieldClassName,
12064
+ textFieldSx
12065
+ ]
12066
+ );
12067
+ const defaultRenderOption = react.useCallback(
12068
+ (props2, option, { selected }) => /* @__PURE__ */ react.createElement(
12069
+ "li",
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"
11902
12078
  }
11903
12079
  },
11904
- children: /* @__PURE__ */ jsxRuntime.jsx(
11905
- material.Autocomplete,
12080
+ /* @__PURE__ */ jsxRuntime.jsx(
12081
+ material.Checkbox,
11906
12082
  {
11907
- options,
11908
- getOptionLabel: (option) => option.label || String(option.value),
11909
- isOptionEqualToValue: (option, value) => option.value === value.value,
11910
- value: selectedOption,
11911
- onChange: handleChange,
11912
- filterOptions: (options2, { inputValue }) => {
11913
- return options2.filter(
11914
- (option) => {
11915
- var _a, _b, _c, _d;
11916
- 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()));
11917
- }
11918
- );
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
11919
12095
  },
11920
- renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
11921
- material.TextField,
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,
12102
+ {
12103
+ variant: "body2",
12104
+ sx: [
11922
12105
  {
11923
- ...params,
11924
- onChange: handleSearchChange,
11925
- label: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11926
- label,
11927
- required && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { color: "red" }, component: "span", children: " *" })
11928
- ] }),
11929
- variant,
11930
- placeholder,
11931
- error: Boolean(fieldError) && isTouched,
11932
- helperText: isTouched && fieldError ? fieldError : "",
11933
- FormHelperTextProps: {
11934
- sx: { color: "#FF5630" }
11935
- },
11936
- sx: {
11937
- "& .MuiInputLabel-root": {
11938
- color: "text.primary"
11939
- },
11940
- "& .MuiInputLabel-root.Mui-focused": {
12106
+ color: option.disabled ? "text.disabled" : "text.primary",
12107
+ ...option.textSx
12108
+ },
12109
+ ...Array.isArray(optionSx) ? optionSx : [optionSx]
12110
+ ],
12111
+ children: option.label
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": {
11941
12134
  color: "text.primary"
12135
+ }
12136
+ }
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"
12158
+ },
12159
+ ...Array.isArray(selectedCountSx) ? selectedCountSx : [selectedCountSx]
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: [
12188
+ {
12189
+ "& .MuiAutocomplete-root": {
12190
+ "& .MuiOutlinedInput-root": {
12191
+ padding: "4px"
11942
12192
  },
11943
- "& .MuiOutlinedInput-input": {
11944
- color: "common.black"
11945
- },
11946
- "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
11947
- borderColor: "common.white"
11948
- },
11949
- "& .MuiSvgIcon-root": {
11950
- color: "common.black"
12193
+ "& .MuiAutocomplete-input": {
12194
+ padding: "8.5px 4px"
11951
12195
  }
11952
12196
  }
11953
- }
11954
- ),
11955
- ...otherProps
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
+ ]
12269
+ },
12270
+ className: `app-searchable-multi-selector-autocomplete ${autocompleteClassName}`.trim(),
12271
+ sx: [
12272
+ {
12273
+ "& .MuiAutocomplete-tag": {
12274
+ margin: 0,
12275
+ height: "auto"
12276
+ },
12277
+ "& .MuiAutocomplete-endAdornment": {
12278
+ right: 8
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
12301
+ }
12302
+ ),
12303
+ renderSelectedCount()
12304
+ ]
11956
12305
  }
11957
12306
  )
11958
12307
  }
11959
12308
  );
11960
- }
12309
+ });
12310
+ AppSearchableMultiSelector2.displayName = "AppSearchableMultiSelector";
12311
+ var AppSearchableSelect_default = AppSearchableMultiSelector2;
11961
12312
  var AppSelectInput = react.forwardRef(
11962
12313
  ({
11963
12314
  name,
@@ -12068,16 +12419,9 @@ var AppSelectInput = react.forwardRef(
12068
12419
  className: "app-select-input",
12069
12420
  sx: [
12070
12421
  {
12071
- "& .MuiInputLabel-root": {
12072
- "&.Mui-focused": {
12073
- color: hasError ? "error.main" : "primary.main"
12074
- },
12075
- "&.Mui-disabled": {
12076
- color: "text.disabled"
12077
- }
12078
- }
12422
+ width: fullWidth ? "100%" : "auto"
12079
12423
  },
12080
- ...Array.isArray(formControlSx) ? formControlSx : [formControlSx].filter(Boolean)
12424
+ ...Array.isArray(sx) ? sx : [sx].filter(Boolean)
12081
12425
  ],
12082
12426
  children: /* @__PURE__ */ jsxRuntime.jsxs(
12083
12427
  material.FormControl,
@@ -12089,13 +12433,24 @@ var AppSelectInput = react.forwardRef(
12089
12433
  className: "app-select-form-control",
12090
12434
  sx: [
12091
12435
  {
12436
+ position: "relative",
12437
+ "& .MuiOutlinedInput-notchedOutline": {
12438
+ borderWidth: "1px"
12439
+ },
12092
12440
  "& .MuiInputLabel-root": {
12441
+ position: "relative",
12442
+ transform: "none",
12443
+ fontSize: "0.875rem",
12444
+ mb: 1,
12093
12445
  "&.Mui-focused": {
12094
12446
  color: hasError ? "error.main" : "primary.main"
12095
12447
  },
12096
12448
  "&.Mui-disabled": {
12097
12449
  color: "text.disabled"
12098
12450
  }
12451
+ },
12452
+ "& .MuiInputLabel-shrink": {
12453
+ transform: "none"
12099
12454
  }
12100
12455
  },
12101
12456
  ...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
@@ -12107,15 +12462,23 @@ var AppSelectInput = react.forwardRef(
12107
12462
  id: `select-${name}-label`,
12108
12463
  htmlFor: `select-${name}`,
12109
12464
  className: "app-select-label",
12465
+ shrink: false,
12110
12466
  sx: [
12111
12467
  {
12468
+ position: "relative",
12469
+ transform: "none",
12470
+ fontSize: "0.875rem",
12471
+ fontWeight: 500,
12112
12472
  color: hasError ? "error.main" : "text.secondary",
12473
+ mb: 1,
12113
12474
  "&.Mui-focused": {
12114
12475
  color: hasError ? "error.main" : "primary.main"
12115
12476
  },
12116
- mb: 1,
12117
- ...Array.isArray(labelSx) ? labelSx : [labelSx]
12118
- }
12477
+ "&.Mui-disabled": {
12478
+ color: "text.disabled"
12479
+ }
12480
+ },
12481
+ ...Array.isArray(labelSx) ? labelSx : [labelSx].filter(Boolean)
12119
12482
  ],
12120
12483
  children: [
12121
12484
  label,
@@ -12146,6 +12509,8 @@ var AppSelectInput = react.forwardRef(
12146
12509
  onOpen,
12147
12510
  onClose,
12148
12511
  renderValue,
12512
+ label: void 0,
12513
+ displayEmpty: true,
12149
12514
  inputProps: {
12150
12515
  readOnly,
12151
12516
  ...inputProps
@@ -12156,6 +12521,7 @@ var AppSelectInput = react.forwardRef(
12156
12521
  {
12157
12522
  mt: 1,
12158
12523
  boxShadow: theme.shadows[3],
12524
+ maxHeight: 300,
12159
12525
  "& .MuiMenuItem-root": {
12160
12526
  px: 2,
12161
12527
  py: 1,
@@ -12174,7 +12540,24 @@ var AppSelectInput = react.forwardRef(
12174
12540
  },
12175
12541
  sx: [
12176
12542
  {
12177
- // Your base styles here
12543
+ "& .MuiSelect-select": {
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
+ },
12178
12561
  "&.Mui-disabled": {
12179
12562
  backgroundColor: "action.disabledBackground",
12180
12563
  "& .MuiOutlinedInput-notchedOutline": {
@@ -12204,6 +12587,7 @@ var AppSelectInput = react.forwardRef(
12204
12587
  {
12205
12588
  mx: 0,
12206
12589
  mt: 0.5,
12590
+ fontSize: "0.75rem",
12207
12591
  ...hasError ? {
12208
12592
  color: "error.main",
12209
12593
  ...errorSx
@@ -13998,7 +14382,7 @@ exports.AppRadioGroup = AppRadioGroup_default;
13998
14382
  exports.AppRating = AppRating_default;
13999
14383
  exports.AppRichTextEditor = AppRichTextEditor_default;
14000
14384
  exports.AppSearchableMultiSelector = AppSearchableMultiSelector_default;
14001
- exports.AppSearchableSelectInput = AppSearchableSelectInput;
14385
+ exports.AppSearchableSelectInput = AppSearchableSelect_default;
14002
14386
  exports.AppSelectInput = AppSelectInput_default;
14003
14387
  exports.AppSimpleUploadFile = AppSimpleUploadFile_default;
14004
14388
  exports.AppSwitch = AppSwitch;