@m4l/components 9.3.16 → 9.3.17

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.
Files changed (29) hide show
  1. package/components/areas/icons.js +1 -1
  2. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +3 -35
  3. package/components/hook-form/RHFAutocomplete/types.d.ts +1 -6
  4. package/components/index.d.ts +1 -0
  5. package/components/mui_extended/Autocomplete/Autocomplete.js +12 -6
  6. package/components/mui_extended/Autocomplete/Autocomplete.styles.js +48 -5
  7. package/components/mui_extended/Autocomplete/hooks/useEndAdornments.d.ts +1 -0
  8. package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +4 -3
  9. package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +4 -4
  10. package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +39 -4
  11. package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.d.ts +3 -1
  12. package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.js +2 -0
  13. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +6 -0
  14. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +11 -1
  15. package/components/mui_extended/Autocomplete/types.d.ts +1 -1
  16. package/components/mui_extended/Button/ButtonStyles.js +3 -6
  17. package/components/mui_extended/Popper/Popper.js +9 -2
  18. package/components/mui_extended/Popper/types.d.ts +1 -0
  19. package/components/mui_extended/Select/Select.js +17 -10
  20. package/components/mui_extended/Select/Select.styles.js +17 -10
  21. package/components/mui_extended/Select/types.d.ts +1 -1
  22. package/components/mui_extended/TextField/TextField.d.ts +2 -1
  23. package/components/mui_extended/TextField/TextField.js +25 -4
  24. package/components/mui_extended/TextField/TextField.styles.js +132 -125
  25. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +3 -9
  26. package/components/mui_extended/TextField/slots/TextFieldSlots.js +2 -1
  27. package/components/mui_extended/Typography/Typography.js +1 -1
  28. package/package.json +1 -1
  29. package/test/mocks/dictionary-mock.d.ts +433 -0
@@ -1,6 +1,6 @@
1
1
  const ICONS = {
2
2
  MAXIMIZE: "window_expand.svg",
3
- NORMALIZE: "window_normalize.svg",
3
+ NORMALIZE: "window_minimize.svg",
4
4
  COLLAPSE: "window_collapse.svg",
5
5
  UNCOLLPASE: "window_uncollapse.svg",
6
6
  RESET_COOKIES: "reset_cookies.svg",
@@ -1,7 +1,4 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { getPropertyByString } from "@m4l/core";
3
- import { useIsMobile } from "@m4l/graphics";
4
- import { useTheme } from "@mui/material";
5
2
  import { useId, useState, useCallback, useEffect } from "react";
6
3
  import { useFormContext, Controller } from "react-hook-form";
7
4
  import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
@@ -13,28 +10,22 @@ function RHFAutocomplete(props) {
13
10
  getOptionLabel,
14
11
  isOptionEqualToValue,
15
12
  label,
16
- color,
17
13
  options,
18
14
  disabled,
19
15
  onOpen,
20
16
  onClose,
21
17
  loading,
22
- variant,
23
18
  helperMessage,
24
19
  size,
25
20
  onChangeFilterParmsLocal,
26
21
  mandatory,
27
22
  mandatoryMessage,
28
23
  multiple,
29
- imageScale = true,
30
- imageRepeat,
31
24
  refresh
32
25
  // onChange: onChangeRHF,
33
26
  } = props;
34
27
  const htmlForId = useId();
35
- const theme = useTheme();
36
28
  const [open, setOpen] = useState(false);
37
- const isDesktop = !useIsMobile();
38
29
  const onCloseLocal = useCallback((event, reason) => {
39
30
  setOpen(false);
40
31
  if (onClose) {
@@ -59,34 +50,11 @@ function RHFAutocomplete(props) {
59
50
  },
60
51
  [getOptionLabel]
61
52
  );
62
- const paletteColor = getPropertyByString(
63
- theme.vars.palette,
64
- disabled ? "default" : color || "default",
65
- theme.vars.palette.default
66
- );
67
53
  const {
68
- control,
69
- formState: { errors }
54
+ control
70
55
  } = useFormContext();
71
- const [currentVariant, setCurrentVariant] = useState(null);
72
- useEffect(() => {
73
- const hasError = errors[nameRHF];
74
- if (hasError) {
75
- setCurrentVariant("error");
76
- } else if (variant) {
77
- setCurrentVariant(variant);
78
- } else {
79
- setCurrentVariant(null);
80
- }
81
- }, [errors, nameRHF, variant, control]);
82
56
  const ownerState = {
83
- size: !isDesktop ? "medium" : size,
84
- semantics: currentVariant,
85
- disabled,
86
- multiple: Boolean(multiple),
87
- imageScale: Boolean(imageScale),
88
- imageRepeat: Boolean(imageRepeat),
89
- paletteColor
57
+ disabled
90
58
  };
91
59
  return /* @__PURE__ */ jsx(
92
60
  AutocompleteRootStyled,
@@ -147,7 +115,7 @@ function RHFAutocomplete(props) {
147
115
  htmlFor: htmlForId
148
116
  }
149
117
  ),
150
- currentVariant === "error" ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
118
+ error?.message ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
151
119
  ] });
