@m4l/graphics 0.1.18 → 0.1.20
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/{contexts/LocalesContext/index.3fcfbe02.js → dist/contexts/LocalesContext/index.5b555637.js} +22 -22
- package/{contexts/index.84089632.js → dist/contexts/index.2f4a4040.js} +1 -1
- package/{hooks/index.a0cce694.js → dist/hooks/index.c13bc37e.js} +1 -1
- package/{hooks/useLocales/index.8154a401.js → dist/hooks/useLocales/index.f676279e.js} +1 -1
- package/{index.d.ts → dist/index.d.ts} +1 -0
- package/dist/index.js +55 -0
- package/dist/package.json +34 -0
- package/dist/theme/breakpoints.d.ts +10 -0
- package/{theme/defaultThemeOptions.9b9e7503.js → dist/theme/defaultThemeOptions.b2cdbe59.js} +11 -9
- package/{theme/typography.f5eadf47.js → dist/theme/typography.63fff3ec.js} +1 -1
- package/dist/utils/anchorEl.d.ts +13 -0
- package/dist/utils/index.7ab4fc54.js +159 -0
- package/dist/vendor.3b4b3674.js +27 -0
- package/package.json +51 -10
- package/index.js +0 -53
- package/utils/index.d8b24456.js +0 -107
- /package/{components → dist/components}/ProgressBarStyle/index.d.ts +0 -0
- /package/{components → dist/components}/ProgressBarStyle/index.fb6fd9ed.js +0 -0
- /package/{components → dist/components}/index.80514d59.js +0 -0
- /package/{components → dist/components}/index.d.ts +0 -0
- /package/{contexts → dist/contexts}/FormatterContext/index.92336f4c.js +0 -0
- /package/{contexts → dist/contexts}/FormatterContext/index.d.ts +0 -0
- /package/{contexts → dist/contexts}/FormatterContext/types.d.ts +0 -0
- /package/{contexts → dist/contexts}/HostThemeContext/index.a6a62c70.js +0 -0
- /package/{contexts → dist/contexts}/HostThemeContext/index.d.ts +0 -0
- /package/{contexts → dist/contexts}/HostThemeContext/types.d.ts +0 -0
- /package/{contexts → dist/contexts}/LocalesContext/helper.d.ts +0 -0
- /package/{contexts → dist/contexts}/LocalesContext/index.d.ts +0 -0
- /package/{contexts → dist/contexts}/LocalesContext/types.d.ts +0 -0
- /package/{contexts → dist/contexts}/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useFirstRender/index.1e9b02fb.js +0 -0
- /package/{hooks → dist/hooks}/useFirstRender/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useFormatter/index.57ac8cca.js +0 -0
- /package/{hooks → dist/hooks}/useFormatter/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useHostTheme/index.1c8e4ad7.js +0 -0
- /package/{hooks → dist/hooks}/useHostTheme/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useIsMountedRef/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useLocales/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useOffSetTop.d.ts +0 -0
- /package/{hooks → dist/hooks}/useResponsive/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/useResponsive/index.fc5e1b4f.js +0 -0
- /package/{theme → dist/theme}/defaultThemeOptions.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Accordion.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Autocomplete.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Avatar.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Backdrop.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Badge.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Breadcrumbs.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Button.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/ButtonGroup.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Card.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Checkbox.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/ControlLabel.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/CssBaseline.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/DataGrid.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Dialog.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Drawer.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Fab.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/IconButton.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Input.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/InputLabel.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Link.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/List.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/LoadingButton.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Menu.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Pagination.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Paper.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Popover.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Progress.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Radio.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Skeleton.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Slider.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Stepper.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/SvgIcon.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Switch.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Table.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Tabs.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Timeline.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/ToggleButton.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Tooltip.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/Typography.d.ts +0 -0
- /package/{theme → dist/theme}/overrides/index.d.ts +0 -0
- /package/{theme → dist/theme}/overrides.7958c0ab.js +0 -0
- /package/{theme → dist/theme}/palette.2baf72f5.js +0 -0
- /package/{theme → dist/theme}/palette.d.ts +0 -0
- /package/{theme → dist/theme}/shadows.bf8dc290.js +0 -0
- /package/{theme → dist/theme}/shadows.d.ts +0 -0
- /package/{theme → dist/theme}/stretch.d.ts +0 -0
- /package/{theme → dist/theme}/typography.d.ts +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{utils → dist/utils}/getColorPresets.d.ts +0 -0
- /package/{utils → dist/utils}/getFontValue.d.ts +0 -0
- /package/{utils → dist/utils}/strings.d.ts +0 -0
- /package/{vite-env.d.ts → dist/vite-env.d.ts} +0 -0
package/{contexts/LocalesContext/index.3fcfbe02.js → dist/contexts/LocalesContext/index.5b555637.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createContext as k, useState as _, useCallback as x, useEffect as L } from "react";
|
|
2
2
|
import { AdapterDateFns as F } from "@mui/x-date-pickers/AdapterDateFns";
|
|
3
|
-
import { LocalizationProvider as
|
|
4
|
-
import { useEnvironment as
|
|
5
|
-
import
|
|
3
|
+
import { LocalizationProvider as P } from "@mui/x-date-pickers";
|
|
4
|
+
import { useEnvironment as U, useNetwork as I, useHostTools as j, useLocalStorageWithListener as w, EmitEvents as u } from "@m4l/core";
|
|
5
|
+
import v from "date-fns/locale/en-US";
|
|
6
6
|
import { jsx as g } from "react/jsx-runtime";
|
|
7
|
-
async function B(t, e,
|
|
7
|
+
async function B(t, e, n) {
|
|
8
8
|
const s = f(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 = v : (i = v, r.lang = "en", r.script = void 0, r.region = "US", r.url_icon = `${e}/${n}/frontend/commons/assets/icons/langs/lang_en.svg`, r.name = "English US*"), {
|
|
11
11
|
...r,
|
|
12
12
|
module: i,
|
|
13
13
|
localeString: f(r)
|
|
@@ -37,35 +37,35 @@ const G = k(null);
|
|
|
37
37
|
function J(t) {
|
|
38
38
|
const {
|
|
39
39
|
children: e,
|
|
40
|
-
isMicroFrontEnd:
|
|
40
|
+
isMicroFrontEnd: n,
|
|
41
41
|
localeHost: s,
|
|
42
42
|
getLocaleFromNetwork: r
|
|
43
43
|
} = t;
|
|
44
|
-
if (
|
|
44
|
+
if (n && !s)
|
|
45
45
|
throw Error("Must set localeHost in microfrontend");
|
|
46
|
-
if (!
|
|
46
|
+
if (!n && !r)
|
|
47
47
|
throw Error("Must set getLocaleFromNetwork in host");
|
|
48
48
|
const {
|
|
49
49
|
domain_token: i,
|
|
50
|
-
host_static_assets:
|
|
50
|
+
host_static_assets: S,
|
|
51
51
|
environment_assets: h
|
|
52
|
-
} =
|
|
52
|
+
} = U(), {
|
|
53
53
|
networkOperation: C
|
|
54
54
|
} = I(), {
|
|
55
55
|
events_add_listener: N,
|
|
56
56
|
events_remove_listener: T,
|
|
57
57
|
events_emit: H
|
|
58
58
|
} = j(), [a, d] = _(() => {
|
|
59
|
-
if (
|
|
59
|
+
if (n)
|
|
60
60
|
return s;
|
|
61
|
-
}), [l, m] = w("localeHost", navigator.language), [M, A] = _(""), p = x((
|
|
62
|
-
d(
|
|
61
|
+
}), [l, m] = w("localeHost", navigator.language), [M, A] = _(""), p = x((o) => {
|
|
62
|
+
d(o);
|
|
63
63
|
}, []);
|
|
64
|
-
if (L(() => (
|
|
65
|
-
|
|
64
|
+
if (L(() => (n && N(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, p), console.log("useEffect LocalesProvider"), () => {
|
|
65
|
+
n && T(u.EMMIT_EVENT_HOST_LOCALE_CHANGE, p);
|
|
66
66
|
}), []), L(() => {
|
|
67
|
-
let
|
|
68
|
-
if (!
|
|
67
|
+
let o = !0;
|
|
68
|
+
if (!n && !!r && !(l === M && l !== ""))
|
|
69
69
|
return C({
|
|
70
70
|
method: "POST",
|
|
71
71
|
endPoint: "na/locales",
|
|
@@ -74,24 +74,24 @@ function J(t) {
|
|
|
74
74
|
domain_token: i
|
|
75
75
|
}
|
|
76
76
|
}).then((E) => {
|
|
77
|
-
|
|
77
|
+
o && r(E.data, S, h).then((c) => {
|
|
78
78
|
d(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
|
+
o = !1;
|
|
83
83
|
};
|
|
84
84
|
}, [l]), !a)
|
|
85
85
|
return /* @__PURE__ */ g("div", {});
|
|
86
|
-
const O = (
|
|
87
|
-
(
|
|
86
|
+
const O = (o) => {
|
|
87
|
+
(o.lang !== a.lang || o.script !== a.script || o.region !== a.region) && m(f(o));
|
|
88
88
|
};
|
|
89
89
|
return /* @__PURE__ */ g(G.Provider, {
|
|
90
90
|
value: {
|
|
91
91
|
currentLocale: a,
|
|
92
92
|
onChangeLocale: O
|
|
93
93
|
},
|
|
94
|
-
children: /* @__PURE__ */ g(
|
|
94
|
+
children: /* @__PURE__ */ g(P, {
|
|
95
95
|
dateAdapter: F,
|
|
96
96
|
adapterLocale: a.module,
|
|
97
97
|
dateFormats: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef as f, useEffect as s, useState as n } from "react";
|
|
2
2
|
import "../contexts/FormatterContext/index.92336f4c.js";
|
|
3
3
|
import "../contexts/HostThemeContext/index.a6a62c70.js";
|
|
4
|
-
import "../contexts/LocalesContext/index.
|
|
4
|
+
import "../contexts/LocalesContext/index.5b555637.js";
|
|
5
5
|
import "@mui/material/styles";
|
|
6
6
|
import "@mui/material/useMediaQuery";
|
|
7
7
|
function m() {
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { P as d } from "./components/ProgressBarStyle/index.fb6fd9ed.js";
|
|
2
|
+
import { F as c, a as P } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
+
import { L as C, a as F, g } from "./contexts/LocalesContext/index.5b555637.js";
|
|
4
|
+
import { H as L, a as T } from "./contexts/HostThemeContext/index.a6a62c70.js";
|
|
5
|
+
import { u as H } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
+
import { u as O } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
+
import { u as k } from "./hooks/useHostTheme/index.1c8e4ad7.js";
|
|
8
|
+
import { u as y, a as z } from "./hooks/index.c13bc37e.js";
|
|
9
|
+
import { u as B } from "./hooks/useLocales/index.f676279e.js";
|
|
10
|
+
import { u as E, a as G } from "./hooks/useResponsive/index.fc5e1b4f.js";
|
|
11
|
+
import { d as M } from "./theme/defaultThemeOptions.b2cdbe59.js";
|
|
12
|
+
import { c as V, s as W } from "./theme/shadows.bf8dc290.js";
|
|
13
|
+
import { p as q } from "./theme/palette.2baf72f5.js";
|
|
14
|
+
import { C as K, a as Q, c as U, d as X, b as Y, g as Z } from "./utils/index.7ab4fc54.js";
|
|
15
|
+
import { f as $ } from "./theme/overrides.7958c0ab.js";
|
|
16
|
+
import "@mui/material/styles";
|
|
17
|
+
import "@mui/material";
|
|
18
|
+
import "react/jsx-runtime";
|
|
19
|
+
import "react";
|
|
20
|
+
import "@m4l/core";
|
|
21
|
+
import "@mui/x-date-pickers/AdapterDateFns";
|
|
22
|
+
import "@mui/x-date-pickers";
|
|
23
|
+
import "date-fns/locale/en-US";
|
|
24
|
+
import "@mui/material/useMediaQuery";
|
|
25
|
+
import "./theme/typography.63fff3ec.js";
|
|
26
|
+
import "./vendor.3b4b3674.js";
|
|
27
|
+
export {
|
|
28
|
+
K as Capitalize,
|
|
29
|
+
c as FormatterContext,
|
|
30
|
+
P as FormatterProvider,
|
|
31
|
+
Q as GetFontValue,
|
|
32
|
+
L as HostThemeContext,
|
|
33
|
+
T as HostThemeProvider,
|
|
34
|
+
C as LocalesContext,
|
|
35
|
+
F as LocalesProvider,
|
|
36
|
+
d as ProgressBarStyle,
|
|
37
|
+
U as colorPresets,
|
|
38
|
+
V as customShadows,
|
|
39
|
+
X as defaultPreset,
|
|
40
|
+
M as defaultThemeOptions,
|
|
41
|
+
$ as fnComponentsOverrides,
|
|
42
|
+
Y as getAnchorElPositionWindow,
|
|
43
|
+
Z as getColorPresets,
|
|
44
|
+
g as getLocaleFromNetwork,
|
|
45
|
+
q as palette,
|
|
46
|
+
W as shadows,
|
|
47
|
+
H as useFirstRender,
|
|
48
|
+
O as useFormatter,
|
|
49
|
+
k as useHostTheme,
|
|
50
|
+
y as useIsMountedRef,
|
|
51
|
+
B as useLocales,
|
|
52
|
+
z as useOffSetTop,
|
|
53
|
+
E as useResponsive,
|
|
54
|
+
G as useResponsiveDesktop
|
|
55
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@m4l/graphics",
|
|
3
|
+
"version": "0.1.20",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"author": "M4L Team",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@m4l/core": "*",
|
|
8
|
+
"@mui/x-date-pickers": "^5.0.0-beta.3",
|
|
9
|
+
"date-fns": "^2.29.2"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@mui/material": "^5.10.4",
|
|
13
|
+
"@mui/system": "^5.10.4",
|
|
14
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
15
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
16
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"*"
|
|
20
|
+
],
|
|
21
|
+
"source": "src/index.ts",
|
|
22
|
+
"main": "./index.js",
|
|
23
|
+
"module": "./index.js",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=12.0.0"
|
|
32
|
+
},
|
|
33
|
+
"private": false
|
|
34
|
+
}
|
package/{theme/defaultThemeOptions.9b9e7503.js → dist/theme/defaultThemeOptions.b2cdbe59.js}
RENAMED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { alpha as
|
|
2
|
-
import { t as
|
|
3
|
-
import { p as r, G as
|
|
1
|
+
import { alpha as a } from "@mui/material/styles";
|
|
2
|
+
import { t as e } from "./typography.63fff3ec.js";
|
|
3
|
+
import { p as r, G as t } from "./palette.2baf72f5.js";
|
|
4
4
|
import { s as o, c as s } from "./shadows.bf8dc290.js";
|
|
5
|
-
import { g as i } from "../utils/index.
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { g as i } from "../utils/index.7ab4fc54.js";
|
|
6
|
+
import { b as m } from "../vendor.3b4b3674.js";
|
|
7
|
+
const f = {
|
|
8
|
+
typography: e,
|
|
9
|
+
breakpoints: m,
|
|
8
10
|
shadows: o.light,
|
|
9
11
|
customShadows: {
|
|
10
12
|
...s.light,
|
|
11
|
-
primary: `0 8px 16px 0 ${
|
|
13
|
+
primary: `0 8px 16px 0 ${a(i("default").main, 0.24)}`
|
|
12
14
|
},
|
|
13
15
|
palette: {
|
|
14
16
|
...r.light,
|
|
@@ -23,12 +25,12 @@ const c = {
|
|
|
23
25
|
DarkSelected: "#142827",
|
|
24
26
|
DarkSelectedHover: "#12342B"
|
|
25
27
|
},
|
|
26
|
-
text: { primary:
|
|
28
|
+
text: { primary: t[800], secondary: t[700], disabled: t[500] },
|
|
27
29
|
secondary: {
|
|
28
30
|
main: "#34ac4e"
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
f as d
|
|
34
36
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare 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
|
+
export declare const getAnchorElPositionWindow: (anchorElement: HTMLElement, newWindowRect: Pick<DOMRect, 'width' | 'height'>, anchorOrigin: AnchorOrigin, transformOrigin: AnchorOrigin, marginThreshold?: number) => {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { useTheme as k } from "@mui/material/styles";
|
|
2
|
+
import { u as A } from "../hooks/useResponsive/index.fc5e1b4f.js";
|
|
3
|
+
import { p as d } from "../theme/palette.2baf72f5.js";
|
|
4
|
+
function C(e) {
|
|
5
|
+
return Math.round(parseFloat(e) * 16);
|
|
6
|
+
}
|
|
7
|
+
function u(e) {
|
|
8
|
+
return `${e / 16}rem`;
|
|
9
|
+
}
|
|
10
|
+
function W({ sm: e, md: t, lg: o }) {
|
|
11
|
+
return {
|
|
12
|
+
"@media (min-width:600px)": {
|
|
13
|
+
fontSize: u(e)
|
|
14
|
+
},
|
|
15
|
+
"@media (min-width:900px)": {
|
|
16
|
+
fontSize: u(t)
|
|
17
|
+
},
|
|
18
|
+
"@media (min-width:1200px)": {
|
|
19
|
+
fontSize: u(o)
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function E() {
|
|
24
|
+
return [...k().breakpoints.keys].reverse().reduce((o, n) => {
|
|
25
|
+
const r = A("up", n);
|
|
26
|
+
return !o && r ? n : o;
|
|
27
|
+
}, null) || "xs";
|
|
28
|
+
}
|
|
29
|
+
function v(e) {
|
|
30
|
+
const t = k(), o = E(), n = t.breakpoints.up(o === "xl" ? "lg" : o), h = (e === "h1" || e === "h2" || e === "h3" || e === "h4" || e === "h5" || e === "h6") && t.typography[e][n] ? t.typography[e][n] : t.typography[e], f = C(h.fontSize), a = Number(t.typography[e].lineHeight) * f, { fontWeight: s, letterSpacing: i } = t.typography[e];
|
|
31
|
+
return { fontSize: f, lineHeight: a, fontWeight: s, letterSpacing: i };
|
|
32
|
+
}
|
|
33
|
+
const l = [
|
|
34
|
+
{
|
|
35
|
+
name: "default",
|
|
36
|
+
...d.light.primary,
|
|
37
|
+
LightSelected: "#EBF9F1",
|
|
38
|
+
LightSelectedHover: "#D6F2E3",
|
|
39
|
+
DarkSelected: "#142827",
|
|
40
|
+
DarkSelectedHover: "#12342B"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "purple",
|
|
44
|
+
lighter: "#EBD6FD",
|
|
45
|
+
light: "#B985F4",
|
|
46
|
+
main: "#7635dc",
|
|
47
|
+
dark: "#431A9E",
|
|
48
|
+
darker: "#200A69",
|
|
49
|
+
contrastText: "#fff"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "cyan",
|
|
53
|
+
lighter: "#D1FFFC",
|
|
54
|
+
light: "#76F2FF",
|
|
55
|
+
main: "#1CCAFF",
|
|
56
|
+
dark: "#0E77B7",
|
|
57
|
+
darker: "#053D7A",
|
|
58
|
+
contrastText: d.light.grey[800]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "blue",
|
|
62
|
+
lighter: "#D1E9FC",
|
|
63
|
+
light: "#76B0F1",
|
|
64
|
+
main: "#2065D1",
|
|
65
|
+
dark: "#103996",
|
|
66
|
+
darker: "#061B64",
|
|
67
|
+
contrastText: "#fff"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "orange",
|
|
71
|
+
lighter: "#FEF4D4",
|
|
72
|
+
light: "#FED680",
|
|
73
|
+
main: "#fda92d",
|
|
74
|
+
dark: "#B66816",
|
|
75
|
+
darker: "#793908",
|
|
76
|
+
contrastText: d.light.grey[800]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "red",
|
|
80
|
+
lighter: "#FFE3D5",
|
|
81
|
+
light: "#FFC1AC",
|
|
82
|
+
main: "#FF3030",
|
|
83
|
+
dark: "#B71833",
|
|
84
|
+
darker: "#7A0930",
|
|
85
|
+
contrastText: "#fff"
|
|
86
|
+
}
|
|
87
|
+
], B = l[0], D = l[1], S = l[2], P = l[3], T = l[4], z = l[5];
|
|
88
|
+
function I(e) {
|
|
89
|
+
return {
|
|
90
|
+
purple: D,
|
|
91
|
+
cyan: S,
|
|
92
|
+
blue: P,
|
|
93
|
+
orange: T,
|
|
94
|
+
red: z,
|
|
95
|
+
default: B
|
|
96
|
+
}[e];
|
|
97
|
+
}
|
|
98
|
+
const N = (e) => e && e[0].toUpperCase() + e.slice(1) || "";
|
|
99
|
+
function b(e, t) {
|
|
100
|
+
let o = 0;
|
|
101
|
+
return typeof t == "number" ? o = t : t === "center" ? o = e.height / 2 : t === "bottom" && (o = e.height), o;
|
|
102
|
+
}
|
|
103
|
+
function x(e, t) {
|
|
104
|
+
let o = 0;
|
|
105
|
+
return typeof t == "number" ? o = t : t === "center" ? o = e.width / 2 : t === "right" && (o = e.width), o;
|
|
106
|
+
}
|
|
107
|
+
function w(e) {
|
|
108
|
+
return typeof e == "function" ? e() : e;
|
|
109
|
+
}
|
|
110
|
+
const O = (e, t) => {
|
|
111
|
+
const n = w(e).getBoundingClientRect();
|
|
112
|
+
return {
|
|
113
|
+
top: n.top + b(n, t.vertical),
|
|
114
|
+
left: n.left + x(n, t.horizontal)
|
|
115
|
+
};
|
|
116
|
+
}, H = (e, t) => ({
|
|
117
|
+
vertical: b(e, t.vertical),
|
|
118
|
+
horizontal: x(e, t.horizontal)
|
|
119
|
+
}), U = (e, t, o, n, r = 16) => {
|
|
120
|
+
const h = O(e, o);
|
|
121
|
+
console.log("anchoEl", h);
|
|
122
|
+
const f = H(t, n);
|
|
123
|
+
console.log("elemTransformOrigin", f);
|
|
124
|
+
const a = document.getElementById("ContainerAreas")?.getBoundingClientRect() || {
|
|
125
|
+
top: 0,
|
|
126
|
+
left: 0
|
|
127
|
+
};
|
|
128
|
+
console.log("getAnchorOffset-container", a);
|
|
129
|
+
let s = h.top - f.vertical, i = h.left - f.horizontal;
|
|
130
|
+
const g = s + t.height, m = i + t.width, F = window, p = F.innerHeight - r, y = F.innerWidth - r;
|
|
131
|
+
if (console.log("Final top,bottom,heightThreshold", s, g, p), s < r) {
|
|
132
|
+
const c = s - r;
|
|
133
|
+
s -= c;
|
|
134
|
+
} else if (g > p) {
|
|
135
|
+
const c = g - p;
|
|
136
|
+
s -= c;
|
|
137
|
+
}
|
|
138
|
+
if (i < r) {
|
|
139
|
+
const c = i - r;
|
|
140
|
+
i -= c;
|
|
141
|
+
} else if (m > y) {
|
|
142
|
+
const c = m - y;
|
|
143
|
+
i -= c;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
top: Math.round(s) - a.top,
|
|
147
|
+
left: Math.round(i) - a.left
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
export {
|
|
151
|
+
N as C,
|
|
152
|
+
v as a,
|
|
153
|
+
U as b,
|
|
154
|
+
l as c,
|
|
155
|
+
B as d,
|
|
156
|
+
I as g,
|
|
157
|
+
u as p,
|
|
158
|
+
W as r
|
|
159
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./components/ProgressBarStyle/index.fb6fd9ed.js";
|
|
2
|
+
import "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
+
import "./contexts/LocalesContext/index.5b555637.js";
|
|
4
|
+
import "./contexts/HostThemeContext/index.a6a62c70.js";
|
|
5
|
+
import "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
+
import "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
+
import "./hooks/useHostTheme/index.1c8e4ad7.js";
|
|
8
|
+
import "./hooks/index.c13bc37e.js";
|
|
9
|
+
import "./hooks/useLocales/index.f676279e.js";
|
|
10
|
+
import "./hooks/useResponsive/index.fc5e1b4f.js";
|
|
11
|
+
import "./theme/defaultThemeOptions.b2cdbe59.js";
|
|
12
|
+
import "./theme/shadows.bf8dc290.js";
|
|
13
|
+
import "./theme/palette.2baf72f5.js";
|
|
14
|
+
import "./utils/index.7ab4fc54.js";
|
|
15
|
+
import "./theme/overrides.7958c0ab.js";
|
|
16
|
+
const g = {
|
|
17
|
+
values: {
|
|
18
|
+
xs: 0,
|
|
19
|
+
sm: 600,
|
|
20
|
+
md: 900,
|
|
21
|
+
lg: 1200,
|
|
22
|
+
xl: 1536
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
g as b
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/graphics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"typescript": "tsc",
|
|
8
|
+
"build:package": "node ../../scripts/buildpackage.js",
|
|
9
|
+
"build": "tsc && vite build && yarn build:package",
|
|
10
|
+
"build:monorepo": "tsc && vite build && yarn build:package",
|
|
11
|
+
"release": "yarn build && npm publish ./dist",
|
|
12
|
+
"release:monorepo": "yarn build:monorepo",
|
|
13
|
+
"publish": "npm publish ./dist",
|
|
14
|
+
"lint": "npx eslint src",
|
|
15
|
+
"lint:fix": "npm run lint -- --fix",
|
|
16
|
+
"prettier": "npx prettier src --check",
|
|
17
|
+
"prettier:fix": "npm run prettier -- --write",
|
|
18
|
+
"format": "npm run prettier:fix && npm run lint:fix",
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"coverage": "vitest run --coverage"
|
|
21
|
+
},
|
|
6
22
|
"dependencies": {
|
|
7
23
|
"@m4l/core": "*",
|
|
8
24
|
"@mui/x-date-pickers": "^5.0.0-beta.3",
|
|
@@ -15,20 +31,45 @@
|
|
|
15
31
|
"react": "^17.0.0 || ^18.0.0",
|
|
16
32
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
17
33
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@emotion/react": "^11.5.0",
|
|
36
|
+
"@emotion/styled": "^11.3.0",
|
|
37
|
+
"@mui/material": "^5.10.4",
|
|
38
|
+
"@mui/system": "^5.10.4",
|
|
39
|
+
"@types/node": "^16.7.10",
|
|
40
|
+
"@types/nprogress": "^0.2.0",
|
|
41
|
+
"@types/react": "^18.0.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "5.27.1",
|
|
43
|
+
"@typescript-eslint/parser": "5.27.1",
|
|
44
|
+
"@vitejs/plugin-react": "1.3.2",
|
|
45
|
+
"eslint": "8.17.0",
|
|
46
|
+
"eslint-config-prettier": "8.5.0",
|
|
47
|
+
"eslint-import-resolver-alias": "1.1.2",
|
|
48
|
+
"eslint-plugin-import": "2.26.0",
|
|
49
|
+
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
50
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
51
|
+
"eslint-plugin-react": "7.30.0",
|
|
52
|
+
"eslint-plugin-react-hooks": "4.5.0",
|
|
53
|
+
"eslint-plugin-unused-imports": "2.0.0",
|
|
54
|
+
"prettier": "2.6.2",
|
|
55
|
+
"react": "^18.0.0",
|
|
56
|
+
"rollup": "2.79.0",
|
|
57
|
+
"typedoc": "^0.23.24",
|
|
58
|
+
"typescript": "4.6.3",
|
|
59
|
+
"vite": "3.1.0",
|
|
60
|
+
"vite-plugin-dts": "1.2.0"
|
|
61
|
+
},
|
|
62
|
+
"files": ["dist/**"],
|
|
21
63
|
"source": "src/index.ts",
|
|
22
|
-
"main": "./index.js",
|
|
23
|
-
"module": "./index.js",
|
|
64
|
+
"main": "./dist/index.js",
|
|
65
|
+
"module": "./dist/index.js",
|
|
24
66
|
"type": "module",
|
|
25
|
-
"types": "./index.
|
|
67
|
+
"types": "./src/index.ts",
|
|
26
68
|
"sideEffects": false,
|
|
27
69
|
"publishConfig": {
|
|
28
70
|
"access": "public"
|
|
29
71
|
},
|
|
30
72
|
"engines": {
|
|
31
73
|
"node": ">=12.0.0"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
74
|
+
}
|
|
75
|
+
}
|
package/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { P as d } from "./components/ProgressBarStyle/index.fb6fd9ed.js";
|
|
2
|
-
import { F as n, a as c } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
-
import { L as C, a as F, g as h } from "./contexts/LocalesContext/index.3fcfbe02.js";
|
|
4
|
-
import { H as g, a as L } from "./contexts/HostThemeContext/index.a6a62c70.js";
|
|
5
|
-
import { u as H } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
|
-
import { u as w } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
-
import { u as S } from "./hooks/useHostTheme/index.1c8e4ad7.js";
|
|
8
|
-
import { u as y, a as z } from "./hooks/index.a0cce694.js";
|
|
9
|
-
import { u as D } from "./hooks/useLocales/index.8154a401.js";
|
|
10
|
-
import { u as I, a as M } from "./hooks/useResponsive/index.fc5e1b4f.js";
|
|
11
|
-
import { d as V } from "./theme/defaultThemeOptions.9b9e7503.js";
|
|
12
|
-
import { c as j, s as q } from "./theme/shadows.bf8dc290.js";
|
|
13
|
-
import { p as E } from "./theme/palette.2baf72f5.js";
|
|
14
|
-
import { C as K, a as Q, c as U, d as W, g as X } from "./utils/index.d8b24456.js";
|
|
15
|
-
import { f as Z } from "./theme/overrides.7958c0ab.js";
|
|
16
|
-
import "@mui/material/styles";
|
|
17
|
-
import "@mui/material";
|
|
18
|
-
import "react/jsx-runtime";
|
|
19
|
-
import "react";
|
|
20
|
-
import "@m4l/core";
|
|
21
|
-
import "@mui/x-date-pickers/AdapterDateFns";
|
|
22
|
-
import "@mui/x-date-pickers";
|
|
23
|
-
import "date-fns/locale/en-US";
|
|
24
|
-
import "@mui/material/useMediaQuery";
|
|
25
|
-
import "./theme/typography.f5eadf47.js";
|
|
26
|
-
export {
|
|
27
|
-
K as Capitalize,
|
|
28
|
-
n as FormatterContext,
|
|
29
|
-
c as FormatterProvider,
|
|
30
|
-
Q as GetFontValue,
|
|
31
|
-
g as HostThemeContext,
|
|
32
|
-
L as HostThemeProvider,
|
|
33
|
-
C as LocalesContext,
|
|
34
|
-
F as LocalesProvider,
|
|
35
|
-
d as ProgressBarStyle,
|
|
36
|
-
U as colorPresets,
|
|
37
|
-
j as customShadows,
|
|
38
|
-
W as defaultPreset,
|
|
39
|
-
V as defaultThemeOptions,
|
|
40
|
-
Z as fnComponentsOverrides,
|
|
41
|
-
X as getColorPresets,
|
|
42
|
-
h as getLocaleFromNetwork,
|
|
43
|
-
E as palette,
|
|
44
|
-
q as shadows,
|
|
45
|
-
H as useFirstRender,
|
|
46
|
-
w as useFormatter,
|
|
47
|
-
S as useHostTheme,
|
|
48
|
-
y as useIsMountedRef,
|
|
49
|
-
D as useLocales,
|
|
50
|
-
z as useOffSetTop,
|
|
51
|
-
I as useResponsive,
|
|
52
|
-
M as useResponsiveDesktop
|
|
53
|
-
};
|
package/utils/index.d8b24456.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useTheme as h } from "@mui/material/styles";
|
|
2
|
-
import { u as m } from "../hooks/useResponsive/index.fc5e1b4f.js";
|
|
3
|
-
import { p as s } from "../theme/palette.2baf72f5.js";
|
|
4
|
-
function u(e) {
|
|
5
|
-
return Math.round(parseFloat(e) * 16);
|
|
6
|
-
}
|
|
7
|
-
function a(e) {
|
|
8
|
-
return `${e / 16}rem`;
|
|
9
|
-
}
|
|
10
|
-
function P({ sm: e, md: t, lg: r }) {
|
|
11
|
-
return {
|
|
12
|
-
"@media (min-width:600px)": {
|
|
13
|
-
fontSize: a(e)
|
|
14
|
-
},
|
|
15
|
-
"@media (min-width:900px)": {
|
|
16
|
-
fontSize: a(t)
|
|
17
|
-
},
|
|
18
|
-
"@media (min-width:1200px)": {
|
|
19
|
-
fontSize: a(r)
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function f() {
|
|
24
|
-
return [...h().breakpoints.keys].reverse().reduce((r, o) => {
|
|
25
|
-
const i = m("up", o);
|
|
26
|
-
return !r && i ? o : r;
|
|
27
|
-
}, null) || "xs";
|
|
28
|
-
}
|
|
29
|
-
function T(e) {
|
|
30
|
-
const t = h(), r = f(), o = t.breakpoints.up(r === "xl" ? "lg" : r), p = (e === "h1" || e === "h2" || e === "h3" || e === "h4" || e === "h5" || e === "h6") && t.typography[e][o] ? t.typography[e][o] : t.typography[e], c = u(p.fontSize), l = Number(t.typography[e].lineHeight) * c, { fontWeight: g, letterSpacing: d } = t.typography[e];
|
|
31
|
-
return { fontSize: c, lineHeight: l, fontWeight: g, letterSpacing: d };
|
|
32
|
-
}
|
|
33
|
-
const n = [
|
|
34
|
-
{
|
|
35
|
-
name: "default",
|
|
36
|
-
...s.light.primary,
|
|
37
|
-
LightSelected: "#EBF9F1",
|
|
38
|
-
LightSelectedHover: "#D6F2E3",
|
|
39
|
-
DarkSelected: "#142827",
|
|
40
|
-
DarkSelectedHover: "#12342B"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "purple",
|
|
44
|
-
lighter: "#EBD6FD",
|
|
45
|
-
light: "#B985F4",
|
|
46
|
-
main: "#7635dc",
|
|
47
|
-
dark: "#431A9E",
|
|
48
|
-
darker: "#200A69",
|
|
49
|
-
contrastText: "#fff"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "cyan",
|
|
53
|
-
lighter: "#D1FFFC",
|
|
54
|
-
light: "#76F2FF",
|
|
55
|
-
main: "#1CCAFF",
|
|
56
|
-
dark: "#0E77B7",
|
|
57
|
-
darker: "#053D7A",
|
|
58
|
-
contrastText: s.light.grey[800]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "blue",
|
|
62
|
-
lighter: "#D1E9FC",
|
|
63
|
-
light: "#76B0F1",
|
|
64
|
-
main: "#2065D1",
|
|
65
|
-
dark: "#103996",
|
|
66
|
-
darker: "#061B64",
|
|
67
|
-
contrastText: "#fff"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "orange",
|
|
71
|
-
lighter: "#FEF4D4",
|
|
72
|
-
light: "#FED680",
|
|
73
|
-
main: "#fda92d",
|
|
74
|
-
dark: "#B66816",
|
|
75
|
-
darker: "#793908",
|
|
76
|
-
contrastText: s.light.grey[800]
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "red",
|
|
80
|
-
lighter: "#FFE3D5",
|
|
81
|
-
light: "#FFC1AC",
|
|
82
|
-
main: "#FF3030",
|
|
83
|
-
dark: "#B71833",
|
|
84
|
-
darker: "#7A0930",
|
|
85
|
-
contrastText: "#fff"
|
|
86
|
-
}
|
|
87
|
-
], F = n[0], y = n[1], k = n[2], x = n[3], D = n[4], S = n[5];
|
|
88
|
-
function b(e) {
|
|
89
|
-
return {
|
|
90
|
-
purple: y,
|
|
91
|
-
cyan: k,
|
|
92
|
-
blue: x,
|
|
93
|
-
orange: D,
|
|
94
|
-
red: S,
|
|
95
|
-
default: F
|
|
96
|
-
}[e];
|
|
97
|
-
}
|
|
98
|
-
const z = (e) => e && e[0].toUpperCase() + e.slice(1) || "";
|
|
99
|
-
export {
|
|
100
|
-
z as C,
|
|
101
|
-
T as a,
|
|
102
|
-
n as c,
|
|
103
|
-
F as d,
|
|
104
|
-
b as g,
|
|
105
|
-
a as p,
|
|
106
|
-
P as r
|
|
107
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|