@m4l/components 9.1.52 → 9.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/@types/export.d.ts +0 -6
  2. package/@types/types.d.ts +31 -26
  3. package/components/Color/Color.d.ts +7 -0
  4. package/components/Color/Color.js +58 -0
  5. package/components/Color/Color.styles.d.ts +8 -0
  6. package/components/Color/Color.styles.js +130 -0
  7. package/components/Color/Color.test.d.ts +1 -0
  8. package/components/Color/constants.d.ts +3 -0
  9. package/components/Color/constants.js +6 -0
  10. package/components/Color/index.d.ts +1 -0
  11. package/components/Color/index.js +1 -0
  12. package/components/Color/slots/ColorEnum.d.ts +5 -0
  13. package/components/Color/slots/ColorEnum.js +9 -0
  14. package/components/Color/slots/ColorSlots.d.ts +23 -0
  15. package/components/Color/slots/ColorSlots.js +23 -0
  16. package/components/Color/slots/index.d.ts +2 -0
  17. package/components/Color/slots/index.js +1 -0
  18. package/components/Color/types.d.ts +64 -0
  19. package/components/HelperError/HelperError.js +6 -3
  20. package/components/HelperError/HelperError.styles.js +2 -2
  21. package/components/HelperError/constant.d.ts +2 -1
  22. package/components/HelperError/constant.js +6 -3
  23. package/components/HelperError/slots/HelperErrorSlots.js +1 -1
  24. package/components/HelperError/types.d.ts +1 -1
  25. package/components/Label/Label.js +42 -27
  26. package/components/Label/types.d.ts +1 -2
  27. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.js +0 -2
  28. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +0 -2
  29. package/components/hook-form/RHFColorPicker/RFHColorPicker.js +90 -68
  30. package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.d.ts +5 -0
  31. package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +105 -0
  32. package/components/hook-form/RHFColorPicker/RHFColorPicker.test.d.ts +1 -0
  33. package/components/hook-form/RHFColorPicker/constants.d.ts +5 -0
  34. package/components/hook-form/RHFColorPicker/constants.js +6 -0
  35. package/components/hook-form/RHFColorPicker/index.d.ts +0 -1
  36. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +5 -0
  37. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +9 -0
  38. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +24 -0
  39. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +23 -0
  40. package/components/hook-form/RHFColorPicker/slots/index.d.ts +2 -0
  41. package/components/hook-form/RHFColorPicker/types.d.ts +51 -7
  42. package/components/hook-form/RHFTextField/RHFTextField.js +18 -29
  43. package/components/hook-form/RHFTextField/RHFTextField.styles.js +3 -1
  44. package/components/hook-form/RHFTextField/types.d.ts +11 -11
  45. package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js +0 -4
  46. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.js +0 -6
  47. package/components/mui_extended/TextField/TextField.js +4 -0
  48. package/components/mui_extended/Typography/types.d.ts +3 -1
  49. package/components/mui_extended/Typography/typography.styles.js +1 -0
  50. package/hooks/useFormFocus/index.d.ts +1 -0
  51. package/index.js +42 -44
  52. package/package.json +1 -1
  53. package/test/TestFormAutoValidation.d.ts +4 -0
  54. package/components/hook-form/RHFColorPicker/classes/constants.d.ts +0 -1
  55. package/components/hook-form/RHFColorPicker/classes/constants.js +0 -4
  56. package/components/hook-form/RHFColorPicker/classes/index.d.ts +0 -15
  57. package/components/hook-form/RHFColorPicker/classes/index.js +0 -44
  58. package/components/hook-form/RHFColorPicker/classes/types.d.ts +0 -15
  59. package/components/hook-form/RHFColorPicker/dictionary.d.ts +0 -1
  60. package/components/hook-form/RHFColorPicker/dictionary.js +0 -6
  61. package/components/hook-form/RHFColorPicker/styles.d.ts +0 -1
  62. package/components/hook-form/RHFColorPicker/styles.js +0 -7
  63. package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.d.ts +0 -5
  64. package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.js +0 -21
  65. package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/types.d.ts +0 -2
