@m4l/components 8.2.0-beta.devManuela.RHFTextField → 8.2.0

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 (22) hide show
  1. package/components/hook-form/RHFTextField/RHFTextField.js +23 -13
  2. package/components/hook-form/RHFTextField/RHFTextField.styles.js +157 -104
  3. package/components/hook-form/RHFTextField/stories/Error/TextFieldErrorOutlined.stories.d.ts +9 -0
  4. package/components/hook-form/RHFTextField/stories/Error/TextFieldErrorText.stories.d.ts +9 -0
  5. package/components/hook-form/RHFTextField/stories/Primary/TextFieldOutlined.stories.d.ts +9 -0
  6. package/components/hook-form/RHFTextField/stories/Primary/TextFieldText.stories.d.ts +9 -0
  7. package/components/hook-form/RHFTextField/types.d.ts +0 -3
  8. package/components/mui_extended/TextField/slots/TextFieldEnum.d.ts +1 -1
  9. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +6 -6
  10. package/components/mui_extended/TextField/types.d.ts +10 -54
  11. package/package.json +1 -1
  12. package/test/TestAppWrapper.d.ts +31 -0
  13. package/test/utils.d.ts +26 -6
  14. package/components/NavLink/tests/index.test.d.ts +0 -1
  15. package/components/PropertyValue/tests/index.test.d.ts +0 -1
  16. package/components/hook-form/RHFDateTime/test/index.test.d.ts +0 -1
  17. package/components/hook-form/RHFTextField/stories/Error/RHFTextFieldErrorOutlined.stories.d.ts +0 -29
  18. package/components/hook-form/RHFTextField/stories/Error/RHFTextFieldErrorText.stories.d.ts +0 -29
  19. package/components/hook-form/RHFTextField/stories/Primary/RHFTextFieldOutlined.stories.d.ts +0 -29
  20. package/components/hook-form/RHFTextField/stories/Primary/RHFTextFieldText.stories.d.ts +0 -32
  21. package/components/hook-form/RHFUpload/RHFUploadImage/tests/index.test.d.ts +0 -1
  22. package/components/mui_extended/LoadingButton/tests/index.test.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
2
+ import { forwardRef, useState, useEffect } from "react";
3
3
  import { useFormContext, Controller } from "react-hook-form";
4
4
  import { useTheme, InputAdornment } from "@mui/material";
5
5
  import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
@@ -13,7 +13,7 @@ import { R as RHFTextFieldSlots } from "./slots/RHFTextFieldEnum.js";
13
13
  import { H as HelperError } from "../../HelperError/HelperError.js";
