@m4l/components 9.3.28 → 9.3.29

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 (115) hide show
  1. package/components/Color/Color.js +32 -131
  2. package/components/Color/Color.styles.js +6 -124
  3. package/components/Color/slots/ColorEnum.d.ts +1 -3
  4. package/components/Color/slots/ColorEnum.js +1 -3
  5. package/components/Color/slots/ColorSlots.d.ts +3 -18
  6. package/components/Color/slots/ColorSlots.js +6 -19
  7. package/components/Color/types.d.ts +6 -7
  8. package/components/DataGrid/DataGrid.js +1 -1
  9. package/components/DataGrid/formatters/ColumnColorFormatter/formatter.d.ts +6 -0
  10. package/components/DataGrid/formatters/ColumnColorFormatter/formatter.js +19 -0
  11. package/components/DataGrid/formatters/ColumnColorFormatter/index.d.ts +3 -0
  12. package/components/DataGrid/formatters/ColumnColorFormatter/index.js +1 -0
  13. package/components/DataGrid/formatters/ColumnColorFormatter/types.d.ts +12 -0
  14. package/components/DataGrid/formatters/ColumnColorFormatter/types.js +1 -0
  15. package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.d.ts +14 -0
  16. package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.js +22 -0
  17. package/components/DataGrid/formatters/index.d.ts +1 -0
  18. package/components/DataGrid/tests/helpers/generators.d.ts +26 -0
  19. package/components/DataGrid/tests/helpers/types.d.ts +2 -0
  20. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +1 -1
  21. package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +1 -1
  22. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +1 -1
  23. package/components/Icon/Icon.js +1 -1
  24. package/components/Image/Image.js +1 -1
  25. package/components/Image/subcomponents/IntersectComponent/index.js +1 -1
  26. package/components/ImageText/ImageText.js +1 -1
  27. package/components/LanguagePopover/LanguagePopover.js +1 -1
  28. package/components/LinearProgressIndeterminate/LinearProgressIndeterminate.js +1 -1
  29. package/components/LoadingError/LoadingError.js +1 -1
  30. package/components/NumberInput/NumberInput.js +1 -1
  31. package/components/ObjectLogs/subcomponents/ObjectLogsByM4L/ObjectLogsByM4L.js +1 -1
  32. package/components/ObjectLogs/subcomponents/ObjectLogsByOthers/ObjectLogsByOthers.js +1 -1
  33. package/components/PDFViewer/PDFViewer.js +1 -1
  34. package/components/PrintingSystem/PrintingSystem.js +1 -1
  35. package/components/PropertyValue/PropertyValue.js +1 -1
  36. package/components/ToastContainer/ToastContainer.js +1 -1
  37. package/components/WindowBase/WindowBase.js +1 -1
  38. package/components/WindowConfirm/WindowConfirm.js +1 -1
  39. package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
  40. package/components/areas/components/AreasViewer/AreasViewer.js +1 -1
  41. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -1
  42. package/components/commercial/TopBar/TopBar.js +1 -1
  43. package/components/commercial/TopBar/component/ConteinItem/index.js +1 -1
  44. package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +1 -1
  45. package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.js +1 -1
  46. package/components/extended/React-resizable-panels/SplitLayout.js +1 -1
  47. package/components/formatters/BooleanFormatter/BooleanFormatter.js +1 -1
  48. package/components/formatters/ColorFormatter/ColorFormatter.d.ts +18 -0
  49. package/components/formatters/ColorFormatter/ColorFormatter.js +35 -0
  50. package/components/formatters/ColorFormatter/ColorFormatter.styles.d.ts +2 -0
  51. package/components/formatters/ColorFormatter/ColorFormatter.styles.js +15 -0
  52. package/components/formatters/ColorFormatter/constants.d.ts +1 -0
  53. package/components/formatters/ColorFormatter/constants.js +4 -0
  54. package/components/formatters/ColorFormatter/index.d.ts +3 -0
  55. package/components/formatters/ColorFormatter/index.js +1 -0
  56. package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.d.ts +3 -0
  57. package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.js +7 -0
  58. package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.d.ts +4 -0
  59. package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.js +11 -0
  60. package/components/formatters/ColorFormatter/types.d.ts +24 -0
  61. package/components/formatters/ColorFormatter/types.js +1 -0
  62. package/components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js +1 -1
  63. package/components/formatters/DateFormatter/DateFormatter.js +1 -1
  64. package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +1 -1
  65. package/components/formatters/PeriodFormatter/PeriodFormatter.js +1 -1
  66. package/components/formatters/PointsFormatter/PointsFormatter.js +1 -1
  67. package/components/formatters/PriceFormatter/PriceFormatter.js +1 -1
  68. package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.js +1 -1
  69. package/components/formatters/index.d.ts +1 -0
  70. package/components/hook-form/RHFColorPicker/RFHColorPicker.js +28 -36
  71. package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +156 -0
  72. package/components/hook-form/RHFColorPicker/hooks/useColorPicker/index.d.ts +2 -0
  73. package/components/hook-form/RHFColorPicker/hooks/useColorPicker/types.d.ts +9 -0
  74. package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +41 -0
  75. package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.js +50 -0
  76. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +4 -1
  77. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +3 -0
  78. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +21 -0
  79. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +19 -1
  80. package/components/hook-form/RHFColorPicker/slots/index.js +1 -0
  81. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.d.ts +33 -0
  82. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.js +147 -0
  83. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.d.ts +2 -0
  84. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.js +1 -0
  85. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.d.ts +20 -0
  86. package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.js +1 -0
  87. package/components/hook-form/RHFDateTime/RHFDateTime.js +1 -1
  88. package/components/hook-form/RHFNumberInput/RHFNumberInput.js +1 -1
  89. package/components/hook-form/RHFPeriod/RHFPeriod.js +1 -1
  90. package/components/hook-form/RHFSelect/RHFSelect.js +1 -1
  91. package/components/hook-form/RHFTextField/RHFTextField.js +1 -1
  92. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
  93. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +1 -1
  94. package/components/mui_extended/Accordion/Accordion.js +1 -1
  95. package/components/mui_extended/Avatar/Avatar.js +1 -1
  96. package/components/mui_extended/Avatar/subcomponents/SkeletonAvatar/index.js +1 -1
  97. package/components/mui_extended/Badge/Badge.js +1 -1
  98. package/components/mui_extended/CircularProgress/CircularProgress.js +1 -1
  99. package/components/mui_extended/DateTimePicker/DateTimePicker.js +1 -1
  100. package/components/mui_extended/Dialog/Dialog.js +1 -1
  101. package/components/mui_extended/ImageButton/ImageButton.js +1 -1
  102. package/components/mui_extended/MenuDivider/MenuDivider.js +1 -1
  103. package/components/mui_extended/NavLink/NavLink.js +1 -1
  104. package/components/mui_extended/Popover/Popover.js +1 -1
  105. package/components/mui_extended/Select/Select.js +1 -1
  106. package/components/mui_extended/Stack/Stack.js +1 -1
  107. package/components/mui_extended/TextField/TextField.js +1 -1
  108. package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
  109. package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +1 -1
  110. package/components/mui_extended/Typography/Typography.js +1 -1
  111. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +1 -1
  112. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +1 -1
  113. package/index.js +58 -52
  114. package/package.json +2 -2
  115. package/test/getNameDataTestId.js +2 -2