@@ -1,36 +1,51 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useEnvironment, useModuleSkeleton } from "@m4l/core";
3
+ import clsx from "clsx";
4
+ import { L as LABEL_KEY_COMPONENT } from "./constants.js";
5
+ import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
3
6
  import { L as LabelRootStyled, T as TypographyStyled, a as TypographyMandatoryMessageStyled, I as IconHelperMessageStyled, S as SkeletonStyled } from "./slots/LabelSlots.js";
4
7
  const Label = (props) => {
5
- const { helperMessage, label, mandatory, mandatoryMessage, htmlFor, id, error, size = "medium", disabled } = props;
8
+ const { helperMessage, label, mandatory, mandatoryMessage, htmlFor, id, error, size = "medium", disabled, className } = props;
6
9
  const { host_static_assets, environment_assets } = useEnvironment();
7
10
  const isSkeleton = useModuleSkeleton();
8
- return /* @__PURE__ */ jsx(LabelRootStyled, { ownerState: { disabled }, htmlFor, id, label: "", variantLabel: "standard", children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, { children: [
9
- /* @__PURE__ */ jsx(TypographyStyled, { ownerState: { size, disabled }, variant: "body", className: "", children: label }),
10
- mandatory && /* @__PURE__ */ jsx(
11
- TypographyMandatoryMessageStyled,
12
- {
13
- ownerState: { size, disabled },
14
- variant: "body",
15
- className: mandatoryMessage ? "mandatoryMessage" : "mandatoryAsterisk",
16
- children: mandatoryMessage ? mandatoryMessage : "*"
17
- }
18
- ),
19
- helperMessage && /* @__PURE__ */ jsx(
20
- IconHelperMessageStyled,
21
- {
22
- tooltipContent: helperMessage,
23
- ownerState: { disabled },
24
- placement: "right",
25
- className: error ? "helper-icon-error" : "helper-icon",
26
- src: `${host_static_assets}/${environment_assets}/frontend/components/LabelMessage/assets/icons/infoSmall.svg`
27
- }
28
- )
29
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
30
- /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: {}, variant: "text", width: "30%", height: "14px" }),
31
- mandatory && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: {}, variant: "text", width: "10px", height: "14px" }),
32
- helperMessage && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { type: "helperMessage" }, variant: "rounded", width: "14px", height: "14px" })
33
- ] }) });
11
+ const classRoot = getComponentSlotRoot(LABEL_KEY_COMPONENT);
12
+ return /* @__PURE__ */ jsx(
13
+ LabelRootStyled,
14
+ {
15
+ className: clsx(classRoot, className),
16
+ "aria-label": LABEL_KEY_COMPONENT,
17
+ ownerState: { disabled },
18
+ htmlFor,
19
+ id,
20
+ label: "",
21
+ children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, { children: [
22
+ /* @__PURE__ */ jsx(TypographyStyled, { ownerState: { size, disabled }, variant: "body", className: "", children: label }),
23
+ mandatory && /* @__PURE__ */ jsx(
24
+ TypographyMandatoryMessageStyled,
25
+ {
26
+ ownerState: { size, disabled },
27
+ variant: "body",
28
+ className: mandatoryMessage ? "mandatoryMessage" : "mandatoryAsterisk",
29
+ children: mandatoryMessage ? mandatoryMessage : "*"
30
+ }
31
+ ),
32
+ helperMessage && /* @__PURE__ */ jsx(
33
+ IconHelperMessageStyled,
34
+ {
35
+ tooltipContent: helperMessage,
36
+ ownerState: { disabled },
37
+ placement: "right",
38
+ className: error ? "helper-icon-error" : "helper-icon",
39
+ src: `${host_static_assets}/${environment_assets}/frontend/components/LabelMessage/assets/icons/infoSmall.svg`
40
+ }
41
+ )
42
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: {}, variant: "text", width: "30%", height: "14px" }),
44
+ mandatory && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: {}, variant: "text", width: "10px", height: "14px" }),
45
+ helperMessage && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { type: "helperMessage" }, variant: "rounded", width: "14px", height: "14px" })
46
+ ] })
47
+ }
48
+ );
34
49
  };
