@m4l/components 9.1.36 → 9.1.37

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 (56) hide show
  1. package/components/hook-form/RHFTextField/RHFTextField.d.ts +1 -1
  2. package/components/hook-form/RHFTextField/RHFTextField.js +100 -126
  3. package/components/hook-form/RHFTextField/RHFTextField.styles.js +11 -212
  4. package/components/hook-form/RHFTextField/slots/RHFTextFieldEnum.d.ts +2 -1
  5. package/components/hook-form/RHFTextField/slots/RHFTextFieldEnum.js +1 -0
  6. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +5 -10
  7. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.js +7 -11
  8. package/components/hook-form/RHFTextField/test/RHFTextField.test.d.ts +1 -0
  9. package/components/hook-form/RHFTextField/types.d.ts +3 -11
  10. package/components/mui_extended/TextField/TextField.js +70 -0
  11. package/components/mui_extended/TextField/TextField.styles.js +245 -0
  12. package/components/mui_extended/TextField/constants.d.ts +1 -0
  13. package/components/mui_extended/TextField/constants.js +8 -0
  14. package/components/mui_extended/TextField/index.js +1 -0
  15. package/components/mui_extended/TextField/slots/TextFieldEnum.d.ts +1 -2
  16. package/components/mui_extended/TextField/slots/TextFieldEnum.js +8 -0
  17. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +2 -7
  18. package/components/mui_extended/TextField/slots/TextFieldSlots.js +18 -0
  19. package/components/mui_extended/TextField/slots/index.js +1 -0
  20. package/components/mui_extended/TextField/test/TextField.test.d.ts +1 -0
  21. package/components/mui_extended/TextField/types.d.ts +5 -1
  22. package/package.json +1 -1
  23. package/components/hook-form/RHFTextField/stories/Default/RHFTextFieldDisabledOutlined.stories.d.ts +0 -10
  24. package/components/hook-form/RHFTextField/stories/Default/RHFTextFieldDisabledText.stories.d.ts +0 -10
  25. package/components/hook-form/RHFTextField/stories/Default/RHFTextFieldSkeleton.stories.d.ts +0 -6
  26. package/components/hook-form/RHFTextField/stories/Error/RHFTextFieldErrorOutlined.stories.d.ts +0 -29
  27. package/components/hook-form/RHFTextField/stories/Error/RHFTextFieldErrorText.stories.d.ts +0 -29
  28. package/components/hook-form/RHFTextField/stories/Primary/RHFTextFieldOutlined.stories.d.ts +0 -29
  29. package/components/hook-form/RHFTextField/stories/Primary/RHFTextFieldText.stories.d.ts +0 -32
  30. package/components/hook-form/RHFTextField/subcomponents/Skeleton/index.d.ts +0 -5
  31. package/components/hook-form/RHFTextField/subcomponents/Skeleton/index.js +0 -29
  32. package/components/hook-form/RHFTextField/subcomponents/Skeleton/types.d.ts +0 -6
  33. package/components/mui_extended/TextField/stories/PaletteColorTextField/Default/TextFieldDisabledOutlined.stories.d.ts +0 -15
  34. package/components/mui_extended/TextField/stories/PaletteColorTextField/Default/TextFieldDisabledText.stories.d.ts +0 -15
  35. package/components/mui_extended/TextField/stories/PaletteColorTextField/Default/TextFieldSkeleton.stories.d.ts +0 -11
  36. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/TextFieldErrorOutlined.stories.d.ts +0 -9
  37. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/TextFieldErrorText.stories.d.ts +0 -9
  38. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateOutlined/TextFieldErrorOutlinedStateActive.stories.d.ts +0 -14
  39. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateOutlined/TextFieldErrorOutlinedStateEnabled.stories.d.ts +0 -14
  40. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateOutlined/TextFieldErrorOutlinedStateFocus.stories.d.ts +0 -14
  41. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateOutlined/TextFieldErrorOutlinedStateHover.stories.d.ts +0 -14
  42. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateText/TextFieldTextErrorStateActive.stories.d.ts +0 -14
  43. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateText/TextFieldTextErrorStateEnabled.stories.d.ts +0 -14
  44. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateText/TextFieldTextErrorStateFocus.stories.d.ts +0 -14
  45. package/components/mui_extended/TextField/stories/PaletteColorTextField/Error/states/stateText/TextFieldTextErrorStateHover.stories.d.ts +0 -14
  46. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/TextFieldOutlined.stories.d.ts +0 -9
  47. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/TextFieldText.stories.d.ts +0 -12
  48. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateOutlined/TextFieldPrimaryOutlinedStateActive.stories.d.ts +0 -14
  49. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateOutlined/TextFieldPrimaryOutlinedStateEnabled.stories.d.ts +0 -14
  50. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateOutlined/TextFieldPrimaryOutlinedStateFocus.stories.d.ts +0 -14
  51. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateOutlined/TextFieldPrimaryOutlinedStateHover.stories.d.ts +0 -14
  52. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateText/TextFieldTextPrimaryStateActive.stories.d.ts +0 -14
  53. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateText/TextFieldTextPrimaryStateEnabled.stories.d.ts +0 -14
  54. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateText/TextFieldTextPrimaryStateFocus.stories.d.ts +0 -14
  55. package/components/mui_extended/TextField/stories/PaletteColorTextField/Primary/states/stateText/TextFieldTextPrimaryStateHover.stories.d.ts +0 -14
  56. package/components/mui_extended/TextField/stories/PaletteColorTextField/sizes/TextFieldSizes.stories.d.ts +0 -16