14
14
  const RHFTextField = forwardRef((props, ref) => {
15
15
  const {
16
- name,
16
+ name: nameRHF,
17
17
  autoComplete = "off",
18
18
  skeletonWidth = "100%",
19
19
  skeletonHeight = "18px",
@@ -30,32 +30,42 @@ const RHFTextField = forwardRef((props, ref) => {
30
30
  color = "primary",
31
31
  isInteger = true,
32
32
  mandatoryMessage,
33
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
34
  helperText = true,
34
35
  ...other
35
36
  } = props;
36
- const ariaLabelledById = `field-label-${name}`;
37
+ const ariaLabelledById = `field-label-${nameRHF}`;
37
38
  const {
38
39
  control,
39
40
  formState: { errors }
40
41
  } = useFormContext();
42
+ const [currentVariant, setCurrentVariant] = useState(null);
41
43
  const { handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
42
44
  const isDesktop = useResponsiveDesktop();
43
45
  const isSkeleton = useModuleSkeleton();
46
+ useEffect(() => {
47
+ if (errors[nameRHF]) {
48
+ setCurrentVariant("error");
49
+ } else if (variant) {
50
+ setCurrentVariant(variant);
51
+ } else {
52
+ setCurrentVariant(null);
53
+ }
54
+ }, [errors[nameRHF], variant, control]);
44
55
  const theme = useTheme();
45
56
  const paletteColor = getPropertyByString(
46
57
  theme.palette,
47
- disabled ? "default" : errors ? "error" : color,
58
+ disabled ? "default" : color,
48
59
  theme.palette.default
49
60
  );
50
61
  const ownerState = {
51
- name,
62
+ name: nameRHF,
52
63
  isInteger,
53
64
  paletteColor,
54
65
  type: type ?? "text",
55
66
  size: !isDesktop ? "medium" : size,
56
67
  disabled,
57
- variantRHFTextField: RHFvariants,
58
- RHFtextFieldError: !!errors[name]
68
+ variantRHFTextField: RHFvariants
59
69
  };
60
70
  return (
61
71
  /* RHFTextFieldRoot: Contenedor principal del componente, es usado para aplicar los estilos css de los overrides
@@ -69,14 +79,14 @@ const RHFTextField = forwardRef((props, ref) => {
69
79
  onBlur: handlerOnBlur,
70
80
  onKeyUp: handlerOnKeyUp,
71
81
  role: "textbox",
72
- htmlFor: name,
82
+ htmlFor: nameRHF,
73
83
  ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.root),
74
84
  children: !isSkeleton ? (
75
85
  /* controller: Componente usado para suscribir el componente al contexto de hook-form */
76
86
  /* @__PURE__ */ jsx(
77
87
  Controller,
78
88
  {
79
- name,
89
+ name: nameRHF,
80
90
  control,
81
91
  render: ({ field: { onChange, value, ref: inputRef }, fieldState: { error } }) => {
82
92
  const onInternalChange = (event) => {
@@ -118,8 +128,8 @@ const RHFTextField = forwardRef((props, ref) => {
118
128
  className: "rhf-text-field-root",
119
129
  value: type === "number" ? isNaN(parseFloat(value)) ? "" : value : value || "",
120
130
  inputProps: {
121
- name,
122
- id: name,
131
+ name: nameRHF,
132
+ id: nameRHF,
123
133
  "aria-labelledby": ariaLabelledById,
124
134
  ...getPropDataTestId(RHF_TEXT_FIELD_KEY_COMPONENT, RHFTextFieldSlots.textField)
125
135
  },
@@ -141,10 +151,10 @@ const RHFTextField = forwardRef((props, ref) => {
141
151
  ...other
142
152
  }
143
153
  ),
144
- error?.message ? /* @__PURE__ */ jsx(
154
+ currentVariant ? /* @__PURE__ */ jsx(
145
155
  HelperError,
146
156
  {
147
- message: error.message
157
+ message: currentVariant !== "error" ? helperMessage : error?.message
148
158
  }
149
159
  ) : null
150
160
  ] });
@@ -1,212 +1,265 @@
1
1
  const rhfTextFieldStyles = {
2
2
  /**
3
3
  * Estilos personalizados para el componente RHFTextField.
4
+ * @author Bruce Escobar - automatic
5
+ * @createdAt 2024-10-22 09:41:31 - automatic
6
+ * @updatedAt 2024-10-22 19:27:23 - automatic
7
+ * @updatedUser Bruce Escobar - automatic
4
8
  */
5
9
  textField: ({ ownerState, theme }) => ({
6
10
  "&.rhf-text-field-root": {
7
11
  width: "100%",
8
12
  padding: 0,
9
- borderRadius: theme.vars.size.borderRadius.r1,
10
- display: "flex",
11
- '& [class*="M4LIcon-icon"]': {
12
- backgroundColor: ownerState.paletteColor?.main
13
+ borderRadius: theme.size.borderRadius.r1,
14
+ // Condiciones de tamaño Medium en el root
15
+ ...ownerState.sizes === "medium" && {
16
+ ...theme.generalSettings.isMobile ? {
17
+ height: theme.vars.size.mobile.medium.action,
18
+ width: theme.vars.size.mobile.medium.action
19
+ } : {
20
+ height: theme.vars.size.desktop.medium.action,
21
+ width: theme.vars.size.desktop.medium.action
22
+ }
23
+ },
24
+ // Condiciones de tamaño Small en el root
25
+ ...ownerState.sizes === "small" && {
26
+ ...theme.generalSettings.isMobile ? {
27
+ height: theme.vars.size.mobile.small.action,
28
+ width: theme.vars.size.mobile.small.action
29
+ } : {
30
+ height: theme.vars.size.desktop.medium.action,
31
+ width: theme.vars.size.desktop.medium.action
32
+ }
13
33
  },
14
34
  // Variant Outlined TextField
15
35
  ...ownerState.variantRHFTextField === "outlined" && {
16
36
  "& .MuiInputBase-root": {
17
37
  padding: 0,
18
38
  minHeight: 0,
19
- height: "inherit",
20
39
  paddingLeft: theme.vars.size.baseSpacings.sp1,
21
40
  paddingRight: theme.vars.size.baseSpacings.sp1,
22
- borderRadius: theme.vars.size.borderRadius.r1,
41
+ borderRadius: theme.size.borderRadius.r1,
23
42
  "& .MuiOutlinedInput-notchedOutline": {
24
- minHeight: 0,
25
43
  border: theme.vars.size.borderStroke.actionInput,
26
- borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default
44
+ borderColor: theme.vars.palette.border.default
27
45
  },
28
- //Estilo Hover para primary para el Icono e IconButton
29
- "&:hover": {
30
- backgroundColor: ownerState.paletteColor?.hoverOpacity
46
+ //Active para primary para el icono y placeholder
47
+ "&:active": {
48
+ ":focus-within": {
49
+ "&:focus-within .MuiInputBase-input::placeholder": {
50
+ color: theme.vars.palette.primary.active
51
+ },
52
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
53
+ backgroundColor: theme.vars.palette.primary.active
54
+ }
55
+ }
31
56
  },
32
- //Estilo Focus para primary para el Icono e IconButton
57
+ //Estilos de focus primary para el icono y placeholder
33
58
  ":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
59
+ "&:focus-within .MuiInputBase-input::placeholder": {
60
+ color: ownerState.paletteColor?.main
37
61
  },
38
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
62
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
39
63
  backgroundColor: ownerState.paletteColor?.main
40
64
  }
41
65
  },
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
- }
66
+ //Estilos del hover primar
67
+ "&:hover": {
68
+ backgroundColor: ownerState.paletteColor?.hoverOpacity
55
69
  },
56
70
  //Estilos del InputBase
57
71
  "& .MuiInputBase-input": {
58
- padding: "0px",
59
- paddingRight: theme.vars.size.baseSpacings.sp1,
60
- paddingLeft: theme.vars.size.baseSpacings.sp1,
61
- height: "inherit",
72
+ ...ownerState.error && {
73
+ borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default
74
+ },
62
75
  //Estilos del InputBase en hover
63
76
  "&:hover ~ .MuiOutlinedInput-notchedOutline": {
64
77
  ...ownerState.error && {
65
78
  borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default
66
79
  }
67
80
  },
68
- // Estilos del InputBase en Focus
81
+ //Estilos del InputBase en Focus
69
82
  "&:focus ~ .MuiOutlinedInput-notchedOutline": {
70
- borderColor: ownerState.paletteColor?.main
83
+ borderColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
71
84
  },
72
- // Estilos del InputBase en Active
85
+ //Estilos del InputBase en Active
73
86
  "&:active ~ .MuiOutlinedInput-notchedOutline": {
74
- borderColor: ownerState.paletteColor?.active
87
+ borderColor: ownerState.error ? theme.vars.palette.error.active : theme.vars.palette.primary.active
75
88
  },
76
89
  //Estilos del InputBase en placeholder default
77
90
  "&::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
91
+ color: theme.vars.palette.text.primary
82
92
  }
83
93
  },
84
94
  //Este estilo se asegura de que los campos de entrada que han sido autocompletados por el navegador no tengan ningún relleno adicional
85
95
  "& .MuiOutlinedInput-input:-webkit-autofill": {
86
96
  padding: 0
87
97
  },
98
+ // Historia Error variante Outlined
99
+ ...ownerState.error && {
100
+ "& .MuiOutlinedInput-notchedOutline": {
101
+ borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default
102
+ },
103
+ //Estilos del hover Error
104
+ "&:hover": {
105
+ backgroundColor: theme.vars.palette.error.hoverOpacity,
106
+ borderColor: ownerState.paletteColor?.main
107
+ },
108
+ //Estilos focus Error el icono y placeholder de color error
109
+ "&:focus-within": {
110
+ "&:focus-within .MuiInputBase-input::placeholder": {
111
+ color: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
112
+ },
113
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
114
+ backgroundColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
115
+ }
116
+ },
117
+ //Estilos active Error el icono y placeholder de color error
118
+ "&:active": {
119
+ "&:focus-within": {
120
+ "&:focus-within .MuiInputBase-input::placeholder": {
121
+ color: theme.vars.palette.error.active
122
+ },
123
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
124
+ backgroundColor: theme.vars.palette.error.active
125
+ }
126
+ }
127
+ }
128
+ },
88
129
  // Historia Disabled para Outlined
89
130
  ...ownerState.disabled && {
90
- borderColor: theme.vars.palette.border.disabled,
91
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto",
131
+ borderColor: theme.palette.border.disabled,
132
+ pointerEvents: ownerState.disabled ? "none" : "auto",
92
133
  "&:hover": {
93
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto"
94
- },
95
- "& .MuiInputBase-input::placeholder": {
96
- color: theme.vars.palette.text.disabled
134
+ pointerEvents: ownerState.disabled ? "none" : "auto"
97
135
  }
98
136
  }
99
137
  }
100
138
  },
101
- // Variant Text TextField
139
+ // Variant Text RHFTextField
102
140
  ...ownerState.variantRHFTextField === "text" && {
103
141
  borderColor: "transparent",
104
142
  "& .MuiInputBase-root": {
105
143
  padding: 0,
106
144
  minHeight: 0,
107
- height: "inherit",
108
145
  borderColor: "transparent",
109
146
  paddingLeft: theme.vars.size.baseSpacings.sp1,
110
147
  paddingRight: theme.vars.size.baseSpacings.sp1,
111
- borderRadius: theme.vars.size.borderRadius.r1,
148
+ borderRadius: theme.size.borderRadius.r1,
112
149
  //Estilos para los bordes del campo de texto
113
150
  "& .MuiOutlinedInput-notchedOutline": {
114
- minHeight: 0,
115
151
  border: theme.vars.size.borderStroke.actionInput,
116
- borderColor: ownerState.error ? ownerState.paletteColor?.main : theme.vars.palette.border.default,
152
+ borderColor: theme.vars.palette.border.default,
153
+ borderTop: theme.vars.palette.primary.main,
117
154
  borderLeft: "transparent",
118
- borderTop: "transparent",
119
155
  borderRight: "transparent"
120
156
  },
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
157
+ //Estilo Focus para primary para el icono y placeholder
126
158
  ":focus-within": {
127
- '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
128
- backgroundColor: ownerState.paletteColor?.main
159
+ borderColor: theme.palette.border.main,
160
+ "&:focus-within .MuiInputBase-input::placeholder": {
161
+ color: ownerState.paletteColor?.main
129
162
  },
130
- '&:focus-within .MuiIconButton-root [class*="M4LIcon-icon"]': {
131
- backgroundColor: ownerState.paletteColor?.main
163
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
164
+ backgroundColor: theme.vars.palette.primary.main
132
165
  }
133
166
  },
134
- //Estilo Active para primary para el Icono e IconButton
167
+ //Estilo Active para primary para el icono y placeholder
135
168
  "&:active": {
136
169
  ":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
170
+ "&:focus-within .MuiInputBase-input::placeholder": {
171
+ color: theme.vars.palette.primary.active
142
172
  },
143
- "&:not(:placeholder-shown) .MuiOutlinedInput-notchedOutline": {
144
- color: ownerState.textFieldError ? theme.vars.palette.error.main : theme.vars.palette.text.primary
173
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
174
+ backgroundColor: theme.vars.palette.primary.active
145
175
  }
146
176
  }
147
177
  },
178
+ //Estilos para Hover Text
179
+ "&:hover": {
180
+ borderColor: "transparent",
181
+ backgroundColor: ownerState.paletteColor?.hoverOpacity
182
+ },
148
183
  //Estilos del InputBase
149
184
  "& .MuiInputBase-input": {
150
- padding: "0px",
151
- paddingRight: theme.vars.size.baseSpacings.sp1,
152
- paddingLeft: theme.vars.size.baseSpacings.sp1,
153
- height: "inherit",
185
+ "&:hover ~ .MuiOutlinedInput-notchedOutline": {
186
+ borderColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
187
+ },
154
188
  //Estilo Focus del InputBase
155
189
  "&:focus ~ .MuiOutlinedInput-notchedOutline": {
156
- borderColor: ownerState.paletteColor?.main
190
+ borderColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
157
191
  },
158
192
  //Estilo Active del InputBase
159
193
  "&:active ~ .MuiOutlinedInput-notchedOutline": {
160
- borderColor: ownerState.paletteColor?.active
194
+ borderColor: ownerState.error ? theme.vars.palette.error.active : theme.vars.palette.primary.active,
195
+ "&:focus-within .MuiInputBase-input::placeholder": {
196
+ color: theme.vars.palette.primary.active
197
+ }
161
198
  },
162
- // Estilos del InputBase en placeholder default
163
199
  "&::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
200
+ color: theme.vars.palette.text.primary
168
201
  }
169
202
  },
170
203
  //Este estilo se asegura de que los campos de entrada que han sido autocompletados por el navegador no tengan ningún relleno adicional
171
204
  "& .MuiOutlinedInput-input:-webkit-autofill": {
172
205
  padding: 0
173
206
  },
207
+ // Historia Error
208
+ ...ownerState.error && {
209
+ // Historia Error variante Text
210
+ "& .MuiOutlinedInput-notchedOutline": {
211
+ borderColor: theme.vars.palette.border.error,
212
+ borderTop: theme.vars.palette.border.error,
213
+ borderLeft: "transparent",
214
+ borderRight: "transparent",
215
+ "&:focus": { borderColor: theme.vars.palette.error.main }
216
+ },
217
+ //Estilos del hover Error
218
+ "&:hover": {
219
+ backgroundColor: theme.vars.palette.error.hoverOpacity
220
+ },
221
+ // Estilos focus Error el icono y placeholder de color error
222
+ "&:focus-within": {
223
+ borderColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main,
224
+ "&:focus-within .MuiInputBase-input::placeholder": {
225
+ color: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
226
+ },
227
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
228
+ backgroundColor: ownerState.error ? theme.vars.palette.error.main : theme.vars.palette.primary.main
229
+ }
230
+ },
231
+ // Estilos active Error el icono y placeholder de color error
232
+ "&:active": {
233
+ "& .MuiOutlinedInput-notchedOutline": {
234
+ borderColor: theme.vars.palette.error.main
235
+ },
236
+ ":focus-within": {
237
+ "&:focus-within .MuiInputBase-input::placeholder": {
238
+ color: theme.vars.palette.error.active
239
+ },
240
+ '&:focus-within [class*="M4LIcon-icon"]:not(.MuiIconButton-root [class*="M4LIcon-icon"])': {
241
+ backgroundColor: theme.vars.palette.error.active
242
+ }
243
+ }
244
+ }
245
+ },
174
246
  // Historia Disabled
175
247
  ...ownerState.disabled && {
176
248
  "& .MuiOutlinedInput-notchedOutline": {
177
- borderColor: theme.vars.palette.border.disabled,
178
- borderTop: theme.vars.palette.border.disabled,
249
+ borderColor: theme.palette.border.disabled,
250
+ borderTop: theme.palette.border.disabled,
179
251
  borderLeft: "transparent",
180
252
  borderRight: "transparent"
181
253
  },
182
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto",
254
+ pointerEvents: ownerState.disabled ? "none" : "auto",
183
255
  "&:hover": {
184
- pointerEvents: ownerState.textFieldDisabled ? "none" : "auto"
185
- },
186
- "& .MuiInputBase-input::placeholder": {
187
- color: theme.vars.palette.text.disabled
256
+ pointerEvents: ownerState.disabled ? "none" : "auto"
188
257
  }
189
258
  }
190
259
  }
191
260
  }
192
261
  }
193
262
  }),
194
- /**
195
- * Estilos personalizados para el componente Label.
196
- */
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
- }),
210
263
  /**
211
264
  * Estilos personalizados para el componente Skeleton.
212
265
  * @author Bruce Escobar - automatic
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react/*';
2
+ import { RHFTextField } from '../../..';
3
+ declare const meta: Meta<typeof RHFTextField>;
4
+ type Story = StoryObj<typeof RHFTextField>;
5
+ /**
6
+ * Error en RHFTextField outlined y text se utiliza para mostrar un campo de texto que indica un estado de error. Esto es útil para proporcionar retroalimentación visual al usuario cuando hay un problema con la entrada de datos.
7
+ */
8
+ export declare const ErrorOutlined: Story;
9
+ export default meta;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react/*';
2
+ import { RHFTextField } from '../../..';
3
+ declare const meta: Meta<typeof RHFTextField>;
4
+ type Story = StoryObj<typeof RHFTextField>;
5
+ /**
6
+ * Error en RHFTextField outlined y text se utiliza para mostrar un campo de texto que indica un estado de error. Esto es útil para proporcionar retroalimentación visual al usuario cuando hay un problema con la entrada de datos.
7
+ */
8
+ export declare const ErrorText: Story;
9
+ export default meta;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react/*';
2
+ import { RHFTextField } from '../../..';
3
+ declare const meta: Meta<typeof RHFTextField>;
4
+ type Story = StoryObj<typeof RHFTextField>;
5
+ /**
6
+ * Story for the primary outlined RHFvariants of the TextField component.
7
+ */
8
+ export declare const PrimaryOutlined: Story;
9
+ export default meta;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react/*';
2
+ import { RHFTextField } from '../../..';
3
+ declare const meta: Meta<typeof RHFTextField>;
4
+ type Story = StoryObj<typeof RHFTextField>;
5
+ /**
6
+ * Story for the primary text variant of the TextField component.
7
+ */
8
+ export declare const PrimaryText: Story;
9
+ export default meta;
@@ -28,7 +28,6 @@ export interface RHFTextFieldProps extends Omit<TextFieldProps, 'size' | 'inputP
28
28
  isInteger?: boolean;
29
29
  color?: Extract<ComponentPalletColor, 'primary'>;
30
30
  RHFvariants?: VariantsRHFTextField;
31
- RHFtextFieldError?: boolean;
32
31
  }