@@ -1,156 +1,57 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { clsx } from "clsx";
3
- import { useState, useMemo } from "react";
4
- import { useTheme } from "@mui/material";
3
+ import { useMemo } from "react";
5
4
  import { useEnvironment, useModuleSkeleton } from "@m4l/core";
6
- import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
7
5
  import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
8
6
  import { C as COLOR_KEY_COMPONENT } from "./constants.js";
9
7
  import { C as ColorSlots } from "./slots/ColorEnum.js";
10
8
  import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
11
- import { C as ColorPickerStyled, I as IconButtonRootStyled, P as PopoverStyled, S as SketchPickerStyled } from "./slots/ColorSlots.js";
12
- import { A as ActionsContainer } from "../CommonActions/components/ActionsContainer/ActionsContainer.js";
9
+ import { C as ColorStyled, R as RootStyled } from "./slots/ColorSlots.js";
13
10
  import { I as Icon } from "../Icon/Icon.js";
14
- import { A as ActionCancel } from "../CommonActions/components/ActionCancel/ActionCancel.js";
15
- import { A as ActionIntro } from "../CommonActions/components/ActionIntro/ActionIntro.js";
16
11
  const Color = (props) => {
17
12
  const {
18
- className,
19
13
  size,
20
- disabled,
14
+ className,
21
15
  value,
22
- role,
23
16
  error = false,
24
- onChange,
25
- dataTestId,
26
- ...other
17
+ dataTestId = "m4l_color_test"
27
18
  } = props;
28
- const theme = useTheme();
29
19
  const { host_static_assets, environment_assets } = useEnvironment();
30
20
  const classes = getComponentClasses(COLOR_KEY_COMPONENT, ColorSlots);
31
21
  const urlIcon = `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/out_of.svg`;
32
- const [anchorEl, setAnchorEl] = useState(null);
33
- const [tempColor, setTempColor] = useState(value ?? void 0);
34
- const handleIntro = () => {
35
- setAnchorEl(null);
36
- if (tempColor !== value) {
37
- onChange(tempColor ?? null);
38
- setTempColor(tempColor);
39
- }
40
- };
41
- const handleColorChange = (color) => {
42
- setTempColor(color.hex);
43
- };
44
22
  const { currentSize } = useComponentSize(size);
45
23
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
46
24
  const isSkeleton = useModuleSkeleton();
47
- const { color: _, ...otherWithoutColor } = other;
48
- const ownerState = useMemo(() => ({
49
- size: adjustedSize,
50
- disabled,
51
- value,
52
- error
53
- }), [adjustedSize, disabled, value, error]);
54
- const icon = useMemo(() => value ? /* @__PURE__ */ jsx(
55
- ColorPickerStyled,
56
- {
57
- role: "status",
58
- "aria-live": "polite",
59
- ownerState: { ...ownerState },
60
- disabled,
61
- size: adjustedSize
62
- }
63
- ) : /* @__PURE__ */ jsx(
64
- Icon,
65
- {
66
- src: urlIcon,
67
- disabled,
68
- size: adjustedSize
69
- }
70
- ), [value, ownerState, disabled, adjustedSize, urlIcon]);
71
- return /* @__PURE__ */ jsxs(Fragment, { children: [
72
- /* @__PURE__ */ jsx(
73
- IconButtonRootStyled,
74
- {
75
- ...otherWithoutColor,
76
- className: clsx(className, classes.root),
77
- onClick: (event) => setAnchorEl(event.currentTarget),
78
- "aria-busy": isSkeleton,
79
- disabled: isSkeleton || disabled,
80
- ownerState: { ...ownerState },
81
- size: adjustedSize,
82
- icon
83
- }
84
- ),
85
- /* @__PURE__ */ jsxs(
86
- PopoverStyled,
25
+ const ownerState = useMemo(
26
+ () => ({
27
+ size: adjustedSize,
28
+ value,
29
+ error
30
+ }),
31
+ [adjustedSize, value, error]
32
+ );
33
+ const content = useMemo(
34
+ () => value ? /* @__PURE__ */ jsx(
35
+ ColorStyled,
87
36
  {
88
- className: clsx(classes.popover, className),
89
- size,
37
+ role: "status",
38
+ "aria-live": "polite",
90
39
  ownerState: { ...ownerState },
91
- open: Boolean(anchorEl),
92
- arrowType: "no-arrow",
93
- anchorEl,
94
- onClose: () => setAnchorEl(null),
95
- anchorOrigin: {
96
- vertical: "bottom",
97
- horizontal: "left"
98
- },
99
- transformOrigin: {
100
- vertical: "top",
101
- horizontal: "left"
102
- },
103
- sx: {
104
- mt: error ? theme.vars.size.baseSpacings.sp7 : 0
105
- },
106
- children: [
107
- /* @__PURE__ */ jsx(
108
- SketchPickerStyled,
109
- {
110
- ownerState: { ownerState },
111
- color: tempColor ?? void 0,
112
- onChange: handleColorChange,
113
- disableAlpha: true,
114
- presetColors: [
115
- "#D0021B",
116
- "#F5A623",
117
- "#F8E71C",
118
- "#8B572A",
119
- "#7ED321",
120
- "#417505",
121
- "#BD10E0",
122
- "#9013FE",
123
- "#4A90E2",
124
- "#50E3C2",
125
- "#B8E986",
126
- "#000000",
127
- "#4A4A4A",
128
- "#9B9B9B",
129
- "#FFFFFF"
130
- ]
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
- ...getPropDataTestId(COLOR_KEY_COMPONENT, ColorSlots.root, dataTestId),
145
- onClick: handleIntro,
146
- size
147
- }
148
- )
149
- ] })
150
- ]
40
+ size: adjustedSize
151
41
  }
152
- )
153
- ] });
42
+ ) : /* @__PURE__ */ jsx(Icon, { src: urlIcon, size: adjustedSize }),
43
+ [value, ownerState, adjustedSize, urlIcon]
44
+ );
45
+ return /* @__PURE__ */ jsx(
46
+ RootStyled,
47
+ {
48
+ className: clsx(className, classes.root),
49
+ "aria-busy": isSkeleton,
50
+ "data-testid": dataTestId,
51
+ ownerState,
52
+ children: content
53
+ }
54
+ );
154
55
  };