@@ -6,4 +6,4 @@ import { RHFTextFieldProps } from './types';
6
6
  * @updatedAt 2024-10-22 19:27:23 - automatic
7
7
  * @updatedUser Bruce Escobar - automatic
8
8
  */
9
- export declare const RHFTextField: import('react').ForwardRefExoticComponent<Omit<RHFTextFieldProps, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
9
+ export declare const RHFTextField: import('react').ForwardRefExoticComponent<Omit<RHFTextFieldProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,16 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { useFormContext, Controller } from "react-hook-form";
4
- import { useTheme, InputAdornment } from "@mui/material";
5
- import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
6
- import { useResponsiveDesktop } from "@m4l/graphics";
7
- import { S as SkeletonTextField } from "./subcomponents/Skeleton/index.js";
4
+ import { InputAdornment } from "@mui/material";
8
5
  import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
9
6
  import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
10
7
  import { R as RHF_TEXT_FIELD_KEY_COMPONENT } from "./constant.js";
11
- import { R as RHFTextFieldRootStyled, L as LabelStyled, T as TextFieldStyled } from "./slots/RHFTextFieldSlots.js";
8
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
9
+ import { R as RHFTextFieldRootStyled, L as LabelStyled, T as TextFieldStyled, H as HelperErrorStyled } from "./slots/RHFTextFieldSlots.js";
12
10
  import { R as RHFTextFieldSlots } from "./slots/RHFTextFieldEnum.js";
