@m4l/graphics 7.2.3-beta.0 → 7.2.3-beta.2

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 (137) hide show
  1. package/components/GlobalStyles/getDateRangePickerPopupGlobalStyles.d.ts +319 -0
  2. package/components/GlobalStyles/getDateRangePickerPopupGlobalStyles.d.ts.map +1 -0
  3. package/components/GlobalStyles/getDateRangePickerPopupGlobalStyles.js +347 -0
  4. package/components/GlobalStyles/index.d.ts +9 -0
  5. package/components/GlobalStyles/index.d.ts.map +1 -0
  6. package/components/GlobalStyles/index.js +99 -0
  7. package/components/GlobalStyles/rsuiteStyles.min.css.js +4 -0
  8. package/components/index.d.ts +2 -0
  9. package/components/index.d.ts.map +1 -0
  10. package/contexts/DeviceTypeContext/helper.d.ts +10 -0
  11. package/contexts/DeviceTypeContext/helper.d.ts.map +1 -0
  12. package/contexts/DeviceTypeContext/helper.js +4 -0
  13. package/contexts/DeviceTypeContext/index.d.ts +16 -0
  14. package/contexts/DeviceTypeContext/index.d.ts.map +1 -0
  15. package/contexts/DeviceTypeContext/index.js +18 -0
  16. package/contexts/DeviceTypeContext/store.d.ts +19 -0
  17. package/contexts/DeviceTypeContext/store.d.ts.map +1 -0
  18. package/contexts/DeviceTypeContext/store.js +36 -0
  19. package/contexts/DeviceTypeContext/types.d.ts +37 -0
  20. package/contexts/DeviceTypeContext/types.d.ts.map +1 -0
  21. package/contexts/FormatterContext/index.d.ts +13 -0
  22. package/contexts/FormatterContext/index.d.ts.map +1 -0
  23. package/contexts/FormatterContext/index.js +74 -0
  24. package/contexts/FormatterContext/types.d.ts +59 -0
  25. package/contexts/FormatterContext/types.d.ts.map +1 -0
  26. package/contexts/HostThemeContext/index.d.ts +12 -0
  27. package/contexts/HostThemeContext/index.d.ts.map +1 -0
  28. package/contexts/HostThemeContext/index.js +46 -0
  29. package/contexts/HostThemeContext/types.d.ts +18 -0
  30. package/contexts/HostThemeContext/types.d.ts.map +1 -0
  31. package/contexts/LocalesContext/helper.d.ts +26 -0
  32. package/contexts/LocalesContext/helper.d.ts.map +1 -0
  33. package/contexts/LocalesContext/helper.js +35 -0
  34. package/contexts/LocalesContext/index.d.ts +12 -0
  35. package/contexts/LocalesContext/index.d.ts.map +1 -0
  36. package/contexts/LocalesContext/index.js +71 -0
  37. package/contexts/LocalesContext/types.d.ts +27 -0
  38. package/contexts/LocalesContext/types.d.ts.map +1 -0
  39. package/contexts/ResponsiveContainerContext/constants.d.ts +3 -0
  40. package/contexts/ResponsiveContainerContext/constants.d.ts.map +1 -0
  41. package/contexts/ResponsiveContainerContext/constants.js +4 -0
  42. package/contexts/ResponsiveContainerContext/index.d.ts +17 -0
  43. package/contexts/ResponsiveContainerContext/index.d.ts.map +1 -0
  44. package/contexts/ResponsiveContainerContext/index.js +51 -0
  45. package/contexts/ResponsiveContainerContext/store.d.ts +19 -0
  46. package/contexts/ResponsiveContainerContext/store.d.ts.map +1 -0
  47. package/contexts/ResponsiveContainerContext/store.js +33 -0
  48. package/contexts/ResponsiveContainerContext/types.d.ts +27 -0
  49. package/contexts/ResponsiveContainerContext/types.d.ts.map +1 -0
  50. package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts +20 -0
  51. package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts.map +1 -0
  52. package/contexts/ThemeSettingsContext/ThemeSettingsContext.js +32 -0
  53. package/contexts/ThemeSettingsContext/constants.d.ts +3 -0
  54. package/contexts/ThemeSettingsContext/constants.d.ts.map +1 -0
  55. package/contexts/ThemeSettingsContext/constants.js +10 -0
  56. package/contexts/ThemeSettingsContext/index.d.ts +4 -0
  57. package/contexts/ThemeSettingsContext/index.d.ts.map +1 -0
  58. package/contexts/ThemeSettingsContext/store.d.ts +19 -0
  59. package/contexts/ThemeSettingsContext/store.d.ts.map +1 -0
  60. package/contexts/ThemeSettingsContext/store.js +177 -0
  61. package/contexts/ThemeSettingsContext/types.d.ts +72 -0
  62. package/contexts/ThemeSettingsContext/types.d.ts.map +1 -0
  63. package/contexts/index.d.ts +13 -0
  64. package/contexts/index.d.ts.map +1 -0
  65. package/hooks/index.d.ts +15 -0
  66. package/hooks/index.d.ts.map +1 -0
  67. package/hooks/useFirstRender/index.d.ts +10 -0
  68. package/hooks/useFirstRender/index.d.ts.map +1 -0
  69. package/hooks/useFirstRender/index.js +10 -0
  70. package/hooks/useFormatter/index.d.ts +9 -0
  71. package/hooks/useFormatter/index.d.ts.map +1 -0
  72. package/hooks/useFormatter/index.js +11 -0
  73. package/hooks/useHostTheme/index.d.ts +9 -0
  74. package/hooks/useHostTheme/index.d.ts.map +1 -0
  75. package/hooks/useHostTheme/index.js +11 -0
  76. package/hooks/useIsMobile/index.d.ts +15 -0
  77. package/hooks/useIsMobile/index.d.ts.map +1 -0
  78. package/hooks/useIsMobile/index.js +17 -0
  79. package/hooks/useIsMountedRef/index.d.ts +9 -0
  80. package/hooks/useIsMountedRef/index.d.ts.map +1 -0
  81. package/hooks/useIsMountedRef/index.js +13 -0
  82. package/hooks/useLocales/index.d.ts +9 -0
  83. package/hooks/useLocales/index.d.ts.map +1 -0
  84. package/hooks/useLocales/index.js +11 -0
  85. package/hooks/useOffSetTop.d.ts +9 -0
  86. package/hooks/useOffSetTop.d.ts.map +1 -0
  87. package/hooks/useOffSetTop.js +12 -0
  88. package/hooks/usePaginate/index.d.ts +15 -0
  89. package/hooks/usePaginate/index.d.ts.map +1 -0
  90. package/hooks/usePaginate/index.js +76 -0
  91. package/hooks/usePaginate/types.d.ts +22 -0
  92. package/hooks/usePaginate/types.d.ts.map +1 -0
  93. package/hooks/usePaginate/types.js +8 -0
  94. package/hooks/useResizeObserver/index.d.ts +10 -0
  95. package/hooks/useResizeObserver/index.d.ts.map +1 -0
  96. package/hooks/useResizeObserver/index.js +19 -0
  97. package/hooks/useResponsive/index.d.ts +6 -0
  98. package/hooks/useResponsive/index.d.ts.map +1 -0
  99. package/hooks/useResponsive/index.js +7 -0
  100. package/hooks/useResponsiveContainer/index.d.ts +7 -0
  101. package/hooks/useResponsiveContainer/index.d.ts.map +1 -0
  102. package/hooks/useResponsiveContainer/index.js +12 -0
  103. package/hooks/useRows/index.d.ts +12 -0
  104. package/hooks/useRows/index.d.ts.map +1 -0
  105. package/hooks/useRows/index.js +70 -0
  106. package/hooks/useRows/state.d.ts +30 -0
  107. package/hooks/useRows/state.d.ts.map +1 -0
  108. package/hooks/useRows/state.js +25 -0
  109. package/hooks/useRows/types.d.ts +10 -0
  110. package/hooks/useRows/types.d.ts.map +1 -0
  111. package/hooks/useThemSettingsStore/index.d.ts +10 -0
  112. package/hooks/useThemSettingsStore/index.d.ts.map +1 -0
  113. package/hooks/useThemSettingsStore/index.js +12 -0
  114. package/hooks/useUserAgent/index.d.ts +5 -0
  115. package/hooks/useUserAgent/index.d.ts.map +1 -0
  116. package/hooks/useUserAgent/index.js +25 -0
  117. package/index.d.ts.map +1 -0
  118. package/package.json +2 -2
  119. package/test/setup.d.ts +1 -0
  120. package/test/setup.d.ts.map +1 -0
  121. package/test/utils.d.ts +9 -0
  122. package/test/utils.d.ts.map +1 -0
  123. package/utils/anchorEl.d.ts +21 -0
  124. package/utils/anchorEl.d.ts.map +1 -0
  125. package/utils/anchorEl.js +49 -0
  126. package/utils/getContrastTextColor/getContrastTextColor.d.ts +6 -0
  127. package/utils/getContrastTextColor/getContrastTextColor.d.ts.map +1 -0
  128. package/utils/getContrastTextColor/getContrastTextColor.js +14 -0
  129. package/utils/getContrastTextColor/index.d.ts +3 -0
  130. package/utils/getContrastTextColor/index.d.ts.map +1 -0
  131. package/utils/getContrastTextColor/types.d.ts +3 -0
  132. package/utils/getContrastTextColor/types.d.ts.map +1 -0
  133. package/utils/index.d.ts +4 -0
  134. package/utils/index.d.ts.map +1 -0
  135. package/utils/strings.d.ts +2 -0
  136. package/utils/strings.d.ts.map +1 -0
  137. package/utils/strings.js +4 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useIsMobile/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAI/E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,CAAC,EAC7C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,GAC1C,CAAC,CAOH;AACD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,cAAc,CAAC,EAAC,OAAO,WAIlD"}
