@m4l/components 9.3.20 → 9.3.21-JAEBeta.1

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 (91) hide show
  1. package/@types/types.d.ts +1 -1
  2. package/components/Chip/Chip.js +9 -7
  3. package/components/Chip/ChipStyles.js +4 -31
  4. package/components/Chip/helpers.d.ts +10 -0
  5. package/components/Chip/helpers.js +34 -0
  6. package/components/Chip/types.d.ts +6 -0
  7. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
  8. package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
  9. package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
  10. package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
  11. package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
  12. package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
  13. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
  14. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
  15. package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
  16. package/components/DragResizeWindowRND/index.d.ts +1 -0
  17. package/components/DragResizeWindowRND/types.d.ts +12 -2
  18. package/components/DynamicFilter/DynamicFilter.js +2 -1
  19. package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
  20. package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
  21. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
  22. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
  23. package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
  24. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
  25. package/components/DynamicFilter/types.d.ts +4 -0
  26. package/components/DynamicSort/DynamicSort.js +2 -1
  27. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
  28. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
  29. package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
  30. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
  31. package/components/DynamicSort/types.d.ts +4 -0
  32. package/components/Image/Image.js +4 -1
  33. package/components/MFLoader/MFLoader.js +8 -3
  34. package/components/MFLoader/styles.js +1 -1
  35. package/components/MFLoader/types.d.ts +10 -0
  36. package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
  37. package/components/WindowBase/WindowBase.js +3 -3
  38. package/components/WindowBase/WindowBase.styles.js +36 -31
  39. package/components/WindowBase/constants.d.ts +1 -1
  40. package/components/WindowBase/constants.js +2 -2
  41. package/components/WindowBase/index.d.ts +1 -0
  42. package/components/WindowBase/subcomponents/Component/index.js +2 -2
  43. package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
  44. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
  45. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  46. package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +4 -0
  47. package/components/WindowBase/types.d.ts +3 -3
  48. package/components/WindowConfirm/WindowConfirm.js +1 -1
  49. package/components/areas/components/AreasViewer/AreasViewer.styles.js +1 -1
  50. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +6 -2
  51. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
  52. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +21 -3
  53. package/components/areas/contexts/AreasContext/store.js +2 -2
  54. package/components/areas/index.d.ts +1 -1
  55. package/components/areas/types.d.ts +1 -1
  56. package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
  57. package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
  58. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
  59. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
  60. package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
  61. package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
  62. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +5 -1
  63. package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
  64. package/components/hook-form/RHFAutocomplete/constants.js +5 -1
  65. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +3 -1
  66. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
  67. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  68. package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
  69. package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
  70. package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
  71. package/components/mui_extended/index.d.ts +1 -1
  72. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
  73. package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
  74. package/components/popups/components/PopupsViewer/PopupsViewer.js +4 -3
  75. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +5 -2
  76. package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +5 -0
  77. package/components/popups/components/PopupsViewer/types.d.ts +3 -0
  78. package/hooks/index.d.ts +1 -0
  79. package/hooks/useSizeContainer/index.d.ts +2 -1
  80. package/hooks/useSizeContainer/index.js +22 -13
  81. package/hooks/useSizeContainer/types.d.ts +6 -0
  82. package/hooks/useStateRef/index.d.ts +1 -1
  83. package/hooks/useStateRef/index.js +6 -6
  84. package/index.js +45 -38
  85. package/package.json +1 -2
  86. package/utils/deepShallow.d.ts +17 -0
  87. package/utils/deepShallow.js +76 -0
  88. package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
  89. package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
  90. package/utils/formatDistanceToNow/types.d.ts +13 -0
  91. package/utils/index.d.ts +1 -0
@@ -30,7 +30,8 @@ const Window = (props) => {
30
30
  dynamicMFStore,
31
31
  windowTools,
32
32
  onTouch,
33
- memoizedActions
33
+ memoizedActions,
34
+ loggedUser
34
35
  } = useWindow(windowId, areaId);
