@m4l/graphics 0.1.6 → 0.1.8

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.
Files changed (34) hide show
  1. package/components/ProgressBarStyle/index.fb6fd9ed.js +36 -0
  2. package/components/{index.js → index.80514d59.js} +0 -0
  3. package/contexts/HostThemeContext/index.c6db12d4.js +53 -0
  4. package/contexts/LocalesContext/index.c10c0bb5.js +53 -0
  5. package/contexts/index.993249c2.js +2 -0
  6. package/hooks/index.9ec64bcf.js +26 -0
  7. package/hooks/useHostTheme/index.b3063684.js +11 -0
  8. package/hooks/useLocales/index.680b143a.js +11 -0
  9. package/hooks/useResponsive/index.fc5e1b4f.js +20 -0
  10. package/index.js +36 -13
  11. package/package.json +1 -1
  12. package/theme/defaultThemeOptions.9b9e7503.js +34 -0
  13. package/theme/overrides/Autocomplete.d.ts +1 -1
  14. package/theme/overrides/DataGrid.d.ts +2 -2
  15. package/theme/overrides/Table.d.ts +5 -5
  16. package/theme/overrides/Tabs.d.ts +2 -2
  17. package/theme/overrides/ToggleButton.d.ts +1 -1
  18. package/theme/{overrides.js → overrides.7958c0ab.js} +307 -306
  19. package/theme/palette.2baf72f5.js +126 -0
  20. package/theme/shadows.bf8dc290.js +61 -0
  21. package/theme/{typography.js → typography.f5eadf47.js} +26 -25
  22. package/utils/index.d8b24456.js +107 -0
  23. package/components/ProgressBarStyle/index.js +0 -34
  24. package/contexts/HostThemeContext/index.js +0 -70
  25. package/contexts/LocalesContext/index.js +0 -57
  26. package/contexts/index.js +0 -2
  27. package/hooks/index.js +0 -33
  28. package/hooks/useHostTheme/index.js +0 -9
  29. package/hooks/useLocales/index.js +0 -9
  30. package/hooks/useResponsive/index.js +0 -26
  31. package/theme/defaultThemeOptions.js +0 -32
  32. package/theme/palette.js +0 -133
  33. package/theme/shadows.js +0 -65
  34. package/utils/index.js +0 -114
