@m4l/components 9.1.70 → 9.1.71

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 (26) hide show
  1. package/components/Image/Image.js +8 -5
  2. package/components/Image/constant.d.ts +4 -0
  3. package/components/Image/constant.js +4 -0
  4. package/components/Image/image.styles.js +1 -1
  5. package/components/Image/slots/ImageEnum.d.ts +1 -1
  6. package/components/Image/slots/ImageEnum.js +1 -1
  7. package/components/Image/slots/ImageSlots.js +2 -2
  8. package/components/Image/types.d.ts +1 -0
  9. package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
  10. package/components/mui_extended/MenuItem/MenuItem.styles.js +13 -0
  11. package/components/mui_extended/Select/Select.d.ts +1 -1
  12. package/components/mui_extended/Select/Select.js +93 -96
  13. package/components/mui_extended/Select/Select.styles.js +94 -230
  14. package/components/mui_extended/Select/constants.d.ts +23 -0
  15. package/components/mui_extended/Select/constants.js +11 -1
  16. package/components/mui_extended/Select/dictionary.d.ts +4 -2
  17. package/components/mui_extended/Select/dictionary.js +7 -0
  18. package/components/mui_extended/Select/slots/SelectEnum.d.ts +12 -7
  19. package/components/mui_extended/Select/slots/SelectEnum.js +14 -7
  20. package/components/mui_extended/Select/slots/SelectSlots.d.ts +15 -9
  21. package/components/mui_extended/Select/slots/SelectSlots.js +31 -20
  22. package/components/mui_extended/Select/slots/index.js +1 -0
  23. package/components/mui_extended/Select/types.d.ts +41 -29
  24. package/components/mui_extended/TextField/TextField.js +1 -1
  25. package/package.json +1 -1
  26. /package/components/mui_extended/Select/{Select.test.d.ts → test/Select.test.d.ts} +0 -0
@@ -1,37 +1,46 @@
1
1
  import { Select } from "@mui/material";
2
2
  import { styled } from "@mui/material/styles";
3
- import { S as SELECT_KEY_COMPONENT } from "../constants.js";
3
+ import { a as SELECT_KEY_COMPONENT } from "../constants.js";
4
4
  import { s as selectStyles } from "../Select.styles.js";
5
5
  import { S as SelectSlots } from "./SelectEnum.js";
6
6
  import { I as IconButton } from "../../IconButton/IconButton.js";
7
7
  import { S as Skeleton } from "../../Skeleton/Skeleton.js";
8
8
  import { T as Typography } from "../../Typography/Typography.js";
9
+ import { I as Icon } from "../../../Icon/Icon.js";
9
10
  import { M as MenuItem } from "../../MenuItem/MenuItem.js";
10
11
  const SelectRootStyled = styled(Select, {
11
12
  name: SELECT_KEY_COMPONENT,
12
- slot: SelectSlots.selectRoot
13
- })(selectStyles?.selectRoot);
14
- const IconButtonStyled = styled(IconButton, {
13
+ slot: SelectSlots.root
14
+ })(selectStyles?.root);
15
+ const AdormentStyled = styled(Icon, {
15
16
  name: SELECT_KEY_COMPONENT,
16
- slot: SelectSlots.iconButton
17
- })(selectStyles?.iconButton);
18
- const MenuItemSelectStyled = styled(MenuItem, {
17
+ slot: SelectSlots.adorment
18
+ })(selectStyles?.adorment);
19
+ const MenuItemListStyled = styled(MenuItem, {
19
20
  name: SELECT_KEY_COMPONENT,
20
- slot: SelectSlots.menuItemSelect
21
- })(selectStyles?.menuItemSelect);
21
+ slot: SelectSlots.menuItemList
22
+ })(selectStyles?.menuItemList);
23
+ const MenuItemNoOptionStyled = styled(MenuItem, {
24
+ name: SELECT_KEY_COMPONENT,
25
+ slot: SelectSlots.menuItemNoOptions
26
+ })(selectStyles?.menuItemNoOptions);
22
27
  const SkeletonSelectStyled = styled(Skeleton, {
23
28
  name: SELECT_KEY_COMPONENT,
24
29
  slot: SelectSlots.skeletonSelect
25
30
  })(selectStyles?.skeletonSelect);
26
- const RenderOptionContainerStyled = styled("div", {
31
+ const RenderValueContainerStyled = styled("div", {
32
+ name: SELECT_KEY_COMPONENT,
33
+ slot: SelectSlots.renderValueContainer
34
+ })(selectStyles?.renderValueContainer);
35
+ const ArrowDownStyled = styled(IconButton, {
27
36
  name: SELECT_KEY_COMPONENT,
28
- slot: SelectSlots.renderOptionContainer
29
- })(selectStyles?.renderOptionContainer);
30
- styled("div", {
37
+ slot: SelectSlots.arrowDown
38
+ })(selectStyles?.arrowDown);
39
+ const RenderValueTypography = styled(Typography, {
31
40
  name: SELECT_KEY_COMPONENT,
32
- slot: SelectSlots.menuOptions
33
- })(selectStyles?.menuOptions);
34
- const LabelOptionStyled = styled(Typography, {
41
+ slot: SelectSlots.renderValueTypography
42
+ })(selectStyles?.renderValueTypography);
43
+ styled(Typography, {
35
44
  name: SELECT_KEY_COMPONENT,
36
45
  slot: SelectSlots.labelOption
37
46
  })(selectStyles?.labelOption);
@@ -40,11 +49,13 @@ const LabelPlaceholerStyled = styled(Typography, {
40
49
  slot: SelectSlots.labelPlaceholer
41
50
  })(selectStyles?.labelPlaceholer);
42
51
  export {
43
- IconButtonStyled as I,
52
+ ArrowDownStyled as A,
44
53
  LabelPlaceholerStyled as L,
45
- MenuItemSelectStyled as M,
46
- RenderOptionContainerStyled as R,
54
+ MenuItemListStyled as M,
55
+ RenderValueContainerStyled as R,
47
56
  SkeletonSelectStyled as S,
48
57
  SelectRootStyled as a,
49
- LabelOptionStyled as b
58
+ MenuItemNoOptionStyled as b,
59
+ AdormentStyled as c,
60
+ RenderValueTypography as d
50
61
  };
@@ -1,9 +1,10 @@
1
- import { ComponentPalletColor, Sizes } from '@m4l/styles';
1
+ import { Sizes } from '@m4l/styles';
2
2
  import { PaletteColor, Theme } from '@mui/material';
3
3
  import { SelectProps as MUISelectProps } from '@mui/material/Select';
4
- import { OverridesStyleRules } from '@mui/material/styles/overrides';
5
4
  import { SELECT_KEY_COMPONENT } from './constants';
6
5
  import { SelectSlots } from './slots';
6
+ import { M4LOverridesStyleRules } from 'src/@types/augmentations';
7
+ import { default as React } from 'react';
7
8
  /**
8
9
  * Representa una opción dentro del Select.
9
10
  * id - Identificador único de la opción. Puede ser número o string.
@@ -11,52 +12,63 @@ import { SelectSlots } from './slots';
11
12
  * [icon] - (Opcional) URL del ícono asociado a la opción.
12
13
  * @createdAt 2024-10-22 10:30:26 - automatic
13
14
  */
14
- export type selectOption = {
15
- id: string;
15
+ export type selectOption<T = unknown> = {
16
+ id: T;
16
17
  label: string;
17
- startAdornment?: string;
18
- endAdornment?: string;
18
+ startAdornment?: React.ReactNode;
19
19
  };
20
20
  /**
21
21
  * Propiedades que acepta el componente `Select`, extendiendo las propiedades de Material-UI `SelectProps`.
22
- * [id] - Identificador opcional del componente.
23
- * [size] - Tamaño del Select, valores posibles: 'small', 'medium', etc.
24
- * [src] - Fuente opcional, si es aplicable.
25
- * options - Array de opciones que recibirá el Select.
26
- * value - Valor o valores seleccionados.
27
- * onChange - Función que se ejecuta al cambiar la selección.
28
- * [multiple] - Define si el Select es de selección múltiple.
29
- * [disabled] - Establece si el Select está deshabilitado.
30
- * [error] - Define si el Select está en estado de error.
31
- * [componentPaletteColor] - Personaliza el color del componente.
32
- * [color] - Define el color del Select.
33
- * variant - Variante del Select.
34
22
  * @author Bruce Escobar - automatic
35
23
  * @createdAt 2024-10-22 10:30:26 - automatic
36
24
  * @updatedAt 2025-01-03 11:42:15 - automatic
37
25
  * @updatedUser Andrés Quintero - automatic
38
26
  */
39
- export interface SelectProps extends Omit<MUISelectProps, 'size' | 'onChange' | 'value' | 'error' | 'variant' | 'color'> {
40
- id?: string;
27
+ export interface SelectProps<T> extends Omit<MUISelectProps<T>, 'size' | 'onChange' | 'error' | 'variant' | 'color'> {
28
+ /**
29
+ * Lista de opciones para enseñar en el Select.
30
+ */
31
+ options: selectOption<T>[];
32
+ /**
33
+ * Tamaño del Select.
34
+ */
41
35
  size?: Extract<Sizes, 'small' | 'medium'>;
42
- src?: string;
43
- options: Array<selectOption>;
44
- value: number | string | string[] | number[];
45
- onChange: (options: selectOption | selectOption[]) => void;
36
+ /**
37
+ * procedimiento para ejecutarse cuando cabia la selección.
38
+ */
39
+ onChange?: (option: selectOption<T>) => void;
40
+ /**
41
+ * Define si el Select está deshabilitado.
42
+ */
46
43
  disabled?: boolean;
44
+ /**
45
+ * Define si el Select está en estado de error.
46
+ */
47
47
  error?: boolean;
48
+ /**
49
+ * Enseña un texto de guia en el Select.
50
+ */
48
51
  placeholder?: string;
49
- color?: Extract<ComponentPalletColor, 'default'>;
50
- variant: 'text' | 'outlined';
52
+ /**
53
+ * Variaciones de apariecia del Select.
54
+ */
55
+ variant?: 'text' | 'outlined';
56
+ /**
57
+ * Classes personalizadas.
58
+ */
51
59
  className?: string;
60
+ /**
61
+ * Identificador único del componente, para pruebas automatizadas.
62
+ */
63
+ dataTestId?: string;
52
64
  }
53
65
  /**
54
66
  * Propiedades internas que definen el estado del componente `Select`.
55
67
  * paletteColor - Color de la paleta aplicado al Select.
56
68
  */
57
- export interface SelectOwnerState extends Pick<SelectProps, 'classes' | 'size' | 'error' | 'color' | 'variant' | 'disabled'> {
58
- dissabled?: boolean;
69
+ export interface SelectOwnerState extends Pick<SelectProps<unknown>, 'classes' | 'size' | 'error' | 'variant' | 'disabled'> {
59
70
  paletteColor: PaletteColor;
71
+ disabled?: boolean;
60
72
  }
61
73
  /**
62
74
  * Define los tipos de slots disponibles en el Select.
@@ -65,4 +77,4 @@ export type SelectSlotsType = keyof typeof SelectSlots;
65
77
  /**
66
78
  * Estilos aplicables al componente Select.
67
79
  */
68
- export type SelectStyles = Partial<OverridesStyleRules<SelectSlotsType, typeof SELECT_KEY_COMPONENT, Theme>>;
80
+ export type SelectStyles = M4LOverridesStyleRules<SelectSlotsType, typeof SELECT_KEY_COMPONENT, Theme>;
@@ -49,7 +49,7 @@ const TextField = forwardRef(function TextField2(props, ref) {
49
49
  {
50
50
  ref,
51
51
  ownerState: { ...ownerState },
52
- className: clsx(TEXT_FIELD_CLASSES.root, TEXT_FIELD_CLASSES.variant, className),
52
+ className: clsx(TEXT_FIELD_CLASSES.root, TEXT_FIELD_CLASSES[variant], className),
53
53
  ...getPropDataTestId(TEXT_FIELD_KEY_COMPONENT, TextFieldSlots.root, dataTestId),
54
54
  autoComplete,
55
55
  value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.70",
3
+ "version": "9.1.71",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"