13
- import { H as HelperError } from "../../HelperError/HelperError.js";
14
11
  const RHFTextField = forwardRef((props, ref) => {
15
12
  const {
16
13
  name,
@@ -22,12 +19,11 @@ const RHFTextField = forwardRef((props, ref) => {
22
19
  size = "small",
23
20
  startIcon,
24
21
  endIcon,
25
- RHFvariants = "outlined",
26
22
  helperMessage = "",
27
23
  disabled,
28
24
  mandatory,
29
- variant,
30
- color = "primary",
25
+ variant = "outlined",
26
+ color = "default",
31
27
  isInteger = true,
32
28
  mandatoryMessage,
33
29
  helperText = true,
@@ -35,133 +31,111 @@ const RHFTextField = forwardRef((props, ref) => {
35
31
  } = props;
36
32
  const ariaLabelledById = `field-label-${name}`;
37
33
  const {
38
- control,
39
- formState: { errors }
34
+ control
40
35
  } = useFormContext();
41
36
  const { handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
42
- const isDesktop = useResponsiveDesktop();
43
- const isSkeleton = useModuleSkeleton();
44
- const theme = useTheme();
45
- const paletteColor = getPropertyByString(
46
- theme.palette,
47
- disabled ? "default" : errors ? "error" : color,
48
- theme.palette.default
49
- );
37
+ const { currentSize } = useComponentSize(size);
38
+ const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
50
39
  const ownerState = {
51
40
  name,
41
+ color,
52
42
  isInteger,
53
- paletteColor,
54
43
  type: type ?? "text",
55
- size: !isDesktop ? "medium" : size,
56
- disabled,
57
- variantRHFTextField: RHFvariants,
58
- RHFtextFieldError: !!errors[name]
44
+ size: adjustedSize,
45
+ disabled
59
46
  };
60
- return (
61
- /* RHFTextFieldRoot: Contenedor principal del componente, es usado para aplicar los estilos css de los overrides
62
- que provienen del objeto del tema. Se usa para garantizar de que estos estilos no se propaguen a otros
63
- componentes de la plataforna web. */
64
- /* @__PURE__ */ jsx(
65
- RHFTextFieldRootStyled,
66
- {
67
- ownerState: { ...ownerState },
68
- onFocus: handlerFocus,
69
- onBlur: handlerOnBlur,
70
- onKeyUp: handlerOnKeyUp,
71
- role: "textbox",
72
- htmlFor: name,
73
- ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.root),
74
- children: !isSkeleton ? (
75
- /* controller: Componente usado para suscribir el componente al contexto de hook-form */
76
- /* @__PURE__ */ jsx(
77
- Controller,
78
- {
79
- name,
80
- control,
81
- render: ({ field: { onChange, value, ref: inputRef }, fieldState: { error } }) => {
82
- const onInternalChange = (event) => {
83
- let newValue = event.target.value;
84
- if (type === "number") {
85
- if (isInteger) {
86
- newValue = newValue ? parseInt(newValue, 10) : "";
87
- } else {
88
- if (!/^\d*\.?\d*$/.test(newValue)) {
89
- newValue = value;
90
- }
91
- }
47
+ return /* @__PURE__ */ jsx(
48
+ RHFTextFieldRootStyled,
49
+ {
50
+ ownerState: { ...ownerState },
51
+ onFocus: handlerFocus,
52
+ onBlur: handlerOnBlur,
53
+ onKeyUp: handlerOnKeyUp,
54
+ role: "textbox",
55
+ htmlFor: name,
56
+ ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.root),
57
+ children: /* @__PURE__ */ jsx(
58
+ Controller,
59
+ {
60
+ name,
61
+ control,
62
+ render: ({ field: { onChange, value, ref: inputRef }, fieldState: { error } }) => {
63
+ const onInternalChange = (event) => {
64
+ let newValue = event.target.value;
65
+ if (type === "number") {
66
+ if (isInteger) {
67
+ newValue = newValue ? parseInt(newValue, 10) : "";
68
+ } else {
69
+ if (!/^\d*\.?\d*$/.test(newValue)) {
70
+ newValue = value;
92
71
  }
93
- onChange(newValue);
94
- };
95
- return /* @__PURE__ */ jsxs(Fragment, { children: [
96
- label && /* @__PURE__ */ jsx(
97
- LabelStyled,
98
- {
99
- ownerState: { ...ownerState },
100
- label,
101
- id: ariaLabelledById,
102
- mandatory,
103
- mandatoryMessage,
104
- helperMessage,
105
- className: "Ejemplo"
106
- }
107
- ),
108
- /* @__PURE__ */ jsx(
109
- TextFieldStyled,
110
- {
111
- ownerState: { ...ownerState, error: !!error || other.error },
112
- disabled,
113
- ref,
114
- inputRef,
115
- InputLabelProps: { shrink: true },
116
- autoComplete,
117
- onChange: onInternalChange,
118
- className: "rhf-text-field-root",
119
- value: type === "number" ? isNaN(parseFloat(value)) ? "" : value : value || "",
120
- inputProps: {
121
- name,
122
- id: name,
123
- "aria-labelledby": ariaLabelledById,
124
- ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.textField)
125
- },
126
- fullWidth: true,
127
- error: !!error,
128
- type,
129
- ...startIcon || endIcon ? {
130
- InputProps: {
131
- ...{
132
- ...startIcon ? {
133
- startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: startIcon })
134
- } : {},
135
- ...endIcon ? {
136
- endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: endIcon })
137
- } : {}
138
- }
139
- }
140
- } : {},
141
- ...other
142
- }
143
- ),
144
- error?.message ? /* @__PURE__ */ jsx(
145
- HelperError,
146
- {
147
- message: error.message
148
- }
149
- ) : null
150
- ] });
72
+ }
151
73
  }
152
- }
153
- )
154
- ) : /* @__PURE__ */ jsx(
155
- SkeletonTextField,
156
- {
157
- variant: variant || void 0,
158
- skeletonWidth,
159
- skeletonHeight,
160
- hasLabel: label
74
+ onChange(newValue);
75
+ };
76
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ label && /* @__PURE__ */ jsx(
78
+ LabelStyled,
79
+ {
80
+ ownerState: { ...ownerState },
81
+ size: adjustedSize,
82
+ label,
83
+ id: ariaLabelledById,
84
+ mandatory,
85
+ mandatoryMessage,
86
+ helperMessage,
87
+ className: "Ejemplo"
88
+ }
89
+ ),
90
+ /* @__PURE__ */ jsx(
91
+ TextFieldStyled,
92
+ {
93
+ ownerState: { ...ownerState, error: !!error || other.error },
94
+ disabled,
95
+ inputRef,
96
+ ref,
97
+ InputLabelProps: { shrink: true },
98
+ autoComplete,
99
+ onChange: onInternalChange,
100
+ className: "rhf-text-field-root",
101
+ value: type === "number" ? isNaN(parseFloat(value)) ? "" : value : value || "",
102
+ inputProps: {
103
+ name,
104
+ id: name,
105
+ "aria-labelledby": ariaLabelledById,
106
+ ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.textField)
107
+ },
108
+ fullWidth: true,
109
+ error: !!error,
110
+ type,
111
+ ...startIcon || endIcon ? {
112
+ InputProps: {
113
+ ...{
114
+ ...startIcon ? {
115
+ startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: startIcon })
116
+ } : {},
117
+ ...endIcon ? {
118
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: endIcon })
119
+ } : {}
120
+ }
121
+ }
122
+ } : {},
123
+ ...other
124
+ }
125
+ ),
126
+ error?.message ? /* @__PURE__ */ jsx(
127
+ HelperErrorStyled,
128
+ {
129
+ ownerState: {},
130
+ message: error.message,
131
+ size: adjustedSize
132
+ }
133
+ ) : null
134
+ ] });
161
135
  }
162
- )
163
- }
164
- )
136
+ }
137
+ )
138
+ }
165
139
  );