155
56
  export {
156
57
  Color as C
@@ -4,31 +4,15 @@ const colorStyles = {
4
4
  */
5
5
  root: ({ theme, ownerState }) => ({
6
6
  // Estructura y layout básico
7
- display: "flex",
7
+ display: "inline-flex",
8
+ alignItems: "center",
8
9
  justifyContent: "center",
9
- width: "fit-content",
10
- height: "fit-content",
11
- cursor: ownerState?.disabled ? "not-allowed" : "pointer",
12
- color: theme.vars.palette.text.primary,
13
- pointerEvents: ownerState?.disabled ? "none" : "auto",
14
10
  //Espaciado
15
11
  padding: 0,
16
12
  // Radio de borde
17
- borderRadius: theme.size.borderRadius.r1,
13
+ borderRadius: theme.size.borderRadius["r1-5"],
14
+ backgroundColor: theme.vars.palette.default.enabled,
18
15
  border: ownerState?.error ? `1px solid ${theme.vars.palette.error.enabled}` : void 0,
19
- /**
20
- *Pseudoclases**:
21
- */
22
- "&:hover": {
23
- background: ownerState?.error ? theme.vars.palette.error.hoverOpacity : theme.vars.palette.default.hoverOpacity
24
- },
25
- "&:active": {
26
- background: ownerState?.error ? theme.vars.palette.error.activeOpacity : theme.vars.palette.default.activeOpacity
27
- },
28
- "&:focus-visible": {
29
- outline: `1px solid ${theme.vars.palette.primary.focusVisible}`,
30
- outlineOffset: 2
31
- },
32
16
  // Sizes medium
33
17
  ...ownerState?.size === "medium" && {
34
18
  ...theme.generalSettings.isMobile ? {
@@ -53,14 +37,13 @@ const colorStyles = {
53
37
  /**
54
38
  * Estilos para el selector de color.
55
39
  */
56
- colorPicker: ({ theme, ownerState }) => ({
40
+ color: ({ theme, ownerState }) => ({
57
41
  //Estilos generales
58
- right: 0,
59
42
  display: "flex",
60
43
  flexDirection: "column",
61
44
  justifyContent: "center",
62
45
  backgroundColor: ownerState?.value,
63
- borderRadius: theme.size.borderRadius["r0-5"],
46
+ borderRadius: theme.size.borderRadius.r1,
64
47
  // Sizes medium
65
48
  ...ownerState?.size === "medium" && {
66
49
  ...theme.generalSettings.isMobile ? {
@@ -82,107 +65,6 @@ const colorStyles = {
82
65
  }
83
66
  },
84
67
  variants: []
85
- }),
86
- /**
87
- * Popover
88
- */
89
- popover: ({ theme, ownerState }) => ({
90
- "& .MuiPaper-root": {
91
- padding: 0,
92
- border: theme.vars.size.borderStroke.container,
93
- borderColor: ownerState?.error ? theme.vars.palette.border.error : theme.vars.palette.border.default,
94
- borderRadius: theme.vars.size.borderRadius.r1,
95
- "& .MuiButtonBase-root": {
96
- // Ajuste específico de estilo para el contenido de los botones
97
- justifyContent: "center"
98
- }
99
- }
100
- }),
101
- /**
102
- * estilos en picker
103
- */
104
- sketchPicker: ({ theme }) => ({
105
- display: "flex",
106
- flexDirection: "column",
107
- gap: theme.vars.size.baseSpacings.sp3,
108
- boxShadow: "none !important",
109
- background: `${theme.vars.palette.background.default} !important`,
110
- "& > div": {
111
- // Caja de selección de color
112
- "&:nth-of-type(1)": {
113
- borderRadius: theme.vars.size.borderRadius.r1
114
- },
115
- // Caja de selección horizontal de color
116
- "&:nth-of-type(2)": {
117
- display: "flex !important",
118
- justifyContent: "center !important",
119
- alignItems: "center !important",
120
- gap: theme.vars.size.baseSpacings.sp3,
121
- "& > div:nth-of-type(1)": {
122
- padding: "0px !important",
123
- "& > div:nth-of-type(1)": {
124
- height: `${theme.vars.size.baseSpacings.sp3}!important`,
125
- borderRadius: `${theme.vars.size.borderRadius["r0-5"]} !important`,
126
- "& > div > div > div > div": {
127
- height: "10px !important"
128
- }
129
- }
130
- },
131
- "& > div:nth-of-type(2)": {
132
- margin: "0px !important",
133
- borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
134
- height: `${theme.vars.size.desktop.medium.base} !important`,
135
- width: `${theme.vars.size.desktop.medium.base} !important`,
136
- "& div": {
137
- borderRadius: `${theme.vars.size.borderRadius.r1} !important`,
138
- boxShadow: "none !important"
139
- }
140
- }
141
- },
142
- // Inputs para el cambio de color mediante a texto( hexadecimal o rgb )
143
- "&:nth-of-type(3)": {
144
- padding: "0px !important",
145
- "& > div": {
146
- // Estilos compartidos para las cajas de color
147
- "&:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3), &:nth-of-type(4), &:nth-of-type(5)": {
148
- padding: "0px !important",
149
- "& div": {
150
- display: "flex !important",
151
- flexDirection: "column-reverse !important",
152
- "& label": {
153
- textAlign: "left !important",
154
- color: `${theme.vars.palette.text.secondary} !important`,
155
- textTransform: "uppercase !important",
156
- padding: "0px !important"
157
- },
158
- "& input": {
159
- outline: `1px solid ${theme.vars.palette.border.default}`,
160
- borderRadius: theme.vars.size.borderRadius.r1,
161
- background: theme.vars.palette.background.default,
162
- color: theme.vars.palette.text.primary,
163
- boxShadow: "none !important",
164
- "&:hover": {
165
- background: theme.vars.palette.primary.hoverOpacity
166
- },
167
- "&:focus-visible": {
168
- outlineColor: theme.vars.palette.primary.focusVisible
169
- },
170
- "&:active": {
171
- outlineColor: theme.vars.palette.primary.active
172
- }
173
- }
174
- }
175
- }
176
- }
177
- },
178
- //Colores en grid varios del componente de react-color
179
- "&:nth-of-type(4)": {
180
- paddingTop: "0px !important"
181
- }
182
- },
183
- "& .flexbox-fix": {
184
- border: "0px !important"
185
- }
186
68
  })
187
69
  };
188
70
  export {
@@ -1,6 +1,4 @@
1
1
  export declare enum ColorSlots {
2
2
  root = "root",
3
- colorPicker = "colorPicker",
4
- popover = "popover",
5
- sketchPicker = "sketchPicker"
3
+ color = "color"
6
4
  }
@@ -1,8 +1,6 @@
1
1
  var ColorSlots = /* @__PURE__ */ ((ColorSlots2) => {
2
2
  ColorSlots2["root"] = "root";
3
- ColorSlots2["colorPicker"] = "colorPicker";
4
- ColorSlots2["popover"] = "popover";
5
- ColorSlots2["sketchPicker"] = "sketchPicker";
3
+ ColorSlots2["color"] = "color";
6
4
  return ColorSlots2;
7
5
  })(ColorSlots || {});
8
6
  export {
@@ -1,27 +1,12 @@
1
- import { SketchPicker } from 'react-color';
2
1
  /**
3
2
  * Componente estilizado de IconButton como el contenedor raíz del componente de color.
4
3
  */
5
- export declare const IconButtonRootStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../mui_extended/IconButton/types').IconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>, "value" | "size" | "children" | "title" | "component" | "name" | "id" | "type" | "selected" | "disabled" | "action" | "hidden" | "color" | "content" | "style" | "icon" | "tooltip" | "variant" | "translate" | "className" | "classes" | "src" | "sx" | "form" | "slot" | "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" | "exportparts" | "part" | "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" | "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" | "instaceDataTestId" | "placement" | "rotationAngle" | "ariaLabel" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "badgeProps" | keyof import('react').RefAttributes<HTMLButtonElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
4
+ export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
6
5
  ownerState?: (Partial<import('../types').ColorOwnerState> & Record<string, unknown>) | undefined;
7
- }, {}, {}>;
6
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
8
7
  /**
9
8
  * Componente envoltorio `div` que representa el color que recibe por la prop `value`.
10
9
  */
11
- export declare const ColorPickerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
10
+ export declare const ColorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
12
11
  ownerState?: (Partial<import('../types').ColorOwnerState> & Record<string, unknown>) | undefined;
13
12
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
14
- /**
15
- * Componente `Popover` de M4L.
16
- */
17
- 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/styles').Theme> & Record<string, unknown> & {
18
- ownerState?: (Partial<import('../types').ColorOwnerState> & Record<string, unknown>) | undefined;
19
- }, {}, {}>;
20
- /**
21
- * Componente `SketchPicker` que viene de la libreria de react color.
22
- */
23
- 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/styles').Theme> & Record<string, unknown> & {
24
- ownerState?: (Partial<import('../types').ColorOwnerState> & Record<string, unknown>) | undefined;
25
- }, {}, {
26
- ref?: import('react').Ref<SketchPicker> | undefined;
27
- }>;
@@ -1,29 +1,16 @@
1
- import { SketchPicker } from "react-color";
2
1
  import { styled } from "@mui/material/styles";
3
2
  import { C as COLOR_KEY_COMPONENT } from "../constants.js";
4
3
  import { c as colorStyles } from "../Color.styles.js";
5
4
  import { C as ColorSlots } from "./ColorEnum.js";
6
- import { P as Popover } from "../../mui_extended/Popover/Popover.js";
7
- import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
8
- const IconButtonRootStyled = styled(IconButton, {
5
+ const RootStyled = styled("div", {
9
6
  name: COLOR_KEY_COMPONENT,
10
7
  slot: ColorSlots.root
11
8
  })(colorStyles?.root);
12
- const ColorPickerStyled = styled("div", {
9
+ const ColorStyled = styled("div", {
13
10
  name: COLOR_KEY_COMPONENT,
14
- slot: ColorSlots.colorPicker
15
- })(colorStyles?.colorPicker);
16
- const PopoverStyled = styled(Popover, {
17
- name: COLOR_KEY_COMPONENT,
18
- slot: ColorSlots.popover
19
- })(colorStyles?.popover);
20
- const SketchPickerStyled = styled(SketchPicker, {
21
- name: COLOR_KEY_COMPONENT,
22
- slot: ColorSlots.sketchPicker
23
- })(colorStyles?.sketchPicker);
11
+ slot: ColorSlots.color
12
+ })(colorStyles?.color);
24
13
  export {
25
- ColorPickerStyled as C,
26
- IconButtonRootStyled as I,
27
- PopoverStyled as P,
28
- SketchPickerStyled as S
14
+ ColorStyled as C,
15
+ RootStyled as R
29
16
  };
@@ -1,5 +1,4 @@
1
1
  import { Theme } from '@mui/material/styles';
2
- import { IconButtonProps as MUIIconButtonProps } from '@mui/material';
3
2
  import { Sizes } from '@m4l/styles';
4
3
  import { M4LOverridesStyleRules } from '../../@types/augmentations';
5
4
  import { COLOR_KEY_COMPONENT } from './constants';
@@ -9,7 +8,7 @@ import { ColorSlots } from './slots';
9
8
  *
10
9
  * Esta interfaz define las propiedades que el componente `Color` acepta. Se basa en las propiedades de `MUIIconButtonProps`.
11
10
  */
12
- export interface ColorProps extends Omit<MUIIconButtonProps, 'size' | 'value' | 'onChange'> {
11
+ export interface ColorProps {
13
12
  /**
14
13
  * Define el color que tendrá el componente.
15
14
  * Puede ser un color en formato de string o `null`/`undefined` para mostrar un ícono predeterminado.
@@ -24,14 +23,14 @@ export interface ColorProps extends Omit<MUIIconButtonProps, 'size' | 'value' |
24
23
  * Indica si el componente está en estado de error
25
24
  */
26
25
  error?: boolean;
27
- /**
28
- * Evento que se dispara cuando el color del componente cambia.
29
- */
30
- onChange: (color: string | null) => void;
31
26
  /**
32
27
  * testId
33
28
  */
34
29
  dataTestId?: string;
30
+ /**
31
+ * Clases personalizadas
32
+ */
33
+ className?: string;
35
34
  }
36
35
  /**
37
36
  * Tipo para las ranuras del componente `Color`.
@@ -44,7 +43,7 @@ export type ColorSlotsType = keyof typeof ColorSlots;
44
43
  * Este tipo se utiliza para describir el estado completo del componente `Color`, incluyendo
45
44
  * las propiedades pasadas al componente y el estado calculado como el color de la paleta y el estado de esqueleto.
46
45
  */
47
- export type ColorOwnerState = Pick<ColorProps, 'size' | 'value' | 'error' | 'disabled'>;
46
+ export type ColorOwnerState = Pick<ColorProps, 'size' | 'value' | 'error'>;
48
47
  /**
49
48
  * Tipos de estilos para el componente `Color`.
50
49
  * Esta interfaz extiende las reglas de estilo personalizadas para las ranuras del componente (`ColorSlots`)
@@ -4,7 +4,7 @@ import { F as FilterProvider } from "./contexts/FilterContext/index.js";
4
4
  import { D as DataGridProvider } from "./contexts/DataGridContext/index.js";
5
5
  import { T as TEST_PROP_COLUMNS } from "./types.js";
6
6
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
7
- import { a as getNameDataTestId } from "../../test/getNameDataTestId.js";
7
+ import { g as getNameDataTestId } from "../../test/getNameDataTestId.js";
8
8
  import { T as TEST_SKELETON, D as DATAGRID_PREFIX_NAME } from "./constants.js";
9
9
  import { D as DataGridRootStyled, C as CustomHeaderStyled } from "./slots/DataGridSlot.js";
10
10
  import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
@@ -0,0 +1,6 @@
1
+ import { RenderCellProps } from 'react-data-grid';
2
+ import { ColumnColorFormatterProps } from './types';
3
+ /**
4
+ * Función para formatear un color en una columna de un DataGrid
5
+ */
6
+ export declare function ColumnColorFormatter<TRow>(props: ColumnColorFormatterProps<TRow>): (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { getPropertyByString } from "@m4l/core";
3
+ import { C as ColorFormatter } from "../../../formatters/ColorFormatter/ColorFormatter.js";
4
+ function ColumnColorFormatter(props) {
5
+ const { fieldValue, size = "medium" } = props;
6
+ return (renderProps) => {
7
+ const colorValue = getPropertyByString(renderProps.row, fieldValue);
8
+ let fixedValue;
9
+ if (typeof colorValue === "string") {
10
+ fixedValue = colorValue;
11
+ } else {
12
+ fixedValue = null;
13
+ }
14
+ return /* @__PURE__ */ jsx(ColorFormatter, { value: fixedValue, size });
15
+ };
16
+ }
17
+ export {
18
+ ColumnColorFormatter as C
19
+ };
@@ -0,0 +1,3 @@
1
+ export * from './formatter';
2
+ export * from './types';
3
+ export * from './useColumnColor';
@@ -0,0 +1,12 @@
1
+ import { DeepKeyOf } from '../../../../utils/types';
2
+ import { ColorFormatterProps } from '../../../formatters/ColorFormatter/types';
3
+ /**
4
+ * Props para el ColumnColorFormatter
5
+ */
6
+ export interface ColumnColorFormatterProps<TRow> extends Pick<ColorFormatterProps, 'size' | 'className'> {
7
+ /**
8
+ * Campo de la fila que contiene el valor del color.
9
+ * Soporta acceso a propiedades anidadas (ej: 'user.profile.color')
10
+ */
11
+ fieldValue: DeepKeyOf<TRow>;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { ColumnColorFormatterProps } from './types';
2
+ /**
3
+ * Hook que retorna el formatter para una columna de color en el DataGrid.
4
+ *
5
+ * Este hook gestiona el estado del formatter y se asegura de que las props
6
+ * se actualicen correctamente cuando cambian, utilizando deepEqual para
7
+ * comparación profunda de objetos.
8
+ * @template TRow - Tipo de la fila del DataGrid
9
+ * @param {ColumnColorFormatterProps<TRow>} props - Propiedades del formatter
10
+ * @returns {object} Objeto con el formatter configurado
11
+ */
12
+ export declare const useColumnColor: <TRow>(props: ColumnColorFormatterProps<TRow>) => {
13
+ formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
14
+ };
@@ -0,0 +1,22 @@
1
+ import { useState, useRef, useEffect, useMemo } from "react";
2
+ import { deepEqual } from "fast-equals";
3
+ import { C as ColumnColorFormatter } from "./formatter.js";
4
+ const useColumnColor = (props) => {
5
+ const [stateProps, setStateProps] = useState(props);
6
+ const refProps = useRef({ ...props });
7
+ useEffect(() => {
8
+ if (!deepEqual(refProps.current, props)) {
9
+ refProps.current = props;
10
+ setStateProps(props);
11
+ }
12
+ }, [props]);
13
+ return useMemo(
14
+ () => ({
15
+ formatter: ColumnColorFormatter(stateProps)
16
+ }),
17
+ [stateProps]
18
+ );
19
+ };
20
+ export {
21
+ useColumnColor as u
22
+ };
@@ -10,3 +10,4 @@ export * from './ColumnSetCheckFormatter';
10
10
  export * from './ColumnUncertaintyFormatter';
11
11
  export * from './ColumnChipStatusFormatter';
12
12
  export * from './ColumnTagsFormatter';
13
+ export * from './ColumnColorFormatter';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generadores de datos aleatorios para el DataGrid
3
+ */
4
+ /**
5
+ * Función para generar un estado aleatorio
6
+ */
7
+ export declare const getStatus: (index: number) => string;
8
+ /**
9
+ * Función para generar un tipo de usuario aleatorio
10
+ */
11
+ export declare const getUserType: (index: number) => "superadmin" | "admin" | "user";
12
+ /**
13
+ * Función para obtener código de carácter desde el índice
14
+ */
15
+ export declare const getCharCode: (index: number) => string;
16
+ /**
17
+ * Función para generar un color aleatorio en formato hexadecimal
18
+ */
19
+ export declare const getRandomColor: (index: number) => string;
20
+ /**
21
+ * Función para generar tags aleatorios
22
+ */
23
+ export declare const getTags: (index: number) => {
24
+ label: string;
25
+ backgroundColor: string;
26
+ }[];
@@ -28,6 +28,7 @@ export interface SeedProps {
28
28
  aligns?: Record<string, ColumnAlign>;
29
29
  names?: Record<string, string>;
30
30
  visibleColumns?: string[];
31
+ withColor?: boolean;
31
32
  }
32
33
  export type GetColumnsProps = Omit<SeedProps, 'quantity'>;
33
34
  export type ColumnType = 'string' | 'number' | 'boolean' | 'date' | 'custom';
@@ -67,6 +68,7 @@ export interface RowType {
67
68
  label: string;
68
69
  currentStatus: 'superadmin' | 'admin' | 'user';
69
70
  };
71
+ color?: string;
70
72
  }
71
73
  interface RangesUncertainty {
72
74
  cmcMin: number;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
2
+ import { a as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
3
3
  import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoot.js";
4
4
  import { D as DYNAMIC_FILTER_KEY_COMPONENT } from "../../constants.js";
5
5
  import { u as useDynamicFilterBase } from "./useDynamicFilterBase.js";