@m4l/graphics 6.0.2-alpha.2 → 6.0.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.
@@ -1 +1,8 @@
1
+ /**
2
+ * Estilos globales
3
+ * @author Juan Escobar - automatic
4
+ * @createdAt 2024-10-06 20:07:17 - automatic
5
+ * @updatedAt 2024-10-06 20:07:18 - automatic
6
+ * @updatedUser Juan Escobar - automatic
7
+ */
1
8
  export declare function GlobalStyles(): import("react").JSX.Element;
@@ -1,15 +1,12 @@
1
1
  import { FormatterProviderProps, Formatters } from './types';
2
2
  declare const FormatterContext: import('react').Context<Formatters | null>;
3
3
  /**
4
- * @function
5
4
  * Componente encargado de proveer un contexto que permita saber los diferentes forrmatos,
6
5
  * Segunda linea
7
- * @param props Objeto de propiedades
8
- * @version 1.0.0
9
- * @author Juan Andrés Escobar
10
- * @date 2023-02-11
11
- * @beta
12
- * @link
6
+ * @author Juan Escobar - automatic
7
+ * @createdAt 2024-10-06 20:07:18 - automatic
8
+ * @updatedAt 2024-10-06 20:07:18 - automatic
9
+ * @updatedUser Juan Escobar - automatic
13
10
  */
14
11
  declare function FormatterProvider(props: FormatterProviderProps): import("react").JSX.Element;
15
12
  export { FormatterProvider, FormatterContext };
@@ -9,7 +9,11 @@ export interface NumberFormatter {
9
9
  thousandsSymbol: string;
10
10
  }
11
11
  /**
12
- * @author
12
+ * Formateador de fechas
13
+ * @author Juan Escobar - automatic
14
+ * @createdAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedAt 2024-10-06 20:07:18 - automatic
16
+ * @updatedUser Juan Escobar - automatic
13
17
  */
14
18
  export interface DateFormatter {
15
19
  dateFormat: string;
@@ -46,7 +50,6 @@ export interface OptionalFormatters {
46
50
  numberFormatter?: NumberFormatter;
47
51
  }
48
52
  /**
49
- * @interface
50
53
  */
51
54
  export interface FormatterProviderProps extends OptionalFormatters {
52
55
  isMicroFrontEnd: boolean;
@@ -1,4 +1,11 @@
1
1
  import { HostThemeProviderProps } from './types';
2
2
  declare const HostThemeContext: import('react').Context<import('./types').HostThemeType | null>;
3
+ /**
4
+ * Host theme provider
5
+ * @author Juan Escobar - automatic
6
+ * @createdAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedAt 2024-10-06 20:07:18 - automatic
8
+ * @updatedUser Juan Escobar - automatic
9
+ */
3
10
  declare function HostThemeProvider(props: HostThemeProviderProps): import("react").JSX.Element;
4
11
  export { HostThemeProvider, HostThemeContext };
@@ -1,4 +1,25 @@
1
1
  import { BaseLocale, LocaleType, NetworkLocaleType } from './types';
2
+ /**
3
+ * Obtiene el locale de la red
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
+ */
2
9
  export declare function getLocaleFromNetwork(locale: NetworkLocaleType, host_static_assets: string, environment_assets: string): Promise<LocaleType>;
10
+ /**
11
+ * Une los elementos de un locale
12
+ * @author Juan Escobar - automatic
13
+ * @createdAt 2024-10-06 20:07:18 - automatic
14
+ * @updatedAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedUser Juan Escobar - automatic
16
+ */
3
17
  export declare function joinLocale(baseLocale: BaseLocale): string;
18
+ /**
19
+ * Divide un locale en sus partes
20
+ * @author Juan Escobar - automatic
21
+ * @createdAt 2024-10-06 20:07:18 - automatic
22
+ * @updatedAt 2024-10-06 20:07:18 - automatic
23
+ * @updatedUser Juan Escobar - automatic
24
+ */
4
25
  export declare function splitLocale(locale: string): BaseLocale;
@@ -1,4 +1,11 @@
1
1
  import { LocalesProviderProps, LocalesContextProps } from './types';
2
2
  declare const LocalesContext: import('react').Context<LocalesContextProps | null>;
3
+ /**
4
+ * Proveedor de locales
5
+ * @author Juan Escobar - automatic
6
+ * @createdAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedAt 2024-10-06 20:07:18 - automatic
8
+ * @updatedUser Juan Escobar - automatic
9
+ */
3
10
  declare function LocalesProvider(props: LocalesProviderProps): import("react").JSX.Element | null;
4
11
  export { LocalesProvider, LocalesContext };
@@ -8,5 +8,12 @@ declare const ResponsiveContainerContext: import('react').Context<(Omit<Omit<imp
8
8
  type: unknown;
9
9
  } | undefined): void;
10
10
  }) | null>;