166
140
  });
167
141
  RHFTextField.displayName = "RHFTextField";
@@ -1,212 +1,20 @@
1
1
  const rhfTextFieldStyles = {
2
2
  /**
3
- * Estilos personalizados para el componente RHFTextField.
3
+ * Elemento Root
4
4
  */
5
- textField: ({ ownerState, theme }) => ({
6
- "&.rhf-text-field-root": {
7
- width: "100%",
8
- padding: 0,
9
- borderRadius: theme.vars.size.borderRadius.r1,
10
- display: "flex",
11
- '& [class*="M4LIcon-icon"]': {
12
- backgroundColor: ownerState.paletteColor?.main
13
- },
14
- // Variant Outlined TextField
15
- ...ownerState.variantRHFTextField === "outlined" && {
16
- "& .MuiInputBase-root": {
17
- padding: 0,
18
- minHeight: 0,
19
- height: "inherit",
20
- paddingLeft: theme.vars.size.baseSpacings.sp1,
21
- paddingRight: theme.vars.size.baseSpacings.sp1,
22
- borderRadius: theme.vars.size.borderRadius.r1,
23
- "& .MuiOutlinedInput-notchedOutline": {
24
- minHeight: 0,
25
- border: theme.vars.size.borderStroke.actionInput,
26
- borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default
27
- },
28
- //Estilo Hover para primary para el Icono e IconButton
29
- "&:hover": {
30
- backgroundColor: ownerState.paletteColor?.hoverOpacity
31
- },
32
- //Estilo Focus para primary para el Icono e IconButton
33
- ":focus-within": {
34
- borderColor: theme.vars.palette.border.main,
35
- '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
36
- backgroundColor: ownerState.paletteColor?.main
37
- },
38
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
39
- backgroundColor: ownerState.paletteColor?.main
40
- }
41
- },
42
- //Estilo Active para primary para el Icono e IconButton
43
- "&:active": {
44
- ":focus-within": {
45
- '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
46
- backgroundColor: ownerState.paletteColor?.main
47
- },
48
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
49
- backgroundColor: ownerState.paletteColor?.main
50
- },
51
- "&:not(:placeholder-shown)": {
52
- color: ownerState.paletteColor?.active
53
- }
54
- }
55
- },
56
- //Estilos del InputBase
57
- "& .MuiInputBase-input": {
58
- padding: "0px",
59
- paddingRight: theme.vars.size.baseSpacings.sp1,
60
- paddingLeft: theme.vars.size.baseSpacings.sp1,
61
- height: "inherit",
62
- //Estilos del InputBase en hover
63
- "&:hover ~ .MuiOutlinedInput-notchedOutline": {
64
- ...ownerState.error && {
65
- borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default
66
- }
67
- },
68
- // Estilos del InputBase en Focus
69
- "&:focus ~ .MuiOutlinedInput-notchedOutline": {
70
- borderColor: ownerState.paletteColor?.main
71
- },
72
- // Estilos del InputBase en Active
73
- "&:active ~ .MuiOutlinedInput-notchedOutline": {
74
- borderColor: ownerState.paletteColor?.active
75
- },
76
- //Estilos del InputBase en placeholder default
77
- "&::placeholder": {
78
- color: theme.vars.palette.text.secondary
79
- },
80
- "&:not(:placeholder-shown)": {
81
- color: ownerState.textFieldError ? ownerState.paletteColor?.main : theme.vars.palette.text.primary
82
- }
83
- },
84
- //Este estilo se asegura de que los campos de entrada que han sido autocompletados por el navegador no tengan ningún relleno adicional
85
- "& .MuiOutlinedInput-input:-webkit-autofill": {
86
- padding: 0
87
- },
88
- // Historia Disabled para Outlined
89
- ...ownerState.disabled && {
90
- borderColor: theme.vars.palette.border.disabled,
91
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto",
92
- "&:hover": {
93
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto"
94
- },
95
- "& .MuiInputBase-input::placeholder": {
96
- color: theme.vars.palette.text.disabled
97
- }
98
- }
99
- }
100
- },
101
- // Variant Text TextField
102
- ...ownerState.variantRHFTextField === "text" && {
103
- borderColor: "transparent",
104
- "& .MuiInputBase-root": {
105
- padding: 0,
106
- minHeight: 0,
107
- height: "inherit",
108
- borderColor: "transparent",
109
- paddingLeft: theme.vars.size.baseSpacings.sp1,
110
- paddingRight: theme.vars.size.baseSpacings.sp1,
111
- borderRadius: theme.vars.size.borderRadius.r1,
112
- //Estilos para los bordes del campo de texto
113
- "& .MuiOutlinedInput-notchedOutline": {
114
- minHeight: 0,
115
- border: theme.vars.size.borderStroke.actionInput,
116
- borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default,
117
- borderLeft: "transparent",
118
- borderTop: "transparent",
119
- borderRight: "transparent"
120
- },
121
- //Estilo Hover para primary para el Icono e IconButton
122
- "&:hover": {
123
- backgroundColor: ownerState.paletteColor?.hoverOpacity
124
- },
125
- //Estilo Focus para primary para el Icono e IconButton
126
- ":focus-within": {
127
- '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
128
- backgroundColor: ownerState.paletteColor?.main
129
- },
130
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
131
- backgroundColor: ownerState.paletteColor?.main
132
- }
133
- },
134
- //Estilo Active para primary para el Icono e IconButton
135
- "&:active": {
136
- ":focus-within": {
137
- '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
138
- backgroundColor: ownerState.paletteColor?.main
139
- },
140
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
141
- backgroundColor: ownerState.paletteColor?.main
142
- },
143
- "&:not(:placeholder-shown) .MuiOutlinedInput-notchedOutline": {
144
- color: ownerState.textFieldError ? theme.vars.palette.error.main : theme.vars.palette.text.primary
145
- }
146
- }
147
- },
148
- //Estilos del InputBase
149
- "& .MuiInputBase-input": {
150
- padding: "0px",
151
- paddingRight: theme.vars.size.baseSpacings.sp1,
152
- paddingLeft: theme.vars.size.baseSpacings.sp1,
153
- height: "inherit",
154
- //Estilo Focus del InputBase
155
- "&:focus ~ .MuiOutlinedInput-notchedOutline": {
156
- borderColor: ownerState.paletteColor?.main
157
- },
158
- //Estilo Active del InputBase
159
- "&:active ~ .MuiOutlinedInput-notchedOutline": {
160
- borderColor: ownerState.paletteColor?.active
161
- },
162
- // Estilos del InputBase en placeholder default
163
- "&::placeholder": {
164
- color: theme.vars.palette.text.secondary
165
- },
166
- "&:not(:placeholder-shown)": {
167
- color: ownerState.textFieldError ? ownerState.paletteColor?.main : theme.vars.palette.text.primary
168
- }
169
- },
170
- //Este estilo se asegura de que los campos de entrada que han sido autocompletados por el navegador no tengan ningún relleno adicional
171
- "& .MuiOutlinedInput-input:-webkit-autofill": {
172
- padding: 0
173
- },
174
- // Historia Disabled
175
- ...ownerState.disabled && {
176
- "& .MuiOutlinedInput-notchedOutline": {
177
- borderColor: theme.vars.palette.border.disabled,
178
- borderTop: theme.vars.palette.border.disabled,
179
- borderLeft: "transparent",
180
- borderRight: "transparent"
181
- },
182
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto",
183
- "&:hover": {
184
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto"
185
- },
186
- "& .MuiInputBase-input::placeholder": {
187
- color: theme.vars.palette.text.disabled
188
- }
189
- }
190
- }
191
- }
192
- }
5
+ root: ({ theme }) => ({
6
+ display: "flex",
7
+ flexDirection: "column",
8
+ gap: theme.vars.size.baseSpacings.sp1
193
9
  }),
