@m4l/components 9.1.76 → 9.1.78
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/DataGrid/formatters/ColumnUncertaintyFormatter/index.js +1 -1
- 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 +62 -19
- package/components/Label/types.d.ts +1 -0
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.d.ts +53 -0
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.js +54 -0
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.styles.d.ts +2 -0
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.styles.js +11 -0
- package/components/formatters/UncertaintyFormatter/constants.d.ts +1 -0
- package/components/formatters/UncertaintyFormatter/constants.js +4 -0
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterEnum.d.ts +3 -0
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterEnum.js +7 -0
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.d.ts +1 -0
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.js +12 -0
- package/components/formatters/UncertaintyFormatter/tests/UncertaintyFormatter.test.d.ts +1 -0
- package/components/formatters/UncertaintyFormatter/types.d.ts +45 -1
- package/components/formatters/index.d.ts +1 -1
- 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/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- 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 +1 -1
- package/package.json +1 -1
- package/components/HelperError/HelperError.stories.d.ts +0 -13
- package/components/formatters/UncertaintyFormatter/index.d.ts +0 -9
- package/components/formatters/UncertaintyFormatter/index.js +0 -29
- 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
package/@types/types.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ import { PropagateLoaderSpinnerOwnerState, PropagateLoaderSpinnerType } from '..
|
|
|
142
142
|
import { LinearProgressIndeterminateOwnerState, LinearProgressIndeterminateType } from '../components/LinearProgressIndeterminate/types';
|
|
143
143
|
import { MenuDividerOwnerState, MenuDividerSlotsType } from '../components/mui_extended/MenuDivider/types';
|
|
144
144
|
import { RHFSelectSlotsType, RHFSelectOwnerState } from '../components/hook-form/RHFSelect/types';
|
|
145
|
+
import { RHFCheckBoxOwnerState, RHFCheckBoxSlotsType } from '../components/hook-form/RHFCheckbox/types';
|
|
145
146
|
|
|
146
147
|
declare module '@mui/material/styles' {
|
|
147
148
|
// Define the slots in the theme
|
|
@@ -191,6 +192,7 @@ declare module '@mui/material/styles' {
|
|
|
191
192
|
M4LToggleButton: ToggleButtonSlotsType;
|
|
192
193
|
M4LBooleanFormatter: PresentationType;
|
|
193
194
|
M4LToggleIconButton: ToggleIconButtonSlotsType;
|
|
195
|
+
M4LRHFCheckBox: RHFCheckBoxSlotsType;
|
|
194
196
|
M4LTabs: TabsSlotsType;
|
|
195
197
|
RHFM4LAutocomplete: RHFAutocompleteSlotsType;
|
|
196
198
|
M4LAccountPopover: AccountPopoverSlotsType;
|
|
@@ -247,6 +249,7 @@ declare module '@mui/material/styles' {
|
|
|
247
249
|
M4LToggleButton: Partial<ToggleButtonOwnerState>;
|
|
248
250
|
M4LBooleanFormatter: Partial<BooleanFormatterOwnerState>;
|
|
249
251
|
M4LToggleIconButton: Partial<ToggleIconButtonOwnerState>;
|
|
252
|
+
M4LRHFCheckBox: Partial<RHFCheckBoxOwnerState>;
|
|
250
253
|
M4LTabs: Partial<TabsOwnerState>;
|
|
251
254
|
RHFM4LAutocomplete: Partial<RHFAutocompleteOwnerState>;
|
|
252
255
|
M4LAccountPopover: Partial<AccountPopoverOwnerState>;
|
|
@@ -481,6 +484,11 @@ declare module '@mui/material/styles' {
|
|
|
481
484
|
styleOverrides?: ComponentsOverrides<Theme>['M4LPropertyValue'];
|
|
482
485
|
variants?: ComponentsVariants['M4LPropertyValue'];
|
|
483
486
|
};
|
|
487
|
+
M4LRHFCheckBox?: {
|
|
488
|
+
defaultProps?: ComponentsPropsList['M4LRHFCheckBox'];
|
|
489
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LRHFCheckBox'];
|
|
490
|
+
variants?: ComponentsVariants['M4LRHFCheckBox'];
|
|
491
|
+
};
|
|
484
492
|
M4LTabs?: {
|
|
485
493
|
defaultProps?: ComponentsPropsList['M4LTabs'];
|
|
486
494
|
styleOverrides?: ComponentsOverrides<Theme>['M4LTabs'];
|
|
@@ -525,11 +533,12 @@ declare module '@mui/material/styles' {
|
|
|
525
533
|
defaultProps?: ComponentsPropsList['M4LMenuDivider'];
|
|
526
534
|
styleOverrides?: ComponentsOverrides<Theme>['M4LMenuDivider'];
|
|
527
535
|
variants?: ComponentsVariants['M4LMenuDivider'];
|
|
528
|
-
|
|
536
|
+
};
|
|
537
|
+
|
|
529
538
|
M4LRHFSelect?: {
|
|
530
539
|
defaultProps?: ComponentsPropsList['M4LRHFSelect'];
|
|
531
540
|
styleOverrides?: ComponentsOverrides<Theme>['M4LRHFSelect'];
|
|
532
541
|
variants?: ComponentsVariants['M4LRHFSelect'];
|
|
533
542
|
};
|
|
534
|
-
|
|
543
|
+
}
|
|
535
544
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { U as UncertaintyFormatter } from "../../../formatters/UncertaintyFormatter/
|
|
2
|
+
import { U as UncertaintyFormatter } from "../../../formatters/UncertaintyFormatter/UncertaintyFormatter.js";
|
|
3
3
|
function ColumnUncertaintyFormatter(props) {
|
|
4
4
|
return (obProps) => {
|
|
5
5
|
return /* @__PURE__ */ jsx(UncertaintyFormatter, { obProps, ...props });
|
|
@@ -10,4 +10,4 @@ import { HelperErrorProps } from './types';
|
|
|
10
10
|
* @updatedAt 2025-01-08 10:36:40 - automatic
|
|
11
11
|
* @updatedUser Andrés Quintero - automatic
|
|
12
12
|
*/
|
|
13
|
-
export declare const HelperError: (
|
|
13
|
+
export declare const HelperError: import('react').ForwardRefExoticComponent<HelperErrorProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
|
-
import { H as HELPER_ERROR_KEY_COMPONENT, c as classHelperErrorRoot
|
|
5
|
+
import { H as HELPER_ERROR_KEY_COMPONENT, c as classHelperErrorRoot } from "./constant.js";
|
|
6
6
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
-
import { T as TypographyStyled } from "./slots/HelperErrorSlots.js";
|
|
8
|
-
const HelperError = (props)
|
|
9
|
-
const { message = "",
|
|
7
|
+
import { T as TypographyStyled, S as SkeletonStyled } from "./slots/HelperErrorSlots.js";
|
|
8
|
+
const HelperError = forwardRef(function HelperError2(props, ref) {
|
|
9
|
+
const { message = "", size = "medium", className, ...other } = props;
|
|
10
|
+
const isSkeleton = useModuleSkeleton();
|
|
10
11
|
const { currentSize } = useComponentSize(size);
|
|
11
12
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const paletteColor = getPropertyByString(
|
|
14
|
-
theme.palette,
|
|
15
|
-
"error",
|
|
16
|
-
theme.palette.default
|
|
17
|
-
);
|
|
18
13
|
const ownerState = {
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
size,
|
|
15
|
+
color: "error"
|
|
21
16
|
};
|
|
22
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !isSkeleton ? /* @__PURE__ */ jsx(
|
|
23
18
|
TypographyStyled,
|
|
24
19
|
{
|
|
20
|
+
ref,
|
|
25
21
|
"aria-errormessage": HELPER_ERROR_KEY_COMPONENT,
|
|
26
|
-
className: clsx(classHelperErrorRoot,
|
|
27
|
-
ownerState: { ...ownerState
|
|
22
|
+
className: clsx(classHelperErrorRoot, className),
|
|
23
|
+
ownerState: { ...ownerState },
|
|
28
24
|
size: adjustedSize,
|
|
29
25
|
variant: "body",
|
|
30
|
-
skeletonWidth,
|
|
31
26
|
component: "label",
|
|
32
27
|
...other,
|
|
33
28
|
children: message
|
|
34
29
|
}
|
|
35
|
-
);
|
|
36
|
-
};
|
|
30
|
+
) : /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...ownerState }, variant: "text" }) });
|
|
31
|
+
});
|
|
37
32
|
export {
|
|
38
33
|
HelperError as H
|
|
39
34
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
|
|
2
2
|
const helperErrorStyles = {
|
|
3
3
|
/**
|
|
4
4
|
* Estilos para el slot del root HelperError
|
|
@@ -8,13 +8,19 @@ const helperErrorStyles = {
|
|
|
8
8
|
* @updatedUser Andrés Quintero - automatic
|
|
9
9
|
*/
|
|
10
10
|
root: ({ theme, ownerState }) => ({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
"&.MuiTypography-root": {
|
|
12
|
+
"&.M4lclassCssSpecificity": {
|
|
13
|
+
color: theme.vars.palette.error.enabled,
|
|
14
|
+
...getTypographyStyles(
|
|
15
|
+
theme.generalSettings.isMobile,
|
|
16
|
+
ownerState.size || "medium",
|
|
17
|
+
"body"
|
|
18
|
+
),
|
|
19
|
+
...getTypographyStyles(
|
|
20
|
+
theme.generalSettings.isMobile,
|
|
21
|
+
ownerState.size || "small",
|
|
22
|
+
"body"
|
|
23
|
+
)
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
}),
|
|
@@ -26,13 +32,17 @@ const helperErrorStyles = {
|
|
|
26
32
|
* @updatedUser Andrés Quintero - automatic
|
|
27
33
|
*/
|
|
28
34
|
skeletonStyled: ({ theme, ownerState }) => ({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
width: theme.vars.size.baseSpacings.sp14,
|
|
36
|
+
...getTypographyStyles(
|
|
37
|
+
theme.generalSettings.isMobile,
|
|
38
|
+
ownerState.size || "medium",
|
|
39
|
+
"body"
|
|
40
|
+
),
|
|
41
|
+
...getTypographyStyles(
|
|
42
|
+
theme.generalSettings.isMobile,
|
|
43
|
+
ownerState.size || "small",
|
|
44
|
+
"body"
|
|
45
|
+
),
|
|
36
46
|
variants: []
|
|
37
47
|
})
|
|
38
48
|
};
|
|
@@ -7,5 +7,4 @@ export declare const HELPER_ERROR_KEY_COMPONENT = "M4LHelperError";
|
|
|
7
7
|
* Nombre de clase creado para aportar especificidad a los estilos del componente. Es usado para sobreescribir los estilos de MUI sin
|
|
8
8
|
* tener la necesidad de agregar valores en !important.
|
|
9
9
|
*/
|
|
10
|
-
export declare const HELPER_ERROR_CLASS_SPECIFY = "M4lclassCssSpecificity";
|
|
11
10
|
export declare const classHelperErrorRoot: string;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
2
2
|
const HELPER_ERROR_KEY_COMPONENT = "M4LHelperError";
|
|
3
|
-
const HELPER_ERROR_CLASS_SPECIFY = "M4lclassCssSpecificity";
|
|
4
3
|
const classHelperErrorRoot = getComponentSlotRoot(HELPER_ERROR_KEY_COMPONENT);
|
|
5
4
|
export {
|
|
6
5
|
HELPER_ERROR_KEY_COMPONENT as H,
|
|
7
|
-
HELPER_ERROR_CLASS_SPECIFY as a,
|
|
8
6
|
classHelperErrorRoot as c
|
|
9
7
|
};
|
|
@@ -8,10 +8,11 @@ const TypographyStyled = styled(Typography, {
|
|
|
8
8
|
name: HELPER_ERROR_KEY_COMPONENT,
|
|
9
9
|
slot: HelperErrorSlots.root
|
|
10
10
|
})(helperErrorStyles?.root);
|
|
11
|
-
styled(Skeleton, {
|
|
11
|
+
const SkeletonStyled = styled(Skeleton, {
|
|
12
12
|
name: HELPER_ERROR_KEY_COMPONENT,
|
|
13
13
|
slot: HelperErrorSlots.skeletonStyled
|
|
14
14
|
})(helperErrorStyles?.skeletonStyled);
|
|
15
15
|
export {
|
|
16
|
+
SkeletonStyled as S,
|
|
16
17
|
TypographyStyled as T
|
|
17
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
2
|
import { TypographyProps } from '../mui_extended/Typography/types';
|
|
3
3
|
import { HELPER_ERROR_KEY_COMPONENT } from './constant';
|
|
4
4
|
import { HelperErrorSlots } from './slots';
|
|
@@ -28,21 +28,17 @@ export interface HelperErrorProps extends Pick<TypographyProps, 'skeletonWidth'
|
|
|
28
28
|
*/
|
|
29
29
|
export interface HelperErrorOwnerState {
|
|
30
30
|
/**
|
|
31
|
-
* Color de la paleta del
|
|
31
|
+
* Color de la paleta del texto.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
color?: Extract<ComponentPalletColor, 'error'>;
|
|
34
34
|
/**
|
|
35
35
|
* Color de la paleta del componente del campo de texto.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
componentPaletteColor?: ComponentPalletColor;
|
|
38
38
|
/**
|
|
39
39
|
* Tamaño del campo de texto.
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Indica si el campo de texto es error.
|
|
44
|
-
*/
|
|
45
|
-
helperStateError?: boolean;
|
|
41
|
+
size: Extract<Sizes, 'small' | 'medium'>;
|
|
46
42
|
}
|
|
47
43
|
/**
|
|
48
44
|
* Define los tipos de slots disponibles en HelperError utilizando las claves de HelperErrorSlots.
|
|
@@ -51,4 +47,4 @@ export type HelperErrorSlotsType = keyof typeof HelperErrorSlots;
|
|
|
51
47
|
/**
|
|
52
48
|
* Define los estilos personalizables para HelperError, permitiendo la sobrescritura de estilos por defecto.
|
|
53
49
|
*/
|
|
54
|
-
export type HelperErrorStyles =
|
|
50
|
+
export type HelperErrorStyles = OverridesStyleRules<HelperErrorSlotsType, typeof HELPER_ERROR_KEY_COMPONENT, Theme>;
|
|
@@ -57,7 +57,7 @@ const Label = (props) => {
|
|
|
57
57
|
}
|
|
58
58
|
)
|
|
59
59
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...ownerState }, variant: "
|
|
60
|
+
/* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...ownerState }, variant: "rectangular", className: "SkeletonWidthLabel" }),
|
|
61
61
|
mandatory && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...ownerState }, variant: "circular", className: "MandatoryLabel" }),
|
|
62
62
|
helperMessage && /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...ownerState }, variant: "circular", className: "HelperIconLabel" })
|
|
63
63
|
] })
|
|
@@ -2,7 +2,10 @@ import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
|
|
|
2
2
|
import { g as getHeightSizeStyles } from "../../utils/getHeightSizeStyles.js";
|
|
3
3
|
const labelStyles = {
|
|
4
4
|
/**
|
|
5
|
-
* Estilos para el contenedor raíz del Label
|
|
5
|
+
* Estilos para el contenedor raíz del Label 🏷️
|
|
6
|
+
* @param {object} theme - El tema de MUI.
|
|
7
|
+
* @param {object} ownerState - El estado del componente.
|
|
8
|
+
* @returns {object} - Los estilos aplicados al root del Label.
|
|
6
9
|
* @author Bruce Escobar - automatic
|
|
7
10
|
* @createdAt 2024-10-22 09:34:39 - automatic
|
|
8
11
|
* @updatedAt 2025-01-08 10:36:40 - automatic
|
|
@@ -10,22 +13,21 @@ const labelStyles = {
|
|
|
10
13
|
*/
|
|
11
14
|
root: ({ theme, ownerState }) => ({
|
|
12
15
|
display: "flex",
|
|
13
|
-
|
|
16
|
+
flexDirection: "row",
|
|
14
17
|
alignItems: "center",
|
|
15
18
|
flexWrap: "wrap",
|
|
16
19
|
width: "fit-content",
|
|
17
|
-
...getHeightSizeStyles(
|
|
18
|
-
theme.generalSettings.isMobile,
|
|
19
|
-
ownerState.size || "small",
|
|
20
|
-
"base"
|
|
21
|
-
),
|
|
22
20
|
gap: theme.size.baseSpacings.sp1,
|
|
21
|
+
/** Estilos para el estado disabled del Label 😶🌫️ */
|
|
23
22
|
...ownerState.disabled && {
|
|
24
23
|
color: theme.vars.palette.text.disabled
|
|
25
24
|
}
|
|
26
25
|
}),
|
|
27
26
|
/**
|
|
28
|
-
* Estilos para el slot Typography del Label
|
|
27
|
+
* Estilos para el slot Typography del Label 📝
|
|
28
|
+
* @param {object} theme - El tema de MUI.
|
|
29
|
+
* @param {object} ownerState - El estado del componente.
|
|
30
|
+
* @returns {object} - Los estilos aplicados al Typography del Label.
|
|
29
31
|
*/
|
|
30
32
|
typographyStyled: ({ theme, ownerState }) => ({
|
|
31
33
|
"&.MuiTypography-root": {
|
|
@@ -48,7 +50,10 @@ const labelStyles = {
|
|
|
48
50
|
}
|
|
49
51
|
}),
|
|
50
52
|
/**
|
|
51
|
-
* Estilos para el slot Typography del mensaje obligatorio del Label
|
|
53
|
+
* Estilos para el slot Typography del mensaje obligatorio del Label ❗
|
|
54
|
+
* @param {object} theme - El tema de MUI.
|
|
55
|
+
* @param {object} ownerState - El estado del componente.
|
|
56
|
+
* @returns {object} - Los estilos aplicados al Typography del mensaje obligatorio del Label.
|
|
52
57
|
*/
|
|
53
58
|
typographyMandatoryMessageStyled: ({ theme, ownerState }) => ({
|
|
54
59
|
"&.MuiTypography-root": {
|
|
@@ -71,7 +76,10 @@ const labelStyles = {
|
|
|
71
76
|
}
|
|
72
77
|
}),
|
|
73
78
|
/**
|
|
74
|
-
* Estilos para el slot Icon del Label
|
|
79
|
+
* Estilos para el slot Icon del Label 🛠️
|
|
80
|
+
* @param {object} theme - El tema de MUI.
|
|
81
|
+
* @param {object} ownerState - El estado del componente.
|
|
82
|
+
* @returns {object} - Los estilos aplicados al Icon del Label.
|
|
75
83
|
*/
|
|
76
84
|
iconHelperMessageStyled: ({ theme, ownerState }) => ({
|
|
77
85
|
borderRadius: theme.vars.size.borderRadius.r1,
|
|
@@ -85,10 +93,18 @@ const labelStyles = {
|
|
|
85
93
|
theme.generalSettings.isMobile,
|
|
86
94
|
ownerState.size || "small",
|
|
87
95
|
"base"
|
|
96
|
+
),
|
|
97
|
+
...getHeightSizeStyles(
|
|
98
|
+
theme.generalSettings.isMobile,
|
|
99
|
+
ownerState.size || "medium",
|
|
100
|
+
"base"
|
|
88
101
|
)
|
|
89
102
|
}),
|
|
90
103
|
/**
|
|
91
|
-
* Estilos para el slot Skeleton del Label
|
|
104
|
+
* Estilos para el slot Skeleton del Label 💀
|
|
105
|
+
* @param {object} theme - El tema de MUI.
|
|
106
|
+
* @param {object} ownerState - El estado del componente.
|
|
107
|
+
* @returns {object} - Los estilos aplicados al Skeleton del Label.
|
|
92
108
|
*/
|
|
93
109
|
skeletonStyled: ({ ownerState, theme }) => ({
|
|
94
110
|
width: "100%",
|
|
@@ -99,27 +115,54 @@ const labelStyles = {
|
|
|
99
115
|
...getHeightSizeStyles(
|
|
100
116
|
theme.generalSettings.isMobile,
|
|
101
117
|
ownerState.size || "medium",
|
|
102
|
-
"
|
|
118
|
+
"base"
|
|
103
119
|
),
|
|
104
120
|
...getHeightSizeStyles(
|
|
105
121
|
theme.generalSettings.isMobile,
|
|
106
122
|
ownerState.size || "small",
|
|
107
|
-
"
|
|
123
|
+
"base"
|
|
108
124
|
),
|
|
109
125
|
"&.MandatoryLabel": {
|
|
110
126
|
width: theme.vars.size.baseSpacings["sp0-5"],
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
128
|
+
paddingRight: theme.vars.size.baseSpacings.sp1
|
|
113
129
|
},
|
|
114
130
|
"&.SkeletonWidthLabel": {
|
|
115
131
|
width: theme.vars.size.baseSpacings.sp14,
|
|
116
|
-
borderRadius: theme.vars.size.borderRadius.r1
|
|
132
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
133
|
+
...getHeightSizeStyles(
|
|
134
|
+
theme.generalSettings.isMobile,
|
|
135
|
+
ownerState.size || "medium",
|
|
136
|
+
"base"
|
|
137
|
+
),
|
|
138
|
+
...getHeightSizeStyles(
|
|
139
|
+
theme.generalSettings.isMobile,
|
|
140
|
+
ownerState.size || "small",
|
|
141
|
+
"base"
|
|
142
|
+
)
|
|
117
143
|
},
|
|
118
144
|
"&.HelperIconLabel": {
|
|
119
|
-
width: theme.vars.size.baseSpacings.sp2,
|
|
120
145
|
borderRadius: theme.vars.size.borderRadius.r4,
|
|
121
|
-
|
|
122
|
-
|
|
146
|
+
...getHeightSizeStyles(
|
|
147
|
+
theme.generalSettings.isMobile,
|
|
148
|
+
ownerState.size || "small",
|
|
149
|
+
"base",
|
|
150
|
+
(val) => {
|
|
151
|
+
return {
|
|
152
|
+
width: val
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
...getHeightSizeStyles(
|
|
157
|
+
theme.generalSettings.isMobile,
|
|
158
|
+
ownerState.size || "medium",
|
|
159
|
+
"base",
|
|
160
|
+
(val) => {
|
|
161
|
+
return {
|
|
162
|
+
width: val
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
)
|
|
123
166
|
}
|
|
124
167
|
})
|
|
125
168
|
};
|
|
@@ -32,6 +32,7 @@ export interface LabelProps extends Pick<TypographyProps, 'skeletonWidth'> {
|
|
|
32
32
|
error?: boolean;
|
|
33
33
|
/** Indica si el componente está deshabilitado. */
|
|
34
34
|
disabled?: boolean;
|
|
35
|
+
/** Indica si el componente está deshabilitado. */
|
|
35
36
|
helperText?: string;
|
|
36
37
|
}
|
|
37
38
|
export type OwnerState = Pick<LabelProps, 'size'>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UncertaintyFormatterProps } from './types';
|
|
3
|
+
import { UncertaintyFormatterRootStyled } from './slots/UncertaintyFormatterSlots';
|
|
4
|
+
/**
|
|
5
|
+
* Formatea un conjunto de rangos de incertidumbre en una cadena legible.
|
|
6
|
+
* @param obProps - Objeto que contiene las propiedades de los rangos de incertidumbre.
|
|
7
|
+
* @param fieldValue - Nombre del campo que contiene los valores de los rangos.
|
|
8
|
+
* @param fieldSymbol - Nombre del campo que contiene el símbolo a utilizar.
|
|
9
|
+
* @param fieldUnit - Nombre del campo que contiene la unidad de medida.
|
|
10
|
+
* @returns Una cadena que representa los rangos de incertidumbre formateados.
|
|
11
|
+
* @example
|
|
12
|
+
* const obProps = {
|
|
13
|
+
* ranges: [
|
|
14
|
+
* { cmc_min: -20, cmc_max: 0.0, cmc_min_closed: true, cmc_max_closed: false, cmc_uncertainty: 0.5 },
|
|
15
|
+
* ],
|
|
16
|
+
* symbol: 'T',
|
|
17
|
+
* unit: '°C'
|
|
18
|
+
* };
|
|
19
|
+
* const result = getUncertaintyFormat(obProps, 'ranges', 'symbol', 'unit');
|
|
20
|
+
* console.log(result); // "[-20°C ≤ T < 0°C ± 0.5]"
|
|
21
|
+
*/
|
|
22
|
+
export declare function getUncertaintyFormat(obProps: any, fieldValue: string, fieldSymbol: string, fieldUnit: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Formatea y muestra valores de incertidumbre con estilo opcional.
|
|
25
|
+
* @param props - Las propiedades para el componente UncertaintyFormatter.
|
|
26
|
+
* @returns El valor de incertidumbre formateado envuelto en el componente especificado.
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
*
|
|
30
|
+
* const ObjFormatter = {
|
|
31
|
+
* ranges: [
|
|
32
|
+
* { cmc_min: -20,
|
|
33
|
+
* cmc_max: 0.0,
|
|
34
|
+
* cmc_min_closed: true,
|
|
35
|
+
* cmc_max_closed: false,
|
|
36
|
+
* cmc_uncertainty: 0.5 },
|
|
37
|
+
* ],
|
|
38
|
+
* symbol: 'T',
|
|
39
|
+
* unit: '°C',
|
|
40
|
+
* },
|
|
41
|
+
*
|
|
42
|
+
* <UncertaintyFormatter
|
|
43
|
+
* obProps = {ObjFormatter}
|
|
44
|
+
* fieldValue='ranges'
|
|
45
|
+
* fieldSymbol='symbol'
|
|
46
|
+
* fieldUnit='unit'
|
|
47
|
+
* color='text.primary'
|
|
48
|
+
* size='medium'
|
|
49
|
+
* variant='body'
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function UncertaintyFormatter<T extends React.ElementType = typeof UncertaintyFormatterRootStyled>(props: UncertaintyFormatterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { getPropertyByString } from "@m4l/core";
|
|
5
|
+
import { U as UncertaintyFormatterRootStyled } from "./slots/UncertaintyFormatterSlots.js";
|
|
6
|
+
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
7
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
8
|
+
import { U as UNCERTAINTY_FORMATTER_KEY_COMPONENT } from "./constants.js";
|
|
9
|
+
import { U as UncertaintyFormatterSlots } from "./slots/UncertaintyFormatterEnum.js";
|
|
10
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
|
+
function getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit) {
|
|
12
|
+
let result = "";
|
|
13
|
+
const ranges = getPropertyByString(obProps, fieldValue);
|
|
14
|
+
const symbol = getPropertyByString(obProps, fieldSymbol);
|
|
15
|
+
const unit = getPropertyByString(obProps, fieldUnit);
|
|
16
|
+
if (ranges === void 0 || ranges === null || !Array.isArray(ranges) || typeof symbol !== "string" || typeof unit !== "string") {
|
|
17
|
+
return "[]";
|
|
18
|
+
}
|
|
19
|
+
ranges.map((obj, idx) => {
|
|
20
|
+
const cmc_min_closed = obj.cmc_min_closed !== true ? "<" : "≤";
|
|
21
|
+
const cmc_max_closed = obj.cmc_max_closed !== true ? "<" : "≤";
|
|
22
|
+
result = result.concat(
|
|
23
|
+
`${idx > 0 ? " " : ""}`,
|
|
24
|
+
obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} ± ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} ± ${obj.cmc_uncertainty}]`
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
function UncertaintyFormatter(props) {
|
|
30
|
+
const { obProps, fieldValue, fieldSymbol, fieldUnit, Component = UncertaintyFormatterRootStyled, size = "medium", color, dataTestid, className } = props;
|
|
31
|
+
const { currentSize } = useComponentSize(size);
|
|
32
|
+
const formatterUncertainty = useMemo(
|
|
33
|
+
() => getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit),
|
|
34
|
+
[obProps, fieldValue, fieldSymbol, fieldUnit]
|
|
35
|
+
);
|
|
36
|
+
if (Component === React.Fragment) {
|
|
37
|
+
return /* @__PURE__ */ jsx(Fragment, { children: formatterUncertainty });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
Component,
|
|
41
|
+
{
|
|
42
|
+
size: currentSize,
|
|
43
|
+
variant: "body",
|
|
44
|
+
color,
|
|
45
|
+
className: clsx(getComponentSlotRoot(UNCERTAINTY_FORMATTER_KEY_COMPONENT), className),
|
|
46
|
+
...getPropDataTestId(UNCERTAINTY_FORMATTER_KEY_COMPONENT, UncertaintyFormatterSlots.root, dataTestid),
|
|
47
|
+
children: formatterUncertainty
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
UncertaintyFormatter as U,
|
|
53
|
+
getUncertaintyFormat as g
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UNCERTAINTY_FORMATTER_KEY_COMPONENT = "M4LUncertaintyFormatter";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UncertaintyFormatterRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Typography/types').TypographyProps, keyof import('../../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { U as UNCERTAINTY_FORMATTER_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { u as uncertaintyFormatterStyles } from "../UncertaintyFormatter.styles.js";
|
|
4
|
+
import { U as UncertaintyFormatterSlots } from "./UncertaintyFormatterEnum.js";
|
|
5
|
+
import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
|
|
6
|
+
const UncertaintyFormatterRootStyled = styled(Typography, {
|
|
7
|
+
name: UNCERTAINTY_FORMATTER_KEY_COMPONENT,
|
|
8
|
+
slot: UncertaintyFormatterSlots.root
|
|
9
|
+
})(uncertaintyFormatterStyles.root);
|
|
10
|
+
export {
|
|
11
|
+
UncertaintyFormatterRootStyled as U
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,58 @@
|
|
|
1
|
+
import { Sizes } from '@m4l/styles';
|
|
2
|
+
import { Theme } from '@mui/material';
|
|
3
|
+
import { M4LOverridesStyleRules } from 'src/@types/augmentations';
|
|
4
|
+
import { TypographyProps } from '../../mui_extended/Typography/types';
|
|
5
|
+
import { UncertaintyFormatterSlots as Slots } from './slots/UncertaintyFormatterEnum';
|
|
6
|
+
import { UNCERTAINTY_FORMATTER_KEY_COMPONENT } from './constants';
|
|
7
|
+
/**
|
|
8
|
+
* Representa un rango de incertidumbre con límites y una incertidumbre asociada.
|
|
9
|
+
*/
|
|
1
10
|
export interface UncertaintyRange {
|
|
11
|
+
/**
|
|
12
|
+
* Indica si el límite inferior está cerrado (≤) o abierto (<).
|
|
13
|
+
*/
|
|
2
14
|
cmc_min_closed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Valor mínimo del rango.
|
|
17
|
+
*/
|
|
3
18
|
cmc_min: number;
|
|
19
|
+
/**
|
|
20
|
+
* Indica si el límite superior está cerrado (≤) o abierto (<).
|
|
21
|
+
*/
|
|
4
22
|
cmc_max_closed: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Valor máximo del rango.
|
|
25
|
+
*/
|
|
5
26
|
cmc_max: number;
|
|
27
|
+
/**
|
|
28
|
+
* Incertidumbre asociada al rango.
|
|
29
|
+
*/
|
|
6
30
|
cmc_uncertainty: number;
|
|
7
31
|
}
|
|
8
|
-
export interface UncertaintyFormatterProps {
|
|
32
|
+
export interface UncertaintyFormatterProps extends Pick<TypographyProps, 'color' | 'dataTestid' | 'className'> {
|
|
33
|
+
/**
|
|
34
|
+
* Componente personalizado que puede dar la presentación del formatter.
|
|
35
|
+
*/
|
|
9
36
|
Component?: React.ElementType;
|
|
37
|
+
/**
|
|
38
|
+
* Objeto de información que contine los valores que se van a utilizar en las propiedades fieldUnit y fieldValue.
|
|
39
|
+
*/
|
|
10
40
|
obProps: any;
|
|
41
|
+
/**
|
|
42
|
+
* Valor del campo que debe ser expresado en notación de cadena.
|
|
43
|
+
*/
|
|
11
44
|
fieldValue: string;
|
|
45
|
+
/**
|
|
46
|
+
* Valor del simbolo que debe ser expresado en notación de cadena.
|
|
47
|
+
*/
|
|
12
48
|
fieldSymbol: string;
|
|
49
|
+
/**
|
|
50
|
+
* Valor de la unidad de medida que debe ser expresado en notación de cadena.
|
|
51
|
+
*/
|
|
13
52
|
fieldUnit: string;
|
|
53
|
+
/**
|
|
54
|
+
* Tamaño del componente.
|
|
55
|
+
*/
|
|
56
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
14
57
|
}
|
|
58
|
+
export type UncertaintyFormatterStyles = M4LOverridesStyleRules<keyof typeof Slots, typeof UNCERTAINTY_FORMATTER_KEY_COMPONENT, Theme>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BooleanFormatter } from './BooleanFormatter/BooleanFormatter';
|
|
2
2
|
export { useFormatDate as getFormatDate, DateFormatter } from './DateFormatter/DateFormatter';
|
|
3
|
-
export { UncertaintyFormatter, getUncertaintyFormat } from './UncertaintyFormatter';
|
|
3
|
+
export { UncertaintyFormatter, getUncertaintyFormat } from './UncertaintyFormatter/UncertaintyFormatter';
|
|
4
4
|
export { PointsFormatter, getFormatPoints } from './PointsFormatter/PointsFormatter';
|
|
5
5
|
export { getFormatConcatenated, ConcatenatedFormatter } from './ConcatenatedFormatter/ConcatenatedFormatter';
|
|
6
6
|
export { useFormatPeriod, PeriodFormatter } from './PeriodFormatter/PeriodFormatter';
|