@@ -0,0 +1,36 @@
1
+ import { useTheme as e } from "@mui/material/styles";
2
+ import { GlobalStyles as r } from "@mui/material";
3
+ import { jsx as o } from "react/jsx-runtime";
4
+ function n() {
5
+ const t = e();
6
+ return /* @__PURE__ */ o(r, {
7
+ styles: {
8
+ "#nprogress": {
9
+ pointerEvents: "none",
10
+ "& .bar": {
11
+ top: 0,
12
+ left: 0,
13
+ height: 2,
14
+ width: "100%",
15
+ position: "fixed",
16
+ zIndex: t.zIndex.snackbar,
17
+ backgroundColor: t.palette.primary.main,
18
+ boxShadow: `0 0 2px ${t.palette.primary.main}`
19
+ },
20
+ "& .peg": {
21
+ right: 0,
22
+ opacity: 1,
23
+ width: 100,
24
+ height: "100%",
25
+ display: "block",
26
+ position: "absolute",
27
+ transform: "rotate(3deg) translate(0px, -4px)",
28
+ boxShadow: `0 0 10px ${t.palette.primary.main}, 0 0 5px ${t.palette.primary.main}`
29
+ }
30
+ }
31
+ }
32
+ });
33
+ }
34
+ export {
35
+ n as P
36
+ };
File without changes
@@ -0,0 +1,53 @@
1
+ import { createContext as v, useState as c, useMemo as H, useCallback as O, useEffect as h } from "react";
2
+ import { CssBaseline as C } from "@mui/material";
3
+ import { createTheme as M, StyledEngineProvider as F, ThemeProvider as x } from "@mui/material/styles";
4
+ import { voidFunction as S, useHostTools as N, EmitEvents as T } from "@m4l/core";
5
+ import { jsx as n, jsxs as P } from "react/jsx-runtime";
6
+ const j = {
7
+ hostThemeOptions: {},
8
+ fnComponentsOverrides: S
9
+ }, I = v(j);
10
+ function k(a) {
11
+ const {
12
+ children: l,
13
+ hostThemeOptions: t,
14
+ fnComponentsOverrides: r,
15
+ isMicroFrontEnd: o
16
+ } = a, [s, i] = c(t), {
17
+ events_add_listener: d,
18
+ events_remove_listener: f,
19
+ events_emit: E
20
+ } = N(), [u, p] = c(!0), _ = H(() => {
21
+ const e = M(s);
22
+ return e.components = r(e), e;
23
+ }, [s]), m = O((e) => {
24
+ i(e);
25
+ }, []);
26
+ return h(() => (o && d(T.EMMIT_EVENT_HOST_THEME_CHANGE, m), () => {
27
+ o && f("host_theme_change", m);
28
+ }), []), h(() => {
29
+ if (u) {
30
+ p(!1);
31
+ return;
32
+ }
33
+ o || (i(t), E(T.EMMIT_EVENT_HOST_THEME_CHANGE, t));
34
+ }, [t]), /* @__PURE__ */ n(I.Provider, {
35
+ value: {
36
+ hostThemeOptions: s,
37
+ fnComponentsOverrides: r
38
+ },
39
+ children: /* @__PURE__ */ n(F, {
40
+ injectFirst: !0,
41
+ children: /* @__PURE__ */ P(x, {
42
+ theme: _,
43
+ children: [/* @__PURE__ */ n(C, {
44
+ enableColorScheme: !0
45
+ }), l]
46
+ })
47
+ })
48
+ });
49
+ }
50
+ export {
51
+ I as H,
52
+ k as a
53
+ };
@@ -0,0 +1,53 @@
1
+ import { createContext as f, useMemo as u, useState as L } from "react";
2
+ import { AdapterDateFns as d } from "@mui/x-date-pickers/AdapterDateFns";
3
+ import { LocalizationProvider as v } from "@mui/x-date-pickers";
4
+ import p from "date-fns/locale/es";
5
+ import h from "date-fns/locale/fr";
6
+ import S from "date-fns/locale/en-US";
7
+ import { useLocalStorage as _, useEnvironment as $ } from "@m4l/core";
8
+ import { jsx as t } from "react/jsx-runtime";
9
+ const x = f(null);
10
+ function D({
11
+ children: r
12
+ }) {
13
+ const [l, c] = _("langStorage", "en"), {
14
+ host_static_assets: a,
15
+ environment_assets: n
16
+ } = $(), o = u(() => [{
17
+ label: "English",
18
+ value: "en",
19
+ locale: S,
20
+ icon: `${a}/${n}/frontend/commons/assets/icons/langs/lang_en.svg`
21
+ }, {
22
+ label: "Espa\xF1ol",
23
+ value: "es",
24
+ locale: p,
25
+ icon: `${a}/${n}/frontend/commons/assets/icons/langs/lang_es.svg`
26
+ }, {
27
+ label: "French",
28
+ value: "fr",
29
+ locale: h,
30
+ icon: `${a}/${n}/frontend/commons/assets/icons/langs/lang_fr.svg`
31
+ }], []), [s, i] = L(o.find((e) => e.value === l) || o[0]), m = (e) => {
32
+ c(e), i(o.find((g) => g.value === e) || o[0]);
33
+ };
34
+ return /* @__PURE__ */ t(x.Provider, {
35
+ value: {
36
+ currentLang: s,
37
+ onChangeLang: m,
38
+ allLang: o
39
+ },
40
+ children: /* @__PURE__ */ t(v, {
41
+ dateAdapter: d,
42
+ adapterLocale: s.locale,
43
+ dateFormats: {
44
+ hours24h: "23"
45
+ },
46
+ children: r
47
+ })
48
+ });
49
+ }
50
+ export {
51
+ x as L,
52
+ D as a
53
+ };
@@ -0,0 +1,2 @@
1
+ import "./LocalesContext/index.c10c0bb5.js";
2
+ import "./HostThemeContext/index.c6db12d4.js";
@@ -0,0 +1,26 @@
1
+ import { useRef as n, useEffect as s, useState as r } from "react";
2
+ import "@mui/material/styles";
3
+ import "@mui/material/useMediaQuery";
4
+ import "../contexts/LocalesContext/index.c10c0bb5.js";
5
+ import "../contexts/HostThemeContext/index.c6db12d4.js";
6
+ function a() {
7
+ const e = n(!0);
8
+ return s(
9
+ () => () => {
10
+ e.current = !1;
11
+ },
12
+ []
13
+ ), e;
14
+ }
15
+ function m(e) {
16
+ const [f, t] = r(!1), o = e || 100;
17
+ return s(() => (window.onscroll = () => {
18
+ window.pageYOffset > o ? t(!0) : t(!1);
19
+ }, () => {
20
+ window.onscroll = null;
21
+ }), [o]), f;
22
+ }
23
+ export {
24
+ m as a,
25
+ a as u
26
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { H as o } from "../../contexts/HostThemeContext/index.c6db12d4.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
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as o } from "react";
2
+ import { L as t } from "../../contexts/LocalesContext/index.c10c0bb5.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
+ };
@@ -0,0 +1,20 @@
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
+ };
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- export { P as ProgressBarStyle } from "./components/ProgressBarStyle/index.js";
2
- export { L as LocalesContext, a as LocalesProvider } from "./contexts/LocalesContext/index.js";
3
- export { H as HostThemeContext, a as HostThemeProvider } from "./contexts/HostThemeContext/index.js";
4
- export { u as useResponsive, a as useResponsiveDesktop } from "./hooks/useResponsive/index.js";
5
- export { u as useIsMountedRef, a as useOffSetTop } from "./hooks/index.js";
6
- export { u as useLocales } from "./hooks/useLocales/index.js";
7
- export { u as useHostTheme } from "./hooks/useHostTheme/index.js";
8
- export { d as defaultThemeOptions } from "./theme/defaultThemeOptions.js";
9
- export { c as customShadows, s as shadows } from "./theme/shadows.js";
10
- export { p as palette } from "./theme/palette.js";
11
- export { C as Capitalize, a as GetFontValue, c as colorPresets, d as defaultPreset, g as getColorPresets } from "./utils/index.js";
12
- export { f as fnComponentsOverrides } from "./theme/overrides.js";
1
+ import { P as n } from "./components/ProgressBarStyle/index.fb6fd9ed.js";
2
+ import { L as P, a as h } from "./contexts/LocalesContext/index.c10c0bb5.js";
3
+ import { H as v, a as T } from "./contexts/HostThemeContext/index.c6db12d4.js";
4
+ import { u as L, a as g } from "./hooks/useResponsive/index.fc5e1b4f.js";
5
+ import { u as R, a as S } from "./hooks/index.9ec64bcf.js";
6
+ import { u as k } from "./hooks/useLocales/index.680b143a.js";
7
+ import { u as z } from "./hooks/useHostTheme/index.b3063684.js";
8
+ import { d as D } from "./theme/defaultThemeOptions.9b9e7503.js";
9
+ import { c as G, s as I } from "./theme/shadows.bf8dc290.js";
10
+ import { p as V } from "./theme/palette.2baf72f5.js";
11
+ import { C as j, a as q, c as A, d as E, g as J } from "./utils/index.d8b24456.js";
12
+ import { f as N } from "./theme/overrides.7958c0ab.js";
13
13
  import "@mui/material/styles";