10
+ /**
11
+ * Estilos personalizados para el componente RHFTextField.
12
+ */
13
+ textField: {},
194
14
  /**
195
15
  * Estilos personalizados para el componente Label.
196
16
  */
197
- label: ({ theme }) => ({
198
- display: "flex",
199
- alignItems: "center",
200
- color: theme.vars.palette.text.primary,
201
- "& .mandatory": {
202
- /* color: theme.vars.palette.error.main, */
203
- marginLeft: theme.spacing(0.5)
204
- },
205
- '& .M4LIcon-icon[class*="M4LIcon-icon"]': {
206
- width: "inherit",
207
- height: "inherit"
208
- }
209
- }),
17
+ label: {},
210
18
  /**
211
19
  * Estilos personalizados para el componente Skeleton.
212
20
  * @author Bruce Escobar - automatic
@@ -214,16 +22,7 @@ const rhfTextFieldStyles = {
214
22
  * @updatedAt 2024-10-22 19:27:23 - automatic
215
23
  * @updatedUser Bruce Escobar - automatic
216
24
  */
217
- wrapperSkeletonRHFTextField: ({ ownerState, theme }) => ({
218
- borderRadius: theme.size.borderRadius.r1,
219
- ...ownerState.size === "small" && {
220
- ...theme.generalSettings.isMobile ? { height: theme.vars.size.mobile.small.action } : { height: theme.vars.size.desktop.small.action }
221
- },
222
- // Condiciones de tamaño Medium en el root
223
- ...ownerState.size === "medium" && {
224
- ...theme.generalSettings.isMobile ? { height: theme.vars.size.mobile.medium.action } : { height: theme.vars.size.desktop.medium.action }
225
- }
226
- })
25
+ helperErrorStyled: {}
227
26
  };
