@m4l/components 9.1.87 → 9.1.89
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.
- package/@types/types.d.ts +9 -1
- package/components/Chip/Chip.js +3 -1
- package/components/Chip/ChipStyles.js +19 -14
- package/components/Chip/types.d.ts +8 -3
- package/components/MenuActions/MenuActions.d.ts +1 -1
- package/components/MenuActions/MenuActions.js +18 -2
- package/components/MenuActions/MenuActions.styles.js +17 -4
- package/components/MenuActions/slots/MenuActionsEnum.d.ts +3 -1
- package/components/MenuActions/slots/MenuActionsEnum.js +2 -0
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +6 -0
- package/components/MenuActions/slots/MenuActionsSlots.js +10 -0
- package/components/MenuActions/types.d.ts +11 -3
- package/components/hook-form/RHFDateTime/RHFDateTime.d.ts +4 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.js +39 -86
- package/components/hook-form/RHFDateTime/RHFDateTime.styles.d.ts +2 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.styles.js +17 -0
- package/components/hook-form/RHFDateTime/constants.d.ts +1 -0
- package/components/hook-form/RHFDateTime/constants.js +4 -0
- package/components/hook-form/RHFDateTime/slots/RHFDateTimeEnum.d.ts +3 -0
- package/components/hook-form/RHFDateTime/slots/RHFDateTimeEnum.js +7 -0
- package/components/hook-form/RHFDateTime/slots/RHFDateTimeSlots.d.ts +1 -0
- package/components/hook-form/RHFDateTime/slots/RHFDateTimeSlots.js +9 -0
- package/components/hook-form/RHFDateTime/tests/RHFDateTime.test.d.ts +1 -0
- package/components/hook-form/RHFDateTime/types.d.ts +13 -12
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +1 -5
- package/components/mui_extended/DateTimePicker/DateTimePicker.d.ts +33 -0
- package/components/mui_extended/DateTimePicker/DateTimePicker.js +154 -0
- package/components/mui_extended/DateTimePicker/DateTimePicker.styles.d.ts +2 -0
- package/components/mui_extended/DateTimePicker/DateTimePicker.styles.js +752 -0
- package/components/mui_extended/DateTimePicker/constants.d.ts +1 -0
- package/components/mui_extended/DateTimePicker/constants.js +4 -0
- package/components/mui_extended/DateTimePicker/icons.d.ts +4 -0
- package/components/mui_extended/DateTimePicker/icons.js +10 -0
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerEnum.d.ts +10 -0
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerEnum.js +14 -0
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +26 -0
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.js +49 -0
- package/components/mui_extended/DateTimePicker/tests/DateTimePicker.test.d.ts +1 -0
- package/components/mui_extended/DateTimePicker/types.d.ts +51 -0
- package/package.json +1 -1
- package/components/hook-form/RHFDateTime/classes/constants.d.ts +0 -1
- package/components/hook-form/RHFDateTime/classes/constants.js +0 -4
- package/components/hook-form/RHFDateTime/classes/index.d.ts +0 -11
- package/components/hook-form/RHFDateTime/classes/index.js +0 -45
- package/components/hook-form/RHFDateTime/classes/types.d.ts +0 -16
- package/components/hook-form/RHFDateTime/styles.js +0 -7
- package/components/hook-form/RHFDateTime/subcomponents/Skeleton/index.d.ts +0 -5
- package/components/hook-form/RHFDateTime/subcomponents/Skeleton/index.js +0 -15
- package/components/hook-form/RHFDateTime/subcomponents/Skeleton/types.d.ts +0 -5
- package/components/hook-form/RHFDateTime/test/constants.d.ts +0 -1
- package/components/hook-form/RHFDateTime/test/constants.js +0 -4
- package/components/hook-form/RHFDateTime/test/utils.d.ts +0 -2
- package/components/hook-form/RHFDateTime/test/utils.js +0 -7
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
import { TextFieldVariants } from '../../../components/mui_extended/TextField/types';
|
|
1
3
|
import { LabelProps } from '../../Label/types';
|
|
4
|
+
import { M4LOverridesStyleRules } from '../../../../src/@types/augmentations';
|
|
5
|
+
import { Theme } from '@mui/material';
|
|
6
|
+
import { RHFDateTimeSlots } from './slots/RHFDateTimeEnum';
|
|
7
|
+
import { RHF_DATE_TIME_KEY_COMPONENT } from './constants';
|
|
2
8
|
export interface RHFDateTimeProps extends Omit<LabelProps, 'label'> {
|
|
3
|
-
skeletonWidth?: string | number;
|
|
4
|
-
skeletonHeight?: string | number;
|
|
5
9
|
name: string;
|
|
6
|
-
variant?:
|
|
7
|
-
size?:
|
|
10
|
+
variant?: TextFieldVariants;
|
|
11
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
8
12
|
disabled?: boolean;
|
|
9
13
|
className?: string;
|
|
10
14
|
label?: string;
|
|
11
15
|
helperMessage?: string;
|
|
16
|
+
/**
|
|
17
|
+
* dataTestId
|
|
18
|
+
*/
|
|
19
|
+
dataTestId?: string;
|
|
12
20
|
}
|
|
13
|
-
type
|
|
14
|
-
export type RHFDateTimeVariants = 'info' | 'success' | 'warning' | undefined;
|
|
15
|
-
export interface OwnerState extends Pick<RHFDateTimeProps, 'size' | 'disabled'> {
|
|
16
|
-
isFocus: boolean;
|
|
17
|
-
isTabSelected: boolean;
|
|
18
|
-
variant?: RHFDateTimeVariants | 'error';
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
+
export type RHFDateTimeStyles = M4LOverridesStyleRules<keyof typeof RHFDateTimeSlots, typeof RHF_DATE_TIME_KEY_COMPONENT, Theme>;
|
|
@@ -58,11 +58,7 @@ const autocompleteSyles = {
|
|
|
58
58
|
* @updatedAt 2025-01-08 10:36:41 - automatic
|
|
59
59
|
* @updatedUser Andrés Quintero - automatic
|
|
60
60
|
*/
|
|
61
|
-
chip:
|
|
62
|
-
"& .M4LIconClass-root": {
|
|
63
|
-
backgroundColor: theme.vars.palette.chips.default.semanticText
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
61
|
+
chip: {},
|
|
66
62
|
/**
|
|
67
63
|
* Styles for the text field component.
|
|
68
64
|
* @author SebastianM - automatic
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DateTimePickerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* DataTimePicker es un refactor del componente de material UI.
|
|
4
|
+
* @author DanielEscobar - automatic
|
|
5
|
+
* @createdAt 2025-01-27 14:53:37 - automatic
|
|
6
|
+
* @updatedAt 2025-01-28 13:53:42 - automatic
|
|
7
|
+
* @updatedUser DanielEscobar - automatic
|
|
8
|
+
*
|
|
9
|
+
* ```tsx *
|
|
10
|
+
* const ExampleComponent = () => {
|
|
11
|
+
* const [selectedDate, setSelectedDate] = useState<Date | null>(new Date());
|
|
12
|
+
*
|
|
13
|
+
* const handleDateChange = (date: Date | null) => {
|
|
14
|
+
* setSelectedDate(date);
|
|
15
|
+
* };
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <DateTimePicker
|
|
19
|
+
* size="medium"
|
|
20
|
+
* error={false}
|
|
21
|
+
* disabled={false}
|
|
22
|
+
* variant="outlined"
|
|
23
|
+
* ampm={true}
|
|
24
|
+
* value={selectedDate}
|
|
25
|
+
* onChange={handleDateChange}
|
|
26
|
+
* />
|
|
27
|
+
* );
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* export default ExampleComponent;
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const DateTimePicker: (props: DateTimePickerProps<Date>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useMemo, useCallback } from "react";
|
|
4
|
+
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
5
|
+
import { useIsMobile } from "@m4l/graphics";
|
|
6
|
+
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
7
|
+
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
8
|
+
import { P as PopperStyled, a as PickersCalendarHeaderStyled, I as IconButtonStyled, b as PickersDayStyled, c as PaperStyled, S as SkeletonStyled, M as MobileDateTimePickerRootStyled, D as DesktopDateTimePickerRootStyled } from "./slots/DateTimePickerSlots.js";
|
|
9
|
+
import { d as date, c as chevron_right, a as chevron_left, b as chevron_down } from "./icons.js";
|
|
10
|
+
import { D as DateTimePickerEnum } from "./slots/DateTimePickerEnum.js";
|
|
11
|
+
import { D as DATE_TIME_PICKER_KEY_COMPONENT } from "./constants.js";
|
|
12
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
13
|
+
import { I as IconButton } from "../IconButton/IconButton.js";
|
|
14
|
+
const DateTimePicker = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
size = "medium",
|
|
17
|
+
error = false,
|
|
18
|
+
disabled = false,
|
|
19
|
+
className,
|
|
20
|
+
dataTestId,
|
|
21
|
+
variant,
|
|
22
|
+
ampm = true,
|
|
23
|
+
value,
|
|
24
|
+
onChange,
|
|
25
|
+
...others
|
|
26
|
+
} = props;
|
|
27
|
+
const isMobile = useIsMobile();
|
|
28
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
29
|
+
const { currentSize } = useComponentSize(size);
|
|
30
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
31
|
+
const ownerState = useMemo(() => ({
|
|
32
|
+
size: adjustedSize,
|
|
33
|
+
error,
|
|
34
|
+
variant,
|
|
35
|
+
disabled
|
|
36
|
+
}), [adjustedSize, disabled, error, variant]);
|
|
37
|
+
const openPickerButton = useCallback((args) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
IconButton,
|
|
40
|
+
{
|
|
41
|
+
...args,
|
|
42
|
+
icon: `${host_static_assets}/${environment_assets}/${date}`,
|
|
43
|
+
size: adjustedSize,
|
|
44
|
+
disabled
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}, [adjustedSize, disabled, environment_assets, host_static_assets]);
|
|
48
|
+
const popper = useCallback((args) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(PopperStyled, { ...args, ownerState, ...getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.popper, dataTestId) });
|
|
50
|
+
}, [ownerState]);
|
|
51
|
+
const calendarHeader = useCallback((args) => {
|
|
52
|
+
return /* @__PURE__ */ jsx(PickersCalendarHeaderStyled, { ...args, ownerState, ...getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.pickersCalendarHeader, dataTestId) });
|
|
53
|
+
}, [ownerState]);
|
|
54
|
+
const nextIconButton = useCallback((args) => {
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
IconButtonStyled,
|
|
57
|
+
{
|
|
58
|
+
...args,
|
|
59
|
+
ownerState,
|
|
60
|
+
size: adjustedSize,
|
|
61
|
+
disabled,
|
|
62
|
+
icon: `${host_static_assets}/${environment_assets}/${chevron_right}`
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}, [adjustedSize, disabled, environment_assets, host_static_assets, ownerState]);
|
|
66
|
+
const previousIconButton = useCallback((args) => {
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
IconButtonStyled,
|
|
69
|
+
{
|
|
70
|
+
...args,
|
|
71
|
+
ownerState,
|
|
72
|
+
size: adjustedSize,
|
|
73
|
+
disabled,
|
|
74
|
+
icon: `${host_static_assets}/${environment_assets}/${chevron_left}`
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}, [adjustedSize, disabled, environment_assets, host_static_assets, ownerState]);
|
|
78
|
+
const switchViewButton = useCallback((args) => {
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
IconButtonStyled,
|
|
81
|
+
{
|
|
82
|
+
...args,
|
|
83
|
+
ownerState,
|
|
84
|
+
size: adjustedSize,
|
|
85
|
+
disabled,
|
|
86
|
+
icon: `${host_static_assets}/${environment_assets}/${chevron_down}`
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}, [adjustedSize, disabled, environment_assets, host_static_assets, ownerState]);
|
|
90
|
+
const day = useCallback((args) => {
|
|
91
|
+
return /* @__PURE__ */ jsx(PickersDayStyled, { ...args, disableRipple: true, ownerState, ...getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.pickersDay, dataTestId) });
|
|
92
|
+
}, [ownerState]);
|
|
93
|
+
const mobilePaper = useCallback((args) => {
|
|
94
|
+
return /* @__PURE__ */ jsx(PaperStyled, { ...args, ownerState, ...getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.paper, dataTestId) });
|
|
95
|
+
}, [ownerState]);
|
|
96
|
+
const classes = getComponentClasses(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum);
|
|
97
|
+
const isSkeleton = useModuleSkeleton();
|
|
98
|
+
if (isSkeleton) {
|
|
99
|
+
return /* @__PURE__ */ jsx(SkeletonStyled, { ownerState, ...getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.skeleton, dataTestId) });
|
|
100
|
+
}
|
|
101
|
+
return isMobile ? /* @__PURE__ */ jsx(
|
|
102
|
+
MobileDateTimePickerRootStyled,
|
|
103
|
+
{
|
|
104
|
+
ownerState,
|
|
105
|
+
ampm,
|
|
106
|
+
disabled,
|
|
107
|
+
value,
|
|
108
|
+
onChange,
|
|
109
|
+
slots: {
|
|
110
|
+
calendarHeader,
|
|
111
|
+
nextIconButton,
|
|
112
|
+
previousIconButton,
|
|
113
|
+
switchViewButton,
|
|
114
|
+
day,
|
|
115
|
+
mobilePaper
|
|
116
|
+
},
|
|
117
|
+
slotProps: {
|
|
118
|
+
textField: {
|
|
119
|
+
className: clsx(className, classes.rootMobile),
|
|
120
|
+
"data-testid": getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.rootMobile, dataTestId)["data-testid"]
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
...others
|
|
124
|
+
}
|
|
125
|
+
) : /* @__PURE__ */ jsx(
|
|
126
|
+
DesktopDateTimePickerRootStyled,
|
|
127
|
+
{
|
|
128
|
+
ownerState,
|
|
129
|
+
ampm,
|
|
130
|
+
disabled,
|
|
131
|
+
value,
|
|
132
|
+
onChange,
|
|
133
|
+
slots: {
|
|
134
|
+
openPickerButton,
|
|
135
|
+
popper,
|
|
136
|
+
calendarHeader,
|
|
137
|
+
nextIconButton,
|
|
138
|
+
previousIconButton,
|
|
139
|
+
switchViewButton,
|
|
140
|
+
day
|
|
141
|
+
},
|
|
142
|
+
slotProps: {
|
|
143
|
+
textField: {
|
|
144
|
+
className: clsx(className, classes.rootDesktop),
|
|
145
|
+
"data-testid": getPropDataTestId(DATE_TIME_PICKER_KEY_COMPONENT, DateTimePickerEnum.rootDesktop, dataTestId)["data-testid"]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
...others
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
DateTimePicker as D
|
|
154
|
+
};
|