@m4l/components 9.1.54 → 9.1.56

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.
Files changed (55) hide show
  1. package/components/Chip/Chip.js +6 -2
  2. package/components/Chip/ChipStyles.js +7 -7
  3. package/components/Chip/constants.d.ts +4 -0
  4. package/components/Chip/constants.js +5 -1
  5. package/components/Chip/slots/ChipEnum.d.ts +7 -7
  6. package/components/Chip/slots/ChipEnum.js +8 -7
  7. package/components/Chip/slots/ChipSlots.js +3 -3
  8. package/components/Chip/types.d.ts +41 -11
  9. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +9 -21
  10. package/components/formatters/PeriodFormatter/PeriodFormatter.d.ts +25 -0
  11. package/components/formatters/PeriodFormatter/PeriodFormatter.js +87 -0
  12. package/components/formatters/PeriodFormatter/PeriodFormatter.styles.d.ts +2 -0
  13. package/components/formatters/PeriodFormatter/PeriodFormatter.styles.js +29 -0
  14. package/components/formatters/PeriodFormatter/constants.d.ts +1 -0
  15. package/components/formatters/PeriodFormatter/constants.js +4 -0
  16. package/components/formatters/PeriodFormatter/dictionary.d.ts +6 -9
  17. package/components/formatters/PeriodFormatter/slots/PeriodFomatterEnum.d.ts +4 -0
  18. package/components/formatters/PeriodFormatter/slots/PeriodFomatterEnum.js +8 -0
  19. package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.d.ts +2 -0
  20. package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.js +18 -0
  21. package/components/formatters/PeriodFormatter/slots/index.d.ts +2 -0
  22. package/components/formatters/PeriodFormatter/slots/index.js +1 -0
  23. package/components/formatters/PeriodFormatter/tests/PeriodFormatter.test.d.ts +1 -0
  24. package/components/formatters/PeriodFormatter/types.d.ts +22 -2
  25. package/components/formatters/index.d.ts +1 -1
  26. package/components/mui_extended/Autocomplete/Autocomplete.js +13 -9
  27. package/components/mui_extended/Autocomplete/AutocompleteStyles.js +18 -58
  28. package/components/mui_extended/Autocomplete/dictionary.d.ts +0 -2
  29. package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +1 -1
  30. package/components/mui_extended/Autocomplete/renderOptions/index.js +3 -2
  31. package/components/mui_extended/Autocomplete/slots /AutocompleteSlots.js +3 -2
  32. package/components/mui_extended/MenuItem/MenuItem.js +7 -6
  33. package/components/mui_extended/MenuItem/MenuItem.styles.js +55 -64
  34. package/components/mui_extended/MenuItem/constants.d.ts +4 -0
  35. package/components/mui_extended/MenuItem/constants.js +5 -1
  36. package/components/mui_extended/MenuItem/slots/MenuItemEnum.d.ts +1 -1
  37. package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +1 -1
  38. package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +3 -3
  39. package/components/mui_extended/MenuItem/types.d.ts +32 -11
  40. package/components/mui_extended/TextField/TextField.js +2 -1
  41. package/components/mui_extended/TextField/TextField.styles.js +26 -10
  42. package/components/mui_extended/TextField/constants.d.ts +3 -3
  43. package/components/mui_extended/TextField/constants.js +2 -2
  44. package/components/mui_extended/TextField/slots/TextFieldEnum.d.ts +1 -1
  45. package/components/mui_extended/TextField/slots/TextFieldEnum.js +6 -6
  46. package/components/mui_extended/Typography/Typography.js +4 -3
  47. package/components/mui_extended/Typography/constants.d.ts +4 -0
  48. package/components/mui_extended/Typography/constants.js +5 -1
  49. package/components/mui_extended/Typography/slots/typographySlots.js +1 -1
  50. package/index.js +1 -1
  51. package/package.json +1 -1
  52. package/utils/getHeightSizeStyles.js +1 -1
  53. package/components/formatters/PeriodFormatter/index.d.ts +0 -15
  54. package/components/formatters/PeriodFormatter/index.js +0 -60
  55. package/components/formatters/PeriodFormatter/index.test.d.ts +0 -4
