@m4l/graphics 6.0.2 → 6.0.3

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.
@@ -4,7 +4,7 @@ declare const HostThemeContext: import('react').Context<import('./types').HostTh
4
4
  * Host theme provider
5
5
  * @author Juan Escobar - automatic
6
6
  * @createdAt 2024-10-06 20:07:18 - automatic
7
- * @updatedAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedAt 2024-10-08 13:22:53 - automatic
8
8
  * @updatedUser Juan Escobar - automatic
9
9
  */
10
10
  declare function HostThemeProvider(props: HostThemeProviderProps): import("react").JSX.Element;
@@ -1,15 +1,15 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { createContext as h, useMemo as d } from "react";
3
- import { CssBaseline as p } from "@mui/material";
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
+ import { createContext as h, useMemo as p } from "react";
3
+ import { CssBaseline as f } from "@mui/material";
4
4
  import { deepmerge as t } from "@mui/utils";
5
- import { G as f } from "../../components/GlobalStyles/index.js";
6
- import { createTheme as u, experimental_extendTheme as x, Experimental_CssVarsProvider as T, StyledEngineProvider as v } from "@mui/material/styles";
7
- const C = h(null);
8
- function y(l) {
9
- const { children: c, hostThemeOptions: n, fnComponentsOverrides: s, isMobile: m } = l, a = d(() => {
5
+ import { G as u } from "../../components/GlobalStyles/index.js";
6
+ import { experimental_extendTheme as x, Experimental_CssVarsProvider as v, StyledEngineProvider as C } from "@mui/material/styles";
7
+ import { u as S } from "../../hooks/useIsMobile/index.js";
8
+ const T = h(null);
9
+ function E(c) {
10
+ const { children: a, hostThemeOptions: s, fnComponentsOverrides: n, isMobileForced: i } = c, m = S(i), d = p(() => {
10
11
  const e = {
11
- ...u(),
12
- ...n
12
+ ...s
13
13
  }, r = x({
14
14
  cssVarPrefix: "m4l",
15
15
  colorSchemes: {
@@ -21,26 +21,27 @@ function y(l) {
21
21
  isMobile: m
22
22
  }
23
23
  });
24
- return r.components = s(r), r;
24
+ return r.components = n(r), r;
25
25
  }, [m]);
26
- return /* @__PURE__ */ i(T, { theme: a, children: [
27
- /* @__PURE__ */ o(f, {}),
26
+ return /* @__PURE__ */ l(v, { theme: d, children: [
27
+ /* @__PURE__ */ o(u, {}),
28
28
  /* @__PURE__ */ o(
29
- C.Provider,
29
+ T.Provider,
30
30
  {
31
31
  value: {
32
- hostThemeOptions: n,
33
- fnComponentsOverrides: s
32
+ hostThemeOptions: s,
33
+ fnComponentsOverrides: n,
34
+ isMobileForced: i
34
35
  },
35
- children: /* @__PURE__ */ i(v, { injectFirst: !0, children: [
36
- /* @__PURE__ */ o(p, { enableColorScheme: !0 }),
37
- c
36
+ children: /* @__PURE__ */ l(C, { injectFirst: !0, children: [
37
+ /* @__PURE__ */ o(f, { enableColorScheme: !0 }),
38
+ a
38
39
  ] })
39
40
  }
40
41
  )
41
42
  ] });
42
43
  }
43
44
  export {
44
- C as H,
45
- y as a
45
+ T as H,
46
+ E as a
46
47
  };
@@ -1,14 +1,22 @@
1
- import { OurTheme } from '@m4l/styles';
2
1
  import { Theme, CssVarsTheme } from '@mui/material/styles';
3
2
  import { ReactNode } from 'react';
4
3
  export type EventFunListener = (...args: any[]) => void;
5
4
  export interface HostThemeType {
6
- hostThemeOptions: OurTheme;
5
+ /**
6
+ * "dataTestId" es una variable que se encarga de asignar un id a un componente
7
+ * @createdAt 2024-10-08 18:52:29 - automatic
8
+ */
9
+ dataTestId?: string;
10
+ /**
11
+ * "isMobileForced" es una variable que se encarga de forzar el modo mobile en la plataforma
12
+ * @createdAt 2024-10-08 13:22:53 - automatic
13
+ */
14
+ isMobileForced?: boolean | undefined;
15
+ hostThemeOptions: Theme;
7
16
  fnComponentsOverrides: (theme: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme) => any;
8
17
  }
9
18
  export interface HostThemeProviderProps extends HostThemeType {
10
19
  isMicroFrontEnd: boolean;
11
20
  children: ReactNode;
12
- isMobile: boolean;
13
21
  }
14
22
  export type HostThemeContextType = HostThemeType;
@@ -12,7 +12,7 @@ declare const ResponsiveContainerContext: import('react').Context<(Omit<Omit<imp
12
12
  * Proveedor de contenedor responsivo
13
13
  * @author Juan Escobar - automatic
14
14
  * @createdAt 2024-10-06 20:07:18 - automatic
15
- * @updatedAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedAt 2024-10-08 13:22:54 - automatic
16
16
  * @updatedUser Juan Escobar - automatic
17
17
  */
18
18
  declare const ResponsiveContainerProvider: (props: ResponsiveContainerProviderProps) => import("react").JSX.Element;
@@ -12,8 +12,8 @@ declare const ThemeSettingsContext: import('react').Context<(Omit<Omit<import('z
12
12
  * Theme settings provider
13
13
  * @author Juan Escobar - automatic
14
14
  * @createdAt 2024-10-06 20:07:18 - automatic
15
- * @updatedAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedAt 2024-10-08 13:22:54 - automatic
16
16
  * @updatedUser Juan Escobar - automatic
17
17
  */
18
- declare function ThemeSettingsProvider({ children, themeSettings }: ThemeSettingsProviderProps): import("react").JSX.Element;
18
+ declare function ThemeSettingsProvider({ children, themeSettingsForced }: ThemeSettingsProviderProps): import("react").JSX.Element;
19
19
  export { ThemeSettingsProvider, ThemeSettingsContext };
@@ -1,32 +1,32 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { createContext as c, useRef as a, useEffect as u } from "react";
3
- import { useNetwork as f, useLocalStorageWithListener as g } from "@m4l/core";
4
- import { OUR_THEME as p, presetsOptions as S } from "@m4l/styles";
2
+ import { createContext as a, useRef as c } from "react";
3
+ import { useLocalStorageWithListener as p } from "@m4l/core";
4
+ import { getUserThemeOptions as f, presetsOptionsMainColor as g } from "@m4l/styles";
5
5
  import { c as h } from "./store.js";
6
- import { d as l } from "./constants.js";
7
- import { u as T } from "../../hooks/useIsMobile/index.js";
8
- const d = c(null);
9
- function b({ children: o, themeSettings: t }) {
10
- const { networkOperation: s } = f(), r = T(), [n, i] = g(
6
+ import { d as r } from "./constants.js";
7
+ const l = a(null);
8
+ function x({ children: s, themeSettingsForced: t }) {
9
+ const [n, i] = p(
11
10
  "theme_setting",
12
- {}
13
- ), e = a();
11
+ r
12
+ ), o = {
13
+ ...r,
14
+ //Por si hay algo en el local storage incopatible con el default
15
+ ...n,
16
+ ...t || {}
17
+ //Si es forzado, se sobreescribe y por eso es el último
18
+ }, e = c();
14
19
  return e.current || (e.current = h({
15
- networkOperation: s,
16
- currentThemeSettings: {
17
- ...l,
18
- ...t,
19
- ...n
20
- },
21
- themeOptions: p,
22
- colorOption: S,
20
+ themeUserSettings: o,
21
+ themeOptions: f(o.themeMode, o.themeColor),
22
+ presetsOptionsColorMain: g,
23
+ //Para visibilidad de los colores en el radiogroup de SettingsLayout
23
24
  open: !1,
24
- setterThemeSettings: t ? void 0 : i
25
- }), e.current.getState().settingsActions.init()), u(() => {
26
- e.current?.getState().settingsActions.setThemeSettings({ isMobile: r });
27
- }, [r]), /* @__PURE__ */ m(d.Provider, { value: e.current, children: o });
25
+ themeSettingsPersistFn: t ? void 0 : i
26
+ // Solo se instancia cuando esta en host, cuando esta storybook no se instancia, evitando guardar en localStorage
27
+ }), e.current.getState().settingsActions.init()), /* @__PURE__ */ m(l.Provider, { value: e.current, children: s });
28
28
  }
29
29
  export {
30
- d as T,
31
- b as a
30
+ l as T,
31
+ x as a
32
32
  };
@@ -1,2 +1,2 @@
1
- import { ThemeSettingsType } from './types';
2
- export declare const defaultThemeSettings: ThemeSettingsType;
1
+ import { ThemeUserSettings } from './types';
2
+ export declare const defaultThemeSettings: ThemeUserSettings;
@@ -1,10 +1,9 @@
1
1
  const e = {
2
2
  themeMode: "light",
3
3
  themeDirection: "ltr",
4
- themeColorPresets: "patronus",
4
+ themeColor: "patronus",
5
5
  themeLayout: "horizontal",
6
- themeStretch: !1,
7
- isMobile: !1
6
+ themeStretch: !1
8
7
  };
9
8
  export {
10
9
  e as d
@@ -1,3 +1,3 @@
1
1
  export * from './ThemeSettingsContext';
2
- export type { ThemeSettingsType, ThemeMode } from './types';
2
+ export type { ThemeUserSettings as ThemeSettingsType, ThemeUserMode as ThemeMode } from './types';
3
3
  export { defaultThemeSettings } from './constants';
@@ -4,7 +4,7 @@ import { WritableDraft } from 'immer/dist/internal';
4
4
  * Crea la tienda de configuración del tema
5
5
  * @author Juan Escobar - automatic
6
6
  * @createdAt 2024-10-06 20:07:18 - automatic
7
- * @updatedAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedAt 2024-10-08 13:22:54 - automatic
8
8
  * @updatedUser Juan Escobar - automatic
9
9
  */
10
10
  export declare const createThemeSettingsStore: (initialState: InitialThemeSettingsStoreProps) => Omit<Omit<import('zustand').StoreApi<ThemeSettingsStateWithActions>, "setState"> & {
@@ -1,99 +1,95 @@
1
- import { createStore as l } from "zustand";
2
- import { devtools as u } from "zustand/middleware";
3
- import { immer as S } from "zustand/middleware/immer";
4
- import { getPaletteByPreset as p, typography as T, shadows as h, getColorPresets as a, createCustomShadows as d } from "@m4l/styles";
5
- import { alpha as f } from "@mui/system";
6
- import { d as c } from "./constants.js";
7
- function g(n, r = "m4l") {
1
+ import { createStore as c } from "zustand";
2
+ import { devtools as l } from "zustand/middleware";
3
+ import { immer as p } from "zustand/middleware/immer";
4
+ import { getPaletteByPreset as a, typography as u, shadows as h, getColorPresets as d, createCustomShadows as f } from "@m4l/styles";
5
+ import { alpha as U } from "@mui/system";
6
+ import { d as s } from "./constants.js";
7
+ function g(r, o = "m4l") {
8
8
  const m = document.querySelector('[data-mui-color-scheme="light"]');
9
- if (!m) {
10
- console.error('Element with data-mui-color-scheme="light" not found.');
11
- return;
12
- }
13
- Object.keys(n).forEach((t) => {
14
- const e = n[t];
9
+ m && Object.keys(r).forEach((t) => {
10
+ const e = r[t];
15
11
  if (typeof e == "string" || typeof e == "number") {
16
- const s = `--${r}-${t}`;
17
- m.style.setProperty(s, e.toString());
18
- } else typeof e == "object" && e !== null && g(e, `${r}-${t}`);
12
+ const S = `--${o}-${t}`;
13
+ m.style.setProperty(S, e.toString());
14
+ } else typeof e == "object" && e !== null && g(e, `${o}-${t}`);
19
15
  });
20
16
  }
21
- const o = (n) => {
22
- const r = n.currentThemeSettings || c, m = r.themeMode === "light", t = p(r.themeColorPresets), e = m ? t.light : t.dark;
23
- n.themeOptions = {
24
- ...n.themeOptions,
25
- typography: T,
17
+ const n = (r) => {
18
+ const o = r.themeUserSettings || s, m = o.themeMode === "light", t = a(o.themeColor), e = m ? t.light : t.dark;
19
+ r.themeOptions = {
20
+ ...r.themeOptions,
21
+ typography: u,
26
22
  palette: {
27
- ...n.themeOptions?.palette ?? {},
23
+ ...r.themeOptions?.palette ?? {},
28
24
  ...e
29
25
  },
30
26
  shape: { borderRadius: 8 },
31
- direction: r.themeDirection,
27
+ direction: o.themeDirection,
32
28
  shadows: m ? h.light : h.dark,
33
29
  customShadows: {
34
- primary: `0 8px 16px 0 ${f(
35
- a(r.themeColorPresets)?.main || "#fff",
30
+ primary: `0 8px 16px 0 ${U(
31
+ d(o.themeColor)?.main || "#fff",
36
32
  0.2
37
33
  )}`,
38
- ...d(r.themeMode)
34
+ ...f(o.themeMode)
39
35
  },
40
- stretch: r.themeStretch
41
- }, g(n.themeOptions);
42
- }, i = (n) => {
43
- n.setterThemeSettings && n.setterThemeSettings(n.currentThemeSettings);
44
- }, b = (n) => l(
45
- u(
46
- S((r, m) => ({
47
- ...n,
36
+ stretch: o.themeStretch
37
+ }, g(r.themeOptions);
38
+ }, i = (r) => {
39
+ r.themeSettingsPersistFn && r.themeSettingsPersistFn(r.themeUserSettings);
40
+ }, P = (r) => c(
41
+ l(
42
+ p((o, m) => ({
43
+ ...r,
48
44
  settingsActions: {
49
45
  /**
50
46
  * Inicializa la tienda de configuración del tema
51
47
  * @author Juan Escobar - automatic
52
48
  * @createdAt 2024-10-06 20:07:18 - automatic
53
- * @updatedAt 2024-10-06 20:07:18 - automatic
49
+ * @updatedAt 2024-10-08 13:22:54 - automatic
54
50
  * @updatedUser Juan Escobar - automatic
55
51
  */
56
52
  init: () => {
57
- r((t) => {
58
- o(t);
53
+ o((t) => {
54
+ n(t);
59
55
  });
60
56
  },
61
57
  /**
62
58
  * Establece la configuración del tema
63
59
  * @author Juan Escobar - automatic
64
60
  * @createdAt 2024-10-06 20:07:18 - automatic
65
- * @updatedAt 2024-10-06 20:07:18 - automatic
61
+ * @updatedAt 2024-10-08 13:22:54 - automatic
66
62
  * @updatedUser Juan Escobar - automatic
67
63
  */
68
64
  setThemeSettings: (t) => {
69
- r((e) => {
70
- e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, i(e), o(e);
65
+ o((e) => {
66
+ e.themeUserSettings = { ...e.themeUserSettings, ...t }, i(e), n(e);
71
67
  });
72
68
  },
73
69
  /**
74
70
  * Cambia el modo del tema
75
71
  * @author Juan Escobar - automatic
76
72
  * @createdAt 2024-10-06 20:07:18 - automatic
77
- * @updatedAt 2024-10-06 20:07:18 - automatic
73
+ * @updatedAt 2024-10-08 13:22:54 - automatic
78
74
  * @updatedUser Juan Escobar - automatic
79
75
  */
80
76
  onChangeMode: (t) => {
81
- r((e) => {
82
- e.currentThemeSettings = {
83
- ...e.currentThemeSettings,
77
+ o((e) => {
78
+ e.themeUserSettings = {
79
+ ...e.themeUserSettings,
84
80
  themeMode: t.target.value
85
- }, i(e), o(e);
81
+ }, i(e), n(e);
86
82
  });
87
83
  },
88
84
  /**
89
85
  * Abre o cierra el panel de configuración del tema
90
86
  * @author Juan Escobar - automatic
91
87
  * @createdAt 2024-10-06 20:07:18 - automatic
92
- * @updatedAt 2024-10-06 20:07:18 - automatic
88
+ * @updatedAt 2024-10-08 13:22:54 - automatic
93
89
  * @updatedUser Juan Escobar - automatic
94
90
  */
95
91
  handleOpen: () => {
96
- r((t) => {
92
+ o((t) => {
97
93
  t.open = !t.open;
98
94
  });
99
95
  },
@@ -101,74 +97,74 @@ const o = (n) => {
101
97
  * Cambia la dirección del tema
102
98
  * @author Juan Escobar - automatic
103
99
  * @createdAt 2024-10-06 20:07:18 - automatic
104
- * @updatedAt 2024-10-06 20:07:18 - automatic
100
+ * @updatedAt 2024-10-08 13:22:54 - automatic
105
101
  * @updatedUser Juan Escobar - automatic
106
102
  */
107
103
  onChangeDirection: (t) => {
108
- r((e) => {
109
- e.currentThemeSettings = {
110
- ...e.currentThemeSettings,
104
+ o((e) => {
105
+ e.themeUserSettings = {
106
+ ...e.themeUserSettings,
111
107
  themeDirection: t.target.value
112
- }, i(e), o(e);
108
+ }, i(e), n(e);
113
109
  });
114
110
  },
115
111
  /**
116
112
  * Cambia el color del tema
117
113
  * @author Juan Escobar - automatic
118
114
  * @createdAt 2024-10-06 20:07:18 - automatic
119
- * @updatedAt 2024-10-06 20:07:18 - automatic
115
+ * @updatedAt 2024-10-08 13:22:54 - automatic
120
116
  * @updatedUser Juan Escobar - automatic
121
117
  */
122
118
  onChangeColor: (t) => {
123
- r((e) => {
124
- e.currentThemeSettings = {
125
- ...e.currentThemeSettings,
126
- themeColorPresets: t.target.value
127
- }, i(e), o(e);
119
+ o((e) => {
120
+ e.themeUserSettings = {
121
+ ...e.themeUserSettings,
122
+ themeColor: t.target.value
123
+ }, i(e), n(e);
128
124
  });
129
125
  },
130
126
  /**
131
127
  * Cambia el diseño del tema
132
128
  * @author Juan Escobar - automatic
133
129
  * @createdAt 2024-10-06 20:07:18 - automatic
134
- * @updatedAt 2024-10-06 20:07:18 - automatic
130
+ * @updatedAt 2024-10-08 13:22:54 - automatic
135
131
  * @updatedUser Juan Escobar - automatic
136
132
  */
137
133
  onChangeLayout: (t) => {
138
- r((e) => {
139
- e.currentThemeSettings = {
140
- ...e.currentThemeSettings,
134
+ o((e) => {
135
+ e.themeUserSettings = {
136
+ ...e.themeUserSettings,
141
137
  themeLayout: t.target.value
142
- }, i(e), o(e);
138
+ }, i(e), n(e);
143
139
  });
144
140
  },
145
141
  /**
146
142
  * Cambia el estiramiento del tema
147
143
  * @author Juan Escobar - automatic
148
144
  * @createdAt 2024-10-06 20:07:18 - automatic
149
- * @updatedAt 2024-10-06 20:07:18 - automatic
145
+ * @updatedAt 2024-10-08 13:22:54 - automatic
150
146
  * @updatedUser Juan Escobar - automatic
151
147
  */
152
148
  onToggleStretch: () => {
153
- r((t) => {
154
- t.currentThemeSettings = {
155
- ...t.currentThemeSettings,
156
- themeStretch: !t.currentThemeSettings.themeStretch
157
- }, i(t), o(t);
149
+ o((t) => {
150
+ t.themeUserSettings = {
151
+ ...t.themeUserSettings,
152
+ themeStretch: !t.themeUserSettings.themeStretch
153
+ }, i(t), n(t);
158
154
  });
159
155
  },
160
156
  /**
161
157
  * Resetea la configuración del tema
162
158
  * @author Juan Escobar - automatic
163
159
  * @createdAt 2024-10-06 20:07:18 - automatic
164
- * @updatedAt 2024-10-06 20:07:18 - automatic
160
+ * @updatedAt 2024-10-08 13:22:54 - automatic
165
161
  * @updatedUser Juan Escobar - automatic
166
162
  */
167
163
  onResetSetting: () => {
168
- r((t) => {
169
- t.currentThemeSettings = {
170
- ...c
171
- }, i(t), o(t);
164
+ o((t) => {
165
+ t.themeUserSettings = {
166
+ ...s
167
+ }, i(t), n(t);
172
168
  });
173
169
  }
174
170
  }
@@ -177,5 +173,5 @@ const o = (n) => {
177
173
  )
178
174
  );
179
175
  export {
180
- b as c
176
+ P as c
181
177
  };
@@ -1,50 +1,56 @@
1
- import { NetworkProps } from '@m4l/core';
2
- import { OurTheme, PresetsOptions, ThemeColorOptionsType } from '@m4l/styles';
3
- import { CssVarsTheme, Theme } from '@mui/material/styles';
1
+ import { PresetsOptionsColorMain, ThemeUserColor } from '@m4l/styles';
2
+ import { Theme } from '@mui/material/styles';
4
3
  import { ReactNode } from 'react';
5
- export type ThemeMode = 'light' | 'dark';
6
- export type ThemeDirection = 'rtl' | 'ltr';
7
- export type ThemeLayout = 'vertical' | 'horizontal';
8
- export type ThemeStretch = boolean;
9
- export type ThemeSettingsType = {
10
- themeMode: ThemeMode;
11
- themeDirection: ThemeDirection;
12
- themeColorPresets: ThemeColorOptionsType;
13
- themeStretch: ThemeStretch;
14
- themeLayout: ThemeLayout;
15
- isMobile: boolean;
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;
16
18
  };
17
19
  export interface ThemeSettingsStore {
18
- networkOperation: (props: NetworkProps) => Promise<any>;
19
- currentThemeSettings: ThemeSettingsType;
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;
20
25
  /**
21
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.
22
27
  * @createdAt 2024-10-06 20:07:18 - automatic
23
28
  */
24
- themeOptions: (Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme) | OurTheme;
25
- colorOption: PresetsOptions;
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;
26
35
  /**
27
- * "setterThemeSettings" es una función que se encarga de persistir en local storage los cambios de los settings
36
+ * "themeSettingsPersistFn" es una función que se encarga de persistir en local storage los cambios de los settings
28
37
  * Solo se instancia cuando esta en host, cuando esta storybook no se instancia
29
38
  * @author Juan Escobar - automatic
30
39
  * @createdAt 2024-10-06 20:07:18 - automatic
31
- * @updatedAt 2024-10-06 20:07:18 - automatic
40
+ * @updatedAt 2024-10-08 13:26:41 - automatic
32
41
  * @updatedUser Juan Escobar - automatic
33
42
  */
34
- setterThemeSettings?: (newValue: ThemeSettingsType) => void;
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
+ */
35
48
  open: boolean;
36
49
  }
37
50
  export type DefaultThemeSettingsStoreProps = ThemeSettingsStore;
38
51
  export type InitialThemeSettingsStoreProps = DefaultThemeSettingsStoreProps;
39
52
  export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
40
53
  settingsActions: {
41
- /**
42
- * Inicializa la tienda de configuración del tema
43
- * @author Juan Escobar - automatic
44
- * @createdAt 2024-10-06 20:07:18 - automatic
45
- * @updatedAt 2024-10-06 20:07:18 - automatic
46
- * @updatedUser Juan Escobar - automatic
47
- */
48
54
  init: () => void;
49
55
  onToggleStretch: VoidFunction;
50
56
  onResetSetting: VoidFunction;
@@ -53,10 +59,13 @@ export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
53
59
  onChangeColor: (event: React.ChangeEvent<HTMLInputElement>) => void;
54
60
  onChangeLayout: (event: React.ChangeEvent<HTMLInputElement>) => void;
55
61
  handleOpen: () => void;
56
- setThemeSettings: (newValue: Partial<ThemeSettingsType>) => void;
62
+ setThemeSettings: (newValue: Partial<ThemeUserSettings>) => void;
57
63
  };
58
64
  }
59
65
  export type ThemeSettingsProviderProps = {
60
- themeSettings?: ThemeSettingsType;
66
+ /**
67
+ * "themeSettingsForced" es una variable que se encarga de forzar las configuraciones del tema, normalmente en storybook
68
+ */
69
+ themeSettingsForced?: ThemeUserSettings;
61
70
  children: ReactNode;
62
71
  };
@@ -2,7 +2,7 @@
2
2
  * Hook to check if the device is a mobile device
3
3
  * @author Juan Escobar - automatic
4
4
  * @createdAt 2024-10-06 20:07:18 - automatic
5
- * @updatedAt 2024-10-06 20:07:18 - automatic
5
+ * @updatedAt 2024-10-08 13:22:54 - automatic
6
6
  * @updatedUser Juan Escobar - automatic
7
7
  */
8
- export declare const useIsMobile: () => boolean;
8
+ export declare const useIsMobile: (isMobileForced?: boolean) => boolean;
@@ -1,11 +1,13 @@
1
- import { useState as n, useEffect as o } from "react";
2
- import s from "lodash/throttle";
3
- const i = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), l = () => {
4
- const [t, r] = n(i());
5
- return o(() => {
6
- const e = s(
1
+ import { useState as o, useEffect as s } from "react";
2
+ import a from "lodash/throttle";
3
+ const i = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), f = (t) => {
4
+ const [r, n] = o(t || i());
5
+ return s(() => {
6
+ if (t === void 0)
7
+ return;
8
+ const e = a(
7
9
  () => {
8
- r(i());
10
+ n(i());
9
11
  },
10
12
  200,
11
13
  {
@@ -15,8 +17,8 @@ const i = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|Bl
15
17
  return window.addEventListener("resize", e), e(), () => {
16
18
  window.removeEventListener("resize", e), e.cancel();
17
19
  };
18
- }, []), t;
20
+ }, [t]), r;
19
21
  };
20
22
  export {
21
- l as u
23
+ f as u
22
24
  };
package/index.js CHANGED
@@ -3,10 +3,10 @@ import { g as s } from "./contexts/LocalesContext/helper.js";
3
3
  import { F as m, a as p } from "./contexts/FormatterContext/index.js";
4
4
  import { L as f, a as i } from "./contexts/LocalesContext/index.js";
5
5
  import { R as u, a as l } from "./contexts/ResponsiveContainerContext/index.js";
6
- import { H as v, a as C } from "./contexts/HostThemeContext/index.js";
7
- import { d as g } from "./contexts/ThemeSettingsContext/constants.js";
6
+ import { H as v, a as T } from "./contexts/HostThemeContext/index.js";
7
+ import { d as h } from "./contexts/ThemeSettingsContext/constants.js";
8
8
  import { T as R, a as S } from "./contexts/ThemeSettingsContext/ThemeSettingsContext.js";
9
- import { u as P } from "./hooks/useFirstRender/index.js";
9
+ import { u as F } from "./hooks/useFirstRender/index.js";
10
10
  import { u as L } from "./hooks/useFormatter/index.js";
11
11
  import { u as b } from "./hooks/useIsMountedRef/index.js";
12
12
  import { u as w } from "./hooks/useLocales/index.js";
@@ -17,25 +17,25 @@ import { u as D } from "./hooks/useHostTheme/index.js";
17
17
  import { u as N } from "./hooks/useResizeObserver/index.js";
18
18
  import { u as j } from "./hooks/useResponsive/index.js";
19
19
  import { u as B } from "./hooks/useThemSettingsStore/index.js";
20
- import { C as K } from "./utils/strings.js";
20
+ import { c as K } from "./utils/strings.js";
21
21
  import { g as U } from "./utils/anchorEl.js";
22
22
  export {
23
- K as Capitalize,
24
23
  m as FormatterContext,
25
24
  p as FormatterProvider,
26
25
  r as GlobalStyles,
27
26
  v as HostThemeContext,
28
- C as HostThemeProvider,
27
+ T as HostThemeProvider,
29
28
  f as LocalesContext,
30
29
  i as LocalesProvider,
31
30
  u as ResponsiveContainerContext,
32
31
  l as ResponsiveContainerProvider,
33
32
  R as ThemeSettingsContext,
34
33
  S as ThemeSettingsProvider,
35
- g as defaultThemeSettings,
34
+ K as capitalize,
35
+ h as defaultThemeSettings,
36
36
  U as getAnchorElPositionWindow,
37
37
  s as getLocaleFromNetwork,
38
- P as useFirstRender,
38
+ F as useFirstRender,
39
39
  L as useFormatter,
40
40
  D as useHostTheme,
41
41
  M as useIsMobile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "publishConfig": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@m4l/core": "^2.0.9",
21
- "@m4l/styles": "^6.5.1",
21
+ "@m4l/styles": "^7.0.0",
22
22
  "@mui/material": "^5.15.19",
23
23
  "@mui/x-date-pickers": "^6.11.1",
24
24
  "@types/react": "^18.0.0",
@@ -1 +1 @@
1
- export declare const Capitalize: (s: string) => string;
1
+ export declare const capitalize: (s: string) => string;
package/utils/strings.js CHANGED
@@ -1,4 +1,4 @@
1
1
  const a = (e) => e && e[0].toUpperCase() + e.slice(1) || "";
2
2
  export {
3
- a as C
3
+ a as c
4
4
  };