14
14
  import "@mui/material";
15
15
  import "react/jsx-runtime";
@@ -21,4 +21,27 @@ import "date-fns/locale/fr";
21
21
  import "date-fns/locale/en-US";
22
22
  import "@m4l/core";
23
23
  import "@mui/material/useMediaQuery";
24
- import "./theme/typography.js";
24
+ import "./theme/typography.f5eadf47.js";
25
+ export {
26
+ j as Capitalize,
27
+ q as GetFontValue,
28
+ v as HostThemeContext,
29
+ T as HostThemeProvider,
30
+ P as LocalesContext,
31
+ h as LocalesProvider,
32
+ n as ProgressBarStyle,
33
+ A as colorPresets,
34
+ G as customShadows,
35
+ E as defaultPreset,
36
+ D as defaultThemeOptions,
37
+ N as fnComponentsOverrides,
38
+ J as getColorPresets,
39
+ V as palette,
40
+ I as shadows,
41
+ z as useHostTheme,
42
+ R as useIsMountedRef,
43
+ k as useLocales,
44
+ S as useOffSetTop,
45
+ L as useResponsive,
46
+ g as useResponsiveDesktop
47
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "dependencies": {
@@ -0,0 +1,34 @@
1
+ import { alpha as t } from "@mui/material/styles";
2
+ import { t as a } from "./typography.f5eadf47.js";
3
+ import { p as r, G as e } from "./palette.2baf72f5.js";
4
+ import { s as o, c as s } from "./shadows.bf8dc290.js";
5
+ import { g as i } from "../utils/index.d8b24456.js";
6
+ const c = {
7
+ typography: a,
8
+ shadows: o.light,
9
+ customShadows: {
10
+ ...s.light,
11
+ primary: `0 8px 16px 0 ${t(i("default").main, 0.24)}`
12
+ },
13
+ palette: {
14
+ ...r.light,
15
+ primary: {
16
+ lighter: "#283829",
17
+ light: "#26372b",
18
+ main: "#00AB55",
19
+ dark: "#007B55",
20
+ darker: "#005249",
21
+ LightSelected: "#EBF9F1",
22
+ LightSelectedHover: "#D6F2E3",
23
+ DarkSelected: "#142827",
24
+ DarkSelectedHover: "#12342B"
25
+ },
26
+ text: { primary: e[800], secondary: e[700], disabled: e[500] },
27
+ secondary: {
28
+ main: "#34ac4e"
29
+ }
30
+ }
31
+ };
32
+ export {
33
+ c as d
34
+ };
@@ -18,7 +18,7 @@ export default function Autocomplete(theme: Theme): {
18
18
  '& .MuiAutocomplete-option': {
19
19
  padding: string;
20
20
  margin: string;
21
- borderRadius: string | number;
21
+ borderRadius: number;
22
22
  };
23
23
  };
24
24
  };
@@ -36,7 +36,7 @@ export default function DataGrid(theme: Theme): {
36
36
  root: {
37
37
  '& .MuiDataGrid-gridMenuList': {
38
38
  boxShadow: string;
39
- borderRadius: string | number;
39
+ borderRadius: number;
40
40
  };
41
41
  '& .MuiMenuItem-root': {
42
42
  [x: string]: unknown;
@@ -847,7 +847,7 @@ export default function DataGrid(theme: Theme): {
847
847
  };
848
848
  '& .MuiNativeSelect-select, .MuiInput-input': {
849
849
  padding: string;
850
- borderRadius: string | number;
850
+ borderRadius: number;
851
851
  backgroundColor: string;
852
852
  '@font-face'?: import("@mui/material/styles/createTypography").Fontface | import("@mui/material/styles/createTypography").Fontface[] | undefined;
853
853
  accentColor?: import("csstype").Property.AccentColor | undefined;
@@ -22,14 +22,14 @@ export default function Table(theme: Theme): {
22
22
  backgroundColor: string;
23
23
  '&:first-of-type': {
24
24
  paddingLeft: string;
25
- borderTopLeftRadius: string | number;
26
- borderBottomLeftRadius: string | number;
25
+ borderTopLeftRadius: number;
26
+ borderBottomLeftRadius: number;
27
27
  boxShadow: string;
28
28
  };
29
29
  '&:last-of-type': {
30
30
  paddingRight: string;
31
- borderTopRightRadius: string | number;
32
- borderBottomRightRadius: string | number;
31
+ borderTopRightRadius: number;
32
+ borderBottomRightRadius: number;
33
33
  boxShadow: string;
34
34
  };
35
35
  };
@@ -3226,7 +3226,7 @@ export default function Table(theme: Theme): {
3226
3226
  select: {
3227
3227
  paddingBottom: number;
3228
3228
  '&:focus': {
3229
- borderRadius: string | number;
3229
+ borderRadius: number;
3230
3230
  };
3231
3231
  };
3232
3232
  selectIcon: {
@@ -5,8 +5,8 @@ export default function Tabs(theme: Theme): {
5
5
  root: {
6
6
  padding: number;
7
7
  fontWeight: import("csstype").Property.FontWeight | undefined;
8
- borderTopLeftRadius: string | number;
9
- borderTopRightRadius: string | number;
8
+ borderTopLeftRadius: number;
9
+ borderTopRightRadius: number;
10
10
  '&.Mui-selected': {
11
11
  color: string;
12
12
  };
@@ -29,7 +29,7 @@ export default function ToggleButton(theme: Theme): {
29
29
  MuiToggleButtonGroup: {
30
30
  styleOverrides: {
31
31
  root: {
32
- borderRadius: string | number;
32
+ borderRadius: number;
33
33
  backgroundColor: string;
34
34
  border: string;
35
35
  '& .MuiToggleButton-root': {