33
32
  export interface RHFTextFieldState extends Pick<RHFTextFieldProps, 'size' | 'disabled'> {
34
33
  type: 'password' | 'text';
@@ -40,8 +39,6 @@ export type RHFTextFieldOwnerState = RHFTextFieldProps & {
40
39
  componentPaletteColor?: ComponentPalletColor;
41
40
  paletteColor: PaletteColor;
42
41
  variantRHFTextField?: VariantsRHFTextField;
43
- RHFtextFieldError?: boolean;
44
- error?: boolean;
45
42
  };
46
43
  export type RHFTextFieldSlotsType = keyof typeof RHFTextFieldSlots;
47
44
  export type RHFTextFieldStyles = Partial<OverridesStyleRules<RHFTextFieldSlotsType, typeof RHF_TEXT_FIELD_KEY_COMPONENT, Theme> | undefined> | undefined;
@@ -1,5 +1,5 @@
1
1
  export declare enum TextFieldSlots {
2
- root = "root",
2
+ muiTextFieldStyled = "muiTextFieldStyled",
3
3
  textFieldRootStyled = "textFieldRootStyled",
4
4
  muiSkeletonStyled = "muiSkeletonStyled"
5
5
  }
@@ -1,13 +1,13 @@
1
1
  export declare const MuiTextFieldStyled: import('@emotion/styled').StyledComponent<Pick<{
2
2
  variant?: import('@mui/material').TextFieldVariants | undefined;
3
- } & 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" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "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" | "onChange" | "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" | "label" | "key" | "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('../types').TextFieldOwnerState> & Record<string, unknown> & {
4
- ownerState: Partial<import('../types').TextFieldOwnerState> & Record<string, unknown>;
3
+ } & 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" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "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" | "onChange" | "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" | "label" | "key" | "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('../types').OwnerState> & Record<string, unknown> & {
4
+ ownerState: Partial<import('../types').OwnerState> & Record<string, unknown>;
5
5
  }, {}, {}>;
6
- export declare const TextFieldRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').TextFieldOwnerState> & Record<string, unknown> & {
7
- ownerState: Partial<import('../types').TextFieldOwnerState> & Record<string, unknown>;
6
+ export declare const TextFieldRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').OwnerState> & Record<string, unknown> & {
7
+ ownerState: Partial<import('../types').OwnerState> & Record<string, unknown>;
8
8
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
9
9
  export declare const MuiSkeletonStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').SkeletonOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
10
10
  ref?: ((instance: HTMLSpanElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLSpanElement> | null | undefined;
11
- }, "children" | "style" | "variant" | "width" | "height" | "animation" | "sx" | "classes" | "className">, "children" | "ref" | "title" | "id" | "hidden" | "color" | "content" | "style" | "variant" | "width" | "height" | "translate" | "animation" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "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" | "onChange" | "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" | "key"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').TextFieldOwnerState> & Record<string, unknown> & {
12
- ownerState: Partial<import('../types').TextFieldOwnerState> & Record<string, unknown>;
11
+ }, "children" | "style" | "variant" | "width" | "height" | "animation" | "sx" | "classes" | "className">, "children" | "ref" | "title" | "id" | "hidden" | "color" | "content" | "style" | "variant" | "width" | "height" | "translate" | "animation" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "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" | "onChange" | "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" | "key"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').OwnerState> & Record<string, unknown> & {
12
+ ownerState: Partial<import('../types').OwnerState> & Record<string, unknown>;
13
13
  }, {}, {}>;