228
27
  export {
229
28
  rhfTextFieldStyles as r
@@ -3,5 +3,6 @@ export declare enum RHFTextFieldSlots {
3
3
  label = "label",
4
4
  textField = "textField",
5
5
  skeletonTextFieldRoot = "skeletonTextFieldRoot",
6
- wrapperSkeletonRHFTextField = "wrapperSkeletonRHFTextField"
6
+ wrapperSkeletonRHFTextField = "wrapperSkeletonRHFTextField",
7
+ helperErrorStyled = "helperErrorStyled"
7
8
  }
@@ -4,6 +4,7 @@ var RHFTextFieldSlots = /* @__PURE__ */ ((RHFTextFieldSlots2) => {
4
4
  RHFTextFieldSlots2["textField"] = "textField";
5
5
  RHFTextFieldSlots2["skeletonTextFieldRoot"] = "skeletonTextFieldRoot";
6
6
  RHFTextFieldSlots2["wrapperSkeletonRHFTextField"] = "wrapperSkeletonRHFTextField";
7
+ RHFTextFieldSlots2["helperErrorStyled"] = "helperErrorStyled";
7
8
  return RHFTextFieldSlots2;
8
9
  })(RHFTextFieldSlots || {});
9
10
  export {
@@ -1,17 +1,12 @@
1
- export declare const RHFTextFieldRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
1
+ export declare const RHFTextFieldRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
2
2
  ownerState: Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown>;
3
3
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
4
- export declare const LabelStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Label').LabelProps, keyof import('../../../Label').LabelProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
4
+ export declare const LabelStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Label').LabelProps, keyof import('../../../Label').LabelProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
5
5
  ownerState: Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown>;
6
6
  }, {}, {}>;
7
- export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<{
8
- variant?: import('@mui/material').TextFieldVariants | undefined;
9
- } & Omit<import('@mui/material').FilledTextFieldProps | import('@mui/material').OutlinedTextFieldProps | import('@mui/material').StandardTextFieldProps, "variant">, "children" | "value" | "ref" | "title" | "component" | "size" | "name" | "error" | "select" | "rows" | "id" | "type" | "hidden" | "color" | "content" | "style" | "disabled" | "variant" | "margin" | "label" | "className" | "classes" | "onChange" | "sx" | "translate" | "slot" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoComplete" | "placeholder" | "required" | "fullWidth" | "inputProps" | "inputRef" | "SelectProps" | "multiline" | "maxRows" | "minRows" | "hiddenLabel" | "focused" | "InputProps" | "FormHelperTextProps" | "helperText" | "InputLabelProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
7
+ export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/TextField/types').TextFieldProps, keyof import('../../../mui_extended/TextField/types').TextFieldProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
10
8
  ownerState: Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown>;
11
9
  }, {}, {}>;
