@m4l/components 9.1.50 → 9.1.51
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/components/hook-form/RHFPeriod/RHFPeriod.d.ts +9 -0
- package/components/hook-form/RHFPeriod/{index.js → RHFPeriod.js} +21 -15
- package/components/hook-form/RHFPeriod/RHFPeriod.styles.d.ts +2 -0
- package/components/hook-form/RHFPeriod/RHFPeriod.styles.js +61 -0
- package/components/hook-form/RHFPeriod/constants.d.ts +1 -0
- package/components/hook-form/RHFPeriod/constants.js +4 -0
- package/components/hook-form/RHFPeriod/index.d.ts +6 -5
- package/components/hook-form/RHFPeriod/slots/RHFPeriodEnum.d.ts +6 -0
- package/components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js +10 -0
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +4 -0
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js +28 -0
- package/components/hook-form/RHFPeriod/slots/index.d.ts +2 -0
- package/components/hook-form/RHFPeriod/slots/index.js +1 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.d.ts +9 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +86 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/dictionary.d.ts +7 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/dictionary.js +8 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/types.d.ts +33 -0
- package/components/hook-form/RHFPeriod/subcomponents/Period/types.js +9 -0
- package/components/hook-form/RHFPeriod/tests/RHFPeriod.test.d.ts +1 -0
- package/components/hook-form/RHFPeriod/types.d.ts +15 -5
- package/components/hook-form/index.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +155 -0
- package/components/mui_extended/Select/Select.styles.js +321 -0
- package/components/mui_extended/Select/constants.js +4 -0
- package/components/mui_extended/Select/index.js +1 -0
- package/components/mui_extended/Select/slots/SelectEnum.js +15 -0
- package/components/mui_extended/Select/slots/SelectSlots.js +50 -0
- package/components/mui_extended/Select/types.js +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/components/hook-form/RHFPeriod/classes/constants.d.ts +0 -1
- package/components/hook-form/RHFPeriod/classes/constants.js +0 -4
- package/components/hook-form/RHFPeriod/classes/index.d.ts +0 -10
- package/components/hook-form/RHFPeriod/classes/index.js +0 -25
- package/components/hook-form/RHFPeriod/classes/types.d.ts +0 -8
- package/components/hook-form/RHFPeriod/styles.d.ts +0 -1
- package/components/hook-form/RHFPeriod/styles.js +0 -13
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RHFPeriodProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente que renderiza un campo de formulario para ingresar un período.
|
|
4
|
+
* @author cesar - automatic
|
|
5
|
+
* @createdAt 2024-12-27 15:03:02 - automatic
|
|
6
|
+
* @updatedAt 2024-12-31 11:03:05 - automatic
|
|
7
|
+
* @updatedUser cesar - automatic
|
|
8
|
+
*/
|
|
9
|
+
export declare const RHFPeriod: (props: RHFPeriodProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { R as RHFPeriodRoot } from "./styles.js";
|
|
3
2
|
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
-
import { R as RHFPeriodUtilityClasses } from "./classes/index.js";
|
|
5
3
|
import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
|
|
6
4
|
import { useModuleSkeleton } from "@m4l/core";
|
|
7
5
|
import { L as Label } from "../../Label/Label.js";
|
|
8
|
-
import {
|
|
6
|
+
import { R as RHFPeriodRootStyled } from "./slots/RHFPeriodSlots.js";
|
|
7
|
+
import { P as Period } from "./subcomponents/Period/Period.js";
|
|
8
|
+
import { R as RHF_PERIOD_KEY_COMPONENT } from "./constants.js";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
11
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
12
|
+
import { R as RHFPeriodSlots } from "./slots/RHFPeriodEnum.js";
|
|
9
13
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
10
14
|
const RHFPeriod = (props) => {
|
|
11
15
|
const {
|
|
12
16
|
name,
|
|
13
17
|
readOnly,
|
|
14
|
-
skeletonWidth,
|
|
15
|
-
skeletonHeight,
|
|
16
|
-
state,
|
|
17
18
|
label,
|
|
18
19
|
mandatory,
|
|
19
20
|
mandatoryMessage,
|
|
20
21
|
helperMessage,
|
|
21
|
-
|
|
22
|
+
disabled,
|
|
23
|
+
size = "medium",
|
|
24
|
+
dataTestId,
|
|
25
|
+
className
|
|
22
26
|
} = props;
|
|
23
27
|
const { control } = useFormContext();
|
|
24
28
|
const isSkeleton = useModuleSkeleton();
|
|
@@ -27,14 +31,17 @@ const RHFPeriod = (props) => {
|
|
|
27
31
|
isFocus: !isSkeleton ? isFocus : false,
|
|
28
32
|
isTabSelected: !isSkeleton ? isTabSelected : false
|
|
29
33
|
};
|
|
30
|
-
const classes = RHFPeriodUtilityClasses(ownerState);
|
|
31
34
|
return /* @__PURE__ */ jsx(
|
|
32
|
-
|
|
35
|
+
RHFPeriodRootStyled,
|
|
33
36
|
{
|
|
34
|
-
className:
|
|
37
|
+
className: clsx(getComponentSlotRoot(RHF_PERIOD_KEY_COMPONENT), className),
|
|
38
|
+
...getPropDataTestId(RHF_PERIOD_KEY_COMPONENT, RHFPeriodSlots.root, dataTestId),
|
|
39
|
+
role: "rhf-period",
|
|
40
|
+
ownerState,
|
|
35
41
|
onFocus: handlerFocus,
|
|
36
42
|
onBlur: handlerOnBlur,
|
|
37
43
|
onKeyUp: handlerOnKeyUp,
|
|
44
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
38
45
|
children: /* @__PURE__ */ jsx(
|
|
39
46
|
Controller,
|
|
40
47
|
{
|
|
@@ -45,7 +52,7 @@ const RHFPeriod = (props) => {
|
|
|
45
52
|
label && /* @__PURE__ */ jsx(
|
|
46
53
|
Label,
|
|
47
54
|
{
|
|
48
|
-
|
|
55
|
+
size,
|
|
49
56
|
label,
|
|
50
57
|
mandatory,
|
|
51
58
|
mandatoryMessage,
|
|
@@ -55,13 +62,12 @@ const RHFPeriod = (props) => {
|
|
|
55
62
|
/* @__PURE__ */ jsx(
|
|
56
63
|
Period,
|
|
57
64
|
{
|
|
65
|
+
disabled,
|
|
58
66
|
value,
|
|
59
67
|
onChange,
|
|
60
|
-
|
|
68
|
+
size,
|
|
61
69
|
readOnly,
|
|
62
|
-
|
|
63
|
-
skeletonHeight,
|
|
64
|
-
size
|
|
70
|
+
error: !!error
|
|
65
71
|
}
|
|
66
72
|
),
|
|
67
73
|
error && /* @__PURE__ */ jsx(HelperError, { message: error.message || "" })
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const rhfPeriodStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* root class
|
|
4
|
+
* @updatedUser cesar - automatic
|
|
5
|
+
* @updatedAt 2025-01-03 14:54:18 - automatic
|
|
6
|
+
* @createdAt 2024-12-27 16:45:26 - automatic
|
|
7
|
+
* @author cesar - automatic
|
|
8
|
+
* @author cesar - automatic
|
|
9
|
+
* @createdAt 2024-11-21 08:55:01 - automatic
|
|
10
|
+
* @updatedAt 2025-01-03 14:54:18 - automatic
|
|
11
|
+
* @updatedUser cesar - automatic
|
|
12
|
+
*/
|
|
13
|
+
root: ({ theme }) => ({
|
|
14
|
+
width: "270px",
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
alignItems: "flex-start",
|
|
19
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
20
|
+
}),
|
|
21
|
+
/**
|
|
22
|
+
* periodRoot class
|
|
23
|
+
* @author cesar - automatic
|
|
24
|
+
* @createdAt 2024-12-30 07:34:10 - automatic
|
|
25
|
+
* @updatedAt 2025-01-03 14:54:18 - automatic
|
|
26
|
+
* @updatedUser cesar - automatic
|
|
27
|
+
*/
|
|
28
|
+
periodRoot: ({ theme }) => ({
|
|
29
|
+
width: "100%",
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
34
|
+
}),
|
|
35
|
+
/**
|
|
36
|
+
* textField class
|
|
37
|
+
* @author cesar - automatic
|
|
38
|
+
* @createdAt 2024-12-30 07:34:10 - automatic
|
|
39
|
+
* @updatedAt 2025-01-03 14:54:18 - automatic
|
|
40
|
+
* @updatedUser cesar - automatic
|
|
41
|
+
*/
|
|
42
|
+
textField: ({ theme }) => ({
|
|
43
|
+
borderRadius: "50px",
|
|
44
|
+
width: "43px !important",
|
|
45
|
+
border: theme.vars.palette.border.default,
|
|
46
|
+
color: theme.vars.palette.text.disabled
|
|
47
|
+
}),
|
|
48
|
+
/**
|
|
49
|
+
* select class
|
|
50
|
+
* @author cesar - automatic
|
|
51
|
+
* @createdAt 2024-12-30 16:21:22 - automatic
|
|
52
|
+
* @updatedAt 2025-01-03 14:54:18 - automatic
|
|
53
|
+
* @updatedUser cesar - automatic
|
|
54
|
+
*/
|
|
55
|
+
select: () => ({
|
|
56
|
+
width: "100px"
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
rhfPeriodStyles as r
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RHF_PERIOD_KEY_COMPONENT = "M4LRHFPeriod";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
export
|
|
1
|
+
export * from './RHFPeriod.styles';
|
|
2
|
+
export * from './RHFPeriod';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './slots/RHFPeriodEnum';
|
|
5
|
+
export * from './slots/RHFPeriodSlots';
|
|
6
|
+
export * from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var RHFPeriodSlots = /* @__PURE__ */ ((RHFPeriodSlots2) => {
|
|
2
|
+
RHFPeriodSlots2["root"] = "root";
|
|
3
|
+
RHFPeriodSlots2["periodRoot"] = "periodRoot";
|
|
4
|
+
RHFPeriodSlots2["textField"] = "textField";
|
|
5
|
+
RHFPeriodSlots2["select"] = "select";
|
|
6
|
+
return RHFPeriodSlots2;
|
|
7
|
+
})(RHFPeriodSlots || {});
|
|
8
|
+
export {
|
|
9
|
+
RHFPeriodSlots as R
|
|
10
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const RHFPeriodRootStyled: 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').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
2
|
+
export declare const PeriodRootStyled: 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').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
3
|
+
export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/TextField/types').TextFieldProps, keyof import('../../../mui_extended/TextField/types').TextFieldProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
4
|
+
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Select').SelectProps, keyof import('../../../mui_extended/Select').SelectProps> & 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 { R as RHF_PERIOD_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { r as rhfPeriodStyles } from "../RHFPeriod.styles.js";
|
|
4
|
+
import { R as RHFPeriodSlots } from "./RHFPeriodEnum.js";
|
|
5
|
+
import { T as TextField } from "../../../mui_extended/TextField/TextField.js";
|
|
6
|
+
import { S as Select } from "../../../mui_extended/Select/Select.js";
|
|
7
|
+
const RHFPeriodRootStyled = styled("div", {
|
|
8
|
+
name: RHF_PERIOD_KEY_COMPONENT,
|
|
9
|
+
slot: RHFPeriodSlots.root
|
|
10
|
+
})(rhfPeriodStyles?.root);
|
|
11
|
+
const PeriodRootStyled = styled("div", {
|
|
12
|
+
name: RHF_PERIOD_KEY_COMPONENT,
|
|
13
|
+
slot: RHFPeriodSlots.periodRoot
|
|
14
|
+
})(rhfPeriodStyles?.periodRoot);
|
|
15
|
+
const TextFieldStyled = styled(TextField, {
|
|
16
|
+
name: RHF_PERIOD_KEY_COMPONENT,
|
|
17
|
+
slot: RHFPeriodSlots.textField
|
|
18
|
+
})(rhfPeriodStyles?.textField);
|
|
19
|
+
const SelectStyled = styled(Select, {
|
|
20
|
+
name: RHF_PERIOD_KEY_COMPONENT,
|
|
21
|
+
slot: RHFPeriodSlots.select
|
|
22
|
+
})(rhfPeriodStyles?.select);
|
|
23
|
+
export {
|
|
24
|
+
PeriodRootStyled as P,
|
|
25
|
+
RHFPeriodRootStyled as R,
|
|
26
|
+
SelectStyled as S,
|
|
27
|
+
TextFieldStyled as T
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PeriodProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente que renderiza un campo de formulario para ingresar un período.
|
|
4
|
+
* @author cesar - automatic
|
|
5
|
+
* @createdAt 2024-12-30 16:32:50 - automatic
|
|
6
|
+
* @updatedAt 2025-01-03 08:17:13 - automatic
|
|
7
|
+
* @updatedUser cesar - automatic
|
|
8
|
+
*/
|
|
9
|
+
export declare const Period: ({ value: valuePeriod, onChange, size, disabled, error }: PeriodProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
3
|
+
import { E as ETimePeriods } from "./types.js";
|
|
4
|
+
import { d as dictionary } from "./dictionary.js";
|
|
5
|
+
import { useMemo, useCallback } from "react";
|
|
6
|
+
import { u as useComponentSize } from "../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
+
import { P as PeriodRootStyled, S as SelectStyled, T as TextFieldStyled } from "../../slots/RHFPeriodSlots.js";
|
|
8
|
+
import { I as Icon } from "../../../../Icon/Icon.js";
|
|
9
|
+
const normalizePeriod = (period) => {
|
|
10
|
+
const defaultPeriodTime = { id: ETimePeriods.YEARS, label: "" };
|
|
11
|
+
return {
|
|
12
|
+
selPeriodTime: period?.selPeriodTime ?? defaultPeriodTime,
|
|
13
|
+
singleValue: period?.singleValue ?? ""
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const Period = ({ value: valuePeriod, onChange, size, disabled, error }) => {
|
|
17
|
+
const { getLabel } = useModuleDictionary();
|
|
18
|
+
const { currentSize } = useComponentSize(size);
|
|
19
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
20
|
+
const normalizedSize = currentSize === "large" ? "medium" : currentSize;
|
|
21
|
+
const { selPeriodTime, singleValue } = normalizePeriod(valuePeriod);
|
|
22
|
+
const options = useMemo(
|
|
23
|
+
() => [
|
|
24
|
+
{ id: ETimePeriods.YEARS.toString(), label: getLabel(dictionary.LABEL_YEARS) },
|
|
25
|
+
{ id: ETimePeriods.MONTHS.toString(), label: getLabel(dictionary.LABEL_MONTHS) },
|
|
26
|
+
{ id: ETimePeriods.DAYS.toString(), label: getLabel(dictionary.LABEL_DAYS) }
|
|
27
|
+
],
|
|
28
|
+
[getLabel]
|
|
29
|
+
);
|
|
30
|
+
const handlePeriodChange = useCallback(
|
|
31
|
+
(newPeriodTime, newValue) => {
|
|
32
|
+
onChange({ selPeriodTime: newPeriodTime, singleValue: newValue });
|
|
33
|
+
},
|
|
34
|
+
[onChange]
|
|
35
|
+
);
|
|
36
|
+
const ownerState = {
|
|
37
|
+
size: normalizedSize,
|
|
38
|
+
disabled,
|
|
39
|
+
isValid: !error
|
|
40
|
+
};
|
|
41
|
+
const handleKeyDown = useCallback((e) => {
|
|
42
|
+
const validKeys = /^[0-9]$/;
|
|
43
|
+
if (!validKeys.test(e.key) && e.key !== "Backspace" && e.key !== "Delete" && e.key !== "Tab") {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
return /* @__PURE__ */ jsxs(PeriodRootStyled, { ownerState, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Icon,
|
|
50
|
+
{
|
|
51
|
+
size: normalizedSize,
|
|
52
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`,
|
|
53
|
+
disabled
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
SelectStyled,
|
|
58
|
+
{
|
|
59
|
+
value: selPeriodTime.id,
|
|
60
|
+
options,
|
|
61
|
+
onChange: (selectedOption) => handlePeriodChange(selectedOption, singleValue),
|
|
62
|
+
disabled,
|
|
63
|
+
size: normalizedSize,
|
|
64
|
+
error,
|
|
65
|
+
variant: "outlined"
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
TextFieldStyled,
|
|
70
|
+
{
|
|
71
|
+
type: "number",
|
|
72
|
+
variant: "outlined",
|
|
73
|
+
value: singleValue,
|
|
74
|
+
InputProps: { disableUnderline: true },
|
|
75
|
+
error,
|
|
76
|
+
size: normalizedSize,
|
|
77
|
+
onChange: (e) => handlePeriodChange(selPeriodTime, e.target.value === "" ? "" : parseInt(e.target.value, 10)),
|
|
78
|
+
onKeyDown: handleKeyDown,
|
|
79
|
+
disabled
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
Period as P
|
|
86
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
export declare enum ETimePeriods {
|
|
3
|
+
YEARS = 0,
|
|
4
|
+
MONTHS = 1,
|
|
5
|
+
DAYS = 2
|
|
6
|
+
}
|
|
7
|
+
export type PeriodTime = {
|
|
8
|
+
id: number | string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
export type SKTWrapperProps = Pick<PeriodProps, 'readOnly'>;
|
|
12
|
+
export type PeriodType = {
|
|
13
|
+
selPeriodTime: PeriodTime;
|
|
14
|
+
singleValue: number | '';
|
|
15
|
+
};
|
|
16
|
+
export interface PeriodProps {
|
|
17
|
+
value: PeriodType;
|
|
18
|
+
onChange: (newValue: PeriodType) => void;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
size: Sizes;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
isValid?: boolean;
|
|
23
|
+
error?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface WrapperProps {
|
|
26
|
+
error: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface PeriodOwnerState extends Pick<PeriodProps, 'disabled'> {
|
|
29
|
+
focus?: boolean;
|
|
30
|
+
isValid?: boolean;
|
|
31
|
+
size: Sizes;
|
|
32
|
+
error?: boolean;
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var ETimePeriods = /* @__PURE__ */ ((ETimePeriods2) => {
|
|
2
|
+
ETimePeriods2[ETimePeriods2["YEARS"] = 0] = "YEARS";
|
|
3
|
+
ETimePeriods2[ETimePeriods2["MONTHS"] = 1] = "MONTHS";
|
|
4
|
+
ETimePeriods2[ETimePeriods2["DAYS"] = 2] = "DAYS";
|
|
5
|
+
return ETimePeriods2;
|
|
6
|
+
})(ETimePeriods || {});
|
|
7
|
+
export {
|
|
8
|
+
ETimePeriods as E
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { LabelProps } from '../../Label/types';
|
|
2
|
-
import { PeriodProps
|
|
3
|
-
|
|
2
|
+
import { PeriodProps } from '../RHFPeriod/subcomponents/Period/types';
|
|
3
|
+
import { RHFPeriodSlots } from './slots/RHFPeriodEnum';
|
|
4
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
5
|
+
import { Theme } from '@mui/material';
|
|
6
|
+
import { RHF_PERIOD_KEY_COMPONENT } from './constants';
|
|
7
|
+
export type RHFPeriodType = keyof typeof RHFPeriodSlots;
|
|
8
|
+
export interface RHFPeriodProps extends Pick<PeriodProps, 'readOnly'>, Omit<LabelProps, 'label'> {
|
|
9
|
+
size?: 'small' | 'medium';
|
|
4
10
|
name: string;
|
|
5
|
-
variant?: PeriodVariant;
|
|
6
|
-
state?: PeriodState;
|
|
7
11
|
label?: string;
|
|
12
|
+
dataTestId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Clase CSS adicional para aplicar estilos personalizados al componente.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
8
17
|
}
|
|
9
|
-
export interface
|
|
18
|
+
export interface RHFPeriodOwnerState {
|
|
10
19
|
isFocus: boolean;
|
|
11
20
|
isTabSelected: boolean;
|
|
12
21
|
}
|
|
22
|
+
export type RHFPeriodStyles = OverridesStyleRules<RHFPeriodType, typeof RHF_PERIOD_KEY_COMPONENT, Theme>;
|
|
@@ -10,7 +10,7 @@ export { RHFSelect } from './RHFSelect';
|
|
|
10
10
|
export { RHFHelperError } from './RHFHelperError';
|
|
11
11
|
export * from './RHFTextField';
|
|
12
12
|
export * from './RHFTextFieldPassword';
|
|
13
|
-
export { RHFPeriod } from './RHFPeriod';
|
|
13
|
+
export { RHFPeriod } from './RHFPeriod/RHFPeriod';
|
|
14
14
|
export { getPeriodComponetsDictionary } from '../Period/dictionary';
|
|
15
15
|
export { RHFRadioGroup } from './RHFRadioGroup';
|
|
16
16
|
export * from './RHFUpload';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEnvironment, useModuleSkeleton, useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { useTheme } from "@mui/material";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { useState, useMemo } from "react";
|
|
6
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
7
|
+
import { I as Icon } from "../../Icon/Icon.js";
|
|
8
|
+
import { S as SkeletonSelectStyled, a as SelectRootStyled, L as LabelPlaceholerStyled, R as RenderOptionContainerStyled, b as LabelOptionStyled, M as MenuItemSelectStyled, I as IconButtonStyled } from "./slots/SelectSlots.js";
|
|
9
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
10
|
+
const Select = (props) => {
|
|
11
|
+
const {
|
|
12
|
+
value,
|
|
13
|
+
options = [],
|
|
14
|
+
onChange,
|
|
15
|
+
size = "medium",
|
|
16
|
+
disabled = false,
|
|
17
|
+
error = false,
|
|
18
|
+
color = "default",
|
|
19
|
+
variant = "outlined",
|
|
20
|
+
placeholder = "Selecciona una opcion",
|
|
21
|
+
className
|
|
22
|
+
} = props;
|
|
23
|
+
const { currentSize } = useComponentSize(size);
|
|
24
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
25
|
+
const isSkeleton = useModuleSkeleton();
|
|
26
|
+
const { getLabel } = useModuleDictionary();
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
29
|
+
const [selectedValue, setSelectedValue] = useState(value || "");
|
|
30
|
+
const paletteColor = getPropertyByString(
|
|
31
|
+
theme.vars.palette,
|
|
32
|
+
disabled ? "default" : error ? "error" : color,
|
|
33
|
+
theme.vars.palette.default
|
|
34
|
+
);
|
|
35
|
+
const ownerState = {
|
|
36
|
+
size: adjustedSize,
|
|
37
|
+
disabled,
|
|
38
|
+
error,
|
|
39
|
+
variant,
|
|
40
|
+
paletteColor,
|
|
41
|
+
color
|
|
42
|
+
};
|
|
43
|
+
const optionsMap = useMemo(
|
|
44
|
+
() => new Map(options.map((opt) => [opt.id.toString(), opt])),
|
|
45
|
+
[options]
|
|
46
|
+
);
|
|
47
|
+
const handleChange = (event) => {
|
|
48
|
+
const newValue = event.target.value;
|
|
49
|
+
setSelectedValue(newValue);
|
|
50
|
+
const selectedOption = optionsMap.get(newValue);
|
|
51
|
+
if (selectedOption) {
|
|
52
|
+
onChange?.(selectedOption);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const isOptionEqualToValueLocal = (optionId, currentValue) => optionId === currentValue;
|
|
56
|
+
const ArrowDropDownIcon = `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/chevron_down.svg`;
|
|
57
|
+
const arrowIcon = () => /* @__PURE__ */ jsx(
|
|
58
|
+
IconButtonStyled,
|
|
59
|
+
{
|
|
60
|
+
ownerState: { ...ownerState },
|
|
61
|
+
src: ArrowDropDownIcon,
|
|
62
|
+
disabled,
|
|
63
|
+
size: adjustedSize
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
if (isSkeleton) {
|
|
67
|
+
return /* @__PURE__ */ jsx(SkeletonSelectStyled, { ownerState: { ...ownerState } });
|
|
68
|
+
}
|
|
69
|
+
const classSelect = getComponentSlotRoot("M4LSelectClass");
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
SelectRootStyled,
|
|
72
|
+
{
|
|
73
|
+
className: clsx(classSelect, className),
|
|
74
|
+
ownerState: { ...ownerState },
|
|
75
|
+
value: selectedValue,
|
|
76
|
+
onChange: handleChange,
|
|
77
|
+
IconComponent: arrowIcon,
|
|
78
|
+
fullWidth: true,
|
|
79
|
+
disabled,
|
|
80
|
+
error,
|
|
81
|
+
renderValue: (selected) => {
|
|
82
|
+
if (!selected || selected === "" || !optionsMap.has(selected)) {
|
|
83
|
+
return /* @__PURE__ */ jsx(LabelPlaceholerStyled, { size, ownerState: {}, children: placeholder });
|
|
84
|
+
}
|
|
85
|
+
const selectedOption = optionsMap.get(selected);
|
|
86
|
+
return /* @__PURE__ */ jsxs(RenderOptionContainerStyled, { size, ownerState: { ...ownerState }, children: [
|
|
87
|
+
selectedOption?.startAdornment && /* @__PURE__ */ jsx(Icon, { size, src: selectedOption.startAdornment }),
|
|
88
|
+
/* @__PURE__ */ jsx(LabelOptionStyled, { size, ownerState: { ...ownerState }, children: selectedOption?.label || placeholder })
|
|
89
|
+
] });
|
|
90
|
+
},
|
|
91
|
+
MenuProps: {
|
|
92
|
+
disableAutoFocusItem: true,
|
|
93
|
+
MenuListProps: {
|
|
94
|
+
onMouseMove: (event) => {
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Handles the key down event for the menu.
|
|
100
|
+
* @param {React.KeyboardEvent} event - The key down event.
|
|
101
|
+
* @author SebastianM - automatic
|
|
102
|
+
* @createdAt 2024-12-23 10:47:53 - automatic
|
|
103
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
104
|
+
* @updatedUser Andrés Quintero - automatic
|
|
105
|
+
*/
|
|
106
|
+
onKeyDown: (event) => {
|
|
107
|
+
const char = event.key.toLowerCase();
|
|
108
|
+
const matchingOption = options.find(
|
|
109
|
+
(option) => option.label.toLowerCase().startsWith(char)
|
|
110
|
+
);
|
|
111
|
+
if (matchingOption) {
|
|
112
|
+
const element = document.querySelector(
|
|
113
|
+
`[data-value='${matchingOption.id}']`
|
|
114
|
+
);
|
|
115
|
+
element?.scrollIntoView({ block: "nearest" });
|
|
116
|
+
setSelectedValue(matchingOption.id.toString());
|
|
117
|
+
const selectedOption = optionsMap.get(matchingOption.id.toString());
|
|
118
|
+
if (selectedOption) {
|
|
119
|
+
onChange?.(selectedOption);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
children: options.length > 0 ? options.map((option) => /* @__PURE__ */ jsx(
|
|
125
|
+
MenuItemSelectStyled,
|
|
126
|
+
{
|
|
127
|
+
ownerState: { ...ownerState },
|
|
128
|
+
size,
|
|
129
|
+
value: option.id.toString(),
|
|
130
|
+
disabled,
|
|
131
|
+
label: option.label,
|
|
132
|
+
selected: isOptionEqualToValueLocal(
|
|
133
|
+
option.id,
|
|
134
|
+
selectedValue
|
|
135
|
+
),
|
|
136
|
+
startIcon: option.startAdornment,
|
|
137
|
+
endIcon: option.endAdornment,
|
|
138
|
+
"data-value": option.id
|
|
139
|
+
},
|
|
140
|
+
option.id
|
|
141
|
+
)) : /* @__PURE__ */ jsx(
|
|
142
|
+
MenuItemSelectStyled,
|
|
143
|
+
{
|
|
144
|
+
ownerState: { ...ownerState },
|
|
145
|
+
selected: false,
|
|
146
|
+
size,
|
|
147
|
+
label: getLabel("select.no_options")
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
export {
|
|
154
|
+
Select as S
|
|
155
|
+
};
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
const selectStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilos para el componente Select
|
|
4
|
+
* @author Bruce Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-22 10:30:26 - automatic
|
|
6
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
7
|
+
* @updatedUser Andrés Quintero - automatic
|
|
8
|
+
*/
|
|
9
|
+
selectRoot: ({ theme, ownerState }) => ({
|
|
10
|
+
width: "100%",
|
|
11
|
+
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
12
|
+
...ownerState.error === true && {
|
|
13
|
+
"&.M4LSelectClass-root": {
|
|
14
|
+
borderColor: ownerState.paletteColor?.main
|
|
15
|
+
},
|
|
16
|
+
"&:hover fieldset": {
|
|
17
|
+
backgroundColor: theme.vars.palette.error.hoverOpacity,
|
|
18
|
+
borderColor: ownerState.paletteColor?.main
|
|
19
|
+
},
|
|
20
|
+
...ownerState.variant === "text" && {
|
|
21
|
+
"&.M4LSelectClass-root": {
|
|
22
|
+
borderColor: ownerState.paletteColor?.main
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
26
|
+
border: `${theme.vars.size.borderStroke.actionInput} ${ownerState.paletteColor?.main}`
|
|
27
|
+
},
|
|
28
|
+
"& .MuiIconButton-root": {
|
|
29
|
+
"& .M4LIconClass-root": {
|
|
30
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"& > .MuiPaper-root": {
|
|
35
|
+
padding: theme.vars.size.baseSpacings.sp2
|
|
36
|
+
},
|
|
37
|
+
"&:hover fieldset": {
|
|
38
|
+
backgroundColor: theme.vars.palette.primary.hoverOpacity,
|
|
39
|
+
borderColor: theme.vars.palette.border.default + "!important",
|
|
40
|
+
...ownerState.error === true && {
|
|
41
|
+
backgroundColor: theme.vars.palette.error.hoverOpacity,
|
|
42
|
+
borderColor: theme.vars.palette.error.main + "!important"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"&.M4LSelectClass-root": {
|
|
46
|
+
display: "flex",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "flex-start",
|
|
49
|
+
padding: theme.vars.size.baseSpacings.sp1,
|
|
50
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
51
|
+
"&:active": {
|
|
52
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
53
|
+
borderTop: "transparent",
|
|
54
|
+
borderLeft: "transparent",
|
|
55
|
+
borderRight: "transparent"
|
|
56
|
+
},
|
|
57
|
+
"&.Mui-focused": {
|
|
58
|
+
"& .MuiIconButton-root": {
|
|
59
|
+
"& .M4LIconClass-root": {
|
|
60
|
+
backgroundColor: theme.vars.palette.primary.main,
|
|
61
|
+
...ownerState.error === true && {
|
|
62
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"&.Mui-focused": {
|
|
69
|
+
"&.Mui-focused": {
|
|
70
|
+
"& .MuiIconButton-root": {
|
|
71
|
+
"& .M4LIconClass-root": {
|
|
72
|
+
backgroundColor: theme.vars.palette.primary.main,
|
|
73
|
+
...ownerState.error === true && {
|
|
74
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
75
|
+
},
|
|
76
|
+
transform: "rotate(180deg)",
|
|
77
|
+
transition: "transform 0.3s ease"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
83
|
+
border: `${theme.vars.size.borderStroke.actionInput} ${theme.vars.palette.primary.main}`,
|
|
84
|
+
...ownerState.error === true && {
|
|
85
|
+
borderColor: ownerState.paletteColor?.main + "!important"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
...ownerState.variant === "text" && {
|
|
90
|
+
"&.M4LSelectClass-root": {
|
|
91
|
+
border: "none",
|
|
92
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
93
|
+
borderBottom: `${theme.vars.size.borderStroke.actionInput} ${theme.vars.palette.border.default}`,
|
|
94
|
+
padding: theme.vars.size.baseSpacings.sp1,
|
|
95
|
+
...ownerState.error === true && {
|
|
96
|
+
borderColor: ownerState.paletteColor?.main,
|
|
97
|
+
"& .MuiIconButton-root": {
|
|
98
|
+
"& .M4LIconClass-root": {
|
|
99
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"&:active": {
|
|
104
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
105
|
+
borderTop: "transparent",
|
|
106
|
+
borderLeft: "transparent",
|
|
107
|
+
borderRight: "transparent"
|
|
108
|
+
},
|
|
109
|
+
"&.Mui-focused": {
|
|
110
|
+
"& .MuiIconButton-root": {
|
|
111
|
+
"& .M4LIconClass-root": {
|
|
112
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"&.Mui-focused": {
|
|
118
|
+
borderColor: theme.vars.palette.primary.main,
|
|
119
|
+
...ownerState.error === true && {
|
|
120
|
+
borderColor: ownerState.paletteColor?.main + "!important"
|
|
121
|
+
},
|
|
122
|
+
"&.Mui-focused": {
|
|
123
|
+
"& .MuiIconButton-root": {
|
|
124
|
+
"& .M4LIconClass-root": {
|
|
125
|
+
backgroundColor: theme.vars.palette.primary.main,
|
|
126
|
+
...ownerState.error === true && {
|
|
127
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
128
|
+
},
|
|
129
|
+
transform: "rotate(180deg)",
|
|
130
|
+
transition: "transform 0.3s ease"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"&:focus-active": {
|
|
136
|
+
borderTop: "transparent",
|
|
137
|
+
borderLeft: "transparent",
|
|
138
|
+
borderRight: "transparent"
|
|
139
|
+
},
|
|
140
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
141
|
+
border: "none"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
145
|
+
minHeight: 0,
|
|
146
|
+
borderLeft: "transparent",
|
|
147
|
+
borderTop: "transparent",
|
|
148
|
+
borderRight: "transparent",
|
|
149
|
+
border: theme.vars.palette.primary.main,
|
|
150
|
+
...ownerState.error === true && {
|
|
151
|
+
borderColor: ownerState.paletteColor?.main
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
// Estilos específicos para el tamaño small
|
|
156
|
+
...ownerState.size === "small" && {
|
|
157
|
+
...theme.generalSettings.isMobile ? {
|
|
158
|
+
height: theme.vars.size.mobile.small.action,
|
|
159
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
160
|
+
} : {
|
|
161
|
+
height: theme.vars.size.desktop.small.action,
|
|
162
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
// Estilos específicos para el tamaño medium
|
|
166
|
+
...ownerState.size === "medium" && {
|
|
167
|
+
...theme.generalSettings.isMobile ? {
|
|
168
|
+
height: theme.vars.size.mobile.medium.action,
|
|
169
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
170
|
+
} : {
|
|
171
|
+
height: theme.vars.size.desktop.medium.action,
|
|
172
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"& .MuiSelect-select": {
|
|
176
|
+
display: "flex",
|
|
177
|
+
alignItems: "center",
|
|
178
|
+
justifyContent: "flex-start",
|
|
179
|
+
padding: theme.vars.size.baseSpacings.sp0,
|
|
180
|
+
"&::placeholder": {
|
|
181
|
+
color: theme.vars.palette.text.disabled
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
...ownerState.disabled === true && {
|
|
185
|
+
borderColor: theme.vars.palette.border.disabled,
|
|
186
|
+
color: theme.vars.palette.text.disabled,
|
|
187
|
+
pointerEvents: "none"
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
/**
|
|
191
|
+
* Estilos para el ícono de la fila
|
|
192
|
+
* @author Bruce Escobar - automatic
|
|
193
|
+
* @createdAt 2024-10-22 10:30:26 - automatic
|
|
194
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
195
|
+
* @updatedUser Andrés Quintero - automatic
|
|
196
|
+
*/
|
|
197
|
+
iconButton: ({ theme }) => ({
|
|
198
|
+
position: "absolute",
|
|
199
|
+
right: theme.vars.size.baseSpacings.sp0,
|
|
200
|
+
top: "50%",
|
|
201
|
+
transform: "translateY(-50%)",
|
|
202
|
+
pointerEvents: "none"
|
|
203
|
+
}),
|
|
204
|
+
/**
|
|
205
|
+
* Styles for the render option container
|
|
206
|
+
* @returns {object} The styles for the render option container
|
|
207
|
+
* @author SebastianM - automatic
|
|
208
|
+
* @createdAt 2024-12-18 15:11:13 - automatic
|
|
209
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
210
|
+
* @updatedUser Andrés Quintero - automatic
|
|
211
|
+
*/
|
|
212
|
+
renderOptionContainer: ({ theme, ownerState }) => ({
|
|
213
|
+
display: "flex",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
color: theme.vars.palette.text.primary,
|
|
216
|
+
"& .M4LIconClass-root": {
|
|
217
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
218
|
+
},
|
|
219
|
+
...ownerState.error && {
|
|
220
|
+
"& .M4LIconClass-root": {
|
|
221
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"&:focus": {
|
|
225
|
+
"& .M4LIconClass-root": {
|
|
226
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
...ownerState.disabled && {
|
|
230
|
+
"& .M4LIconClass-root": {
|
|
231
|
+
backgroundColor: theme.vars.palette.text.disabled
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}),
|
|
235
|
+
/**
|
|
236
|
+
* Styles for the label option
|
|
237
|
+
* @author SebastianM - automatic
|
|
238
|
+
* @createdAt 2024-12-23 10:47:53 - automatic
|
|
239
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
240
|
+
* @updatedUser Andrés Quintero - automatic
|
|
241
|
+
*/
|
|
242
|
+
labelOption: ({ theme }) => ({
|
|
243
|
+
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
244
|
+
paddingRight: theme.vars.size.baseSpacings.sp3
|
|
245
|
+
}),
|
|
246
|
+
/**
|
|
247
|
+
* Styles for the label placeholder
|
|
248
|
+
* @returns {object} The styles for the label placeholder
|
|
249
|
+
* @author SebastianM - automatic
|
|
250
|
+
* @createdAt 2024-12-26 14:16:33 - automatic
|
|
251
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
252
|
+
* @updatedUser Andrés Quintero - automatic
|
|
253
|
+
*/
|
|
254
|
+
labelPlaceholer: ({ theme }) => ({
|
|
255
|
+
color: theme.vars.palette.text.disabled,
|
|
256
|
+
zIndex: 100
|
|
257
|
+
}),
|
|
258
|
+
/**
|
|
259
|
+
* Styles for the menu options
|
|
260
|
+
* @param {object} theme - The theme object
|
|
261
|
+
* @returns {object} The styles for the menu options
|
|
262
|
+
* @author SebastianM - automatic
|
|
263
|
+
* @createdAt 2024-12-18 15:11:13 - automatic
|
|
264
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
265
|
+
* @updatedUser Andrés Quintero - automatic
|
|
266
|
+
*/
|
|
267
|
+
menuOptions: ({ theme }) => ({
|
|
268
|
+
padding: theme.vars.size.baseSpacings.sp2,
|
|
269
|
+
boxShadow: theme.vars.shadows[1]
|
|
270
|
+
}),
|
|
271
|
+
/**
|
|
272
|
+
* Styles for the menu item select
|
|
273
|
+
* @param {object} theme - The theme object
|
|
274
|
+
* @returns {object} The styles for the menu item select
|
|
275
|
+
* @author SebastianM - automatic
|
|
276
|
+
* @createdAt 2024-12-26 14:16:33 - automatic
|
|
277
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
278
|
+
* @updatedUser Andrés Quintero - automatic
|
|
279
|
+
*/
|
|
280
|
+
menuItemSelect: ({ theme }) => ({
|
|
281
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
282
|
+
paddingRight: theme.vars.size.baseSpacings.sp2
|
|
283
|
+
}),
|
|
284
|
+
/**
|
|
285
|
+
* Styles for the skeleton select component
|
|
286
|
+
* @author SebastianM - automatic
|
|
287
|
+
* @createdAt 2024-12-17 15:54:22 - automatic
|
|
288
|
+
* @updatedAt 2024-12-31 11:23:53 - automatic
|
|
289
|
+
* @updatedUser Andrés Quintero - automatic
|
|
290
|
+
*/
|
|
291
|
+
skeletonSelect: ({ theme, ownerState }) => ({
|
|
292
|
+
width: "100%",
|
|
293
|
+
borderRadius: theme.vars.size.borderRadius.r0,
|
|
294
|
+
display: "flex",
|
|
295
|
+
alignItems: "center",
|
|
296
|
+
background: theme.vars.palette.skeleton.transition,
|
|
297
|
+
// Estilos específicos para el tamaño small
|
|
298
|
+
...ownerState.size === "small" && {
|
|
299
|
+
...theme.generalSettings.isMobile ? {
|
|
300
|
+
height: theme.vars.size.mobile.small.action,
|
|
301
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
302
|
+
} : {
|
|
303
|
+
height: theme.vars.size.desktop.small.action,
|
|
304
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
// Estilos específicos para el tamaño medium
|
|
308
|
+
...ownerState.size === "medium" && {
|
|
309
|
+
...theme.generalSettings.isMobile ? {
|
|
310
|
+
height: theme.vars.size.mobile.medium.action,
|
|
311
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
312
|
+
} : {
|
|
313
|
+
height: theme.vars.size.desktop.medium.action,
|
|
314
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
})
|
|
318
|
+
};
|
|
319
|
+
export {
|
|
320
|
+
selectStyles as s
|
|
321
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var SelectSlots = /* @__PURE__ */ ((SelectSlots2) => {
|
|
2
|
+
SelectSlots2["selectRoot"] = "selectRoot";
|
|
3
|
+
SelectSlots2["iconButton"] = "iconButton";
|
|
4
|
+
SelectSlots2["menuItemSelect"] = "menuItemSelect";
|
|
5
|
+
SelectSlots2["skeletonSelect"] = "skeletonMenuItem";
|
|
6
|
+
SelectSlots2["renderOptionContainer"] = "renderOptionContainer";
|
|
7
|
+
SelectSlots2["labelOption"] = "labelOption";
|
|
8
|
+
SelectSlots2["labelPlaceholer"] = "labelPlaceholer";
|
|
9
|
+
SelectSlots2["menuOptions"] = "menuOptions";
|
|
10
|
+
SelectSlots2["menu"] = "menu";
|
|
11
|
+
return SelectSlots2;
|
|
12
|
+
})(SelectSlots || {});
|
|
13
|
+
export {
|
|
14
|
+
SelectSlots as S
|
|
15
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Select } from "@mui/material";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { S as SELECT_KEY_COMPONENT } from "../constants.js";
|
|
4
|
+
import { s as selectStyles } from "../Select.styles.js";
|
|
5
|
+
import { S as SelectSlots } from "./SelectEnum.js";
|
|
6
|
+
import { I as IconButton } from "../../IconButton/IconButton.js";
|
|
7
|
+
import { M as MenuItem } from "../../MenuItem/MenuItem.js";
|
|
8
|
+
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
9
|
+
import { T as Typography } from "../../Typography/Typography.js";
|
|
10
|
+
const SelectRootStyled = styled(Select, {
|
|
11
|
+
name: SELECT_KEY_COMPONENT,
|
|
12
|
+
slot: SelectSlots.selectRoot
|
|
13
|
+
})(selectStyles?.selectRoot);
|
|
14
|
+
const IconButtonStyled = styled(IconButton, {
|
|
15
|
+
name: SELECT_KEY_COMPONENT,
|
|
16
|
+
slot: SelectSlots.iconButton
|
|
17
|
+
})(selectStyles?.iconButton);
|
|
18
|
+
const MenuItemSelectStyled = styled(MenuItem, {
|
|
19
|
+
name: SELECT_KEY_COMPONENT,
|
|
20
|
+
slot: SelectSlots.menuItemSelect
|
|
21
|
+
})(selectStyles?.menuItemSelect);
|
|
22
|
+
const SkeletonSelectStyled = styled(Skeleton, {
|
|
23
|
+
name: SELECT_KEY_COMPONENT,
|
|
24
|
+
slot: SelectSlots.skeletonSelect
|
|
25
|
+
})(selectStyles?.skeletonSelect);
|
|
26
|
+
const RenderOptionContainerStyled = styled("div", {
|
|
27
|
+
name: SELECT_KEY_COMPONENT,
|
|
28
|
+
slot: SelectSlots.renderOptionContainer
|
|
29
|
+
})(selectStyles?.renderOptionContainer);
|
|
30
|
+
styled("div", {
|
|
31
|
+
name: SELECT_KEY_COMPONENT,
|
|
32
|
+
slot: SelectSlots.menuOptions
|
|
33
|
+
})(selectStyles?.menuOptions);
|
|
34
|
+
const LabelOptionStyled = styled(Typography, {
|
|
35
|
+
name: SELECT_KEY_COMPONENT,
|
|
36
|
+
slot: SelectSlots.labelOption
|
|
37
|
+
})(selectStyles?.labelOption);
|
|
38
|
+
const LabelPlaceholerStyled = styled(Typography, {
|
|
39
|
+
name: SELECT_KEY_COMPONENT,
|
|
40
|
+
slot: SelectSlots.labelPlaceholer
|
|
41
|
+
})(selectStyles?.labelPlaceholer);
|
|
42
|
+
export {
|
|
43
|
+
IconButtonStyled as I,
|
|
44
|
+
LabelPlaceholerStyled as L,
|
|
45
|
+
MenuItemSelectStyled as M,
|
|
46
|
+
RenderOptionContainerStyled as R,
|
|
47
|
+
SkeletonSelectStyled as S,
|
|
48
|
+
SelectRootStyled as a,
|
|
49
|
+
LabelOptionStyled as b
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import { R as R3 } from "./components/hook-form/RHFDateTime/RHFDateTime.js";
|
|
|
33
33
|
import { R as R4 } from "./components/hook-form/RHFMultiCheckbox/index.js";
|
|
34
34
|
import { R as R5 } from "./components/hook-form/RHFSelect.js";
|
|
35
35
|
import { R as R6 } from "./components/hook-form/RHFHelperError/index.js";
|
|
36
|
-
import { R as R7 } from "./components/hook-form/RHFPeriod/
|
|
36
|
+
import { R as R7 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
|
|
37
37
|
import { g as g6 } from "./components/Period/dictionary.js";
|
|
38
38
|
import { R as R8 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
|
|
39
39
|
import { R as R9 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const componentName = "M4LRHFPeriod";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { RHFPeriodClassesType } from './types';
|
|
2
|
-
import { OwnerState } from '../types';
|
|
3
|
-
export declare const RHFPeriodClasses: RHFPeriodClassesType;
|
|
4
|
-
export declare function getRHFPeriodUtilityClass(slot: string): string;
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Documentar
|
|
7
|
-
*/
|
|
8
|
-
export declare const RHFPeriodUtilityClasses: (ownerState: OwnerState) => {
|
|
9
|
-
root: string;
|
|
10
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
2
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
3
|
-
import { c as componentName } from "./constants.js";
|
|
4
|
-
generateUtilityClasses(componentName, [
|
|
5
|
-
/* elements */
|
|
6
|
-
"root",
|
|
7
|
-
/* states or variants of elements */
|
|
8
|
-
"isFocus",
|
|
9
|
-
"isTabSelected"
|
|
10
|
-
]);
|
|
11
|
-
function getRHFPeriodUtilityClass(slot) {
|
|
12
|
-
return generateUtilityClass(componentName, slot);
|
|
13
|
-
}
|
|
14
|
-
const RHFPeriodUtilityClasses = (ownerState) => {
|
|
15
|
-
const slots = {
|
|
16
|
-
root: ["root", ownerState.isFocus && "isFocus", ownerState.isTabSelected && "isTabSelected"]
|
|
17
|
-
};
|
|
18
|
-
const composedClasses = unstable_composeClasses(slots, getRHFPeriodUtilityClass, {});
|
|
19
|
-
return {
|
|
20
|
-
...composedClasses
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
RHFPeriodUtilityClasses as R
|
|
25
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RHFPeriodUtilityClasses } from '.';
|
|
2
|
-
export interface RHFPeriodClassesType {
|
|
3
|
-
root: string;
|
|
4
|
-
isFocus: string;
|
|
5
|
-
isTabSelected: string;
|
|
6
|
-
}
|
|
7
|
-
export type RHFPeriodClassesKey = keyof RHFPeriodClassesType;
|
|
8
|
-
export type Classes = ReturnType<typeof RHFPeriodUtilityClasses>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RHFPeriodRoot: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
-
const RHFPeriodRoot = styled("div")(({ theme }) => ({
|
|
3
|
-
width: "100%",
|
|
4
|
-
display: "flex",
|
|
5
|
-
flexDirection: "column",
|
|
6
|
-
justifyContent: "center",
|
|
7
|
-
alignItems: "flex-start",
|
|
8
|
-
gap: theme.spacing(1),
|
|
9
|
-
...theme.components?.M4LRHFPeriod?.styleOverrides || {}
|
|
10
|
-
}));
|
|
11
|
-
export {
|
|
12
|
-
RHFPeriodRoot as R
|
|
13
|
-
};
|