@m4l/components 9.3.19-BE101025-beta.2 → 9.3.19-BE171025-beta.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 (95) hide show
  1. package/@types/types.d.ts +1 -1
  2. package/components/AccountPopover/AccountPopover.js +12 -13
  3. package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.d.ts +1 -1
  4. package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.js +7 -4
  5. package/components/AccountPopover/subcomponents/MenuPopover/types.d.ts +1 -1
  6. package/components/Chip/Chip.js +9 -7
  7. package/components/Chip/ChipStyles.js +4 -31
  8. package/components/Chip/helpers.d.ts +10 -0
  9. package/components/Chip/helpers.js +34 -0
  10. package/components/Chip/types.d.ts +6 -0
  11. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
  12. package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
  13. package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
  14. package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
  15. package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
  16. package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
  17. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
  18. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
  19. package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
  20. package/components/DragResizeWindowRND/index.d.ts +1 -0
  21. package/components/DragResizeWindowRND/types.d.ts +12 -2
  22. package/components/DynamicFilter/DynamicFilter.js +2 -1
  23. package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
  24. package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
  25. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
  26. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
  27. package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
  28. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
  29. package/components/DynamicFilter/types.d.ts +4 -0
  30. package/components/DynamicSort/DynamicSort.js +2 -1
  31. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
  32. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
  33. package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
  34. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
  35. package/components/DynamicSort/types.d.ts +4 -0
  36. package/components/GridLayout/subcomponents/GridItem/index.js +2 -2
  37. package/components/Image/Image.js +4 -1
  38. package/components/MFLoader/MFLoader.js +8 -3
  39. package/components/MFLoader/styles.js +1 -1
  40. package/components/MFLoader/types.d.ts +10 -0
  41. package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
  42. package/components/WindowBase/WindowBase.js +3 -3
  43. package/components/WindowBase/WindowBase.styles.js +36 -31
  44. package/components/WindowBase/constants.d.ts +1 -1
  45. package/components/WindowBase/constants.js +2 -2
  46. package/components/WindowBase/index.d.ts +1 -0
  47. package/components/WindowBase/subcomponents/Component/index.js +2 -2
  48. package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
  49. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
  50. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  51. package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +4 -0
  52. package/components/WindowBase/types.d.ts +3 -3
  53. package/components/WindowConfirm/WindowConfirm.js +1 -1
  54. package/components/areas/components/AreasViewer/AreasViewer.styles.js +1 -1
  55. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +6 -2
  56. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
  57. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +21 -3
  58. package/components/areas/index.d.ts +1 -1
  59. package/components/areas/types.d.ts +1 -1
  60. package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
  61. package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
  62. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
  63. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
  64. package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
  65. package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
  66. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +5 -1
  67. package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
  68. package/components/hook-form/RHFAutocomplete/constants.js +5 -1
  69. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +3 -1
  70. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
  71. package/components/mui_extended/Button/ButtonStyles.js +15 -5
  72. package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
  73. package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
  74. package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
  75. package/components/mui_extended/index.d.ts +1 -1
  76. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
  77. package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
  78. package/components/popups/components/PopupsViewer/PopupsViewer.js +4 -3
  79. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +5 -2
  80. package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +5 -0
  81. package/components/popups/components/PopupsViewer/types.d.ts +3 -0
  82. package/hooks/index.d.ts +1 -0
  83. package/hooks/useSizeContainer/index.d.ts +2 -1
  84. package/hooks/useSizeContainer/index.js +22 -13
  85. package/hooks/useSizeContainer/types.d.ts +6 -0
  86. package/hooks/useStateRef/index.d.ts +1 -1
  87. package/hooks/useStateRef/index.js +6 -6
  88. package/index.js +45 -38
  89. package/package.json +3 -4
  90. package/utils/deepShallow.d.ts +17 -0
  91. package/utils/deepShallow.js +76 -0
  92. package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
  93. package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
  94. package/utils/formatDistanceToNow/types.d.ts +13 -0
  95. package/utils/index.d.ts +1 -0
