@m4l/components 9.4.19-BE20260205-2 → 9.4.19-BE20260205-5

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.
@@ -1 +1 @@
1
- import "./rsuite";
1
+
@@ -0,0 +1,77 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from "react";
3
+ import { S as SkeletonDateRangePickerStyled, D as DateRangePickerStyled } from "./slots/DateRangePickerSlots.js";
4
+ import { u as useDateRangePicker } from "./hooks/useDateRangePicker/useDateRangePicker.js";
5
+ import { D as DATE_RANGE_PICKER_CLASSES } from "./constants.js";
6
+ import { clsx } from "clsx";
7
+ import { T as TEST_PROP_ID } from "../../../../test/constants_no_mock.js";
8
+ import { DateRangePicker as DateRangePicker$1 } from "rsuite";
9
+ import { DateTimeCreatedOutlined } from "@m4l/icons";
10
+ import { I as Icon } from "../../../Icon/Icon.js";
11
+ const DateRangePicker = forwardRef((props, ref) => {
12
+ const {
13
+ value,
14
+ onChange,
15
+ disabled,
16
+ className,
17
+ readOnly,
18
+ dataTestId,
19
+ format: formatProp,
20
+ ...dateRangePickerProps
21
+ } = props;
22
+ const {
23
+ ownerState,
24
+ dateFormat,
25
+ currentSize,
26
+ isSkeleton
27
+ } = useDateRangePicker(props);
28
+ const handleChange = (rsuiteValue) => {
29
+ if (rsuiteValue === null || rsuiteValue === void 0) {
30
+ onChange?.({ start: null, end: null });
31
+ } else {
32
+ const [start, end] = rsuiteValue;
33
+ onChange?.({ start, end });
34
+ }
35
+ };
36
+ const caretAs = useMemo(() => {
37
+ const CaretIcon = () => /* @__PURE__ */ jsx(Icon, { size: currentSize, src: /* @__PURE__ */ jsx(DateTimeCreatedOutlined, {}) });
38
+ return CaretIcon;
39
+ }, [currentSize]);
40
+ const normalizedValue = value ? [value.start, value.end] : [null, null];
41
+ if (isSkeleton) {
42
+ return /* @__PURE__ */ jsx(
43
+ SkeletonDateRangePickerStyled,
44
+ {
45
+ className: DATE_RANGE_PICKER_CLASSES.skeleton,
46
+ variant: "rounded",
47
+ ownerState: { size: currentSize },
48
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {}
49
+ }
50
+ );
51
+ }
52
+ return /* @__PURE__ */ jsx(
53
+ DateRangePickerStyled,
54
+ {
55
+ className: clsx(className, DATE_RANGE_PICKER_CLASSES.root),
56
+ ...{ ownerState },
57
+ ref,
58
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: dataTestId } : {},
59
+ children: /* @__PURE__ */ jsx(
60
+ DateRangePicker$1,
61
+ {
62
+ ...dateRangePickerProps,
63
+ value: normalizedValue,
64
+ onChange: handleChange,
65
+ disabled,
66
+ readOnly,
67
+ format: formatProp || dateFormat,
68
+ caretAs
69
+ }
70
+ )
71
+ }
72
+ );
73
+ });
74
+ DateRangePicker.displayName = "DateRangePicker";
75
+ export {
76
+ DateRangePicker as D
77
+ };
@@ -0,0 +1,83 @@
1
+ import { g as getSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
2
+ import { g as getTypographyStyles } from "../../../../utils/getTypographyStyles.js";
3
+ import { D as DATE_RANGE_PICKER_CLASSES } from "./constants.js";
4
+ const dateRangePickerStyles = {
5
+ /**
6
+ * Estilos para el elemento raíz del DateRangePicker.
7
+ */
8
+ root: ({ theme, ownerState }) => ({
9
+ "&&&": {
10
+ width: "100%",
11
+ "& .rs-picker": {
12
+ width: "100%"
13
+ },
14
+ // input group
15
+ ".rs-input-group": {
16
+ width: "100%",
17
+ "& .rs-input": {
18
+ backgroundColor: "transparent",
19
+ color: theme.vars.palette.text.primary,
20
+ ...getTypographyStyles(theme.generalSettings.isMobile, ownerState?.size || "medium", "body")
21
+ },
22
+ "& .rs-btn-close": {
23
+ display: "flex",
24
+ alignItems: "center",
25
+ justifyContent: "center",
26
+ "& svg": {
27
+ width: "12px",
28
+ height: "12px",
29
+ fill: theme.vars.palette.text.primary
30
+ }
31
+ },
32
+ borderRadius: theme.vars.size.borderRadius["r1-5"],
33
+ borderColor: `${theme.vars.palette.border.secondary}!important`,
34
+ border: theme.vars.size.borderStroke.container,
35
+ backgroundColor: theme.vars.palette.background.default,
36
+ transition: "all 0.3s ease",
37
+ paddingLeft: theme.vars.size.baseSpacings.sp1,
38
+ boxShadow: "unset",
39
+ outline: "unset",
40
+ ...getSizeStyles(theme, ownerState?.size || "medium", "action"),
41
+ ...ownerState?.error && {
42
+ borderColor: `${theme.vars.palette.error.enabled}!important`
43
+ },
44
+ "&:hover": {
45
+ backgroundColor: theme.vars.palette.default.hoverOpacity,
46
+ ...ownerState?.error && {
47
+ backgroundColor: theme.vars.palette.error.hoverOpacity,
48
+ borderColor: `${theme.vars.palette.error.hover}!important`
49
+ }
50
+ },
51
+ '&:focus, &[data-focus="true"]': {
52
+ borderColor: `${theme.vars.palette.primary.selected}!important`,
53
+ ...ownerState?.error && {
54
+ borderColor: `${theme.vars.palette.error.focus}!important`
55
+ }
56
+ }
57
+ },
58
+ // Estilos para el drawer en mobile (se renderiza en un portal separado)
59
+ // El drawer se renderiza fuera del árbol del componente, por lo que usamos un selector global
60
+ // que apunta al drawer cuando contiene el popup con nuestra clase
61
+ [`body .rs-drawer .rs-drawer-dialog`]: {
62
+ backgroundColor: "red!important"
63
+ }
64
+ }
65
+ }),
66
+ /**
67
+ * Estilos personalizados para el componente Skeleton.
68
+ */
69
+ skeleton: ({ ownerState, theme }) => ({
70
+ [`&.${DATE_RANGE_PICKER_CLASSES.skeleton}`]: {
71
+ display: "flex",
72
+ borderRadius: theme.vars.size.borderRadius["r1-5"],
73
+ ...getSizeStyles(
74
+ theme,
75
+ ownerState?.size || "medium",
76
+ "action"
77
+ )
78
+ }
79
+ })
80
+ };
81
+ export {
82
+ dateRangePickerStyles as d
83
+ };
@@ -0,0 +1,11 @@
1
+ import { g as getComponentClasses } from "../../../../utils/getComponentSlotRoot.js";
2
+ import { D as DateRangePickerEnum } from "./slots/DateRangePickerEnum.js";
3
+ const DATE_RANGE_PICKER_KEY_COMPONENT = "M4LDateRangePicker";
4
+ const DATE_RANGE_PICKER_CLASSES = getComponentClasses(
5
+ DATE_RANGE_PICKER_KEY_COMPONENT,
6
+ DateRangePickerEnum
7
+ );
8
+ export {
9
+ DATE_RANGE_PICKER_CLASSES as D,
10
+ DATE_RANGE_PICKER_KEY_COMPONENT as a
11
+ };
@@ -0,0 +1,29 @@
1
+ import { useFormatter } from "@m4l/graphics";
2
+ import { useMemo } from "react";
3
+ import { useModuleSkeleton } from "@m4l/core";
4
+ import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
5
+ const useDateRangePicker = (props) => {
6
+ const {
7
+ error,
8
+ size = "medium",
9
+ disabled
10
+ } = props;
11
+ const { dateFormatter } = useFormatter();
12
+ const { currentSize } = useComponentSize(size);
13
+ const isSkeleton = useModuleSkeleton();
14
+ const { dateFormat } = dateFormatter;
15
+ const ownerState = useMemo(() => ({
16
+ size: currentSize,
17
+ error: !!error,
18
+ disabled: !!disabled
19
+ }), [currentSize, error, disabled]);
20
+ return {
21
+ ownerState,
22
+ dateFormat,
23
+ currentSize,
24
+ isSkeleton
25
+ };
26
+ };
27
+ export {
28
+ useDateRangePicker as u
29
+ };
@@ -1,2 +1,2 @@
1
1
  export { DateRangePicker } from './DateRangePicker';
2
- export type { DateRangePickerProps } from './types';
2
+ export type { DateRangePickerProps, DateRangeValue } from './types';
@@ -0,0 +1,8 @@
1
+ var DateRangePickerEnum = /* @__PURE__ */ ((DateRangePickerEnum2) => {
2
+ DateRangePickerEnum2["root"] = "root";
3
+ DateRangePickerEnum2["skeleton"] = "skeleton";
4
+ return DateRangePickerEnum2;
5
+ })(DateRangePickerEnum || {});
6
+ export {
7
+ DateRangePickerEnum as D
8
+ };
@@ -0,0 +1,19 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { a as DATE_RANGE_PICKER_KEY_COMPONENT } from "../constants.js";
3
+ import { d as dateRangePickerStyles } from "../DateRangePicker.styles.js";
4
+ import { D as DateRangePickerEnum } from "./DateRangePickerEnum.js";
5
+ import { S as Skeleton } from "../../../../mui_extended/Skeleton/Skeleton.js";
6
+ const DateRangePickerStyled = styled("div", {
7
+ name: DATE_RANGE_PICKER_KEY_COMPONENT,
8
+ slot: DateRangePickerEnum.root,
9
+ shouldForwardProp: (prop) => prop !== "ownerState"
10
+ })(dateRangePickerStyles?.root);
11
+ const SkeletonDateRangePickerStyled = styled(Skeleton, {
12
+ name: DATE_RANGE_PICKER_KEY_COMPONENT,
13
+ slot: DateRangePickerEnum.skeleton,
14
+ shouldForwardProp: (prop) => prop !== "ownerState"
15
+ })(dateRangePickerStyles?.skeleton);
16
+ export {
17
+ DateRangePickerStyled as D,
18
+ SkeletonDateRangePickerStyled as S
19
+ };
@@ -1,5 +1,5 @@
1
- import { DateRangePicker } from "../../extended/rsuite/DateRangePicker";
2
1
  import { w as withRHFController } from "../../../hocs/withRHFController/index.js";
2
+ import { D as DateRangePicker } from "../../extended/rsuite/DateRangePicker/DateRangePicker.js";
3
3
  const RHFDateRangePicker = withRHFController(DateRangePicker);
4
4
  export {
5
5
  RHFDateRangePicker as R
package/index.js CHANGED
@@ -101,7 +101,7 @@ import { P } from "./components/extended/React-Spinners/PropagateLoaderSpinner/P
101
101
  import { F } from "./components/extended/React-Window/FixedSizeList/FixedSizeList.js";
102
102
  import { V } from "./components/extended/React-Window/VariableSizeList/VariableSizeList.js";
103
103
  import { R as R3 } from "./components/extended/React-Json-Viewer/ReactJsonViewer.js";
104
- export * from "./components/extended/rsuite";
104
+ import { D as D7 } from "./components/extended/rsuite/DateRangePicker/DateRangePicker.js";
105
105
  import { A as A16 } from "./components/mui_extended/Avatar/Avatar.js";
106
106
  import { B as B2 } from "./components/mui_extended/BoxIcon/index.js";
107
107
  import { B as B3 } from "./components/mui_extended/Breadcrumbs/index.js";
@@ -138,11 +138,11 @@ import { a as a8, T as T15 } from "./components/mui_extended/ToggleIconButton/co
138
138
  import { T as T16 } from "./components/mui_extended/ToggleIconButton/slots/ToggleIconButtonEnum.js";
139
139
  import { T as T17 } from "./components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.js";
140
140
  import { N as N2 } from "./components/mui_extended/NavLink/NavLink.js";
141
- import { D as D7 } from "./components/mui_extended/Dialog/Dialog.js";
142
- import { D as D8 } from "./components/mui_extended/Divider/Divider.js";
143
- import { D as D9 } from "./components/mui_extended/DatePicker/DatePicker.js";
141
+ import { D as D8 } from "./components/mui_extended/Dialog/Dialog.js";
142
+ import { D as D9 } from "./components/mui_extended/Divider/Divider.js";
143
+ import { D as D10 } from "./components/mui_extended/DatePicker/DatePicker.js";
144
144
  import { B as B6 } from "./components/formatters/BooleanFormatter/BooleanFormatter.js";
145
- import { D as D10, g as g14 } from "./components/formatters/DateFormatter/DateFormatter.js";
145
+ import { D as D11, g as g14 } from "./components/formatters/DateFormatter/DateFormatter.js";
146
146
  import { U, g as g15 } from "./components/formatters/UncertaintyFormatter/UncertaintyFormatter.js";
147
147
  import { P as P3, g as g16 } from "./components/formatters/PointsFormatter/PointsFormatter.js";
148
148
  import { C as C33, g as g17 } from "./components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
@@ -153,7 +153,7 @@ import { C as C34 } from "./components/formatters/ColorFormatter/ColorFormatter.
153
153
  import { I as I4 } from "./components/formatters/ImageFormatter/ImageFormatter.js";
154
154
  import { C as C35 } from "./components/formatters/ChipStatusFormatter/ChipStatusFormatter.js";
155
155
  import { g as g19 } from "./components/formatters/DistanceToNowFormatter/dictionary.js";
156
- import { D as D11 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
156
+ import { D as D12 } from "./components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js";
157
157
  import { u as u17 } from "./components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js";
158
158
  import { g as g20 } from "./components/formatters/dictionary.js";
159
159
  import { F as F2 } from "./components/FormContainer/FormContainer.js";
@@ -234,7 +234,7 @@ import { u as u20 } from "./components/WindowBase/hooks/useWindowToolsMF/index.j
234
234
  import { u as u21, a as a14 } from "./components/WindowBase/hooks/useDynamicMFParameters/index.js";
235
235
  import { M as M7, W as W3, a as a15 } from "./components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js";
236
236
  import { c as c4 } from "./components/WindowBase/contexts/DynamicMFParmsContext/store.js";
237
- import { D as D12, a as a16, M as M8 } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
237
+ import { D as D13, a as a16, M as M8 } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
238
238
  import { W as W4 } from "./components/WindowConfirm/WindowConfirm.js";
239
239
  import { a as a17, g as g30 } from "./components/ModalDialog/dictionary.js";
240
240
  import { M as M9 } from "./components/ModalDialog/ModalDialog.js";
@@ -356,15 +356,16 @@ export {
356
356
  e as DATAGRID_SEMANTIC_WIDTHS,
357
357
  D as DICTIONARY,
358
358
  D2 as DataGrid,
359
- D10 as DateFormatter,
360
- D9 as DatePicker,
359
+ D11 as DateFormatter,
360
+ D10 as DatePicker,
361
+ D7 as DateRangePicker,
361
362
  D3 as DaysOfWeekPicker,
362
- D7 as Dialog,
363
- D11 as DistanceToNowFormatter,
364
- D8 as Divider,
363
+ D8 as Dialog,
364
+ D12 as DistanceToNowFormatter,
365
+ D9 as Divider,
365
366
  D4 as DragResizeWindowRND,
366
367
  D5 as DynamicFilter,
367
- D12 as DynamicMFParmsContext,
368
+ D13 as DynamicMFParmsContext,
368
369
  a16 as DynamicMFParmsProvider,
369
370
  D6 as DynamicSort,
370
371
  F as FixedSizeList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.4.19-BE20260205-2+PR665-dateRangePicker",
3
+ "version": "9.4.19-BE20260205-5+PR665-dateRangePicker",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -11,7 +11,7 @@
11
11
  "@googlemaps/js-api-loader": "^1.16.6",
12
12
  "@hookform/resolvers": "2.9.11",
13
13
  "@m4l/core": "^2.0.0",
14
- "@m4l/graphics": "^7.0.0",
14
+ "@m4l/graphics": "7.2.2-BE20260205-5+PR665-dateRangePicker",
15
15
  "@m4l/icons": "0.0.11",
16
16
  "@m4l/styles": "^7.0.0",
17
17
  "@mui/lab": "5.0.0-alpha.173",