@mitodl/smoot-design 1.2.1 → 2.0.1
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 +4 -0
- package/dist/cjs/components/Button/ActionButton.stories.js +0 -3
- package/dist/cjs/components/Button/Button.d.ts +1 -1
- package/dist/cjs/components/Button/Button.js +0 -33
- package/dist/cjs/components/Button/Button.stories.js +0 -3
- package/dist/cjs/components/ThemeProvider/ThemeProvider.d.ts +1 -3
- package/dist/cjs/components/ThemeProvider/ThemeProvider.js +4 -8
- package/dist/cjs/components/ThemeProvider/breakpoints.js +0 -1
- package/dist/cjs/components/ThemeProvider/typography.js +0 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -3
- package/dist/esm/components/Button/ActionButton.stories.js +0 -3
- package/dist/esm/components/Button/Button.d.ts +1 -1
- package/dist/esm/components/Button/Button.js +0 -33
- package/dist/esm/components/Button/Button.stories.js +0 -3
- package/dist/esm/components/ThemeProvider/ThemeProvider.d.ts +1 -3
- package/dist/esm/components/ThemeProvider/ThemeProvider.js +4 -8
- package/dist/esm/components/ThemeProvider/breakpoints.js +0 -1
- package/dist/esm/components/ThemeProvider/typography.js +0 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type-augmentation/theme.d.ts +1 -1
- package/package.json +18 -15
package/README.md
CHANGED
|
@@ -12,6 +12,10 @@ To trigger a release, run the "Release" github action. Using [semantic-release](
|
|
|
12
12
|
2. Determine whether the version bump should be major, minor, or patch based on commit types. Breaking changes (e.g., `feat!: remove Button variant 'outlined'`) will result in major version bumps.
|
|
13
13
|
3. Publish the package to NPM and the repository's [Github Releases](https://github.com/mitodl/smoot-design/releases).
|
|
14
14
|
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Ensure `peerDependencies` are installed as well. See [`package.json`](./package.json).
|
|
18
|
+
|
|
15
19
|
## Documentation
|
|
16
20
|
|
|
17
21
|
Documentation for `smoot-design` components is available at https://mitodl.github.io/smoot-design.
|
|
@@ -20,9 +20,6 @@ const VARIANTS = (0, story_utils_1.enumValues)({
|
|
|
20
20
|
tertiary: true,
|
|
21
21
|
bordered: true,
|
|
22
22
|
text: true,
|
|
23
|
-
unstable_noBorder: true,
|
|
24
|
-
unstable_inverted: true,
|
|
25
|
-
unstable_success: true,
|
|
26
23
|
});
|
|
27
24
|
const STABLE_VARIANTS = VARIANTS.filter((v) => !v.startsWith("unstable"));
|
|
28
25
|
const SIZES = (0, story_utils_1.enumValues)({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { LinkAdapterPropsOverrides } from "../LinkAdapter/LinkAdapter";
|
|
3
|
-
type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "bordered"
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "bordered";
|
|
4
4
|
type ButtonSize = "small" | "medium" | "large";
|
|
5
5
|
type ButtonEdge = "circular" | "rounded" | "none";
|
|
6
6
|
type ButtonStyleProps = {
|
|
@@ -99,21 +99,6 @@ const buttonStyles = (props) => {
|
|
|
99
99
|
boxShadow: "none",
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
|
-
variant === "unstable_success" && {
|
|
103
|
-
backgroundColor: colors.darkGreen,
|
|
104
|
-
color: colors.white,
|
|
105
|
-
border: "none",
|
|
106
|
-
/* Shadow/04dp */
|
|
107
|
-
boxShadow: "0px 2px 4px 0px rgba(37, 38, 43, 0.10), 0px 3px 8px 0px rgba(37, 38, 43, 0.12)",
|
|
108
|
-
":hover:not(:disabled)": {
|
|
109
|
-
backgroundColor: colors.darkGreen,
|
|
110
|
-
boxShadow: "none",
|
|
111
|
-
},
|
|
112
|
-
":disabled": {
|
|
113
|
-
backgroundColor: colors.silverGray,
|
|
114
|
-
boxShadow: "none",
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
102
|
variant === "secondary" && {
|
|
118
103
|
color: colors.red,
|
|
119
104
|
backgroundColor: "transparent",
|
|
@@ -153,18 +138,6 @@ const buttonStyles = (props) => {
|
|
|
153
138
|
color: colors.silverGrayDark,
|
|
154
139
|
},
|
|
155
140
|
},
|
|
156
|
-
variant === "unstable_noBorder" && {
|
|
157
|
-
backgroundColor: colors.white,
|
|
158
|
-
color: colors.darkGray2,
|
|
159
|
-
border: "none",
|
|
160
|
-
":hover:not(:disabled)": {
|
|
161
|
-
// darkGray1 at 6% alpha
|
|
162
|
-
backgroundColor: "rgba(64, 70, 76, 0.06)",
|
|
163
|
-
},
|
|
164
|
-
":disabled": {
|
|
165
|
-
color: colors.silverGray,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
141
|
variant === "tertiary" && {
|
|
169
142
|
color: colors.darkGray2,
|
|
170
143
|
border: "none",
|
|
@@ -177,12 +150,6 @@ const buttonStyles = (props) => {
|
|
|
177
150
|
color: colors.silverGrayLight,
|
|
178
151
|
},
|
|
179
152
|
},
|
|
180
|
-
variant === "unstable_inverted" && {
|
|
181
|
-
backgroundColor: colors.white,
|
|
182
|
-
color: colors.mitRed,
|
|
183
|
-
borderColor: colors.mitRed,
|
|
184
|
-
borderStyle: "solid",
|
|
185
|
-
},
|
|
186
153
|
// edge
|
|
187
154
|
edge === "rounded" && {
|
|
188
155
|
borderRadius: "4px",
|
|
@@ -20,9 +20,6 @@ const VARIANTS = (0, story_utils_1.enumValues)({
|
|
|
20
20
|
tertiary: true,
|
|
21
21
|
bordered: true,
|
|
22
22
|
text: true,
|
|
23
|
-
unstable_noBorder: true,
|
|
24
|
-
unstable_inverted: true,
|
|
25
|
-
unstable_success: true,
|
|
26
23
|
});
|
|
27
24
|
const STABLE_VARIANTS = VARIANTS.filter((v) => !v.startsWith("unstable"));
|
|
28
25
|
const SIZES = (0, story_utils_1.enumValues)({
|
|
@@ -6,9 +6,7 @@ import type { ThemeOptions, Theme } from "@mui/material/styles";
|
|
|
6
6
|
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
7
7
|
* for more.
|
|
8
8
|
*/
|
|
9
|
-
declare const createTheme: (options?:
|
|
10
|
-
custom: Partial<ThemeOptions["custom"]>;
|
|
11
|
-
}) => Theme;
|
|
9
|
+
declare const createTheme: (options?: ThemeOptions) => Theme;
|
|
12
10
|
type ThemeProviderProps = {
|
|
13
11
|
children?: React.ReactNode;
|
|
14
12
|
theme?: Theme;
|
|
@@ -7,6 +7,7 @@ const typography = require("./typography");
|
|
|
7
7
|
const buttons = require("./buttons");
|
|
8
8
|
const chips = require("./chips");
|
|
9
9
|
const colors_1 = require("./colors");
|
|
10
|
+
const deepmerge_1 = require("@mui/utils/deepmerge");
|
|
10
11
|
const custom = {
|
|
11
12
|
colors: colors_1.colors,
|
|
12
13
|
dimensions: {
|
|
@@ -48,13 +49,6 @@ const defaultThemeOptions = {
|
|
|
48
49
|
components: {
|
|
49
50
|
MuiButtonBase: buttons.buttonBaseComponent,
|
|
50
51
|
MuiTypography: typography.component,
|
|
51
|
-
MuiTabPanel: {
|
|
52
|
-
styleOverrides: {
|
|
53
|
-
root: {
|
|
54
|
-
padding: "0px",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
52
|
MuiMenu: {
|
|
59
53
|
styleOverrides: { paper: { borderRadius: "4px" } },
|
|
60
54
|
},
|
|
@@ -76,7 +70,9 @@ const defaultThemeOptions = {
|
|
|
76
70
|
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
77
71
|
* for more.
|
|
78
72
|
*/
|
|
79
|
-
const createTheme = (options) =>
|
|
73
|
+
const createTheme = (options) => {
|
|
74
|
+
return (0, styles_1.createTheme)((0, deepmerge_1.default)(defaultThemeOptions, options));
|
|
75
|
+
};
|
|
80
76
|
exports.createTheme = createTheme;
|
|
81
77
|
const defaultTheme = createTheme();
|
|
82
78
|
/**
|
|
@@ -14,7 +14,6 @@ const BREAKPOINT_VALUES = {
|
|
|
14
14
|
exports.BREAKPOINT_VALUES = BREAKPOINT_VALUES;
|
|
15
15
|
const { breakpoints } = (0, styles_1.createTheme)({
|
|
16
16
|
breakpoints: BREAKPOINT_VALUES,
|
|
17
|
-
// @ts-expect-error only using breakpoints
|
|
18
17
|
custom: {},
|
|
19
18
|
});
|
|
20
19
|
exports.breakpoints = breakpoints;
|
|
@@ -168,7 +168,6 @@ const component = {
|
|
|
168
168
|
exports.component = component;
|
|
169
169
|
const { typography } = (0, styles_1.createTheme)({
|
|
170
170
|
typography: globalSettings,
|
|
171
|
-
// @ts-expect-error: we only care about typography from this theme
|
|
172
171
|
custom: {},
|
|
173
172
|
});
|
|
174
173
|
exports.typography = typography;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as styled } from "@emotion/styled";
|
|
2
2
|
export { css, Global } from "@emotion/react";
|
|
3
|
-
export { AppRouterCacheProvider as NextJsAppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
|
|
4
3
|
export { ThemeProvider, createTheme, } from "./components/ThemeProvider/ThemeProvider";
|
|
5
4
|
export { Button, ButtonLink } from "./components/Button/Button";
|
|
6
5
|
export type { ButtonProps, ButtonLinkProps } from "./components/Button/Button";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.VisuallyHidden = exports.SrAnnouncer = exports.TextField = exports.Input = exports.ActionButtonLink = exports.ActionButton = exports.ButtonLink = exports.Button = exports.createTheme = exports.ThemeProvider = exports.
|
|
4
|
+
exports.VisuallyHidden = exports.SrAnnouncer = exports.TextField = exports.Input = exports.ActionButtonLink = exports.ActionButton = exports.ButtonLink = exports.Button = exports.createTheme = exports.ThemeProvider = exports.Global = exports.css = exports.styled = void 0;
|
|
5
5
|
var styled_1 = require("@emotion/styled");
|
|
6
6
|
Object.defineProperty(exports, "styled", { enumerable: true, get: function () { return styled_1.default; } });
|
|
7
7
|
var react_1 = require("@emotion/react");
|
|
8
8
|
Object.defineProperty(exports, "css", { enumerable: true, get: function () { return react_1.css; } });
|
|
9
9
|
Object.defineProperty(exports, "Global", { enumerable: true, get: function () { return react_1.Global; } });
|
|
10
|
-
var v15_appRouter_1 = require("@mui/material-nextjs/v15-appRouter");
|
|
11
|
-
Object.defineProperty(exports, "NextJsAppRouterCacheProvider", { enumerable: true, get: function () { return v15_appRouter_1.AppRouterCacheProvider; } });
|
|
12
10
|
var ThemeProvider_1 = require("./components/ThemeProvider/ThemeProvider");
|
|
13
11
|
Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return ThemeProvider_1.ThemeProvider; } });
|
|
14
12
|
Object.defineProperty(exports, "createTheme", { enumerable: true, get: function () { return ThemeProvider_1.createTheme; } });
|
|
@@ -17,9 +17,6 @@ const VARIANTS = enumValues({
|
|
|
17
17
|
tertiary: true,
|
|
18
18
|
bordered: true,
|
|
19
19
|
text: true,
|
|
20
|
-
unstable_noBorder: true,
|
|
21
|
-
unstable_inverted: true,
|
|
22
|
-
unstable_success: true,
|
|
23
20
|
});
|
|
24
21
|
const STABLE_VARIANTS = VARIANTS.filter((v) => !v.startsWith("unstable"));
|
|
25
22
|
const SIZES = enumValues({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { LinkAdapterPropsOverrides } from "../LinkAdapter/LinkAdapter";
|
|
3
|
-
type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "bordered"
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "bordered";
|
|
4
4
|
type ButtonSize = "small" | "medium" | "large";
|
|
5
5
|
type ButtonEdge = "circular" | "rounded" | "none";
|
|
6
6
|
type ButtonStyleProps = {
|
|
@@ -94,21 +94,6 @@ const buttonStyles = (props) => {
|
|
|
94
94
|
boxShadow: "none",
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
|
-
variant === "unstable_success" && {
|
|
98
|
-
backgroundColor: colors.darkGreen,
|
|
99
|
-
color: colors.white,
|
|
100
|
-
border: "none",
|
|
101
|
-
/* Shadow/04dp */
|
|
102
|
-
boxShadow: "0px 2px 4px 0px rgba(37, 38, 43, 0.10), 0px 3px 8px 0px rgba(37, 38, 43, 0.12)",
|
|
103
|
-
":hover:not(:disabled)": {
|
|
104
|
-
backgroundColor: colors.darkGreen,
|
|
105
|
-
boxShadow: "none",
|
|
106
|
-
},
|
|
107
|
-
":disabled": {
|
|
108
|
-
backgroundColor: colors.silverGray,
|
|
109
|
-
boxShadow: "none",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
97
|
variant === "secondary" && {
|
|
113
98
|
color: colors.red,
|
|
114
99
|
backgroundColor: "transparent",
|
|
@@ -148,18 +133,6 @@ const buttonStyles = (props) => {
|
|
|
148
133
|
color: colors.silverGrayDark,
|
|
149
134
|
},
|
|
150
135
|
},
|
|
151
|
-
variant === "unstable_noBorder" && {
|
|
152
|
-
backgroundColor: colors.white,
|
|
153
|
-
color: colors.darkGray2,
|
|
154
|
-
border: "none",
|
|
155
|
-
":hover:not(:disabled)": {
|
|
156
|
-
// darkGray1 at 6% alpha
|
|
157
|
-
backgroundColor: "rgba(64, 70, 76, 0.06)",
|
|
158
|
-
},
|
|
159
|
-
":disabled": {
|
|
160
|
-
color: colors.silverGray,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
136
|
variant === "tertiary" && {
|
|
164
137
|
color: colors.darkGray2,
|
|
165
138
|
border: "none",
|
|
@@ -172,12 +145,6 @@ const buttonStyles = (props) => {
|
|
|
172
145
|
color: colors.silverGrayLight,
|
|
173
146
|
},
|
|
174
147
|
},
|
|
175
|
-
variant === "unstable_inverted" && {
|
|
176
|
-
backgroundColor: colors.white,
|
|
177
|
-
color: colors.mitRed,
|
|
178
|
-
borderColor: colors.mitRed,
|
|
179
|
-
borderStyle: "solid",
|
|
180
|
-
},
|
|
181
148
|
// edge
|
|
182
149
|
edge === "rounded" && {
|
|
183
150
|
borderRadius: "4px",
|
|
@@ -17,9 +17,6 @@ const VARIANTS = enumValues({
|
|
|
17
17
|
tertiary: true,
|
|
18
18
|
bordered: true,
|
|
19
19
|
text: true,
|
|
20
|
-
unstable_noBorder: true,
|
|
21
|
-
unstable_inverted: true,
|
|
22
|
-
unstable_success: true,
|
|
23
20
|
});
|
|
24
21
|
const STABLE_VARIANTS = VARIANTS.filter((v) => !v.startsWith("unstable"));
|
|
25
22
|
const SIZES = enumValues({
|
|
@@ -6,9 +6,7 @@ import type { ThemeOptions, Theme } from "@mui/material/styles";
|
|
|
6
6
|
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
7
7
|
* for more.
|
|
8
8
|
*/
|
|
9
|
-
declare const createTheme: (options?:
|
|
10
|
-
custom: Partial<ThemeOptions["custom"]>;
|
|
11
|
-
}) => Theme;
|
|
9
|
+
declare const createTheme: (options?: ThemeOptions) => Theme;
|
|
12
10
|
type ThemeProviderProps = {
|
|
13
11
|
children?: React.ReactNode;
|
|
14
12
|
theme?: Theme;
|
|
@@ -4,6 +4,7 @@ import * as typography from "./typography";
|
|
|
4
4
|
import * as buttons from "./buttons";
|
|
5
5
|
import * as chips from "./chips";
|
|
6
6
|
import { colors } from "./colors";
|
|
7
|
+
import deepmerge from "@mui/utils/deepmerge";
|
|
7
8
|
const custom = {
|
|
8
9
|
colors,
|
|
9
10
|
dimensions: {
|
|
@@ -45,13 +46,6 @@ const defaultThemeOptions = {
|
|
|
45
46
|
components: {
|
|
46
47
|
MuiButtonBase: buttons.buttonBaseComponent,
|
|
47
48
|
MuiTypography: typography.component,
|
|
48
|
-
MuiTabPanel: {
|
|
49
|
-
styleOverrides: {
|
|
50
|
-
root: {
|
|
51
|
-
padding: "0px",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
49
|
MuiMenu: {
|
|
56
50
|
styleOverrides: { paper: { borderRadius: "4px" } },
|
|
57
51
|
},
|
|
@@ -73,7 +67,9 @@ const defaultThemeOptions = {
|
|
|
73
67
|
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
74
68
|
* for more.
|
|
75
69
|
*/
|
|
76
|
-
const createTheme = (options) =>
|
|
70
|
+
const createTheme = (options) => {
|
|
71
|
+
return muiCreateTheme(deepmerge(defaultThemeOptions, options));
|
|
72
|
+
};
|
|
77
73
|
const defaultTheme = createTheme();
|
|
78
74
|
/**
|
|
79
75
|
*
|
|
@@ -162,7 +162,6 @@ const component = {
|
|
|
162
162
|
};
|
|
163
163
|
const { typography } = createTheme({
|
|
164
164
|
typography: globalSettings,
|
|
165
|
-
// @ts-expect-error: we only care about typography from this theme
|
|
166
165
|
custom: {},
|
|
167
166
|
});
|
|
168
167
|
export { globalSettings, component, pxToRem, typography };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as styled } from "@emotion/styled";
|
|
2
2
|
export { css, Global } from "@emotion/react";
|
|
3
|
-
export { AppRouterCacheProvider as NextJsAppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
|
|
4
3
|
export { ThemeProvider, createTheme, } from "./components/ThemeProvider/ThemeProvider";
|
|
5
4
|
export { Button, ButtonLink } from "./components/Button/Button";
|
|
6
5
|
export type { ButtonProps, ButtonLinkProps } from "./components/Button/Button";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { default as styled } from "@emotion/styled";
|
|
3
3
|
export { css, Global } from "@emotion/react";
|
|
4
|
-
export { AppRouterCacheProvider as NextJsAppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
|
|
5
4
|
export { ThemeProvider, createTheme, } from "./components/ThemeProvider/ThemeProvider";
|
|
6
5
|
export { Button, ButtonLink } from "./components/Button/Button";
|
|
7
6
|
export { ActionButton, ActionButtonLink, } from "./components/Button/ActionButton";
|