@m4l/graphics 0.1.38 → 0.1.40
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/components/GlobalStyles/index.d.ts +2 -1
- package/contexts/FormatterContext/index.d.ts +1 -1
- package/contexts/HostThemeContext/index.d.ts +1 -1
- package/contexts/LocalesContext/{index.3fcfbe02.js → index.53f0b702.js} +20 -20
- package/contexts/LocalesContext/index.d.ts +1 -1
- package/contexts/{index.84089632.js → index.798d4696.js} +1 -1
- package/hooks/index.5c8cfbbc.js +48 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/useLocales/{index.8154a401.js → index.d5a80aff.js} +1 -1
- package/hooks/useResizeObserver/index.d.ts +3 -0
- package/hooks/useResponsive/index.1409e387.js +7 -0
- package/hooks/useResponsive/index.d.ts +0 -7
- package/index.js +28 -29
- package/package.json +4 -6
- package/hooks/index.a4ef9776.js +0 -34
- package/hooks/useResponsive/index.fc5e1b4f.js +0 -20
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function GlobalStyles(): import("react").JSX.Element;
|
|
@@ -12,5 +12,5 @@ declare const FormatterContext: import("react").Context<Formatters | null>;
|
|
|
12
12
|
* @beta
|
|
13
13
|
* @link
|
|
14
14
|
*/
|
|
15
|
-
declare function FormatterProvider(props: FormatterProviderProps): JSX.Element;
|
|
15
|
+
declare function FormatterProvider(props: FormatterProviderProps): import("react").JSX.Element;
|
|
16
16
|
export { FormatterProvider, FormatterContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HostThemeProviderProps } from './types';
|
|
3
3
|
declare const HostThemeContext: import("react").Context<import("./types").HostThemeType | null>;
|
|
4
|
-
declare function HostThemeProvider(props: HostThemeProviderProps): JSX.Element;
|
|
4
|
+
declare function HostThemeProvider(props: HostThemeProviderProps): import("react").JSX.Element;
|
|
5
5
|
export { HostThemeProvider, HostThemeContext };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { createContext as k, useState as
|
|
1
|
+
import { createContext as k, useState as E, useCallback as x, useEffect as _ } from "react";
|
|
2
2
|
import { AdapterDateFns as F } from "@mui/x-date-pickers/AdapterDateFns";
|
|
3
3
|
import { LocalizationProvider as U } from "@mui/x-date-pickers";
|
|
4
4
|
import { useEnvironment as P, useNetwork as I, useHostTools as j, useLocalStorageWithListener as w, EmitEvents as u } from "@m4l/core";
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
5
|
+
import L from "date-fns/locale/en-US";
|
|
6
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
7
7
|
async function B(t, e, o) {
|
|
8
|
-
const s =
|
|
8
|
+
const s = g(t), r = { ...t };
|
|
9
9
|
let i;
|
|
10
|
-
return s === "es" ? i = (await import("date-fns/locale/es")).default : s === "fr" ? i = (await import("date-fns/locale/fr")).default : s === "en-US" ? i =
|
|
10
|
+
return s === "es" ? i = (await import("date-fns/locale/es")).default : s === "fr" ? i = (await import("date-fns/locale/fr")).default : s === "en-US" ? i = L : (i = L, r.lang = "en", r.script = void 0, r.region = "US", r.url_icon = `${e}/${o}/frontend/commons/assets/icons/langs/lang_en.svg`, r.name = "English US*"), {
|
|
11
11
|
...r,
|
|
12
12
|
module: i,
|
|
13
|
-
localeString:
|
|
13
|
+
localeString: g(r)
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function g(t) {
|
|
17
17
|
let e = t.lang;
|
|
18
18
|
return t.script && t.script !== "" && (e = e + "-" + t.script), t.region && t.region !== "" && (e = e + "-" + t.region), e;
|
|
19
19
|
}
|
|
@@ -55,15 +55,15 @@ function J(t) {
|
|
|
55
55
|
events_add_listener: N,
|
|
56
56
|
events_remove_listener: T,
|
|
57
57
|
events_emit: H
|
|
58
|
-
} = j(), [a,
|
|
58
|
+
} = j(), [a, f] = E(() => {
|
|
59
59
|
if (o)
|
|
60
60
|
return s;
|
|
61
|
-
}), [l, m] = w("localeHost", navigator.language), [M, A] =
|
|
62
|
-
|
|
61
|
+
}), [l, m] = w("localeHost", navigator.language), [M, A] = E(""), d = x((n) => {
|
|
62
|
+
f(n);
|
|
63
63
|
}, []);
|
|
64
|
-
if (
|
|
65
|
-
o && T(u.EMMIT_EVENT_HOST_LOCALE_CHANGE,
|
|
66
|
-
}), []),
|
|
64
|
+
if (_(() => (o && N(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, d), () => {
|
|
65
|
+
o && T(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, d);
|
|
66
|
+
}), []), _(() => {
|
|
67
67
|
let n = !0;
|
|
68
68
|
if (!o && !!r && !(l === M && l !== ""))
|
|
69
69
|
return C({
|
|
@@ -73,25 +73,25 @@ function J(t) {
|
|
|
73
73
|
...y(l),
|
|
74
74
|
domain_token: i
|
|
75
75
|
}
|
|
76
|
-
}).then((
|
|
77
|
-
n && r(
|
|
78
|
-
|
|
76
|
+
}).then((p) => {
|
|
77
|
+
n && r(p.data, v, h).then((c) => {
|
|
78
|
+
f(c), A(c.localeString), l !== c.localeString && m(c.localeString), H(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, c);
|
|
79
79
|
});
|
|
80
80
|
}).finally(() => {
|
|
81
81
|
}), function() {
|
|
82
82
|
n = !1;
|
|
83
83
|
};
|
|
84
84
|
}, [l]), !a)
|
|
85
|
-
return
|
|
85
|
+
return null;
|
|
86
86
|
const O = (n) => {
|
|
87
|
-
(n.lang !== a.lang || n.script !== a.script || n.region !== a.region) && m(
|
|
87
|
+
(n.lang !== a.lang || n.script !== a.script || n.region !== a.region) && m(g(n));
|
|
88
88
|
};
|
|
89
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ S(G.Provider, {
|
|
90
90
|
value: {
|
|
91
91
|
currentLocale: a,
|
|
92
92
|
onChangeLocale: O
|
|
93
93
|
},
|
|
94
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ S(U, {
|
|
95
95
|
dateAdapter: F,
|
|
96
96
|
adapterLocale: a.module,
|
|
97
97
|
dateFormats: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LocalesProviderProps, LocalesContextProps } from './types';
|
|
3
3
|
declare const LocalesContext: import("react").Context<LocalesContextProps | null>;
|
|
4
|
-
declare function LocalesProvider(props: LocalesProviderProps): JSX.Element;
|
|
4
|
+
declare function LocalesProvider(props: LocalesProviderProps): import("react").JSX.Element | null;
|
|
5
5
|
export { LocalesProvider, LocalesContext };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useRef as r, useEffect as n, useState as f, useContext as i, useLayoutEffect as c } from "react";
|
|
2
|
+
import { H as m } from "../contexts/HostThemeContext/index.a6a62c70.js";
|
|
3
|
+
import "../contexts/FormatterContext/index.92336f4c.js";
|
|
4
|
+
import "../contexts/LocalesContext/index.53f0b702.js";
|
|
5
|
+
import "@m4l/styles";
|
|
6
|
+
function T() {
|
|
7
|
+
const e = r(!0);
|
|
8
|
+
return n(
|
|
9
|
+
() => () => {
|
|
10
|
+
e.current = !1;
|
|
11
|
+
},
|
|
12
|
+
[]
|
|
13
|
+
), e;
|
|
14
|
+
}
|
|
15
|
+
function b(e) {
|
|
16
|
+
const [s, t] = f(!1), o = e || 100;
|
|
17
|
+
return n(() => (window.onscroll = () => {
|
|
18
|
+
window.pageYOffset > o ? t(!0) : t(!1);
|
|
19
|
+
}, () => {
|
|
20
|
+
window.onscroll = null;
|
|
21
|
+
}), [o]), s;
|
|
22
|
+
}
|
|
23
|
+
const h = () => {
|
|
24
|
+
const e = i(m);
|
|
25
|
+
if (!e)
|
|
26
|
+
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
27
|
+
return e;
|
|
28
|
+
};
|
|
29
|
+
function v(e) {
|
|
30
|
+
const s = r(null);
|
|
31
|
+
return c(() => {
|
|
32
|
+
const t = s?.current;
|
|
33
|
+
if (!t)
|
|
34
|
+
return;
|
|
35
|
+
const o = new ResizeObserver((u) => {
|
|
36
|
+
e(t, u[0]);
|
|
37
|
+
});
|
|
38
|
+
return o.observe(t), () => {
|
|
39
|
+
o.disconnect();
|
|
40
|
+
};
|
|
41
|
+
}, [e, s.current]), s;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
b as a,
|
|
45
|
+
h as b,
|
|
46
|
+
v as c,
|
|
47
|
+
T as u
|
|
48
|
+
};
|
package/hooks/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { useIsMountedRef } from './useIsMountedRef';
|
|
|
4
4
|
export { useLocales } from './useLocales';
|
|
5
5
|
export { useOffSetTop } from './useOffSetTop';
|
|
6
6
|
export { useHostTheme } from './useHostTheme';
|
|
7
|
-
export {
|
|
7
|
+
export { useResizeObserver } from './useResizeObserver';
|
|
8
|
+
export { useResponsiveDesktop } from './useResponsive';
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import { Breakpoint } from '@mui/material';
|
|
2
|
-
declare type Query = 'up' | 'down' | 'between' | 'only';
|
|
3
|
-
declare type Key = Breakpoint | number;
|
|
4
|
-
declare type Start = Breakpoint | number;
|
|
5
|
-
declare type End = Breakpoint | number;
|
|
6
|
-
export declare function useResponsive(query: Query, key?: Key, start?: Start, end?: End): boolean | undefined;
|
|
7
1
|
export declare function useResponsiveDesktop(): boolean | undefined;
|
|
8
|
-
export {};
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { F as
|
|
3
|
-
import { L as
|
|
4
|
-
import { H as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { b as
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as
|
|
10
|
-
import { C as
|
|
1
|
+
import { G as x } from "./components/GlobalStyle/index.30beab6e.js";
|
|
2
|
+
import { F as n, a as c } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
+
import { L as F, a as v, g as C } from "./contexts/LocalesContext/index.53f0b702.js";
|
|
4
|
+
import { H as g, a as h } from "./contexts/HostThemeContext/index.a6a62c70.js";
|
|
5
|
+
import { u as P } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
+
import { u as T } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
+
import { b as k, u as w, a as z, c as G } from "./hooks/index.5c8cfbbc.js";
|
|
8
|
+
import { u as S } from "./hooks/useLocales/index.d5a80aff.js";
|
|
9
|
+
import { u as A } from "./hooks/useResponsive/index.1409e387.js";
|
|
10
|
+
import { C as E, g as I } from "./utils/index.6909c662.js";
|
|
11
11
|
import "@mui/material/styles";
|
|
12
12
|
import "@mui/material";
|
|
13
13
|
import "@m4l/styles";
|
|
@@ -17,24 +17,23 @@ import "@m4l/core";
|
|
|
17
17
|
import "@mui/x-date-pickers/AdapterDateFns";
|
|
18
18
|
import "@mui/x-date-pickers";
|
|
19
19
|
import "date-fns/locale/en-US";
|
|
20
|
-
import "@mui/material/useMediaQuery";
|
|
21
20
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
E as Capitalize,
|
|
22
|
+
n as FormatterContext,
|
|
23
|
+
c as FormatterProvider,
|
|
24
|
+
x as GlobalStyles,
|
|
25
|
+
g as HostThemeContext,
|
|
26
|
+
h as HostThemeProvider,
|
|
27
|
+
F as LocalesContext,
|
|
28
|
+
v as LocalesProvider,
|
|
29
|
+
I as getAnchorElPositionWindow,
|
|
30
|
+
C as getLocaleFromNetwork,
|
|
31
|
+
P as useFirstRender,
|
|
32
|
+
T as useFormatter,
|
|
33
|
+
k as useHostTheme,
|
|
34
|
+
w as useIsMountedRef,
|
|
35
|
+
S as useLocales,
|
|
36
|
+
z as useOffSetTop,
|
|
37
|
+
G as useResizeObserver,
|
|
38
|
+
A as useResponsiveDesktop
|
|
40
39
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/graphics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
|
-
"author": "M4L Team",
|
|
5
|
+
"author": "M4L Team*",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@m4l/core": "*",
|
|
8
|
-
"@
|
|
9
|
-
"date-fns": "^2.
|
|
8
|
+
"@m4l/styles": "*",
|
|
9
|
+
"date-fns": "^2.30.0"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@mui/material": "5.10.4",
|
|
13
|
-
"@mui/system": "5.10.4",
|
|
14
12
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
15
13
|
"react": "^17.0.0 || ^18.0.0",
|
|
16
14
|
"react-toastify": "9.0.5"
|
package/hooks/index.a4ef9776.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useRef as n, useEffect as s, useState as u, useContext as f } from "react";
|
|
2
|
-
import { H as i } from "../contexts/HostThemeContext/index.a6a62c70.js";
|
|
3
|
-
import "../contexts/FormatterContext/index.92336f4c.js";
|
|
4
|
-
import "../contexts/LocalesContext/index.3fcfbe02.js";
|
|
5
|
-
import "@mui/material/styles";
|
|
6
|
-
import "@mui/material/useMediaQuery";
|
|
7
|
-
function T() {
|
|
8
|
-
const e = n(!0);
|
|
9
|
-
return s(
|
|
10
|
-
() => () => {
|
|
11
|
-
e.current = !1;
|
|
12
|
-
},
|
|
13
|
-
[]
|
|
14
|
-
), e;
|
|
15
|
-
}
|
|
16
|
-
function d(e) {
|
|
17
|
-
const [r, t] = u(!1), o = e || 100;
|
|
18
|
-
return s(() => (window.onscroll = () => {
|
|
19
|
-
window.pageYOffset > o ? t(!0) : t(!1);
|
|
20
|
-
}, () => {
|
|
21
|
-
window.onscroll = null;
|
|
22
|
-
}), [o]), r;
|
|
23
|
-
}
|
|
24
|
-
const h = () => {
|
|
25
|
-
const e = f(i);
|
|
26
|
-
if (!e)
|
|
27
|
-
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
28
|
-
return e;
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
d as a,
|
|
32
|
-
h as b,
|
|
33
|
-
T as u
|
|
34
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useTheme as m } from "@mui/material/styles";
|
|
2
|
-
import o from "@mui/material/useMediaQuery";
|
|
3
|
-
function c(e, t, s, i) {
|
|
4
|
-
const n = m(), r = o(n.breakpoints.up(t)), p = o(n.breakpoints.down(t)), u = o(n.breakpoints.between(s, i)), a = o(n.breakpoints.only(t));
|
|
5
|
-
if (e === "up")
|
|
6
|
-
return r;
|
|
7
|
-
if (e === "down")
|
|
8
|
-
return p;
|
|
9
|
-
if (e === "between")
|
|
10
|
-
return u;
|
|
11
|
-
if (e === "only")
|
|
12
|
-
return a;
|
|
13
|
-
}
|
|
14
|
-
function b() {
|
|
15
|
-
return c("up", "sm");
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
b as a,
|
|
19
|
-
c as u
|
|
20
|
-
};
|