152
120
  }
153
121
  }
@@ -1,4 +1,4 @@
1
- import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme, PaletteColor, PopperProps } from '@mui/material';
1
+ import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme, PopperProps } from '@mui/material';
2
2
  import { ComponentPalletColor, Sizes } from '@m4l/styles';
3
3
  import { TextFieldProps } from '../../mui_extended/TextField/types';
4
4
  import { RFHAUTOCOMPLETE_KEY_COMPONENT } from './constants';
@@ -52,11 +52,6 @@ export interface RHFAutocompleteProps<T = any, Multiple extends boolean | undefi
52
52
  */
53
53
  export interface RHFAutocompleteOwnerState extends Pick<RHFAutocompleteProps<any>, 'size' | 'disabled' | 'variant'> {
54
54
  disabled?: boolean;
55
- semantics: RHFAutocompleteVariants | 'error' | null;
56
- multiple: boolean;
57
- imageScale?: boolean;
58
- imageRepeat?: boolean;
59
- paletteColor: PaletteColor;
60
55
  }
61
56
  /**
62
57
  * Defines the types of Slots available for the Autocomplete.
@@ -6,6 +6,7 @@ export * from './areas';
6
6
  export * from './BaseModule';
7
7
  export * from './Card';
8
8
  export * from './Chip';
9
+ export * from './Card';
9
10
  export * from './commercial';
10
11
  export * from './CommonActions/';
11
12
  export * from './ContainerFlow';
@@ -21,7 +21,9 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
21
21
  // Diferencia
22
22
  refresh,
23
23
  error = false,
24
- htmlFor
24
+ htmlFor,
25
+ readOnly = false,
26
+ placeholder
25
27
  } = props;
26
28
  const { getLabel } = useModuleDictionary();
27
29
  const isSkeleton = useModuleSkeleton();
@@ -47,8 +49,9 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
47
49
  variant,
48
50
  disabled,
49
51
  multiple: Boolean(multiple),
50
- error
51
- }), [adjustedSize, disabled, error, multiple, variant]);
52
+ error,
53
+ readOnly
54
+ }), [adjustedSize, disabled, error, multiple, variant, readOnly]);
52
55
  const startAdornments = useStartAdornments({
53
56
  selectedValue,
54
57
  multiple,
@@ -66,7 +69,8 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
66
69
  handleRefresh,
67
70
  disabled,
68
71
  onOpenLocal,
69
- open
72
+ open,
73
+ readOnly
70
74
  });
71
75
  if (isSkeleton) {
72
76
  return /* @__PURE__ */ jsx(
@@ -158,12 +162,14 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
158
162
  InputProps: {
159
163
  ...otherInputProps,
160
164
  startAdornment: startAdornments,
161
- endAdornment: endAdornments
165
+ endAdornment: endAdornments,
166
+ readOnly
162
167
  },
163
168
  SelectProps: { native: true },
164
169
  size: adjustedSize,
165
170
  fullWidth: true,
166
- disabled
171
+ disabled,
172
+ placeholder
167
173
  }
