@saleor/macaw-ui 0.2.4
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/README.md +40 -0
- package/dist/ActionBar/ActionBar.d.ts +8 -0
- package/dist/ActionBar/context.d.ts +9 -0
- package/dist/ActionBar/index.d.ts +2 -0
- package/dist/ActionBar/styles.d.ts +2 -0
- package/dist/Alert/Alert.d.ts +9 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/styles.d.ts +2 -0
- package/dist/Backlink/Backlink.d.ts +6 -0
- package/dist/Backlink/context.d.ts +5 -0
- package/dist/Backlink/index.d.ts +2 -0
- package/dist/Backlink/styles.d.ts +2 -0
- package/dist/ConfirmButton/ConfirmButton.d.ts +11 -0
- package/dist/ConfirmButton/index.d.ts +1 -0
- package/dist/ConfirmButton/styles.d.ts +2 -0
- package/dist/Notification/Notification.d.ts +3 -0
- package/dist/Notification/index.d.ts +2 -0
- package/dist/Notification/styles.d.ts +2 -0
- package/dist/Notification/types.d.ts +16 -0
- package/dist/ResponsiveTable/ResponsiveTable.d.ts +8 -0
- package/dist/ResponsiveTable/index.d.ts +1 -0
- package/dist/ResponsiveTable/styles.d.ts +2 -0
- package/dist/Savebar/ButtonTooltipDecorator.d.ts +6 -0
- package/dist/Savebar/Savebar.d.ts +14 -0
- package/dist/Savebar/index.d.ts +1 -0
- package/dist/Savebar/styles.d.ts +2 -0
- package/dist/Sidebar/ExpandButton.d.ts +6 -0
- package/dist/Sidebar/MenuItem.d.ts +11 -0
- package/dist/Sidebar/Sidebar.d.ts +6 -0
- package/dist/Sidebar/fixtures.d.ts +2 -0
- package/dist/Sidebar/index.d.ts +4 -0
- package/dist/Sidebar/types.d.ts +16 -0
- package/dist/SidebarDrawer/MenuItemBtn.d.ts +7 -0
- package/dist/SidebarDrawer/SidebarDrawer.d.ts +4 -0
- package/dist/SidebarDrawer/index.d.ts +2 -0
- package/dist/SidebarDrawer/styles.d.ts +2 -0
- package/dist/SquareButton/SquareButton.d.ts +3 -0
- package/dist/SquareButton/index.d.ts +1 -0
- package/dist/Tooltip/Tooltip.d.ts +6 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/styles.d.ts +3 -0
- package/dist/UserChipMenu/UserChipMenu.d.ts +8 -0
- package/dist/UserChipMenu/UserChipMenuItem.d.ts +6 -0
- package/dist/UserChipMenu/context.d.ts +4 -0
- package/dist/UserChipMenu/index.d.ts +2 -0
- package/dist/UserChipMenu/styles.d.ts +2 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/sendMessage.d.ts +3 -0
- package/dist/extensions/types.d.ts +22 -0
- package/dist/extensions/useExtensionMessage.d.ts +2 -0
- package/dist/icons/ArrowDropdownIcon.d.ts +2 -0
- package/dist/icons/CheckboxCheckedIcon.d.ts +1 -0
- package/dist/icons/CheckboxIcon.d.ts +1 -0
- package/dist/icons/CheckboxIndeterminateIcon.d.ts +1 -0
- package/dist/icons/CompleteIcon.d.ts +2 -0
- package/dist/icons/InfoIcon.d.ts +2 -0
- package/dist/icons/Logo.d.ts +2 -0
- package/dist/icons/NotAllowedIcon.d.ts +2 -0
- package/dist/icons/NotAllowedInvertedIcon.d.ts +2 -0
- package/dist/icons/WarningIcon.d.ts +2 -0
- package/dist/icons/index.d.ts +9 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/dist/localStorageKeys.d.ts +4 -0
- package/dist/macaw-ui.cjs.development.js +2582 -0
- package/dist/macaw-ui.cjs.development.js.map +1 -0
- package/dist/macaw-ui.cjs.production.min.js +2 -0
- package/dist/macaw-ui.cjs.production.min.js.map +1 -0
- package/dist/macaw-ui.esm.js +2536 -0
- package/dist/macaw-ui.esm.js.map +1 -0
- package/dist/theme/Baseline.d.ts +2 -0
- package/dist/theme/ThemeProvider.d.ts +17 -0
- package/dist/theme/context.d.ts +3 -0
- package/dist/theme/createSaleorTheme/createSaleorTheme.d.ts +3 -0
- package/dist/theme/createSaleorTheme/index.d.ts +2 -0
- package/dist/theme/createSaleorTheme/overrides/buttons.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/index.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/inputs.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/tables.d.ts +3 -0
- package/dist/theme/createSaleorTheme/palette.d.ts +2 -0
- package/dist/theme/createSaleorTheme/shadows.d.ts +2 -0
- package/dist/theme/createSaleorTheme/types.d.ts +53 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/styles.d.ts +5 -0
- package/dist/theme/themes.d.ts +3 -0
- package/dist/theme/types.d.ts +6 -0
- package/dist/theme/utils.d.ts +1 -0
- package/dist/tools/useLocalStorage.d.ts +5 -0
- package/dist/tools/useWindowScroll.d.ts +5 -0
- package/dist/utils/Decorator.d.ts +4 -0
- package/package.json +117 -0
- package/src/ActionBar/ActionBar.stories.tsx +34 -0
- package/src/ActionBar/ActionBar.tsx +58 -0
- package/src/ActionBar/context.tsx +32 -0
- package/src/ActionBar/index.ts +2 -0
- package/src/ActionBar/styles.ts +27 -0
- package/src/Alert/Alert.stories.tsx +30 -0
- package/src/Alert/Alert.tsx +86 -0
- package/src/Alert/index.ts +1 -0
- package/src/Alert/styles.ts +46 -0
- package/src/Backlink/Backlink.stories.tsx +51 -0
- package/src/Backlink/Backlink.tsx +40 -0
- package/src/Backlink/context.tsx +27 -0
- package/src/Backlink/index.ts +2 -0
- package/src/Backlink/styles.ts +41 -0
- package/src/ConfirmButton/ConfirmButton.stories.tsx +72 -0
- package/src/ConfirmButton/ConfirmButton.tsx +119 -0
- package/src/ConfirmButton/index.ts +1 -0
- package/src/ConfirmButton/styles.ts +44 -0
- package/src/Notification/Notification.stories.tsx +42 -0
- package/src/Notification/Notification.tsx +98 -0
- package/src/Notification/index.ts +2 -0
- package/src/Notification/styles.ts +74 -0
- package/src/Notification/types.ts +18 -0
- package/src/ResponsiveTable/ResponsiveTable.tsx +24 -0
- package/src/ResponsiveTable/index.ts +1 -0
- package/src/ResponsiveTable/styles.ts +23 -0
- package/src/Savebar/ButtonTooltipDecorator.tsx +22 -0
- package/src/Savebar/Savebar.stories.tsx +57 -0
- package/src/Savebar/Savebar.tsx +79 -0
- package/src/Savebar/index.ts +1 -0
- package/src/Savebar/styles.ts +25 -0
- package/src/Sidebar/ExpandButton.tsx +44 -0
- package/src/Sidebar/MenuItem.tsx +217 -0
- package/src/Sidebar/Sidebar.stories.tsx +21 -0
- package/src/Sidebar/Sidebar.tsx +88 -0
- package/src/Sidebar/fixtures.ts +39 -0
- package/src/Sidebar/index.ts +4 -0
- package/src/Sidebar/types.ts +18 -0
- package/src/SidebarDrawer/MenuItemBtn.tsx +40 -0
- package/src/SidebarDrawer/SidebarDrawer.stories.tsx +13 -0
- package/src/SidebarDrawer/SidebarDrawer.tsx +113 -0
- package/src/SidebarDrawer/index.ts +2 -0
- package/src/SidebarDrawer/styles.ts +69 -0
- package/src/SquareButton/SquareButton.stories.tsx +15 -0
- package/src/SquareButton/SquareButton.tsx +35 -0
- package/src/SquareButton/index.ts +1 -0
- package/src/Tooltip/Tooltip.stories.tsx +19 -0
- package/src/Tooltip/Tooltip.tsx +25 -0
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/styles.ts +28 -0
- package/src/UserChipMenu/UserChipMenu.stories.tsx +40 -0
- package/src/UserChipMenu/UserChipMenu.tsx +113 -0
- package/src/UserChipMenu/UserChipMenuItem.tsx +33 -0
- package/src/UserChipMenu/context.ts +19 -0
- package/src/UserChipMenu/index.ts +2 -0
- package/src/UserChipMenu/styles.ts +65 -0
- package/src/assets/placeholder_64x64.png +0 -0
- package/src/extensions/index.ts +3 -0
- package/src/extensions/sendMessage.ts +23 -0
- package/src/extensions/types.ts +26 -0
- package/src/extensions/useExtensionMessage.ts +13 -0
- package/src/icons/ArrowDropdownIcon.tsx +11 -0
- package/src/icons/CheckboxCheckedIcon.tsx +15 -0
- package/src/icons/CheckboxIcon.tsx +7 -0
- package/src/icons/CheckboxIndeterminateIcon.tsx +17 -0
- package/src/icons/CompleteIcon.tsx +25 -0
- package/src/icons/InfoIcon.tsx +23 -0
- package/src/icons/Logo.tsx +32 -0
- package/src/icons/NotAllowedIcon.tsx +25 -0
- package/src/icons/NotAllowedInvertedIcon.tsx +25 -0
- package/src/icons/WarningIcon.tsx +23 -0
- package/src/icons/index.ts +9 -0
- package/src/index.tsx +15 -0
- package/src/localStorageKeys.ts +4 -0
- package/src/theme/Baseline.tsx +30 -0
- package/src/theme/ThemeProvider.tsx +84 -0
- package/src/theme/context.ts +8 -0
- package/src/theme/createSaleorTheme/createSaleorTheme.ts +267 -0
- package/src/theme/createSaleorTheme/index.ts +2 -0
- package/src/theme/createSaleorTheme/overrides/buttons.ts +94 -0
- package/src/theme/createSaleorTheme/overrides/index.ts +15 -0
- package/src/theme/createSaleorTheme/overrides/inputs.ts +149 -0
- package/src/theme/createSaleorTheme/overrides/tables.ts +74 -0
- package/src/theme/createSaleorTheme/palette.ts +38 -0
- package/src/theme/createSaleorTheme/shadows.ts +46 -0
- package/src/theme/createSaleorTheme/types.ts +84 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/styles.ts +40 -0
- package/src/theme/themes.ts +113 -0
- package/src/theme/types.ts +7 -0
- package/src/theme/utils.test.ts +43 -0
- package/src/theme/utils.ts +13 -0
- package/src/tools/useLocalStorage.ts +56 -0
- package/src/tools/useWindowScroll.ts +26 -0
- package/src/utils/Decorator.tsx +23 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import CssBaseline from "@material-ui/core/CssBaseline";
|
|
2
|
+
import { fade } from "@material-ui/core/styles";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
import { makeStyles } from "./styles";
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles(
|
|
8
|
+
(theme) => ({
|
|
9
|
+
"@global": {
|
|
10
|
+
"@import": "url('https://rsms.me/inter/inter.css')",
|
|
11
|
+
|
|
12
|
+
// For some reason @import clause must be put on top
|
|
13
|
+
// eslint-disable-next-line sort-keys
|
|
14
|
+
"::selection": {
|
|
15
|
+
background: fade(theme.palette.primary.main, 0.2),
|
|
16
|
+
},
|
|
17
|
+
html: {
|
|
18
|
+
fontSize: "62.5%",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
{ name: "Baseline" }
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const Baseline: React.FC = () => {
|
|
26
|
+
useStyles();
|
|
27
|
+
|
|
28
|
+
return <CssBaseline />;
|
|
29
|
+
};
|
|
30
|
+
Baseline.displayName = "Baseline";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Theme } from "@material-ui/core/styles";
|
|
2
|
+
import { MuiThemeProvider } from "@material-ui/core/styles";
|
|
3
|
+
import { merge } from "lodash";
|
|
4
|
+
import React, { useEffect } from "react";
|
|
5
|
+
|
|
6
|
+
import { ActionBarProvider } from "../ActionBar/context";
|
|
7
|
+
import { BacklinkProvider } from "../Backlink/context";
|
|
8
|
+
import {
|
|
9
|
+
ExtensionMessageType,
|
|
10
|
+
sendMessageToExtension,
|
|
11
|
+
ThemeChangeMessage,
|
|
12
|
+
} from "../extensions";
|
|
13
|
+
import { localStorageKeys } from "../localStorageKeys";
|
|
14
|
+
import useLocalStorage from "../tools/useLocalStorage";
|
|
15
|
+
import { Baseline } from "./Baseline";
|
|
16
|
+
import { ThemeContext } from "./context";
|
|
17
|
+
import { createTheme, Themes, ThemeType } from "./createSaleorTheme";
|
|
18
|
+
import { dark, light } from "./themes";
|
|
19
|
+
import { changeColorMeta } from "./utils";
|
|
20
|
+
|
|
21
|
+
export interface ThemeProviderProps {
|
|
22
|
+
defaultTheme?: ThemeType;
|
|
23
|
+
/**
|
|
24
|
+
* Passing an object here will result in losing visual consistency with
|
|
25
|
+
* Saleor's Dashboard. Use with caution.
|
|
26
|
+
*/
|
|
27
|
+
palettes?: Partial<Themes>;
|
|
28
|
+
/**
|
|
29
|
+
* Passing an object here will result in losing visual consistency with
|
|
30
|
+
* Saleor's Dashboard. Use with caution.
|
|
31
|
+
*/
|
|
32
|
+
overrides?: Partial<Theme>;
|
|
33
|
+
}
|
|
34
|
+
export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
35
|
+
children,
|
|
36
|
+
defaultTheme = "light",
|
|
37
|
+
palettes = {},
|
|
38
|
+
overrides = {},
|
|
39
|
+
}) => {
|
|
40
|
+
const { value: themeTypeName, setValue: setThemeType } = useLocalStorage(
|
|
41
|
+
localStorageKeys.theme,
|
|
42
|
+
defaultTheme
|
|
43
|
+
);
|
|
44
|
+
const themeType = themeTypeName as ThemeType;
|
|
45
|
+
const themes = {
|
|
46
|
+
light,
|
|
47
|
+
dark,
|
|
48
|
+
...palettes,
|
|
49
|
+
};
|
|
50
|
+
const theme = merge(createTheme(themes[themeType]), overrides);
|
|
51
|
+
const sendThemeToExtension = () =>
|
|
52
|
+
sendMessageToExtension<ThemeChangeMessage>(
|
|
53
|
+
{
|
|
54
|
+
theme: themeType,
|
|
55
|
+
type: ExtensionMessageType.THEME,
|
|
56
|
+
},
|
|
57
|
+
"*"
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
sendThemeToExtension();
|
|
62
|
+
changeColorMeta(theme.palette.background.default);
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
}, [themeType]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<ThemeContext.Provider
|
|
68
|
+
value={{
|
|
69
|
+
themeType,
|
|
70
|
+
sendThemeToExtension,
|
|
71
|
+
setTheme: setThemeType,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<MuiThemeProvider theme={theme}>
|
|
75
|
+
<ActionBarProvider>
|
|
76
|
+
<BacklinkProvider>
|
|
77
|
+
<Baseline />
|
|
78
|
+
{children}
|
|
79
|
+
</BacklinkProvider>
|
|
80
|
+
</ActionBarProvider>
|
|
81
|
+
</MuiThemeProvider>
|
|
82
|
+
</ThemeContext.Provider>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { createMuiTheme } from "@material-ui/core/styles";
|
|
2
|
+
import { fade } from "@material-ui/core/styles";
|
|
3
|
+
import type { TypographyProps } from "@material-ui/core/Typography";
|
|
4
|
+
|
|
5
|
+
import { overrides } from "./overrides";
|
|
6
|
+
import { createPalette } from "./palette";
|
|
7
|
+
import { shadows } from "./shadows";
|
|
8
|
+
import { SaleorTheme, SaleorThemeColors } from "./types";
|
|
9
|
+
|
|
10
|
+
export const ICONBUTTON_SIZE = 48;
|
|
11
|
+
|
|
12
|
+
const fontFamily = '"Inter", "roboto", "sans-serif"';
|
|
13
|
+
|
|
14
|
+
export const createTheme = (colors: SaleorThemeColors): SaleorTheme =>
|
|
15
|
+
(createMuiTheme({
|
|
16
|
+
overrides: {
|
|
17
|
+
...overrides(colors, fontFamily),
|
|
18
|
+
MuiCard: {
|
|
19
|
+
root: {
|
|
20
|
+
borderColor: colors.paperBorder,
|
|
21
|
+
borderRadius: 8,
|
|
22
|
+
borderStyle: "solid",
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
overflow: "visible",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
MuiCardActions: {
|
|
28
|
+
root: {
|
|
29
|
+
flexDirection: "row-reverse" as "row-reverse",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
MuiCardContent: {
|
|
33
|
+
root: {
|
|
34
|
+
padding: "2.4rem",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
MuiCardHeader: {
|
|
38
|
+
action: {
|
|
39
|
+
position: "relative",
|
|
40
|
+
top: 4,
|
|
41
|
+
},
|
|
42
|
+
root: {
|
|
43
|
+
padding: "1.6rem 2.4rem",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
MuiChip: {
|
|
47
|
+
avatar: {
|
|
48
|
+
fontSize: "1.2rem",
|
|
49
|
+
height: 32,
|
|
50
|
+
left: -5,
|
|
51
|
+
position: "relative",
|
|
52
|
+
width: 32,
|
|
53
|
+
},
|
|
54
|
+
root: {
|
|
55
|
+
"& $avatar": {
|
|
56
|
+
fontSize: "1.2rem",
|
|
57
|
+
},
|
|
58
|
+
fontSize: "1.3rem",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
MuiDialogActions: {
|
|
62
|
+
root: {
|
|
63
|
+
borderTop: `1px solid ${colors.divider}`,
|
|
64
|
+
padding: "16px 24px",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
MuiDialogContent: {
|
|
68
|
+
root: {
|
|
69
|
+
padding: `24px 0px`,
|
|
70
|
+
margin: `0px 24px`,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
MuiDialogContentText: {
|
|
74
|
+
root: {
|
|
75
|
+
"&:last-child": {
|
|
76
|
+
marginBottom: 0,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
MuiDialogTitle: {
|
|
81
|
+
root: {
|
|
82
|
+
borderBottom: `1px solid ${colors.divider}`,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
MuiFormControlLabel: {
|
|
86
|
+
label: {
|
|
87
|
+
lineHeight: 1.2,
|
|
88
|
+
marginLeft: 4,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
MuiFormLabel: {
|
|
92
|
+
filled: {
|
|
93
|
+
"&&:not($error)": {
|
|
94
|
+
color: colors.primary,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
root: {
|
|
98
|
+
"&&$focused:not($error)": {
|
|
99
|
+
color: colors.font.gray,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
MuiSvgIcon: {
|
|
104
|
+
root: {
|
|
105
|
+
fontSize: "2.4rem",
|
|
106
|
+
height: "1em",
|
|
107
|
+
width: "1em",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
MuiList: {
|
|
111
|
+
root: {
|
|
112
|
+
display: "grid",
|
|
113
|
+
gridRowGap: 8 + "px",
|
|
114
|
+
padding: "8px !important",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
MuiListItem: {
|
|
118
|
+
button: {
|
|
119
|
+
"&:focus": {
|
|
120
|
+
backgroundColor: colors.input.default,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
root: {
|
|
124
|
+
"&$selected": {
|
|
125
|
+
"&:hover": {
|
|
126
|
+
backgroundColor: colors.input.default,
|
|
127
|
+
},
|
|
128
|
+
backgroundColor: colors.input.default,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
MuiMenu: {
|
|
133
|
+
paper: {
|
|
134
|
+
borderRadius: 8,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
MuiMenuItem: {
|
|
138
|
+
root: {
|
|
139
|
+
"&$selected, &$selected:focus, &$selected:hover": {
|
|
140
|
+
backgroundColor: [colors.background.default, "!important"] as any,
|
|
141
|
+
color: colors.primary,
|
|
142
|
+
fontWeight: 700,
|
|
143
|
+
},
|
|
144
|
+
"&:hover": {
|
|
145
|
+
backgroundColor: [colors.background.default, "!important"] as any,
|
|
146
|
+
color: colors.font.default,
|
|
147
|
+
fontWeight: 400,
|
|
148
|
+
},
|
|
149
|
+
borderRadius: 4,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
MuiSelect: {
|
|
153
|
+
root: {
|
|
154
|
+
"&$disabled": {
|
|
155
|
+
backgroundColor: colors.input.disabledBackground,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
MuiSnackbarContent: {
|
|
160
|
+
action: {
|
|
161
|
+
"& $MuiIconButton": {
|
|
162
|
+
"& svg": {
|
|
163
|
+
color: colors.font.default,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
display: "block",
|
|
167
|
+
paddingBottom: 10,
|
|
168
|
+
paddingLeft: 0,
|
|
169
|
+
paddingRight: 45,
|
|
170
|
+
},
|
|
171
|
+
message: {
|
|
172
|
+
fontSize: 16,
|
|
173
|
+
},
|
|
174
|
+
root: {
|
|
175
|
+
backgroundColor: colors.background.paper,
|
|
176
|
+
boxShadow:
|
|
177
|
+
"0 6px 10px 0px rgba(0, 0, 0, 0.15), 0 1px 18px 0px rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.10)",
|
|
178
|
+
color: colors.font.default,
|
|
179
|
+
display: "block",
|
|
180
|
+
maxWidth: 480,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
MuiTooltip: {
|
|
184
|
+
tooltip: {
|
|
185
|
+
fontSize: "0.8em",
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
MuiTouchRipple: {
|
|
189
|
+
child: {
|
|
190
|
+
backgroundColor: fade(colors.primary, 0.2),
|
|
191
|
+
},
|
|
192
|
+
childLeaving: {
|
|
193
|
+
backgroundColor: fade(colors.primary, 0.2),
|
|
194
|
+
},
|
|
195
|
+
ripple: {
|
|
196
|
+
"&$rippleVisible": {
|
|
197
|
+
backgroundColor: fade(colors.primary, 0.2),
|
|
198
|
+
},
|
|
199
|
+
borderRadius: "100%",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
palette: createPalette(colors),
|
|
204
|
+
props: {
|
|
205
|
+
MuiFormControl: {
|
|
206
|
+
variant: "filled",
|
|
207
|
+
},
|
|
208
|
+
MuiTextField: {
|
|
209
|
+
variant: "outlined",
|
|
210
|
+
},
|
|
211
|
+
MuiCard: {
|
|
212
|
+
elevation: 0,
|
|
213
|
+
},
|
|
214
|
+
MuiTypography: {
|
|
215
|
+
component: "div",
|
|
216
|
+
} as TypographyProps,
|
|
217
|
+
MuiCheckbox: {
|
|
218
|
+
color: "primary",
|
|
219
|
+
},
|
|
220
|
+
MuiTooltip: {
|
|
221
|
+
placement: "right-end",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
shadows,
|
|
225
|
+
spacing: (value: number = 1) => `${(value * 8) / 10}rem`,
|
|
226
|
+
typography: {
|
|
227
|
+
allVariants: {
|
|
228
|
+
fontFamily,
|
|
229
|
+
},
|
|
230
|
+
body1: {
|
|
231
|
+
color: colors.font.default,
|
|
232
|
+
fontSize: "1.6rem",
|
|
233
|
+
},
|
|
234
|
+
body2: {
|
|
235
|
+
fontSize: "1.4rem",
|
|
236
|
+
},
|
|
237
|
+
button: {
|
|
238
|
+
fontSize: "1.4rem",
|
|
239
|
+
},
|
|
240
|
+
caption: {
|
|
241
|
+
fontSize: "1.2rem",
|
|
242
|
+
},
|
|
243
|
+
fontFamily,
|
|
244
|
+
h1: {
|
|
245
|
+
fontSize: "4.8rem",
|
|
246
|
+
fontWeight: 700,
|
|
247
|
+
},
|
|
248
|
+
h4: {
|
|
249
|
+
fontSize: "3.4rem",
|
|
250
|
+
color: colors.font.default,
|
|
251
|
+
},
|
|
252
|
+
h5: {
|
|
253
|
+
fontSize: "2.1rem",
|
|
254
|
+
fontWeight: 500,
|
|
255
|
+
},
|
|
256
|
+
h6: {
|
|
257
|
+
fontSize: "2rem",
|
|
258
|
+
fontWeight: 500,
|
|
259
|
+
},
|
|
260
|
+
subtitle1: {
|
|
261
|
+
fontSize: "1.6rem",
|
|
262
|
+
},
|
|
263
|
+
subtitle2: {
|
|
264
|
+
fontSize: "1.4rem",
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}) as unknown) as SaleorTheme;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { darken, fade } from "@material-ui/core/styles";
|
|
2
|
+
import type { Overrides } from "@material-ui/core/styles/overrides";
|
|
3
|
+
|
|
4
|
+
import { SaleorThemeColors } from "../types";
|
|
5
|
+
|
|
6
|
+
export const buttonOverrides = (colors: SaleorThemeColors): Overrides => ({
|
|
7
|
+
MuiButton: {
|
|
8
|
+
contained: {
|
|
9
|
+
"&$disabled": {
|
|
10
|
+
backgroundColor: fade(colors.primary, 0.12),
|
|
11
|
+
color: "#FFFFFF",
|
|
12
|
+
},
|
|
13
|
+
"&:active": {
|
|
14
|
+
boxShadow: "none",
|
|
15
|
+
},
|
|
16
|
+
"&:hover": {
|
|
17
|
+
boxShadow: "none",
|
|
18
|
+
},
|
|
19
|
+
boxShadow: "none",
|
|
20
|
+
},
|
|
21
|
+
containedPrimary: {
|
|
22
|
+
"&:active": {
|
|
23
|
+
backgroundColor: darken(colors.primary, 0.4),
|
|
24
|
+
},
|
|
25
|
+
"&:hover": {
|
|
26
|
+
backgroundColor: darken(colors.primary, 0.1),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
label: {
|
|
30
|
+
fontWeight: 600,
|
|
31
|
+
},
|
|
32
|
+
root: {
|
|
33
|
+
"& svg": {
|
|
34
|
+
marginLeft: 8,
|
|
35
|
+
},
|
|
36
|
+
borderRadius: 4,
|
|
37
|
+
},
|
|
38
|
+
textPrimary: {
|
|
39
|
+
"&:not($disabled) span": {
|
|
40
|
+
color: colors.primary,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
textSizeSmall: {
|
|
44
|
+
fontSize: "1.3rem",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
MuiIconButton: {
|
|
48
|
+
root: {
|
|
49
|
+
"&:hover": {
|
|
50
|
+
backgroundColor: fade(colors.primary, 0.12),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
MuiSwitch: {
|
|
55
|
+
colorPrimary: {
|
|
56
|
+
"&$checked": {
|
|
57
|
+
color: colors.background.paper,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
root: {
|
|
61
|
+
"&$disabled": {
|
|
62
|
+
"&$switchBase": {
|
|
63
|
+
"& + $thumb": {
|
|
64
|
+
backgroundColor: colors.gray.disabled,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
height: 48,
|
|
69
|
+
width: 72,
|
|
70
|
+
},
|
|
71
|
+
switchBase: {
|
|
72
|
+
"&$checked": {
|
|
73
|
+
transform: "translateX(23px)",
|
|
74
|
+
},
|
|
75
|
+
boxShadow: "none",
|
|
76
|
+
left: 1,
|
|
77
|
+
marginLeft: 4,
|
|
78
|
+
top: 5,
|
|
79
|
+
},
|
|
80
|
+
thumb: {
|
|
81
|
+
boxShadow: "none",
|
|
82
|
+
},
|
|
83
|
+
track: {
|
|
84
|
+
"$colorPrimary$checked + &": {
|
|
85
|
+
backgroundColor: colors.primary,
|
|
86
|
+
},
|
|
87
|
+
backgroundColor: colors.gray.default,
|
|
88
|
+
borderRadius: 12,
|
|
89
|
+
height: 24,
|
|
90
|
+
opacity: [["1"], "!important"] as any,
|
|
91
|
+
width: 48,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Overrides } from "@material-ui/core/styles/overrides";
|
|
2
|
+
|
|
3
|
+
import { SaleorThemeColors } from "../types";
|
|
4
|
+
import { buttonOverrides } from "./buttons";
|
|
5
|
+
import { inputOverrides } from "./inputs";
|
|
6
|
+
import { tableOverrides } from "./tables";
|
|
7
|
+
|
|
8
|
+
export const overrides = (
|
|
9
|
+
colors: SaleorThemeColors,
|
|
10
|
+
fontFamily: string
|
|
11
|
+
): Overrides => ({
|
|
12
|
+
...inputOverrides(colors),
|
|
13
|
+
...tableOverrides(colors, fontFamily),
|
|
14
|
+
...buttonOverrides(colors),
|
|
15
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { fade } from "@material-ui/core/styles";
|
|
2
|
+
import type { Overrides } from "@material-ui/core/styles/overrides";
|
|
3
|
+
|
|
4
|
+
import { SaleorThemeColors } from "../types";
|
|
5
|
+
|
|
6
|
+
export const inputOverrides = (colors: SaleorThemeColors): Overrides => ({
|
|
7
|
+
MuiInput: {
|
|
8
|
+
input: {
|
|
9
|
+
"&:-webkit-autofill": {
|
|
10
|
+
WebkitTextFillColor: colors.font.default,
|
|
11
|
+
boxShadow: `inset 0 0 0px 9999px ${colors.autofill}`,
|
|
12
|
+
},
|
|
13
|
+
"&::placeholder": {
|
|
14
|
+
opacity: "1 !important" as any,
|
|
15
|
+
},
|
|
16
|
+
color: colors.font.default,
|
|
17
|
+
},
|
|
18
|
+
underline: {
|
|
19
|
+
"&:after": {
|
|
20
|
+
borderBottomColor: colors.primary,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
MuiInputBase: {
|
|
25
|
+
input: {
|
|
26
|
+
"&$disabled": {
|
|
27
|
+
color: colors.input.disabledText,
|
|
28
|
+
},
|
|
29
|
+
"&::placeholder": {
|
|
30
|
+
color: colors.font.gray,
|
|
31
|
+
opacity: "1 !important" as any,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
MuiInputLabel: {
|
|
36
|
+
formControl: {
|
|
37
|
+
transform: "translate(0, 1.5px) scale(0.75)",
|
|
38
|
+
transformOrigin: "top left" as "top left",
|
|
39
|
+
width: "100%",
|
|
40
|
+
},
|
|
41
|
+
outlined: {
|
|
42
|
+
"&$shrink": {
|
|
43
|
+
transform: "translate(12px, 9px) scale(0.75)",
|
|
44
|
+
},
|
|
45
|
+
transform: "translate(14px, 18px) scale(1)",
|
|
46
|
+
},
|
|
47
|
+
root: {
|
|
48
|
+
"&$disabled": {
|
|
49
|
+
color: `${fade(colors.primary, 0.4)} !important` as any,
|
|
50
|
+
},
|
|
51
|
+
"&$error": {
|
|
52
|
+
"&$focused": {
|
|
53
|
+
color: colors.error,
|
|
54
|
+
},
|
|
55
|
+
color: colors.error,
|
|
56
|
+
},
|
|
57
|
+
"&&$focused": {
|
|
58
|
+
"&:not($error)": {
|
|
59
|
+
color: colors.primary,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
color: fade(colors.input.text, 0.6),
|
|
63
|
+
},
|
|
64
|
+
shrink: {
|
|
65
|
+
// Negates x0.75 scale
|
|
66
|
+
width: "133%",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
MuiOutlinedInput: {
|
|
70
|
+
input: {
|
|
71
|
+
"&:-webkit-autofill": {
|
|
72
|
+
borderRadius: 4,
|
|
73
|
+
boxShadow: "0 0 0px 1000px rgba(19, 190, 187, 0.1) inset",
|
|
74
|
+
},
|
|
75
|
+
color: colors.input.text,
|
|
76
|
+
padding: "23px 12px 10px 12px",
|
|
77
|
+
},
|
|
78
|
+
inputMultiline: {
|
|
79
|
+
left: -2,
|
|
80
|
+
padding: "10px 0",
|
|
81
|
+
position: "relative",
|
|
82
|
+
},
|
|
83
|
+
root: {
|
|
84
|
+
"& fieldset": {
|
|
85
|
+
"&&:not($error)": {
|
|
86
|
+
borderColor: colors.input.border,
|
|
87
|
+
},
|
|
88
|
+
top: 0,
|
|
89
|
+
},
|
|
90
|
+
"& legend": {
|
|
91
|
+
display: "none",
|
|
92
|
+
},
|
|
93
|
+
"&$disabled": {
|
|
94
|
+
"& fieldset": {
|
|
95
|
+
borderColor: [[colors.input.disabled], "!important"] as any,
|
|
96
|
+
},
|
|
97
|
+
"& input": {
|
|
98
|
+
backgroundColor: colors.input.disabledBackground,
|
|
99
|
+
color: colors.input.disabledText,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
"&$error": {
|
|
103
|
+
"&$focused": {
|
|
104
|
+
"& fieldset": {
|
|
105
|
+
borderColor: colors.error,
|
|
106
|
+
},
|
|
107
|
+
"& input": {
|
|
108
|
+
color: colors.error,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
"&:hover": {
|
|
112
|
+
"& fieldset": {
|
|
113
|
+
borderColor: colors.error,
|
|
114
|
+
},
|
|
115
|
+
"& input": {
|
|
116
|
+
color: colors.error,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
"&$focused": {
|
|
121
|
+
"& input": {
|
|
122
|
+
"& fieldset": {
|
|
123
|
+
borderColor: colors.primary,
|
|
124
|
+
},
|
|
125
|
+
"&::placeholder": {
|
|
126
|
+
opacity: [[1], "!important"] as any,
|
|
127
|
+
},
|
|
128
|
+
color: colors.font.default,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
"&:hover": {
|
|
132
|
+
"& input": {
|
|
133
|
+
color: colors.font.default,
|
|
134
|
+
},
|
|
135
|
+
"&&&": {
|
|
136
|
+
"& fieldset": {
|
|
137
|
+
borderColor: colors.primary,
|
|
138
|
+
},
|
|
139
|
+
"&$error fieldset": {
|
|
140
|
+
borderColor: colors.input.error,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
backgroundColor: colors.background.paper,
|
|
145
|
+
borderColor: colors.input.border,
|
|
146
|
+
top: 0,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|