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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useFormikContext, Formik, Form as Form$1, ErrorMessage } from 'formik';
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';
2
+ import { forwardRef, memo, createElement, useState, useMemo, useEffect } from 'react';
3
+ import { Box, useTheme, FormControl, Typography, FormHelperText, TextField, InputLabel, FormLabel, RadioGroup, FormControlLabel, Radio, Stack, Rating, Autocomplete, MenuItem, Chip, Switch, InputAdornment, IconButton, Checkbox, 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';
@@ -651,25 +651,30 @@ function AppSwitchInput({
651
651
  Box,
652
652
  {
653
653
  className,
654
- sx: [{
655
- display: "flex",
656
- flexDirection: labelPlacement === "start" || labelPlacement === "end" ? "row" : "column",
657
- alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
658
- justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
659
- gap: 1,
660
- my: 1,
661
- ...containerSx
662
- }, sx],
654
+ sx: [
655
+ {
656
+ display: "flex",
657
+ flexDirection: labelPlacement === "start" || labelPlacement === "end" ? "row" : "column",
658
+ alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
659
+ justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
660
+ gap: 1,
661
+ my: 1,
662
+ ...containerSx
663
+ },
664
+ sx
665
+ ],
663
666
  children: [
664
667
  label && /* @__PURE__ */ jsx(
665
668
  Typography,
666
669
  {
667
670
  variant: "body2",
668
- sx: [{
669
- color: "text.primary",
670
- order: labelPlacement === "start" ? 0 : 1,
671
- ...labelSx
672
- }],
671
+ sx: [
672
+ {
673
+ color: "text.primary",
674
+ order: labelPlacement === "start" ? 0 : 1,
675
+ ...labelSx
676
+ }
677
+ ],
673
678
  children: label
674
679
  }
675
680
  ),
@@ -682,25 +687,27 @@ function AppSwitchInput({
682
687
  onChange: () => {
683
688
  setFieldValue(name, !values[name], true);
684
689
  },
685
- sx: [{
686
- "& .MuiSwitch-switchBase": {
687
- color: "text.secondary",
688
- "&.Mui-checked": {
689
- color: "primary.main",
690
- "& + .MuiSwitch-track": {
691
- backgroundColor: "primary.main",
692
- opacity: 0.5
690
+ sx: [
691
+ {
692
+ "& .MuiSwitch-switchBase": {
693
+ color: "text.secondary",
694
+ "&.Mui-checked": {
695
+ color: "primary.main",
696
+ "& + .MuiSwitch-track": {
697
+ backgroundColor: "primary.main",
698
+ opacity: 0.5
699
+ }
700
+ },
701
+ "&.Mui-disabled": {
702
+ color: "action.disabled",
703
+ "& + .MuiSwitch-track": {
704
+ backgroundColor: "action.disabledBackground"
705
+ }
693
706
  }
694
707
  },
695
- "&.Mui-disabled": {
696
- color: "action.disabled",
697
- "& + .MuiSwitch-track": {
698
- backgroundColor: "action.disabledBackground"
699
- }
700
- }
701
- },
702
- ...switchSx
703
- }],
708
+ ...switchSx
709
+ }
710
+ ],
704
711
  ...otherProps
705
712
  }
706
713
  ),
@@ -708,12 +715,14 @@ function AppSwitchInput({
708
715
  Typography,
709
716
  {
710
717
  variant: "caption",
711
- sx: [{
712
- color: "error.main",
713
- display: "block",
714
- mt: 0.5,
715
- ...errorSx
716
- }],
718
+ sx: [
719
+ {
720
+ color: "error.main",
721
+ display: "block",
722
+ mt: 0.5,
723
+ ...errorSx
724
+ }
725
+ ],
717
726
  gutterBottom: true,
718
727
  children: fieldError
719
728
  }
@@ -745,21 +754,26 @@ function AppSwitch({
745
754
  alignItems: labelPlacement === "start" || labelPlacement === "end" ? "center" : "flex-start",
746
755
  justifyContent: labelPlacement === "start" || labelPlacement === "end" ? "space-between" : "center",
747
756
  spacing: 1,
748
- sx: [{
749
- width: "100%",
750
- ...labelPlacement === "top" || labelPlacement === "bottom" ? { alignItems: "flex-start" } : {},
751
- ...containerSx
752
- }, sx],
757
+ sx: [
758
+ {
759
+ width: "100%",
760
+ ...labelPlacement === "top" || labelPlacement === "bottom" ? { alignItems: "flex-start" } : {},
761
+ ...containerSx
762
+ },
763
+ sx
764
+ ],
753
765
  children: [
754
766
  /* @__PURE__ */ jsx(
755
767
  Typography,
756
768
  {
757
769
  variant: "body2",
758
- sx: [{
759
- color: "text.primary",
760
- order: labelPlacement === "start" ? 0 : 1,
761
- ...labelSx
762
- }],
770
+ sx: [
771
+ {
772
+ color: "text.primary",
773
+ order: labelPlacement === "start" ? 0 : 1,
774
+ ...labelSx
775
+ }
776
+ ],
763
777
  children: label
764
778
  }
765
779
  ),
@@ -771,25 +785,27 @@ function AppSwitch({
771
785
  onChange: () => {
772
786
  setFieldValue(name, !fieldValue, true);
773
787
  },
774
- sx: [{
775
- "& .MuiSwitch-switchBase": {
776
- color: "text.secondary",
777
- "&.Mui-checked": {
778
- color: "primary.main",
779
- "& + .MuiSwitch-track": {
780
- backgroundColor: "primary.main",
781
- opacity: 0.5
788
+ sx: [
789
+ {
790
+ "& .MuiSwitch-switchBase": {
791
+ color: "text.secondary",
792
+ "&.Mui-checked": {
793
+ color: "primary.main",
794
+ "& + .MuiSwitch-track": {
795
+ backgroundColor: "primary.main",
796
+ opacity: 0.5
797
+ }
798
+ },
799
+ "&.Mui-disabled": {
800
+ color: "action.disabled",
801
+ "& + .MuiSwitch-track": {
802
+ backgroundColor: "action.disabledBackground"
803
+ }
782
804
  }
783
805
  },
784
- "&.Mui-disabled": {
785
- color: "action.disabled",
786
- "& + .MuiSwitch-track": {
787
- backgroundColor: "action.disabledBackground"
788
- }
789
- }
790
- },
791
- ...switchSx
792
- }],
806
+ ...switchSx
807
+ }
808
+ ],
793
809
  ...otherProps
794
810
  }
795
811
  ),
@@ -797,12 +813,14 @@ function AppSwitch({
797
813
  Typography,
798
814
  {
799
815
  variant: "caption",
800
- sx: [{
801
- color: "error.main",
802
- display: "block",
803
- mt: 0.5,
804
- ...errorSx
805
- }],
816
+ sx: [
817
+ {
818
+ color: "error.main",
819
+ display: "block",
820
+ mt: 0.5,
821
+ ...errorSx
822
+ }
823
+ ],
806
824
  gutterBottom: true,
807
825
  children: fieldError
808
826
  }
@@ -11840,447 +11858,106 @@ var AppSearchableMultiSelector = forwardRef(
11840
11858
  );
11841
11859
  AppSearchableMultiSelector.displayName = "AppSearchableMultiSelector";
11842
11860
  var AppSearchableMultiSelector_default = AppSearchableMultiSelector;
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();
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 } = useFormikContext();
11911
11873
  const fieldError = _19.get(errors, name);
11912
- const isTouched = Boolean(_19.get(touched, name));
11913
- const hasError = Boolean(fieldError) && isTouched;
11874
+ const isTouched = _19.get(touched, name);
11914
11875
  const val = _19.get(values, name);
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()
12003
- },
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
- [
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__ */ jsx(
11887
+ FormControl,
11888
+ {
11889
+ fullWidth: true,
12030
11890
  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"
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"
11899
+ },
11900
+ ".MuiOutlinedInput-root": {
11901
+ backgroundColor: (theme) => `${theme.palette.common.white} !important`
12050
11902
  }
12051
11903
  },
12052
- /* @__PURE__ */ jsx(
12053
- Checkbox,
12054
- {
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
12067
- },
12068
- ...checkboxProps
12069
- }
12070
- ),
12071
- option.icon && /* @__PURE__ */ jsx(Box, { component: "span", sx: { mr: 1 }, children: option.icon }),
12072
- /* @__PURE__ */ jsx(
12073
- Typography,
11904
+ children: /* @__PURE__ */ jsx(
11905
+ Autocomplete,
12074
11906
  {
12075
- variant: "body2",
12076
- sx: [
12077
- {
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": {
12106
- color: "text.primary"
12107
- }
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()));
12108
11917
  }
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"
11918
+ );
12130
11919
  },
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: [
11920
+ renderInput: (params) => /* @__PURE__ */ jsx(
11921
+ TextField,
12160
11922
  {
12161
- "& .MuiAutocomplete-root": {
12162
- "& .MuiOutlinedInput-root": {
12163
- padding: "4px"
11923
+ ...params,
11924
+ onChange: handleSearchChange,
11925
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [
11926
+ label,
11927
+ required && /* @__PURE__ */ jsx(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"
12164
11939
  },
12165
- "& .MuiAutocomplete-input": {
12166
- padding: "8.5px 4px"
12167
- }
12168
- }
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
- ]
11940
+ "& .MuiInputLabel-root.Mui-focused": {
11941
+ color: "text.primary"
12241
11942
  },
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
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"
11951
+ }
12273
11952
  }
12274
- ),
12275
- renderSelectedCount()
12276
- ]
11953
+ }
11954
+ ),
11955
+ ...otherProps
12277
11956
  }
12278
11957
  )
12279
11958
  }
12280
11959
  );
12281
- });
12282
- AppSearchableMultiSelector2.displayName = "AppSearchableMultiSelector";
12283
- var AppSearchableSelect_default = AppSearchableMultiSelector2;
11960
+ }
12284
11961
  var AppSelectInput = forwardRef(
12285
11962
  ({
12286
11963
  name,
@@ -12391,9 +12068,16 @@ var AppSelectInput = forwardRef(
12391
12068
  className: "app-select-input",
12392
12069
  sx: [
12393
12070
  {
12394
- width: fullWidth ? "100%" : "auto"
12071
+ "& .MuiInputLabel-root": {
12072
+ "&.Mui-focused": {
12073
+ color: hasError ? "error.main" : "primary.main"
12074
+ },
12075
+ "&.Mui-disabled": {
12076
+ color: "text.disabled"
12077
+ }
12078
+ }
12395
12079
  },
12396
- ...Array.isArray(sx) ? sx : [sx].filter(Boolean)
12080
+ ...Array.isArray(formControlSx) ? formControlSx : [formControlSx].filter(Boolean)
12397
12081
  ],
12398
12082
  children: /* @__PURE__ */ jsxs(
12399
12083
  FormControl,
@@ -12405,24 +12089,13 @@ var AppSelectInput = forwardRef(
12405
12089
  className: "app-select-form-control",
12406
12090
  sx: [
12407
12091
  {
12408
- position: "relative",
12409
- "& .MuiOutlinedInput-notchedOutline": {
12410
- borderWidth: "1px"
12411
- },
12412
12092
  "& .MuiInputLabel-root": {
12413
- position: "relative",
12414
- transform: "none",
12415
- fontSize: "0.875rem",
12416
- mb: 1,
12417
12093
  "&.Mui-focused": {
12418
12094
  color: hasError ? "error.main" : "primary.main"
12419
12095
  },
12420
12096
  "&.Mui-disabled": {
12421
12097
  color: "text.disabled"
12422
12098
  }
12423
- },
12424
- "& .MuiInputLabel-shrink": {
12425
- transform: "none"
12426
12099
  }
12427
12100
  },
12428
12101
  ...Array.isArray(formControlSx) ? formControlSx : formControlSx ? [formControlSx] : []
@@ -12434,23 +12107,15 @@ var AppSelectInput = forwardRef(
12434
12107
  id: `select-${name}-label`,
12435
12108
  htmlFor: `select-${name}`,
12436
12109
  className: "app-select-label",
12437
- shrink: false,
12438
12110
  sx: [
12439
12111
  {
12440
- position: "relative",
12441
- transform: "none",
12442
- fontSize: "0.875rem",
12443
- fontWeight: 500,
12444
12112
  color: hasError ? "error.main" : "text.secondary",
12445
- mb: 1,
12446
12113
  "&.Mui-focused": {
12447
12114
  color: hasError ? "error.main" : "primary.main"
12448
12115
  },
12449
- "&.Mui-disabled": {
12450
- color: "text.disabled"
12451
- }
12452
- },
12453
- ...Array.isArray(labelSx) ? labelSx : [labelSx].filter(Boolean)
12116
+ mb: 1,
12117
+ ...Array.isArray(labelSx) ? labelSx : [labelSx]
12118
+ }
12454
12119
  ],
12455
12120
  children: [
12456
12121
  label,
@@ -12481,8 +12146,6 @@ var AppSelectInput = forwardRef(
12481
12146
  onOpen,
12482
12147
  onClose,
12483
12148
  renderValue,
12484
- label: void 0,
12485
- displayEmpty: true,
12486
12149
  inputProps: {
12487
12150
  readOnly,
12488
12151
  ...inputProps
@@ -12493,7 +12156,6 @@ var AppSelectInput = forwardRef(
12493
12156
  {
12494
12157
  mt: 1,
12495
12158
  boxShadow: theme.shadows[3],
12496
- maxHeight: 300,
12497
12159
  "& .MuiMenuItem-root": {
12498
12160
  px: 2,
12499
12161
  py: 1,
@@ -12512,24 +12174,7 @@ var AppSelectInput = forwardRef(
12512
12174
  },
12513
12175
  sx: [
12514
12176
  {
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
- },
12177
+ // Your base styles here
12533
12178
  "&.Mui-disabled": {
12534
12179
  backgroundColor: "action.disabledBackground",
12535
12180
  "& .MuiOutlinedInput-notchedOutline": {
@@ -12559,7 +12204,6 @@ var AppSelectInput = forwardRef(
12559
12204
  {
12560
12205
  mx: 0,
12561
12206
  mt: 0.5,
12562
- fontSize: "0.75rem",
12563
12207
  ...hasError ? {
12564
12208
  color: "error.main",
12565
12209
  ...errorSx
@@ -14341,6 +13985,6 @@ var SubmitButton = ({
14341
13985
  };
14342
13986
  var SubmitButton_default = SubmitButton;
14343
13987
 
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 };
13988
+ 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 };
14345
13989
  //# sourceMappingURL=out.js.map
14346
13990
  //# sourceMappingURL=index.mjs.map