35
36
  const maximizedId = useAreasStore(
36
37
  (state) => areaId ? state.hashAreas[areaId]?.maximizedId : void 0,
@@ -67,7 +68,7 @@ const Window = (props) => {
67
68
  selected,
68
69
  maximized: !!maximizedId,
69
70
  onMouseDown: onTouch,
70
- type: emergeType,
71
+ emergeType,
71
72
  collapsed,
72
73
  ...process.env.NODE_ENV !== "production" ? {
73
74
  [TEST_PROP_ID]: getNameDataTestId(
@@ -79,14 +80,17 @@ const Window = (props) => {
79
80
  children: status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
80
81
  MemonizedWindowBaseMicroFrontend,
81
82
  {
83
+ emergeType,
82
84
  moduleId,
83
85
  dynamicMFStore,
84
86
  windowTools,
87
+ loggedUser,
85
88
  ...mfProps
86
89
  }
87
90
  ) : /* @__PURE__ */ jsx(
88
91
  WindowBaseComponent,
89
92
  {
93
+ emergeType,
90
94
  dynamicMFStore,
91
95
  windowTools,
92
96
  component
@@ -31,4 +31,5 @@ export declare const useWindow: (windowId: string, areaId?: string) => {
31
31
  windowTools: WindowToolsMF;
32
32
  onTouch: () => void;
33
33
  memoizedActions: import('../../../../../../../../WindowBase/types').WindowBaseAction[];
34
+ loggedUser: import('@m4l/core').Maybe<import('@m4l/core').UserAuth>;
34
35
  };
@@ -3,9 +3,25 @@ import { shallow } from "zustand/shallow";
3
3
  import { u as useAreasStore } from "../../../../../../../hooks/useAreas/index.js";
4
4
  import { u as useHeaderActions } from "./useHeaderActions.js";
5
5
  import { u as usePopupsStore } from "../../../../../../../../popups/components/PopupsProvider/hooks/usePopupsStore.js";
6
+ import { useAuth } from "@m4l/core";
6
7
  import { c as createToaster } from "../../../../../../../../ToastContainer/helpers/toaster.js";
7
8
  const useWindow = (windowId, areaId) => {
8
- const [emergeType, moduleId, winType, title, subTitle, editionInfo, iconUrl, version, buildTime, moduleCount, selected, loading, status, dynamicMFStore] = useAreasStore((state) => {
9
+ const [
10
+ emergeType,
11
+ moduleId,
12
+ winType,
13
+ title,
14
+ subTitle,
15
+ editionInfo,
16
+ iconUrl,
17
+ version,
18
+ buildTime,
19
+ moduleCount,
20
+ selected,
21
+ loading,
22
+ status,
23
+ dynamicMFStore
24
+ ] = useAreasStore((state) => {
9
25
  const window = state.hashWindows[windowId];
10
26
  const selected2 = areaId ? state.hashAreas[areaId]?.currentLayoutId === windowId : false;
11
27
  return [
@@ -26,6 +42,7 @@ const useWindow = (windowId, areaId) => {
26
42
  ];
27
43
  }, shallow);
28
44
  const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
45
+ const { user: loggedUser } = useAuth();
29
46
  const component = useAreasStore(
30
47
  (state) => state.hashWindows[windowId]?.component,
31
48
  shallow
@@ -66,7 +83,7 @@ const useWindow = (windowId, areaId) => {
66
83
  throw new Error("show not implemented");
67
84
  }
68
85
  }),
69
- [windowId, version, setActions, getCookie, getCookies, setCookie, close, startProgress, stopProgress, setFnQueryClose, setWindowTitle]
86
+ [windowId, setActions, getCookie, getCookies, setCookie, close, startProgress, stopProgress, setFnQueryClose, setWindowTitle]
70
87
  );
71
88
  useEffect(() => {
72
89
  if (status === "init") {
@@ -100,7 +117,8 @@ const useWindow = (windowId, areaId) => {
100
117
  dynamicMFStore,
101
118
  windowTools,
102
119
  onTouch,
103
- memoizedActions
120
+ memoizedActions,
121
+ loggedUser
104
122
  };
105
123
  };
106
124
  export {
@@ -441,8 +441,8 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
441
441
  bounds: {
442
442
  left: MARGIN_GRIDLAYOUT,
443
443
  top: MARGIN_GRIDLAYOUT,
444
- right: -MARGIN_GRIDLAYOUT,
445
- bottom: -MARGIN_GRIDLAYOUT
444
+ right: -10,
445
+ bottom: -10
446
446
  }
447
447
  });
448
448
  }
@@ -1,5 +1,5 @@
1
1
  export * from './components';
2
2
  export * from './contexts';
3
3
  export * from './hooks';
4
- export type { CookieType } from './types';
4
+ export type { CookieType, EmergeType } from './types';
5
5
  export * from './dictionary';
@@ -148,7 +148,7 @@ export type AreaLayoutStateProps = AreaLayoutProps & WindowState;
148
148
  export type EmmitNewLayoutProps = Omit<AreaLayoutMFProps, 'windowId' | 'onClose' | 'areaId'> | Omit<AreaLayoutComponentProps, 'windowId' | 'onClose' | 'areaId'> & {
149
149
  winType: string;
150
150
  emergeType: string;
151
- layoutProps: any;
151
+ layoutProps: Omit<LayoutItem, 'i'>;
152
152
  moduleId: string;
153
153
  dynamicParams: Record<string, any>;
154
154
  iconUrl: string;
@@ -1,46 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import React, { useMemo, useState, useCallback } from "react";
2
+ import React from "react";
3
3
  import clsx from "clsx";
4
- import { useModuleDictionary } from "@m4l/core";
5
4
  import { R as RootStyled } from "./slots/DistanceToNowFormatterSlots.js";
6
- import { u as useInterval } from "../../../hooks/useInterval/index.js";
7
- import { D as DTNF_DICCTIONARY } from "./dictionary.js";
8
5
  import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
9
6
  import { C as COMPONET_KEY_COMPONENT } from "./constants.js";
10
7
  import { D as DistanceToNowFormatterSlots } from "./slots/slots.js";
11
- import { f as formatDistanceToNow } from "../../../utils/formatDistanceToNow/formatDistanteToNow.js";
8
+ import { u as useDistanceToNowFormatter } from "./hooks/useDistanceToNowFormatter.js";
12
9
  import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
13
10
  function DistanceToNowFormatter(props) {
14
11
  const { presentationTime = "present", date, dataTestId, delay, className, Component = RootStyled, componentProps } = props;
15
- const { getLabel } = useModuleDictionary();
16
- const dictionary = useMemo(() => {
17
- const ret = {
18
- label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
19
- label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
20
- label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
21
- label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
22
- label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
23
- label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
24
- label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
25
- label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
26
- label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
27
- label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
28
- label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
29
- label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
30
- label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
31
- label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
32
- label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
33
- label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
34
- label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
35
- label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS)
36
- };
37
- return ret;
38
- }, [getLabel]);
39
- const [time, setTime] = useState(formatDistanceToNow(presentationTime, date, dictionary));
40
- const updateTime = useCallback(() => {
41
- setTime(formatDistanceToNow(presentationTime, date, dictionary));
42
- }, [date, dictionary, presentationTime]);
43
- useInterval(updateTime, delay);
12
+ const { time } = useDistanceToNowFormatter({ presentationTime, date, delay });
44
13
  if (Component === React.Fragment) {
45
14
  return time;
46
15
  }
@@ -19,4 +19,12 @@ export declare const DTNF_DICCTIONARY: {
19
19
  readonly LABEL_UNIT_TIME_MONTHS: "distance_to_now_formmater.label_unit_time_months";
20
20
  readonly LABEL_UNIT_TIME_YEAR: "distance_to_now_formmater.label_unit_time_year";
21
21
  readonly LABEL_UNIT_TIME_YEARS: "distance_to_now_formmater.label_unit_time_years";
22
+ readonly LABEL_UNIT_TIME_SECONDS_SHORT: "distance_to_now_formmater.label_unit_time_seconds_short";
23
+ readonly LABEL_UNIT_TIME_MINUTES_SHORT: "distance_to_now_formmater.label_unit_time_minutes_short";
24
+ readonly LABEL_UNIT_TIME_HOURS_SHORT: "distance_to_now_formmater.label_unit_time_hours_short";
25
+ readonly LABEL_UNIT_TIME_DAYS_SHORT: "distance_to_now_formmater.label_unit_time_days_short";
26
+ readonly LABEL_UNIT_TIME_MONTHS_SHORT: "distance_to_now_formmater.label_unit_time_months_short";
27
+ readonly LABEL_UNIT_TIME_YEARS_SHORT: "distance_to_now_formmater.label_unit_time_years_short";
28
+ readonly LABEL_SEPARATOR_TIME: "distance_to_now_formmater.label_separator_time";
29
+ readonly LABEL_SEPARATOR_DATE: "distance_to_now_formmater.label_separator_date";
22
30
  };
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { DistanceToNowFormatterProps } from '../types';
3
+ import { FormatDistanceToNowReturn } from '../../../../utils/formatDistanceToNow/types';
4
+ /**
5
+ * "useDistanceToNowFormatter" que se encarga de retornar el tiempo transcurrido desde una fecha hasta la fecha actual.
6
+ * Actualizando cada delay configurable a través de props
7
+ * Tiene 3 tipos de presentaciones:
8
+ * En tiempo pasado
9
+ * En tiempo presente
10
+ * En tiempo futuro
11
+ *
12
+ */
13
+ export declare function useDistanceToNowFormatter<T extends React.ElementType>(props: DistanceToNowFormatterProps<T>): FormatDistanceToNowReturn;
@@ -0,0 +1,65 @@
1
+ import { useMemo, useState, useRef, useCallback, useEffect } from "react";
2
+ import { useModuleDictionary } from "@m4l/core";
3
+ import { u as useInterval } from "../../../../hooks/useInterval/index.js";
4
+ import { D as DTNF_DICCTIONARY } from "../dictionary.js";
5
+ import { f as formatDistanceToNow } from "../../../../utils/formatDistanceToNow/formatDistanteToNow.js";
6
+ function useDistanceToNowFormatter(props) {
7
+ const { presentationTime = "present", date, delay } = props;
8
+ const { getLabel } = useModuleDictionary();
9
+ const dictionary = useMemo(() => {
10
+ const ret = {
11
+ label_sentence_past_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_SECONDS),
12
+ label_sentence_past_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PAST_OTHERS),
13
+ label_sentence_present_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_SECONDS),
14
+ label_sentence_present_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_PRESENT_OTHERS),
15
+ label_sentence_future_seconds: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_SECONDS),
16
+ label_sentence_future_others: getLabel(DTNF_DICCTIONARY.LABEL_SENTENCE_FUTURE_OTHERS),
17
+ label_unit_time_second: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECOND),
18
+ label_unit_time_seconds: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS),
19
+ label_unit_time_minute: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTE),
20
+ label_unit_time_minutes: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES),
21
+ label_unit_time_hour: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOUR),
22
+ label_unit_time_hours: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS),
23
+ label_unit_time_day: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAY),
24
+ label_unit_time_days: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS),
25
+ label_unit_time_month: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTH),
26
+ label_unit_time_months: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS),
27
+ label_unit_time_year: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEAR),
28
+ label_unit_time_years: getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS),
29
+ label_unit_time_seconds_short: "ss",
30
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_SECONDS_SHORT),
31
+ label_unit_time_minutes_short: "mm",
32
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MINUTES_SHORT),
33
+ label_unit_time_hours_short: "hh",
34
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_HOURS_SHORT),
35
+ label_unit_time_days_short: "DD",
36
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_DAYS_SHORT),
37
+ label_unit_time_months_short: "MM",
38
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_MONTHS_SHORT),
39
+ label_unit_time_years_short: "YY",
40
+ // getLabel(DTNF_DICCTIONARY.LABEL_UNIT_TIME_YEARS_SHORT),
41
+ label_separator_time: ":",
42
+ // getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_TIME),
43
+ label_separator_date: "-"
44
+ // getLabel(DTNF_DICCTIONARY.LABEL_SEPARATOR_DATE),
45
+ };
46
+ return ret;
47
+ }, [getLabel]);
48
+ const [time, setTime] = useState(formatDistanceToNow(presentationTime, new Date(date), dictionary));
49
+ const refTime = useRef({ ...time });
50
+ const updateTime = useCallback(() => {
51
+ const newTime = formatDistanceToNow(presentationTime, new Date(date), dictionary);
52
+ if (refTime.current.value !== newTime.value || refTime.current.unit !== newTime.unit) {
53
+ refTime.current = newTime;
54
+ setTime(newTime);
55
+ }
56
+ }, [date, dictionary, presentationTime]);
57
+ useEffect(() => {
58
+ updateTime();
59
+ }, [updateTime]);
60
+ useInterval(updateTime, delay);
61
+ return time;
62
+ }
63
+ export {
64
+ useDistanceToNowFormatter as u
65
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './DistanceToNowFormatter';
2
+ export * from './hooks/useDistanceToNowFormatter';
2
3
  export { getDistanceToNowFormatterComponentsDictionary } from './dictionary';
@@ -11,7 +11,10 @@ export type DistanceToNowFormatterProps<T extends React.ElementType = typeof Roo
11
11
  */
12
12
  componentProps?: React.ComponentPropsWithoutRef<T>;
13
13
  presentationTime: PresentationTimeType;
14
- date: Date;
14
+ /**
15
+ * Se maneja en string, para evitar re-renderizaciones innecesarias debido a que Date es un objeto y se crea un nuevo objeto cada vez que se pasa como prop.
16
+ */
17
+ date: string;
15
18
  delay?: number;
16
19
  dataTestId?: string;
17
20
  className?: string;
@@ -1,6 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useId, useState, useCallback, useEffect } from "react";
3
3
  import { useFormContext, Controller } from "react-hook-form";