168
174
  );
169
175
  }
@@ -10,7 +10,20 @@ const autocompleteSyles = {
10
10
  /**
11
11
  * Styles for the icon button component.
12
12
  */
13
- iconButton: {},
13
+ iconButton: ({ ownerState }) => ({
14
+ ...ownerState?.readOnly && {
15
+ "&:hover": {
16
+ backgroundColor: "unset!important"
17
+ },
18
+ "&:active": {
19
+ backgroundColor: "unset!important"
20
+ },
21
+ "&:focus-visible": {
22
+ backgroundColor: "unset!important",
23
+ outline: "none!important"
24
+ }
25
+ }
26
+ }),
14
27
  /**
15
28
  * Styles for the input component.
16
29
  */
@@ -79,10 +92,22 @@ const autocompleteSyles = {
79
92
  /**
80
93
  * Styles for the popper component.
81
94
  */
82
- popper: ({ theme }) => ({
83
- ...theme.typography.body1,
95
+ popper: () => ({
96
+ width: "fit-content!important",
97
+ maxWidth: "calc(100vw - 20px)",
84
98
  "& .MuiPaper-root": {
85
- width: "100%"
99
+ minWidth: "100%",
100
+ maxHeight: "200px",
101
+ "& .MuiAutocomplete-listbox": {
102
+ height: "100%",
103
+ "& .M4LMenuItem-root ": {
104
+ width: "fit-content",
105
+ "& .M4LTypography-root": {
106
+ width: "fit-content",
107
+ overflow: "unset"
108
+ }
109
+ }
110
+ }
86
111
  }
87
112
  }),
88
113
  /**
@@ -106,7 +131,25 @@ const autocompleteSyles = {
106
131
  )
107
132
  };
108
133
  },
109
- renderInputText: {}
134
+ renderInputText: {},
135
+ /**
136
+ * Styles for the container multiple values component.
137
+ */
138
+ containerMultipleValues: () => ({
139
+ display: "flex",
140
+ overflow: "auto",
141
+ width: "100%",
142
+ flex: 1,
143
+ maxHeight: "80px"
144
+ }),
145
+ /**
146
+ * Styles for the container wrapper component.
147
+ */
148
+ containerWrapper: ({ theme }) => ({
149
+ display: "flex",
150
+ flexWrap: "wrap",
151
+ gap: theme.vars.size.baseSpacings.sp1
152
+ })
110
153
  };
111
154
  export {
112
155
  autocompleteSyles as a
@@ -8,6 +8,7 @@ export type UseAdornmentsProps = {
8
8
  disabled?: boolean;
9
9
  onOpenLocal: (event: React.MouseEvent<HTMLButtonElement>) => void;
10
10
  open: boolean;
11
+ readOnly?: boolean;
11
12
  };
12
13
  /**
13
14
  * Hook para el componente Autocomplete local
@@ -11,7 +11,8 @@ function useEndAdornments(props) {
11
11
  handleRefresh,
12
12
  disabled,
13
13
  onOpenLocal,
14
- open
14
+ open,
15
+ readOnly
15
16
  } = props;
16
17
  const { host_static_assets, environment_assets } = useEnvironment();
17
18
  return /* @__PURE__ */ jsxs(AdormentsStyled, { children: [
@@ -26,7 +27,7 @@ function useEndAdornments(props) {
26
27
  {
27
28
  ownerState: { ...ownerState },
28
29
  icon: `${host_static_assets}/${environment_assets}/${icons.refresh}`,
29
- onClick: handleRefresh,
30
+ onClick: !readOnly ? handleRefresh : void 0,
30
31
  disabled,
31
32
  size: adjustedSize
32
33
  }
@@ -36,7 +37,7 @@ function useEndAdornments(props) {
36
37
  {
37
38
  ownerState: { ...ownerState },
38
39
  icon: `${host_static_assets}/${environment_assets}/${icons.chevronDown}`,
39
- onClick: (event) => onOpenLocal(event),
40
+ onClick: (event) => !readOnly ? onOpenLocal(event) : void 0,
40
41
  disabled,
41
42
  size: adjustedSize,
42
43
  rotationAngle: open ? 180 : 0
@@ -1,5 +1,5 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { b as ChipStyled } from "../slots/AutocompleteSlots.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { b as ContainerMultipleValuesStyled, c as ContainerWrapperStyled, d as ChipStyled } from "../slots/AutocompleteSlots.js";
3
3
  function useStartAdornments(props) {
4
4
  const {
5
5
  selectedValue,
@@ -13,7 +13,7 @@ function useStartAdornments(props) {
13
13
  if (!(Array.isArray(selectedValue) && multiple)) {
14
14
  return null;
15
15
  }
16
- return /* @__PURE__ */ jsx(Fragment, { children: selectedValue.map((option, index) => /* @__PURE__ */ jsx(
16
+ return /* @__PURE__ */ jsx(ContainerMultipleValuesStyled, { children: /* @__PURE__ */ jsx(ContainerWrapperStyled, { children: selectedValue.map((option, index) => /* @__PURE__ */ jsx(
17
17
  ChipStyled,
18
18
  {
19
19
  size: adjustedSize,
@@ -24,7 +24,7 @@ function useStartAdornments(props) {
24
24
  ownerState: { ...ownerState }
25
25
  },
26
26
  `${option}-${index}`
27
- )) });
27
+ )) }) });
28
28
  }
29
29
  export {
30
30
  useStartAdornments as u
@@ -4,7 +4,7 @@ function useValuesAndHandlers(props) {
4
4
  const {
5
5
  getOptionLabel,
6
6
  isOptionEqualToValue,
7
- options,
7
+ options = [],
8
8
  onOpen,
9
9
  onClose,
10
10
  onChangeFilterParmsLocal,
@@ -13,7 +13,8 @@ function useValuesAndHandlers(props) {
13
13
  // Diferencia
14
14
  refresh,
15
15
  onChange,
16
- value
16
+ value,
17
+ readOnly
17
18
  } = props;
18
19
  const [open, setOpen] = useState(false);
19
20
  const scrollPositionOptionsRef = useRef(0);
@@ -39,6 +40,9 @@ function useValuesAndHandlers(props) {
39
40
  [isOptionEqualToValue]
40
41
  );
41
42
  const handleDelete = useCallback((optionToDelete) => {
43
+ if (readOnly) {
44
+ return;
45
+ }
42
46
  if (Array.isArray(selectedValue)) {
43
47
  const updatedValue = selectedValue.filter(
44
48
  (val) => !isOptionEqualToValueLocal(val, optionToDelete)
@@ -50,7 +54,7 @@ function useValuesAndHandlers(props) {
50
54
  "removeOption"
51
55
  );
52
56
  }
53
- }, [selectedValue, isOptionEqualToValueLocal, onChange]);
57
+ }, [selectedValue, isOptionEqualToValueLocal, onChange, readOnly]);
54
58
  const handleRefresh = useCallback(() => {
55
59
  refresh?.();
56
60
  setOpen(true);
@@ -64,6 +68,9 @@ function useValuesAndHandlers(props) {
64
68
  onChange?.(event, updatedValue, reason);
65
69
  };
66
70
  const handleInputChange = (_event, newValue, reason) => {
71
+ if (readOnly) {
72
+ return;
73
+ }
67
74
  setInputValue(newValue);
68
75
  if (onChangeFilterParmsLocal && reason === "input") {
69
76
  onChangeFilterParmsLocal(newValue, reason);
@@ -85,11 +92,14 @@ function useValuesAndHandlers(props) {
85
92
  }
86
93
  };
87
94
  const onOpenLocal = useCallback((event) => {
95
+ if (readOnly) {
96
+ return;
97
+ }
88
98
  setOpen((currentState) => !currentState);
89
99
  if (onOpen) {
90
100
  onOpen(event);
91
101
  }
92
- }, [onOpen]);
102
+ }, [onOpen, readOnly]);
93
103
  const getOptionLabelLocal = useCallback(
94
104
  (option) => {
95
105
  if (typeof option === "string") {
@@ -109,6 +119,14 @@ function useValuesAndHandlers(props) {
109
119
  return getOptionUrlImage(option);
110
120
  }, [getOptionUrlImage]);
111
121
  const [inputValue, setInputValue] = useState("");
122
+ useEffect(() => {
123
+ if (readOnly && value !== null && value !== void 0 && !multiple) {
124
+ const displayValue = getOptionLabelLocal(value);
125
+ setInputValue(displayValue);
126
+ } else if (readOnly && multiple) {
127
+ setInputValue("");
128
+ }
129
+ }, [readOnly, value, getOptionLabelLocal, multiple]);
112
130
  useEffect(() => {
113
131
  if (open === false && value === null && inputValue !== "") {
114
132
  setInputValue("");
@@ -118,6 +136,23 @@ function useValuesAndHandlers(props) {
118
136
  if (e.code === "Enter") {
119
137
  e.preventDefault();
120
138
  }
139
+ if (readOnly) {
140
+ const allowedKeys = [
141
+ "Tab",
142
+ "Escape",
143
+ "ArrowUp",
144
+ "ArrowDown",
145
+ "ArrowLeft",
146
+ "ArrowRight",
147
+ "Home",
148
+ "End",
149
+ "PageUp",
150
+ "PageDown"
151
+ ];
152
+ if (!allowedKeys.includes(e.key) && !e.ctrlKey && !e.metaKey) {
153
+ e.preventDefault();
154
+ }
155
+ }
121
156
  };
122
157
  const selectedOption = options.find((option) => {
123
158
  return isOptionEqualToValueLocal(option, selectedValue);
@@ -11,5 +11,7 @@ export declare enum AutocompleteSlots {
11
11
  circularProgress = "circularProgress",
12
12
  textField = "textField",
13
13
  image = "image",
14
- renderInputText = "renderInputText"
14
+ renderInputText = "renderInputText",
15
+ containerMultipleValues = "containerMultipleValues",
16
+ containerWrapper = "containerWrapper"
15
17
  }
@@ -12,6 +12,8 @@ var AutocompleteSlots = /* @__PURE__ */ ((AutocompleteSlots2) => {
12
12
  AutocompleteSlots2["textField"] = "textField";
13
13
  AutocompleteSlots2["image"] = "image";
14
14
  AutocompleteSlots2["renderInputText"] = "renderInputText";
15
+ AutocompleteSlots2["containerMultipleValues"] = "containerMultipleValues";
16
+ AutocompleteSlots2["containerWrapper"] = "containerWrapper";
15
17
  return AutocompleteSlots2;
16
18
  })(AutocompleteSlots || {});
17
19
  export {
@@ -39,3 +39,9 @@ export declare const RenderInputTextStyled: import('@emotion/styled').StyledComp
39
39
  export declare const AdormentsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
40
40
  ownerState?: (Partial<import('../types').AutocompleteOwnerState> & Record<string, unknown>) | undefined;
41
41
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
42
+ export declare const ContainerMultipleValuesStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
43
+ ownerState?: (Partial<import('../types').AutocompleteOwnerState> & Record<string, unknown>) | undefined;
44
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
45
+ export declare const ContainerWrapperStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
46
+ ownerState?: (Partial<import('../types').AutocompleteOwnerState> & Record<string, unknown>) | undefined;
47
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -64,6 +64,14 @@ const AdormentsStyled = styled("div", {
64
64
  name: AUTOCOMPLETE_KEY_COMPONENT,
65
65
  slot: AutocompleteSlots.adorments
66
66
  })(autocompleteSyles?.adorments);
67
+ const ContainerMultipleValuesStyled = styled("div", {
68
+ name: AUTOCOMPLETE_KEY_COMPONENT,
69
+ slot: AutocompleteSlots.containerMultipleValues
70
+ })(autocompleteSyles?.containerMultipleValues);
71
+ const ContainerWrapperStyled = styled("div", {
72
+ name: AUTOCOMPLETE_KEY_COMPONENT,
73
+ slot: AutocompleteSlots.containerWrapper
74
+ })(autocompleteSyles?.containerWrapper);
67
75
  export {
68
76
  AutocompleteRootStyled as A,
69
77
  CircularProgressStyled as C,
@@ -72,5 +80,7 @@ export {
72
80
  RenderInputStyled as R,
73
81
  SkeletonAutocompleteStyled as S,
74
82
  AdormentsStyled as a,
75
- ChipStyled as b
83
+ ContainerMultipleValuesStyled as b,
84
+ ContainerWrapperStyled as c,
85
+ ChipStyled as d
76
86
  };
@@ -25,7 +25,7 @@ export interface BaseAutocompleteProps {
25
25
  * Props for the unified Autocomplete component.
26
26
  * Supports both single and multiple selection, and two types: `text` and `image`.
27
27
  */
28
- export interface AutocompleteProps<T, Multiple extends boolean | undefined> extends Pick<MUIAutocompleteProps<T, Multiple, undefined, false>, 'options' | 'onOpen' | 'onClose' | 'loading' | 'disabled' | 'open'>, Pick<TextFieldProps, 'error' | 'focused'>, BaseAutocompleteProps {
28
+ export interface AutocompleteProps<T, Multiple extends boolean | undefined> extends Pick<MUIAutocompleteProps<T, Multiple, undefined, false>, 'options' | 'onOpen' | 'onClose' | 'loading' | 'disabled'>, Pick<TextFieldProps, 'error'>, BaseAutocompleteProps {
29
29
  /**
30
30
  * Indica si el campo de texto está en modo de solo lectura.
31
31
  * readOnly={true}
@@ -8,14 +8,14 @@ const buttonStyles = {
8
8
  flexWrap: "nowrap",
9
9
  alignItems: "center",
10
10
  gap: theme.vars.size.baseSpacings.sp1,
11
- padding: `0px ${theme.vars.size.baseSpacings.sp1}`,
11
+ padding: `0px ${theme.vars.size.baseSpacings.sp2}`,
12
12
  boxShadow: "none",
13
- borderRadius: theme.vars.size.borderRadius.r1,
13
+ borderRadius: theme.vars.size.borderRadius["r1-5"],
14
14
  maxWidth: "200px",
15
15
  minWidth: "0",
16
16
  flexShrink: 0,
17
17
  "&:hover": {
18
- backgroundColor: ownerState?.paletteColor?.hoverOpacity,
18
+ backgroundColor: ownerState?.color === "default" ? ownerState?.paletteColor?.hover : ownerState?.paletteColor?.hoverOpacity,
19
19
  borderColor: ownerState?.paletteColor?.hover
20
20
  },
21
21
  "&:active": {
@@ -25,9 +25,6 @@ const buttonStyles = {
25
25
  },
26
26
  "&:focus-visible": {
27
27
  boxShadow: "none",
28
- outline: theme.vars.size.borderStroke.container,
29
- outlineColor: theme.vars.palette.border.main,
30
- outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
31
28
  backgroundColor: ownerState?.paletteColor?.activeOpacity
32
29
  },
33
30
  "&:disabled": {
@@ -25,7 +25,8 @@ const Popper = forwardRef((props, ref) => {
25
25
  const ownerState = {
26
26
  paletteColor,
27
27
  popperColor: color,
28
- arrow
28
+ arrow,
29
+ variant
29
30
  };
30
31
  return /* @__PURE__ */ jsx(
31
32
  PopperRootStyled,
@@ -34,12 +35,18 @@ const Popper = forwardRef((props, ref) => {
34
35
  placement: props.placement || initialPlacement,
35
36
  "data-testid": "popper-root",
36
37
  className: getComponentSlotRoot("M4LPopperClass"),
37
- variant,
38
38
  ownerState: { ...ownerState },
39
39
  anchorEl,
40
40
  color,
41
41
  ref,
42
42
  modifiers: [
43
+ {
44
+ name: "preventOverflow",
45
+ options: {
46
+ boundary: "viewport",
47
+ padding: 8
48
+ }
49
+ },
43
50
  {
44
51
  name: "flip",
45
52
  options: {
@@ -23,6 +23,7 @@ export interface PopperOwnerState extends Pick<PopperProps, 'placement'> {
23
23
  popperColor: PopperProps['color'];
24
24
  arrow: boolean;
25
25
  paletteColor: PaletteColor;
26
+ variant: PopperProps['variant'];
26
27
  }
27
28
  /**
28
29
  * Defines the types of Slots available for the `Popper`.
@@ -32,14 +32,15 @@ const Select = forwardRef(
32
32
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
33
33
  const arrowDropDownIcon = `${host_static_assets}/${environment_assets}/${ICON_ARROW_DOWN}`;
34
34
  const selectedValue = useMemo(() => value, [value]);
35
- const [open, setOpen] = useState(false);
35
+ const [openLocal, setOpenLocal] = useState(false);
36
36
  const theme = useTheme();
37
37
  const ownerState = useMemo(() => ({
38
38
  size: adjustedSize,
39
39
  disabled,
40
40
  error,
41
- variant
42
- }), [adjustedSize, disabled, error, variant]);
41
+ variant,
42
+ multiple
43
+ }), [adjustedSize, disabled, error, variant, multiple]);
43
44
  const handleLocalChange = useCallback((event) => {
44
45
  const newValue = event.target.value;
45
46
  if (!onChange) {
@@ -72,12 +73,12 @@ const Select = forwardRef(
72
73
  disabled,
73
74
  size: adjustedSize,
74
75
  onClick: () => {
75
- !disabled && setOpen(!open);
76
+ !disabled && setOpenLocal(!openLocal);
76
77
  },
77
- rotationAngle: open ? 180 : 0
78
+ rotationAngle: openLocal ? 180 : 0
78
79
  }
79
80
  );
80
- }, [ownerState, arrowDropDownIcon, disabled, adjustedSize, open]);
81
+ }, [ownerState, arrowDropDownIcon, disabled, adjustedSize, openLocal]);
81
82
  const RenderIcon = useCallback((icon) => {
82
83
  if (!icon) {
83
84
  return null;
@@ -139,10 +140,10 @@ const Select = forwardRef(
139
140
  }
140
141
  };
141
142
  const onOpen = useCallback(() => {
142
- setOpen(true);
143
+ setOpenLocal(true);
143
144
  }, []);
144
145
  const onClose = useCallback(() => {
145
- setOpen(false);
146
+ setOpenLocal(false);
146
147
  }, []);
147
148
  const StyledSelect = useMemo(() => SelectRootStyled(), []);
148
149
  if (isSkeleton) {
@@ -164,12 +165,13 @@ const Select = forwardRef(
164
165
  disabled,
165
166
  error,
166
167
  renderValue,
167
- open,
168
+ open: openLocal,
168
169
  native: false,
169
170
  onOpen,
170
171
  onClose,
171
172
  displayEmpty: true,
172
173
  MenuProps: {
174
+ disableScrollLock: true,
173
175
  sx: {
174
176
  "& .MuiPaper-root": {
175
177
  paddingTop: theme.vars.size.baseSpacings.sp3,
@@ -177,11 +179,16 @@ const Select = forwardRef(
177
179
  paddingLeft: 0,
178
180
  paddingRight: 0,
179
181
  maxHeight: "200px",
182
+ overflow: "auto",
180
183
  "& .MuiList-root": {
181
184
  padding: 0,
182
185
  display: "flex",
183
186
  flexDirection: "column",
184
- gap: theme.vars.size.baseSpacings.sp1
187
+ gap: theme.vars.size.baseSpacings.sp1,
188
+ width: "fit-content",
189
+ "& .MuiMenuItem-root": {
190
+ width: "fit-content"
191
+ }
185
192
  }
186
193
  }
187
194
  }