@m4l/components 9.1.51 → 9.1.53
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/@types/export.d.ts +0 -6
- package/@types/types.d.ts +31 -26
- package/components/Color/Color.d.ts +7 -0
- package/components/Color/Color.js +58 -0
- package/components/Color/Color.styles.d.ts +8 -0
- package/components/Color/Color.styles.js +130 -0
- package/components/Color/Color.test.d.ts +1 -0
- package/components/Color/constants.d.ts +3 -0
- package/components/Color/constants.js +6 -0
- package/components/Color/index.d.ts +1 -0
- package/components/Color/index.js +1 -0
- package/components/Color/slots/ColorEnum.d.ts +5 -0
- package/components/Color/slots/ColorEnum.js +9 -0
- package/components/Color/slots/ColorSlots.d.ts +23 -0
- package/components/Color/slots/ColorSlots.js +23 -0
- package/components/Color/slots/index.d.ts +2 -0
- package/components/Color/slots/index.js +1 -0
- package/components/Color/types.d.ts +64 -0
- package/components/HelperError/HelperError.js +6 -3
- package/components/HelperError/HelperError.styles.js +2 -2
- package/components/HelperError/constant.d.ts +2 -1
- package/components/HelperError/constant.js +6 -3
- package/components/HelperError/slots/HelperErrorSlots.js +1 -1
- package/components/HelperError/types.d.ts +1 -1
- package/components/Label/Label.js +42 -27
- package/components/Label/types.d.ts +1 -2
- package/components/PrintingSystem/types.d.ts +2 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.js +0 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +0 -2
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +90 -68
- package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.d.ts +5 -0
- package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +105 -0
- package/components/hook-form/RHFColorPicker/RHFColorPicker.test.d.ts +1 -0
- package/components/hook-form/RHFColorPicker/constants.d.ts +5 -0
- package/components/hook-form/RHFColorPicker/constants.js +6 -0
- package/components/hook-form/RHFColorPicker/index.d.ts +0 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +5 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +9 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +24 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +23 -0
- package/components/hook-form/RHFColorPicker/slots/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/types.d.ts +51 -7
- package/components/hook-form/RHFTextField/RHFTextField.js +18 -29
- package/components/hook-form/RHFTextField/RHFTextField.styles.js +3 -1
- package/components/hook-form/RHFTextField/types.d.ts +11 -11
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js +0 -4
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.js +0 -6
- package/components/mui_extended/TextField/TextField.js +11 -13
- package/components/mui_extended/TextField/TextField.styles.js +16 -16
- package/components/mui_extended/TextField/constants.js +2 -3
- package/components/mui_extended/TextField/types.d.ts +9 -17
- package/components/mui_extended/Typography/types.d.ts +5 -3
- package/components/mui_extended/Typography/typography.styles.js +7 -298
- package/hooks/useFormFocus/index.d.ts +1 -0
- package/index.js +42 -44
- package/package.json +2 -2
- package/test/TestFormAutoValidation.d.ts +4 -0
- package/utils/getTypographyStyles.d.ts +11 -0
- package/utils/getTypographyStyles.js +8 -0
- package/components/hook-form/RHFColorPicker/classes/constants.d.ts +0 -1
- package/components/hook-form/RHFColorPicker/classes/constants.js +0 -4
- package/components/hook-form/RHFColorPicker/classes/index.d.ts +0 -15
- package/components/hook-form/RHFColorPicker/classes/index.js +0 -44
- package/components/hook-form/RHFColorPicker/classes/types.d.ts +0 -15
- package/components/hook-form/RHFColorPicker/dictionary.d.ts +0 -1
- package/components/hook-form/RHFColorPicker/dictionary.js +0 -6
- package/components/hook-form/RHFColorPicker/styles.d.ts +0 -1
- package/components/hook-form/RHFColorPicker/styles.js +0 -7
- package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.d.ts +0 -5
- package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.js +0 -21
- package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/types.d.ts +0 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
4
4
|
import { InputAdornment } from "@mui/material";
|
|
5
|
-
import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
|
|
6
5
|
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
7
6
|
import { R as RHF_TEXT_FIELD_KEY_COMPONENT } from "./constant.js";
|
|
7
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
8
|
+
import clsx from "clsx";
|
|
8
9
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
10
|
import { R as RHFTextFieldRootStyled, L as LabelStyled, T as TextFieldStyled, H as HelperErrorStyled } from "./slots/RHFTextFieldSlots.js";
|
|
10
11
|
import { R as RHFTextFieldSlots } from "./slots/RHFTextFieldEnum.js";
|
|
@@ -12,11 +13,9 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
12
13
|
const {
|
|
13
14
|
name,
|
|
14
15
|
autoComplete = "off",
|
|
15
|
-
skeletonWidth = "100%",
|
|
16
|
-
skeletonHeight = "18px",
|
|
17
16
|
type,
|
|
18
17
|
label,
|
|
19
|
-
size = "
|
|
18
|
+
size = "medium",
|
|
20
19
|
startIcon,
|
|
21
20
|
endIcon,
|
|
22
21
|
helperMessage = "",
|
|
@@ -27,13 +26,14 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
27
26
|
isInteger = true,
|
|
28
27
|
mandatoryMessage,
|
|
29
28
|
helperText = true,
|
|
29
|
+
className,
|
|
30
30
|
...other
|
|
31
31
|
} = props;
|
|
32
|
-
const
|
|
32
|
+
const htmlForId = useId();
|
|
33
|
+
const ariaLabelledById = `field-label-${htmlForId}`;
|
|
33
34
|
const {
|
|
34
35
|
control
|
|
35
36
|
} = useFormContext();
|
|
36
|
-
const { handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
|
|
37
37
|
const { currentSize } = useComponentSize(size);
|
|
38
38
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
39
39
|
const ownerState = {
|
|
@@ -44,15 +44,12 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
44
44
|
size: adjustedSize,
|
|
45
45
|
disabled
|
|
46
46
|
};
|
|
47
|
+
const classRoot = getComponentSlotRoot(RHF_TEXT_FIELD_KEY_COMPONENT);
|
|
47
48
|
return /* @__PURE__ */ jsx(
|
|
48
49
|
RHFTextFieldRootStyled,
|
|
49
50
|
{
|
|
50
51
|
ownerState: { ...ownerState },
|
|
51
|
-
|
|
52
|
-
onBlur: handlerOnBlur,
|
|
53
|
-
onKeyUp: handlerOnKeyUp,
|
|
54
|
-
role: "textbox",
|
|
55
|
-
htmlFor: name,
|
|
52
|
+
className: clsx(classRoot, className),
|
|
56
53
|
...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.root),
|
|
57
54
|
children: /* @__PURE__ */ jsx(
|
|
58
55
|
Controller,
|
|
@@ -61,16 +58,7 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
61
58
|
control,
|
|
62
59
|
render: ({ field: { onChange, value, ref: inputRef }, fieldState: { error } }) => {
|
|
63
60
|
const onInternalChange = (event) => {
|
|
64
|
-
|
|
65
|
-
if (type === "number") {
|
|
66
|
-
if (isInteger) {
|
|
67
|
-
newValue = newValue ? parseInt(newValue, 10) : "";
|
|
68
|
-
} else {
|
|
69
|
-
if (!/^\d*\.?\d*$/.test(newValue)) {
|
|
70
|
-
newValue = value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
61
|
+
const newValue = event.target.value;
|
|
74
62
|
onChange(newValue);
|
|
75
63
|
};
|
|
76
64
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -80,28 +68,28 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
80
68
|
ownerState: { ...ownerState },
|
|
81
69
|
size: adjustedSize,
|
|
82
70
|
label,
|
|
83
|
-
|
|
71
|
+
htmlFor: htmlForId,
|
|
84
72
|
mandatory,
|
|
85
73
|
mandatoryMessage,
|
|
86
|
-
helperMessage
|
|
87
|
-
className: "Ejemplo"
|
|
74
|
+
helperMessage
|
|
88
75
|
}
|
|
89
76
|
),
|
|
90
77
|
/* @__PURE__ */ jsx(
|
|
91
78
|
TextFieldStyled,
|
|
92
79
|
{
|
|
93
|
-
ownerState: { ...ownerState, error: !!error
|
|
80
|
+
ownerState: { ...ownerState, error: !!error },
|
|
94
81
|
disabled,
|
|
95
82
|
inputRef,
|
|
96
83
|
ref,
|
|
97
84
|
InputLabelProps: { shrink: true },
|
|
98
85
|
autoComplete,
|
|
99
86
|
onChange: onInternalChange,
|
|
100
|
-
className: "rhf-text-field-root",
|
|
101
87
|
value: type === "number" ? isNaN(parseFloat(value)) ? "" : value : value || "",
|
|
102
88
|
inputProps: {
|
|
103
89
|
name,
|
|
104
|
-
|
|
90
|
+
role: "textbox",
|
|
91
|
+
ss: 1,
|
|
92
|
+
id: htmlForId,
|
|
105
93
|
"aria-labelledby": ariaLabelledById,
|
|
106
94
|
...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.textField)
|
|
107
95
|
},
|
|
@@ -128,7 +116,8 @@ const RHFTextField = forwardRef((props, ref) => {
|
|
|
128
116
|
{
|
|
129
117
|
ownerState: {},
|
|
130
118
|
message: error.message,
|
|
131
|
-
size: adjustedSize
|
|
119
|
+
size: adjustedSize,
|
|
120
|
+
htmlFor: htmlForId
|
|
132
121
|
}
|
|
133
122
|
) : null
|
|
134
123
|
] });
|
|
@@ -26,7 +26,9 @@ const rhfTextFieldStyles = {
|
|
|
26
26
|
* @updatedAt 2024-10-22 19:27:23 - automatic
|
|
27
27
|
* @updatedUser Bruce Escobar - automatic
|
|
28
28
|
*/
|
|
29
|
-
helperErrorStyled: {}
|
|
29
|
+
helperErrorStyled: {},
|
|
30
|
+
skeletonTextFieldRoot: {},
|
|
31
|
+
wrapperSkeletonRHFTextField: {}
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
34
|
rhfTextFieldStyles as r
|
|
@@ -6,9 +6,16 @@ import { LabelProps } from '../../Label/types';
|
|
|
6
6
|
import { RHFTextFieldSlots } from './slots';
|
|
7
7
|
import { RHF_TEXT_FIELD_KEY_COMPONENT } from './constant';
|
|
8
8
|
import { ComponentPalletColor } from '@m4l/styles';
|
|
9
|
-
export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputProps' | 'label' | 'theme' | 'color'>, Omit<LabelProps, 'label'> {
|
|
9
|
+
export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputProps' | 'label' | 'theme' | 'color' | 'error'>, Omit<LabelProps, 'label' | 'error'> {
|
|
10
|
+
/**
|
|
11
|
+
* Valor de anchura total para la vista de carga provisional.
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
10
14
|
skeletonWidth?: string | number;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Valor de altura total para la vista de carga provisional.
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
12
19
|
skeletonHeight?: string | number;
|
|
13
20
|
/** Identificador del campo para react hook form. */
|
|
14
21
|
name: string;
|
|
@@ -23,17 +30,10 @@ export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputP
|
|
|
23
30
|
/** Etiqueta que se utiliza para condicionar el valor del campo de texto para que sea de tipo entero o decimal.*/
|
|
24
31
|
isInteger?: boolean;
|
|
25
32
|
color?: Extract<ComponentPalletColor, 'default'>;
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export interface RHFTextFieldState extends Pick<RHFTextFieldProps, 'size' | 'disabled'> {
|
|
29
|
-
type: 'password' | 'text';
|
|
30
|
-
isFocus: boolean;
|
|
31
|
-
isTabSelected: boolean;
|
|
33
|
+
className?: string;
|
|
32
34
|
}
|
|
33
35
|
export type RHFTextFieldOwnerState = RHFTextFieldProps & {
|
|
34
|
-
componentPaletteColor?: ComponentPalletColor;
|
|
35
|
-
RHFtextFieldError?: boolean;
|
|
36
36
|
error?: boolean;
|
|
37
37
|
};
|
|
38
38
|
export type RHFTextFieldSlotsType = keyof typeof RHFTextFieldSlots;
|
|
39
|
-
export type RHFTextFieldStyles =
|
|
39
|
+
export type RHFTextFieldStyles = OverridesStyleRules<RHFTextFieldSlotsType, typeof RHF_TEXT_FIELD_KEY_COMPONENT, Theme>;
|
|
@@ -12,8 +12,6 @@ const RHFTextFieldPassword = (props) => {
|
|
|
12
12
|
const {
|
|
13
13
|
name,
|
|
14
14
|
label,
|
|
15
|
-
skeletonWidth,
|
|
16
|
-
skeletonHeight,
|
|
17
15
|
size,
|
|
18
16
|
mandatory,
|
|
19
17
|
mandatoryMessage,
|
|
@@ -38,8 +36,6 @@ const RHFTextFieldPassword = (props) => {
|
|
|
38
36
|
label,
|
|
39
37
|
type: showPassword ? "text" : "password",
|
|
40
38
|
autoComplete: "on",
|
|
41
|
-
skeletonWidth,
|
|
42
|
-
skeletonHeight,
|
|
43
39
|
size,
|
|
44
40
|
mandatory,
|
|
45
41
|
mandatoryMessage,
|
|
@@ -99,8 +99,6 @@ function GeneralData() {
|
|
|
99
99
|
name: "properties.radius",
|
|
100
100
|
label: getLabel(MAP_GPSTOOLS_DICCTIONARY.LABEL_RADIUS),
|
|
101
101
|
autoComplete: "off",
|
|
102
|
-
skeletonWidth: "70%",
|
|
103
|
-
skeletonHeight: "18px",
|
|
104
102
|
disabled: true,
|
|
105
103
|
size: "small"
|
|
106
104
|
}
|
|
@@ -111,8 +109,6 @@ function GeneralData() {
|
|
|
111
109
|
name: "lat",
|
|
112
110
|
label: getLabel(MAP_GPSTOOLS_DICCTIONARY.LABEL_LAT),
|
|
113
111
|
autoComplete: "off",
|
|
114
|
-
skeletonWidth: "70%",
|
|
115
|
-
skeletonHeight: "18px",
|
|
116
112
|
disabled: true,
|
|
117
113
|
size: "small"
|
|
118
114
|
}
|
|
@@ -123,8 +119,6 @@ function GeneralData() {
|
|
|
123
119
|
name: "lng",
|
|
124
120
|
label: getLabel(MAP_GPSTOOLS_DICCTIONARY.LABEL_LON),
|
|
125
121
|
autoComplete: "off",
|
|
126
|
-
skeletonWidth: "70%",
|
|
127
|
-
skeletonHeight: "18px",
|
|
128
122
|
disabled: true,
|
|
129
123
|
size: "small"
|
|
130
124
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
3
3
|
import { useTheme } from "@mui/material";
|
|
4
4
|
import { S as SkeletonStyled, T as TextFieldRootStyled } from "./slots/TextFieldSlots.js";
|
|
5
5
|
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
6
|
-
import { T as TEXT_FIELD_KEY_COMPONENT
|
|
6
|
+
import { T as TEXT_FIELD_KEY_COMPONENT } from "./constants.js";
|
|
7
7
|
import { T as TextFieldSlots } from "./slots/TextFieldEnum.js";
|
|
8
|
-
import {
|
|
8
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
9
|
+
import clsx from "clsx";
|
|
9
10
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
11
|
const TextField = (props) => {
|
|
11
12
|
const {
|
|
@@ -23,17 +24,13 @@ const TextField = (props) => {
|
|
|
23
24
|
const { currentSize } = useComponentSize(size);
|
|
24
25
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
25
26
|
const theme = useTheme();
|
|
26
|
-
const paletteColor =
|
|
27
|
-
theme.palette,
|
|
28
|
-
disabled ? "default" : error ? "error" : color,
|
|
29
|
-
theme.palette.default
|
|
30
|
-
);
|
|
27
|
+
const paletteColor = disabled && theme.palette.default || error && theme.palette.error || theme.palette[color] || theme.palette.default;
|
|
31
28
|
const ownerState = {
|
|
32
29
|
size: adjustedSize,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
disabled,
|
|
31
|
+
paletteColor,
|
|
32
|
+
variants: variant,
|
|
33
|
+
error
|
|
37
34
|
};
|
|
38
35
|
const isSkeleton = useModuleSkeleton();
|
|
39
36
|
if (isSkeleton) {
|
|
@@ -47,12 +44,13 @@ const TextField = (props) => {
|
|
|
47
44
|
}
|
|
48
45
|
);
|
|
49
46
|
}
|
|
47
|
+
const classRoot = getComponentSlotRoot(TEXT_FIELD_KEY_COMPONENT);
|
|
50
48
|
return /* @__PURE__ */ jsx(
|
|
51
49
|
TextFieldRootStyled,
|
|
52
50
|
{
|
|
51
|
+
className: clsx(classRoot, className),
|
|
53
52
|
ownerState: { ...ownerState },
|
|
54
53
|
...getPropDataTestId(TEXT_FIELD_KEY_COMPONENT, TextFieldSlots.root, dataTestId),
|
|
55
|
-
className: clsx(TEXT_FIELD_CLASSES.root, className),
|
|
56
54
|
autoComplete,
|
|
57
55
|
inputMode: "numeric",
|
|
58
56
|
inputProps: {
|
|
@@ -32,7 +32,7 @@ const textFieldStyles = {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
// Variant Outlined TextField
|
|
35
|
-
...ownerState.
|
|
35
|
+
...ownerState.variants === "outlined" && {
|
|
36
36
|
"& .MuiInputBase-root": {
|
|
37
37
|
padding: 0,
|
|
38
38
|
minHeight: 0,
|
|
@@ -48,11 +48,11 @@ const textFieldStyles = {
|
|
|
48
48
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
49
49
|
minHeight: 0,
|
|
50
50
|
border: theme.vars.size.borderStroke.actionInput,
|
|
51
|
-
borderColor: ownerState.
|
|
51
|
+
borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default
|
|
52
52
|
},
|
|
53
53
|
//Estilo Hover para primary para el Icono e IconButton
|
|
54
54
|
"&:hover": {
|
|
55
|
-
backgroundColor: ownerState.
|
|
55
|
+
backgroundColor: ownerState.error ? "inherit" : theme.palette.primary.hoverOpacity
|
|
56
56
|
},
|
|
57
57
|
//Estilo Focus para primary para el Icono e IconButton
|
|
58
58
|
":focus-within": {
|
|
@@ -83,13 +83,13 @@ const textFieldStyles = {
|
|
|
83
83
|
height: "inherit",
|
|
84
84
|
//Estilos del InputBase en hover
|
|
85
85
|
"&:hover ~ .MuiOutlinedInput-notchedOutline": {
|
|
86
|
-
...ownerState.
|
|
87
|
-
borderColor: ownerState.
|
|
86
|
+
...ownerState.error && {
|
|
87
|
+
borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
// Estilos del InputBase en Focus
|
|
91
91
|
"&:focus ~ .MuiOutlinedInput-notchedOutline": {
|
|
92
|
-
borderColor: ownerState.
|
|
92
|
+
borderColor: ownerState.error ? theme.vars.palette.border.error : ownerState.paletteColor?.selected
|
|
93
93
|
},
|
|
94
94
|
//Estilos del InputBase en placeholder default
|
|
95
95
|
"&::placeholder": {
|
|
@@ -101,11 +101,11 @@ const textFieldStyles = {
|
|
|
101
101
|
padding: 0
|
|
102
102
|
},
|
|
103
103
|
// Historia Disabled para Outlined
|
|
104
|
-
...ownerState.
|
|
104
|
+
...ownerState.disabled && {
|
|
105
105
|
borderColor: theme.palette.border.disabled,
|
|
106
|
-
pointerEvents: ownerState.
|
|
106
|
+
pointerEvents: ownerState.disabled ? "none" : "auto",
|
|
107
107
|
"&:hover": {
|
|
108
|
-
pointerEvents: ownerState.
|
|
108
|
+
pointerEvents: ownerState.disabled ? "none" : "auto"
|
|
109
109
|
},
|
|
110
110
|
"& .MuiInputBase-input::placeholder": {
|
|
111
111
|
color: theme.palette.text.disabled
|
|
@@ -120,7 +120,7 @@ const textFieldStyles = {
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
// Variant Text TextField
|
|
123
|
-
...ownerState.
|
|
123
|
+
...ownerState.variants === "text" && {
|
|
124
124
|
borderColor: "transparent",
|
|
125
125
|
"& .MuiInputBase-root": {
|
|
126
126
|
padding: 0,
|
|
@@ -139,14 +139,14 @@ const textFieldStyles = {
|
|
|
139
139
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
140
140
|
minHeight: 0,
|
|
141
141
|
border: theme.vars.size.borderStroke.actionInput,
|
|
142
|
-
borderColor: ownerState.
|
|
142
|
+
borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default,
|
|
143
143
|
borderLeft: "transparent",
|
|
144
144
|
borderTop: "transparent",
|
|
145
145
|
borderRight: "transparent"
|
|
146
146
|
},
|
|
147
147
|
//Estilo Hover para primary para el Icono e IconButton
|
|
148
148
|
"&:hover": {
|
|
149
|
-
backgroundColor: ownerState.
|
|
149
|
+
backgroundColor: ownerState.error ? "inherit" : theme.palette.primary.hoverOpacity,
|
|
150
150
|
'.MuiIconButton-root [class*="M4LIcon-icon"]': {
|
|
151
151
|
backgroundColor: theme.vars.palette.text.primary
|
|
152
152
|
}
|
|
@@ -179,7 +179,7 @@ const textFieldStyles = {
|
|
|
179
179
|
height: "inherit",
|
|
180
180
|
//Estilo Focus del InputBase
|
|
181
181
|
"&:focus ~ .MuiOutlinedInput-notchedOutline": {
|
|
182
|
-
borderColor: ownerState.
|
|
182
|
+
borderColor: ownerState.error ? theme.vars.palette.border.error : ownerState.paletteColor?.selected
|
|
183
183
|
},
|
|
184
184
|
// Estilos del InputBase en placeholder default
|
|
185
185
|
"&::placeholder": {
|
|
@@ -191,16 +191,16 @@ const textFieldStyles = {
|
|
|
191
191
|
padding: 0
|
|
192
192
|
},
|
|
193
193
|
// Historia Disabled
|
|
194
|
-
...ownerState.
|
|
194
|
+
...ownerState.disabled && {
|
|
195
195
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
196
196
|
borderColor: theme.palette.border.disabled,
|
|
197
197
|
borderTop: theme.palette.border.disabled,
|
|
198
198
|
borderLeft: "transparent",
|
|
199
199
|
borderRight: "transparent"
|
|
200
200
|
},
|
|
201
|
-
pointerEvents: ownerState.
|
|
201
|
+
pointerEvents: ownerState.disabled ? "none" : "auto",
|
|
202
202
|
"&:hover": {
|
|
203
|
-
pointerEvents: ownerState.
|
|
203
|
+
pointerEvents: ownerState.disabled ? "none" : "auto"
|
|
204
204
|
},
|
|
205
205
|
"& .MuiInputBase-input::placeholder": {
|
|
206
206
|
color: theme.palette.text.disabled
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
2
2
|
import { T as TextFieldSlots } from "./slots/TextFieldEnum.js";
|
|
3
3
|
const TEXT_FIELD_KEY_COMPONENT = "M4LTextField";
|
|
4
|
-
|
|
4
|
+
getComponentClasses(TEXT_FIELD_KEY_COMPONENT, TextFieldSlots);
|
|
5
5
|
export {
|
|
6
|
-
TEXT_FIELD_KEY_COMPONENT as T
|
|
7
|
-
TEXT_FIELD_CLASSES as a
|
|
6
|
+
TEXT_FIELD_KEY_COMPONENT as T
|
|
8
7
|
};
|
|
@@ -41,6 +41,10 @@ export interface TextFieldProps extends Omit<MUITextFieldProps, 'size' | 'color'
|
|
|
41
41
|
* color="primary"
|
|
42
42
|
*/
|
|
43
43
|
color?: Extract<ComponentPalletColor, 'default' | 'primary'>;
|
|
44
|
+
/**
|
|
45
|
+
* Indica si el campo de texto debe aceptar solo texto.
|
|
46
|
+
*/
|
|
47
|
+
type?: string;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Estado del propietario del campo de texto.
|
|
@@ -49,19 +53,15 @@ export interface TextFieldOwnerState {
|
|
|
49
53
|
/**
|
|
50
54
|
* Indica si el campo de texto está deshabilitado.
|
|
51
55
|
*/
|
|
52
|
-
|
|
56
|
+
disabled?: boolean;
|
|
53
57
|
/**
|
|
54
58
|
* Color de la paleta del campo de texto.
|
|
55
59
|
*/
|
|
56
|
-
|
|
60
|
+
paletteColor: PaletteColor;
|
|
57
61
|
/**
|
|
58
62
|
* Variante del campo de texto.
|
|
59
63
|
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Color de la paleta del componente del campo de texto.
|
|
63
|
-
*/
|
|
64
|
-
textFieldComponentPaletteColor?: ComponentPalletColor;
|
|
64
|
+
variants?: TextFieldVariants;
|
|
65
65
|
/**
|
|
66
66
|
* Tamaño del campo de texto.
|
|
67
67
|
*/
|
|
@@ -69,15 +69,7 @@ export interface TextFieldOwnerState {
|
|
|
69
69
|
/**
|
|
70
70
|
* Indica si el campo de texto es error.
|
|
71
71
|
*/
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Color del campo de texto.
|
|
75
|
-
*/
|
|
76
|
-
textFieldColor?: Extract<ComponentPalletColor, 'primary'>;
|
|
77
|
-
/**
|
|
78
|
-
* Indica si el campo de texto debe aceptar solo texto.
|
|
79
|
-
*/
|
|
80
|
-
type?: string;
|
|
72
|
+
error?: boolean;
|
|
81
73
|
}
|
|
82
74
|
export type TextFieldSlotsType = keyof typeof TextFieldSlots;
|
|
83
|
-
export type TextFieldStyles =
|
|
75
|
+
export type TextFieldStyles = OverridesStyleRules<TextFieldSlotsType, typeof TEXT_FIELD_KEY_COMPONENT, Theme>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
2
2
|
import { TypographyProps as MUITypographyProps, Theme } from '@mui/material';
|
|
3
|
-
import { Sizes,
|
|
3
|
+
import { Sizes, TypographyVariants } from '@m4l/styles';
|
|
4
4
|
import { TypographySlots } from './slots/typographyEnum';
|
|
5
5
|
import { TYPOGRAPHY_KEY_COMPONENT } from './constants';
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ export type TypographyColors = 'text.primary' | 'text.secondary' | 'text.disable
|
|
|
10
10
|
/**
|
|
11
11
|
* Define la propiedades del componente, se une a las capacidades originales de MUI Typography.
|
|
12
12
|
*/
|
|
13
|
-
export interface TypographyProps extends Omit<MUITypographyProps, 'color' | 'variant' | 'children'> {
|
|
13
|
+
export interface TypographyProps extends Omit<MUITypographyProps, 'color' | 'variant' | 'children' | 'size'> {
|
|
14
14
|
/**
|
|
15
15
|
* Anchura del elemento Skeleton.
|
|
16
16
|
*/
|
|
@@ -30,7 +30,7 @@ export interface TypographyProps extends Omit<MUITypographyProps, 'color' | 'var
|
|
|
30
30
|
/**
|
|
31
31
|
* Listas de variantes de tipografía disponibles para la aplicación web.
|
|
32
32
|
*/
|
|
33
|
-
variant?:
|
|
33
|
+
variant?: TypographyVariants;
|
|
34
34
|
/**
|
|
35
35
|
* Contenido del componente.
|
|
36
36
|
*/
|
|
@@ -39,6 +39,8 @@ export interface TypographyProps extends Omit<MUITypographyProps, 'color' | 'var
|
|
|
39
39
|
* Nombre identificador del componente, es útil para realizar pruebas del componente.
|
|
40
40
|
*/
|
|
41
41
|
dataTestid?: string;
|
|
42
|
+
/** Sirve para vincular un elemento de etiqueta con un elemento de formulario, como un campo de entrada, lo que permite que al hacer clic en el texto de la etiqueta, se active el campo correspondiente*/
|
|
43
|
+
htmlFor?: string | undefined;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Define valores de estado necesarios para estilar el componente.
|