4
+ import { r as rhfAutocompleteClasses } from "./constants.js";
5
+ import clsx from "clsx";
4
6
  import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
5
7
  import { A as Autocomplete } from "../../mui_extended/Autocomplete/Autocomplete.js";
6
8
  import { H as HelperError } from "../../HelperError/HelperError.js";
@@ -21,7 +23,8 @@ function RHFAutocomplete(props) {
21
23
  mandatory,
22
24
  mandatoryMessage,
23
25
  multiple,
24
- refresh
26
+ refresh,
27
+ className
25
28
  // onChange: onChangeRHF,
26
29
  } = props;
27
30
  const htmlForId = useId();
@@ -59,6 +62,7 @@ function RHFAutocomplete(props) {
59
62
  return /* @__PURE__ */ jsx(
60
63
  AutocompleteRootStyled,
61
64
  {
65
+ className: clsx(className, rhfAutocompleteClasses.autocompleteRoot),
62
66
  ownerState: { ...ownerState },
63
67
  size,
64
68
  children: /* @__PURE__ */ jsx(
@@ -7,3 +7,4 @@
7
7
  */
8
8
  export declare const RFHAUTOCOMPLETE_KEY_COMPONENT = "RHFM4LAutocomplete";
9
9
  export declare const RFHAUTOCOMPLETE_CLASS_NAME_SPECIFY = "RHFM4LclasssAutocompleCssSpecificity";
10
+ export declare const rhfAutocompleteClasses: Record<string, string>;
@@ -1,4 +1,8 @@
1
+ import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
2
+ import { R as RFHAutocompleteSlots } from "./slots/RHFAutocompleteEnum.js";
1
3
  const RFHAUTOCOMPLETE_KEY_COMPONENT = "RHFM4LAutocomplete";
4
+ const rhfAutocompleteClasses = getComponentClasses(RFHAUTOCOMPLETE_KEY_COMPONENT, RFHAutocompleteSlots);
2
5
  export {
3
- RFHAUTOCOMPLETE_KEY_COMPONENT as R
6
+ RFHAUTOCOMPLETE_KEY_COMPONENT as R,
7
+ rhfAutocompleteClasses as r
4
8
  };
@@ -22,7 +22,8 @@ function RHFAutocompleteAsync(props) {
22
22
  multiple,
23
23
  disabled,
24
24
  skeletonWidth,
25
- responseToCamelCase
25
+ responseToCamelCase,
26
+ className
26
27
  } = props;
27
28
  const [state, dispatch] = useReducer(
28
29
  RHFAutocompleteAsyncReducer(onChangeFilterParms),
@@ -74,6 +75,7 @@ function RHFAutocompleteAsync(props) {
74
75
  return /* @__PURE__ */ jsx(
75
76
  RHFAutocomplete,
76
77
  {
78
+ className,
77
79
  name,
78
80
  loading: state.loading,
79
81
  label,
@@ -41,6 +41,10 @@ export interface RHFAutocompleteAsyncProps<T extends any = unknown> extends Omit
41
41
  * Whether the autocomplete is multiple
42
42
  */
43
43
  multiple?: boolean;
44
+ /**
45
+ * Class name for the autocomplete
46
+ */
47
+ className?: string;
44
48
  }
45
49
  /**
46
50
  * Defines the types of Slots available for the Autocomplete.
@@ -3,7 +3,7 @@ import { CustomFormArguments, FormProviderCustomProps, FormProviderProps } from
3
3
  /**
4
4
  * TODO: Documentar
5
5
  */
6
- export declare function useCustomForm({ validationSchema, values, statusLoad, mode, }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
6
+ export declare function useCustomForm({ validationSchema, values, statusLoad, mode, }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, undefined>;
7
7
  /**
8
8
  * TODO: Documentar
9
9
  */
@@ -14,20 +14,24 @@ const ToggleAbleIconButton = ({
14
14
  variant = "text",
15
15
  color,
16
16
  badgeProps,
17
+ disabled,
18
+ className,
17
19
  ...props
18
20
  }) => {
19
21
  const ownerState = {
20
22
  isToggled,
21
- variant
23
+ variant,
24
+ disabled
22
25
  };
23
26
  return /* @__PURE__ */ jsx(
24
27
  ToggleIconButtonRootStyled,
25
28
  {
26
29
  ...props,
27
30
  variant,
31
+ disabled,
28
32
  color,
29
33
  badgeProps,
30
- className: clsx(getComponentSlotRoot(TOGGLE_ICON_BUTTON_KEY_COMPONENT), TOGGLE_ICON_BUTTON_CLASS_NAME_SPECIFY),
34
+ className: clsx(className, getComponentSlotRoot(TOGGLE_ICON_BUTTON_KEY_COMPONENT), TOGGLE_ICON_BUTTON_CLASS_NAME_SPECIFY),
31
35
  ...getPropDataTestId(TOGGLE_ICON_BUTTON_KEY_COMPONENT, ToggleIconButtonSlots.toggleIconButtonRoot, dataTestId),
32
36
  role: "toggle-iconButton",
33
37
  ownerState,
@@ -24,6 +24,15 @@ const toggleIconButtonStyles = {
24
24
  },
25
25
  "&:focus-visible": {
26
26
  backgroundColor: theme.vars.palette.primary.enabledOpacity
27
+ },
28
+ ...ownerState?.disabled && {
29
+ backgroundColor: theme.vars.palette.default.opacity,
30
+ "& .M4LIcon-root .M4LIcon-icon": {
31
+ backgroundColor: `${theme.vars.palette.text.disabled} !important`
32
+ },
33
+ ...ownerState?.variant === "outline" && {
34
+ backgroundColor: theme.vars.palette.border.disabled
35
+ }
27
36
  }
28
37
  }
29
38
  }
@@ -22,6 +22,7 @@ export interface ToggleIconButtonProps extends Omit<IconButtonProps, 'onClick' |
22
22
  * Estado del propietario del componente ToggleIconButton.
23
23
  */
24
24
  export interface ToggleIconButtonOwnerState extends Record<string, unknown> {
25
+ disabled?: boolean;
25
26
  /** Indica si el valor es verdadero o falso. */
26
27
  isToggled?: boolean;
27
28
  /** Valor de la variante del componente. */
@@ -23,7 +23,7 @@ export * from './Tabs';
23
23
  export * from './TabContent';
24
24
  export * from './TabContext';
25
25
  export { getPagerComponentsDictionary } from '../Pager/dicctionary';
26
- export * from './Typography/Typography';
26
+ export * from './Typography';
27
27
  export * from './ToggleButton';
28
28
  export * from './ToggleIconButton';
29
29
  export * from './NavLink';
@@ -17,7 +17,7 @@ export declare const usePopups: (popupId: string) => {
17
17
  iconUrl: string;
18
18
  selected: boolean;
19
19
  mfProps: import('../../../../MFLoader/types').MFBaseProps | undefined;
20
- component: import('../../../../WindowBase/types').JSX_REACT_NODE;
20
+ component: import('../../../../WindowBase').JSX_REACT_NODE;
21
21
  loading: boolean | undefined;
22
22
  status: import('../../PopupsViewer/types').PopupStatus;
23
23
  version: string | undefined;
@@ -32,7 +32,7 @@ export declare const usePopups: (popupId: string) => {
32
32
  variant: import('../contexts/PopupsContext/types').PopupVariantType;
33
33
  draggable: boolean;
34
34
  resizable: boolean;
35
- defaultPosition: import('../../../../DragResizeWindowRND/types').DefaultPosition | undefined;
35
+ defaultPosition: import('../../../..').RNDDefaultPosition | undefined;
36
36
  bounds: import('../../../../DragResizeWindowRND/types').DraggableWindowBounds | undefined;
37
37
  onMouseDown: ((e: MouseEvent) => void) | undefined;
38
38
  allowHeightResizeContainer: boolean | undefined;
@@ -89,7 +89,6 @@ const usePopups = (popupId) => {
89
89
  }),
90
90
  [
91
91
  popupId,
92
- version,
93
92
  buildTime,
94
93
  setActions,
95
94
  //getCookie,
@@ -7,7 +7,7 @@ import { u as useSizeContainer } from "../../../../hooks/useSizeContainer/index.
7
7
  import { R as RootStyled } from "./slots/popupsViewerSlots.js";
8
8
  import { useRef, createRef, useEffect, memo } from "react";
9
9
  const PopupsViewer = (props) => {
10
- const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement } = props;
10
+ const { groupId = "global", onResizeStart, onResizeStop, onDragStart, onDragStop, containerElement, className, loggedUser } = props;
11
11
  const popupsIds = usePopupsStore(
12
12
  (state) => state.popupsIds.filter((pId) => groupId === state.hashPopups[pId].groupId && state.hashPopups[pId].status !== "closing"),
13
13
  shallow
@@ -29,7 +29,7 @@ const PopupsViewer = (props) => {
29
29
  if (!containerElement || !containerSize) {
30
30
  return null;
31
31
  }
32
- return /* @__PURE__ */ jsx(RootStyled, { ownerState: { baseZindex }, children: /* @__PURE__ */ jsx(TransitionGroup, { children: popupsIds.map((id) => {
32
+ return /* @__PURE__ */ jsx(RootStyled, { ownerState: { baseZindex }, className, children: /* @__PURE__ */ jsx(TransitionGroup, { children: popupsIds.map((id) => {
33
33
  return /* @__PURE__ */ jsx(
34
34
  CSSTransition,
35
35
  {
@@ -57,7 +57,8 @@ const PopupsViewer = (props) => {
57
57
  "data-testid": "popup",
58
58
  popupId: id,
59
59
  containerElement,
60
- containerSize
60
+ containerSize,
61
+ loggedUser
61
62
  },
62
63
  id
63
64
  )
@@ -11,7 +11,7 @@ import { M as MemonizedWindowBaseMicroFrontend } from "../../../../../WindowBase
11
11
  import { W as WindowBaseComponent } from "../../../../../WindowBase/subcomponents/Component/index.js";
12
12
  import { W as WindowBase } from "../../../../../WindowBase/WindowBase.js";
13
13
  const Popup = forwardRef((props, ref) => {
14
- const { popupId, containerElement, containerSize, style, onResizeStart, onResizeStop, onDragStart, onDragStop } = props;
14
+ const { popupId, containerElement, containerSize, style, onResizeStart, onResizeStop, onDragStart, onDragStop, loggedUser } = props;
15
15
  const popup = usePopupsStore((state) => state.hashPopups[popupId], shallow);
16
16
  const { bringPopupOnFront } = usePopupsStore((state) => state.popupsActions, shallow);
17
17
  const { close } = usePopupsStore((state) => state.popupActions, shallow);
@@ -118,7 +118,7 @@ const Popup = forwardRef((props, ref) => {
118
118
  isLoading: loading,
119
119
  windowId: popupId,
120
120
  selected,
121
- type: "popup",
121
+ emergeType: "popup",
122
122
  variant: "outlined",
123
123
  ...process.env.NODE_ENV !== "production" ? {
124
124
  [TEST_PROP_ID]: getNameDataTestId(
@@ -129,14 +129,17 @@ const Popup = forwardRef((props, ref) => {
129
129
  children: winType === "microfrontend" ? /* @__PURE__ */ jsx(
130
130
  MemonizedWindowBaseMicroFrontend,
131
131
  {
132
+ emergeType: "popup",
132
133
  moduleId,
133
134
  dynamicMFStore,
134
135
  windowTools,
136
+ loggedUser,
135
137
  ...mfProps ?? { debugPort: 0, prefix: "" }
136
138
  }
137
139
  ) : /* @__PURE__ */ jsx(
138
140
  WindowBaseComponent,
139
141
  {
142
+ emergeType: "popup",
140
143
  dynamicMFStore,
141
144
  windowTools,
142
145
  component
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ContainerSize } from '../../../../../../utils/types';
3
+ import { AuthUserType } from '@m4l/core';
3
4
  export type ResizeReason = 'start' | 'resize' | 'stop';
4
5
  export interface PopupProps {
5
6
  /**
@@ -34,4 +35,8 @@ export interface PopupProps {
34
35
  * "onDragStop" Función que se ejecuta cuando se termina de arrastrar el popup
35
36
  */
36
37
  onDragStop?: () => void;
38
+ /**
39
+ * "loggedUser" Usuario logueado
40
+ */
41
+ loggedUser?: AuthUserType;
37
42
  }
@@ -3,14 +3,17 @@ import { PopupViewerSlots } from './slots/slots';
3
3
  import { POPUPS_VIEWER_KEY_COMPONENT } from './constants';
4
4
  import { PopupStoreProps, PopupsProviderStoreState } from '../PopupsProvider/contexts/PopupsContext/types';
5
5
  import { M4LOverridesStyleRules } from '../../../../@types/augmentations';
6
+ import { AuthUserType } from '@m4l/core';
6
7
  export type PopupViewerSlotsType = keyof typeof PopupViewerSlots;
7
8
  export type PopupsViewerProps = {
9
+ className?: string;
8
10
  containerElement?: HTMLElement;
9
11
  groupId?: string;
10
12
  onResizeStart?: () => void;
11
13
  onResizeStop?: () => void;
12
14
  onDragStart?: () => void;
13
15
  onDragStop?: () => void;
16
+ loggedUser?: AuthUserType;
14
17
  };
15
18
  export type PopupStatus = 'init' | 'closing' | 'hidden';
16
19
  export interface PopupOwnerState extends Pick<PopupStoreProps, 'status' | 'subTitle' | 'editionInfo' | 'zIndex' | 'variant'> {
package/hooks/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from './useDynamicFilterAndSort';
12
12
  export * from './useDataGridPersistence';
13
13
  export * from './usePopoverContainer';
14
14
  export * from './useIsVisible';
15
+ export * from './useSizeContainer';
@@ -1,8 +1,9 @@
1
1
  import { ContainerSize } from '../../utils/types';
2
+ import { UseSizeContainerOptions } from './types';
2
3
  /**
3
4
  * useSizeContainer: hook encargado de obtener el tamaño de un elemento contenedor
4
5
  * TODO: Usar throttle para evitar llamadas innecesarias
5
6
  * @param containerElement
6
7
  * @returns un objeto con el ancho y alto del contenedor
7
8
  */
8
- export declare function useSizeContainer(containerElement?: HTMLElement | undefined | null): ContainerSize | undefined;
9
+ export declare function useSizeContainer(containerElement?: HTMLElement | undefined | null, options?: UseSizeContainerOptions): ContainerSize | undefined;