@m4l/components 9.1.77 → 9.1.79
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 +11 -2
- package/components/HelperError/HelperError.d.ts +1 -1
- package/components/HelperError/HelperError.js +16 -21
- package/components/HelperError/HelperError.styles.js +25 -15
- package/components/HelperError/constant.d.ts +0 -1
- package/components/HelperError/constant.js +0 -2
- package/components/HelperError/slots/HelperErrorSlots.js +2 -1
- package/components/HelperError/types.d.ts +6 -10
- package/components/Label/Label.js +1 -1
- package/components/Label/Label.styles.js +70 -13
- package/components/Label/types.d.ts +1 -0
- package/components/NumberInput/NumberInput.js +124 -0
- package/components/NumberInput/NumberInput.styles.js +199 -0
- package/components/NumberInput/constants.js +4 -0
- package/components/NumberInput/hooks/useNumberInput/NumberInputActions.js +12 -0
- package/components/NumberInput/hooks/useNumberInput/NumberInputReducer.js +106 -0
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +364 -0
- package/components/NumberInput/slots/NumberInputEnum.js +13 -0
- package/components/NumberInput/slots/NumberInputSlots.js +43 -0
- package/components/NumberInput/utils.js +23 -0
- package/components/PropertyValue/PropertyValue.d.ts +1 -1
- package/components/PropertyValue/PropertyValue.js +5 -17
- package/components/PropertyValue/PropertyValue.styles.js +6 -6
- package/components/hook-form/RHFCheckbox/RHFCheckBox.styles.d.ts +2 -0
- package/components/hook-form/RHFCheckbox/RHFCheckBox.styles.js +31 -0
- package/components/hook-form/RHFCheckbox/RHFCheckbox.d.ts +2 -2
- package/components/hook-form/RHFCheckbox/RHFCheckbox.js +57 -67
- package/components/hook-form/RHFCheckbox/constants.d.ts +2 -0
- package/components/hook-form/RHFCheckbox/constants.js +7 -0
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxEnum.d.ts +6 -0
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxEnum.js +10 -0
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +4 -0
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.js +28 -0
- package/components/hook-form/RHFCheckbox/slots/index.d.ts +2 -0
- package/components/hook-form/RHFCheckbox/types.d.ts +33 -5
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +89 -0
- package/components/hook-form/RHFNumberInput/RHFNumberInput.styles.js +16 -0
- package/components/hook-form/RHFNumberInput/constants.js +4 -0
- package/components/hook-form/RHFNumberInput/slots/RHFNumberInputEnum.js +7 -0
- package/components/hook-form/RHFNumberInput/slots/RHFNumberInputSlots.js +11 -0
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/index.js +1 -1
- package/components/mui_extended/CheckBox/CheckBox.d.ts +2 -2
- package/components/mui_extended/CheckBox/CheckBox.js +4 -3
- package/components/mui_extended/CheckBox/CheckBox.styles.js +64 -15
- package/components/mui_extended/CheckBox/types.d.ts +31 -6
- package/index.js +22 -20
- package/package.json +1 -1
- package/components/HelperError/HelperError.stories.d.ts +0 -13
- package/components/hook-form/RHFCheckbox/classes/index.d.ts +0 -12
- package/components/hook-form/RHFCheckbox/classes/index.js +0 -44
- package/components/hook-form/RHFCheckbox/classes/types.d.ts +0 -12
- package/components/hook-form/RHFCheckbox/styles.d.ts +0 -6
- package/components/hook-form/RHFCheckbox/styles.js +0 -24
- package/components/hook-form/RHFCheckbox/test/constants.d.ts +0 -4
- package/components/hook-form/RHFCheckbox/test/constants.js +0 -4
- package/components/hook-form/RHFCheckbox/test/utils.d.ts +0 -2
- package/components/hook-form/RHFCheckbox/test/utils.js +0 -7
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
|
|
3
|
+
import { n as numberInputStyles } from "../NumberInput.styles.js";
|
|
4
|
+
import { N as NUMBER_INPUT_KEY_COMPONENT } from "../constants.js";
|
|
5
|
+
import { N as NumberInputSlots } from "./NumberInputEnum.js";
|
|
6
|
+
import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
|
|
7
|
+
const RootStyled = styled("div", {
|
|
8
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
9
|
+
slot: NumberInputSlots.root
|
|
10
|
+
})(numberInputStyles?.root);
|
|
11
|
+
const InputStyled = styled("input", {
|
|
12
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
13
|
+
slot: NumberInputSlots.input
|
|
14
|
+
})(numberInputStyles?.input);
|
|
15
|
+
const ContainerButtonsStyled = styled("div", {
|
|
16
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
17
|
+
slot: NumberInputSlots.containerButtons
|
|
18
|
+
})(numberInputStyles?.containerButtons);
|
|
19
|
+
const ContainButtonsAdornmentStyled = styled("div", {
|
|
20
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
21
|
+
slot: NumberInputSlots.containButtonsAdornment
|
|
22
|
+
})(numberInputStyles?.ContainButtonsAdornment);
|
|
23
|
+
const IncrementButtonStyled = styled(IconButton, {
|
|
24
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
25
|
+
slot: NumberInputSlots.increment
|
|
26
|
+
})(numberInputStyles?.increment);
|
|
27
|
+
const DecrementButtonStyled = styled(IconButton, {
|
|
28
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
29
|
+
slot: NumberInputSlots.decrement
|
|
30
|
+
})(numberInputStyles?.decrement);
|
|
31
|
+
const SkeletonStyled = styled(Skeleton, {
|
|
32
|
+
name: NUMBER_INPUT_KEY_COMPONENT,
|
|
33
|
+
slot: NumberInputSlots.skeleton
|
|
34
|
+
})(numberInputStyles?.skeleton);
|
|
35
|
+
export {
|
|
36
|
+
ContainButtonsAdornmentStyled as C,
|
|
37
|
+
DecrementButtonStyled as D,
|
|
38
|
+
InputStyled as I,
|
|
39
|
+
RootStyled as R,
|
|
40
|
+
SkeletonStyled as S,
|
|
41
|
+
ContainerButtonsStyled as a,
|
|
42
|
+
IncrementButtonStyled as b
|
|
43
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clamp } from "@mui/utils";
|
|
2
|
+
function clampStepwise(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, stepProp = NaN, withDecimal = false) {
|
|
3
|
+
if (Number.isNaN(stepProp)) {
|
|
4
|
+
return clamp(val, min, max);
|
|
5
|
+
}
|
|
6
|
+
if (withDecimal) {
|
|
7
|
+
return clamp(val, min, max);
|
|
8
|
+
}
|
|
9
|
+
const step = stepProp || 1;
|
|
10
|
+
const remainder = val % step;
|
|
11
|
+
const positivity = Math.sign(remainder);
|
|
12
|
+
if (Math.abs(remainder) > step / 2) {
|
|
13
|
+
return clamp(val + positivity * (step - Math.abs(remainder)), min, max);
|
|
14
|
+
}
|
|
15
|
+
return clamp(val - positivity * Math.abs(remainder), min, max);
|
|
16
|
+
}
|
|
17
|
+
function isNumber(val) {
|
|
18
|
+
return typeof val === "number" && !Number.isNaN(val) && Number.isFinite(val);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
clampStepwise as c,
|
|
22
|
+
isNumber as i
|
|
23
|
+
};
|
|
@@ -3,7 +3,7 @@ import { PropertyValueProps } from './types';
|
|
|
3
3
|
* PropertyValue component is used to display a property and its value in a form or not.
|
|
4
4
|
* @author cesar - automatic
|
|
5
5
|
* @createdAt 2024-12-19 14:44:17 - automatic
|
|
6
|
-
* @updatedAt 2025-01-
|
|
6
|
+
* @updatedAt 2025-01-21 09:09:02 - automatic
|
|
7
7
|
* @updatedUser cesar - automatic
|
|
8
8
|
*/
|
|
9
9
|
export declare function PropertyValue(props: PropertyValueProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,8 +6,8 @@ import { g as getPropDataTestId, a as getNameDataTestId } from "../../test/getNa
|
|
|
6
6
|
import { P as PropertyValueRootStyled, a as PropertyStyled, V as ValueStyled } from "./slots/PropertyValueSlots.js";
|
|
7
7
|
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
8
8
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
9
|
+
import React from "react";
|
|
9
10
|
import { L as Label } from "../Label/Label.js";
|
|
10
|
-
import { T as TextField } from "../mui_extended/TextField/TextField.js";
|
|
11
11
|
import { T as Typography } from "../mui_extended/Typography/Typography.js";
|
|
12
12
|
import { I as Icon } from "../Icon/Icon.js";
|
|
13
13
|
function PropertyValue(props) {
|
|
@@ -47,23 +47,11 @@ function PropertyValue(props) {
|
|
|
47
47
|
return startAdornment;
|
|
48
48
|
};
|
|
49
49
|
const renderValue = () => {
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
TextField,
|
|
54
|
-
{
|
|
55
|
-
size: normalizedSize,
|
|
56
|
-
defaultValue: value,
|
|
57
|
-
disabled,
|
|
58
|
-
helperText: helperMessage,
|
|
59
|
-
fullWidth: true
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return value;
|
|
50
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
51
|
+
return /* @__PURE__ */ jsx(Typography, { size: normalizedSize, variant: "body", children: value });
|
|
64
52
|
}
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
53
|
+
if (React.isValidElement(value)) {
|
|
54
|
+
return React.cloneElement(value, { size: normalizedSize });
|
|
67
55
|
}
|
|
68
56
|
return value;
|
|
69
57
|
};
|
|
@@ -4,8 +4,8 @@ const propertyValueStyles = {
|
|
|
4
4
|
* Property Value Root Styles
|
|
5
5
|
* @author cesar - automatic
|
|
6
6
|
* @createdAt 2024-12-19 14:44:17 - automatic
|
|
7
|
-
* @updatedAt 2025-01-
|
|
8
|
-
* @updatedUser
|
|
7
|
+
* @updatedAt 2025-01-20 18:52:54 - automatic
|
|
8
|
+
* @updatedUser cesar - automatic
|
|
9
9
|
*/
|
|
10
10
|
Root: ({ theme, ownerState }) => {
|
|
11
11
|
const createSemanticStyle = (minWidth, maxWidth) => ({
|
|
@@ -67,8 +67,8 @@ const propertyValueStyles = {
|
|
|
67
67
|
* Property Styles
|
|
68
68
|
* @author cesar - automatic
|
|
69
69
|
* @createdAt 2024-12-26 11:44:46 - automatic
|
|
70
|
-
* @updatedAt 2025-01-
|
|
71
|
-
* @updatedUser
|
|
70
|
+
* @updatedAt 2025-01-20 18:52:54 - automatic
|
|
71
|
+
* @updatedUser cesar - automatic
|
|
72
72
|
*/
|
|
73
73
|
property: ({ theme, ownerState }) => ({
|
|
74
74
|
display: "flex",
|
|
@@ -82,8 +82,8 @@ const propertyValueStyles = {
|
|
|
82
82
|
* Value Styles (Form and No Form Combined)
|
|
83
83
|
* @author cesar - automatic
|
|
84
84
|
* @createdAt 2024-12-26 11:44:46 - automatic
|
|
85
|
-
* @updatedAt 2025-01-
|
|
86
|
-
* @updatedUser
|
|
85
|
+
* @updatedAt 2025-01-20 18:52:54 - automatic
|
|
86
|
+
* @updatedUser cesar - automatic
|
|
87
87
|
*/
|
|
88
88
|
value: ({ theme, ownerState }) => ({
|
|
89
89
|
width: "100%",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const rhfCheckBoxStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilo raíz del componente 🏠
|
|
4
|
+
* @param {object} theme - El tema de MUI.
|
|
5
|
+
* @returns {object} - Los estilos aplicados al root del componente.
|
|
6
|
+
*/
|
|
7
|
+
root: ({ theme }) => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
gap: theme.vars.size.baseSpacings["sp0-5"]
|
|
11
|
+
}),
|
|
12
|
+
/**
|
|
13
|
+
* Estilo del CheckBox ✅
|
|
14
|
+
*/
|
|
15
|
+
checkBox: {},
|
|
16
|
+
/**
|
|
17
|
+
* Estilo del Label de Checkbox 🏷️
|
|
18
|
+
* @returns {object} - Los estilos aplicados al Label del Checkbox.
|
|
19
|
+
*/
|
|
20
|
+
labelComponent: () => ({}),
|
|
21
|
+
/**
|
|
22
|
+
* Estilo del contenedor de Typography del CheckBox 📝
|
|
23
|
+
* @returns {object} - Los estilos aplicados al contenedor de Typography del CheckBox.
|
|
24
|
+
*/
|
|
25
|
+
containerCheckTypography: () => ({
|
|
26
|
+
"&.MuiSkeleton-root": {}
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
rhfCheckBoxStyles as r
|
|
31
|
+
};
|
|
@@ -5,6 +5,6 @@ import { RHFCheckboxProps } from './types';
|
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* El RHFCheckbox es un componente de checkbox que se integra con react-hook-form para manejar formularios en React. Proporciona características adicionales como validación, mensajes de ayuda, y soporte para un estado de esqueleto. Es útil para asegurar que los formularios sean manejados de manera eficiente y consistente, con una experiencia de usuario mejorada.
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare const RHFCheckbox: import('react').ForwardRefExoticComponent<Omit<RHFCheckboxProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,89 +1,79 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
2
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { R as RHFCheckboxRoot, C as ContainerCheckTypography } from "./
|
|
4
|
-
import { u as
|
|
5
|
-
import { g as getNameDataTestId } from "./test/utils.js";
|
|
6
|
-
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.js";
|
|
7
|
-
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
8
|
-
import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
|
|
9
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
10
|
-
import { C as CheckBox } from "../../mui_extended/CheckBox/CheckBox.js";
|
|
4
|
+
import { R as RHFCheckboxRoot, L as LabelComponent, C as ContainerCheckTypography, a as CheckBoxStyled } from "./slots/RHFCheckBoxSlots.js";
|
|
5
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
6
|
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
12
|
-
|
|
7
|
+
const RHFCheckbox = forwardRef(function RHFCheckbox2(props, ref) {
|
|
13
8
|
const {
|
|
14
9
|
name,
|
|
15
|
-
|
|
10
|
+
size = "medium",
|
|
16
11
|
label,
|
|
17
12
|
disabled = false,
|
|
18
13
|
mandatory,
|
|
14
|
+
id,
|
|
19
15
|
mandatoryMessage,
|
|
20
|
-
helperMessage
|
|
16
|
+
helperMessage,
|
|
17
|
+
inlineText,
|
|
18
|
+
helperText
|
|
21
19
|
} = props;
|
|
22
20
|
const {
|
|
23
21
|
control,
|
|
24
22
|
formState: { errors }
|
|
25
23
|
} = useFormContext();
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const isDesktop = useResponsiveDesktop();
|
|
24
|
+
const { currentSize } = useComponentSize(size);
|
|
25
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
29
26
|
const ownerState = {
|
|
30
|
-
isFocus: !isSkeleton ? isFocus : false,
|
|
31
|
-
isTabSelected: !isSkeleton ? isTabSelected : false,
|
|
32
|
-
sizeCheck: !isDesktop ? "medium" : sizeCheck,
|
|
33
27
|
disabled,
|
|
34
|
-
error: errors[name] ? true : false
|
|
28
|
+
error: errors[name] ? true : false,
|
|
29
|
+
name,
|
|
30
|
+
size: adjustedSize,
|
|
31
|
+
paletteColor: "default"
|
|
35
32
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
helperMessage,
|
|
73
|
-
htmlFor: name
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
error?.message && /* @__PURE__ */ jsx(HelperError, { message: error?.message + "" })
|
|
79
|
-
] });
|
|
33
|
+
const htmlForId = useId();
|
|
34
|
+
const hookId = useId();
|
|
35
|
+
const finalId = id || hookId;
|
|
36
|
+
return /* @__PURE__ */ jsx(RHFCheckboxRoot, { ownerState, children: /* @__PURE__ */ jsx(
|
|
37
|
+
Controller,
|
|
38
|
+
{
|
|
39
|
+
name,
|
|
40
|
+
control,
|
|
41
|
+
render: ({ field: { onChange, value }, fieldState: { error } }) => {
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
LabelComponent,
|
|
45
|
+
{
|
|
46
|
+
ownerState: { ...ownerState },
|
|
47
|
+
size: adjustedSize,
|
|
48
|
+
label: label || "",
|
|
49
|
+
mandatory,
|
|
50
|
+
mandatoryMessage,
|
|
51
|
+
helperMessage,
|
|
52
|
+
helperText
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(ContainerCheckTypography, { children: /* @__PURE__ */ jsx(
|
|
56
|
+
CheckBoxStyled,
|
|
57
|
+
{
|
|
58
|
+
ownerState: { ownerState, error: !!error },
|
|
59
|
+
size: adjustedSize,
|
|
60
|
+
onChange,
|
|
61
|
+
checked: value,
|
|
62
|
+
disabled: disabled ? true : false,
|
|
63
|
+
disableRipple: true,
|
|
64
|
+
inlineText,
|
|
65
|
+
htmlFor: finalId,
|
|
66
|
+
error: !!error,
|
|
67
|
+
id: htmlForId,
|
|
68
|
+
ref
|
|
80
69
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
70
|
+
) }),
|
|
71
|
+
error?.message && /* @__PURE__ */ jsx(HelperError, { htmlFor: htmlForId, size: adjustedSize, message: error?.message + "" })
|
|
72
|
+
] });
|
|
83
73
|
}
|
|
84
|
-
|
|
85
|
-
);
|
|
86
|
-
}
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
});
|
|
87
77
|
export {
|
|
88
78
|
RHFCheckbox as R
|
|
89
79
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { R as RHFCheckBoxSlots } from "./slots/RHFCheckBoxEnum.js";
|
|
3
|
+
const RHF_CHECKBOX_KEY_COMPONENT = "M4LRHFCheckbox";
|
|
4
|
+
getComponentClasses(RHF_CHECKBOX_KEY_COMPONENT, RHFCheckBoxSlots);
|
|
5
|
+
export {
|
|
6
|
+
RHF_CHECKBOX_KEY_COMPONENT as R
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var RHFCheckBoxSlots = /* @__PURE__ */ ((RHFCheckBoxSlots2) => {
|
|
2
|
+
RHFCheckBoxSlots2["root"] = "root";
|
|
3
|
+
RHFCheckBoxSlots2["checkBox"] = "checkBox";
|
|
4
|
+
RHFCheckBoxSlots2["containerCheckTypography"] = "containerCheckTypography";
|
|
5
|
+
RHFCheckBoxSlots2["labelComponent"] = "labelComponent";
|
|
6
|
+
return RHFCheckBoxSlots2;
|
|
7
|
+
})(RHFCheckBoxSlots || {});
|
|
8
|
+
export {
|
|
9
|
+
RHFCheckBoxSlots as R
|
|
10
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const RHFCheckboxRoot: 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 CheckBoxStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/CheckBox/types').CheckboxProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>, "children" | "value" | "title" | "component" | "size" | "name" | "error" | "id" | "action" | "hidden" | "color" | "content" | "style" | "icon" | "mandatory" | "disabled" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "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" | "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" | "onResize" | "onResizeCapture" | "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" | "form" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "checked" | "readOnly" | "required" | "htmlFor" | "skeletonWidth" | keyof import('react').RefAttributes<HTMLButtonElement> | "indeterminate" | "helperText" | "inputProps" | "inputRef" | "helperMessage" | "mandatoryMessage" | "checkedIcon" | "indeterminateIcon" | "inlineText"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
3
|
+
export declare const ContainerCheckTypography: 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>>, {}>;
|
|
4
|
+
export declare const LabelComponent: import('@emotion/styled').StyledComponent<Pick<import('../../../Label/types').LabelProps, keyof import('../../../Label/types').LabelProps> & 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 rhfCheckBoxStyles } from "../RHFCheckBox.styles.js";
|
|
3
|
+
import { R as RHFCheckBoxSlots } from "./RHFCheckBoxEnum.js";
|
|
4
|
+
import { R as RHF_CHECKBOX_KEY_COMPONENT } from "../constants.js";
|
|
5
|
+
import { C as CheckBox } from "../../../mui_extended/CheckBox/CheckBox.js";
|
|
6
|
+
import { L as Label } from "../../../Label/Label.js";
|
|
7
|
+
const RHFCheckboxRoot = styled("div", {
|
|
8
|
+
name: RHF_CHECKBOX_KEY_COMPONENT,
|
|
9
|
+
slot: RHFCheckBoxSlots.root
|
|
10
|
+
})(rhfCheckBoxStyles?.root);
|
|
11
|
+
const CheckBoxStyled = styled(CheckBox, {
|
|
12
|
+
name: RHF_CHECKBOX_KEY_COMPONENT,
|
|
13
|
+
slot: RHFCheckBoxSlots.checkBox
|
|
14
|
+
})(rhfCheckBoxStyles?.checkBox);
|
|
15
|
+
const ContainerCheckTypography = styled("div", {
|
|
16
|
+
name: RHF_CHECKBOX_KEY_COMPONENT,
|
|
17
|
+
slot: RHFCheckBoxSlots.containerCheckTypography
|
|
18
|
+
})(rhfCheckBoxStyles?.containerCheckTypography);
|
|
19
|
+
const LabelComponent = styled(Label, {
|
|
20
|
+
name: RHF_CHECKBOX_KEY_COMPONENT,
|
|
21
|
+
slot: RHFCheckBoxSlots.labelComponent
|
|
22
|
+
})(rhfCheckBoxStyles?.labelComponent);
|
|
23
|
+
export {
|
|
24
|
+
ContainerCheckTypography as C,
|
|
25
|
+
LabelComponent as L,
|
|
26
|
+
RHFCheckboxRoot as R,
|
|
27
|
+
CheckBoxStyled as a
|
|
28
|
+
};
|
|
@@ -1,16 +1,44 @@
|
|
|
1
1
|
import { FormControlLabelProps } from '@mui/material';
|
|
2
2
|
import { LabelProps } from '../../Label/types';
|
|
3
|
+
import { ComponentPalletColor } from '@m4l/styles';
|
|
4
|
+
import { RHFCheckBoxSlots } from './slots';
|
|
5
|
+
import { Theme } from '@mui/material/styles';
|
|
6
|
+
import { RHF_CHECKBOX_KEY_COMPONENT } from './constants';
|
|
7
|
+
import { M4LOverridesStyleRules } from '../../../@types/augmentations';
|
|
8
|
+
/** Propiedades del componente RHFCheckbox. */
|
|
3
9
|
export interface RHFCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'>, Omit<LabelProps, 'label'> {
|
|
10
|
+
/** El nombre del campo de formulario. */
|
|
4
11
|
name: string;
|
|
12
|
+
/** El tamaño del CheckBox. */
|
|
5
13
|
sizeCheck?: 'small' | 'medium';
|
|
14
|
+
/** La etiqueta de texto principal del componente. */
|
|
6
15
|
label?: string;
|
|
16
|
+
/** Indica si hay un error en el campo asociado al CheckBox. */
|
|
17
|
+
error?: boolean;
|
|
18
|
+
/** El texto que se muestra en línea con el CheckBox. */
|
|
19
|
+
inlineText?: string;
|
|
20
|
+
/** El tamaño del CheckBox. */
|
|
21
|
+
size?: 'small' | 'medium';
|
|
22
|
+
/** Texto de ayuda adicional. */
|
|
23
|
+
helperText?: string;
|
|
7
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Propiedades del componente RHFMultiCheckbox.
|
|
27
|
+
*/
|
|
8
28
|
export interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, 'control' | 'label'> {
|
|
9
29
|
name: string;
|
|
10
30
|
options: string[];
|
|
11
31
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
32
|
+
export type RHFCheckBoxOwnerState = RHFCheckboxProps & {
|
|
33
|
+
paletteColor: ComponentPalletColor;
|
|
34
|
+
error?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Tipos de slots del RHFCheckBox.
|
|
39
|
+
*/
|
|
40
|
+
export type RHFCheckBoxSlotsType = keyof typeof RHFCheckBoxSlots;
|
|
41
|
+
/**
|
|
42
|
+
* Estilos del RHFCheckBox.
|
|
43
|
+
*/
|
|
44
|
+
export type RHFCheckBoxStyles = M4LOverridesStyleRules<RHFCheckBoxSlotsType, typeof RHF_CHECKBOX_KEY_COMPONENT, Theme>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
+
import useId from "@mui/material/utils/useId";
|
|
4
|
+
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
5
|
+
import { L as Label } from "../../Label/Label.js";
|
|
6
|
+
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
7
|
+
import { N as NumberInput } from "../../NumberInput/NumberInput.js";
|
|
8
|
+
import { R as RHFNumberInputSlots } from "./slots/RHFNumberInputEnum.js";
|
|
9
|
+
import { R as RHF_NUMBER_INPUT_KEY_COMPONENT } from "./constants.js";
|
|
10
|
+
import { R as RootStyled } from "./slots/RHFNumberInputSlots.js";
|
|
11
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
12
|
+
const RHFNumberInput = (props) => {
|
|
13
|
+
const {
|
|
14
|
+
name,
|
|
15
|
+
max,
|
|
16
|
+
min,
|
|
17
|
+
step,
|
|
18
|
+
disabled,
|
|
19
|
+
size = "medium",
|
|
20
|
+
variant = "outlined",
|
|
21
|
+
label,
|
|
22
|
+
mandatory,
|
|
23
|
+
mandatoryMessage,
|
|
24
|
+
helperMessage,
|
|
25
|
+
startAdornment,
|
|
26
|
+
endAdornment,
|
|
27
|
+
...others
|
|
28
|
+
} = props;
|
|
29
|
+
const { control } = useFormContext();
|
|
30
|
+
const { currentSize } = useComponentSize(size);
|
|
31
|
+
const ownerState = {
|
|
32
|
+
iconSize: currentSize
|
|
33
|
+
};
|
|
34
|
+
const htmlForId = useId();
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
RootStyled,
|
|
37
|
+
{
|
|
38
|
+
ownerState: { ...ownerState },
|
|
39
|
+
...getPropDataTestId(RHF_NUMBER_INPUT_KEY_COMPONENT, RHFNumberInputSlots.root),
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
Controller,
|
|
42
|
+
{
|
|
43
|
+
name,
|
|
44
|
+
control,
|
|
45
|
+
render: ({ field: { value, onChange }, fieldState: { error } }) => {
|
|
46
|
+
const onChangeLocal = (_event, newValue) => {
|
|
47
|
+
onChange(newValue);
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
label && /* @__PURE__ */ jsx(
|
|
51
|
+
Label,
|
|
52
|
+
{
|
|
53
|
+
htmlFor: htmlForId,
|
|
54
|
+
label,
|
|
55
|
+
mandatory,
|
|
56
|
+
mandatoryMessage,
|
|
57
|
+
helperMessage,
|
|
58
|
+
size
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
NumberInput,
|
|
63
|
+
{
|
|
64
|
+
id: htmlForId,
|
|
65
|
+
size,
|
|
66
|
+
step,
|
|
67
|
+
max,
|
|
68
|
+
min,
|
|
69
|
+
value,
|
|
70
|
+
onChange: onChangeLocal,
|
|
71
|
+
variant,
|
|
72
|
+
disabled,
|
|
73
|
+
startAdornment,
|
|
74
|
+
endAdornment,
|
|
75
|
+
error: !!error,
|
|
76
|
+
...others
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
error?.message && /* @__PURE__ */ jsx(HelperError, { htmlFor: htmlForId, size, message: error.message })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
RHFNumberInput as R
|
|
89
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const rhfNumberInputStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilos para el slot `root`.
|
|
4
|
+
*
|
|
5
|
+
* Se utiliza para aplicar estilos personalizados al contenedor principal
|
|
6
|
+
* del componente `RHFInputNumberSpinner`.
|
|
7
|
+
*/
|
|
8
|
+
root: ({ theme }) => ({
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
rhfNumberInputStyles as r
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
import { R as RHF_NUMBER_INPUT_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { r as rhfNumberInputStyles } from "../RHFNumberInput.styles.js";
|
|
4
|
+
import { R as RHFNumberInputSlots } from "./RHFNumberInputEnum.js";
|
|
5
|
+
const RootStyled = styled("div", {
|
|
6
|
+
name: RHF_NUMBER_INPUT_KEY_COMPONENT,
|
|
7
|
+
slot: RHFNumberInputSlots.root
|
|
8
|
+
})(rhfNumberInputStyles?.root);
|
|
9
|
+
export {
|
|
10
|
+
RootStyled as R
|
|
11
|
+
};
|
|
@@ -17,4 +17,4 @@ export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pic
|
|
|
17
17
|
* Elemento HelperError construido a través de styled,
|
|
18
18
|
* sirve para mostrar el mensaje de error del componente `RHFSelect`
|
|
19
19
|
*/
|
|
20
|
-
export declare const HelperErrorStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../HelperError').HelperErrorProps
|
|
20
|
+
export declare const HelperErrorStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../HelperError').HelperErrorProps & import('react').RefAttributes<HTMLLabelElement>, keyof import('../../../HelperError').HelperErrorProps | keyof import('react').RefAttributes<HTMLLabelElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|