@@ -0,0 +1,17 @@
1
+ import { useContext as r } from "react";
2
+ import { useStore as i } from "zustand";
3
+ import { DeviceTypeContext as n } from "../../contexts/DeviceTypeContext/index.js";
4
+ function s(o, t) {
5
+ const e = r(n);
6
+ if (!e)
7
+ throw new Error("useIsMobileStore context must be use inside DeviceTypeContext");
8
+ return i(e, o, t);
9
+ }
10
+ function p(o) {
11
+ const t = s((e) => e.deviceType === "mobile");
12
+ return o || t;
13
+ }
14
+ export {
15
+ p as useIsMobile,
16
+ s as useIsMobileStore
17
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook to use the is mounted ref
3
+ * @author Juan Escobar - automatic
4
+ * @createdAt 2024-10-06 20:07:18 - automatic
5
+ * @updatedAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedUser Juan Escobar - automatic
7
+ */
8
+ export declare function useIsMountedRef(): import('react').RefObject<boolean>;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useIsMountedRef/index.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,eAAe,uCAW9B"}
@@ -0,0 +1,13 @@
1
+ import { useRef as t, useEffect as u } from "react";
2
+ function f() {
3
+ const e = t(!0);
4
+ return u(
5
+ () => () => {
6
+ e.current = !1;
7
+ },
8
+ []
9
+ ), e;
10
+ }
11
+ export {
12
+ f as useIsMountedRef
13
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook to use the locales context
3
+ * @author Juan Escobar - automatic
4
+ * @createdAt 2024-10-06 20:07:18 - automatic
5
+ * @updatedAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedUser Juan Escobar - automatic
7
+ */
8
+ export declare const useLocales: () => import('../../contexts/LocalesContext/types').LocalesContextProps;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useLocales/index.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,yEAOtB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { useContext as o } from "react";
2
+ import { LocalesContext as t } from "../../contexts/LocalesContext/index.js";
3
+ const n = () => {
4
+ const e = o(t);
5
+ if (!e)
6
+ throw new Error("useLocales context must be use inside LocalesProvider");
7
+ return e;
8
+ };
9
+ export {
10
+ n as useLocales
11
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook to use the offset top
3
+ * @author Juan Escobar - automatic
4
+ * @createdAt 2024-10-06 20:07:18 - automatic
5
+ * @updatedAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedUser Juan Escobar - automatic
7
+ */
8
+ export declare function useOffSetTop(pTop: number): boolean;
9
+ //# sourceMappingURL=useOffSetTop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOffSetTop.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/hooks/useOffSetTop.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,WAyBxC"}
@@ -0,0 +1,12 @@
1
+ import { useState as s, useEffect as n } from "react";
2
+ function l(t) {
3
+ const [f, e] = s(!1), o = t || 100;
4
+ return n(() => (window.onscroll = () => {
5
+ window.pageYOffset > o ? e(!0) : e(!1);
6
+ }, () => {
7
+ window.onscroll = null;
8
+ }), [o]), f;
9
+ }
10
+ export {
11
+ l as useOffSetTop
12
+ };
@@ -0,0 +1,15 @@
1
+ import { UsePaginateProps, PagerState } from './types';
2
+ /**
3
+ * Hook para paginar una lista de elementos
4
+ */
5
+ export declare const usePaginate: <TRow>(props: UsePaginateProps<TRow>) => {
6
+ onPageChange: (newPage: number) => void;
7
+ onRowsPerPageChange: (newRowsPerPage: number) => void;
8
+ pagerState: PagerState;
9
+ rows: TRow[];
10
+ clearRows: () => void;
11
+ Refresh: () => void;
12
+ setRows: import('react').Dispatch<import('react').SetStateAction<TRow[]>>;
13
+ loading: boolean;
14
+ };
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/usePaginate/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,EAAE,OAAO,gBAAgB,CAAC,IAAI,CAAC;4BA6G9B,MAAM;0CAQQ,MAAM;;;;;;;CAepD,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { useState as s, useRef as j, useCallback as v, useEffect as c } from "react";
2
+ import { initialPagerState as o } from "./types.js";
3
+ import { useHostTools as z, useNetwork as A, useModuleSkeleton as B, useModuleDictionary as I } from "@m4l/core";
4
+ const Z = (C) => {
5
+ const {
6
+ endPoint: R,
7
+ timeout: S = 5e3,
8
+ queryParams: u,
9
+ fireOnChangeParms: P,
10
+ // Propiedad para permitir que un cambio en los parametros de la consulta dispare la recarga de la red
11
+ fireOnFirstLoad: k = !0,
12
+ // propiedad que evita que se cargue la red la en el primer render del hook
13
+ rowsPerPage: l = o.rowsPerPage,
14
+ startProgress: y,
15
+ stopProgress: O,
16
+ isRemote: T = !0,
17
+ bodyToSnakeCase: b = !1,
18
+ responseToCamelCase: E = !1,
19
+ initialRows: L = [],
20
+ externalCondition: f = !0,
21
+ onNetworkError: p,
22
+ refreshOnChangeDictionary: m = !1
23
+ } = C, [h, g] = s(P ? 1 : 0), [x, a] = s(L), [D, n] = s({ ...o, rowsPerPage: l }), t = j({ ...o, rowsPerPage: l }), [F, M] = s(k), [N, w] = s(!1), { startProgress: Q, stopProgress: q } = z(), { networkOperation: G } = A(), d = B(), { getLabel: H } = I(), i = v(() => {
24
+ g((r) => r + 1);
25
+ }, []);
26
+ return c(() => {
27
+ if (F) {
28
+ M(!1);
29
+ return;
30
+ }
31
+ t.current.page = 0, P && i();
32
+ }, [u]), c(() => {
33
+ let r = !0;
34
+ if (!(!f || h === 0))
35
+ return w(!0), G({
36
+ method: "GET",
37
+ endPoint: R,
38
+ timeout: S,
39
+ parms: {
40
+ ...u,
41
+ page: t.current.page,
42
+ limit: t.current.rowsPerPage
43
+ },
44
+ bodyToSnakeCase: b,
45
+ responseToCamelCase: E,
46
+ options: {
47
+ startProgress: y || Q,
48
+ stopProgress: O || q
49
+ },
50
+ isRemote: T
51
+ }).then((e) => {
52
+ r && (a(e.data), t.current.page = e.pager.page, n((U) => ({
53
+ ...U,
54
+ page: e.pager.page,
55
+ totalRecords: e.pager.total
56
+ })));
57
+ }).catch((e) => {
58
+ a([]), n(o), p && p(e.status);
59
+ }).finally(() => {
60
+ w(!1);
61
+ }), function() {
62
+ r = !1;
63
+ };
64
+ }, [h, f]), c(() => {
65
+ !d && m && i();
66
+ }, [H, m, d]), { onPageChange: (r) => {
67
+ t.current.page = r, g((e) => e + 1);
68
+ }, onRowsPerPageChange: (r) => {
69
+ t.current.rowsPerPage = r, n((e) => ({ ...e, rowsPerPage: r })), g((e) => e + 1);
70
+ }, pagerState: D, rows: x, clearRows: () => {
71
+ a([]), n(o);
72
+ }, Refresh: i, setRows: a, loading: N };
73
+ };
74
+ export {
75
+ Z as usePaginate
76
+ };
@@ -0,0 +1,22 @@
1
+ import { AxiosOptions, GetLabelType, NetworkProps } from '../../../../core/src/index.ts';
2
+ export declare interface PagerState {
3
+ page: number;
4
+ rowsPerPage: number;
5
+ totalRecords: number;
6
+ }
7
+ export declare const initialPagerState: PagerState;
8
+ export interface UsePaginateProps<TRow> extends Pick<NetworkProps, 'endPoint' | 'timeout' | 'isRemote' | 'bodyToSnakeCase' | 'responseToCamelCase'>, AxiosOptions {
9
+ fireOnChangeParms?: boolean;
10
+ fireOnFirstLoad?: boolean;
11
+ queryParams: Record<string, unknown>;
12
+ rowsPerPage?: number;
13
+ initialRows?: TRow[];
14
+ externalCondition?: boolean;
15
+ onNetworkError?: (code: number) => void;
16
+ /**
17
+ * @deprecated This property is not used
18
+ */
19
+ getLabel?: GetLabelType;
20
+ refreshOnChangeDictionary?: boolean;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/usePaginate/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGrE,MAAM,CAAC,OAAO,WAAW,UAAU;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,UAI/B,CAAC;AAEF,MAAM,WAAW,gBAAgB,CAAC,IAAI,CACpC,SAAQ,IAAI,CACR,YAAY,EACZ,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,qBAAqB,CAChF,EACD,YAAY;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
@@ -0,0 +1,8 @@
1
+ const e = {
2
+ page: 0,
3
+ rowsPerPage: 25,
4
+ totalRecords: 0
5
+ };
6
+ export {
7
+ e as initialPagerState
8
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Hook to use the resize observer
3
+ * @author Juan Escobar - automatic
4
+ * @createdAt 2024-10-06 20:07:18 - automatic
5
+ * @updatedAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedUser Juan Escobar - automatic
7
+ */
8
+ export declare function useResizeObserver<T extends HTMLElement>(callback: (target: T, entry: ResizeObserverEntry) => void): import('react').RefObject<T | null>;
9
+ export default useResizeObserver;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useResizeObserver/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EACrD,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,mBAAmB,KAAK,IAAI,uCAuB1D;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { useRef as u, useLayoutEffect as o } from "react";
2
+ function c(t) {
3
+ const e = u(null);
4
+ return o(() => {
5
+ const r = e?.current;
6
+ if (!r)
7
+ return;
8
+ const n = new ResizeObserver((s) => {
9
+ t(r, s[0]);
10
+ });
11
+ return n.observe(r), () => {
12
+ n.disconnect();
13
+ };
14
+ }, [t, e.current]), e;
15
+ }
16
+ export {
17
+ c as default,
18
+ c as useResizeObserver
19
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the screen size is desktop.
3
+ * @deprecated usar useIsMobile
4
+ */
5
+ export declare function useResponsiveDesktop(): boolean;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useResponsive/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,oBAAoB,YAGnC"}
@@ -0,0 +1,7 @@
1
+ import { useResponsive as s } from "@m4l/styles";
2
+ function p() {
3
+ return s("up", "sm");
4
+ }
5
+ export {
6
+ p as useResponsiveDesktop
7
+ };
@@ -0,0 +1,7 @@
1
+ import { ResponsiveContainerStateWithActions } from '../../contexts/ResponsiveContainerContext/types';
2
+ /**
3
+ * Hook to use the responsive container store
4
+ * @deprecated usa use
5
+ */
6
+ export declare function useResponsiveContainerStore<T>(selector: (state: ResponsiveContainerStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useResponsiveContainer/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AAGtG;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,mCAAmC,KAAK,CAAC,EAC3D,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,GAC1C,CAAC,CAOH"}
@@ -0,0 +1,12 @@
1
+ import { useContext as r } from "react";
2
+ import { useStore as n } from "zustand";
3
+ import { ResponsiveContainerContext as s } from "../../contexts/ResponsiveContainerContext/index.js";
4
+ function p(t, o) {
5
+ const e = r(s);
6
+ if (!e)
7
+ throw new Error("useAreasStore context must be use inside AreasContext");
8
+ return n(e, t, o);
9
+ }
10
+ export {
11
+ p as useResponsiveContainerStore
12
+ };
@@ -0,0 +1,12 @@
1
+ import { UseRowsProps } from './types';
2
+ /**
3
+ * Hook para obtener las filas de la lista de elementos
4
+ */
5
+ export declare const useRows: <TRow>(props: UseRowsProps<TRow>) => {
6
+ rows: TRow[];
7
+ clearRows: () => void;
8
+ refresh: () => void;
9
+ setRows: (rows: TRow[]) => void;
10
+ loading: boolean;
11
+ };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useRows/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,IAAI,EAAE,OAAO,YAAY,CAAC,IAAI,CAAC;;;;oBAmGlB,IAAI,EAAE;;CAS1C,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { useReducer as D, useRef as F, useCallback as i, useEffect as u } from "react";
2
+ import { useHostTools as I, useNetwork as W, useModuleSkeleton as b, useModuleDictionary as A } from "@m4l/core";
3
+ import { useFirstRender as G } from "../useFirstRender/index.js";
4
+ import { reducer as M, getInitialState as H, shouldRefresh as q } from "./state.js";
5
+ const v = (R) => {
6
+ const {
7
+ endPoint: y,
8
+ timeout: m = 5e3,
9
+ queryParams: s,
10
+ fireOnChangeParms: n = !1,
11
+ fireOnFirstLoad: S = !0,
12
+ startProgress: g,
13
+ stopProgress: h,
14
+ isRemote: E = !0,
15
+ bodyToSnakeCase: P = !1,
16
+ responseToCamelCase: O = !1,
17
+ initialRows: T = [],
18
+ onNetworkError: l,
19
+ refreshOnChangeDictionary: c = !1
20
+ } = R, [t, e] = D(
21
+ M,
22
+ H(n, S, T)
23
+ ), { startProgress: w, stopProgress: C } = I(), { networkOperation: k } = W(), f = b(), { getLabel: _ } = A(), p = F(s), d = G([s]), r = i(() => {
24
+ e({ type: "INCREMENT_REFRESH" });
25
+ }, []);
26
+ u(() => {
27
+ q(d, t, s, p.current, n) && r(), p.current = s;
28
+ }, [s, d, t, n, r]), u(() => {
29
+ let o = !0;
30
+ if (t.countRefresh !== 0)
31
+ return e({ type: "SET_LOADING", payload: !0 }), k({
32
+ method: "GET",
33
+ endPoint: y,
34
+ timeout: m,
35
+ parms: {
36
+ ...s
37
+ },
38
+ bodyToSnakeCase: P,
39
+ responseToCamelCase: O,
40
+ options: {
41
+ startProgress: g || w,
42
+ stopProgress: h || C
43
+ },
44
+ isRemote: E
45
+ }).then((a) => {
46
+ o && e({ type: "SET_ROWS", payload: a.data });
47
+ }).catch((a) => {
48
+ e({ type: "SET_ROWS", payload: [] }), l && l(a.status);
49
+ }).finally(() => {
50
+ e({ type: "SET_LOADING", payload: !1 });
51
+ }), function() {
52
+ o = !1;
53
+ };
54
+ }, [t.countRefresh]), u(() => {
55
+ !f && c && r();
56
+ }, [_, c, f]);
57
+ const N = i(() => {
58
+ e({ type: "CLEAR_ROWS" });
59
+ }, []), L = i((o) => e({ type: "SET_ROWS", payload: o }), [e]);
60
+ return {
61
+ rows: t.rows,
62
+ clearRows: N,
63
+ refresh: r,
64
+ setRows: L,
65
+ loading: t.loading
66
+ };
67
+ };
68
+ export {
69
+ v as useRows
70
+ };
@@ -0,0 +1,30 @@
1
+ export interface State<TRow> {
2
+ countRefresh: number;
3
+ rows: TRow[];
4
+ fireOnFirstLoad: boolean;
5
+ loading: boolean;
6
+ }
7
+ export type Action<TRow> = {
8
+ type: 'INCREMENT_REFRESH';
9
+ } | {
10
+ type: 'SET_ROWS';
11
+ payload: TRow[];
12
+ } | {
13
+ type: 'SET_LOADING';
14
+ payload: boolean;
15
+ } | {
16
+ type: 'CLEAR_ROWS';
17
+ };
18
+ /**
19
+ * Obtiene el estado inicial de la lista de elementos
20
+ */
21
+ export declare const getInitialState: <TRow>(fireOnChangeParms: boolean, fireOnFirstLoad: boolean, initialRows: TRow[]) => State<TRow>;
22
+ /**
23
+ * Reducer para actualizar el estado de la lista de elementos
24
+ */
25
+ export declare const reducer: <TRow>(state: State<TRow>, action: Action<TRow>) => State<TRow>;
26
+ /**
27
+ * Verifica si se debe actualizar la lista de elementos
28
+ */
29
+ export declare const shouldRefresh: <T>(isFirstRender: boolean, state: State<T>, currentParams: any, previousParams: any, fireOnChangeParms: boolean) => boolean;
30
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useRows/state.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,KAAK,CAAC,IAAI;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,MAAM,CAAC,IAAI,IACnB;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,IAAI,EAAE,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,EAAE,mBAAmB,OAAO,EAAE,iBAAiB,OAAO,EAAE,aAAa,IAAI,EAAE,KAAG,KAAK,CAAC,IAAI,CAK1H,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,MAAM,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,IAAI,CAalF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,eAAe,OAAO,EACtB,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,eAAe,GAAG,EAClB,gBAAgB,GAAG,EACnB,mBAAmB,OAAO,KACzB,OAUF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { deepEqual as t } from "fast-equals";
2
+ const f = (r, e, u) => ({
3
+ countRefresh: r ? 1 : 0,
4
+ rows: u,
5
+ fireOnFirstLoad: e,
6
+ loading: !1
7
+ }), a = (r, e) => {
8
+ switch (e.type) {
9
+ case "INCREMENT_REFRESH":
10
+ return { ...r, countRefresh: r.countRefresh + 1 };
11
+ case "SET_ROWS":
12
+ return { ...r, rows: e.payload };
13
+ case "SET_LOADING":
14
+ return { ...r, loading: e.payload };
15
+ case "CLEAR_ROWS":
16
+ return { ...r, rows: [] };
17
+ default:
18
+ return r;
19
+ }
20
+ }, c = (r, e, u, o, n) => !!(r && e.fireOnFirstLoad || !r && !t(o, u) && n);
21
+ export {
22
+ f as getInitialState,
23
+ a as reducer,
24
+ c as shouldRefresh
25
+ };
@@ -0,0 +1,10 @@
1
+ import { AxiosOptions, NetworkProps } from '../../../../core/src/index.ts';
2
+ export interface UseRowsProps<TRow> extends Pick<NetworkProps, 'endPoint' | 'timeout' | 'isRemote' | 'bodyToSnakeCase' | 'responseToCamelCase'>, AxiosOptions {
3
+ fireOnChangeParms?: boolean;
4
+ fireOnFirstLoad?: boolean;
5
+ queryParams: Record<string, unknown>;
6
+ initialRows?: TRow[];
7
+ onNetworkError?: (code: number) => void;
8
+ refreshOnChangeDictionary?: boolean;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useRows/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAG,YAAY,EAAE,MAAM,WAAW,CAAC;AAGxD,MAAM,WAAW,YAAY,CAAC,IAAI,CAChC,SAAQ,IAAI,CACR,YAAY,EACZ,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,qBAAqB,CAChF,EACD,YAAY;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
@@ -0,0 +1,10 @@
1
+ import { ThemeSettingsStateWithActions } from '../../contexts/ThemeSettingsContext/types';
2
+ /**
3
+ * Hook to use the settings store
4
+ * @author Juan Escobar - automatic
5
+ * @createdAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedUser Juan Escobar - automatic
8
+ */
9
+ export declare function useThemeSettingsStore<T>(selector: (state: ThemeSettingsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useThemSettingsStore/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAG1F;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,CAAC,EACrD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,GAC1C,CAAC,CAOH"}
@@ -0,0 +1,12 @@
1
+ import { useContext as r } from "react";
2
+ import { useStore as n } from "zustand";
3
+ import { ThemeSettingsContext as s } from "../../contexts/ThemeSettingsContext/ThemeSettingsContext.js";
4
+ function S(e, o) {
5
+ const t = r(s);
6
+ if (!t)
7
+ throw new Error("useSettingsStore context must be use inside SettignsContext");
8
+ return n(t, e, o);
9
+ }
10
+ export {
11
+ S as useThemeSettingsStore
12
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook encargado obtener el valor del userAgent, y reaccionar a cambios en el mismo.
3
+ */
4
+ export declare const useUserAgent: () => string;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/hooks/useUserAgent/index.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,MAM/B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { debounce as s } from "@mui/material";
2
+ import { useSyncExternalStore as o } from "react";
3
+ const t = () => navigator.userAgent, i = (e) => {
4
+ const n = s(
5
+ () => {
6
+ e(navigator.userAgent);
7
+ },
8
+ 500
9
+ ), r = () => {
10
+ e(navigator.userAgent);
11
+ };
12
+ return window.addEventListener("userAgentChange", r), window.addEventListener("resize", n), () => {
13
+ window.removeEventListener("userAgentChange", r), window.removeEventListener("resize", n);
14
+ };
15
+ }, d = () => o(
16
+ i,
17
+ // Función de suscripción
18
+ t,
19
+ // Función para obtener el estado actual
20
+ t
21
+ // (Opcional) Función para obtener el valor en SSR
22
+ );
23
+ export {
24
+ d as useUserAgent
25
+ };
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/graphics/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.2.3-beta.0",
3
+ "version": "7.2.3-beta.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,7 +11,7 @@
11
11
  "files": [
12
12
  "index.js",
13
13
  "index.d.ts",
14
- "lib/**/*"
14
+ "*"
15
15
  ],
16
16
  "exports": {
17
17
  "./package.json": "./package.json",
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { cleanup, screen, renderHook } from '@testing-library/react';
2
+ import { default as React, act } from 'react';
3
+ /**
4
+ * customRender
5
+ */
6
+ declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
7
+ export { default as userEvent } from '@testing-library/user-event';
8
+ export { customRender as render, renderHook, screen, cleanup, act };
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAgC,MAAM,wBAAwB,CAAC;AAClF,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAWnC;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,IAAI,KAAK,CAAC,YAAY,EAAE,YAAY,iIASzD,CAAC;AACF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ export type AnchorEl = HTMLElement | (() => HTMLElement);
2
+ export interface AnchorOrigin {
3
+ vertical: 'top' | 'center' | 'bottom' | number;
4
+ horizontal: 'left' | 'center' | 'right' | number;
5
+ }
6
+ export interface AnchorPosition {
7
+ top: number;
8
+ left: number;
9
+ }
10
+ /**
11
+ * Get the position of the element based on the anchor element
12
+ * @author Juan Escobar - automatic
13
+ * @createdAt 2024-10-06 20:06:37 - automatic
14
+ * @updatedAt 2024-10-06 20:06:38 - automatic
15
+ * @updatedUser Juan Escobar - automatic
16
+ */
17
+ export declare const getAnchorElPositionWindow: (anchorElement: HTMLElement, newWindowRect: Pick<DOMRect, "width" | "height">, anchorOrigin: AnchorOrigin, transformOrigin: AnchorOrigin, marginThreshold?: number) => {
18
+ top: number;
19
+ left: number;
20
+ };
21
+ //# sourceMappingURL=anchorEl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorEl.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/utils/anchorEl.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAyFD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,eAAe,WAAW,EAC1B,eAAe,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,EAEhD,cAAc,YAAY,EAC1B,iBAAiB,YAAY,EAC7B,wBAAoB;;;CAkDrB,CAAC"}