@m4l/graphics 7.2.2 → 7.2.3-beta.0
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.
- package/index.d.ts +1 -0
- package/index.js +43 -43
- package/lib/graphics.d.ts +6 -0
- package/lib/graphics.d.ts.map +1 -0
- package/package.json +29 -57
- package/components/GlobalStyles/index.d.ts +0 -8
- package/components/GlobalStyles/index.js +0 -82
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/contexts/DeviceTypeContext/helper.d.ts +0 -9
- package/contexts/DeviceTypeContext/helper.js +0 -4
- package/contexts/DeviceTypeContext/index.d.ts +0 -15
- package/contexts/DeviceTypeContext/index.js +0 -18
- package/contexts/DeviceTypeContext/store.d.ts +0 -18
- package/contexts/DeviceTypeContext/store.js +0 -36
- package/contexts/DeviceTypeContext/types.d.ts +0 -36
- package/contexts/FormatterContext/index.d.ts +0 -12
- package/contexts/FormatterContext/index.js +0 -74
- package/contexts/FormatterContext/types.d.ts +0 -58
- package/contexts/HostThemeContext/index.d.ts +0 -11
- package/contexts/HostThemeContext/index.js +0 -46
- package/contexts/HostThemeContext/types.d.ts +0 -17
- package/contexts/LocalesContext/helper.d.ts +0 -25
- package/contexts/LocalesContext/helper.js +0 -35
- package/contexts/LocalesContext/index.d.ts +0 -11
- package/contexts/LocalesContext/index.js +0 -71
- package/contexts/LocalesContext/types.d.ts +0 -26
- package/contexts/ResponsiveContainerContext/constants.d.ts +0 -2
- package/contexts/ResponsiveContainerContext/constants.js +0 -4
- package/contexts/ResponsiveContainerContext/index.d.ts +0 -16
- package/contexts/ResponsiveContainerContext/index.js +0 -51
- package/contexts/ResponsiveContainerContext/store.d.ts +0 -18
- package/contexts/ResponsiveContainerContext/store.js +0 -33
- package/contexts/ResponsiveContainerContext/types.d.ts +0 -26
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts +0 -19
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.js +0 -32
- package/contexts/ThemeSettingsContext/constants.d.ts +0 -2
- package/contexts/ThemeSettingsContext/constants.js +0 -10
- package/contexts/ThemeSettingsContext/index.d.ts +0 -3
- package/contexts/ThemeSettingsContext/index.js +0 -1
- package/contexts/ThemeSettingsContext/store.d.ts +0 -19
- package/contexts/ThemeSettingsContext/store.js +0 -177
- package/contexts/ThemeSettingsContext/types.d.ts +0 -71
- package/contexts/index.d.ts +0 -12
- package/contexts/index.js +0 -1
- package/hooks/index.d.ts +0 -14
- package/hooks/index.js +0 -1
- package/hooks/useFirstRender/index.d.ts +0 -9
- package/hooks/useFirstRender/index.js +0 -10
- package/hooks/useFormatter/index.d.ts +0 -8
- package/hooks/useFormatter/index.js +0 -11
- package/hooks/useHostTheme/index.d.ts +0 -8
- package/hooks/useHostTheme/index.js +0 -11
- package/hooks/useIsMobile/index.d.ts +0 -14
- package/hooks/useIsMobile/index.js +0 -16
- package/hooks/useIsMountedRef/index.d.ts +0 -8
- package/hooks/useIsMountedRef/index.js +0 -13
- package/hooks/useLocales/index.d.ts +0 -8
- package/hooks/useLocales/index.js +0 -11
- package/hooks/useOffSetTop.d.ts +0 -8
- package/hooks/useOffSetTop.js +0 -12
- package/hooks/usePaginate/index.d.ts +0 -14
- package/hooks/usePaginate/index.js +0 -76
- package/hooks/usePaginate/index.test.d.ts +0 -35
- package/hooks/usePaginate/types.d.ts +0 -21
- package/hooks/usePaginate/types.js +0 -8
- package/hooks/useResizeObserver/index.d.ts +0 -9
- package/hooks/useResizeObserver/index.js +0 -18
- package/hooks/useResponsive/index.d.ts +0 -5
- package/hooks/useResponsive/index.js +0 -7
- package/hooks/useResponsiveContainer/index.d.ts +0 -6
- package/hooks/useResponsiveContainer/index.js +0 -12
- package/hooks/useRows/index.d.ts +0 -11
- package/hooks/useRows/index.js +0 -70
- package/hooks/useRows/index.test.d.ts +0 -1
- package/hooks/useRows/state.d.ts +0 -29
- package/hooks/useRows/state.js +0 -25
- package/hooks/useRows/state.test.d.ts +0 -1
- package/hooks/useRows/types.d.ts +0 -9
- package/hooks/useThemSettingsStore/index.d.ts +0 -9
- package/hooks/useThemSettingsStore/index.js +0 -12
- package/hooks/useUserAgent/index.d.ts +0 -4
- package/hooks/useUserAgent/index.js +0 -25
- package/test/setup.d.ts +0 -0
- package/test/utils.d.ts +0 -9
- package/utils/anchorEl.d.ts +0 -20
- package/utils/anchorEl.js +0 -49
- package/utils/getContrastTextColor/getContrastTextColor.d.ts +0 -5
- package/utils/getContrastTextColor/getContrastTextColor.js +0 -14
- package/utils/getContrastTextColor/index.d.ts +0 -2
- package/utils/getContrastTextColor/index.js +0 -1
- package/utils/getContrastTextColor/types.d.ts +0 -2
- package/utils/index.d.ts +0 -3
- package/utils/index.js +0 -1
- package/utils/strings.d.ts +0 -1
- package/utils/strings.js +0 -4
- package/vite-env.d.ts +0 -1
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { createStore as c } from "zustand";
|
|
2
|
-
import { devtools as d } from "zustand/middleware";
|
|
3
|
-
import { immer as a } from "zustand/middleware/immer";
|
|
4
|
-
import { getPaletteByPreset as u, createCustomShadows as x, shadows as p, typographyOld as U, getColorPresets as m } from "@m4l/styles";
|
|
5
|
-
import { alpha as s } from "@mui/system";
|
|
6
|
-
import { d as g } from "./constants.js";
|
|
7
|
-
function l(r, o = "m4l") {
|
|
8
|
-
const n = document.querySelector('[data-mui-color-scheme="light"]');
|
|
9
|
-
n && Object.keys(r).forEach((t) => {
|
|
10
|
-
const e = r[t];
|
|
11
|
-
if (typeof e == "string" || typeof e == "number") {
|
|
12
|
-
const S = `--${o}-${t}`;
|
|
13
|
-
n.style.setProperty(S, e.toString());
|
|
14
|
-
} else typeof e == "object" && e !== null && l(e, `${o}-${t}`);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const h = (r) => {
|
|
18
|
-
const o = r.themeUserSettings || g, n = o.themeMode === "light", t = u(o.themeColor), e = n ? t.light : t.dark;
|
|
19
|
-
r.themeOptions = {
|
|
20
|
-
...r.themeOptions,
|
|
21
|
-
...U,
|
|
22
|
-
palette: {
|
|
23
|
-
...r.themeOptions?.palette ?? {},
|
|
24
|
-
...e
|
|
25
|
-
},
|
|
26
|
-
shape: { borderRadius: 8 },
|
|
27
|
-
direction: o.themeDirection,
|
|
28
|
-
shadows: n ? p.light : p.dark,
|
|
29
|
-
customShadows: {
|
|
30
|
-
primary: n ? `0 4px 8px -4px ${s(m(o.themeColor)?.enabledLight, 0.12)},
|
|
31
|
-
0 2px 27px 2px ${s(m(o.themeColor)?.enabledLight, 0.02)}` : `0 4px 8px -4px ${s(m(o.themeColor)?.enabledDark, 0.12)},
|
|
32
|
-
0 2px 27px 2px ${s(m(o.themeColor)?.enabledDark, 0.02)}`,
|
|
33
|
-
...x(o.themeMode),
|
|
34
|
-
primary2: n ? `0px 2px 3px 0px ${s(m(o.themeColor)?.hoverOpacityLight, 0.2)}` : `0px 2px 3px 0px ${s(m(o.themeColor)?.hoverOpacityDark, 0.2)}`
|
|
35
|
-
},
|
|
36
|
-
stretch: o.themeStretch
|
|
37
|
-
}, l(r.themeOptions);
|
|
38
|
-
}, i = (r) => {
|
|
39
|
-
r.themeSettingsPersistFn && r.themeSettingsPersistFn(r.themeUserSettings);
|
|
40
|
-
}, T = (r) => c(
|
|
41
|
-
d(
|
|
42
|
-
a((o, n) => ({
|
|
43
|
-
...r,
|
|
44
|
-
settingsActions: {
|
|
45
|
-
/**
|
|
46
|
-
* Inicializa la tienda de configuración del tema
|
|
47
|
-
* @author Juan Escobar - automatic
|
|
48
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
49
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
50
|
-
* @updatedUser Juan Escobar - automatic
|
|
51
|
-
*/
|
|
52
|
-
init: () => {
|
|
53
|
-
o((t) => {
|
|
54
|
-
h(t);
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
/**
|
|
58
|
-
* Establece la configuración del tema
|
|
59
|
-
* @author Juan Escobar - automatic
|
|
60
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
61
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
62
|
-
* @updatedUser Juan Escobar - automatic
|
|
63
|
-
*/
|
|
64
|
-
setThemeSettings: (t) => {
|
|
65
|
-
o((e) => {
|
|
66
|
-
e.themeUserSettings = { ...e.themeUserSettings, ...t }, i(e), h(e);
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Cambia el modo del tema
|
|
71
|
-
* @author Juan Escobar - automatic
|
|
72
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
73
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
74
|
-
* @updatedUser Juan Escobar - automatic
|
|
75
|
-
*/
|
|
76
|
-
onChangeMode: (t) => {
|
|
77
|
-
o((e) => {
|
|
78
|
-
t !== e.themeUserSettings.themeMode && (e.themeUserSettings = {
|
|
79
|
-
...e.themeUserSettings,
|
|
80
|
-
themeMode: t
|
|
81
|
-
}, i(e), h(e));
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* Abre o cierra el panel de configuración del tema
|
|
86
|
-
* @author Juan Escobar - automatic
|
|
87
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
88
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
89
|
-
* @updatedUser Juan Escobar - automatic
|
|
90
|
-
*/
|
|
91
|
-
handleOpen: () => {
|
|
92
|
-
o((t) => {
|
|
93
|
-
t.open = !t.open;
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* Cambia la dirección del tema
|
|
98
|
-
* @author Juan Escobar - automatic
|
|
99
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
100
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
101
|
-
* @updatedUser Juan Escobar - automatic
|
|
102
|
-
*/
|
|
103
|
-
onChangeDirection: (t) => {
|
|
104
|
-
o((e) => {
|
|
105
|
-
t !== e.themeUserSettings.themeDirection && (e.themeUserSettings = {
|
|
106
|
-
...e.themeUserSettings,
|
|
107
|
-
themeDirection: t
|
|
108
|
-
}, i(e), h(e));
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
/**
|
|
112
|
-
* Cambia el color del tema
|
|
113
|
-
* @author Juan Escobar - automatic
|
|
114
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
115
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
116
|
-
* @updatedUser Juan Escobar - automatic
|
|
117
|
-
*/
|
|
118
|
-
onChangeColor: (t) => {
|
|
119
|
-
o((e) => {
|
|
120
|
-
t !== e.themeUserSettings.themeColor && (e.themeUserSettings = {
|
|
121
|
-
...e.themeUserSettings,
|
|
122
|
-
themeColor: t
|
|
123
|
-
}, i(e), h(e));
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* Cambia el diseño del tema
|
|
128
|
-
* @author Juan Escobar - automatic
|
|
129
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
130
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
131
|
-
* @updatedUser Juan Escobar - automatic
|
|
132
|
-
*/
|
|
133
|
-
onChangeLayout: (t) => {
|
|
134
|
-
o((e) => {
|
|
135
|
-
e.themeUserSettings = {
|
|
136
|
-
...e.themeUserSettings,
|
|
137
|
-
themeLayout: t.target.value
|
|
138
|
-
}, i(e), h(e);
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* Cambia el estiramiento del tema
|
|
143
|
-
* @author Juan Escobar - automatic
|
|
144
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
145
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
146
|
-
* @updatedUser Juan Escobar - automatic
|
|
147
|
-
*/
|
|
148
|
-
onToggleStretch: () => {
|
|
149
|
-
o((t) => {
|
|
150
|
-
t.themeUserSettings = {
|
|
151
|
-
...t.themeUserSettings,
|
|
152
|
-
themeStretch: !t.themeUserSettings.themeStretch
|
|
153
|
-
}, i(t), h(t);
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Resetea la configuración del tema
|
|
158
|
-
* @author Juan Escobar - automatic
|
|
159
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
160
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
161
|
-
* @updatedUser Juan Escobar - automatic
|
|
162
|
-
*/
|
|
163
|
-
onResetSetting: () => {
|
|
164
|
-
o((t) => {
|
|
165
|
-
t.themeUserSettings = {
|
|
166
|
-
...g
|
|
167
|
-
}, i(t), h(t);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
})),
|
|
172
|
-
{ name: "ThemeSettingsStore" }
|
|
173
|
-
)
|
|
174
|
-
);
|
|
175
|
-
export {
|
|
176
|
-
T as c
|
|
177
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { PresetsOptionsColorMain, ThemeUserColor } from '@m4l/styles';
|
|
2
|
-
import { Theme } from '@mui/material/styles';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
export type ThemeUserMode = 'light' | 'dark';
|
|
5
|
-
export type ThemeUserDirection = 'rtl' | 'ltr';
|
|
6
|
-
export type ThemeUserLayout = 'vertical' | 'horizontal';
|
|
7
|
-
export type ThemeUserStretch = boolean;
|
|
8
|
-
/**
|
|
9
|
-
* "ThemeSettingsType" son las configuraciones que el usuario escoge para ver la plataforma
|
|
10
|
-
* @createdAt 2024-10-08 13:22:53 - automatic
|
|
11
|
-
*/
|
|
12
|
-
export type ThemeUserSettings = {
|
|
13
|
-
themeMode: ThemeUserMode;
|
|
14
|
-
themeDirection: ThemeUserDirection;
|
|
15
|
-
themeColor: ThemeUserColor;
|
|
16
|
-
themeStretch: ThemeUserStretch;
|
|
17
|
-
themeLayout: ThemeUserLayout;
|
|
18
|
-
};
|
|
19
|
-
export interface ThemeSettingsStore {
|
|
20
|
-
/**
|
|
21
|
-
* Configuraciones seleccionadas por el usuario, modo, dirección, color, estiramiento y layout
|
|
22
|
-
* @createdAt 2024-10-08 13:22:53 - automatic
|
|
23
|
-
*/
|
|
24
|
-
themeUserSettings: ThemeUserSettings;
|
|
25
|
-
/**
|
|
26
|
-
* Contiene la configuración incial del tema como la paleta, tipografía, sombras, etc. También puede contener el tema convertido a css vars.
|
|
27
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
28
|
-
*/
|
|
29
|
-
themeOptions: Theme;
|
|
30
|
-
/**
|
|
31
|
-
* "presetsOptionsColorMain" es un array de objetos que contiene el nombre y el valor de los colores principales
|
|
32
|
-
* @createdAt 2024-10-08 13:22:53 - automatic
|
|
33
|
-
*/
|
|
34
|
-
presetsOptionsColorMain: PresetsOptionsColorMain;
|
|
35
|
-
/**
|
|
36
|
-
* "themeSettingsPersistFn" es una función que se encarga de persistir en local storage los cambios de los settings
|
|
37
|
-
* Solo se instancia cuando esta en host, cuando esta storybook no se instancia
|
|
38
|
-
* @author Juan Escobar - automatic
|
|
39
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
40
|
-
* @updatedAt 2024-10-08 19:28:36 - automatic
|
|
41
|
-
* @updatedUser Juan Escobar - automatic
|
|
42
|
-
*/
|
|
43
|
-
themeSettingsPersistFn?: (newValue: ThemeUserSettings) => void;
|
|
44
|
-
/**
|
|
45
|
-
* "open" es una variable que se encarga de abrir o cerrar el formulario
|
|
46
|
-
* @createdAt 2024-10-08 13:22:53 - automatic
|
|
47
|
-
*/
|
|
48
|
-
open: boolean;
|
|
49
|
-
}
|
|
50
|
-
export type DefaultThemeSettingsStoreProps = ThemeSettingsStore;
|
|
51
|
-
export type InitialThemeSettingsStoreProps = DefaultThemeSettingsStoreProps;
|
|
52
|
-
export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
|
|
53
|
-
settingsActions: {
|
|
54
|
-
init: () => void;
|
|
55
|
-
onToggleStretch: VoidFunction;
|
|
56
|
-
onResetSetting: VoidFunction;
|
|
57
|
-
onChangeMode: (mode: ThemeUserMode) => void;
|
|
58
|
-
onChangeDirection: (direction: ThemeUserDirection) => void;
|
|
59
|
-
onChangeColor: (color: ThemeUserColor) => void;
|
|
60
|
-
onChangeLayout: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
61
|
-
handleOpen: () => void;
|
|
62
|
-
setThemeSettings: (newValue: Partial<ThemeUserSettings>) => void;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export type ThemeSettingsProviderProps = {
|
|
66
|
-
/**
|
|
67
|
-
* "themeSettingsForced" es una variable que se encarga de forzar las configuraciones del tema, normalmente en storybook
|
|
68
|
-
*/
|
|
69
|
-
themeSettingsForced?: ThemeUserSettings;
|
|
70
|
-
children: ReactNode;
|
|
71
|
-
};
|
package/contexts/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './FormatterContext';
|
|
2
|
-
export type { Formatters, DateFormatter, NumberFormatter, CurrencyFormatter, } from './FormatterContext/types';
|
|
3
|
-
export * from './LocalesContext';
|
|
4
|
-
export * from './ResponsiveContainerContext';
|
|
5
|
-
export type { BreakpointType } from './ResponsiveContainerContext/types';
|
|
6
|
-
export type { NetworkLocaleType, LocaleType } from './LocalesContext/types';
|
|
7
|
-
export { getLocaleFromNetwork } from './LocalesContext/helper';
|
|
8
|
-
export * from './HostThemeContext';
|
|
9
|
-
export * from './DeviceTypeContext';
|
|
10
|
-
export * from './ThemeSettingsContext';
|
|
11
|
-
export type { HostThemeType } from './HostThemeContext/types';
|
|
12
|
-
export type { DeviceType } from './DeviceTypeContext/types';
|
package/contexts/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/hooks/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { useFirstRender } from './useFirstRender';
|
|
2
|
-
export { useFormatter } from './useFormatter';
|
|
3
|
-
export { useIsMountedRef } from './useIsMountedRef';
|
|
4
|
-
export { useLocales } from './useLocales';
|
|
5
|
-
export { useResponsiveContainerStore } from './useResponsiveContainer';
|
|
6
|
-
export { useUserAgent } from './useUserAgent';
|
|
7
|
-
export { useIsMobile } from './useIsMobile';
|
|
8
|
-
export { useOffSetTop } from './useOffSetTop';
|
|
9
|
-
export { useHostTheme } from './useHostTheme';
|
|
10
|
-
export { useResizeObserver } from './useResizeObserver';
|
|
11
|
-
export { useResponsiveDesktop } from './useResponsive';
|
|
12
|
-
export { useThemeSettingsStore } from './useThemSettingsStore';
|
|
13
|
-
export { usePaginate } from './usePaginate';
|
|
14
|
-
export { useRows } from './useRows';
|
package/hooks/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DependencyList } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to use the first render .
|
|
4
|
-
* @author Juan Escobar - automatic
|
|
5
|
-
* @createdAt 2024-10-06 20:07:18 - automatic
|
|
6
|
-
* @updatedAt 2024-10-09 13:39:06 - automatic
|
|
7
|
-
* @updatedUser Juan Escobar - automatic
|
|
8
|
-
*/
|
|
9
|
-
export declare function useFirstRender(dependencies?: DependencyList): boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to use the formatter 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 useFormatter: () => import('../..').Formatters;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext as r } from "react";
|
|
2
|
-
import { F as e } from "../../contexts/FormatterContext/index.js";
|
|
3
|
-
const m = () => {
|
|
4
|
-
const t = r(e);
|
|
5
|
-
if (!t)
|
|
6
|
-
throw new Error("useFormatter context must be use inside FormatterProvider");
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
m as u
|
|
11
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to use the host theme 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 useHostTheme: () => import('../..').HostThemeType;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext as t } from "react";
|
|
2
|
-
import { H as o } from "../../contexts/HostThemeContext/index.js";
|
|
3
|
-
const m = () => {
|
|
4
|
-
const e = t(o);
|
|
5
|
-
if (!e)
|
|
6
|
-
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
7
|
-
return e;
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
m as u
|
|
11
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DeviceTypeWithActions } from '../../contexts/DeviceTypeContext/types';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to use the responsive container 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 useIsMobileStore<T>(selector: (state: DeviceTypeWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
10
|
-
/**
|
|
11
|
-
* hook usado para obtener el valor por defecto para los componentes que usan la prop size
|
|
12
|
-
* @returns objeto con el valor por default del size y la función para cambiarlo
|
|
13
|
-
*/
|
|
14
|
-
export declare function useIsMobile(isMobileForced?: boolean): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useContext as r } from "react";
|
|
2
|
-
import { useStore as i } from "zustand";
|
|
3
|
-
import { D as s } from "../../contexts/DeviceTypeContext/index.js";
|
|
4
|
-
function n(o, t) {
|
|
5
|
-
const e = r(s);
|
|
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 = n((e) => e.deviceType === "mobile");
|
|
12
|
-
return o || t;
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
p as u
|
|
16
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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').MutableRefObject<boolean>;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext as o } from "react";
|
|
2
|
-
import { L 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 u
|
|
11
|
-
};
|
package/hooks/useOffSetTop.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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(top: number): boolean;
|
package/hooks/useOffSetTop.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 u
|
|
12
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { useState as s, useRef as j, useCallback as v, useEffect as u } from "react";
|
|
2
|
-
import { i 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: c,
|
|
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 u(() => {
|
|
27
|
-
if (F) {
|
|
28
|
-
M(!1);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
t.current.page = 0, P && i();
|
|
32
|
-
}, [c]), u(() => {
|
|
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
|
-
...c,
|
|
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]), u(() => {
|
|
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 u
|
|
76
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { HostToolsType } from '@m4l/core';
|
|
3
|
-
import { Id, ToastOptions } from 'react-toastify';
|
|
4
|
-
export declare const mock_addFlag: import('vitest').Mock<(...args: any[]) => any>;
|
|
5
|
-
export declare const mock_networkOperation: import('vitest').Mock<(...args: any[]) => any>;
|
|
6
|
-
export declare const mock_events_add_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
7
|
-
export declare const mock_events_remove_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
8
|
-
export declare const mock_events_emit: import('vitest').Mock<(...args: any[]) => any>;
|
|
9
|
-
export declare const mock_startProgress: import('vitest').Mock<(...args: any[]) => any>;
|
|
10
|
-
export declare const mock_stopProgress: import('vitest').Mock<(...args: any[]) => any>;
|
|
11
|
-
export interface ToasterFunctionProps {
|
|
12
|
-
title: ReactNode;
|
|
13
|
-
description?: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export type Toaster = {
|
|
16
|
-
(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
17
|
-
success(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
18
|
-
info(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
19
|
-
warning(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
20
|
-
error(props: ToasterFunctionProps, toastOptions?: ToastOptions): Id;
|
|
21
|
-
};
|
|
22
|
-
export declare const mock_toaster: Toaster;
|
|
23
|
-
export declare const environmentDataForTesting: {
|
|
24
|
-
isLocalhost: boolean;
|
|
25
|
-
host: string;
|
|
26
|
-
domain_token: string;
|
|
27
|
-
host_api_local: string;
|
|
28
|
-
host_api_remote: string;
|
|
29
|
-
host_static_assets: string;
|
|
30
|
-
environment_assets: string;
|
|
31
|
-
isMicroFrontend: boolean;
|
|
32
|
-
isIsolatation: boolean;
|
|
33
|
-
database: string;
|
|
34
|
-
};
|
|
35
|
-
export declare const hostToolsDataForTesting: HostToolsType;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AxiosOptions, GetLabelType, NetworkProps } from '@m4l/core';
|
|
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
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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>;
|
|
9
|
-
export default useResizeObserver;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRef as u, useLayoutEffect as o } from "react";
|
|
2
|
-
function f(n) {
|
|
3
|
-
const e = u(null);
|
|
4
|
-
return o(() => {
|
|
5
|
-
const r = e?.current;
|
|
6
|
-
if (!r)
|
|
7
|
-
return;
|
|
8
|
-
const t = new ResizeObserver((s) => {
|
|
9
|
-
n(r, s[0]);
|
|
10
|
-
});
|
|
11
|
-
return t.observe(r), () => {
|
|
12
|
-
t.disconnect();
|
|
13
|
-
};
|
|
14
|
-
}, [n, e.current]), e;
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
f as u
|
|
18
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|