11
+ /**
12
+ * Proveedor de contenedor responsivo
13
+ * @author Juan Escobar - automatic
14
+ * @createdAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedAt 2024-10-06 20:07:18 - automatic
16
+ * @updatedUser Juan Escobar - automatic
17
+ */
11
18
  declare const ResponsiveContainerProvider: (props: ResponsiveContainerProviderProps) => import("react").JSX.Element;
12
19
  export { ResponsiveContainerProvider, ResponsiveContainerContext };
@@ -1,4 +1,11 @@
1
1
  import { InitialResponsiveContainerProps, ResponsiveContainerStateWithActions } from './types';
2
+ /**
3
+ * Crea la tienda de contenedor responsivo
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
+ */
2
9
  export declare const createResponsiveContainerStore: (initProps: InitialResponsiveContainerProps) => Omit<Omit<import('zustand').StoreApi<ResponsiveContainerStateWithActions>, "setState"> & {
3
10
  setState<A extends string | {
4
11
  type: unknown;
@@ -10,6 +10,13 @@ const S = (r) => {
10
10
  n((t, p) => ({
11
11
  ...s,
12
12
  responsiveContainerActions: {
13
+ /**
14
+ * Establece el punto de interrupción
15
+ * @author Juan Escobar - automatic
16
+ * @createdAt 2024-10-06 20:07:18 - automatic
17
+ * @updatedAt 2024-10-06 20:07:18 - automatic
18
+ * @updatedUser Juan Escobar - automatic
19
+ */
13
20
  setBreakpoint: (e) => {
14
21
  t((o) => {
15
22
  o.breakPoint = e, o.isUpSm = e !== "xs" && e !== "sm", o.isXs = e === "xs";
@@ -8,5 +8,12 @@ declare const ThemeSettingsContext: import('react').Context<(Omit<Omit<import('z
8
8
  type: unknown;
9
9
  } | undefined): void;
10
10
  }) | null>;
11
+ /**
12
+ * Theme settings provider
13
+ * @author Juan Escobar - automatic
14
+ * @createdAt 2024-10-06 20:07:18 - automatic
15
+ * @updatedAt 2024-10-06 20:07:18 - automatic
16
+ * @updatedUser Juan Escobar - automatic
17
+ */
11
18
  declare function ThemeSettingsProvider({ children, themeSettings }: ThemeSettingsProviderProps): import("react").JSX.Element;
12
19
  export { ThemeSettingsProvider, ThemeSettingsContext };
@@ -1,5 +1,12 @@
1
1
  import { InitialThemeSettingsStoreProps, ThemeSettingsStateWithActions } from './types';
2
2
  import { WritableDraft } from 'immer/dist/internal';
3
+ /**
4
+ * Crea la tienda de configuración del tema
5
+ * @author Juan Escobar - automatic
6
+ * @createdAt 2024-10-06 20:07:18 - automatic
7
+ * @updatedAt 2024-10-06 20:07:18 - automatic
8
+ * @updatedUser Juan Escobar - automatic
9
+ */
3
10
  export declare const createThemeSettingsStore: (initialState: InitialThemeSettingsStoreProps) => Omit<Omit<import('zustand').StoreApi<ThemeSettingsStateWithActions>, "setState"> & {
4
11
  setState<A extends string | {
5
12
  type: unknown;
@@ -46,16 +46,37 @@ const o = (n) => {
46
46
  S((r, m) => ({
47
47
  ...n,
48
48
  settingsActions: {
49
+ /**
50
+ * Inicializa la tienda de configuración del tema
51
+ * @author Juan Escobar - automatic
52
+ * @createdAt 2024-10-06 20:07:18 - automatic
53
+ * @updatedAt 2024-10-06 20:07:18 - automatic
54
+ * @updatedUser Juan Escobar - automatic
55
+ */
49
56
  init: () => {
50
57
  r((t) => {
51
58
  o(t);
52
59
  });
53
60
  },
61
+ /**
62
+ * Establece la configuración del tema
63
+ * @author Juan Escobar - automatic
64
+ * @createdAt 2024-10-06 20:07:18 - automatic
65
+ * @updatedAt 2024-10-06 20:07:18 - automatic
66
+ * @updatedUser Juan Escobar - automatic
67
+ */
54
68
  setThemeSettings: (t) => {
55
69
  r((e) => {
56
70
  e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, i(e), o(e);
57
71
  });
58
72
  },
73
+ /**
74
+ * Cambia el modo del tema
75
+ * @author Juan Escobar - automatic
76
+ * @createdAt 2024-10-06 20:07:18 - automatic
77
+ * @updatedAt 2024-10-06 20:07:18 - automatic
78
+ * @updatedUser Juan Escobar - automatic
79
+ */
59
80
  onChangeMode: (t) => {
60
81
  r((e) => {
61
82
  e.currentThemeSettings = {
@@ -64,11 +85,25 @@ const o = (n) => {
64
85
  }, i(e), o(e);
65
86
  });
66
87
  },
88
+ /**
89
+ * Abre o cierra el panel de configuración del tema
90
+ * @author Juan Escobar - automatic
91
+ * @createdAt 2024-10-06 20:07:18 - automatic
92
+ * @updatedAt 2024-10-06 20:07:18 - automatic
93
+ * @updatedUser Juan Escobar - automatic
94
+ */
67
95
  handleOpen: () => {
68
96
  r((t) => {
69
97
  t.open = !t.open;
70
98
  });
71
99
  },
100
+ /**
101
+ * Cambia la dirección del tema
102
+ * @author Juan Escobar - automatic
103
+ * @createdAt 2024-10-06 20:07:18 - automatic
104
+ * @updatedAt 2024-10-06 20:07:18 - automatic
105
+ * @updatedUser Juan Escobar - automatic
106
+ */
72
107
  onChangeDirection: (t) => {
73
108
  r((e) => {
74
109
  e.currentThemeSettings = {
@@ -77,6 +112,13 @@ const o = (n) => {
77
112
  }, i(e), o(e);
78
113
  });
79
114
  },
115
+ /**
116
+ * Cambia el color del tema
117
+ * @author Juan Escobar - automatic
118
+ * @createdAt 2024-10-06 20:07:18 - automatic
119
+ * @updatedAt 2024-10-06 20:07:18 - automatic
120
+ * @updatedUser Juan Escobar - automatic
121
+ */
80
122
  onChangeColor: (t) => {
81
123
  r((e) => {
82
124
  e.currentThemeSettings = {
@@ -85,6 +127,13 @@ const o = (n) => {
85
127
  }, i(e), o(e);
86
128
  });
87
129
  },
130
+ /**
131
+ * Cambia el diseño del tema
132
+ * @author Juan Escobar - automatic
133
+ * @createdAt 2024-10-06 20:07:18 - automatic
134
+ * @updatedAt 2024-10-06 20:07:18 - automatic
135
+ * @updatedUser Juan Escobar - automatic
136
+ */
88
137
  onChangeLayout: (t) => {
89
138
  r((e) => {
90
139
  e.currentThemeSettings = {
@@ -93,6 +142,13 @@ const o = (n) => {
93
142
  }, i(e), o(e);
94
143
  });
95
144
  },
145
+ /**
146
+ * Cambia el estiramiento del tema
147
+ * @author Juan Escobar - automatic
148
+ * @createdAt 2024-10-06 20:07:18 - automatic
149
+ * @updatedAt 2024-10-06 20:07:18 - automatic
150
+ * @updatedUser Juan Escobar - automatic
151
+ */
96
152
  onToggleStretch: () => {
97
153
  r((t) => {
98
154
  t.currentThemeSettings = {
@@ -101,6 +157,13 @@ const o = (n) => {
101
157
  }, i(t), o(t);
102
158
  });
103
159
  },
160
+ /**
161
+ * Resetea la configuración del tema
162
+ * @author Juan Escobar - automatic
163
+ * @createdAt 2024-10-06 20:07:18 - automatic
164
+ * @updatedAt 2024-10-06 20:07:18 - automatic
165
+ * @updatedUser Juan Escobar - automatic
166
+ */
104
167
  onResetSetting: () => {
105
168
  r((t) => {
106
169
  t.currentThemeSettings = {
@@ -19,12 +19,17 @@ export interface ThemeSettingsStore {
19
19
  currentThemeSettings: ThemeSettingsType;
20
20
  /**
21
21
  * 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
+ * @createdAt 2024-10-06 20:07:18 - automatic
22
23
  */
23
24
  themeOptions: (Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme) | OurTheme;
24
25
  colorOption: PresetsOptions;
25
26
  /**
26
27
  * "setterThemeSettings" es una función que se encarga de persistir en local storage los cambios de los settings
27
28
  * Solo se instancia cuando esta en host, cuando esta storybook no se instancia
29
+ * @author Juan Escobar - automatic
30
+ * @createdAt 2024-10-06 20:07:18 - automatic
31
+ * @updatedAt 2024-10-06 20:07:18 - automatic
32
+ * @updatedUser Juan Escobar - automatic
28
33
  */
29
34
  setterThemeSettings?: (newValue: ThemeSettingsType) => void;
30
35
  open: boolean;
@@ -33,6 +38,13 @@ export type DefaultThemeSettingsStoreProps = ThemeSettingsStore;
33
38
  export type InitialThemeSettingsStoreProps = DefaultThemeSettingsStoreProps;
34
39
  export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
35
40
  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
+ */
36
48
  init: () => void;
37
49
  onToggleStretch: VoidFunction;
38
50
  onResetSetting: VoidFunction;
@@ -1,2 +1,9 @@
1
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-06 20:07:18 - automatic
7
+ * @updatedUser Juan Escobar - automatic
8
+ */
2
9
  export declare function useFirstRender(dependencies?: DependencyList): boolean;
@@ -1 +1,8 @@
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
+ */
1
8
  export declare const useFormatter: () => import('../..').Formatters;
@@ -1 +1,8 @@
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
+ */
1
8
  export declare const useHostTheme: () => import('../..').HostThemeType;
@@ -1 +1,8 @@
1
+ /**
2
+ * Hook to check if the device is a mobile device
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
+ */
1
8
  export declare const useIsMobile: () => boolean;
@@ -1 +1,8 @@
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
+ */
1
8
  export declare function useIsMountedRef(): import('react').MutableRefObject<boolean>;
@@ -1 +1,8 @@
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
+ */
1
8
  export declare const useLocales: () => import('../../contexts/LocalesContext/types').LocalesContextProps;
@@ -1 +1,8 @@
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
+ */
1
8
  export declare function useOffSetTop(top: number): boolean;
@@ -1,2 +1,9 @@
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
+ */
1
8
  export declare function useResizeObserver<T extends HTMLElement>(callback: (target: T, entry: ResizeObserverEntry) => void): import('react').RefObject<T>;
2
9
  export default useResizeObserver;
@@ -1 +1,8 @@
1
+ /**
2
+ * Returns true if the screen size is desktop.
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
+ */
1
8
  export declare function useResponsiveDesktop(): boolean | undefined;
@@ -1,2 +1,9 @@
1
1
  import { ResponsiveContainerStateWithActions } from '../../contexts/ResponsiveContainerContext/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
+ */
2
9
  export declare function useResponsiveContainerStore<T>(selector: (state: ResponsiveContainerStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
@@ -1,2 +1,9 @@
1
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
+ */
2
9
  export declare function useThemeSettingsStore<T>(selector: (state: ThemeSettingsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
package/package.json CHANGED
@@ -1,16 +1,24 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "6.0.2-alpha.2",
3
+ "version": "6.0.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "lint-staged": {
10
+ "**/*.{js,jsx,ts,tsx,json}": [
11
+ "eslint . --fix"
12
+ ]
13
+ },
6
14
  "dependencies": {
7
15
  "date-fns": "^2.30.0",
8
16
  "immer": "^9.0.21",
9
17
  "zustand": "4.3.6"
10
18
  },
11
19
  "peerDependencies": {
12
- "@m4l/core": "^2.0.9-alpha.0",
13
- "@m4l/styles": "^6.4.1",
20
+ "@m4l/core": "^2.0.9",
21
+ "@m4l/styles": "^6.5.1",
14
22
  "@mui/material": "^5.15.19",
15
23
  "@mui/x-date-pickers": "^6.11.1",
16
24
  "@types/react": "^18.0.0",
@@ -70,9 +78,6 @@
70
78
  "type": "module",
71
79
  "types": "./index.d.ts",
72
80
  "sideEffects": false,
73
- "publishConfig": {
74
- "access": "public"
75
- },
76
81
  "engines": {
77
82
  "node": ">=12.0.0"
78
83
  },
@@ -7,6 +7,13 @@ export interface AnchorPosition {
7
7
  top: number;
8
8
  left: number;
9
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
+ */
10
17
  export declare const getAnchorElPositionWindow: (anchorElement: HTMLElement, newWindowRect: Pick<DOMRect, "width" | "height">, anchorOrigin: AnchorOrigin, transformOrigin: AnchorOrigin, marginThreshold?: number) => {
11
18
  top: number;
12
19
  left: number;