@@ -1,7 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useModuleSkeleton, useEnvironment, getPropertyByString } from "@m4l/core";
3
3
  import { useTheme } from "@mui/material";
4
+ import clsx from "clsx";
4
5
  import { forwardRef } from "react";
6
+ import { C as CHIP_CLASSES } from "./constants.js";
5
7
  import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
6
8
  import { S as SkeletonChipStyled, C as ChipRootStyled, T as TextChipStyled, I as IconButtonStyled, a as IconStyled } from "./slots/ChipSlots.js";
7
9
  const Chip = forwardRef((props, ref) => {
@@ -17,6 +19,7 @@ const Chip = forwardRef((props, ref) => {
17
19
  hasIconClose = true,
18
20
  onClick,
19
21
  onDeleted,
22
+ className,
20
23
  ...others
21
24
  } = props;
22
25
  const { currentSize } = useComponentSize(size);
@@ -30,7 +33,7 @@ const Chip = forwardRef((props, ref) => {
30
33
  theme.vars.palette.default
31
34
  );
32
35
  const ownerState = {
33
- size,
36
+ chipSize: adjustedSize,
34
37
  variant,
35
38
  paletteColor,
36
39
  color,
@@ -75,9 +78,10 @@ const Chip = forwardRef((props, ref) => {
75
78
  {
76
79
  role: "button-chip",
77
80
  tabIndex: 0,
78
- size,
81
+ size: adjustedSize,
79
82
  onClick,
80
83
  ownerState: { ...ownerState },
84
+ className: clsx(className, CHIP_CLASSES.root),
81
85
  ref,
82
86
  ...others,
83
87
  children: [
@@ -6,7 +6,7 @@ const chipStyles = {
6
6
  * @updatedAt 2024-12-06 13:56:58 - automatic
7
7
  * @updatedUser SebastianM - automatic
8
8
  */
9
- chipRoot: ({ theme, ownerState }) => ({
9
+ root: ({ theme, ownerState }) => ({
10
10
  display: "flex",
11
11
  alignItems: "center",
12
12
  padding: theme.vars.size.baseSpacings.sp1,
@@ -424,7 +424,7 @@ const chipStyles = {
424
424
  }
425
425
  },
426
426
  // Estilos específicos para el tamaño small
427
- ...ownerState.size === "small" && {
427
+ ...ownerState.chipSize === "small" && {
428
428
  ...theme.generalSettings.isMobile ? {
429
429
  height: theme.vars.size.mobile.small.base,
430
430
  minHeight: theme.vars.size.mobile.small.base
@@ -434,7 +434,7 @@ const chipStyles = {
434
434
  }
435
435
  },
436
436
  // Estilos específicos para el tamaño medium
437
- ...ownerState.size === "medium" && {
437
+ ...ownerState.chipSize === "medium" && {
438
438
  ...theme.generalSettings.isMobile ? {
439
439
  height: theme.vars.size.mobile.medium.base,
440
440
  minHeight: theme.vars.size.mobile.medium.base
@@ -472,7 +472,7 @@ const chipStyles = {
472
472
  */
473
473
  iconButton: ({ theme, ownerState }) => ({
474
474
  // Estilos específicos para el tamaño small
475
- ...ownerState.size === "small" && {
475
+ ...ownerState.chipSize === "small" && {
476
476
  ...theme.generalSettings.isMobile ? {
477
477
  height: theme.vars.size.mobile.small.base,
478
478
  width: theme.vars.size.mobile.small.base,
@@ -484,7 +484,7 @@ const chipStyles = {
484
484
  }
485
485
  },
486
486
  // Estilos específicos para el tamaño medium
487
- ...ownerState.size === "medium" && {
487
+ ...ownerState.chipSize === "medium" && {
488
488
  ...theme.generalSettings.isMobile ? {
489
489
  height: theme.vars.size.mobile.medium.base,
490
490
  width: theme.vars.size.mobile.medium.base,
@@ -507,7 +507,7 @@ const chipStyles = {
507
507
  width: "100%",
508
508
  background: theme.vars.palette.skeleton.transition,
509
509
  // Estilos específicos para el tamaño small
510
- ...ownerState.size === "small" && {
510
+ ...ownerState.chipSize === "small" && {
511
511
  ...theme.generalSettings.isMobile ? {
512
512
  height: theme.vars.size.mobile.small.base,
513
513
  minHeight: theme.vars.size.mobile.small.base
@@ -517,7 +517,7 @@ const chipStyles = {
517
517
  }
518
518
  },
519
519
  // Estilos específicos para el tamaño medium
520
- ...ownerState.size === "medium" && {
520
+ ...ownerState.chipSize === "medium" && {
521
521
  ...theme.generalSettings.isMobile ? {
522
522
  height: theme.vars.size.mobile.medium.base,
523
523
  minHeight: theme.vars.size.mobile.medium.base
@@ -6,3 +6,7 @@
6
6
  * @default 'M4LChip'
7
7
  */
8
8
  export declare const CHIP_KEY_COMPONENT = "M4LChip";
9
+ /**
10
+ * Inventario de clases CSS para el componente Chip
11
+ */
12
+ export declare const CHIP_CLASSES: Record<string, string>;
@@ -1,4 +1,8 @@
1
+ import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
2
+ import { C as ChipSlots } from "./slots/ChipEnum.js";
1
3
  const CHIP_KEY_COMPONENT = "M4LChip";
4
+ const CHIP_CLASSES = getComponentClasses(CHIP_KEY_COMPONENT, ChipSlots);
2
5
  export {
3
- CHIP_KEY_COMPONENT as C
6
+ CHIP_CLASSES as C,
7
+ CHIP_KEY_COMPONENT as a
4
8
  };
@@ -1,7 +1,7 @@
1
- export declare const ChipSlots: {
2
- chipRoot: string;
3
- skeletonChip: string;
4
- chipIcon: string;
5
- textChip: string;
6
- iconButton: string;
7
- };
1
+ export declare enum ChipSlots {
2
+ root = "root",
3
+ skeletonChip = "skeleton",
4
+ chipIcon = "icon",
5
+ textChip = "text",
6
+ iconButton = "iconButton"
7
+ }
@@ -1,10 +1,11 @@
1
- const ChipSlots = {
2
- chipRoot: "Root",
3
- skeletonChip: "Skeleton",
4
- chipIcon: "Icon",
5
- textChip: "Text",
6
- iconButton: "IconButton"
7
- };
1
+ var ChipSlots = /* @__PURE__ */ ((ChipSlots2) => {
2
+ ChipSlots2["root"] = "root";
3
+ ChipSlots2["skeletonChip"] = "skeleton";
4
+ ChipSlots2["chipIcon"] = "icon";
5
+ ChipSlots2["textChip"] = "text";
6
+ ChipSlots2["iconButton"] = "iconButton";
7
+ return ChipSlots2;
8
+ })(ChipSlots || {});
8
9
  export {
9
10
  ChipSlots as C
10
11
  };
@@ -1,6 +1,6 @@
1
1
  import { styled } from "@mui/material/styles";
2
2
  import { c as chipStyles } from "../ChipStyles.js";
3
- import { C as CHIP_KEY_COMPONENT } from "../constants.js";
3
+ import { a as CHIP_KEY_COMPONENT } from "../constants.js";
4
4
  import { C as ChipSlots } from "./ChipEnum.js";
5
5
  import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
6
6
  import { T as Typography } from "../../mui_extended/Typography/Typography.js";
@@ -8,8 +8,8 @@ import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
8
8
  import { I as Icon } from "../../Icon/Icon.js";
9
9
  const ChipRootStyled = styled("div", {
10
10
  name: CHIP_KEY_COMPONENT,
11
- slot: ChipSlots.chipRoot
12
- })(chipStyles?.chipRoot);
11
+ slot: ChipSlots.root
12
+ })(chipStyles?.root);
13
13
  const SkeletonChipStyled = styled(Skeleton, {
14
14
  name: CHIP_KEY_COMPONENT,
15
15
  slot: ChipSlots.skeletonChip
@@ -6,36 +6,66 @@ import { CHIP_KEY_COMPONENT } from './constants';
6
6
  import { ChipSlots } from './slots';
7
7
  type ChipVariants = 'contained' | 'outlined';
8
8
  /**
9
- * Props for the `Chip` component, extending the original properties of Material UI.
10
- * [startIcon] - Optional prop for the icon on the left in the `Chip`.
11
- * [endIcon] - Optional prop for the icon on the right in the `Chip`.
12
- * label - Text describing the `Chip`.
13
- * [componentPaletteColor] - Customization of the component's palette color.
14
- * [size] - Size of the `Chip` (default 'medium').
15
- * [error] - Indicates if the `Chip` is in an error state.
16
- * [variant] - Defines the variant of the `Chip` (default 'contained').
17
- * [color] - Defines the color of the `Chip`.
9
+ * Propiedades del componente `Chip`.
18
10
  * @createdAt 2024-12-06 11:17:21 - automatic
19
11
  */
20
12
  export interface ChipProps {
13
+ /**
14
+ * Optional prop for the icon on the left in the `Chip`. Can accept a URL as a string to render an image icon, or a React component to render it directly.
15
+ */
21
16
  startIcon?: ReactNode;
17
+ /**
18
+ * Optional prop for the icon on the right in the `Chip`. Can accept a URL as a string to render an image icon, or a React component to render it directly.
19
+ */
22
20
  endIcon?: ReactNode;
21
+ /**
22
+ * Size of the `Chip` (default 'medium').
23
+ */
23
24
  size?: Extract<Sizes, 'small' | 'medium'>;
25
+ /**
26
+ * Text describing the `Chip`.
27
+ */
24
28
  label?: string;
29
+ /**
30
+ * Defines the variant of the `Chip` (default 'contained').
31
+ */
25
32
  variant?: ChipVariants;
33
+ /**
34
+ * Defines the color of the `Chip`.
35
+ */
26
36
  color?: Exclude<ComponentPalletColor, 'primary'>;
37
+ /**
38
+ * Define el with of skeleton mode
39
+ */
27
40
  skeletonWidth?: string | number;
41
+ /**
42
+ * OPtion prop to render the close icon
43
+ */
28
44
  hasIconClose?: boolean;
45
+ /**
46
+ * Opacity of the `Chip`.
47
+ */
29
48
  opacity?: boolean;
49
+ /**
50
+ * Function to be executed when the `Chip` is clicked.
51
+ */
30
52
  onClick?: () => void;
53
+ /**
54
+ * Function to be executed when the `Chip` is deleted.
55
+ */
31
56
  onDeleted?: EventHandler<any>;
57
+ /**
58
+ * Class name for the `Chip`.
59
+ */
60
+ className?: string;
32
61
  }
33
62
  /**
34
63
  * Owner state of the `Chip` used to define internal style and behavior properties.
35
64
  */
36
- export interface ChipOwnerState extends Pick<ChipProps, 'size' | 'variant' | 'color'> {
65
+ export interface ChipOwnerState extends Pick<ChipProps, 'variant' | 'color'> {
37
66
  opacity?: boolean;
38
67
  paletteColor: PaletteColor;
68
+ chipSize: ChipProps['size'];
39
69
  }
40
70
  /**
41
71
  * Defines the types of Slots available for the `Chip`.
@@ -44,5 +74,5 @@ export type ChipSlotsType = keyof typeof ChipSlots;
44
74
  /**
45
75
  * Styles applicable to the `Chip` using themes and custom slots.
46
76
  */
47
- export type ChipStyles = Partial<OverridesStyleRules<ChipSlotsType, typeof CHIP_KEY_COMPONENT, Theme> | undefined> | undefined;
77
+ export type ChipStyles = OverridesStyleRules<ChipSlotsType, typeof CHIP_KEY_COMPONENT, Theme>;
48
78
  export {};
@@ -1,3 +1,4 @@
1
+ import { g as getHeightSizeStyles } from "../../../../../../utils/getHeightSizeStyles.js";
1
2
  import { a as ITEM_IN_TREE_ACTIVE, I as ITEM_ACTIVE } from "../../../../constants.js";
2
3
  const containerMenuItemsMainStyles = {
3
4
  /**
@@ -12,34 +13,21 @@ const containerMenuItemsMainStyles = {
12
13
  display: "flex",
13
14
  flexDirection: "column",
14
15
  gap: theme.vars.size.baseSpacings["sp0-5"],
15
- "& .M4LMenuItem-menuItemContainer": {
16
- // Estilos específicos para el tamaño small
17
- ...ownerState.sidebarSize === "small" && {
18
- ...theme.generalSettings.isMobile ? {
19
- minHeight: theme.vars.size.mobile.small.action
20
- } : {
21
- minHeight: theme.vars.size.desktop.small.action
22
- }
23
- },
24
- // Estilos específicos para el tamaño medium
25
- ...ownerState.sidebarSize === "medium" && {
26
- ...theme.generalSettings.isMobile ? {
27
- minHeight: theme.vars.size.mobile.medium.action
28
- } : {
29
- minHeight: theme.vars.size.desktop.medium.action
30
- }
31
- }
32
- },
33
- [`&.M4LListMenuItem-root > .M4LMenuItemRoot[class*="${ITEM_IN_TREE_ACTIVE}"]`]: {
16
+ ...getHeightSizeStyles(
17
+ theme.generalSettings.isMobile,
18
+ ownerState.size || "medium",
19
+ "container"
20
+ ),
21
+ [`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_IN_TREE_ACTIVE}"]`]: {
34
22
  borderColor: theme.vars.palette.divider,
35
23
  "& span": {
36
24
  color: theme.vars.palette.text.primary
37
25
  }
38
26
  },
39
- [`&.M4LListMenuItem-root > .M4LMenuItemRoot[class*="${ITEM_IN_TREE_ACTIVE}"] .M4LIconClass-root`]: {
27
+ [`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_IN_TREE_ACTIVE}"] .M4LIconClass-root`]: {
40
28
  background: theme.vars.palette.text.primary
41
29
  },
42
- [`&.M4LListMenuItem-root > .M4LMenuItemRoot[class*="${ITEM_ACTIVE}"]`]: {
30
+ [`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_ACTIVE}"]`]: {
43
31
  borderColor: theme.vars.palette.primary.main,
44
32
  "& span": {
45
33
  color: theme.vars.palette.primary.main
@@ -0,0 +1,25 @@
1
+ import { default as React } from 'react';
2
+ import { PeriodFormatterProps } from './types';
3
+ /**
4
+ * Muestra un periodo de tiempo en años, meses y días. Retorna un string
5
+ * @param years Cantidad de años
6
+ * @param months Cantidad de meses
7
+ * @param days Cantidad de días
8
+ * @returns string
9
+ * @author cesar - automatic
10
+ * @createdAt 2025-01-02 15:08:06 - automatic
11
+ * @updatedAt 2025-01-07 15:14:22 - automatic
12
+ * @updatedUser cesar - automatic
13
+ */
14
+ export declare function useFormatPeriod(years: number, months: number, days: number): string;
15
+ /**
16
+ * Muestra un periodo de tiempo en años, meses y días. Retorna un JSX.
17
+ * Si el componente está en skeleton, muestra un placeholder de carga.
18
+ * @param props
19
+ * @returns JSX.Element.
20
+ * @author cesar - automatic
21
+ * @createdAt 2025-01-02 15:08:06 - automatic
22
+ * @updatedAt 2025-01-07 15:14:22 - automatic
23
+ * @updatedUser cesar - automatic
24
+ */
25
+ export declare function PeriodFormatter<T extends React.ElementType>(props: PeriodFormatterProps<T>): JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import React, { useMemo } from "react";
3
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
4
+ import { P as PERIOD_FORMATTER_KEY_COMPONENT } from "./constants.js";
5
+ import clsx from "clsx";
6
+ import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
7
+ import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
8
+ import { d as dictionary } from "./dictionary.js";
9
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
10
+ import { P as PeriodFormatterSkeletonStyled, a as PeriodFormatterRootStyled } from "./slots/PeriodFormatterSlots.js";
11
+ import { P as PeriodFormatterSlots } from "./slots/PeriodFomatterEnum.js";
12
+ function useFormatPeriod(years, months, days) {
13
+ const { getLabel } = useModuleDictionary();
14
+ let period = "";
15
+ const separator = ", ";
16
+ switch (years) {
17
+ case 0:
18
+ break;
19
+ case 1:
20
+ period = `1 ${getLabel(dictionary.LABEL_YEAR)}`;
21
+ break;
22
+ default:
23
+ period = `${years} ${getLabel(dictionary.LABEL_YEARS)}`;
24
+ }
25
+ switch (months) {
26
+ case 0:
27
+ break;
28
+ case 1:
29
+ if (years > 0) {
30
+ period += separator;
31
+ }
32
+ period += `1 ${getLabel(dictionary.LABEL_MONTH)}`;
33
+ break;
34
+ default:
35
+ if (years > 0) {
36
+ period += separator;
37
+ }
38
+ period += `${months} ${getLabel(dictionary.LABEL_MONTHS)}`;
39
+ }
40
+ switch (days) {
41
+ case 0:
42
+ break;
43
+ case 1:
44
+ if (years > 0 || months > 0) {
45
+ period += separator;
46
+ }
47
+ period += `1 ${getLabel(dictionary.LABEL_DAY)}`;
48
+ break;
49
+ default:
50
+ if (years > 0 || months > 0) {
51
+ period += separator;
52
+ }
53
+ period += `${days} ${getLabel(dictionary.LABEL_DAYS)}`;
54
+ }
55
+ if (period === "") {
56
+ period = "-";
57
+ }
58
+ return period;
59
+ }
60
+ function PeriodFormatter(props) {
61
+ const { size = "medium", years = 0, months = 0, days = 0, Component = PeriodFormatterRootStyled, dataTestId, className, componentProps } = props;
62
+ const { currentSize } = useComponentSize(size);
63
+ const isSkeleton = useModuleSkeleton();
64
+ const formattedPeriod = useFormatPeriod(years, months, days);
65
+ const memoComponent = useMemo(() => {
66
+ return isSkeleton ? /* @__PURE__ */ jsx(PeriodFormatterSkeletonStyled, { variant: "text" }) : formattedPeriod;
67
+ }, [formattedPeriod, isSkeleton]);
68
+ if (Component === React.Fragment) {
69
+ return /* @__PURE__ */ jsx(Fragment, { children: memoComponent });
70
+ }
71
+ const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
72
+ return /* @__PURE__ */ jsx(
73
+ Component,
74
+ {
75
+ size: adjustedSize,
76
+ className: clsx(getComponentSlotRoot(PERIOD_FORMATTER_KEY_COMPONENT), className),
77
+ ...getPropDataTestId(PERIOD_FORMATTER_KEY_COMPONENT, PeriodFormatterSlots.root, dataTestId),
78
+ role: "period-formatter-role",
79
+ ...componentProps,
80
+ children: memoComponent
81
+ }
82
+ );
83
+ }
84
+ export {
85
+ PeriodFormatter as P,
86
+ useFormatPeriod as u
87
+ };
@@ -0,0 +1,2 @@
1
+ import { PeriodFormatterStyles } from './types';
2
+ export declare const periodFormatterStyles: PeriodFormatterStyles;
@@ -0,0 +1,29 @@
1
+ const periodFormatterStyles = {
2
+ /**
3
+ * Root container of the window
4
+ * @author cesar - automatic
5
+ * @createdAt 2025-01-02 15:08:06 - automatic
6
+ * @updatedAt 2025-01-02 15:08:07 - automatic
7
+ * @updatedUser cesar - automatic
8
+ */
9
+ root: ({ theme }) => ({
10
+ display: "flex",
11
+ flexDirection: "column",
12
+ alignItems: "flex-start",
13
+ color: theme.vars.palette.text.primary
14
+ }),
15
+ /**
16
+ * Skeleton container
17
+ * @author cesar - automatic
18
+ * @createdAt 2025-01-02 15:08:06 - automatic
19
+ * @updatedAt 2025-01-02 15:08:07 - automatic
20
+ * @updatedUser cesar - automatic
21
+ */
22
+ skeleton: ({ theme }) => ({
23
+ width: "100%",
24
+ background: theme.vars.palette.skeleton.transition
25
+ })
26
+ };
27
+ export {
28
+ periodFormatterStyles as p
29
+ };
@@ -0,0 +1 @@
1
+ export declare const PERIOD_FORMATTER_KEY_COMPONENT = "M4LPeriodFormatter";
@@ -0,0 +1,4 @@
1
+ const PERIOD_FORMATTER_KEY_COMPONENT = "M4LPeriodFormatter";
2
+ export {
3
+ PERIOD_FORMATTER_KEY_COMPONENT as P
4
+ };
@@ -8,14 +8,11 @@ export declare const dictionary: {
8
8
  LABEL_DAY: string;
9
9
  };
10
10
  /**
11
- * TODO: Documentar
11
+ * Returns the dictionary of the formatters components
12
+ * @author cesar - automatic
13
+ * @createdAt 2025-01-02 15:08:06 - automatic
14
+ * @updatedAt 2025-01-02 15:08:07 - automatic
15
+ * @updatedUser cesar - automatic
12
16
  */
13
- export declare function getFormattersComponentsDictionary(): {
14
- LABEL_YEARS: string;
15
- LABEL_YEAR: string;
16
- LABEL_MONTHS: string;
17
- LABEL_MONTH: string;
18
- LABEL_DAYS: string;
19
- LABEL_DAY: string;
20
- };
17
+ export declare function getFormattersComponentsDictionary(): string[];
21
18
  export declare const PERIOD_FORMATTER_DICTIONARY_LABELS: string[];
@@ -0,0 +1,4 @@
1
+ export declare enum PeriodFormatterSlots {
2
+ root = "root",
3
+ skeleton = "skeleton"
4
+ }
@@ -0,0 +1,8 @@
1
+ var PeriodFormatterSlots = /* @__PURE__ */ ((PeriodFormatterSlots2) => {
2
+ PeriodFormatterSlots2["root"] = "root";
3
+ PeriodFormatterSlots2["skeleton"] = "skeleton";
4
+ return PeriodFormatterSlots2;
5
+ })(PeriodFormatterSlots || {});
6
+ export {
7
+ PeriodFormatterSlots as P
8
+ };
@@ -0,0 +1,2 @@
1
+ export declare const PeriodFormatterRootStyled: 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>, {}, {}>;
2
+ export declare const PeriodFormatterSkeletonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../mui_extended/Skeleton/types').SkeletonProps, keyof import('../../../mui_extended/Skeleton/types').SkeletonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
@@ -0,0 +1,18 @@
1
+ import { P as PERIOD_FORMATTER_KEY_COMPONENT } from "../constants.js";
2
+ import { p as periodFormatterStyles } from "../PeriodFormatter.styles.js";
3
+ import { P as PeriodFormatterSlots } from "./PeriodFomatterEnum.js";
4
+ import { styled } from "@mui/material/styles";
5
+ import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
6
+ import { S as Skeleton } from "../../../mui_extended/Skeleton/Skeleton.js";
7
+ const PeriodFormatterRootStyled = styled(Typography, {
8
+ name: PERIOD_FORMATTER_KEY_COMPONENT,
9
+ slot: PeriodFormatterSlots.root
10
+ })(periodFormatterStyles?.root);
11
+ const PeriodFormatterSkeletonStyled = styled(Skeleton, {
12
+ name: PERIOD_FORMATTER_KEY_COMPONENT,
13
+ slot: PeriodFormatterSlots.skeleton
14
+ })(periodFormatterStyles?.skeleton);
15
+ export {
16
+ PeriodFormatterSkeletonStyled as P,
17
+ PeriodFormatterRootStyled as a
18
+ };
@@ -0,0 +1,2 @@
1
+ export * from './PeriodFomatterEnum';
2
+ export * from './PeriodFormatterSlots';
@@ -1,13 +1,33 @@
1
1
  import { ElementType } from 'react';
2
+ import { PeriodFormatterSlots, PeriodFormatterRootStyled } from './slots';
3
+ import { OverridesStyleRules } from '@mui/material/styles/overrides';
4
+ import { PERIOD_FORMATTER_KEY_COMPONENT } from './constants';
5
+ import { Theme } from '@mui/material';
6
+ import { Sizes } from '@m4l/styles';
7
+ export type PeriodFormatterType = keyof typeof PeriodFormatterSlots;
2
8
  /**
3
9
  * Component: Tipo de componente HTML que "abraza" el resultado
4
10
  * years: Cantidad de años
5
11
  * months: Cantidad de meses
6
12
  * days: Cantidad de días
7
13
  */
8
- export interface PeriodFormatterProps {
14
+ export interface PeriodFormatterProps<T extends ElementType = typeof PeriodFormatterRootStyled> {
9
15
  years?: number;
10
16
  months?: number;
11
17
  days?: number;
12
- Component?: ElementType;
18
+ Component?: T;
19
+ dataTestId?: string;
20
+ className?: string;
21
+ /**
22
+ * Props para el componente personalizado.
23
+ */
24
+ componentProps?: React.ComponentPropsWithoutRef<T>;
25
+ /**
26
+ * Opciones de tamaño del componente.
27
+ */
28
+ size?: Extract<Sizes, 'small' | 'medium'>;
13
29
  }
30
+ /**
31
+ * Estilos personalizados para el componente PeriodFormatter.
32
+ */
33
+ export type PeriodFormatterStyles = OverridesStyleRules<PeriodFormatterType, typeof PERIOD_FORMATTER_KEY_COMPONENT, Theme>;
@@ -3,7 +3,7 @@ export { useFormatDate as getFormatDate, DateFormatter } from './DateFormatter';
3
3
  export { UncertaintyFormatter, getUncertaintyFormat } from './UncertaintyFormatter';
4
4
  export { PointsFormatter, getFormatPoints } from './PointsFormatter';
5
5
  export { getFormatConcatenated, ConcatenatedFormatter } from './ConcatenatedFormatter';
6
- export { useFormatPeriod, PeriodFormatter } from './PeriodFormatter';
6
+ export { useFormatPeriod, PeriodFormatter } from './PeriodFormatter/PeriodFormatter';
7
7
  export { PriceFormatter, getFormatPrice } from './PriceFormatter';
8
8
  export * from './DistanceToNowFormatter';
9
9
  export type { UncertaintyRange } from './UncertaintyFormatter/types';