@m4l/components 9.3.16-JT19092025.beta.1 → 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.
- package/components/Stepper/Stepper.styles.js +1 -6
- package/components/Stepper/hooks/useStepperActions/index.js +3 -21
- package/components/Stepper/subcomponents/StepArea/index.js +0 -4
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +1 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +6 -39
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +1 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +3 -5
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +1 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +3 -5
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +1 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +3 -5
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.js +9 -17
- package/components/Stepper/types.d.ts +0 -7
- package/components/areas/icons.js +1 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +3 -35
- package/components/hook-form/RHFAutocomplete/types.d.ts +1 -6
- package/components/hook-form/RHFormContext/index.d.ts +1 -1
- package/components/hook-form/RHFormContext/index.js +4 -29
- package/components/index.d.ts +1 -0
- package/components/mui_extended/Autocomplete/Autocomplete.js +12 -6
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +48 -5
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.d.ts +1 -0
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +4 -3
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +4 -4
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +39 -4
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.d.ts +3 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.js +2 -0
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +6 -0
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +11 -1
- package/components/mui_extended/Autocomplete/types.d.ts +1 -1
- package/components/mui_extended/Button/ButtonStyles.js +3 -6
- package/components/mui_extended/Popper/Popper.js +9 -2
- package/components/mui_extended/Popper/types.d.ts +1 -0
- package/components/mui_extended/Select/Select.js +17 -10
- package/components/mui_extended/Select/Select.styles.js +17 -10
- package/components/mui_extended/Select/types.d.ts +1 -1
- package/components/mui_extended/TextField/TextField.d.ts +2 -1
- package/components/mui_extended/TextField/TextField.js +25 -4
- package/components/mui_extended/TextField/TextField.styles.js +132 -125
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +3 -9
- package/components/mui_extended/TextField/slots/TextFieldSlots.js +2 -1
- package/components/mui_extended/Typography/Typography.js +1 -1
- package/package.json +1 -1
- package/test/mocks/dictionary-mock.d.ts +433 -0
- package/components/Stepper/hooks/useDynamicValidation/index.d.ts +0 -9
- package/components/Stepper/hooks/useDynamicValidation/index.js +0 -57
|
@@ -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
|
|
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(
|
|
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
|
-
|
|
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'
|
|
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.
|
|
11
|
+
padding: `0px ${theme.vars.size.baseSpacings.sp2}`,
|
|
12
12
|
boxShadow: "none",
|
|
13
|
-
borderRadius: theme.vars.size.borderRadius
|
|
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 [
|
|
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
|
-
|
|
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 &&
|
|
76
|
+
!disabled && setOpenLocal(!openLocal);
|
|
76
77
|
},
|
|
77
|
-
rotationAngle:
|
|
78
|
+
rotationAngle: openLocal ? 180 : 0
|
|
78
79
|
}
|
|
79
80
|
);
|
|
80
|
-
}, [ownerState, arrowDropDownIcon, disabled, adjustedSize,
|
|
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
|
-
|
|
143
|
+
setOpenLocal(true);
|
|
143
144
|
}, []);
|
|
144
145
|
const onClose = useCallback(() => {
|
|
145
|
-
|
|
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
|
}
|
|
@@ -9,7 +9,7 @@ const selectStyles = {
|
|
|
9
9
|
return {
|
|
10
10
|
[`&.${SELECT_CLASSES.root}`]: {
|
|
11
11
|
width: "100%",
|
|
12
|
-
borderRadius: theme.vars.size.borderRadius
|
|
12
|
+
borderRadius: theme.vars.size.borderRadius["r1-5"],
|
|
13
13
|
border: theme.vars.size.borderStroke.actionInput,
|
|
14
14
|
borderColor: ownerState?.error ? theme.vars.palette[color].enabled : theme.vars.palette.border.default,
|
|
15
15
|
padding: 0,
|
|
@@ -18,7 +18,7 @@ const selectStyles = {
|
|
|
18
18
|
display: "none"
|
|
19
19
|
},
|
|
20
20
|
'&:has(.MuiSelect-select[aria-expanded="true"])': {
|
|
21
|
-
border: `1px solid ${theme.vars.palette[color].
|
|
21
|
+
border: `1px solid ${theme.vars.palette[color].enabled}`
|
|
22
22
|
},
|
|
23
23
|
"& .M4LImage-root": {
|
|
24
24
|
...getHeightSizeStyles(
|
|
@@ -40,21 +40,26 @@ const selectStyles = {
|
|
|
40
40
|
overflow: "auto",
|
|
41
41
|
boxSizing: "border-box",
|
|
42
42
|
display: "flex",
|
|
43
|
-
flexDirection: "column"
|
|
43
|
+
flexDirection: "column",
|
|
44
|
+
flexWrap: "unset"
|
|
44
45
|
},
|
|
45
46
|
// Estilos para la variante text
|
|
46
|
-
[
|
|
47
|
+
[`&&&.${SELECT_CLASSES.text}`]: {
|
|
47
48
|
borderTop: 0,
|
|
48
49
|
borderRight: 0,
|
|
49
|
-
borderBottom: theme.vars.size.borderStroke.actionInput,
|
|
50
50
|
borderLeft: 0,
|
|
51
|
-
|
|
51
|
+
borderRadius: "unset"
|
|
52
52
|
},
|
|
53
53
|
"&:hover": {
|
|
54
54
|
backgroundColor: ownerState?.disabled ? "unset" : theme.vars.palette[color].hoverOpacity
|
|
55
55
|
},
|
|
56
56
|
"&:focus-within": {
|
|
57
|
-
borderColor: theme.vars.palette[color].
|
|
57
|
+
borderColor: theme.vars.palette[color].enabled,
|
|
58
|
+
...ownerState?.variant === "text" ? {
|
|
59
|
+
boxShadow: `0px 1.5px 0px 0px ${theme.vars.palette[color].selectedOpacity} !important`
|
|
60
|
+
} : {
|
|
61
|
+
boxShadow: `0px 0px 0px 1.5px ${theme.vars.palette[color].selectedOpacity} !important`
|
|
62
|
+
}
|
|
58
63
|
},
|
|
59
64
|
'&[aria-hidden="true"]': {
|
|
60
65
|
pointerEvents: "none"
|
|
@@ -90,13 +95,15 @@ const selectStyles = {
|
|
|
90
95
|
* Styles for the render option container
|
|
91
96
|
* @returns {object} The styles for the render option container
|
|
92
97
|
*/
|
|
93
|
-
renderValueContainer: ({ theme }) => ({
|
|
98
|
+
renderValueContainer: ({ theme, ownerState }) => ({
|
|
94
99
|
display: "flex",
|
|
95
100
|
alignItems: "center",
|
|
96
101
|
gap: theme.vars.size.baseSpacings.sp1,
|
|
97
|
-
flexWrap: "wrap",
|
|
98
102
|
overflow: "auto",
|
|
99
|
-
flexShrink: 1
|
|
103
|
+
flexShrink: 1,
|
|
104
|
+
...ownerState?.multiple && {
|
|
105
|
+
flexWrap: "wrap"
|
|
106
|
+
}
|
|
100
107
|
}),
|
|
101
108
|
arrowDown: {},
|
|
102
109
|
renderValueTypography: () => ({
|
|
@@ -72,7 +72,7 @@ export interface SelectProps<T extends string | number, Multiple extends boolean
|
|
|
72
72
|
* Propiedades internas que definen el estado del componente `Select`.
|
|
73
73
|
* paletteColor - Color de la paleta aplicado al Select.
|
|
74
74
|
*/
|
|
75
|
-
export interface SelectOwnerState<T extends string | number> extends Pick<SelectProps<T>, 'classes' | 'size' | 'error' | 'variant' | 'disabled'> {
|
|
75
|
+
export interface SelectOwnerState<T extends string | number, Multiple extends boolean | undefined = false> extends Pick<SelectProps<T, Multiple>, 'classes' | 'size' | 'error' | 'variant' | 'disabled' | 'multiple'> {
|
|
76
76
|
disabled?: boolean;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextFieldProps } from './types';
|
|
2
|
+
import { default as React } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* Componente TextField extended de MUI-MATERIAL componente de entrada de datos en una interfaz de usuario que permite a los usuarios ingresar y editar texto. Es comúnmente utilizado en formularios y otros contextos donde se requiere la entrada de texto por parte del usuario.
|
|
4
5
|
*/
|
|
5
|
-
export declare const TextField:
|
|
6
|
+
export declare const TextField: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,8 +6,9 @@ import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
|
6
6
|
import { T as TEXT_FIELD_CLASSES, a as TEXT_FIELD_KEY_COMPONENT } from "./constants.js";
|
|
7
7
|
import { T as TextFieldSlots } from "./slots/TextFieldEnum.js";
|
|
8
8
|
import { useTheme } from "@mui/material";
|
|
9
|
-
import { forwardRef } from "react";
|
|
9
|
+
import React, { forwardRef, useMemo, cloneElement } from "react";
|
|
10
10
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
|
+
import { I as IconButton } from "../IconButton/IconButton.js";
|
|
11
12
|
const TextField = forwardRef(function TextField2(props, ref) {
|
|
12
13
|
const {
|
|
13
14
|
value,
|
|
@@ -37,6 +38,24 @@ const TextField = forwardRef(function TextField2(props, ref) {
|
|
|
37
38
|
color: error ? "error" : "default",
|
|
38
39
|
readOnly: InputProps?.readOnly
|
|
39
40
|
};
|
|
41
|
+
const renderStartAdornment = useMemo(() => {
|
|
42
|
+
if (InputProps?.startAdornment && React.isValidElement(InputProps?.startAdornment)) {
|
|
43
|
+
return cloneElement(InputProps?.startAdornment, {
|
|
44
|
+
size: adjustedSize
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
return InputProps?.startAdornment;
|
|
48
|
+
}
|
|
49
|
+
}, [InputProps?.startAdornment, adjustedSize]);
|
|
50
|
+
const renderEndAdornment = useMemo(() => {
|
|
51
|
+
if (InputProps?.endAdornment && React.isValidElement(InputProps?.endAdornment) && InputProps?.endAdornment.type === IconButton) {
|
|
52
|
+
return cloneElement(InputProps?.endAdornment, {
|
|
53
|
+
size: adjustedSize
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
return InputProps?.endAdornment;
|
|
57
|
+
}
|
|
58
|
+
}, [InputProps?.endAdornment, adjustedSize]);
|
|
40
59
|
const isSkeleton = useModuleSkeleton();
|
|
41
60
|
if (isSkeleton) {
|
|
42
61
|
return /* @__PURE__ */ jsx(
|
|
@@ -68,11 +87,13 @@ const TextField = forwardRef(function TextField2(props, ref) {
|
|
|
68
87
|
maxLength,
|
|
69
88
|
InputProps: {
|
|
70
89
|
...InputProps,
|
|
90
|
+
startAdornment: renderStartAdornment,
|
|
91
|
+
endAdornment: renderEndAdornment,
|
|
71
92
|
...maxLength && {
|
|
72
93
|
endAdornment: /* @__PURE__ */ jsxs(LimitContainerStyled, { children: [
|
|
73
|
-
/* @__PURE__ */ jsx(LimitTextFirstStyled, { role: "text", "aria-label": "current characters", variant: "body", color: "text.secondary", ownerState: { percent }, children: value.length }),
|
|
74
|
-
/* @__PURE__ */ jsx(LimitTextSeparatorStyled, { variant: "body", color: "text.secondary", ownerState: { percent }, children: "/" }),
|
|
75
|
-
/* @__PURE__ */ jsx(LimitTextSecondStyled, { role: "text", "aria-label": "limit characters", variant: "body", color: "text.secondary", ownerState: { percent }, children: maxLength }),
|
|
94
|
+
/* @__PURE__ */ jsx(LimitTextFirstStyled, { size: adjustedSize, role: "text", "aria-label": "current characters", variant: "body", color: "text.secondary", ownerState: { percent }, children: value.length }),
|
|
95
|
+
/* @__PURE__ */ jsx(LimitTextSeparatorStyled, { size: adjustedSize, variant: "body", color: "text.secondary", ownerState: { percent }, children: "/" }),
|
|
96
|
+
/* @__PURE__ */ jsx(LimitTextSecondStyled, { size: adjustedSize, role: "text", "aria-label": "limit characters", variant: "body", color: "text.secondary", ownerState: { percent }, children: maxLength }),
|
|
76
97
|
InputProps?.endAdornment
|
|
77
98
|
] })
|
|
78
99
|
},
|