@@ -8,7 +8,7 @@ import { deepEqual } from "fast-equals";
8
8
  import { useFormatter } from "@m4l/graphics";
9
9
  import { u as useButtonActions } from "./useButtonActions.js";
10
10
  import { H as HeaderWindowComponentStyled, c as HeaderContentStyled, I as IconWindowStyled, d as ContainerTitleSubtitleStyled, e as TitleWindowStyled, P as PointIconStyled, S as SubtitleWindowStyled, f as IconsWrapperStyled, g as ContainerLeftActionsStyled, M as MenuActionsWindowsStyled } from "../../slots/WindowBaseSlots.js";
11
- import { a as WINDOW_BASE_CLASSES } from "../../constants.js";
11
+ import { w as windowBaseClasses } from "../../constants.js";
12
12
  import clsx from "clsx";
13
13
  const HeaderWindowBase = (props) => {
14
14
  const {
@@ -24,7 +24,7 @@ const HeaderWindowBase = (props) => {
24
24
  variant,
25
25
  actions = [],
26
26
  collapsed,
27
- type,
27
+ emergeType,
28
28
  draggable
29
29
  } = props;
30
30
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -103,17 +103,17 @@ const HeaderWindowBase = (props) => {
103
103
  maximized,
104
104
  variant,
105
105
  size,
106
- type,
106
+ emergeType,
107
107
  collapsed,
108
108
  draggable
109
109
  };
110
110
  const IconButtonLeftActions = useButtonActions(leftActions);
111
111
  const IconButtonRightActions = useButtonActions(rightActions);
112
- return /* @__PURE__ */ jsxs(HeaderWindowComponentStyled, { className: clsx(draggable && dragResizeWindowRNDClasses.draggableHandle, WINDOW_BASE_CLASSES.headerWindowComponent), ownerState, children: [
113
- /* @__PURE__ */ jsxs(HeaderContentStyled, { ownerState, children: [
112
+ return /* @__PURE__ */ jsxs(HeaderWindowComponentStyled, { className: clsx(draggable && dragResizeWindowRNDClasses.draggableHandle, windowBaseClasses.headerWindowComponent), ownerState, children: [
113
+ /* @__PURE__ */ jsxs(HeaderContentStyled, { ownerState, className: windowBaseClasses.headerContentWindowBase, children: [
114
114
  iconUrl && /* @__PURE__ */ jsx(IconWindowStyled, { size, ownerState, src: iconUrl, "aria-label": "main icon" }),
115
115
  /* @__PURE__ */ jsxs(ContainerTitleSubtitleStyled, { size, ownerState, children: [
116
- /* @__PURE__ */ jsx(TitleWindowStyled, { variant: type === "popup" || type === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: title }),
116
+ /* @__PURE__ */ jsx(TitleWindowStyled, { variant: emergeType === "popup" || emergeType === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: title }),
117
117
  subTitle && /* @__PURE__ */ jsx(
118
118
  PointIconStyled,
119
119
  {
@@ -122,7 +122,7 @@ const HeaderWindowBase = (props) => {
122
122
  ownerState
123
123
  }
124
124
  ),
125
- subTitle && /* @__PURE__ */ jsx(SubtitleWindowStyled, { variant: type === "popup" || type === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: subTitle })
125
+ subTitle && /* @__PURE__ */ jsx(SubtitleWindowStyled, { variant: emergeType === "popup" || emergeType === "modal" ? "body" : "captionDens", size, skeletonWidth: 100, ownerState, children: subTitle })
126
126
  ] })
127
127
  ] }),
128
128
  /* @__PURE__ */ jsxs(
@@ -32,7 +32,7 @@ import { WindowBaseAction, WindowBaseProps } from '../../types';
32
32
  * - `selected` modifies the visual appearance to indicate the selected state.
33
33
  * @see WindowBaseProps - General properties for the window base.
34
34
  */
35
- export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant' | 'type' | 'buildTime' | 'maximized' | 'draggable'> & {
35
+ export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant' | 'emergeType' | 'buildTime' | 'maximized' | 'draggable'> & {
36
36
  actions?: WindowBaseAction[];
37
37
  };
38
38
  /**
@@ -1,3 +1,5 @@
1
+ import { AuthUserType } from '@m4l/core';
2
+ import { EmergeType } from '../../../areas/types';
1
3
  import { MFBaseProps } from '../../../MFLoader/types';
2
4
  import { WindowToolsMF } from '../../contexts';
3
5
  import { DynamicMFStore } from '../../contexts/DynamicMFParmsContext/store';
@@ -5,4 +7,6 @@ export interface MicroFrontendProps extends MFBaseProps {
5
7
  moduleId: string;
6
8
  windowTools: WindowToolsMF;
7
9
  dynamicMFStore: DynamicMFStore;
10
+ emergeType: EmergeType;
11
+ loggedUser: AuthUserType;
8
12
  }
@@ -189,7 +189,7 @@ export interface WindowBaseProps {
189
189
  * - `'window'`: A window.
190
190
  * Default is `'window'` if not specified.
191
191
  */
192
- type?: EmergeType;
192
+ emergeType?: EmergeType;
193
193
  /**
194
194
  * Indicates if the window is draggable.
195
195
  */
@@ -210,13 +210,13 @@ export type WindowBaseType = keyof typeof WindowBaseSlots;
210
210
  * windowBaseVariant (optional) - Visual variant of the component (`'outlined'` or `'text'`).
211
211
  * windowBaseSize (optional) - Size of the component (`'small'` or `'medium'`).
212
212
  */
213
- export type WindowBaseOwnerState = Pick<WindowBaseProps, 'size'> & {
213
+ export type WindowBaseOwnerState = {
214
214
  selected?: WindowBaseProps['selected'];
215
215
  collapsed?: WindowBaseProps['collapsed'];
216
216
  maximized?: WindowBaseProps['maximized'];
217
217
  variant?: WindowBaseProps['variant'];
218
218
  size?: WindowBaseProps['size'];
219
- type?: WindowBaseProps['type'];
219
+ emergeType?: WindowBaseProps['emergeType'];
220
220
  draggable?: WindowBaseProps['draggable'];
221
221
  };
222
222
  /**
@@ -56,7 +56,7 @@ const WindowConfirm = (props) => {
56
56
  info: `${host_static_assets}/${environment_assets}/frontend/components/window_confirm/assets/icons/Info.svg`
57
57
  };
58
58
  const iconUrl = iconMap[variant] || iconMap.warning;
59
- return /* @__PURE__ */ jsx(AppearanceComponentProvider, { defaultSize: currentSize, children: /* @__PURE__ */ jsx(WindowBase, { iconUrl, variant: "outlined", title: getLabel("modal_dialog.label_window_confirm"), onClose: () => closeModal(), type: "modal", children: /* @__PURE__ */ jsx(
59
+ return /* @__PURE__ */ jsx(AppearanceComponentProvider, { defaultSize: currentSize, children: /* @__PURE__ */ jsx(WindowBase, { iconUrl, variant: "outlined", title: getLabel("modal_dialog.label_window_confirm"), onClose: () => closeModal(), emergeType: "modal", children: /* @__PURE__ */ jsx(
60
60
  WindowConfirmRootStyled,
61
61
  {
62
62
  className: clsx(getComponentSlotRoot(WINDOW_CONFIRM_KEY_COMPONENT)),
@@ -33,7 +33,7 @@ const areasViewerStyles = {
33
33
  flexDirection: "row",
34
34
  inset: 0,
35
35
  overflow: "hidden",
36
- justifyContent: "top",
36
+ justifyContent: "flex-start",
37
37
  alignItems: "flex-start",
38
38
  visibility: "hidden",
39
39
  ...ownerState?.selected && {
@@ -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 {
@@ -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";
@@ -24,7 +26,8 @@ function RHFAutocomplete(props) {
24
26
  refresh,
25
27
  startAdornment,
26
28
  getOptionalStartAdornment,
27
- getOptionalEndAdornment
29
+ getOptionalEndAdornment,
30
+ className
28
31
  // onChange: onChangeRHF,
29
32
  } = props;
30
33
  const htmlForId = useId();
@@ -62,6 +65,7 @@ function RHFAutocomplete(props) {
62
65
  return /* @__PURE__ */ jsx(
63
66
  AutocompleteRootStyled,
64
67
  {
68
+ className: clsx(className, rhfAutocompleteClasses.autocompleteRoot),
65
69
  ownerState: { ...ownerState },
66
70
  size,
67
71
  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<"label" | "autocompleteRoot", 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
  };
@@ -25,7 +25,8 @@ function RHFAutocompleteAsync(props) {
25
25
  responseToCamelCase,
26
26
  startAdornment,
27
27
  getOptionalStartAdornment,
28
- getOptionalEndAdornment
28
+ getOptionalEndAdornment,
29
+ className
29
30
  } = props;
30
31
  const [state, dispatch] = useReducer(
31
32
  RHFAutocompleteAsyncReducer(onChangeFilterParms),
@@ -77,6 +78,7 @@ function RHFAutocompleteAsync(props) {
77
78
  return /* @__PURE__ */ jsx(
78
79
  RHFAutocomplete,
79
80
  {
81
+ className,
80
82
  name,
81
83
  loading: state.loading,
82
84
  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.
@@ -6,7 +6,7 @@ const buttonStyles = {
6
6
  */
7
7
  buttonRoot: ({ theme, ownerState }) => {
8
8
  const selectionEffect = {
9
- boxShadow: `inset 0px 0px 0px 1px ${theme.vars.palette.border.main}`
9
+ boxShadow: `inset 0px 0px 0px 1px ${theme.vars.palette.primary.focusVisible}`
10
10
  };
11
11
  return {
12
12
  // Configuración general
@@ -38,11 +38,21 @@ const buttonStyles = {
38
38
  boxShadow: "unset",
39
39
  // Color del texto
40
40
  [`&&& .${BUTTON_CLASSES.textButton}`]: {
41
- color: ownerState?.paletteColor?.contrastText
41
+ ...ownerState?.color === "default" && {
42
+ color: theme.vars.palette.text.primary
43
+ },
44
+ ...ownerState?.color !== "default" && {
45
+ color: ownerState?.paletteColor?.contrastText
46
+ }
42
47
  },
43
48
  // Color de los adornos laterales
44
49
  "&&& .M4LIcon-icon": {
45
- backgroundColor: ownerState?.paletteColor?.contrastText
50
+ ...ownerState?.color === "default" && {
51
+ backgroundColor: theme.vars.palette.text.primary
52
+ },
53
+ ...ownerState?.color !== "default" && {
54
+ backgroundColor: ownerState?.paletteColor?.contrastText
55
+ }
46
56
  },
47
57
  // Estado Hover
48
58
  "&:hover": {
@@ -51,12 +61,12 @@ const buttonStyles = {
51
61
  },
52
62
  // Estado Active
53
63
  "&:active": {
54
- backgroundColor: ownerState?.paletteColor?.activeOpacity,
64
+ backgroundColor: ownerState?.paletteColor?.active,
55
65
  boxShadow: "unset"
56
66
  },
57
67
  // Estado focus visible
58
68
  "&:focus-visible": {
59
- backgroundColor: ownerState?.paletteColor?.activeOpacity,
69
+ backgroundColor: ownerState?.paletteColor?.active,
60
70
  ...selectionEffect
61
71
  }
62
72
  },
@@ -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
  )