35
50
  export {
36
51
  Label as L
@@ -8,7 +8,6 @@ export interface LabelProps {
8
8
  helperMessage?: string | undefined;
9
9
  /** Es la etiqueta de texto principal del componente.*/
10
10
  label: string;
11
- variantLabel?: LabelVariants;
12
11
  /** Es una propiedad que permite visualizar el texto que acompaña a la etiqueta `label` Por defecto es `false`.*/
13
12
  mandatory?: boolean;
14
13
  /** Es una etiqueta de texto que define si el campo es obligatorio, por defecto se visualiza un `*` de lo contrario se va a mostrar el valor que se proporciona .*/
@@ -32,7 +31,7 @@ export interface LabelProps {
32
31
  /** Indica si el componente está deshabilitado. */
33
32
  disabled?: boolean;
34
33
  }
35
- export type OwnerState = Pick<LabelProps, 'size' | 'variantLabel'>;
34
+ export type OwnerState = Pick<LabelProps, 'size'>;
36
35
  export interface LabelOwnerState extends LabelProps, OwnerState {
37
36
  }
38
37
  export type LabelSlotsType = keyof typeof LabelSlots;
@@ -177,8 +177,6 @@ const AreaChip = (props) => {
177
177
  RHFTextField,
178
178
  {
179
179
  name: "inputEditArea",
180
- skeletonWidth: "70%",
181
- skeletonHeight: "18px",
182
180
  sx: { mt: "20px" }
183
181
  }
184
182
  ),
@@ -177,8 +177,6 @@ const ChipMobile = (props) => {
177
177
  RHFTextField,
178
178
  {
179
179
  name: "inputEditArea",
180
- skeletonWidth: "70%",
181
- skeletonHeight: "18px",
182
180
  sx: { mt: "20px" }
183
181
  }
184
182
  ),
@@ -1,58 +1,63 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { useFormContext, useWatch, Controller } from "react-hook-form";
4
- import { useModuleSkeleton, useEnvironment, useModuleDictionary } from "@m4l/core";
5
- import { SketchPicker } from "react-color";
6
- import { u as useUtilityClasses } from "./classes/index.js";
7
- import { R as RHFColorPickerRoot } from "./styles.js";
8
- import { useTheme } from "@mui/material/styles";
9
- import { R as RHFColorPickerSkeleton } from "./subcomponents/Skeleton/indext.js";
10
- import { useResponsiveDesktop } from "@m4l/graphics";
11
- import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
4
+ import { clsx } from "clsx";
5
+ import { useModuleSkeleton } from "@m4l/core";
6
+ import { useTheme } from "@mui/material";
7
+ import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
8
+ import { R as RHFCOLORPICKER_PREFIX, a as RHFCOLOR_PICKER_KEY_COMPONENT } from "./constants.js";
9
+ import { R as RHFColorPickerSlots } from "./slots/RHFColorPickerEnum.js";
10
+ import { R as RootStyled, P as PopoverStyled, S as SketchPickerStyled } from "./slots/RHFColorPickerSlots.js";
11
+ import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
12
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
12
13
  import { L as Label } from "../../Label/Label.js";
14
+ import { C as Color } from "../../Color/Color.js";
13
15
  import { H as HelperError } from "../../HelperError/HelperError.js";
14
- import { P as Popover } from "../../mui_extended/Popover/Popover.js";
15
- import { B as Button } from "../../mui_extended/Button/Button.js";
16
- import { I as Icon } from "../../Icon/Icon.js";
16
+ import { A as ActionsContainer } from "../../CommonActions/components/ActionsContainer/ActionsContainer.js";
17
+ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/ActionCancel.js";
18
+ import { A as ActionIntro } from "../../CommonActions/components/ActionIntro/ActionIntro.js";
17
19
  const RHFColorPicker = (props) => {
18
- const { name, size = "small", label, mandatory, mandatoryMessage, helperMessage } = props;
19
- const { control, setValue, trigger } = useFormContext();
20
- const isSkeleton = useModuleSkeleton();
21
- const { host_static_assets, environment_assets } = useEnvironment();
22
- const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
20
+ const {
21
+ name,
22
+ size = "small",
23
+ label,
24
+ mandatory,
25
+ mandatoryMessage,
26
+ helperMessage,
27
+ instaceDataTestId,
28
+ disabled,
29
+ className
30
+ } = props;
31
+ const { control, setValue, formState: { isSubmitted } } = useFormContext();
23
32
  const theme = useTheme();
33
+ const isSkeleton = useModuleSkeleton();
34
+ const { currentSize } = useComponentSize(size);
35
+ const ownerState = {
36
+ size: currentSize
37
+ };
24
38
  const currentColor = useWatch({
25
39
  name,
26
40
  control
27
41
  });
28
- const isDesktop = useResponsiveDesktop();
29
42
  const [tempColor, setTempColor] = useState(() => currentColor || "#ffffff");
30
43
  const [anchorEl, setAnchorEl] = useState(null);
31
- const { getLabel } = useModuleDictionary();
32
44
  const handleColorChange = (color) => {
33
45
  setTempColor(color.hex);
34
46
  };
35
47
  const handleApprove = () => {
36
48
  setAnchorEl(null);
37
49
  if (tempColor !== currentColor) {
38
- setValue(name, tempColor);
39
- trigger(name);
50
+ setValue(name, tempColor, { shouldValidate: isSubmitted });
40
51
  }
41
52
  };
42
- const ownerState = {
43
- isFocus: !isSkeleton ? isFocus : false,
44
- isTabSelected: !isSkeleton ? isTabSelected : false,
45
- size: isDesktop ? size : "medium"
46
- };
47
- const classes = useUtilityClasses(ownerState);
53
+ const classes = getComponentClasses(RHFCOLOR_PICKER_KEY_COMPONENT, RHFColorPickerSlots);
48
54
  return /* @__PURE__ */ jsx(
49
- RHFColorPickerRoot,
55
+ RootStyled,
50
56
  {
51
- className: classes.root,
52
- onFocus: handlerFocus,
53
- onBlur: handlerOnBlur,
54
- onKeyUp: handlerOnKeyUp,
55
- children: !isSkeleton ? /* @__PURE__ */ jsx(
57
+ role: isSkeleton ? "presentation" : void 0,
58
+ ...getPropDataTestId(RHFCOLORPICKER_PREFIX, RHFColorPickerSlots.root, instaceDataTestId),
59
+ ownerState: { ownerState },
60
+ children: /* @__PURE__ */ jsx(
56
61
  Controller,
57
62
  {
58
63
  name,
@@ -62,74 +67,91 @@ const RHFColorPicker = (props) => {
62
67
  label && /* @__PURE__ */ jsx(
63
68
  Label,
64
69
  {
70
+ size,
65
71
  label,
66
72
  mandatory,
67
73
  mandatoryMessage,
68
74
  helperMessage
69
75
  }
70
76
  ),
71
- /* @__PURE__ */ jsxs(
72
- "div",
77
+ /* @__PURE__ */ jsx(
78
+ Color,
73
79
  {
80
+ "aria-errormessage": error?.message || void 0,
81
+ size,
82
+ onClick: (event) => setAnchorEl(event.currentTarget),
83
+ value,
74
84
  role: "button",
75
85
  tabIndex: 0,
76
- className: classes.containerFieldColor,
77
- onClick: (event) => setAnchorEl(event.currentTarget),
78
86
  onKeyDown: (event) => {
79
87
  if (event.key === "Enter" || event.key === " ") {
80
88
  setAnchorEl(event.currentTarget);
81
89
  }
82
90
  },
83
- children: [
84
- /* @__PURE__ */ jsx(
85
- "div",
86
- {
87
- className: classes.fieldColor,
88
- style: {
89
- backgroundColor: value
90
- }
91
- }
92
- ),
93
- /* @__PURE__ */ jsx(
94
- Icon,
95
- {
96
- src: `${host_static_assets}/${environment_assets}/frontend/components/rhfcolorpicker/assets/icons/chevron_right.svg`
97
- }
98
- )
99
- ]
91
+ color: error?.message ? "error" : "default",
92
+ disabled: isSkeleton ? true : disabled
100
93
  }
101
94
  ),
102
- error?.message && /* @__PURE__ */ jsx(HelperError, { message: error?.message + "" }),
103
- /* @__PURE__ */ jsx(
104
- Popover,
95
+ error?.message && /* @__PURE__ */ jsx(
96
+ HelperError,
97
+ {
98
+ size,
99
+ message: error?.message + ""
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsxs(
103
+ PopoverStyled,
105
104
  {
105
+ className: clsx(classes.popover, className),
106
+ size,
107
+ ownerState: { error: !!error, size: currentSize },
106
108
  open: Boolean(anchorEl),
107
- arrowType: "top-center",
108
- className: classes.popoverRoot,
109
+ arrowType: "no-arrow",
109
110
  anchorEl,
110
111
  onClose: () => setAnchorEl(null),
111
112
  anchorOrigin: {
112
113
  vertical: "bottom",
113
- horizontal: "center"
114
+ horizontal: "left"
114
115
  },
115
116
  transformOrigin: {
116
117
  vertical: "top",
117
- horizontal: "center"
118
+ horizontal: "left"
118
119
  },
119
120
  sx: {
120
- mt: "12px",
121
- ml: -1.25,
122
- ...theme.components?.M4LRHFColorPickerPopoverRoot?.styleOverrides || {}
121
+ mt: error?.message ? theme.vars.size.baseSpacings.sp7 : 0
123
122
  },
124
- children: /* @__PURE__ */ jsxs("div", { className: classes.containerPicker, children: [
125
- /* @__PURE__ */ jsx(SketchPicker, { color: tempColor, onChange: handleColorChange, disableAlpha: true }),
126
- /* @__PURE__ */ jsx(Button, { variant: "contained", onClick: handleApprove, label: getLabel("rhfcolorpicker.accept") })
127
- ] })
123
+ children: [
124
+ /* @__PURE__ */ jsx(
125
+ SketchPickerStyled,
126
+ {
127
+ ownerState: { ownerState },
128
+ color: tempColor,
129
+ onChange: handleColorChange,
130
+ disableAlpha: true
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsxs(ActionsContainer, { children: [
134
+ /* @__PURE__ */ jsx(
135
+ ActionCancel,
136
+ {
137
+ onClick: () => setAnchorEl(null),
138
+ size
139
+ }
140
+ ),
141
+ /* @__PURE__ */ jsx(
142
+ ActionIntro,
143
+ {
144
+ onClick: handleApprove,
145
+ size
146
+ }
147
+ )
148
+ ] })
149
+ ]
128
150
  }
129
151
  )
130
152
  ] })
131
153
  }
132
- ) : /* @__PURE__ */ jsx(RHFColorPickerSkeleton, { label })
154
+ )
133
155
  }
134
156
  );
135
157
  };
@@ -0,0 +1,5 @@
1
+ import { RHFColorPickerStyles } from './types';
2
+ /**
3
+ * Estilos para el componente `RHFColorPicker`. Define los estilos de cada parte del componente, como el root, label, color, popover, sketch picker, y las acciones.
4
+ */
5
+ export declare const rhfcolorPickerStyles: RHFColorPickerStyles;
@@ -0,0 +1,105 @@
1
+ const rhfcolorPickerStyles = {
2
+ /**
3
+ * Estilos para el elemento raíz del `RHFColorPicker`.
4
+ * Aplica un layout de columna con un espacio entre los elementos basado en el tamaño de espaciado definido en el tema.
5
+ */
6
+ root: ({ theme }) => ({
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ gap: theme.vars.size.baseSpacings.sp1
10
+ }),
11
+ /**
12
+ * Estilos para el `Popover` dentro del `RHFColorPicker`.
13
+ * Define la apariencia del `Popover`, como el borde, el padding y el estilo de los botones dentro del `Popover`.
14
+ */
15
+ popover: ({ theme, ownerState }) => {
16
+ return {
17
+ "& .MuiPaper-root": {
18
+ padding: 0,
19
+ border: theme.vars.size.borderStroke.container,
20
+ borderColor: ownerState.error ? theme.vars.palette.border.error : theme.vars.palette.border.default,
21
+ borderRadius: theme.vars.size.borderRadius.r1,
22
+ "& .MuiButtonBase-root": {
23
+ // Ajuste específico de estilo para el contenido de los botones
24
+ justifyContent: "center"
25
+ }
26
+ }
27
+ };
28
+ },
29
+ /**
30
+ * Estilos para el `SketchPicker`, que es el selector de colores dentro del `RHFColorPicker`.
31
+ * Define el layout y la apariencia de las cajas de color, ajustando el diseño y el estilo de los elementos dentro del selector.
32
+ */
33
+ sketchPicker: ({ theme }) => ({
34
+ display: "flex",
35
+ flexDirection: "column",
36
+ gap: theme.vars.size.baseSpacings.sp3,
37
+ boxShadow: "none !important",
38
+ "& > div": {
39
+ // Caja de selección de color
40
+ "&:nth-of-type(1)": {
41
+ borderRadius: theme.vars.size.borderRadius.r1
42
+ },
43
+ // Caja de selección horizontal de color
44
+ "&:nth-of-type(2)": {
45
+ display: "flex !important",
46
+ justifyContent: "center !important",
47
+ alignItems: "center !important",
48
+ gap: theme.vars.size.baseSpacings.sp3,
49
+ "& > div:nth-of-type(1)": {
50
+ padding: "0px !important",
51
+ "& > div:nth-of-type(1)": {
52
+ height: `${theme.vars.size.baseSpacings.sp3}!important`,
53
+ borderRadius: `${theme.vars.size.borderRadius["r0-5"]} !important`,
54
+ "& > div > div > div > div": {
55
+ height: "10px !important"
56
+ }
57
+ }
58
+ },
59
+ "& > div:nth-of-type(2)": {
60
+ margin: "0px !important",
61
+ borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
62
+ height: `${theme.vars.size.desktop.medium.base} !important`,
63
+ width: `${theme.vars.size.desktop.medium.base} !important`,
64
+ "& div": {
65
+ borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
66
+ boxShadow: "none !important"
67
+ }
68
+ }
69
+ },
70
+ // Inputs para el cambio de color mediante a texto( hexadecimal o rgb )
71
+ "&:nth-of-type(3)": {
72
+ padding: "0px !important",
73
+ "& > div": {
74
+ // Estilos compartidos para las cajas de color
75
+ "&:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3), &:nth-of-type(4), &:nth-of-type(5)": {
76
+ padding: "0px !important",
77
+ "& div": {
78
+ display: "flex !important",
79
+ flexDirection: "column-reverse !important",
80
+ "& label": {
81
+ textAlign: "left !important",
82
+ color: `${theme.vars.palette.text.secondary} !important`,
83
+ textTransform: "uppercase !important",
84
+ padding: "0px !important"
85
+ },
86
+ "& input": {
87
+ borderRadius: theme.vars.size.borderRadius.r1
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ //Colores en grid varios del componente de react-color
94
+ "&:nth-of-type(4)": {
95
+ paddingTop: "0px !important"
96
+ }
97
+ },
98
+ "& .flexbox-fix": {
99
+ border: "0px !important"
100
+ }
101
+ })
102
+ };
103
+ export {
104
+ rhfcolorPickerStyles as r
105
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Nombre de clase que se usa para dar identidad a los slots del componente.
3
+ */
4
+ export declare const RHFCOLOR_PICKER_KEY_COMPONENT = "M4LRHFColorPicker";
5
+ export declare const RHFCOLORPICKER_PREFIX = "RHFColorPicker";
@@ -0,0 +1,6 @@
1
+ const RHFCOLOR_PICKER_KEY_COMPONENT = "M4LRHFColorPicker";
2
+ const RHFCOLORPICKER_PREFIX = "RHFColorPicker";
3
+ export {
4
+ RHFCOLORPICKER_PREFIX as R,
5
+ RHFCOLOR_PICKER_KEY_COMPONENT as a
6
+ };
@@ -1,2 +1 @@
1
1
  export { RHFColorPicker } from './RFHColorPicker';
2
- export { getRHFColorPickerComponentsDictionary } from './dictionary';
@@ -0,0 +1,5 @@
1
+ export declare enum RHFColorPickerSlots {
2
+ root = "root",
3
+ popover = "popover",
4
+ sketchPicker = "sketchPicker"
5
+ }
@@ -0,0 +1,9 @@
1
+ var RHFColorPickerSlots = /* @__PURE__ */ ((RHFColorPickerSlots2) => {
2
+ RHFColorPickerSlots2["root"] = "root";
3
+ RHFColorPickerSlots2["popover"] = "popover";
4
+ RHFColorPickerSlots2["sketchPicker"] = "sketchPicker";
5
+ return RHFColorPickerSlots2;
6
+ })(RHFColorPickerSlots || {});
7
+ export {
8
+ RHFColorPickerSlots as R
9
+ };
@@ -0,0 +1,24 @@
1
+ import { SketchPicker } from 'react-color';
2
+ /**
3
+ * Styled component que representa el contenedor raíz del `RHFColorPicker`.
4
+ * Aplica los estilos definidos en `rhfcolorPickerStyles.root` al envoltorio `div`.
5
+ */
6
+ export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
7
+ ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
8
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
9
+ /**
10
+ * Styled component para el `Popover` dentro del `RHFColorPicker`.
11
+ * Aplica los estilos definidos en `rhfcolorPickerStyles.popover` al componente `Popover`.
12
+ */
13
+ export declare const PopoverStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Popover/types').PopoverProps, keyof import('../../../mui_extended/Popover/types').PopoverProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
14
+ ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
15
+ }, {}, {}>;
16
+ /**
17
+ * Styled component para el componente `SketchPicker` de `react-color` dentro del `RHFColorPicker`.
18
+ * Aplica los estilos definidos en `rhfcolorPickerStyles.sketchPicker` al componente `SketchPicker`.
19
+ */
20
+ export declare const SketchPickerStyled: import('@emotion/styled').StyledComponent<Pick<import('react-color').SketchPickerProps, keyof import('react-color').SketchPickerProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown> & {
21
+ ownerState: Partial<import('../types').RHFColorPickerOwnerState> & Record<string, unknown>;
22
+ }, {}, {
23
+ ref?: import('react').Ref<SketchPicker> | undefined;
24
+ }>;
@@ -0,0 +1,23 @@
1
+ import { SketchPicker } from "react-color";
2
+ import { styled } from "@mui/material";
3
+ import { R as RHFColorPickerSlots } from "./RHFColorPickerEnum.js";
4
+ import { a as RHFCOLOR_PICKER_KEY_COMPONENT } from "../constants.js";
5
+ import { r as rhfcolorPickerStyles } from "../RHFColorPicker.styles.js";
6
+ import { P as Popover } from "../../../mui_extended/Popover/Popover.js";
7
+ const RootStyled = styled("div", {
8
+ name: RHFCOLOR_PICKER_KEY_COMPONENT,
9
+ slot: RHFColorPickerSlots.root
10
+ })(rhfcolorPickerStyles?.root);
11
+ const PopoverStyled = styled(Popover, {
12
+ name: RHFCOLOR_PICKER_KEY_COMPONENT,
13
+ slot: RHFColorPickerSlots.popover
14
+ })(rhfcolorPickerStyles?.popover);
15
+ const SketchPickerStyled = styled(SketchPicker, {
16
+ name: RHFCOLOR_PICKER_KEY_COMPONENT,
17
+ slot: RHFColorPickerSlots.sketchPicker
18
+ })(rhfcolorPickerStyles?.sketchPicker);
19
+ export {
20
+ PopoverStyled as P,
21
+ RootStyled as R,
22
+ SketchPickerStyled as S
23
+ };
@@ -0,0 +1,2 @@
1
+ export * from './RHFColorPickerEnum';
2
+ export * from './RHFColorPickerSlots';
@@ -1,19 +1,63 @@
1
+ import { Theme } from '@mui/material';
2
+ import { Sizes } from '@m4l/styles';
3
+ import { OverridesStyleRules } from '@mui/material/styles/overrides';
1
4
  import { LabelProps } from '../../Label/types';
2
- export interface RHFColorPickerProps extends Omit<LabelProps, 'label'> {
5
+ import { RHFColorPickerSlots } from './slots/RHFColorPickerEnum';
6
+ import { RHFCOLOR_PICKER_KEY_COMPONENT } from './constants';
7
+ /**
8
+ * Interfaz de las propiedades que acepta el componente `RHFColorPicker`.
9
+ * Esta interfaz extiende `LabelProps`, excluyendo la propiedad `label`.
10
+ */
11
+ export interface RHFColorPickerProps extends Omit<LabelProps, 'label' | 'error'> {
3
12
  /**
4
- * Nombre de etiqueta del campo
13
+ * Nombre de etiqueta del campo.
14
+ * Esta propiedad se utiliza para etiquetar el campo del color picker.
15
+ * Puede ser útil para accesibilidad o como descripción del campo.
5
16
  */
6
17
  label?: string;
7
18
  /**
8
- * Identificador del campo dentro del formulario de react hook form
19
+ * Identificador único del campo dentro del formulario de React Hook Form.
20
+ * Este identificador es necesario para vincular el campo con el formulario y manejar su estado.
9
21
  */
10
22
  name: string;
11
23
  /**
12
- * Variaciones de tamaño para el componente
24
+ * Variación de tamaño para el componente. Permite seleccionar entre dos tamaños:
25
+ * - `small`: Tamaño pequeño.
26
+ * - `medium`: Tamaño mediano.
13
27
  */
14
28
  size?: 'small' | 'medium';
29
+ /**
30
+ * Propiedad complementaria para el nombre del `data-testid`.
31
+ * Se utiliza para proporcionar un identificador único para el elemento HTML,
32
+ * lo cual es útil en pruebas unitarias o integradas para localizar el componente.
33
+ */
34
+ instaceDataTestId?: string;
35
+ /**
36
+ * Propiedad que indica si el componente está deshabilitado.
37
+ * Si se establece en `true`, el componente se mostrará en un estado deshabilitado y no será interactivo.
38
+ */
39
+ disabled?: boolean;
15
40
  }
16
- export interface OwnerState extends Pick<RHFColorPickerProps, 'size'> {
17
- isFocus: boolean;
18
- isTabSelected: boolean;
41
+ /**
42
+ * Tipo que define los posibles valores de los slots disponibles en el componente `RHFColorPicker`.
43
+ * Este tipo se utiliza para determinar qué partes del componente pueden ser estilizadas o modificadas.
44
+ */
45
+ export type RHFColorPickerSlotsType = keyof typeof RHFColorPickerSlots;
46
+ /**
47
+ * Estado propietario del componente `RHFColorPicker`.
48
+ * Define propiedades específicas del estado que son necesarias para la gestión del componente.
49
+ */
50
+ export interface RHFColorPickerOwnerState {
51
+ /**
52
+ * Valor para definir el tamaño del icono dentro del componente.
53
+ * Este tamaño puede variar en función de las configuraciones del componente.
54
+ */
55
+ size?: Sizes;
56
+ error?: boolean;
19
57
  }
58
+ /**
59
+ * Tipo de estilos para el componente `RHFColorPicker`.
60
+ * Permite personalizar los estilos de los slots del componente.
61
+ * `OverridesStyleRules` se usa para sobrescribir los estilos predeterminados de Material-UI.
62
+ */
63
+ export type RHFColorPickerStyles = Partial<OverridesStyleRules<RHFColorPickerSlots, typeof RHFCOLOR_PICKER_KEY_COMPONENT, Theme>> | undefined;