@saleor/macaw-ui 0.7.2 → 0.7.3
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/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/types/Accordion/Accordion.d.ts +1 -1
- package/dist/types/theme/Baseline.d.ts +5 -1
- package/dist/types/theme/ThemeProvider.d.ts +4 -0
- package/package.json +1 -1
- package/src/Accordion/Accordion.stories.tsx +1 -1
- package/src/Accordion/Accordion.tsx +3 -3
- package/src/Accordion/styles.ts +5 -5
- package/src/PageTabs/styles.ts +1 -0
- package/src/theme/Baseline.tsx +61 -54
- package/src/theme/ThemeProvider.tsx +6 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as MuiAccordion } from "@material-ui/core/Accordion";
|
|
2
|
-
import { AccordionSummaryProps } from "@material-ui/core/AccordionSummary";
|
|
3
2
|
import { default as MuiAAccordionDetails } from "@material-ui/core/AccordionDetails";
|
|
3
|
+
import { AccordionSummaryProps } from "@material-ui/core/AccordionSummary";
|
|
4
4
|
import React from "react";
|
|
5
5
|
export declare const Accordion: typeof MuiAccordion;
|
|
6
6
|
export declare const AccordionSummary: React.FC<AccordionSummaryProps<"div", {}>>;
|
|
@@ -17,5 +17,9 @@ export interface ThemeProviderProps {
|
|
|
17
17
|
* Enables server side rendering.
|
|
18
18
|
*/
|
|
19
19
|
ssr?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Enables importing font style from external source.
|
|
22
|
+
*/
|
|
23
|
+
importFontStyle?: boolean;
|
|
20
24
|
}
|
|
21
25
|
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Meta, Story } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
|
|
3
4
|
import { GuideDecorator } from "../utils/Decorator";
|
|
4
5
|
import { Accordion, AccordionSummary } from "./Accordion";
|
|
5
6
|
|
|
6
|
-
|
|
7
7
|
export const WithContent: Story = () => (
|
|
8
8
|
<Accordion>
|
|
9
9
|
<AccordionSummary>item 1</AccordionSummary>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { default as MuiAccordion } from "@material-ui/core/Accordion";
|
|
2
|
+
import { default as MuiAAccordionDetails } from "@material-ui/core/AccordionDetails";
|
|
2
3
|
import {
|
|
3
|
-
default as MuiAccordionSummary,
|
|
4
4
|
AccordionSummaryProps,
|
|
5
|
+
default as MuiAccordionSummary,
|
|
5
6
|
} from "@material-ui/core/AccordionSummary";
|
|
6
|
-
import
|
|
7
|
+
import React from "react";
|
|
7
8
|
|
|
8
9
|
import { ChevronIcon } from "../icons";
|
|
9
|
-
import React from "react";
|
|
10
10
|
import useStyles from "./styles";
|
|
11
11
|
|
|
12
12
|
const _AccordionSmmary: React.FC<AccordionSummaryProps> = React.forwardRef(
|
package/src/Accordion/styles.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { makeStyles } from "../theme";
|
|
|
3
3
|
const useStyles = makeStyles(
|
|
4
4
|
(theme) => {
|
|
5
5
|
const isDarkMode = theme.palette.type === "dark";
|
|
6
|
-
const colors = theme.palette.saleor
|
|
7
|
-
const borderColor = isDarkMode ? colors.main[4] : colors.main[6]
|
|
8
|
-
|
|
6
|
+
const colors = theme.palette.saleor;
|
|
7
|
+
const borderColor = isDarkMode ? colors.main[4] : colors.main[6];
|
|
8
|
+
|
|
9
9
|
return {
|
|
10
10
|
expandIcon: {
|
|
11
11
|
"&:hover, &.Mui-focusVisible, &$hover, &$active": {
|
|
@@ -18,8 +18,8 @@ const useStyles = makeStyles(
|
|
|
18
18
|
border: `1px solid ${borderColor}`,
|
|
19
19
|
padding: 3,
|
|
20
20
|
transition: "200ms",
|
|
21
|
-
}
|
|
22
|
-
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: "Accordion",
|
package/src/PageTabs/styles.ts
CHANGED
package/src/theme/Baseline.tsx
CHANGED
|
@@ -4,71 +4,78 @@ import React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { makeStyles } from "./styles";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
type BaselineProps = {
|
|
8
|
+
importFontStyle: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const useStyles = (props: BaselineProps) =>
|
|
12
|
+
makeStyles(
|
|
13
|
+
(theme) => ({
|
|
14
|
+
"@global": {
|
|
15
|
+
...(props.importFontStyle && {
|
|
16
|
+
"@import": "url('https://rsms.me/inter/inter.css')",
|
|
17
|
+
}),
|
|
18
|
+
// Putting them here, because MUI doesn't let putting own keys in
|
|
19
|
+
// `overrides` objects
|
|
20
|
+
"@keyframes hoverControlStart": {
|
|
21
|
+
from: {
|
|
22
|
+
transform: "scale(1)",
|
|
23
|
+
},
|
|
24
|
+
to: {
|
|
25
|
+
transform: "scale(1.4)",
|
|
26
|
+
},
|
|
16
27
|
},
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
"@keyframes hoverControl": {
|
|
29
|
+
from: {
|
|
30
|
+
transform: "scale(1.4)",
|
|
31
|
+
},
|
|
32
|
+
to: {
|
|
33
|
+
transform: "scale(1.6)",
|
|
34
|
+
},
|
|
19
35
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
|
|
37
|
+
"@keyframes hoverSwitchStart": {
|
|
38
|
+
from: {
|
|
39
|
+
boxShadow: `0 0 0 0 ${theme.palette.saleor.active[5]}`,
|
|
40
|
+
},
|
|
41
|
+
to: {
|
|
42
|
+
boxShadow: `0 0 0 3px ${theme.palette.saleor.active[5]}`,
|
|
43
|
+
},
|
|
24
44
|
},
|
|
25
|
-
|
|
26
|
-
|
|
45
|
+
"@keyframes hoverSwitch": {
|
|
46
|
+
from: {
|
|
47
|
+
boxShadow: `0 0 0 3px ${theme.palette.saleor.active[5]}`,
|
|
48
|
+
},
|
|
49
|
+
to: {
|
|
50
|
+
boxShadow: `0 0 0 5px ${theme.palette.saleor.active[5]}`,
|
|
51
|
+
},
|
|
27
52
|
},
|
|
28
|
-
},
|
|
29
53
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
":root": {
|
|
55
|
+
"--background-paper": theme.palette.background.paper,
|
|
56
|
+
"--background-default": theme.palette.background.default,
|
|
57
|
+
colorScheme: theme.palette.type,
|
|
33
58
|
},
|
|
34
|
-
|
|
35
|
-
|
|
59
|
+
|
|
60
|
+
// For some reason @import clause must be put on top
|
|
61
|
+
// eslint-disable-next-line sort-keys
|
|
62
|
+
"::selection": {
|
|
63
|
+
background: alpha(theme.palette.primary.main, 0.2),
|
|
36
64
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
from: {
|
|
40
|
-
boxShadow: `0 0 0 3px ${theme.palette.saleor.active[5]}`,
|
|
65
|
+
html: {
|
|
66
|
+
fontSize: "58.4%",
|
|
41
67
|
},
|
|
42
|
-
|
|
43
|
-
|
|
68
|
+
a: {
|
|
69
|
+
color: "inherit",
|
|
70
|
+
textDecoration: "none",
|
|
44
71
|
},
|
|
45
72
|
},
|
|
73
|
+
}),
|
|
74
|
+
{ name: "Baseline" }
|
|
75
|
+
);
|
|
46
76
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"--background-default": theme.palette.background.default,
|
|
50
|
-
colorScheme: theme.palette.type
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// For some reason @import clause must be put on top
|
|
54
|
-
// eslint-disable-next-line sort-keys
|
|
55
|
-
"::selection": {
|
|
56
|
-
background: alpha(theme.palette.primary.main, 0.2),
|
|
57
|
-
},
|
|
58
|
-
html: {
|
|
59
|
-
fontSize: "58.4%",
|
|
60
|
-
},
|
|
61
|
-
a: {
|
|
62
|
-
color: "inherit",
|
|
63
|
-
textDecoration: "none",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
}),
|
|
67
|
-
{ name: "Baseline" }
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
export const Baseline: React.FC = () => {
|
|
71
|
-
useStyles();
|
|
77
|
+
export const Baseline: React.FC<BaselineProps> = (props) => {
|
|
78
|
+
useStyles(props);
|
|
72
79
|
|
|
73
80
|
return <CssBaseline />;
|
|
74
81
|
};
|
|
@@ -34,6 +34,10 @@ export interface ThemeProviderProps {
|
|
|
34
34
|
* Enables server side rendering.
|
|
35
35
|
*/
|
|
36
36
|
ssr?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Enables importing font style from external source.
|
|
39
|
+
*/
|
|
40
|
+
importFontStyle?: boolean;
|
|
37
41
|
}
|
|
38
42
|
export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
39
43
|
children,
|
|
@@ -41,6 +45,7 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
|
41
45
|
palettes = {},
|
|
42
46
|
overrides = {},
|
|
43
47
|
ssr = false,
|
|
48
|
+
importFontStyle = true,
|
|
44
49
|
}) => {
|
|
45
50
|
const { value: themeTypeName, setValue: setThemeType } = useLocalStorage(
|
|
46
51
|
localStorageKeys.theme,
|
|
@@ -79,7 +84,7 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
|
79
84
|
<MuiThemeProvider theme={theme}>
|
|
80
85
|
<ActionBarProvider>
|
|
81
86
|
<BacklinkProvider>
|
|
82
|
-
<Baseline />
|
|
87
|
+
<Baseline importFontStyle={importFontStyle} />
|
|
83
88
|
{children}
|
|
84
89
|
</BacklinkProvider>
|
|
85
90
|
</ActionBarProvider>
|