12
- export declare const SkeletonTextFieldRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
10
+ export declare const HelperErrorStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../HelperError').HelperErrorProps, keyof import('../../../HelperError').HelperErrorProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
13
11
  ownerState: Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown>;
14
- }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
15
- export declare const WrapperSkeletonRHFTextFieldStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown> & {
16
- ownerState: Partial<import('..').RHFTextFieldOwnerState> & Record<string, unknown>;
17
- }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
12
+ }, {}, {}>;
@@ -2,8 +2,9 @@ import { styled } from "@mui/material/styles";
2
2
  import { R as RHFTextFieldSlots } from "./RHFTextFieldEnum.js";
3
3
  import { R as RHF_TEXT_FIELD_KEY_COMPONENT } from "../constant.js";
4
4
  import { r as rhfTextFieldStyles } from "../RHFTextField.styles.js";
5
- import { TextField } from "@mui/material";
6
5
  import { L as Label } from "../../../Label/Label.js";
6
+ import { T as TextField } from "../../../mui_extended/TextField/TextField.js";
7
+ import { H as HelperError } from "../../../HelperError/HelperError.js";
7
8
  const RHFTextFieldRootStyled = styled("div", {
8
9
  name: RHF_TEXT_FIELD_KEY_COMPONENT,
9
10
  slot: RHFTextFieldSlots.root
@@ -16,18 +17,13 @@ const TextFieldStyled = styled(TextField, {
16
17
  name: RHF_TEXT_FIELD_KEY_COMPONENT,
17
18
  slot: RHFTextFieldSlots.textField
18
19
  })(rhfTextFieldStyles?.textField);
19
- const SkeletonTextFieldRootStyled = styled("div", {
20
+ const HelperErrorStyled = styled(HelperError, {
20
21
  name: RHF_TEXT_FIELD_KEY_COMPONENT,
21
- slot: RHFTextFieldSlots.skeletonTextFieldRoot
22
- })(rhfTextFieldStyles?.skeletonTextFieldRoot);
23
- const WrapperSkeletonRHFTextFieldStyled = styled("div", {
24
- name: RHF_TEXT_FIELD_KEY_COMPONENT,
25
- slot: RHFTextFieldSlots.wrapperSkeletonRHFTextField
26
- })(rhfTextFieldStyles?.wrapperSkeletonRHFTextField);
22
+ slot: RHFTextFieldSlots.helperErrorStyled
23
+ })(rhfTextFieldStyles?.helperErrorStyled);
27
24
  export {
25
+ HelperErrorStyled as H,
28
26
  LabelStyled as L,
29
27
  RHFTextFieldRootStyled as R,
30
- SkeletonTextFieldRootStyled as S,
31
- TextFieldStyled as T,
32
- WrapperSkeletonRHFTextFieldStyled as W
28
+ TextFieldStyled as T
33
29
  };
@@ -1,14 +1,12 @@
1
1
  import { Theme } from '@mui/material/styles';
2
2
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
3
- import { TextFieldProps, PaletteColor } from '@mui/material';
3
+ import { TextFieldProps } from '../../mui_extended/TextField/types';
4
4
  import { ReactElement } from 'react';
5
5
  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 type VariantsRHFTextField = 'outlined' | 'text';
10
- export type RHFTextFieldVariants = 'info' | 'success' | 'warning' | null;
11
- export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputProps' | 'variant' | 'label' | 'theme'>, Omit<LabelProps, 'label'> {
9
+ export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputProps' | 'label' | 'theme' | 'color'>, Omit<LabelProps, 'label'> {
12
10
  skeletonWidth?: string | number;
13
11
  /** Valor de altura total para la vista de carga provisional. */
14
12
  skeletonHeight?: string | number;
@@ -20,26 +18,20 @@ export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputP
20
18
  startIcon?: ReactElement;
21
19
  /** Icono lateral derecho dentro del campo de texto. */
22
20
  endIcon?: ReactElement;
23
- /** Variantes de componente de campo de texto. */
24
- variant?: RHFTextFieldVariants;
25
21
  /** Etiqueta que acompaña al campo de texto. */
26
22
  label?: string;
27
23
  /** Etiqueta que se utiliza para condicionar el valor del campo de texto para que sea de tipo entero o decimal.*/
28
24
  isInteger?: boolean;
29
- color?: Extract<ComponentPalletColor, 'primary'>;
30
- RHFvariants?: VariantsRHFTextField;
25
+ color?: Extract<ComponentPalletColor, 'default'>;
31
26
  RHFtextFieldError?: boolean;
32
27
  }
33
28
  export interface RHFTextFieldState extends Pick<RHFTextFieldProps, 'size' | 'disabled'> {
34
29
  type: 'password' | 'text';
35
30
  isFocus: boolean;
36
31
  isTabSelected: boolean;
37
- variant: RHFTextFieldVariants | 'warning' | 'error' | null;
38
32
  }
39
33
  export type RHFTextFieldOwnerState = RHFTextFieldProps & {
40
34
  componentPaletteColor?: ComponentPalletColor;
41
- paletteColor: PaletteColor;
42
- variantRHFTextField?: VariantsRHFTextField;
43
35
  RHFtextFieldError?: boolean;
44
36
  error?: boolean;
45
37
  };