@mitodl/smoot-design 1.2.0 → 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 +1 -4
- 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 +1 -4
- package/dist/cjs/components/Input/Input.stories.js +1 -1
- package/dist/cjs/components/ScrollSnap/ScrollSnap.js +5 -3
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.js +1 -1
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.js +1 -1
- package/dist/cjs/components/TextField/TextField.stories.js +1 -1
- 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/components/internal/FormHelpers/FormHelpers.test.js +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -3
- package/dist/esm/components/Button/ActionButton.stories.js +1 -4
- 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 +1 -4
- package/dist/esm/components/Input/Input.stories.js +1 -1
- package/dist/esm/components/ScrollSnap/ScrollSnap.js +5 -3
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.js +1 -1
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.js +1 -1
- package/dist/esm/components/TextField/TextField.stories.js +1 -1
- 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/components/internal/FormHelpers/FormHelpers.test.js +1 -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 +25 -22
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.
|
|
@@ -7,7 +7,7 @@ const Grid2_1 = require("@mui/material/Grid2");
|
|
|
7
7
|
const Stack_1 = require("@mui/material/Stack");
|
|
8
8
|
const react_1 = require("@remixicon/react");
|
|
9
9
|
const test_1 = require("@storybook/test");
|
|
10
|
-
const story_utils_1 = require("
|
|
10
|
+
const story_utils_1 = require("../../story-utils");
|
|
11
11
|
const ICONS = {
|
|
12
12
|
None: undefined,
|
|
13
13
|
ArrowBackIcon: React.createElement(react_1.RiArrowLeftLine, null),
|
|
@@ -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",
|
|
@@ -7,7 +7,7 @@ const Grid2_1 = require("@mui/material/Grid2");
|
|
|
7
7
|
const Stack_1 = require("@mui/material/Stack");
|
|
8
8
|
const react_1 = require("@remixicon/react");
|
|
9
9
|
const test_1 = require("@storybook/test");
|
|
10
|
-
const story_utils_1 = require("
|
|
10
|
+
const story_utils_1 = require("../../story-utils");
|
|
11
11
|
const ICONS = {
|
|
12
12
|
None: undefined,
|
|
13
13
|
ArrowBackIcon: React.createElement(react_1.RiArrowLeftLine, null),
|
|
@@ -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)({
|
|
@@ -7,7 +7,7 @@ const Stack_1 = require("@mui/material/Stack");
|
|
|
7
7
|
const Grid2_1 = require("@mui/material/Grid2");
|
|
8
8
|
const react_1 = require("@remixicon/react");
|
|
9
9
|
const test_1 = require("@storybook/test");
|
|
10
|
-
const story_utils_1 = require("
|
|
10
|
+
const story_utils_1 = require("../../story-utils");
|
|
11
11
|
const Typography_1 = require("@mui/material/Typography");
|
|
12
12
|
const SIZES = (0, story_utils_1.enumValues)({
|
|
13
13
|
small: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ScrollSnap = void 0;
|
|
4
|
-
const composeRefs_1 = require("
|
|
4
|
+
const composeRefs_1 = require("../../utils/composeRefs");
|
|
5
5
|
const styled_1 = require("@emotion/styled");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
/**
|
|
@@ -36,14 +36,16 @@ const ScrollSnap = React.forwardRef(function ScrollSnap({ children, threshold =
|
|
|
36
36
|
* 3. Then scroll to bottom (if needed)
|
|
37
37
|
*
|
|
38
38
|
* In this way, we can measure the scroll position before the new content is set.
|
|
39
|
+
*
|
|
40
|
+
* In React 19, this started requiring useLayoutEffect.
|
|
39
41
|
*/
|
|
40
|
-
React.
|
|
42
|
+
React.useLayoutEffect(() => {
|
|
41
43
|
if (!el.current)
|
|
42
44
|
return;
|
|
43
45
|
wasAtBottom.current = distanceFromBottom(el.current) < threshold;
|
|
44
46
|
setContent(children);
|
|
45
47
|
}, [children, threshold]);
|
|
46
|
-
React.
|
|
48
|
+
React.useLayoutEffect(() => {
|
|
47
49
|
if (!el.current)
|
|
48
50
|
return;
|
|
49
51
|
const atBottom = distanceFromBottom(el.current) < threshold;
|
|
@@ -5,7 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const ScrollSnap_1 = require("./ScrollSnap");
|
|
6
6
|
const styled_1 = require("@emotion/styled");
|
|
7
7
|
const en_1 = require("@faker-js/faker/locale/en");
|
|
8
|
-
const useInterval_1 = require("
|
|
8
|
+
const useInterval_1 = require("../../utils/useInterval");
|
|
9
9
|
const Slider_1 = require("@mui/material/Slider");
|
|
10
10
|
const Stack_1 = require("@mui/material/Stack");
|
|
11
11
|
const Typography_1 = require("@mui/material/Typography");
|
|
@@ -4,7 +4,7 @@ exports.SrAnnouncer = void 0;
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const VisuallyHidden_1 = require("../VisuallyHidden/VisuallyHidden");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const useDevCheckStable_1 = require("
|
|
7
|
+
const useDevCheckStable_1 = require("../../utils/useDevCheckStable");
|
|
8
8
|
const DEFAULT_PROPS = {
|
|
9
9
|
loadingMessages: [
|
|
10
10
|
{ delay: 1500, text: "Loading" },
|
|
@@ -8,7 +8,7 @@ const Stack_1 = require("@mui/material/Stack");
|
|
|
8
8
|
const Grid_1 = require("@mui/material/Grid");
|
|
9
9
|
const react_1 = require("@remixicon/react");
|
|
10
10
|
const test_1 = require("@storybook/test");
|
|
11
|
-
const story_utils_1 = require("
|
|
11
|
+
const story_utils_1 = require("../../story-utils");
|
|
12
12
|
const SIZES = (0, story_utils_1.enumValues)({
|
|
13
13
|
small: true,
|
|
14
14
|
medium: true,
|
|
@@ -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;
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
const React = require("react");
|
|
15
15
|
const react_1 = require("@testing-library/react");
|
|
16
16
|
const FormHelpers_1 = require("./FormHelpers");
|
|
17
|
-
const ThemeProvider_1 = require("
|
|
17
|
+
const ThemeProvider_1 = require("../../../components/ThemeProvider/ThemeProvider");
|
|
18
18
|
const en_1 = require("@faker-js/faker/locale/en");
|
|
19
19
|
const assertDescription = ({ text, total, exists, }) => {
|
|
20
20
|
var _a;
|
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; } });
|
|
@@ -4,7 +4,7 @@ import Grid from "@mui/material/Grid2";
|
|
|
4
4
|
import Stack from "@mui/material/Stack";
|
|
5
5
|
import { RiArrowLeftLine, RiDeleteBinLine, RiTestTubeLine, } from "@remixicon/react";
|
|
6
6
|
import { fn } from "@storybook/test";
|
|
7
|
-
import { enumValues } from "
|
|
7
|
+
import { enumValues } from "../../story-utils";
|
|
8
8
|
const ICONS = {
|
|
9
9
|
None: undefined,
|
|
10
10
|
ArrowBackIcon: React.createElement(RiArrowLeftLine, null),
|
|
@@ -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",
|
|
@@ -4,7 +4,7 @@ import Grid from "@mui/material/Grid2";
|
|
|
4
4
|
import Stack from "@mui/material/Stack";
|
|
5
5
|
import { RiArrowLeftLine, RiDeleteBinLine, RiTestTubeLine, RiMailLine, } from "@remixicon/react";
|
|
6
6
|
import { fn } from "@storybook/test";
|
|
7
|
-
import { enumValues } from "
|
|
7
|
+
import { enumValues } from "../../story-utils";
|
|
8
8
|
const ICONS = {
|
|
9
9
|
None: undefined,
|
|
10
10
|
ArrowBackIcon: React.createElement(RiArrowLeftLine, null),
|
|
@@ -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({
|
|
@@ -4,7 +4,7 @@ import Stack from "@mui/material/Stack";
|
|
|
4
4
|
import Grid from "@mui/material/Grid2";
|
|
5
5
|
import { RiCalendarLine, RiCloseLine, RiSearchLine } from "@remixicon/react";
|
|
6
6
|
import { fn } from "@storybook/test";
|
|
7
|
-
import { enumValues } from "
|
|
7
|
+
import { enumValues } from "../../story-utils";
|
|
8
8
|
import Typography from "@mui/material/Typography";
|
|
9
9
|
const SIZES = enumValues({
|
|
10
10
|
small: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { composeRefs } from "
|
|
1
|
+
import { composeRefs } from "../../utils/composeRefs";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
/**
|
|
@@ -33,14 +33,16 @@ const ScrollSnap = React.forwardRef(function ScrollSnap({ children, threshold =
|
|
|
33
33
|
* 3. Then scroll to bottom (if needed)
|
|
34
34
|
*
|
|
35
35
|
* In this way, we can measure the scroll position before the new content is set.
|
|
36
|
+
*
|
|
37
|
+
* In React 19, this started requiring useLayoutEffect.
|
|
36
38
|
*/
|
|
37
|
-
React.
|
|
39
|
+
React.useLayoutEffect(() => {
|
|
38
40
|
if (!el.current)
|
|
39
41
|
return;
|
|
40
42
|
wasAtBottom.current = distanceFromBottom(el.current) < threshold;
|
|
41
43
|
setContent(children);
|
|
42
44
|
}, [children, threshold]);
|
|
43
|
-
React.
|
|
45
|
+
React.useLayoutEffect(() => {
|
|
44
46
|
if (!el.current)
|
|
45
47
|
return;
|
|
46
48
|
const atBottom = distanceFromBottom(el.current) < threshold;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { ScrollSnap } from "./ScrollSnap";
|
|
3
3
|
import styled from "@emotion/styled";
|
|
4
4
|
import { faker } from "@faker-js/faker/locale/en";
|
|
5
|
-
import { useInterval } from "
|
|
5
|
+
import { useInterval } from "../../utils/useInterval";
|
|
6
6
|
import Slider from "@mui/material/Slider";
|
|
7
7
|
import Stack from "@mui/material/Stack";
|
|
8
8
|
import Typography from "@mui/material/Typography";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import { useDevCheckStable } from "
|
|
4
|
+
import { useDevCheckStable } from "../../utils/useDevCheckStable";
|
|
5
5
|
const DEFAULT_PROPS = {
|
|
6
6
|
loadingMessages: [
|
|
7
7
|
{ delay: 1500, text: "Loading" },
|
|
@@ -5,7 +5,7 @@ import Stack from "@mui/material/Stack";
|
|
|
5
5
|
import Grid from "@mui/material/Grid";
|
|
6
6
|
import { RiSearchLine, RiCalendarLine, RiCloseLine } from "@remixicon/react";
|
|
7
7
|
import { fn } from "@storybook/test";
|
|
8
|
-
import { enumValues } from "
|
|
8
|
+
import { enumValues } from "../../story-utils";
|
|
9
9
|
const SIZES = enumValues({
|
|
10
10
|
small: true,
|
|
11
11
|
medium: true,
|
|
@@ -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 };
|
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import * as React from "react";
|
|
13
13
|
import { render, screen } from "@testing-library/react";
|
|
14
14
|
import { FormFieldWrapper } from "./FormHelpers";
|
|
15
|
-
import { ThemeProvider } from "
|
|
15
|
+
import { ThemeProvider } from "../../../components/ThemeProvider/ThemeProvider";
|
|
16
16
|
import { faker } from "@faker-js/faker/locale/en";
|
|
17
17
|
const assertDescription = ({ text, total, exists, }) => {
|
|
18
18
|
var _a;
|
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";
|