@m4l/components 9.4.23 → 9.4.25

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 (50) hide show
  1. package/components/DaysOfMonthPicker/DaysOfMonthPicker.d.ts +6 -0
  2. package/components/DaysOfMonthPicker/DaysOfMonthPicker.js +66 -0
  3. package/components/DaysOfMonthPicker/DaysOfMonthPicker.styles.d.ts +2 -0
  4. package/components/DaysOfMonthPicker/DaysOfMonthPicker.styles.js +111 -0
  5. package/components/DaysOfMonthPicker/DaysOfMonthPicker.test.d.ts +1 -0
  6. package/components/DaysOfMonthPicker/constants.d.ts +12 -0
  7. package/components/DaysOfMonthPicker/constants.js +11 -0
  8. package/components/DaysOfMonthPicker/constants.test.d.ts +1 -0
  9. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/index.d.ts +2 -0
  10. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/index.js +1 -0
  11. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/types.d.ts +27 -0
  12. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/types.js +1 -0
  13. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/useDaysOfMonthPicker.d.ts +8 -0
  14. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/useDaysOfMonthPicker.js +121 -0
  15. package/components/DaysOfMonthPicker/hooks/useDaysOfMonthPicker/useDaysOfMonthPicker.test.d.ts +1 -0
  16. package/components/DaysOfMonthPicker/index.d.ts +2 -0
  17. package/components/DaysOfMonthPicker/index.js +1 -0
  18. package/components/DaysOfMonthPicker/slots/DaysOfMonthPickerEnum.d.ts +6 -0
  19. package/components/DaysOfMonthPicker/slots/DaysOfMonthPickerEnum.js +10 -0
  20. package/components/DaysOfMonthPicker/slots/DaysOfMonthPickerSlots.d.ts +4 -0
  21. package/components/DaysOfMonthPicker/slots/DaysOfMonthPickerSlots.js +28 -0
  22. package/components/DaysOfMonthPicker/slots/index.d.ts +2 -0
  23. package/components/DaysOfMonthPicker/types.d.ts +82 -0
  24. package/components/DaysOfMonthPicker/types.js +1 -0
  25. package/components/datagrids/Datagrid.styles.js +27 -0
  26. package/components/datagrids/components/DataGridMain/DataGridMain.js +4 -2
  27. package/components/datagrids/components/TreeDataGrid/TreeDataGrid.js +3 -1
  28. package/components/datagrids/slots/DataGridEnum.d.ts +2 -1
  29. package/components/datagrids/slots/DataGridEnum.js +1 -0
  30. package/components/datagrids/slots/DataGridSlot.d.ts +1 -0
  31. package/components/datagrids/slots/DataGridSlot.js +11 -6
  32. package/components/datagrids/subcomponents/editors/TextEditor/TextEditor.js +1 -1
  33. package/components/datagrids/types.d.ts +33 -0
  34. package/components/datagrids/views/TableView/TableView.js +23 -3
  35. package/components/datagrids/views/TableView/helpers/index.d.ts +1 -0
  36. package/components/datagrids/views/TableView/helpers/rowCellsBackground/index.d.ts +2 -0
  37. package/components/datagrids/views/TableView/helpers/rowCellsBackground/index.js +1 -0
  38. package/components/datagrids/views/TableView/helpers/rowCellsBackground/rowCellsBackground.d.ts +32 -0
  39. package/components/datagrids/views/TableView/helpers/rowCellsBackground/rowCellsBackground.js +58 -0
  40. package/components/datagrids/views/TableView/helpers/rowCellsBackground/types.d.ts +7 -0
  41. package/components/datagrids/views/TableView/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  42. package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.js +1 -1
  43. package/components/hook-form/RHFDaysOfMonthPicker/RHFDaysOfMonthPicker.d.ts +29 -0
  44. package/components/hook-form/RHFDaysOfMonthPicker/RHFDaysOfMonthPicker.js +6 -0
  45. package/components/hook-form/RHFDaysOfMonthPicker/index.d.ts +1 -0
  46. package/components/hook-form/RHFDaysOfMonthPicker/index.js +1 -0
  47. package/components/hook-form/index.d.ts +1 -0
  48. package/components/index.d.ts +1 -0
  49. package/index.js +56 -52
  50. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ import { DaysOfMonthPickerProps } from './types';