@@ -4,6 +4,7 @@ import { TextFieldSlots } from './slots/TextFieldEnum';
4
4
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
5
5
  import { TEXT_FIELD_KEY_COMPONENT } from './constants';
6
6
  import { ComponentPalletColor, Sizes } from '@m4l/styles';
7
+ import { LabelProps } from '../../Label/types';
7
8
  /**
8
9
  * Variants for the TextField component.
9
10
  */
@@ -16,64 +17,19 @@ export type SkeletonVariants = 'rectangular' | 'circular' | 'text';
16
17
  * Props for the TextField component.
17
18
  *
18
19
  */
19
- export interface TextFieldProps extends Omit<MUITextFieldProps, 'size' | 'color' | 'disabled' | 'variant'> {
20
- /**
21
- * todo: documentar
22
- */
20
+ export interface TextFieldProps extends Omit<MUITextFieldProps, 'size' | 'color' | 'disabled' | 'variant'>, Pick<LabelProps, 'helperMessage' | 'htmlFor' | 'id' | 'mandatory' | 'mandatoryMessage'> {
23
21
  dataTestId?: string;
24
- /**
25
- * Variante del campo de texto.
26
- * variant="text"
27
- */
28
22
  variant?: TextFieldVariants;
29
- /**
30
- * Indica si el campo de texto está deshabilitado.
31
- * disabled={true}
32
- */
33
23
  disabled?: boolean;
34
- /**
35
- * Tamaño del campo de texto.
36
- * size="medium"
37
- */
38
- size?: Extract<Sizes, 'small' | 'medium'>;
39
- /**
40
- * Color del campo de texto.
41
- * color="primary"
42
- */
24
+ size?: Sizes;
43
25
  color?: Extract<ComponentPalletColor, 'primary'>;
44
26
  }
45
- /**
46
- * Estado del propietario del campo de texto.
47
- */
48
- export interface TextFieldOwnerState {
49
- /**
50
- * Indica si el campo de texto está deshabilitado.
51
- */
52
- textFieldDisabled?: boolean;
53
- /**
54
- * Color de la paleta del campo de texto.
55
- */
56
- textFieldPaletteColor: PaletteColor;
57
- /**
58
- * Variante del campo de texto.
59
- */
60
- textFieldVariant?: TextFieldVariants;
61
- /**
62
- * Color de la paleta del componente del campo de texto.
63
- */
64
- textFieldComponentPaletteColor?: ComponentPalletColor;
65
- /**
66
- * Tamaño del campo de texto.
67
- */
68
- textFieldSizes: Extract<Sizes, 'small' | 'medium'>;
69
- /**
70
- * Indica si el campo de texto es error.
71
- */
72
- textFieldError?: boolean;
73
- /**
74
- * Color del campo de texto.
75
- */
76
- textFieldColor?: Extract<ComponentPalletColor, 'primary'>;
77
- }
27
+ export type OwnerState = Pick<TextFieldProps, 'size' | 'color' | 'disabled' | 'error'> & {
28
+ disabled?: boolean;
29
+ paletteColor: PaletteColor;
30
+ variantTextField?: TextFieldVariants;
31
+ componentPaletteColor?: ComponentPalletColor;
32
+ };
78
33
  export type TextFieldSlotsType = keyof typeof TextFieldSlots;
34
+ export type TextFieldOwnerState = OwnerState;
79
35
  export type TextFieldStyles = Partial<OverridesStyleRules<TextFieldSlotsType, typeof TEXT_FIELD_KEY_COMPONENT, Theme> | undefined> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "8.2.0-beta.devManuela.RHFTextField",
3
+ "version": "8.2.0",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
@@ -0,0 +1,31 @@
1
+ import { FC, ReactNode } from 'react';
2
+ interface TestAppWrapperProps {
3
+ children: ReactNode;
4
+ }
5
+ /**
6
+ * TestWrapper is a React functional component that provides a consistent testing environment
7
+ * for components that rely on various context providers.
8
+ *
9
+ * It wraps the children components with the following contexts:
10
+ * - ModuleSkeletonContext: Provides the skeleton loading state for components that require it.
11
+ * - HostThemeProviderMock: Mocks the theme provider to ensure components are styled correctly during tests.
12
+ * - AppearanceComponentProvider: Supplies the necessary context for appearance-related components.
13
+ *
14
+ * This wrapper is useful for reducing redundancy in tests by encapsulating common providers,
15
+ * allowing for cleaner and more maintainable test code.
16
+ * @param {Object} props - The properties passed to the component.
17
+ * @param {ReactNode} props.children - The child components that will be rendered within the context providers.
18
+ * @example
19
+ * // Usage example
20
+ * render(
21
+ * <TestWrapper>
22
+ * <MyComponent />
23
+ * </TestWrapper>
24
+ * );
25
+ * @author Cesar Garces - automatic
26
+ * @createdAt 2024-10-25 14:12:46 - automatic
27
+ * @updatedAt 2024-10-25 14:12:46 - automatic
28
+ * @updatedUser Cesar Garces - automatic
29
+ */
30
+ declare const TestAppWrapper: FC<TestAppWrapperProps>;
31
+ export default TestAppWrapper;
package/test/utils.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { cleanup, screen, act, fireEvent, within, waitFor, RenderResult } from '@testing-library/react';
2
- import { describe, expect } from 'vitest';
3
- import { default as userEvent } from '@testing-library/user-event';
1
+ import { act, cleanup, fireEvent, RenderResult, screen, waitFor, within } from '@testing-library/react';
4
2
  import { renderHook } from '@testing-library/react-hooks';
5
- import { default as React } from 'react';
3
+ import { default as userEvent, UserEvent } from '@testing-library/user-event';
4
+ import { ReactElement } from 'react';
5
+ import { describe, expect } from 'vitest';
6
6
  /**
7
7
  * TODO: Documentar
8
8
  * @author Juan Escobar - automatic
@@ -10,7 +10,27 @@ import { default as React } from 'react';
10
10
  * @updatedAt 2024-10-09 14:12:46 - automatic
11
11
  * @updatedUser Juan Escobar - automatic
12
12
  */
13
- declare const customRender: (ui: React.ReactElement, options?: {}) => RenderResult & {
13
+ declare const customRender: (ui: ReactElement, options?: {}) => RenderResult & {
14
14
  user: ReturnType<typeof userEvent.setup>;
15
15
  };
16
- export { customRender as render, renderHook, screen, cleanup, act, fireEvent, userEvent, within, waitFor, describe, expect, };
16
+ /**
17
+ * This function is a wrapper around the render function from @testing-library/react.
18
+ * Render Material UI components with the TestAppWrapper context.
19
+ * TestAppWrapper is a React functional component that provides a consistent testing environment
20
+ * for components that rely on various context providers.
21
+ * It wraps the children components with the following contexts:
22
+ * ModuleSkeletonContext, HostThemeProviderMock, and AppearanceComponentProvider.
23
+ * @param ui - The component to render.
24
+ * @param options - Additional options to pass to the render function.
25
+ * @returns The rendered component and the user event object.
26
+ * @example
27
+ * // Usage example
28
+ * const { renderUI, user } = renderMaterialUI(<MyComponent />);
29
+ * @author Andrés Quintero - automatic
30
+ * @createdAt 2024-10-09 14:12:46 - automatic
31
+ * @updatedAt 2024-10-09 14:12:46 - automatic
32
+ */
33
+ declare const renderMaterialUI: (ui: ReactElement, options?: {}) => RenderResult & {
34
+ user: UserEvent;
35
+ };
36
+ export { act, cleanup, describe, expect, fireEvent, customRender as render, renderHook, renderMaterialUI, screen, userEvent, waitFor, within, };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react/*';
2
- import { RHFTextField } from '../../..';
3
- declare const meta: Meta<typeof RHFTextField>;
4
- type Story = StoryObj<typeof RHFTextField>;
5
- /**
6
- * Story for the Error outlined RHFvariants of the TextField component.
7
- */
8
- export declare const ErrorOutlined: Story;
9
- /**
10
- * Story for the Error outlined RHFvariants of the TextField component whit label props and adorment End
11
- */
12
- export declare const ErrorOutlinedAdormentEnd: Story;
13
- /**
14
- * Story for the Error outlined RHFvariants of the TextField component whit label props and adorment Start
15
- */
16
- export declare const ErrorOutlinedAdormentStart: Story;
17
- /**
18
- * Story for the Error outlined RHFvariants of the TextField component whitout adorments.
19
- */
20
- export declare const WhitoutAdorments: Story;
21
- /**
22
- * Story for the Error outlined RHFvariants of the TextField component whit adorment end.
23
- */
24
- export declare const WhitAdormentEnd: Story;
25
- /**
26
- * Story for the Error outlined RHFvariants of the TextField component whit adorment start.
27
- */
28
- export declare const WhitAdormentStart: Story;
29
- export default meta;
@@ -1,29 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react/*';
2
- import { RHFTextField } from '../../..';
3
- declare const meta: Meta<typeof RHFTextField>;
4
- type Story = StoryObj<typeof RHFTextField>;
5
- /**
6
- * Story for the Error Text RHFvariants of the TextField component.
7
- */
8
- export declare const ErrorText: Story;
9
- /**
10
- * Story for the Error Text RHFvariants of the TextField component whit label props and adorment End
11
- */
12
- export declare const ErrorTextAdormentEnd: Story;
13
- /**
14
- * Story for the Error Text RHFvariants of the TextField component whit label props and adorment Start
15
- */
16
- export declare const ErrorTextAdormentStart: Story;
17
- /**
18
- * Story for the Error Text RHFvariants of the TextField component whitout adorments.
19
- */
20
- export declare const WhitoutAdorments: Story;
21
- /**
22
- * Story for the Error Text RHFvariants of the TextField component whit adorment end.
23
- */
24
- export declare const WhitAdormentEnd: Story;
25
- /**
26
- * Story for the Error Text RHFvariants of the TextField component whit adorment start.
27
- */
28
- export declare const WhitAdormentStart: Story;
29
- export default meta;
@@ -1,29 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react/*';
2
- import { RHFTextField } from '../../..';
3
- declare const meta: Meta<typeof RHFTextField>;
4
- type Story = StoryObj<typeof RHFTextField>;
5
- /**
6
- * Story for the primary outlined RHFvariants of the TextField component.
7
- */
8
- export declare const PrimaryOutlined: Story;
9
- /**
10
- * Story for the primary outlined RHFvariants of the TextField component whit label props and adorment End
11
- */
12
- export declare const PrimaryOutlinedAdormentEnd: Story;
13
- /**
14
- * Story for the primary outlined RHFvariants of the TextField component whit label props and adorment Start
15
- */
16
- export declare const PrimaryOutlinedAdormentStart: Story;
17
- /**
18
- * Story for the primary outlined RHFvariants of the TextField component whitout adorments.
19
- */
20
- export declare const WhitoutAdorments: Story;
21
- /**
22
- * Story for the primary outlined RHFvariants of the TextField component whit adorment end.
23
- */
24
- export declare const WhitAdormentEnd: Story;
25
- /**
26
- * Story for the primary outlined RHFvariants of the TextField component whit adorment start.
27
- */
28
- export declare const WhitAdormentStart: Story;
29
- export default meta;
@@ -1,32 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react/*';
2
- import { RHFTextField } from '../../..';
3
- declare const meta: Meta<typeof RHFTextField>;
4
- type Story = StoryObj<typeof RHFTextField>;
5
- /**
6
- * Story for the primary text variant of the TextField component.
7
- */
8
- /**
9
- * Story for the primary text RHFvariants of the TextField component.
10
- */
11
- export declare const PrimaryText: Story;
12
- /**
13
- * Story for the primary text RHFvariants of the TextField component whit label props and adorment End
14
- */
15
- export declare const PrimaryTextAdormentEnd: Story;
16
- /**
17
- * Story for the primary text RHFvariants of the TextField component whit label props and adorment Start
18
- */
19
- export declare const PrimaryTextAdormentStart: Story;
20
- /**
21
- * Story for the primary text RHFvariants of the TextField component whitout adorments.
22
- */
23
- export declare const WhitoutAdorments: Story;
24
- /**
25
- * Story for the primary text RHFvariants of the TextField component whit adorment end.
26
- */
27
- export declare const WhitAdormentEnd: Story;
28
- /**
29
- * Story for the primary text RHFvariants of the TextField component whit adorment start.
30
- */
31
- export declare const WhitAdormentStart: Story;
32
- export default meta;