@m4l/graphics 0.1.7 → 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 -69
  25. package/contexts/LocalesContext/index.js +0 -55
  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
package/theme/palette.js DELETED
@@ -1,133 +0,0 @@
1
- import { alpha } from "@mui/material/styles";
2
- function createGradient(color1, color2) {
3
- return `linear-gradient(to bottom, ${color1}, ${color2})`;
4
- }
5
- const PRIMARY = {
6
- lighter: "#C8FACD",
7
- light: "#5BE584",
8
- main: "#00AB55",
9
- dark: "#007B55",
10
- darker: "#005249"
11
- };
12
- const SECONDARY = {
13
- lighter: "#D6E4FF",
14
- light: "#84A9FF",
15
- main: "#3366FF",
16
- dark: "#1939B7",
17
- darker: "#091A7A"
18
- };
19
- const INFO = {
20
- lighter: "#D0F2FF",
21
- light: "#74CAFF",
22
- main: "#1890FF",
23
- dark: "#0C53B7",
24
- darker: "#04297A"
25
- };
26
- const SUCCESS = {
27
- lighter: "#E9FCD4",
28
- light: "#AAF27F",
29
- main: "#54D62C",
30
- dark: "#229A16",
31
- darker: "#08660D"
32
- };
33
- const WARNING = {
34
- lighter: "#FFF7CD",
35
- light: "#FFE16A",
36
- main: "#FFC107",
37
- dark: "#B78103",
38
- darker: "#7A4F01"
39
- };
40
- const ERROR = {
41
- lighter: "#FFE7D9",
42
- light: "#FFA48D",
43
- main: "#FF4842",
44
- dark: "#B72136",
45
- darker: "#7A0C2E"
46
- };
47
- const GREY = {
48
- 0: "#FFFFFF",
49
- 100: "#F9FAFB",
50
- 200: "#F4F6F8",
51
- 300: "#DFE3E8",
52
- 400: "#C4CDD5",
53
- 500: "#919EAB",
54
- 600: "#637381",
55
- 700: "#454F5B",
56
- 800: "#212B36",
57
- 900: "#161C24",
58
- 5008: alpha("#919EAB", 0.08),
59
- 50012: alpha("#919EAB", 0.12),
60
- 50016: alpha("#919EAB", 0.16),
61
- 50024: alpha("#919EAB", 0.24),
62
- 50032: alpha("#919EAB", 0.32),
63
- 50048: alpha("#919EAB", 0.48),
64
- 50056: alpha("#919EAB", 0.56),
65
- 50080: alpha("#919EAB", 0.8)
66
- };
67
- const GRADIENTS = {
68
- primary: createGradient(PRIMARY.light, PRIMARY.main),
69
- info: createGradient(INFO.light, INFO.main),
70
- success: createGradient(SUCCESS.light, SUCCESS.main),
71
- warning: createGradient(WARNING.light, WARNING.main),
72
- error: createGradient(ERROR.light, ERROR.main)
73
- };
74
- const CHART_COLORS = {
75
- violet: ["#826AF9", "#9E86FF", "#D0AEFF", "#F7D2FF"],
76
- blue: ["#2D99FF", "#83CFFF", "#A5F3FF", "#CCFAFF"],
77
- green: ["#2CD9C5", "#60F1C8", "#A4F7CC", "#C0F2DC"],
78
- yellow: ["#FFE700", "#FFEF5A", "#FFF7AE", "#FFF3D6"],
79
- red: ["#FF6C40", "#FF8F6D", "#FFBD98", "#FFF2D4"]
80
- };
81
- const COMMON = {
82
- common: { black: "#000", white: "#fff" },
83
- primary: { ...PRIMARY, contrastText: "#fff" },
84
- secondary: { ...SECONDARY, contrastText: "#fff" },
85
- info: { ...INFO, contrastText: "#fff" },
86
- success: { ...SUCCESS, contrastText: GREY[800] },
87
- warning: { ...WARNING, contrastText: GREY[800] },
88
- error: { ...ERROR, contrastText: "#fff" },
89
- grey: GREY,
90
- gradients: GRADIENTS,
91
- chart: CHART_COLORS,
92
- divider: GREY[50024],
93
- action: {
94
- hover: GREY[5008],
95
- selected: GREY[50016],
96
- disabled: GREY[50080],
97
- disabledBackground: GREY[50024],
98
- focus: GREY[50024],
99
- hoverOpacity: 0.08,
100
- disabledOpacity: 0.48
101
- }
102
- };
103
- const palette = {
104
- light: {
105
- ...COMMON,
106
- mode: "light",
107
- text: { primary: GREY[800], secondary: GREY[700], disabled: GREY[500] },
108
- background: {
109
- paper: "#fff",
110
- default: "#fff",
111
- neutral: GREY[200],
112
- autocomplete: GREY[100],
113
- header: "#F6F7F9"
114
- },
115
- action: { active: GREY[600], ...COMMON.action },
116
- grid: { sectionHeader: "#F6F7F9", divider: "#EDEFF2", rowHover: "#FAFBFC" }
117
- },
118
- dark: {
119
- ...COMMON,
120
- mode: "dark",
121
- text: { primary: "#fff", secondary: GREY[500], disabled: GREY[600] },
122
- background: {
123
- paper: GREY[800],
124
- default: GREY[900],
125
- neutral: GREY[50016],
126
- autocomplete: GREY[800],
127
- header: "#29313A"
128
- },
129
- action: { active: GREY[500], ...COMMON.action },
130
- grid: { sectionHeader: "#29313A", divider: "#3E464F", rowHover: "#1F262F" }
131
- }
132
- };
133
- export { GREY as G, palette as p };
package/theme/shadows.js DELETED
@@ -1,65 +0,0 @@
1
- import { alpha } from "@mui/material/styles";
2
- import { p as palette } from "./palette.js";
3
- const LIGHT_MODE = palette.light.grey[500];
4
- const DARK_MODE = "#000000";
5
- const createShadow = (color) => {
6
- const transparent1 = alpha(color, 0.2);
7
- const transparent2 = alpha(color, 0.14);
8
- const transparent3 = alpha(color, 0.12);
9
- return [
10
- "none",
11
- `0px 2px 1px -1px ${transparent1},0px 1px 1px 0px ${transparent2},0px 1px 3px 0px ${transparent3}`,
12
- `0px 3px 1px -2px ${transparent1},0px 2px 2px 0px ${transparent2},0px 1px 5px 0px ${transparent3}`,
13
- `0px 3px 3px -2px ${transparent1},0px 3px 4px 0px ${transparent2},0px 1px 8px 0px ${transparent3}`,
14
- `0px 2px 4px -1px ${transparent1},0px 4px 5px 0px ${transparent2},0px 1px 10px 0px ${transparent3}`,
15
- `0px 3px 5px -1px ${transparent1},0px 5px 8px 0px ${transparent2},0px 1px 14px 0px ${transparent3}`,
16
- `0px 3px 5px -1px ${transparent1},0px 6px 10px 0px ${transparent2},0px 1px 18px 0px ${transparent3}`,
17
- `0px 4px 5px -2px ${transparent1},0px 7px 10px 1px ${transparent2},0px 2px 16px 1px ${transparent3}`,
18
- `0px 5px 5px -3px ${transparent1},0px 8px 10px 1px ${transparent2},0px 3px 14px 2px ${transparent3}`,
19
- `0px 5px 6px -3px ${transparent1},0px 9px 12px 1px ${transparent2},0px 3px 16px 2px ${transparent3}`,
20
- `0px 6px 6px -3px ${transparent1},0px 10px 14px 1px ${transparent2},0px 4px 18px 3px ${transparent3}`,
21
- `0px 6px 7px -4px ${transparent1},0px 11px 15px 1px ${transparent2},0px 4px 20px 3px ${transparent3}`,
22
- `0px 7px 8px -4px ${transparent1},0px 12px 17px 2px ${transparent2},0px 5px 22px 4px ${transparent3}`,
23
- `0px 7px 8px -4px ${transparent1},0px 13px 19px 2px ${transparent2},0px 5px 24px 4px ${transparent3}`,
24
- `0px 7px 9px -4px ${transparent1},0px 14px 21px 2px ${transparent2},0px 5px 26px 4px ${transparent3}`,
25
- `0px 8px 9px -5px ${transparent1},0px 15px 22px 2px ${transparent2},0px 6px 28px 5px ${transparent3}`,
26
- `0px 8px 10px -5px ${transparent1},0px 16px 24px 2px ${transparent2},0px 6px 30px 5px ${transparent3}`,
27
- `0px 8px 11px -5px ${transparent1},0px 17px 26px 2px ${transparent2},0px 6px 32px 5px ${transparent3}`,
28
- `0px 9px 11px -5px ${transparent1},0px 18px 28px 2px ${transparent2},0px 7px 34px 6px ${transparent3}`,
29
- `0px 9px 12px -6px ${transparent1},0px 19px 29px 2px ${transparent2},0px 7px 36px 6px ${transparent3}`,
30
- `0px 10px 13px -6px ${transparent1},0px 20px 31px 3px ${transparent2},0px 8px 38px 7px ${transparent3}`,
31
- `0px 10px 13px -6px ${transparent1},0px 21px 33px 3px ${transparent2},0px 8px 40px 7px ${transparent3}`,
32
- `0px 10px 14px -6px ${transparent1},0px 22px 35px 3px ${transparent2},0px 8px 42px 7px ${transparent3}`,
33
- `0px 11px 14px -7px ${transparent1},0px 23px 36px 3px ${transparent2},0px 9px 44px 8px ${transparent3}`,
34
- `0px 11px 15px -7px ${transparent1},0px 24px 38px 3px ${transparent2},0px 9px 46px 8px ${transparent3}`
35
- ];
36
- };
37
- const createCustomShadow = (color) => {
38
- const transparent = alpha(color, 0.16);
39
- return {
40
- z1: `0 1px 2px 0 ${transparent}`,
41
- z8: `0 8px 16px 0 ${transparent}`,
42
- z12: `0 12px 24px -4px ${transparent}`,
43
- z16: `0 16px 32px -4px ${transparent}`,
44
- z20: `0 20px 40px -4px ${transparent}`,
45
- z24: `0 24px 48px 0 ${transparent}`,
46
- primary: `0 8px 16px 0 ${alpha(palette.light.primary.main, 0.24)}`,
47
- info: `0 8px 16px 0 ${alpha(palette.light.info.main, 0.24)}`,
48
- secondary: `0 8px 16px 0 ${alpha(palette.light.secondary.main, 0.24)}`,
49
- success: `0 8px 16px 0 ${alpha(palette.light.success.main, 0.24)}`,
50
- warning: `0 8px 16px 0 ${alpha(palette.light.warning.main, 0.24)}`,
51
- error: `0 8px 16px 0 ${alpha(palette.light.error.main, 0.24)}`,
52
- card: `0 0 2px 0 ${alpha(color, 0.2)}, 0 12px 24px -4px ${alpha(color, 0.12)}`,
53
- dialog: `-40px 40px 80px -8px ${alpha(palette.light.common.black, 0.24)}`,
54
- dropdown: `0 0 2px 0 ${alpha(color, 0.24)}, -20px 20px 40px -4px ${alpha(color, 0.24)}`
55
- };
56
- };
57
- const customShadows = {
58
- light: createCustomShadow(LIGHT_MODE),
59
- dark: createCustomShadow(DARK_MODE)
60
- };
61
- const shadows = {
62
- light: createShadow(LIGHT_MODE),
63
- dark: createShadow(DARK_MODE)
64
- };
65
- export { customShadows as c, shadows as s };
package/utils/index.js DELETED
@@ -1,114 +0,0 @@
1
- import { useTheme } from "@mui/material/styles";
2
- import { u as useResponsive } from "../hooks/useResponsive/index.js";
3
- import { p as palette } from "../theme/palette.js";
4
- function remToPx(value) {
5
- return Math.round(parseFloat(value) * 16);
6
- }
7
- function pxToRem(value) {
8
- return `${value / 16}rem`;
9
- }
10
- function responsiveFontSizes({ sm, md, lg }) {
11
- return {
12
- "@media (min-width:600px)": {
13
- fontSize: pxToRem(sm)
14
- },
15
- "@media (min-width:900px)": {
16
- fontSize: pxToRem(md)
17
- },
18
- "@media (min-width:1200px)": {
19
- fontSize: pxToRem(lg)
20
- }
21
- };
22
- }
23
- function useWidth() {
24
- const theme = useTheme();
25
- const keys = [...theme.breakpoints.keys].reverse();
26
- return keys.reduce((output, key) => {
27
- const matches = useResponsive("up", key);
28
- return !output && matches ? key : output;
29
- }, null) || "xs";
30
- }
31
- function getFontValue(variant) {
32
- const theme = useTheme();
33
- const breakpoints = useWidth();
34
- const key = theme.breakpoints.up(breakpoints === "xl" ? "lg" : breakpoints);
35
- const hasResponsive = variant === "h1" || variant === "h2" || variant === "h3" || variant === "h4" || variant === "h5" || variant === "h6";
36
- const getFont = hasResponsive && theme.typography[variant][key] ? theme.typography[variant][key] : theme.typography[variant];
37
- const fontSize = remToPx(getFont.fontSize);
38
- const lineHeight = Number(theme.typography[variant].lineHeight) * fontSize;
39
- const { fontWeight, letterSpacing } = theme.typography[variant];
40
- return { fontSize, lineHeight, fontWeight, letterSpacing };
41
- }
42
- const colorPresets = [
43
- {
44
- name: "default",
45
- ...palette.light.primary,
46
- LightSelected: "#EBF9F1",
47
- LightSelectedHover: "#D6F2E3",
48
- DarkSelected: "#142827",
49
- DarkSelectedHover: "#12342B"
50
- },
51
- {
52
- name: "purple",
53
- lighter: "#EBD6FD",
54
- light: "#B985F4",
55
- main: "#7635dc",
56
- dark: "#431A9E",
57
- darker: "#200A69",
58
- contrastText: "#fff"
59
- },
60
- {
61
- name: "cyan",
62
- lighter: "#D1FFFC",
63
- light: "#76F2FF",
64
- main: "#1CCAFF",
65
- dark: "#0E77B7",
66
- darker: "#053D7A",
67
- contrastText: palette.light.grey[800]
68
- },
69
- {
70
- name: "blue",
71
- lighter: "#D1E9FC",
72
- light: "#76B0F1",
73
- main: "#2065D1",
74
- dark: "#103996",
75
- darker: "#061B64",
76
- contrastText: "#fff"
77
- },
78
- {
79
- name: "orange",
80
- lighter: "#FEF4D4",
81
- light: "#FED680",
82
- main: "#fda92d",
83
- dark: "#B66816",
84
- darker: "#793908",
85
- contrastText: palette.light.grey[800]
86
- },
87
- {
88
- name: "red",
89
- lighter: "#FFE3D5",
90
- light: "#FFC1AC",
91
- main: "#FF3030",
92
- dark: "#B71833",
93
- darker: "#7A0930",
94
- contrastText: "#fff"
95
- }
96
- ];
97
- const defaultPreset = colorPresets[0];
98
- const purplePreset = colorPresets[1];
99
- const cyanPreset = colorPresets[2];
100
- const bluePreset = colorPresets[3];
101
- const orangePreset = colorPresets[4];
102
- const redPreset = colorPresets[5];
103
- function getColorPresets(presetsKey) {
104
- return {
105
- purple: purplePreset,
106
- cyan: cyanPreset,
107
- blue: bluePreset,
108
- orange: orangePreset,
109
- red: redPreset,
110
- default: defaultPreset
111
- }[presetsKey];
112
- }
113
- const Capitalize = (s) => s && s[0].toUpperCase() + s.slice(1) || "";
114
- export { Capitalize as C, getFontValue as a, colorPresets as c, defaultPreset as d, getColorPresets as g, pxToRem as p, responsiveFontSizes as r };