2
+ /**
3
+ * Componente DaysOfMonthPicker que permite seleccionar uno o varios días del mes (1-31).
4
+ * Utiliza una estrategia de slots con overrides CSS de Button para cada día.
5
+ */
6
+ export declare const DaysOfMonthPicker: import('react').ForwardRefExoticComponent<DaysOfMonthPickerProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,66 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { forwardRef } from "react";
4
+ import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
5
+ import { a as DaysOfMonthPickerRootStyled, b as DaysOfMonthPickerDaysStyled, S as SkeletonDayStyled } from "./slots/DaysOfMonthPickerSlots.js";
6
+ import { a as DAYS_OF_MONTH_PICKER_CLASSES } from "./constants.js";
7
+ import { u as useDaysOfMonthPicker } from "./hooks/useDaysOfMonthPicker/useDaysOfMonthPicker.js";
8
+ const DaysOfMonthPicker = forwardRef((props, ref) => {
9
+ const { className, dataTestId, disabled } = props;
10
+ const { days, ownerState, currentSize, isSkeleton, renderDay } = useDaysOfMonthPicker(props);
11
+ if (isSkeleton) {
12
+ return /* @__PURE__ */ jsx(
13
+ DaysOfMonthPickerRootStyled,
14
+ {
15
+ ref,
16
+ className: clsx(className, DAYS_OF_MONTH_PICKER_CLASSES.root),
17
+ ownerState,
18
+ role: "group",
19
+ "aria-label": "Selector de días del mes",
20
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {},
21
+ children: /* @__PURE__ */ jsx(
22
+ DaysOfMonthPickerDaysStyled,
23
+ {
24
+ className: DAYS_OF_MONTH_PICKER_CLASSES.days,
25
+ role: "grid",
26
+ "aria-label": "Días del mes",
27
+ children: days.map((day) => /* @__PURE__ */ jsx(
28
+ SkeletonDayStyled,
29
+ {
30
+ variant: "rounded",
31
+ className: DAYS_OF_MONTH_PICKER_CLASSES.skeletonDay,
32
+ ownerState: { size: currentSize }
33
+ },
34
+ day
35
+ ))
36
+ }
37
+ )
38
+ }
39
+ );
40
+ }
41
+ return /* @__PURE__ */ jsx(
42
+ DaysOfMonthPickerRootStyled,
43
+ {
44
+ ref,
45
+ className: clsx(className, DAYS_OF_MONTH_PICKER_CLASSES.root),
46
+ ownerState,
47
+ role: "group",
48
+ "aria-label": "Selector de días del mes",
49
+ "aria-disabled": disabled || void 0,
50
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {},
51
+ children: /* @__PURE__ */ jsx(
52
+ DaysOfMonthPickerDaysStyled,
53
+ {
54
+ className: DAYS_OF_MONTH_PICKER_CLASSES.days,
55
+ role: "grid",
56
+ "aria-label": "Días del mes",
57
+ children: days.map(renderDay)
58
+ }
59
+ )
60
+ }
61
+ );
62
+ });
63
+ DaysOfMonthPicker.displayName = "DaysOfMonthPicker";
64
+ export {
65
+ DaysOfMonthPicker as D
66
+ };
@@ -0,0 +1,2 @@
1
+ import { DaysOfMonthPickerStyles } from './types';
2
+ export declare const daysOfMonthPickerStyles: DaysOfMonthPickerStyles;
@@ -0,0 +1,111 @@
1
+ import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
2
+ import { g as getSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
3
+ const daysOfMonthPickerStyles = {
4
+ /**
5
+ * Estilos para el elemento raíz del componente.
6
+ */
7
+ root: ({ theme }) => ({
8
+ display: "flex",
9
+ flexDirection: "column",
10
+ gap: theme.vars.size.baseSpacings.sp1,
11
+ width: "fit-content"
12
+ }),
13
+ /**
14
+ * Estilos para el contenedor de días.
15
+ */
16
+ days: ({ theme }) => ({
17
+ display: "grid",
18
+ gridTemplateColumns: "repeat(7, 1fr)",
19
+ gap: theme.vars.size.baseSpacings.sp1,
20
+ width: "100%"
21
+ }),
22
+ /**
23
+ * Estilos para cada día individual (slot con overrides de Button).
24
+ */
25
+ day: ({ theme, ownerState }) => {
26
+ const dayOwnerState = ownerState;
27
+ const isSelected = dayOwnerState?.selected;
28
+ const isDisabled = dayOwnerState?.disabled;
29
+ const isReadOnly = dayOwnerState?.readOnly;
30
+ const backgroundColor = isSelected ? theme.vars.palette.primary.enabledOpacity : "transparent";
31
+ let textColor = theme.vars.palette.default.semanticText;
32
+ if (isSelected) {
33
+ textColor = theme.vars.palette.primary.enabled;
34
+ }
35
+ if (isDisabled) {
36
+ textColor = theme.vars.palette.text.disabled;
37
+ }
38
+ const borderRadius = theme.vars.size.borderRadius.r2;
39
+ const shouldHaveInteractiveStates = !isDisabled && !isReadOnly;
40
+ return {
41
+ "&&&": {
42
+ ...getSizeStyles(theme, dayOwnerState?.size || "medium", "action", (size) => ({
43
+ minWidth: size,
44
+ width: size,
45
+ height: size,
46
+ minHeight: size
47
+ })),
48
+ ...getTypographyStyles(theme.generalSettings.isMobile, dayOwnerState?.size || "medium", "body"),
49
+ padding: 0,
50
+ borderRadius,
51
+ display: "flex",
52
+ alignItems: "center",
53
+ justifyContent: "center",
54
+ border: "none",
55
+ // Usar !important cuando está selected para sobrescribir el backgroundColor: 'unset' del Button base (variante text)
56
+ backgroundColor: isSelected ? `${theme.vars.palette.primary.enabledOpacity}!important` : backgroundColor,
57
+ // Usar !important cuando está selected para sobrescribir el color del texto del Button base (especialmente cuando está disabled)
58
+ color: `${textColor}!important`,
59
+ cursor: !shouldHaveInteractiveStates ? "default" : "pointer",
60
+ transition: "background-color 0.2s ease, color 0.2s ease",
61
+ pointerEvents: !shouldHaveInteractiveStates ? "none" : "auto",
62
+ // Estado hover: mantener el backgroundColor actual si está disabled o readOnly
63
+ "&:hover": {
64
+ backgroundColor: shouldHaveInteractiveStates ? isSelected ? `${theme.vars.palette.primary.enabledOpacity}!important` : theme.vars.palette.default.hoverOpacity : `${backgroundColor}!important`
65
+ // Mantener el estado base si no hay estados interactivos
66
+ },
67
+ // Estado active: mantener el backgroundColor actual si está disabled o readOnly
68
+ "&:active": {
69
+ backgroundColor: shouldHaveInteractiveStates ? isSelected ? `${theme.vars.palette.primary.activeOpacity}!important` : theme.vars.palette.default.activeOpacity : `${backgroundColor}!important`
70
+ // Mantener el estado base si no hay estados interactivos
71
+ },
72
+ // Estado focus visible (solo si no está deshabilitado ni en readOnly)
73
+ ...shouldHaveInteractiveStates && {
74
+ "&:focus-visible": {
75
+ outline: `${theme.vars.size.borderStroke.container} solid ${theme.vars.palette.primary.focusVisible}`,
76
+ outlineOffset: "2px"
77
+ }
78
+ },
79
+ // Override del texto del botón
80
+ "& .M4LButton-textButton": {
81
+ // Usar !important cuando está selected para sobrescribir el color del Button base (especialmente cuando está disabled)
82
+ color: `${textColor}!important`,
83
+ padding: 0,
84
+ fontSize: theme.typography.bodyDens.fontSize,
85
+ fontWeight: isSelected ? 600 : 400,
86
+ minWidth: "auto",
87
+ width: "auto",
88
+ cursor: "inherit"
89
+ // Heredar el cursor del contenedor
90
+ }
91
+ }
92
+ };
93
+ },
94
+ /**
95
+ * Estilos para cada día individual en modo skeleton.
96
+ */
97
+ skeletonDay: ({ theme, ownerState }) => {
98
+ const dayOwnerState = ownerState;
99
+ return {
100
+ ...getSizeStyles(theme, dayOwnerState?.size || "medium", "action", (size) => ({
101
+ minWidth: size,
102
+ width: size,
103
+ height: size,
104
+ minHeight: size
105
+ }))
106
+ };
107
+ }
108
+ };
109
+ export {
110
+ daysOfMonthPickerStyles as d
111
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Clave de identificación del componente DaysOfMonthPicker dentro del sistema.
3
+ *
4
+ * Esta constante se utiliza como identificador único para asociar y personalizar estilos y configuraciones
5
+ * relacionadas con el componente `DaysOfMonthPicker` dentro del sistema de temas y estilos.
6
+ * @default 'M4LDaysOfMonthPicker'
7
+ */
8
+ export declare const DAYS_OF_MONTH_PICKER_KEY_COMPONENT = "M4LDaysOfMonthPicker";
9
+ /**
10
+ * Inventario de clases CSS para el componente DaysOfMonthPicker
11
+ */
12
+ export declare const DAYS_OF_MONTH_PICKER_CLASSES: Record<"root" | "days" | "day" | "skeletonDay", string>;
@@ -0,0 +1,11 @@
1
+ import { a as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
2
+ import { D as DaysOfMonthPickerSlots } from "./slots/DaysOfMonthPickerEnum.js";
3
+ const DAYS_OF_MONTH_PICKER_KEY_COMPONENT = "M4LDaysOfMonthPicker";
4
+ const DAYS_OF_MONTH_PICKER_CLASSES = getComponentClasses(
5
+ DAYS_OF_MONTH_PICKER_KEY_COMPONENT,
6
+ DaysOfMonthPickerSlots
7
+ );
8
+ export {
9
+ DAYS_OF_MONTH_PICKER_KEY_COMPONENT as D,
10
+ DAYS_OF_MONTH_PICKER_CLASSES as a
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { useDaysOfMonthPicker } from './useDaysOfMonthPicker';
2
+ export * from './types';
@@ -0,0 +1,27 @@
1
+ import { DaysOfMonthPickerOwnerState } from '../../types';
2
+ import { ReactNode } from 'react';
3
+ /**
4
+ * Valores retornados por el hook useDaysOfMonthPicker
5
+ */
6
+ export interface UseDaysOfMonthPickerReturn {
7
+ /**
8
+ * Array de días del mes (1-31, siempre en orden consecutivo)
9
+ */
10
+ days: number[];
11
+ /**
12
+ * Owner state del componente principal
13
+ */
14
+ ownerState: DaysOfMonthPickerOwnerState;
15
+ /**
16
+ * Tamaño actual del componente
17
+ */
18
+ currentSize: 'small' | 'medium';
19
+ /**
20
+ * Indica si el componente está en modo skeleton
21
+ */
22
+ isSkeleton: boolean;
23
+ /**
24
+ * Función para renderizar un día individual
25
+ */
26
+ renderDay: (day: number) => ReactNode;
27
+ }
@@ -0,0 +1,8 @@
1
+ import { DaysOfMonthPickerProps } from '../../types';
2
+ import { UseDaysOfMonthPickerReturn } from './types';
3
+ /**
4
+ * Hook personalizado que maneja toda la lógica del componente DaysOfMonthPicker
5
+ * @param props - Propiedades del componente DaysOfMonthPicker
6
+ * @returns Objeto con los valores y funciones necesarias para el render
7
+ */
8
+ export declare const useDaysOfMonthPicker: (props: DaysOfMonthPickerProps) => UseDaysOfMonthPickerReturn;
@@ -0,0 +1,121 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useModuleSkeleton } from "@m4l/core";
3
+ import { useMemo, useCallback } from "react";
4
+ import { a as DAYS_OF_MONTH_PICKER_CLASSES } from "../../constants.js";
5
+ import { D as DayButtonStyled } from "../../slots/DaysOfMonthPickerSlots.js";
6
+ import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
7
+ const useDaysOfMonthPicker = (props) => {
8
+ const {
9
+ value,
10
+ onChange,
11
+ multiple = false,
12
+ disabledDays = [],
13
+ disabled = false,
14
+ readOnly = false,
15
+ size
16
+ } = props;
17
+ const isSkeleton = useModuleSkeleton();
18
+ const { currentSize } = useComponentSize(size);
19
+ const ownerState = useMemo(
20
+ () => ({
21
+ disabled,
22
+ readOnly
23
+ }),
24
+ [disabled, readOnly]
25
+ );
26
+ const days = useMemo(() => {
27
+ const daysArray = [];
28
+ for (let day = 1; day <= 31; day++) {
29
+ daysArray.push(day);
30
+ }
31
+ return daysArray;
32
+ }, []);
33
+ const isDaySelected = useCallback(
34
+ (day) => {
35
+ if (value === void 0) {
36
+ return false;
37
+ }
38
+ if (multiple) {
39
+ return Array.isArray(value) && value.includes(day);
40
+ }
41
+ return value === day;
42
+ },
43
+ [value, multiple]
44
+ );
45
+ const isDayDisabled = useCallback(
46
+ (day) => {
47
+ return disabled || disabledDays.includes(day);
48
+ },
49
+ [disabled, disabledDays]
50
+ );
51
+ const handleDayClick = useCallback(
52
+ (day) => {
53
+ if (isDayDisabled(day) || readOnly || isSkeleton) {
54
+ return;
55
+ }
56
+ if (multiple) {
57
+ const currentValue = Array.isArray(value) ? value : [];
58
+ const isSelected = currentValue.includes(day);
59
+ if (isSelected) {
60
+ const newValue = currentValue.filter((d) => d !== day);
61
+ onChange?.(newValue);
62
+ } else {
63
+ const newValue = [...currentValue, day];
64
+ onChange?.(newValue);
65
+ }
66
+ } else {
67
+ const newValue = value === day ? void 0 : day;
68
+ onChange?.(newValue);
69
+ }
70
+ },
71
+ [multiple, value, onChange, isDayDisabled, readOnly, isSkeleton]
72
+ );
73
+ const renderDay = useCallback(
74
+ (day) => {
75
+ const selected = isDaySelected(day);
76
+ const dayDisabled = isDayDisabled(day);
77
+ const dayOwnerState = {
78
+ selected,
79
+ disabled: dayDisabled,
80
+ readOnly,
81
+ size: currentSize
82
+ };
83
+ const dayLabel = day.toString().padStart(2, "0");
84
+ const ariaLabel = selected ? `Día ${day} seleccionado` : `Día ${day} no seleccionado`;
85
+ return /* @__PURE__ */ jsx(
86
+ DayButtonStyled,
87
+ {
88
+ label: dayLabel,
89
+ variant: "text",
90
+ disabled: dayDisabled,
91
+ onClick: () => handleDayClick(day),
92
+ ownerState: dayOwnerState,
93
+ "aria-label": ariaLabel,
94
+ "aria-pressed": selected,
95
+ "aria-disabled": dayDisabled || readOnly,
96
+ role: "button",
97
+ tabIndex: dayDisabled || readOnly ? -1 : 0,
98
+ className: DAYS_OF_MONTH_PICKER_CLASSES.day
99
+ },
100
+ day
101
+ );
102
+ },
103
+ [
104
+ isDaySelected,
105
+ isDayDisabled,
106
+ readOnly,
107
+ handleDayClick,
108
+ currentSize
109
+ ]
110
+ );
111
+ return {
112
+ days,
113
+ ownerState,
114
+ currentSize,
115
+ isSkeleton,
116
+ renderDay
117
+ };
118
+ };
119
+ export {
120
+ useDaysOfMonthPicker as u
121
+ };
@@ -0,0 +1,2 @@
1
+ export * from './DaysOfMonthPicker';
2
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ export declare enum DaysOfMonthPickerSlots {
2
+ root = "root",
3
+ days = "days",
4
+ day = "day",
5
+ skeletonDay = "skeletonDay"
6
+ }
@@ -0,0 +1,10 @@
1
+ var DaysOfMonthPickerSlots = /* @__PURE__ */ ((DaysOfMonthPickerSlots2) => {
2
+ DaysOfMonthPickerSlots2["root"] = "root";
3
+ DaysOfMonthPickerSlots2["days"] = "days";
4
+ DaysOfMonthPickerSlots2["day"] = "day";
5
+ DaysOfMonthPickerSlots2["skeletonDay"] = "skeletonDay";
6
+ return DaysOfMonthPickerSlots2;
7
+ })(DaysOfMonthPickerSlots || {});
8
+ export {
9
+ DaysOfMonthPickerSlots as D
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare const DaysOfMonthPickerRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
2
+ export declare const DaysOfMonthPickerDaysStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
3
+ export declare const DayButtonStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../mui_extended/Button').ButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>, "value" | "size" | "children" | "title" | "component" | "name" | "id" | "type" | "disabled" | "action" | "variant" | "color" | "content" | "translate" | "className" | "style" | "classes" | "sx" | "form" | "label" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "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" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "skeletonWidth" | "startIcon" | "endIcon" | keyof import('react').RefAttributes<HTMLButtonElement> | "fullWidth" | "disableElevation"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
4
+ export declare const SkeletonDayStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Skeleton/types').SkeletonProps, keyof import('../../mui_extended/Skeleton/types').SkeletonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
@@ -0,0 +1,28 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { d as daysOfMonthPickerStyles } from "../DaysOfMonthPicker.styles.js";
3
+ import { D as DAYS_OF_MONTH_PICKER_KEY_COMPONENT } from "../constants.js";
4
+ import { D as DaysOfMonthPickerSlots } from "./DaysOfMonthPickerEnum.js";
5
+ import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
6
+ import { B as Button } from "../../mui_extended/Button/Button.js";
7
+ const DaysOfMonthPickerRootStyled = styled("div", {
8
+ name: DAYS_OF_MONTH_PICKER_KEY_COMPONENT,
9
+ slot: DaysOfMonthPickerSlots.root
10
+ })(daysOfMonthPickerStyles?.root);
11
+ const DaysOfMonthPickerDaysStyled = styled("div", {
12
+ name: DAYS_OF_MONTH_PICKER_KEY_COMPONENT,
13
+ slot: DaysOfMonthPickerSlots.days
14
+ })(daysOfMonthPickerStyles?.days);
15
+ const DayButtonStyled = styled(Button, {
16
+ name: DAYS_OF_MONTH_PICKER_KEY_COMPONENT,
17
+ slot: DaysOfMonthPickerSlots.day
18
+ })(daysOfMonthPickerStyles?.day);
19
+ const SkeletonDayStyled = styled(Skeleton, {
20
+ name: DAYS_OF_MONTH_PICKER_KEY_COMPONENT,
21
+ slot: DaysOfMonthPickerSlots.skeletonDay
22
+ })(daysOfMonthPickerStyles?.skeletonDay);
23
+ export {
24
+ DayButtonStyled as D,
25
+ SkeletonDayStyled as S,
26
+ DaysOfMonthPickerRootStyled as a,
27
+ DaysOfMonthPickerDaysStyled as b
28
+ };
@@ -0,0 +1,2 @@
1
+ export * from './DaysOfMonthPickerEnum';
2
+ export * from './DaysOfMonthPickerSlots';
@@ -0,0 +1,82 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ import { M4LOverridesStyleRules } from '../../@types/augmentations';
3
+ import { DAYS_OF_MONTH_PICKER_KEY_COMPONENT } from './constants';
4
+ import { DaysOfMonthPickerSlots } from './slots/DaysOfMonthPickerEnum';
5
+ import { Sizes } from '@m4l/styles';
6
+ /**
7
+ * Propiedades del componente `DaysOfMonthPicker`.
8
+ */
9
+ export interface DaysOfMonthPickerProps {
10
+ /**
11
+ * Valor seleccionado. Puede ser un número (día único) o un array de números (múltiples días).
12
+ */
13
+ value?: number | number[];
14
+ /**
15
+ * Callback que se ejecuta cuando cambia la selección.
16
+ */
17
+ onChange?: (value: number | number[]) => void;
18
+ /**
19
+ * Si es true, permite seleccionar múltiples días. Si es false, solo permite seleccionar un día modo single.
20
+ * @default false
21
+ */
22
+ multiple?: boolean;
23
+ /**
24
+ * Array de días que están deshabilitados y no se pueden seleccionar.
25
+ */
26
+ disabledDays?: number[];
27
+ /**
28
+ * Si es true, el componente está completamente deshabilitado.
29
+ * @default false
30
+ */
31
+ disabled?: boolean;
32
+ /**
33
+ * Si es true, el componente está en modo solo lectura.
34
+ * @default false
35
+ */
36
+ readOnly?: boolean;
37
+ /**
38
+ * Class name para el componente.
39
+ */
40
+ className?: string;
41
+ /**
42
+ * Tamaño del componente.
43
+ */
44
+ size?: Extract<Sizes, 'small' | 'medium'>;
45
+ /**
46
+ * Test id para el componente.
47
+ */
48
+ dataTestId?: string;
49
+ }
50
+ /**
51
+ * Owner state del componente `DaysOfMonthPicker` usado para definir propiedades internas de estilo y comportamiento.
52
+ */
53
+ export interface DaysOfMonthPickerOwnerState {
54
+ disabled?: boolean;
55
+ readOnly?: boolean;
56
+ [key: string]: unknown;
57
+ }
58
+ /**
59
+ * Owner state para cada día individual.
60
+ */
61
+ export interface DayOwnerState {
62
+ selected: boolean;
63
+ disabled: boolean;
64
+ readOnly: boolean;
65
+ size: Extract<Sizes, 'small' | 'medium'>;
66
+ [key: string]: unknown;
67
+ }
68
+ /**
69
+ * Owner state para cada header de día individual.
70
+ */
71
+ export interface DayHeaderOwnerState {
72
+ size?: Extract<Sizes, 'small' | 'medium'>;
73
+ [key: string]: unknown;
74
+ }
75
+ /**
76
+ * Define los tipos de Slots disponibles para el componente `DaysOfMonthPicker`.
77
+ */
78
+ export type DaysOfMonthPickerSlotsType = keyof typeof DaysOfMonthPickerSlots;
79
+ /**
80
+ * Estilos aplicables al componente `DaysOfMonthPicker` usando temas y slots personalizados.
81
+ */
82
+ export type DaysOfMonthPickerStyles = M4LOverridesStyleRules<DaysOfMonthPickerSlotsType, typeof DAYS_OF_MONTH_PICKER_KEY_COMPONENT, Theme>;
@@ -1165,6 +1165,33 @@ const dataGridStyles = {
1165
1165
  textOverflow: "ellipsis",
1166
1166
  wordBreak: "break-word",
1167
1167
  whiteSpace: "normal"
1168
+ }),
1169
+ /**
1170
+ * Wrapper para celdas con color de fondo personalizado.
1171
+ *
1172
+ * Este estilo aplica backgroundColor y ocupa toda la celda,
1173
+ * manteniendo el comportamiento de truncado con ellipsis.
1174
+ * El color se recibe a través de ownerState.cellBackgroundColor
1175
+ */
1176
+ cellBackgroundWrapper: ({ ownerState }) => ({
1177
+ // Ocupar toda la celda con margin negativo
1178
+ margin: "-8px",
1179
+ padding: "8px",
1180
+ width: "calc(100% + 16px)",
1181
+ height: "calc(100% + 16px)",
1182
+ boxSizing: "border-box",
1183
+ // Mantener el comportamiento de truncado igual que las celdas
1184
+ display: "-webkit-box",
1185
+ WebkitBoxOrient: "vertical",
1186
+ WebkitLineClamp: ownerState?.currentRowHeightVariant === "compact" ? 1 : ownerState?.currentRowHeightVariant === "confortable" ? 3 : 2,
1187
+ overflow: "hidden",
1188
+ textOverflow: "ellipsis",
1189
+ wordBreak: "break-word",
1190
+ whiteSpace: "normal",
1191
+ alignContent: "center",
1192
+ ...ownerState?.cellBackgroundColor && {
1193
+ backgroundColor: ownerState.cellBackgroundColor
1194
+ }
1168
1195
  })
1169
1196
  };
1170
1197
  export {
@@ -14,7 +14,8 @@ function DataGrid(props) {
14
14
  cardsViewConfig,
15
15
  focusOnRowKey,
16
16
  checkedRows,
17
- onCheckedRowsChange
17
+ onCheckedRowsChange,
18
+ rowCellsBackground
18
19
  } = props;
19
20
  return /* @__PURE__ */ jsx(BaseDataGrid, { ...props, children: /* @__PURE__ */ jsx(
20
21
  RenderContent,
@@ -30,7 +31,8 @@ function DataGrid(props) {
30
31
  cardsViewConfig,
31
32
  focusOnRowKey,
32
33
  checkedRows,
33
- onCheckedRowsChange
34
+ onCheckedRowsChange,
35
+ rowCellsBackground
34
36
  }
35
37
  ) });
36
38
  }
@@ -17,7 +17,8 @@ function TreeDataGrid(props) {
17
17
  onCheckedRowsChange,
18
18
  rowGrouper,
19
19
  expandedGroupIds: expandedGroupIdsProp,
20
- onExpandedGroupIdsChange: onExpandedGroupIdsChangeProp
20
+ onExpandedGroupIdsChange: onExpandedGroupIdsChangeProp,
21
+ rowCellsBackground
21
22
  } = props;
22
23
  const [internalExpandedGroupIds, setInternalExpandedGroupIds] = useState(() => new Set(expandedGroupIdsProp ?? []));
23
24
  const isControlled = expandedGroupIdsProp !== void 0 && onExpandedGroupIdsChangeProp !== void 0;
@@ -37,6 +38,7 @@ function TreeDataGrid(props) {
37
38
  focusOnRowKey,
38
39
  checkedRows,
39
40
  onCheckedRowsChange,
41
+ rowCellsBackground,
40
42
  treeProps: {
41
43
  rowGrouper,
42
44
  expandedGroupIds,
@@ -55,7 +55,8 @@ export declare enum TableSlots {
55
55
  editLabel = "editLabel",
56
56
  iconButtonEdit = "iconButtonEdit",
57
57
  defaultRenderGroupCellRoot = "defaultRenderGroupCellRoot",
58
- defaultRenderGroupCellText = "defaultRenderGroupCellText"
58
+ defaultRenderGroupCellText = "defaultRenderGroupCellText",
59
+ cellBackgroundWrapper = "cellBackgroundWrapper"
59
60
  }
60
61
  export declare enum TextEditorSlots {
61
62
  inputTexEditor = "inputTexEditor"
@@ -59,6 +59,7 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
59
59
  TableSlots2["iconButtonEdit"] = "iconButtonEdit";
60
60
  TableSlots2["defaultRenderGroupCellRoot"] = "defaultRenderGroupCellRoot";
61
61
  TableSlots2["defaultRenderGroupCellText"] = "defaultRenderGroupCellText";
62
+ TableSlots2["cellBackgroundWrapper"] = "cellBackgroundWrapper";
62
63
  return TableSlots2;
63
64
  })(TableSlots || {});
64
65
  var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
@@ -99,3 +99,4 @@ export declare const ControlNavigateStyled: import('@emotion/styled').StyledComp
99
99
  export declare const ColumnIconFormatterStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
100
100
  export declare const DefaultRenderGroupCellRootStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
101
101
  export declare const DefaultRenderGroupCellTextStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
102
+ export declare const CellBackgroundWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
@@ -239,6 +239,10 @@ const DefaultRenderGroupCellTextStyled = styled("span", {
239
239
  name: DATAGRID_PREFIX_NAME,
240
240
  slot: TableSlots.defaultRenderGroupCellText
241
241
  })(dataGridStyles.defaultRenderGroupCellText);
242
+ const CellBackgroundWrapperStyled = styled("span", {
243
+ name: DATAGRID_PREFIX_NAME,
244
+ slot: TableSlots.cellBackgroundWrapper
245
+ })(dataGridStyles.cellBackgroundWrapper);
242
246
  export {
243
247
  ActionsRootStyled as A,
244
248
  NameColumnStyled as B,
@@ -254,16 +258,17 @@ export {
254
258
  LabelHeaderColumnStyled as L,
255
259
  HeaderInputBaseStyled as M,
256
260
  NameColumnIconStyled as N,
257
- DefaultRenderGroupCellRootStyled as O,
258
- DefaultRenderGroupCellTextStyled as P,
259
- MenuListStyled as Q,
261
+ CellBackgroundWrapperStyled as O,
262
+ DefaultRenderGroupCellRootStyled as P,
263
+ DefaultRenderGroupCellTextStyled as Q,
260
264
  RowsCountRootStyled as R,
261
- HeaderRenderClickStyled as S,
265
+ MenuListStyled as S,
262
266
  TextToggleCardButtonStyled as T,
263
- TableContainerStyled as U,
267
+ HeaderRenderClickStyled as U,
264
268
  ValueColumnStyled as V,
265
269
  WrapperSkeletonStyled as W,
266
- InputTextEditorStyled as X,
270
+ TableContainerStyled as X,
271
+ InputTextEditorStyled as Y,
267
272
  CardToggleButtonStyled as a,
268
273
  CheckboxCellWrapperStyled as b,
269
274
  ColumnsConfigWrapperStyled as c,
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { X as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
2
+ import { Y as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
3
3
  function autoFocusAndSelect(input) {
4
4
  input?.focus();
5
5
  input?.select();
@@ -54,6 +54,33 @@ declare module 'react-data-grid' {
54
54
  }
55
55
  }
56
56
  export declare type RowKey = string | number;
57
+ /**
58
+ * Define una celda específica que tendrá un color de fondo personalizado.
59
+ * rowKey - Identificador único de la fila (el mismo que usa rowKeyGetter)
60
+ * columnKey - Identificador de la columna (el key de la columna)
61
+ * color - Color de fondo a aplicar (puede ser hex como '#FF0000', rgb, etc.)
62
+ */
63
+ export interface RowCellBackground<TKey extends RowKey = RowKey> {
64
+ rowKey: TKey;
65
+ columnKey: string;
66
+ color: string;
67
+ }
68
+ /**
69
+ * Función que retorna el color de fondo para una celda específica.
70
+ * Esta variante es más óptima para muchas filas porque solo se llama
71
+ * para las celdas visibles durante la virtualización.
72
+ * @param rowKey - Identificador único de la fila
73
+ * @param columnKey - Identificador de la columna
74
+ * @returns El color de fondo (hex, rgb, etc.) o undefined/null para transparente
75
+ */
76
+ export type RowCellsBackgroundGetter<TKey extends RowKey = RowKey> = (rowKey: TKey, columnKey: string) => string | undefined | null;
77
+ /**
78
+ * Tipo union que permite array o función para rowCellsBackground.
79
+ *
80
+ * - Array: Más simple de usar, pero procesa todas las celdas al inicio
81
+ * - Función: Más óptima para muchas filas, solo se llama para celdas visibles
82
+ */
83
+ export type RowCellsBackgroundProp<TKey extends RowKey = RowKey> = RowCellBackground<TKey>[] | RowCellsBackgroundGetter<TKey>;
57
84
  export declare interface WithActionsProps {
58
85
  withActions?: boolean;
59
86
  }
@@ -228,6 +255,12 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
228
255
  * Útil cuando se agrega un nuevo elemento y se quiere enfocar en él.
229
256
  */
230
257
  focusOnRowKey?: TKey;
258
+ /**
259
+ * Colores de fondo para celdas específicas.
260
+ * - Array: `[{ rowKey, columnKey, color }]`
261
+ * - Función: `(rowKey, columnKey) => color | undefined` (más óptima para muchas filas)
262
+ */
263
+ rowCellsBackground?: RowCellsBackgroundProp<TKey>;
231
264
  }
232
265
  export declare const DATAGRID_TEST_ID = "m4ldatagrid";
233
266
  export declare const PREFIX_TEST_ATTRIBUTE = "data-testid";
@@ -3,10 +3,11 @@ import { useMemo, useRef, useState, useEffect } from "react";
3
3
  import DataGrid, { TreeDataGrid } from "react-data-grid";
4
4
  import { DndProvider } from "react-dnd";
5
5
  import { HTML5Backend } from "react-dnd-html5-backend";
6
- import { U as TableContainerStyled, f as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
6
+ import { X as TableContainerStyled, f as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
7
7
  import { u as useSortColumnsRows } from "./hooks/useSortColumnsRows/useSortColumnsRows.js";
8
8
  import { g as getGroupBy } from "./helpers/getGroupBy/getGroupBy.js";
9
9
  import { d as defaultRowGrouper } from "./helpers/defaultRowGrouper/defaultRowGrouper.js";
10
+ import { c as createRowCellsBackgroundMap, p as processColumnsWithRowCellsBackground } from "./helpers/rowCellsBackground/rowCellsBackground.js";
10
11
  import { u as useHeaderMenuActions } from "./hooks/useHeaderMenuActions/useHeaderMenuActions.js";
11
12
  import { a as filterHeight } from "./subcomponents/SelectColumn/SelectColumn.js";
12
13
  import { H as HeaderRenderClick } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
@@ -24,6 +25,7 @@ function TableView(props) {
24
25
  onSelectedRowsChange,
25
26
  defaultColumnOptions: defaultColumnOptionsProp,
26
27
  focusOnRowKey,
28
+ rowCellsBackground,
27
29
  treeProps,
28
30
  ...restProps
29
31
  } = props;
@@ -76,6 +78,24 @@ function TableView(props) {
76
78
  return getGroupBy(columnsConfig);
77
79
  }, [columnsConfig, treeProps]);
78
80
  const rowGrouper = treeProps?.rowGrouper ?? defaultRowGrouper;
81
+ const colorGetter = useMemo(() => {
82
+ if (!rowCellsBackground) {
83
+ return void 0;
84
+ }
85
+ if (typeof rowCellsBackground === "function") {
86
+ return rowCellsBackground;
87
+ }
88
+ return createRowCellsBackgroundMap(rowCellsBackground);
89
+ }, [rowCellsBackground]);
90
+ const columnsWithBackground = useMemo(
91
+ () => processColumnsWithRowCellsBackground(
92
+ finalColumns,
93
+ colorGetter,
94
+ rowKeyGetter,
95
+ currentRowHeightVariant
96
+ ),
97
+ [finalColumns, colorGetter, rowKeyGetter, currentRowHeightVariant]
98
+ );
79
99
  const ref_data_grid = useRef(null);
80
100
  const [popoverState, setPopoverState] = useState({
81
101
  anchorEl: null,
@@ -179,7 +199,7 @@ function TableView(props) {
179
199
  className: "rdg-light",
180
200
  ref: ref_data_grid,
181
201
  headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
182
- columns: finalColumns,
202
+ columns: columnsWithBackground,
183
203
  sortColumns,
184
204
  onSortColumnsChange: handleSortColumnsChange,
185
205
  onColumnResize,
@@ -207,7 +227,7 @@ function TableView(props) {
207
227
  className: "rdg-light",
208
228
  ref: ref_data_grid,
209
229
  headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
210
- columns: finalColumns,
230
+ columns: columnsWithBackground,
211
231
  sortColumns,
212
232
  onSortColumnsChange: handleSortColumnsChange,
213
233
  onColumnResize,
@@ -1,3 +1,4 @@
1
1
  export { getDragHeaderRenderer } from './getDragHeaderRenderer';
2
2
  export { getGroupBy } from './getGroupBy';
3
3
  export { defaultRowGrouper } from './defaultRowGrouper';
4
+ export { createRowCellsBackgroundMap, processColumnsWithRowCellsBackground, } from './rowCellsBackground';
@@ -0,0 +1,2 @@
1
+ export { createRowCellsBackgroundMap, processColumnsWithRowCellsBackground, } from './rowCellsBackground';
2
+ export type { CellColorGetter } from './types';
@@ -0,0 +1,32 @@
1
+ import { Column } from 'react-data-grid';
2
+ import { RowKey, RowCellBackground, RowHeightVariants } from '../../../../types';
3
+ import { CellColorGetter } from './types';
4
+ /**
5
+ * Convierte el array de rowCellsBackground en un Map para buscar el color
6
+ * de una celda usando la combinación de rowKey y columnKey.
7
+ *
8
+ * El Map usa como llave la combinación "rowKey|columnKey" (separados por |)
9
+ * y como valor el color.
10
+ *
11
+ * Ejemplo:
12
+ * - Entrada: [{ rowKey: 'user_1', columnKey: 'status', color: '#FF0000' }]
13
+ * - Map resultante: { 'user_1|status' => '#FF0000' }
14
+ * @param rowCellsBackground - Array de celdas con sus colores (puede ser undefined)
15
+ * @returns Map con la llave "rowKey|columnKey" y el color como valor
16
+ */
17
+ export declare const createRowCellsBackgroundMap: <TKey extends RowKey>(rowCellsBackground: RowCellBackground<TKey>[] | undefined) => Map<string, string>;
18
+ /**
19
+ * Procesa las columnas para agregar el wrapper de color donde corresponda.
20
+ *
21
+ * Para cada columna, modifica el renderCell para:
22
+ * 1. Obtener el rowKey de la fila actual
23
+ * 2. Buscar si existe un color para esa combinación rowKey + columnKey
24
+ * 3. Si existe color, envolver el contenido con CellBackgroundWrapperStyled
25
+ * 4. Si no existe color, mostrar el contenido normal sin cambios
26
+ * @param columns - Las columnas originales del DataGrid
27
+ * @param colorGetter - Map con los colores o función que retorna el color
28
+ * @param rowKeyGetter - Función que obtiene el key de una fila
29
+ * @param currentRowHeightVariant - Variante de altura de fila para el truncado
30
+ * @returns Las columnas modificadas con el renderCell actualizado
31
+ */
32
+ export declare const processColumnsWithRowCellsBackground: <TRow, TSummaryRow, TKey extends RowKey>(columns: readonly Column<TRow, TSummaryRow>[], colorGetter: CellColorGetter<TKey> | undefined, rowKeyGetter: (row: TRow) => TKey, currentRowHeightVariant?: RowHeightVariants) => Column<TRow, TSummaryRow>[];
@@ -0,0 +1,58 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { O as CellBackgroundWrapperStyled } from "../../../../slots/DataGridSlot.js";
3
+ const getCellColor = (colorGetter, rowKey, columnKey) => {
4
+ if (colorGetter instanceof Map) {
5
+ return colorGetter.get(`${rowKey}|${columnKey}`);
6
+ }
7
+ return colorGetter(rowKey, columnKey);
8
+ };
9
+ const createRowCellsBackgroundMap = (rowCellsBackground) => {
10
+ const map = /* @__PURE__ */ new Map();
11
+ if (!rowCellsBackground) {
12
+ return map;
13
+ }
14
+ rowCellsBackground.forEach(({ rowKey, columnKey, color }) => {
15
+ map.set(`${rowKey}|${columnKey}`, color);
16
+ });
17
+ return map;
18
+ };
19
+ const processColumnsWithRowCellsBackground = (columns, colorGetter, rowKeyGetter, currentRowHeightVariant) => {
20
+ if (!colorGetter) {
21
+ return columns;
22
+ }
23
+ if (colorGetter instanceof Map && colorGetter.size === 0) {
24
+ return columns;
25
+ }
26
+ return columns.map((column) => {
27
+ const originalRenderCell = column.renderCell;
28
+ return {
29
+ ...column,
30
+ // Mantener todas las propiedades originales de la columna
31
+ /**
32
+ * Reemplazar renderCell con nuestra versión que agrega el color
33
+ */
34
+ renderCell: (props) => {
35
+ const rowKey = rowKeyGetter(props.row);
36
+ const cellColor = getCellColor(colorGetter, rowKey, column.key);
37
+ const originalContent = originalRenderCell ? originalRenderCell(props) : props.row[column.key];
38
+ if (cellColor) {
39
+ return /* @__PURE__ */ jsx(
40
+ CellBackgroundWrapperStyled,
41
+ {
42
+ ownerState: {
43
+ cellBackgroundColor: cellColor,
44
+ currentRowHeightVariant
45
+ },
46
+ children: originalContent
47
+ }
48
+ );
49
+ }
50
+ return originalContent;
51
+ }
52
+ };
53
+ });
54
+ };
55
+ export {
56
+ createRowCellsBackgroundMap as c,
57
+ processColumnsWithRowCellsBackground as p
58
+ };
@@ -0,0 +1,7 @@
1
+ import { RowKey, RowCellsBackgroundGetter } from '../../../../types';
2
+ /**
3
+ * Tipo para el getter de color - puede ser Map (desde array) o función directa.
4
+ * - Map: Resultado de convertir un array de RowCellBackground
5
+ * - Función: La función directa que retorna el color para cada celda
6
+ */
7
+ export type CellColorGetter<TKey extends RowKey> = Map<string, string> | RowCellsBackgroundGetter<TKey>;
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect, useCallback } from "react";
3
3
  import { useModuleDictionary } from "@m4l/core";
4
4
  import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
5
- import { Q as MenuListStyled, S as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
5
+ import { S as MenuListStyled, U as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
6
6
  import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
7
7
  import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
8
8
  import { D as DICTIONARY } from "../../../../dictionary.js";
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useEnvironment } from "@m4l/core";
3
3
  import { p as pathIcons } from "../../../../icons.js";
4
4
  import { I as Icon } from "../../../../../Icon/Icon.js";
5
- import { O as DefaultRenderGroupCellRootStyled, P as DefaultRenderGroupCellTextStyled } from "../../../../slots/DataGridSlot.js";
5
+ import { P as DefaultRenderGroupCellRootStyled, Q as DefaultRenderGroupCellTextStyled } from "../../../../slots/DataGridSlot.js";
6
6
  import { u as useDataGrid } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
7
7
  function RenderGroupCell(props) {
8
8
  const { groupKey, isExpanded, toggleGroup, column, customRenderGroupCell, ...restProps } = props;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Componente RHFDaysOfMonthPicker que integra DaysOfMonthPicker con react-hook-form.
3
+ *
4
+ * Este componente permite seleccionar días del mes (1-31) en un formulario controlado
5
+ * por react-hook-form, proporcionando validación automática y manejo de estados.
6
+ *
7
+ * ### Características:
8
+ * - **Integración con RHF**: Se integra automáticamente con react-hook-form mediante el HOC withRHFController
9
+ * - **Validación**: Soporta validación mediante esquemas de validación (Yup, Zod, etc.)
10
+ * - **Estados del formulario**: Se deshabilita automáticamente durante el envío del formulario
11
+ * - **Label y errores**: El HOC maneja automáticamente el Label y los mensajes de error
12
+ * - **Modo single/multiple**: Permite seleccionar un día único o múltiples días
13
+ * - **Atajos**: Soporta atajos de selección rápida cuando está en modo multiple
14
+ * @example
15
+ * ```tsx
16
+ * const schema = Yup.object({
17
+ * days: Yup.array().min(1, 'Debe seleccionar al menos un día').required('Campo requerido'),
18
+ * });
19
+ *
20
+ * <RHFDaysOfMonthPicker
21
+ * name="days"
22
+ * label="Días del mes"
23
+ * mandatory
24
+ * multiple
25
+ * disabledDays={[1, 15]} // Deshabilita día 1 y 15
26
+ * />
27
+ * ```
28
+ */
29
+ export declare const RHFDaysOfMonthPicker: import('react').ForwardRefExoticComponent<Omit<import('../../DaysOfMonthPicker').DaysOfMonthPickerProps & import('react').RefAttributes<HTMLDivElement> & import('../../../hocs').BaseRHFProps<import('react-hook-form').FieldValues>, "ref"> & import('react').RefAttributes<any>>;
@@ -0,0 +1,6 @@
1
+ import { w as withRHFController } from "../../../hocs/withRHFController/index.js";
2
+ import { D as DaysOfMonthPicker } from "../../DaysOfMonthPicker/DaysOfMonthPicker.js";
3
+ const RHFDaysOfMonthPicker = withRHFController(DaysOfMonthPicker);
4
+ export {
5
+ RHFDaysOfMonthPicker as R
6
+ };
@@ -0,0 +1 @@
1
+ export { RHFDaysOfMonthPicker } from './RHFDaysOfMonthPicker';
@@ -9,6 +9,7 @@ export { RHFDateTime } from './RHFDateTime';
9
9
  export { RHFDateTimePicker } from './RHFDateTimePicker';
10
10
  export { RHFDatePicker } from './RHFDatePicker';
11
11
  export * from './RHFDaysOfWeekPicker';
12
+ export * from './RHFDaysOfMonthPicker';
12
13
  export { RHFMultiCheckbox } from './RHFMultiCheckbox';
13
14
  export { RHFSelect } from './RHFSelect';
14
15
  export { RHFHelperError } from './RHFHelperError';
@@ -16,6 +16,7 @@ export * from './CommonActions/dictionary';
16
16
  export * from './datagrids';
17
17
  export * from './DaysOfWeekPicker';
18
18
  export * from './DragResizeWindowRND';
19
+ export * from './DaysOfMonthPicker';
19
20
  export * from './DynamicFilter';
20
21
  export * from './DynamicSort';
21
22
  export * from './extended';
package/index.js CHANGED
@@ -63,14 +63,15 @@ import { D as D2, d, g as g3 } from "./components/CommonActions/dictionary.js";
63
63
  import { D as D3 } from "./components/datagrids/components/DataGridMain/DataGridMain.js";
64
64
  import { D as D4, g as g4 } from "./components/formatters/DateFormatter/DateFormatter.js";
65
65
  import { D as D5 } from "./components/mui_extended/DatePicker/DatePicker.js";
66
- import { D as D6 } from "./components/DaysOfWeekPicker/DaysOfWeekPicker.js";
67
- import { D as D7 } from "./components/mui_extended/Dialog/Dialog.js";
68
- import { D as D8 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
69
- import { D as D9 } from "./components/mui_extended/Divider/Divider.js";
70
- import { D as D10 } from "./components/DragResizeWindowRND/DragResizeWindowRND.js";
71
- import { D as D11 } from "./components/DynamicFilter/DynamicFilter.js";
72
- import { D as D12, a as a5, M } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
73
- import { D as D13 } from "./components/DynamicSort/DynamicSort.js";
66
+ import { D as D6 } from "./components/DaysOfMonthPicker/DaysOfMonthPicker.js";
67
+ import { D as D7 } from "./components/DaysOfWeekPicker/DaysOfWeekPicker.js";
68
+ import { D as D8 } from "./components/mui_extended/Dialog/Dialog.js";
69
+ import { D as D9 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
70
+ import { D as D10 } from "./components/mui_extended/Divider/Divider.js";
71
+ import { D as D11 } from "./components/DragResizeWindowRND/DragResizeWindowRND.js";
72
+ import { D as D12 } from "./components/DynamicFilter/DynamicFilter.js";
73
+ import { D as D13, a as a5, M } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
74
+ import { D as D14 } from "./components/DynamicSort/DynamicSort.js";
74
75
  import { F } from "./components/extended/React-Window/FixedSizeList/FixedSizeList.js";
75
76
  import { F as F2 } from "./components/FormContainer/FormContainer.js";
76
77
  import { F as F3, R, u } from "./components/hook-form/RHFormProvider/RHFormProvider.js";
@@ -132,24 +133,25 @@ import { R as R8 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js
132
133
  import { R as R9 } from "./components/hook-form/RHFDatePicker/RHFDatePicker.js";
133
134
  import { R as R10 } from "./components/hook-form/RHFDateTime/RHFDateTime.js";
134
135
  import { R as R11 } from "./components/hook-form/RHFDateTimePicker/RHFDateTimePicker.js";
135
- import { R as R12 } from "./components/hook-form/RHFDaysOfWeekPicker/RHFDaysOfWeekPicker.js";
136
- import { R as R13 } from "./components/hook-form/RHFHelperError/index.js";
137
- import { R as R14 } from "./components/hook-form/RHFMultiCheckbox/index.js";
138
- import { R as R15 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
139
- import { R as R16 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
140
- import { R as R17 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
141
- import { R as R18 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
142
- import { R as R19 } from "./components/hook-form/RHFSelect/RHFSelect.js";
143
- import { R as R20 } from "./components/hook-form/RHFTextField/RHFTextField.js";
144
- import { R as R21 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
145
- import { R as R22 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
146
- import { R as R23 } from "./components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js";
147
- import { R as R24 } from "./components/hook-form/RHFPeriod/constants.js";
148
- import { R as R25 } from "./components/mui_extended/Radio/Radio.js";
149
- import { R as R26 } from "./components/extended/React-Json-Viewer/ReactJsonViewer.js";
150
- import { R as R27 } from "./components/extended/React-Resizable/Resizable/Resizable.js";
151
- import { R as R28 } from "./components/extended/React-Resizable/ResizableBox/ResizableBox.js";
152
- import { R as R29 } from "./components/GridLayout/subcomponents/Responsive/index.js";
136
+ import { R as R12 } from "./components/hook-form/RHFDaysOfMonthPicker/RHFDaysOfMonthPicker.js";
137
+ import { R as R13 } from "./components/hook-form/RHFDaysOfWeekPicker/RHFDaysOfWeekPicker.js";
138
+ import { R as R14 } from "./components/hook-form/RHFHelperError/index.js";
139
+ import { R as R15 } from "./components/hook-form/RHFMultiCheckbox/index.js";
140
+ import { R as R16 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
141
+ import { R as R17 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
142
+ import { R as R18 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
143
+ import { R as R19 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
144
+ import { R as R20 } from "./components/hook-form/RHFSelect/RHFSelect.js";
145
+ import { R as R21 } from "./components/hook-form/RHFTextField/RHFTextField.js";
146
+ import { R as R22 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
147
+ import { R as R23 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
148
+ import { R as R24 } from "./components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js";
149
+ import { R as R25 } from "./components/hook-form/RHFPeriod/constants.js";
150
+ import { R as R26 } from "./components/mui_extended/Radio/Radio.js";
151
+ import { R as R27 } from "./components/extended/React-Json-Viewer/ReactJsonViewer.js";
152
+ import { R as R28 } from "./components/extended/React-Resizable/Resizable/Resizable.js";
153
+ import { R as R29 } from "./components/extended/React-Resizable/ResizableBox/ResizableBox.js";
154
+ import { R as R30 } from "./components/GridLayout/subcomponents/Responsive/index.js";
153
155
  import { S as S2 } from "./hooks/useSvgColor/constants.js";
154
156
  import { S as S3 } from "./components/ScrollBar/ScrollBar.js";
155
157
  import { S as S4 } from "./components/commercial/SectionCommercial/index.js";
@@ -356,15 +358,16 @@ export {
356
358
  D3 as DataGrid,
357
359
  D4 as DateFormatter,
358
360
  D5 as DatePicker,
359
- D6 as DaysOfWeekPicker,
360
- D7 as Dialog,
361
- D8 as DistanceToNowFormatter,
362
- D9 as Divider,
363
- D10 as DragResizeWindowRND,
364
- D11 as DynamicFilter,
365
- D12 as DynamicMFParmsContext,
361
+ D6 as DaysOfMonthPicker,
362
+ D7 as DaysOfWeekPicker,
363
+ D8 as Dialog,
364
+ D9 as DistanceToNowFormatter,
365
+ D10 as Divider,
366
+ D11 as DragResizeWindowRND,
367
+ D12 as DynamicFilter,
368
+ D13 as DynamicMFParmsContext,
366
369
  a5 as DynamicMFParmsProvider,
367
- D13 as DynamicSort,
370
+ D14 as DynamicSort,
368
371
  F as FixedSizeList,
369
372
  F2 as FormContainer,
370
373
  F3 as FormProviderCustom,
@@ -432,26 +435,27 @@ export {
432
435
  R9 as RHFDatePicker,
433
436
  R10 as RHFDateTime,
434
437
  R11 as RHFDateTimePicker,
435
- R12 as RHFDaysOfWeekPicker,
436
- R13 as RHFHelperError,
437
- R14 as RHFMultiCheckbox,
438
- R15 as RHFNumberInput,
439
- R16 as RHFPeriod,
438
+ R12 as RHFDaysOfMonthPicker,
439
+ R13 as RHFDaysOfWeekPicker,
440
+ R14 as RHFHelperError,
441
+ R15 as RHFMultiCheckbox,
442
+ R16 as RHFNumberInput,
443
+ R17 as RHFPeriod,
440
444
  R2 as RHFPeriodRootStyled,
441
- R17 as RHFPeriodSlots,
442
- R18 as RHFRadioGroup,
443
- R19 as RHFSelect,
444
- R20 as RHFTextField,
445
- R21 as RHFTextFieldPassword,
446
- R22 as RHFUploadImage,
447
- R23 as RHFUploadSingleFile,
448
- R24 as RHF_PERIOD_KEY_COMPONENT,
445
+ R18 as RHFPeriodSlots,
446
+ R19 as RHFRadioGroup,
447
+ R20 as RHFSelect,
448
+ R21 as RHFTextField,
449
+ R22 as RHFTextFieldPassword,
450
+ R23 as RHFUploadImage,
451
+ R24 as RHFUploadSingleFile,
452
+ R25 as RHF_PERIOD_KEY_COMPONENT,
449
453
  R as RHFormProvider,
450
- R25 as Radio,
451
- R26 as ReactJsonViewer,
452
- R27 as Resizable,
453
- R28 as ResizableBox,
454
- R29 as Responsive,
454
+ R26 as Radio,
455
+ R27 as ReactJsonViewer,
456
+ R28 as Resizable,
457
+ R29 as ResizableBox,
458
+ R30 as Responsive,
455
459
  S2 as SKELETON_SVG_ICON,
456
460
  S3 as ScrollBar,
457
461
  S4 as SectionCommercial,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.4.23",
3
+ "version": "9.4.25",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {