@m4l/components 9.1.89 → 9.1.91

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 (42) hide show
  1. package/@types/types.d.ts +10 -0
  2. package/components/Pager/Pager.d.ts +1 -1
  3. package/components/Pager/Pager.js +10 -7
  4. package/components/Pager/dicctionary.d.ts +1 -0
  5. package/components/Pager/dicctionary.js +2 -1
  6. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.d.ts +1 -1
  7. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +13 -7
  8. package/components/Pager/subcomponents/CustomTablePagination/types.d.ts +38 -1
  9. package/components/Pager/subcomponents/PagerActions/PagerActions.d.ts +2 -2
  10. package/components/Pager/types.d.ts +13 -0
  11. package/components/index.d.ts +1 -1
  12. package/components/mui_extended/NavLink/NavLink.d.ts +9 -0
  13. package/components/mui_extended/NavLink/NavLink.js +68 -0
  14. package/components/mui_extended/NavLink/NavLink.styles.d.ts +2 -0
  15. package/components/mui_extended/NavLink/NavLink.styles.js +85 -0
  16. package/components/mui_extended/NavLink/constants.d.ts +14 -0
  17. package/components/mui_extended/NavLink/constants.js +10 -0
  18. package/components/mui_extended/NavLink/slots/NavLinkEnum.d.ts +6 -0
  19. package/components/mui_extended/NavLink/slots/NavLinkEnum.js +10 -0
  20. package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +12 -0
  21. package/components/mui_extended/NavLink/slots/NavLinkSlots.js +29 -0
  22. package/components/mui_extended/NavLink/slots/index.d.ts +0 -0
  23. package/components/mui_extended/NavLink/tests/NavLink.test.d.ts +1 -0
  24. package/components/mui_extended/NavLink/types.d.ts +36 -0
  25. package/index.js +1 -1
  26. package/package.json +1 -1
  27. package/components/NavLink/NavLink.d.ts +0 -9
  28. package/components/NavLink/NavLink.js +0 -32
  29. package/components/NavLink/classes/constant.d.ts +0 -1
  30. package/components/NavLink/classes/constant.js +0 -4
  31. package/components/NavLink/classes/index.d.ts +0 -9
  32. package/components/NavLink/classes/index.js +0 -23
  33. package/components/NavLink/classes/types.d.ts +0 -4
  34. package/components/NavLink/styles.d.ts +0 -1
  35. package/components/NavLink/styles.js +0 -7
  36. package/components/NavLink/tests/constants.d.ts +0 -1
  37. package/components/NavLink/tests/constants.js +0 -4
  38. package/components/NavLink/tests/utils.d.ts +0 -2
  39. package/components/NavLink/tests/utils.js +0 -7
  40. package/components/NavLink/types.d.ts +0 -5
  41. /package/components/{NavLink → mui_extended/NavLink}/index.d.ts +0 -0
  42. /package/components/{NavLink → mui_extended/NavLink}/index.js +0 -0
package/@types/types.d.ts CHANGED
@@ -141,11 +141,14 @@ import { RHFAutocompleteOwnerState, RHFAutocompleteSlotsType } from '../componen
141
141
  import { PropagateLoaderSpinnerOwnerState, PropagateLoaderSpinnerType } from '../components/extended/React-Spinners/PropagateLoaderSpinner/types';
142
142
  import { LinearProgressIndeterminateOwnerState, LinearProgressIndeterminateType } from '../components/LinearProgressIndeterminate/types';
143
143
  import { MenuDividerOwnerState, MenuDividerSlotsType } from '../components/mui_extended/MenuDivider/types';
144
+ import { NavLinkOwnerState, NavLinkSlotsType } from '../components/mui_extended/NavLink/types';
145
+
144
146
  import { RHFSelectSlotsType, RHFSelectOwnerState } from '../components/hook-form/RHFSelect/types';
145
147
  import { RHFCheckBoxOwnerState, RHFCheckBoxSlotsType } from '../components/hook-form/RHFCheckbox/types';
146
148
  import { DateTimePickerOwnerState, DateTimePickerSlotsType } from '../components/mui_extended/DateTimePicker/types';
147
149
  import { DividerOwnerState, DividerSlotsType } from '../components/mui_extended/Divider/types';
148
150
 
151
+
149
152
  declare module '@mui/material/styles' {
150
153
  // Define the slots in the theme
151
154
  interface ComponentNameToClassKey {
@@ -203,6 +206,7 @@ declare module '@mui/material/styles' {
203
206
  M4LRHFTextFieldPassword: RHFTextFieldPasswordType;
204
207
  M4LLinearProgressIndeterminate: LinearProgressIndeterminateType;
205
208
  M4LMenuDivider: MenuDividerSlotsType;
209
+ M4LNavLink: NavLinkSlotsType;
206
210
  M4LRHFSelect: RHFSelectSlotsType;
207
211
  M4LDateTimePicker: DateTimePickerSlotsType;
208
212
  M4LDivider: DividerSlotsType;
@@ -264,6 +268,7 @@ declare module '@mui/material/styles' {
264
268
  M4LRHFTextFieldPassword: Partial<RHFTextFieldPasswordOwnerState>;
265
269
  M4LLinearProgressIndeterminate: Partial<LinearProgressIndeterminateOwnerState>;
266
270
  M4LMenuDivider: Partial<MenuDividerOwnerState>;
271
+ M4LNavLink: Partial<NavLinkOwnerState>;
267
272
  M4LRHFSelect: Partial<RHFSelectOwnerState>;
268
273
  M4LDateTimePicker: Partial<DateTimePickerOwnerState>;
269
274
  M4LDivider: Partial<DividerOwnerState>;
@@ -540,6 +545,11 @@ declare module '@mui/material/styles' {
540
545
  styleOverrides?: ComponentsOverrides<Theme>['M4LMenuDivider'];
541
546
  variants?: ComponentsVariants['M4LMenuDivider'];
542
547
  };
548
+ M4LNavLink?: {
549
+ defaultProps?: ComponentsPropsList['M4LNavLink'];
550
+ styleOverrides?: ComponentsOverrides<Theme>['M4LNavLink'];
551
+ variants?: ComponentsVariants['M4LNavLink'];
552
+ };
543
553
 
544
554
  M4LRHFSelect?: {
545
555
  defaultProps?: ComponentsPropsList['M4LRHFSelect'];
@@ -48,7 +48,7 @@ import { PagerProps } from './types';
48
48
  * ```
49
49
  * @author cesar - automatic
50
50
  * @createdAt 2025-01-15 17:01:04 - automatic
51
- * @updatedAt 2025-01-21 15:32:35 - automatic
51
+ * @updatedAt 2025-01-29 08:56:53 - automatic
52
52
  * @updatedUser cesar - automatic
53
53
  */
54
54
  export declare function Pager(props: PagerProps): import("react/jsx-runtime").JSX.Element;
@@ -13,8 +13,8 @@ function Pager(props) {
13
13
  page = 0,
14
14
  onPageChange,
15
15
  onRowsPerPageChange,
16
- labelRows = "Filas por página",
17
- labelOf = "de",
16
+ labelRows,
17
+ labelOf,
18
18
  size = "medium"
19
19
  } = props;
20
20
  const totalPages = useMemo(() => Math.max(1, Math.ceil(totalRecords / rowsPerPage)), [totalRecords, rowsPerPage]);
@@ -24,9 +24,12 @@ function Pager(props) {
24
24
  const currentPage = useMemo(() => {
25
25
  return Math.max(0, Math.min(page, totalPages - 1));
26
26
  }, [page, totalPages]);
27
- const formattedLabelDisplayedRows = useMemo(() => {
28
- return totalRecords === 0 ? `${getLabel(PAGER_DICTIONARY.no_records)}` : `${getLabel(PAGER_DICTIONARY.page)} ${currentPage + 1} ${labelOf} ${totalPages}`;
29
- }, [currentPage, totalPages, labelOf, totalRecords, getLabel]);
27
+ const memoizedLabelOf = useMemo(() => {
28
+ return labelOf ?? getLabel(PAGER_DICTIONARY.of);
29
+ }, [labelOf, getLabel]);
30
+ const memoizedLabelTotalRows = useMemo(() => {
31
+ return labelRows ?? getLabel(PAGER_DICTIONARY.total_rows);
32
+ }, [labelRows, getLabel]);
30
33
  const handleChangeRowsPerPage = (option) => {
31
34
  if (onRowsPerPageChange && option.value !== void 0) {
32
35
  onRowsPerPageChange(option.value);
@@ -47,11 +50,11 @@ function Pager(props) {
47
50
  rowsPerPageOptions,
48
51
  count: totalRecords,
49
52
  rowsPerPage,
50
- labelRowsPerPage: labelRows,
51
53
  page: currentPage,
52
54
  onPageChange: handleChangePage,
53
55
  onRowsPerPageChange: handleChangeRowsPerPage,
54
- labelDisplayedRows: () => formattedLabelDisplayedRows
56
+ labelOf: memoizedLabelOf,
57
+ labelTotalRows: memoizedLabelTotalRows
55
58
  }
56
59
  ) });
57
60
  }
@@ -8,5 +8,6 @@ export declare const PAGER_DICTIONARY: {
8
8
  readonly page: "pager.page";
9
9
  readonly no_records: "pager.no_records";
10
10
  readonly total_rows: "pager.total_rows";
11
+ readonly rows: "pager.rows";
11
12
  };
12
13
  export declare function getPagerComponentsDictionary(): string[];
@@ -7,7 +7,8 @@ const PAGER_DICTIONARY = {
7
7
  of: "pager.of",
8
8
  page: "pager.page",
9
9
  no_records: "pager.no_records",
10
- total_rows: "pager.total_rows"
10
+ total_rows: "pager.total_rows",
11
+ rows: "pager.rows"
11
12
  };
12
13
  function getPagerComponentsDictionary() {
13
14
  return ["pager"];
@@ -3,7 +3,7 @@ import { CustomTablePaginationProps } from './types';
3
3
  * CustomTablePagination component
4
4
  * @author cesar - automatic
5
5
  * @createdAt 2025-01-15 17:13:29 - automatic
6
- * @updatedAt 2025-01-22 12:52:40 - automatic
6
+ * @updatedAt 2025-01-28 14:04:43 - automatic
7
7
  * @updatedUser cesar - automatic
8
8
  */
9
9
  export declare const CustomTablePagination: (props: CustomTablePaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,7 +13,9 @@ const CustomTablePagination = (props) => {
13
13
  rowsPerPageOptions = [10, 25, 50, 100],
14
14
  onRowsPerPageChange,
15
15
  onPageChange,
16
- size
16
+ size,
17
+ labelOf,
18
+ labelTotalRows
17
19
  } = props;
18
20
  const [localRowsPerPage, setLocalRowsPerPage] = useState(rowsPerPage);
19
21
  const [localPage, setLocalPage] = useState(Math.max(0, page));
@@ -32,13 +34,17 @@ const CustomTablePagination = (props) => {
32
34
  const currentPage = useMemo(() => {
33
35
  return Math.max(0, Math.min(localPage, totalPages - 1));
34
36
  }, [localPage, totalPages]);
37
+ const memoizedLabelPage = useMemo(() => getLabel(PAGER_DICTIONARY.page), [getLabel]);
38
+ const memoizedLabelRows = useMemo(() => getLabel(PAGER_DICTIONARY.rows), [getLabel]);
39
+ const memoizedLabelRowsPerPage = useMemo(() => getLabel(PAGER_DICTIONARY.rows_per_page), [getLabel]);
40
+ const memoizedLabelNoRecords = useMemo(() => getLabel(PAGER_DICTIONARY.no_records), [getLabel]);
35
41
  const formattedLabelDisplayedRows = useMemo(() => {
36
42
  if (countTotal === 0) {
37
- return `${getLabel(PAGER_DICTIONARY.no_records)}`;
43
+ return memoizedLabelNoRecords;
38
44
  }
39
45
  const displayedPage = currentPage === 1 ? 1 : currentPage + 1;
40
- return `${getLabel(PAGER_DICTIONARY.page)} ${displayedPage} ${getLabel(PAGER_DICTIONARY.of)} ${totalPages}`;
41
- }, [currentPage, totalPages, countTotal, getLabel]);
46
+ return `${memoizedLabelPage} ${displayedPage} ${labelOf} ${totalPages}`;
47
+ }, [currentPage, totalPages, countTotal, labelOf, memoizedLabelPage, memoizedLabelNoRecords]);
42
48
  const handleChangeRowsPerPage = (option) => {
43
49
  const selectedValue = Number(option.id);
44
50
  const newTotalPages = Math.ceil(countTotal / selectedValue);
@@ -46,7 +52,7 @@ const CustomTablePagination = (props) => {
46
52
  setLocalRowsPerPage(selectedValue);
47
53
  setLocalPage(newPage);
48
54
  if (onRowsPerPageChange) {
49
- onRowsPerPageChange({ id: selectedValue, value: selectedValue, label: `${selectedValue} filas` });
55
+ onRowsPerPageChange({ id: selectedValue, value: selectedValue, label: `${selectedValue} ${memoizedLabelRows}` });
50
56
  }
51
57
  if (onPageChange) {
52
58
  onPageChange(null, newPage);
@@ -54,9 +60,9 @@ const CustomTablePagination = (props) => {
54
60
  };
55
61
  return /* @__PURE__ */ jsxs(Fragment, { children: [
56
62
  rowsPerPageOptions?.length > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
57
- /* @__PURE__ */ jsx(TotalRowStyled, { skeletonWidth: 50, size, variant: "body", children: `${getLabel(PAGER_DICTIONARY.total_rows)}: ${countTotal}` }),
63
+ /* @__PURE__ */ jsx(TotalRowStyled, { skeletonWidth: 50, size, variant: "body", children: `${labelTotalRows}: ${countTotal}` }),
58
64
  /* @__PURE__ */ jsxs(LabelSelectContainerStyled, { children: [
59
- /* @__PURE__ */ jsx(RowsPerPageStyled, { skeletonWidth: 50, size, variant: "body", children: `${getLabel(PAGER_DICTIONARY.rows_per_page)}:` }),
65
+ /* @__PURE__ */ jsx(RowsPerPageStyled, { skeletonWidth: 50, size, variant: "body", children: `${memoizedLabelRowsPerPage}:` }),
60
66
  /* @__PURE__ */ jsx(
61
67
  Select,
62
68
  {
@@ -1,9 +1,46 @@
1
1
  import { LabelDisplayedRowsArgs, TablePaginationProps } from '@mui/material';
2
2
  import { selectOption } from '../../types';
3
3
  export type CustomTablePaginationProps = {
4
+ /**
5
+ * Label for the rows per page select.
6
+ * @deprecated Use `slotProps.select` instead.
7
+ * @createdAt 2025-01-27 15:42:54 - automatic
8
+ */
9
+ labelOf: string;
10
+ /**
11
+ * List of rows per page options.
12
+ * @author cesar - automatic
13
+ * @createdAt 2025-01-27 15:42:54 - automatic
14
+ * @updatedAt 2025-01-28 14:04:43 - automatic
15
+ * @updatedUser cesar - automatic
16
+ */
4
17
  rowsPerPageOptions: number[];
5
18
  onPageChange: (_event: unknown, newPage: number) => void;
6
- labelRowsPerPage: string;
19
+ /**
20
+ * Label rows per page.
21
+ * @deprecated Use `slotProps.select` instead.
22
+ * @createdAt 2025-01-27 15:42:54 - automatic
23
+ */
24
+ labelRowsPerPage?: string;
25
+ /**
26
+ * Label total rows.
27
+ * @createdAt 2025-01-27 17:28:22 - automatic
28
+ */
29
+ labelTotalRows?: string;
30
+ /**
31
+ * Total number of rows.
32
+ * @author cesar - automatic
33
+ * @createdAt 2025-01-27 15:42:54 - automatic
34
+ * @updatedAt 2025-01-28 14:04:43 - automatic
35
+ * @updatedUser cesar - automatic
36
+ */
7
37
  onRowsPerPageChange: (option: selectOption<number>) => void;
38
+ /**
39
+ * Labe displayed rows.
40
+ * @author cesar - automatic
41
+ * @createdAt 2025-01-27 15:42:54 - automatic
42
+ * @updatedAt 2025-01-28 14:04:43 - automatic
43
+ * @updatedUser cesar - automatic
44
+ */
8
45
  labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => string;
9
46
  } & Omit<TablePaginationProps, 'onPageChange' | 'onRowsPerPageChange' | 'ActionsComponent' | 'labelDisplayedRows'>;
@@ -1,9 +1,9 @@
1
1
  import { PagerActionsProps } from './types';
2
2
  /**
3
- * TODO: Documentar
3
+ * PagerActions component is a subcomponent of the Pager component that allows the user to navigate between different pages.
4
4
  * @author cesar - automatic
5
5
  * @createdAt 2025-01-15 17:13:29 - automatic
6
- * @updatedAt 2025-01-21 14:06:55 - automatic
6
+ * @updatedAt 2025-01-27 08:17:21 - automatic
7
7
  * @updatedUser cesar - automatic
8
8
  */
9
9
  export declare function PagerActions(props: PagerActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,20 @@ export interface PagerProps {
12
12
  page: number;
13
13
  onPageChange: (newPage: number) => void;
14
14
  onRowsPerPageChange: (newRowsPerPage: number) => void;
15
+ /**
16
+ * Label rows per page.
17
+ * @deprecated Use `slotProps.select` instead.
18
+ * @createdAt 2025-01-27 15:42:54 - automatic
19
+ * @author cesar - automatic
20
+ * @updatedAt 2025-01-27 15:51:21 - automatic
21
+ * @updatedUser cesar - automatic
22
+ */
15
23
  labelRows?: string;
24
+ /**
25
+ * Label for the rows per page select.
26
+ * @deprecated Use `slotProps.select` instead.
27
+ * @createdAt 2025-01-27 15:42:54 - automatic
28
+ */
16
29
  labelOf?: string;
17
30
  size?: Extract<Sizes, 'small' | 'medium'>;
18
31
  }
@@ -28,7 +28,7 @@ export * from './maps';
28
28
  export * from './modal';
29
29
  export * from './LoadingError';
30
30
  export * from './MFLoader';
31
- export { NavLink } from './NavLink';
31
+ export { NavLink } from './mui_extended/NavLink';
32
32
  export * from './NoItemSelected';
33
33
  export * from './NoItemSelected/dictionary';
34
34
  export * from './ObjectLogs';
@@ -0,0 +1,9 @@
1
+ import { NavLinkProps } from './types';
2
+ /**
3
+ * NavLink es un componente de presentación e interacción diseñado para facilitar la navegación dentro de una aplicación o sitio web.
4
+ * Este componente utiliza un texto o enlace visualmente destacado que permite a los usuarios acceder rápidamente a una página o sección de interés. Su diseño lo hace fácilmente identificable,
5
+ * lo que mejora la experiencia de usuario al proporcionar una interfaz clara e intuitiva.
6
+ * @param {NavLinkProps} props - Las propiedades del componente.
7
+ * @returns {JSX.Element} El componente NavLink renderizado.
8
+ */
9
+ export declare const NavLink: (props: NavLinkProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { R as RouterNavLinkRootStyled, a as RouterNavLinkStyled, T as TypographyStyled, S as SkeletonStyled } from "./slots/NavLinkSlots.js";
3
+ import { useModuleSkeleton } from "@m4l/core";
4
+ import { N as NAV_LINK_KEY_COMPONENT, c as classNavLinkRoot, a as NAV_LINK_SPECIFY } from "./constants.js";
5
+ import { N as NavLinkSlots } from "./slots/NavLinkEnum.js";
6
+ import { clsx } from "clsx";
7
+ import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
8
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
9
+ const NavLink = (props) => {
10
+ const {
11
+ children,
12
+ text,
13
+ size = "medium",
14
+ disabled,
15
+ skeletonWidth,
16
+ color,
17
+ dataTestId,
18
+ ...others
19
+ } = props;
20
+ const isSkeleton = useModuleSkeleton();
21
+ const { currentSize } = useComponentSize(size);
22
+ const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
23
+ const ownerState = {
24
+ disabled,
25
+ size
26
+ };
27
+ return /* @__PURE__ */ jsx(
28
+ RouterNavLinkRootStyled,
29
+ {
30
+ ownerState: {},
31
+ ...getPropDataTestId(NAV_LINK_KEY_COMPONENT, NavLinkSlots.root, dataTestId),
32
+ children: !isSkeleton ? /* @__PURE__ */ jsx(
33
+ RouterNavLinkStyled,
34
+ {
35
+ size: adjustedSize,
36
+ role: "link",
37
+ ownerState,
38
+ disabled,
39
+ "aria-disabled": disabled,
40
+ ...others,
41
+ children: ({ isActive }) => /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ /* @__PURE__ */ jsx(
43
+ TypographyStyled,
44
+ {
45
+ size: adjustedSize,
46
+ color,
47
+ disabled,
48
+ ownerState,
49
+ skeletonWidth,
50
+ className: clsx(
51
+ classNavLinkRoot,
52
+ NAV_LINK_SPECIFY,
53
+ "M4lclassCssSpecificity",
54
+ { active: isActive, inactive: !isActive }
55
+ ),
56
+ children: text
57
+ }
58
+ ),
59
+ typeof children === "function" ? children({ isActive }) : children
60
+ ] })
61
+ }
62
+ ) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: {}, variant: "rounded" }) })
63
+ }
64
+ );
65
+ };
66
+ export {
67
+ NavLink as N
68
+ };
@@ -0,0 +1,2 @@
1
+ import { NavLinkStyles } from './types';
2
+ export declare const navLinkStyles: NavLinkStyles;
@@ -0,0 +1,85 @@
1
+ import { g as getHeightSizeStyles } from "../../../utils/getHeightSizeStyles.js";
2
+ import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
3
+ const navLinkStyles = {
4
+ /** 🌳 Estilos para el componente raiz 🌳 */
5
+ root: () => ({}),
6
+ /** 🔠 Estilos para el componente Typography 🔠 */
7
+ typographyStyled: ({ ownerState, theme }) => ({
8
+ "&.MuiTypography-root": {
9
+ color: "inherit",
10
+ cursor: ownerState.disabled ? "not-allowed" : "inherit",
11
+ /** 🔠 Estilos para tamaños de la tipografia 🔠 */
12
+ ...getTypographyStyles(
13
+ theme.generalSettings.isMobile,
14
+ ownerState.size || "medium",
15
+ "body"
16
+ ),
17
+ ...getTypographyStyles(
18
+ theme.generalSettings.isMobile,
19
+ ownerState.size || "small",
20
+ "body"
21
+ )
22
+ }
23
+ }),
24
+ /** 💀 Estilo para el componente Skeleton 💀 */
25
+ skeletonStyled: ({ ownerState, theme }) => ({
26
+ "&.MuiSkeleton-root": {
27
+ "&.M4lclassCssSpecificity": {
28
+ width: "100px",
29
+ borderRadius: theme.vars.size.borderRadius.r1,
30
+ display: "flex",
31
+ padding: theme.vars.size.baseSpacings.sp1,
32
+ backgroundColor: theme.vars.palette.skeleton.transition,
33
+ /** ☠️ Estilos para tamaños del Skeleton ☠️ */
34
+ ...getHeightSizeStyles(
35
+ theme.generalSettings.isMobile,
36
+ ownerState.size || "medium",
37
+ "base"
38
+ ),
39
+ ...getHeightSizeStyles(
40
+ theme.generalSettings.isMobile,
41
+ ownerState.size || "small",
42
+ "base"
43
+ )
44
+ }
45
+ }
46
+ }),
47
+ /** 👻 Estilo para el componente RouterNavLink 👻 */
48
+ routerNavLinkStyled: ({ theme, ownerState }) => ({
49
+ /** 😶‍🌫️ Estilo Disabeld & Enabled para el componente RouterNavLink 😶‍🌫️ */
50
+ cursor: ownerState.disabled ? "not-allowed" : "pointer",
51
+ pointerEvents: ownerState.disabled ? "none" : "auto",
52
+ color: ownerState.disabled ? theme.vars.palette.text.disabled : theme.vars.palette.primary.enabled,
53
+ /** Estilo Hover para el componente RouterNavLink */
54
+ "&:hover": {
55
+ color: theme.vars.palette.primary.hover
56
+ },
57
+ /** Estilo para la clase active para el componente Typography hace la funcion de "Visited" 👌*/
58
+ "&.active": {
59
+ color: theme.vars.palette.primary.focus,
60
+ //Estado visitado del componente
61
+ "&:hover": {
62
+ color: theme.vars.palette.primary.hover
63
+ // Hover del Typography
64
+ },
65
+ "&.Mui-focusVisible, &:focus-visible": {
66
+ outline: `1px solid ${theme.vars.palette["primary"].focusVisible}`,
67
+ outlineOffset: 2
68
+ }
69
+ },
70
+ /** Estilo Active para el componente RouterNavLink */
71
+ "&:active": {
72
+ color: theme.vars.palette.primary.active
73
+ },
74
+ /** Estilo Focus-Visible para el componente RouterNavLink */
75
+ "&:focus-visible": {
76
+ color: theme.vars.palette.primary.focusVisible,
77
+ outline: `1px solid ${theme.vars.palette["primary"].focusVisible}`,
78
+ outlineOffset: 2,
79
+ borderRadius: theme.vars.size.borderRadius["r0-5"]
80
+ }
81
+ })
82
+ };
83
+ export {
84
+ navLinkStyles as n
85
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Clave de componente para el componente Label
3
+ */
4
+ export declare const NAV_LINK_KEY_COMPONENT = "M4LNavLink";
5
+ export declare const classLabelRoot: string;
6
+ /**
7
+ * Nombre de clase creado para aportar especificidad a los estilos del componente. Es usado para sobreescribir los estilos de MUI sin
8
+ * tener la necesidad de agregar valores en !important.
9
+ */
10
+ export declare const NAV_LINK_SPECIFY = "M4lclassCssSpecificity";
11
+ /**
12
+ * Inventario de clases CSS para el componente Typography.
13
+ */
14
+ export declare const classNavLinkRoot: Record<string, string>;
@@ -0,0 +1,10 @@
1
+ import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
2
+ import { N as NavLinkSlots } from "./slots/NavLinkEnum.js";
3
+ const NAV_LINK_KEY_COMPONENT = "M4LNavLink";
4
+ const NAV_LINK_SPECIFY = "M4lclassCssSpecificity";
5
+ const classNavLinkRoot = getComponentClasses(NAV_LINK_KEY_COMPONENT, NavLinkSlots);
6
+ export {
7
+ NAV_LINK_KEY_COMPONENT as N,
8
+ NAV_LINK_SPECIFY as a,
9
+ classNavLinkRoot as c
10
+ };
@@ -0,0 +1,6 @@
1
+ export declare enum NavLinkSlots {
2
+ root = "root",
3
+ typographyStyled = "typographyStyled",
4
+ skeletonStyled = "skeletonStyled",
5
+ routerNavLinkStyled = "routerNavLinkStyled"
6
+ }
@@ -0,0 +1,10 @@
1
+ var NavLinkSlots = /* @__PURE__ */ ((NavLinkSlots2) => {
2
+ NavLinkSlots2["root"] = "root";
3
+ NavLinkSlots2["typographyStyled"] = "typographyStyled";
4
+ NavLinkSlots2["skeletonStyled"] = "skeletonStyled";
5
+ NavLinkSlots2["routerNavLinkStyled"] = "routerNavLinkStyled";
6
+ return NavLinkSlots2;
7
+ })(NavLinkSlots || {});
8
+ export {
9
+ NavLinkSlots as N
10
+ };
@@ -0,0 +1,12 @@
1
+ export declare const RouterNavLinkRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
2
+ ownerState: Partial<import('../types').NavLinkOwnerState> & Record<string, unknown>;
3
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
4
+ export declare const TypographyStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Typography/types').TypographyProps, keyof import('../../Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
5
+ ownerState: Partial<import('../types').NavLinkOwnerState> & Record<string, unknown>;
6
+ }, {}, {}>;
7
+ export declare const SkeletonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Skeleton/types').SkeletonProps, keyof import('../../Skeleton/types').SkeletonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
8
+ ownerState: Partial<import('../types').NavLinkOwnerState> & Record<string, unknown>;
9
+ }, {}, {}>;
10
+ export declare const RouterNavLinkStyled: import('@emotion/styled').StyledComponent<Pick<import('react-router-dom').NavLinkProps & import('react').RefAttributes<HTMLAnchorElement>, keyof import('react').RefAttributes<HTMLAnchorElement> | keyof import('react-router-dom').NavLinkProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
11
+ ownerState: Partial<import('../types').NavLinkOwnerState> & Record<string, unknown>;
12
+ }, {}, {}>;
@@ -0,0 +1,29 @@
1
+ import { NavLink } from "react-router-dom";
2
+ import { styled } from "@mui/material/styles";
3
+ import { N as NavLinkSlots } from "./NavLinkEnum.js";
4
+ import { N as NAV_LINK_KEY_COMPONENT } from "../constants.js";
5
+ import { S as Skeleton } from "../../Skeleton/Skeleton.js";
6
+ import { n as navLinkStyles } from "../NavLink.styles.js";
7
+ import { T as Typography } from "../../Typography/Typography.js";
8
+ const RouterNavLinkRootStyled = styled("div", {
9
+ name: NAV_LINK_KEY_COMPONENT,
10
+ slot: NavLinkSlots.root
11
+ })(navLinkStyles?.root);
12
+ const TypographyStyled = styled(Typography, {
13
+ name: NAV_LINK_KEY_COMPONENT,
14
+ slot: NavLinkSlots.typographyStyled
15
+ })(navLinkStyles?.typographyStyled);
16
+ const SkeletonStyled = styled(Skeleton, {
17
+ name: NAV_LINK_KEY_COMPONENT,
18
+ slot: NavLinkSlots.skeletonStyled
19
+ })(navLinkStyles?.skeletonStyled);
20
+ const RouterNavLinkStyled = styled(NavLink, {
21
+ name: NAV_LINK_KEY_COMPONENT,
22
+ slot: NavLinkSlots.routerNavLinkStyled
23
+ })(navLinkStyles.routerNavLinkStyled);
24
+ export {
25
+ RouterNavLinkRootStyled as R,
26
+ SkeletonStyled as S,
27
+ TypographyStyled as T,
28
+ RouterNavLinkStyled as a
29
+ };
@@ -0,0 +1,36 @@
1
+ import { NavLinkProps as RouterNavLinkProps } from 'react-router-dom';
2
+ import { TypographyProps } from '../Typography/types';
3
+ import { ComponentPalletColor, Sizes } from '@m4l/styles';
4
+ import { NavLinkSlots } from './slots/NavLinkEnum';
5
+ import { M4LOverridesStyleRules } from '../../../@types/augmentations';
6
+ import { NAV_LINK_KEY_COMPONENT } from './constants';
7
+ import { Theme } from '@mui/material';
8
+ /**
9
+ * 💃 Propiedades del componente NavLink(NavLinkProps)💃.
10
+ */
11
+ export interface NavLinkProps extends RouterNavLinkProps, Pick<TypographyProps, 'skeletonWidth'> {
12
+ text: string;
13
+ /** Define el color del texto. Por defecto es 'primary'. */
14
+ color?: Exclude<ComponentPalletColor, 'primary'>;
15
+ /** Define el with of skeleton mode */
16
+ skeletonWidth?: string | number;
17
+ /** Define el tamaño de la etiqueta. Puede ser 'small' o 'medium'. Por defecto es 'medium'.*/
18
+ size?: Extract<Sizes, 'small' | 'medium'>;
19
+ /** Define el variant de la etiqueta. Por defecto es 'standard'. */
20
+ variant?: 'standard';
21
+ /** Indica si el campo de texto está deshabilitado. */
22
+ disabled?: boolean;
23
+ /** Estilos personalizados para el componente. */
24
+ dataTestId?: string;
25
+ }
26
+ /** Estado del propietario del NavLink.*/
27
+ export type NavLinkOwnerState = Pick<NavLinkProps, 'color'> & {
28
+ /** Indica si el NavLink está deshabilitado. */
29
+ disabled?: boolean;
30
+ /** Define el tamaño de la etiqueta. Puede ser 'small' o 'medium'. Por defecto es 'medium'.*/
31
+ size: Extract<Sizes, 'small' | 'medium'>;
32
+ /** Define el color de la paleta del componente. */
33
+ componentPaletteColor?: ComponentPalletColor;
34
+ };
35
+ export type NavLinkSlotsType = keyof typeof NavLinkSlots;
36
+ export type NavLinkStyles = M4LOverridesStyleRules<NavLinkSlotsType, typeof NAV_LINK_KEY_COMPONENT, Theme>;
package/index.js CHANGED
@@ -3,7 +3,7 @@ import { D } from "./components/DataGrid/index.js";
3
3
  import { g } from "./components/DataGrid/dictionary.js";
4
4
  import { N, T } from "./components/DataGrid/subcomponents/editors/TextEditor/index.js";
5
5
  import { g as g2 } from "./components/DataGrid/utils/getDataGridRowsFromSet.js";
6
- import { N as N2 } from "./components/NavLink/NavLink.js";
6
+ import { N as N2 } from "./components/mui_extended/NavLink/NavLink.js";
7
7
  import { S } from "./components/ScrollToTop/index.js";
8
8
  import { I } from "./components/Icon/Icon.js";
9
9
  import { I as I2 } from "./components/animate/IconButtonAnimate/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.89",
3
+ "version": "9.1.91",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
@@ -1,9 +0,0 @@
1
- import { NavLinkProps } from './types';
2
- /**
3
- * TODO: Documentar
4
- * @author Bruce Escobar - automatic
5
- * @createdAt 2024-10-22 09:41:31 - automatic
6
- * @updatedAt 2024-11-25 09:34:36 - automatic
7
- * @updatedUser cesar - automatic
8
- */
9
- export declare const NavLink: (props: NavLinkProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,32 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { NavLink as NavLink$1 } from "react-router-dom";
3
- import { u as useUtilityClasses } from "./classes/index.js";
4
- import { N as NavLinkRoot } from "./styles.js";
5
- import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
6
- import { g as getNameDataTestId } from "./tests/utils.js";
7
- import { T as Typography } from "../mui_extended/Typography/Typography.js";
8
- const NavLink = (props) => {
9
- const { children, text, skeletonWidth, ...others } = props;
10
- const classes = useUtilityClasses();
11
- return /* @__PURE__ */ jsx(
12
- NavLinkRoot,
13
- {
14
- className: classes.root,
15
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
16
- children: /* @__PURE__ */ jsxs(NavLink$1, { ...others, children: [
17
- /* @__PURE__ */ jsx(
18
- Typography,
19
- {
20
- variant: "body",
21
- skeletonWidth,
22
- children: text
23
- }
24
- ),
25
- typeof children === "function" ? children({ isActive: false }) : children
26
- ] })
27
- }
28
- );
29
- };
30
- export {
31
- NavLink as N
32
- };
@@ -1 +0,0 @@
1
- export declare const componentName = "M4LNavLink";
@@ -1,4 +0,0 @@
1
- const componentName = "M4LNavLink";
2
- export {
3
- componentName as c
4
- };
@@ -1,9 +0,0 @@
1
- import { NavLinkClassesType } from './types';
2
- export declare const navLinkClasses: NavLinkClassesType;
3
- export declare function getNavLinkClassesUtilityClass(slot: string): string;
4
- /**
5
- * TODO: Documentar
6
- */
7
- export declare const useUtilityClasses: () => {
8
- root: string;
9
- };
@@ -1,23 +0,0 @@
1
- import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
2
- import { unstable_composeClasses } from "@mui/base";
3
- import { c as componentName } from "./constant.js";
4
- generateUtilityClasses(componentName, [
5
- /* elements */
6
- "root"
7
- /* states or variants of elements */
8
- ]);
9
- function getNavLinkClassesUtilityClass(slot) {
10
- return generateUtilityClass(componentName, slot);
11
- }
12
- const useUtilityClasses = () => {
13
- const slots = {
14
- root: ["root"]
15
- };
16
- const composedClasses = unstable_composeClasses(slots, getNavLinkClassesUtilityClass, {});
17
- return {
18
- ...composedClasses
19
- };
20
- };
21
- export {
22
- useUtilityClasses as u
23
- };
@@ -1,4 +0,0 @@
1
- export interface NavLinkClassesType {
2
- root: string;
3
- }
4
- export type NavLinkClassesKey = keyof NavLinkClassesType;
@@ -1 +0,0 @@
1
- export declare const NavLinkRoot: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,7 +0,0 @@
1
- import { styled } from "@mui/material/styles";
2
- const NavLinkRoot = styled("div")(({ theme }) => ({
3
- ...theme.components?.M4LNavLink?.styleOverrides || {}
4
- }));
5
- export {
6
- NavLinkRoot as N
7
- };
@@ -1 +0,0 @@
1
- export declare const NAVLINK_PREFIX = "Navlink";
@@ -1,4 +0,0 @@
1
- const NAVLINK_PREFIX = "Navlink";
2
- export {
3
- NAVLINK_PREFIX as N
4
- };
@@ -1,2 +0,0 @@
1
- import { NavLinkClassesKey } from '../classes/types';
2
- export declare const getNameDataTestId: (KEY: NavLinkClassesKey) => string;
@@ -1,7 +0,0 @@
1
- import { N as NAVLINK_PREFIX } from "./constants.js";
2
- const getNameDataTestId = (KEY) => {
3
- return `${NAVLINK_PREFIX}-${KEY}`;
4
- };
5
- export {
6
- getNameDataTestId as g
7
- };
@@ -1,5 +0,0 @@
1
- import { NavLinkProps as RouterNavLinkProps } from 'react-router-dom';
2
- import { TypographyProps } from '../mui_extended/Typography/types';
3
- export interface NavLinkProps extends RouterNavLinkProps, Pick<TypographyProps, 'skeletonWidth'> {
4
- text: string;
5
- }