@mitodl/smoot-design 0.0.0-7bc0c0f
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/LICENSE +28 -0
- package/README.md +31 -0
- package/dist/bundles/remoteTutorDrawer.es.js +38347 -0
- package/dist/bundles/remoteTutorDrawer.umd.js +207 -0
- package/dist/cjs/ai.d.ts +3 -0
- package/dist/cjs/ai.js +5 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.js +87 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +57 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +276 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +283 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +241 -0
- package/dist/cjs/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/cjs/bundles/remoteTutorDrawer.js +40 -0
- package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
- package/dist/cjs/components/AiChat/AiChat.js +247 -0
- package/dist/cjs/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/cjs/components/AiChat/AiChat.stories.js +243 -0
- package/dist/cjs/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/cjs/components/AiChat/AiChat.test.js +211 -0
- package/dist/cjs/components/AiChat/ChatTitle.d.ts +8 -0
- package/dist/cjs/components/AiChat/ChatTitle.js +43 -0
- package/dist/cjs/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/cjs/components/AiChat/EntryScreen.js +123 -0
- package/dist/cjs/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/cjs/components/AiChat/TimLogo.js +15 -0
- package/dist/cjs/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/cjs/components/AiChat/test-utils/api.js +125 -0
- package/dist/cjs/components/AiChat/types.d.ts +82 -0
- package/dist/cjs/components/AiChat/types.js +3 -0
- package/dist/cjs/components/AiChat/utils.d.ts +9 -0
- package/dist/cjs/components/AiChat/utils.js +41 -0
- package/dist/cjs/components/Alert/Alert.d.ts +15 -0
- package/dist/cjs/components/Alert/Alert.js +62 -0
- package/dist/cjs/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/cjs/components/Alert/Alert.stories.js +53 -0
- package/dist/cjs/components/Button/ActionButton.d.ts +30 -0
- package/dist/cjs/components/Button/ActionButton.js +73 -0
- package/dist/cjs/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/cjs/components/Button/ActionButton.stories.js +113 -0
- package/dist/cjs/components/Button/Button.d.ts +54 -0
- package/dist/cjs/components/Button/Button.js +240 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +17 -0
- package/dist/cjs/components/Button/Button.stories.js +135 -0
- package/dist/cjs/components/Button/Button.test.d.ts +1 -0
- package/dist/cjs/components/Button/Button.test.js +46 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.js +30 -0
- package/dist/cjs/components/Input/Input.d.ts +116 -0
- package/dist/cjs/components/Input/Input.js +237 -0
- package/dist/cjs/components/Input/Input.stories.d.ts +19 -0
- package/dist/cjs/components/Input/Input.stories.js +135 -0
- package/dist/cjs/components/Input/Input.test.d.ts +1 -0
- package/dist/cjs/components/Input/Input.test.js +32 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.js +34 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.js +59 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.js +43 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.js +36 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.js +43 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.js +44 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.js +62 -0
- package/dist/cjs/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/cjs/components/TabButtons/TabButtonList.js +97 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.js +139 -0
- package/dist/cjs/components/TextField/TextField.d.ts +29 -0
- package/dist/cjs/components/TextField/TextField.js +33 -0
- package/dist/cjs/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/cjs/components/TextField/TextField.stories.js +136 -0
- package/dist/cjs/components/TextField/TextField.test.d.ts +1 -0
- package/dist/cjs/components/TextField/TextField.test.js +77 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.js +86 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.js +102 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.js +65 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.js +19 -0
- package/dist/cjs/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/cjs/components/ThemeProvider/buttons.js +20 -0
- package/dist/cjs/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/cjs/components/ThemeProvider/chips.js +154 -0
- package/dist/cjs/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/cjs/components/ThemeProvider/colors.js +35 -0
- package/dist/cjs/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/cjs/components/ThemeProvider/typography.js +173 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js +33 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.js +13 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.js +78 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.js +93 -0
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/jest-setup.d.ts +1 -0
- package/dist/cjs/jest-setup.js +18 -0
- package/dist/cjs/jsdom-extended.d.ts +6 -0
- package/dist/cjs/jsdom-extended.js +14 -0
- package/dist/cjs/story-utils/index.d.ts +6 -0
- package/dist/cjs/story-utils/index.js +17 -0
- package/dist/cjs/utils/composeRefs.d.ts +7 -0
- package/dist/cjs/utils/composeRefs.js +20 -0
- package/dist/cjs/utils/composeRefs.test.d.ts +1 -0
- package/dist/cjs/utils/composeRefs.test.js +19 -0
- package/dist/cjs/utils/useDevCheckStable.d.ts +8 -0
- package/dist/cjs/utils/useDevCheckStable.js +29 -0
- package/dist/cjs/utils/useInterval.d.ts +7 -0
- package/dist/cjs/utils/useInterval.js +25 -0
- package/dist/esm/ai.d.ts +3 -0
- package/dist/esm/ai.js +1 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.js +83 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +57 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +273 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +280 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +239 -0
- package/dist/esm/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/esm/bundles/remoteTutorDrawer.js +37 -0
- package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
- package/dist/esm/components/AiChat/AiChat.js +244 -0
- package/dist/esm/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/esm/components/AiChat/AiChat.stories.js +240 -0
- package/dist/esm/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/esm/components/AiChat/AiChat.test.js +209 -0
- package/dist/esm/components/AiChat/ChatTitle.d.ts +8 -0
- package/dist/esm/components/AiChat/ChatTitle.js +40 -0
- package/dist/esm/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/esm/components/AiChat/EntryScreen.js +120 -0
- package/dist/esm/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/esm/components/AiChat/TimLogo.js +13 -0
- package/dist/esm/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/esm/components/AiChat/test-utils/api.js +122 -0
- package/dist/esm/components/AiChat/types.d.ts +82 -0
- package/dist/esm/components/AiChat/types.js +2 -0
- package/dist/esm/components/AiChat/utils.d.ts +9 -0
- package/dist/esm/components/AiChat/utils.js +38 -0
- package/dist/esm/components/Alert/Alert.d.ts +15 -0
- package/dist/esm/components/Alert/Alert.js +59 -0
- package/dist/esm/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/esm/components/Alert/Alert.stories.js +50 -0
- package/dist/esm/components/Button/ActionButton.d.ts +30 -0
- package/dist/esm/components/Button/ActionButton.js +68 -0
- package/dist/esm/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/esm/components/Button/ActionButton.stories.js +110 -0
- package/dist/esm/components/Button/Button.d.ts +54 -0
- package/dist/esm/components/Button/Button.js +232 -0
- package/dist/esm/components/Button/Button.stories.d.ts +17 -0
- package/dist/esm/components/Button/Button.stories.js +132 -0
- package/dist/esm/components/Button/Button.test.d.ts +1 -0
- package/dist/esm/components/Button/Button.test.js +44 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.js +27 -0
- package/dist/esm/components/Input/Input.d.ts +116 -0
- package/dist/esm/components/Input/Input.js +232 -0
- package/dist/esm/components/Input/Input.stories.d.ts +19 -0
- package/dist/esm/components/Input/Input.stories.js +132 -0
- package/dist/esm/components/Input/Input.test.d.ts +1 -0
- package/dist/esm/components/Input/Input.test.js +30 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.js +31 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.js +56 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.js +40 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.js +33 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.js +40 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.js +41 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.js +60 -0
- package/dist/esm/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/esm/components/TabButtons/TabButtonList.js +92 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.js +136 -0
- package/dist/esm/components/TextField/TextField.d.ts +29 -0
- package/dist/esm/components/TextField/TextField.js +30 -0
- package/dist/esm/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/esm/components/TextField/TextField.stories.js +133 -0
- package/dist/esm/components/TextField/TextField.test.d.ts +1 -0
- package/dist/esm/components/TextField/TextField.test.js +75 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.js +82 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.js +99 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.js +62 -0
- package/dist/esm/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/esm/components/ThemeProvider/breakpoints.js +15 -0
- package/dist/esm/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/esm/components/ThemeProvider/buttons.js +17 -0
- package/dist/esm/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/esm/components/ThemeProvider/chips.js +151 -0
- package/dist/esm/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/esm/components/ThemeProvider/colors.js +32 -0
- package/dist/esm/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/esm/components/ThemeProvider/typography.js +167 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +30 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.js +10 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.js +73 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.js +91 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/jest-setup.d.ts +1 -0
- package/dist/esm/jest-setup.js +16 -0
- package/dist/esm/jsdom-extended.d.ts +6 -0
- package/dist/esm/jsdom-extended.js +12 -0
- package/dist/esm/story-utils/index.d.ts +6 -0
- package/dist/esm/story-utils/index.js +13 -0
- package/dist/esm/utils/composeRefs.d.ts +7 -0
- package/dist/esm/utils/composeRefs.js +17 -0
- package/dist/esm/utils/composeRefs.test.d.ts +1 -0
- package/dist/esm/utils/composeRefs.test.js +17 -0
- package/dist/esm/utils/useDevCheckStable.d.ts +8 -0
- package/dist/esm/utils/useDevCheckStable.js +26 -0
- package/dist/esm/utils/useInterval.d.ts +7 -0
- package/dist/esm/utils/useInterval.js +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/type-augmentation/TypescriptDocs.mdx +17 -0
- package/dist/type-augmentation/imports.d.ts +3 -0
- package/dist/type-augmentation/index.d.ts +3 -0
- package/dist/type-augmentation/theme.d.ts +105 -0
- package/dist/type-augmentation/typography.d.ts +54 -0
- package/package.json +155 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { render, screen } from "@testing-library/react";
|
|
12
|
+
import user from "@testing-library/user-event";
|
|
13
|
+
import { TextField } from "./TextField";
|
|
14
|
+
import { ThemeProvider } from "../ThemeProvider/ThemeProvider";
|
|
15
|
+
import { faker } from "@faker-js/faker/locale/en";
|
|
16
|
+
describe("TextField", () => {
|
|
17
|
+
const setup = (props) => {
|
|
18
|
+
const defaults = {
|
|
19
|
+
name: "test-name",
|
|
20
|
+
value: "test-value",
|
|
21
|
+
label: "test-label",
|
|
22
|
+
};
|
|
23
|
+
const { rerender: _rerender } = render(React.createElement(TextField, Object.assign({}, defaults, props)), {
|
|
24
|
+
wrapper: ThemeProvider,
|
|
25
|
+
});
|
|
26
|
+
const rerender = (newProps) => {
|
|
27
|
+
_rerender(React.createElement(TextField, Object.assign({}, defaults, newProps)));
|
|
28
|
+
};
|
|
29
|
+
return { rerender };
|
|
30
|
+
};
|
|
31
|
+
it("Has a label", () => {
|
|
32
|
+
const label = faker.lorem.words();
|
|
33
|
+
setup({ label });
|
|
34
|
+
const input = screen.getByRole("textbox", { name: label });
|
|
35
|
+
expect(input).toBeInstanceOf(HTMLInputElement);
|
|
36
|
+
});
|
|
37
|
+
it("Marks the input as required if required", () => {
|
|
38
|
+
const label = faker.lorem.words();
|
|
39
|
+
setup({ label, required: true });
|
|
40
|
+
const input = screen.getByRole("textbox", { name: label });
|
|
41
|
+
expect(input).toBeRequired();
|
|
42
|
+
});
|
|
43
|
+
it("Emits the correct value on change", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
const name = faker.lorem.word();
|
|
45
|
+
const value = faker.lorem.words();
|
|
46
|
+
const onChange = jest.fn();
|
|
47
|
+
setup({ name, onChange, value });
|
|
48
|
+
const input = screen.getByRole("textbox");
|
|
49
|
+
yield user.type(input, "x");
|
|
50
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
51
|
+
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({
|
|
52
|
+
target: expect.objectContaining({ name }),
|
|
53
|
+
}));
|
|
54
|
+
}));
|
|
55
|
+
it("Forwards inputProps and InputProps", () => {
|
|
56
|
+
/**
|
|
57
|
+
* NOTE: This behavior is important for integrating easily with MUI's
|
|
58
|
+
* Autocomplete component
|
|
59
|
+
*/
|
|
60
|
+
const inputRef = jest.fn();
|
|
61
|
+
const InputRef = jest.fn();
|
|
62
|
+
setup({
|
|
63
|
+
inputProps: {
|
|
64
|
+
ref: inputRef,
|
|
65
|
+
},
|
|
66
|
+
InputProps: {
|
|
67
|
+
ref: InputRef,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
expect(inputRef).toHaveBeenCalledTimes(1);
|
|
71
|
+
expect(inputRef).toHaveBeenCalledWith(expect.any(HTMLInputElement));
|
|
72
|
+
expect(InputRef).toHaveBeenCalledTimes(1);
|
|
73
|
+
expect(InputRef).toHaveBeenCalledWith(expect.any(HTMLDivElement));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ThemeOptions, Theme } from "@mui/material/styles";
|
|
3
|
+
/**
|
|
4
|
+
* Create a customized Smoot Design theme for use with `ThemeProvider`.
|
|
5
|
+
*
|
|
6
|
+
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
7
|
+
* for more.
|
|
8
|
+
*/
|
|
9
|
+
declare const createTheme: (options?: ThemeOptions) => Theme;
|
|
10
|
+
type ThemeProviderProps = {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param param0
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
20
|
+
export { ThemeProvider, createTheme };
|
|
21
|
+
export type { ThemeProviderProps, Theme };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createTheme as muiCreateTheme, ThemeProvider as MuiThemeProvider, } from "@mui/material/styles";
|
|
3
|
+
import * as typography from "./typography";
|
|
4
|
+
import * as buttons from "./buttons";
|
|
5
|
+
import * as chips from "./chips";
|
|
6
|
+
import { colors } from "./colors";
|
|
7
|
+
import deepmerge from "@mui/utils/deepmerge";
|
|
8
|
+
const custom = {
|
|
9
|
+
colors,
|
|
10
|
+
dimensions: {
|
|
11
|
+
headerHeight: "72px",
|
|
12
|
+
headerHeightSm: "60px",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const BREAKPOINTS = {
|
|
16
|
+
values: {
|
|
17
|
+
xs: 0,
|
|
18
|
+
sm: 600,
|
|
19
|
+
md: 900,
|
|
20
|
+
lg: 1272 + 48,
|
|
21
|
+
xl: 1536,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const defaultThemeOptions = {
|
|
25
|
+
custom: custom,
|
|
26
|
+
palette: {
|
|
27
|
+
primary: {
|
|
28
|
+
main: colors.mitRed,
|
|
29
|
+
light: colors.lightRed,
|
|
30
|
+
active: colors.red,
|
|
31
|
+
contrastText: colors.white,
|
|
32
|
+
},
|
|
33
|
+
secondary: {
|
|
34
|
+
light: colors.darkGray2,
|
|
35
|
+
active: colors.silverGrayDark,
|
|
36
|
+
main: colors.black,
|
|
37
|
+
contrastText: colors.white,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
shape: {
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
},
|
|
43
|
+
spacing: 8,
|
|
44
|
+
typography: typography.globalSettings,
|
|
45
|
+
breakpoints: BREAKPOINTS,
|
|
46
|
+
components: {
|
|
47
|
+
MuiButtonBase: buttons.buttonBaseComponent,
|
|
48
|
+
MuiTypography: typography.component,
|
|
49
|
+
MuiMenu: {
|
|
50
|
+
styleOverrides: { paper: { borderRadius: "4px" } },
|
|
51
|
+
},
|
|
52
|
+
MuiAutocomplete: {
|
|
53
|
+
styleOverrides: {
|
|
54
|
+
paper: { borderRadius: "4px" },
|
|
55
|
+
// Mui puts paddingRight: 2px, marginRight: -2px on the popupIndicator,
|
|
56
|
+
// which causes the browser to show a horizontal scrollbar on overflow
|
|
57
|
+
// containers when a scrollbar isn't really necessary.
|
|
58
|
+
popupIndicator: { paddingRight: 0, marginRight: 0 },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
MuiChip: chips.chipComponent,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Create a customized Smoot Design theme for use with `ThemeProvider`.
|
|
66
|
+
*
|
|
67
|
+
* See [ThemeProvider Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-themeprovider--docs#further-customized-theme-with-createtheme)
|
|
68
|
+
* for more.
|
|
69
|
+
*/
|
|
70
|
+
const createTheme = (options) => {
|
|
71
|
+
return muiCreateTheme(deepmerge(defaultThemeOptions, options));
|
|
72
|
+
};
|
|
73
|
+
const defaultTheme = createTheme();
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param param0
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
const ThemeProvider = ({ children, theme = defaultTheme, }) => {
|
|
80
|
+
return React.createElement(MuiThemeProvider, { theme: theme }, children);
|
|
81
|
+
};
|
|
82
|
+
export { ThemeProvider, createTheme };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ThemeProvider } from "./ThemeProvider";
|
|
3
|
+
declare const meta: Meta<typeof ThemeProvider>;
|
|
4
|
+
type Story = StoryObj<typeof ThemeProvider>;
|
|
5
|
+
/**
|
|
6
|
+
* `ThemeProvider` must wrap all components from `smoot`-design, and allows
|
|
7
|
+
* styling any component via [`styled`](https://emotion.sh/docs/styled).
|
|
8
|
+
*
|
|
9
|
+
* In general, most useful theme properties are exposed on `theme.custom`. (Root
|
|
10
|
+
* `theme` properties are used internally by MUI.) See typescript definitions
|
|
11
|
+
* for more information about `theme.custom`.
|
|
12
|
+
*
|
|
13
|
+
* ## Further Customized Theme with `createTheme`
|
|
14
|
+
* Consuming applications can customize `smoot-design`'s default theme by creating
|
|
15
|
+
* a theme instance with `createTheme` and passing it to `ThemeProvider`:
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const customTheme = createTheme({...})
|
|
19
|
+
*
|
|
20
|
+
* <ThemeProvider theme={customTheme}>
|
|
21
|
+
* {children}
|
|
22
|
+
* </ThemeProvider>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ### Custom Link Adapter
|
|
26
|
+
* One particularly notable property is `theme.custom.LinkAdapter`. Some `smoot-design`
|
|
27
|
+
* components render links. These links are native anchor tags by default. In
|
|
28
|
+
* order to use these components with custom routing libraries (e.g. `react-router`
|
|
29
|
+
* or `next/link`), you can provide a custom link adapter.
|
|
30
|
+
*
|
|
31
|
+
* Components such as `ButtonLink` will:
|
|
32
|
+
* - use `Component` on `ButtonLink` if specified (`<ButtonLink Component={Link} />`)
|
|
33
|
+
* - else, use `theme.custom.LinkAdapter` if specified,
|
|
34
|
+
* - else, use `a` tag.
|
|
35
|
+
*
|
|
36
|
+
* For example, to use `next/link` as the default link implementation:
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* import Link from "next/link"
|
|
40
|
+
* const theme = createTheme({ LinkAdapter: Link })
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* You can use [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
|
|
44
|
+
* to add the custom props to relevant components. For example, to expose
|
|
45
|
+
* `next/link`'s `scroll` prop on `ButtonLink`:
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* // Add scroll prop to all components using LinkAdapter
|
|
49
|
+
* declare module "@mitodl/smoot-design" {
|
|
50
|
+
* interface LinkAdapterPropsOverrides {
|
|
51
|
+
* scroll?: boolean
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* ### ImageAdapter
|
|
57
|
+
* Similarly, `theme.custom.ImageAdapter` can be used to customize the image
|
|
58
|
+
* component used by `smoot-design`. By default, `ImageAdapter` uses a simple `img`
|
|
59
|
+
* tag. Interface `ImageAdapterPropsOverrides` is similarly available for
|
|
60
|
+
* augmentation.
|
|
61
|
+
*/
|
|
62
|
+
export declare const LinkAdapterOverride: Story;
|
|
63
|
+
export default meta;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ThemeProvider, createTheme } from "./ThemeProvider";
|
|
3
|
+
import { ButtonLink } from "../Button/Button";
|
|
4
|
+
const CustomLinkAdapater = React.forwardRef((props, ref) => (
|
|
5
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
6
|
+
React.createElement("a", Object.assign({ ref: ref, onClick: (e) => {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
alert(`Custom link to: ${e.currentTarget.href}. (Preventing Navigation.)`);
|
|
9
|
+
}, "data-custom": "theme-default" }, props))));
|
|
10
|
+
CustomLinkAdapater.displayName = "CustomLinkAdapter";
|
|
11
|
+
const customTheme = createTheme({
|
|
12
|
+
custom: {
|
|
13
|
+
LinkAdapter: CustomLinkAdapater,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const meta = {
|
|
17
|
+
title: "smoot-design/ThemeProvider",
|
|
18
|
+
component: ThemeProvider,
|
|
19
|
+
argTypes: {
|
|
20
|
+
theme: {
|
|
21
|
+
options: ["Default", "Custom Link Adapter"],
|
|
22
|
+
mapping: {
|
|
23
|
+
Default: undefined,
|
|
24
|
+
"Custom Link Adapter": customTheme,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
children: {
|
|
28
|
+
table: { disable: true },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
id: "smoot-design/ThemeProvider",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* `ThemeProvider` must wrap all components from `smoot`-design, and allows
|
|
35
|
+
* styling any component via [`styled`](https://emotion.sh/docs/styled).
|
|
36
|
+
*
|
|
37
|
+
* In general, most useful theme properties are exposed on `theme.custom`. (Root
|
|
38
|
+
* `theme` properties are used internally by MUI.) See typescript definitions
|
|
39
|
+
* for more information about `theme.custom`.
|
|
40
|
+
*
|
|
41
|
+
* ## Further Customized Theme with `createTheme`
|
|
42
|
+
* Consuming applications can customize `smoot-design`'s default theme by creating
|
|
43
|
+
* a theme instance with `createTheme` and passing it to `ThemeProvider`:
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* const customTheme = createTheme({...})
|
|
47
|
+
*
|
|
48
|
+
* <ThemeProvider theme={customTheme}>
|
|
49
|
+
* {children}
|
|
50
|
+
* </ThemeProvider>
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ### Custom Link Adapter
|
|
54
|
+
* One particularly notable property is `theme.custom.LinkAdapter`. Some `smoot-design`
|
|
55
|
+
* components render links. These links are native anchor tags by default. In
|
|
56
|
+
* order to use these components with custom routing libraries (e.g. `react-router`
|
|
57
|
+
* or `next/link`), you can provide a custom link adapter.
|
|
58
|
+
*
|
|
59
|
+
* Components such as `ButtonLink` will:
|
|
60
|
+
* - use `Component` on `ButtonLink` if specified (`<ButtonLink Component={Link} />`)
|
|
61
|
+
* - else, use `theme.custom.LinkAdapter` if specified,
|
|
62
|
+
* - else, use `a` tag.
|
|
63
|
+
*
|
|
64
|
+
* For example, to use `next/link` as the default link implementation:
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* import Link from "next/link"
|
|
68
|
+
* const theme = createTheme({ LinkAdapter: Link })
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* You can use [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)
|
|
72
|
+
* to add the custom props to relevant components. For example, to expose
|
|
73
|
+
* `next/link`'s `scroll` prop on `ButtonLink`:
|
|
74
|
+
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* // Add scroll prop to all components using LinkAdapter
|
|
77
|
+
* declare module "@mitodl/smoot-design" {
|
|
78
|
+
* interface LinkAdapterPropsOverrides {
|
|
79
|
+
* scroll?: boolean
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* ### ImageAdapter
|
|
85
|
+
* Similarly, `theme.custom.ImageAdapter` can be used to customize the image
|
|
86
|
+
* component used by `smoot-design`. By default, `ImageAdapter` uses a simple `img`
|
|
87
|
+
* tag. Interface `ImageAdapterPropsOverrides` is similarly available for
|
|
88
|
+
* augmentation.
|
|
89
|
+
*/
|
|
90
|
+
export const LinkAdapterOverride = {
|
|
91
|
+
args: {
|
|
92
|
+
theme: customTheme,
|
|
93
|
+
},
|
|
94
|
+
render: (args) => {
|
|
95
|
+
return (React.createElement(ThemeProvider, { theme: args.theme },
|
|
96
|
+
React.createElement(ButtonLink, { href: "https://mit.edu" }, args.theme ? "Custom theme in use" : "Default theme in use")));
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
export default meta;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Typography from "@mui/material/Typography";
|
|
3
|
+
/**
|
|
4
|
+
* Typography styles can be controlled via the `theme.typography` object when
|
|
5
|
+
* using the `styled` helper or via the `<Tyopgraphy variant="..." />` component.
|
|
6
|
+
*
|
|
7
|
+
* For the `Typography` component, see [MUI's documentation](https://mui.com/material-ui/react-typography/).
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const MyHeading = styled(({ theme }) => ({
|
|
11
|
+
* ...theme.typography.h2,
|
|
12
|
+
* [theme.breakpoints.down("sm")]: {
|
|
13
|
+
* ...theme.typography.h3,
|
|
14
|
+
* },
|
|
15
|
+
* }))
|
|
16
|
+
*
|
|
17
|
+
* // or:
|
|
18
|
+
* <Typography component="h1" typography={
|
|
19
|
+
* {
|
|
20
|
+
* xs: "h3", // above xs
|
|
21
|
+
* sm: "h2" // above sm
|
|
22
|
+
* }
|
|
23
|
+
* }>
|
|
24
|
+
* Hello, world!
|
|
25
|
+
* </Typography>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
declare const meta: Meta<typeof Typography>;
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof Typography>;
|
|
32
|
+
/**
|
|
33
|
+
* Typography variants are shown below.
|
|
34
|
+
*
|
|
35
|
+
* **Note:** The typography variant is not related to the HTML element used. A
|
|
36
|
+
* `variant="h1"` component does not automatically render an `<h1>` element.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export declare const Variants: Story;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Stack from "@mui/material/Stack";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
|
+
/**
|
|
5
|
+
* Typography styles can be controlled via the `theme.typography` object when
|
|
6
|
+
* using the `styled` helper or via the `<Tyopgraphy variant="..." />` component.
|
|
7
|
+
*
|
|
8
|
+
* For the `Typography` component, see [MUI's documentation](https://mui.com/material-ui/react-typography/).
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const MyHeading = styled(({ theme }) => ({
|
|
12
|
+
* ...theme.typography.h2,
|
|
13
|
+
* [theme.breakpoints.down("sm")]: {
|
|
14
|
+
* ...theme.typography.h3,
|
|
15
|
+
* },
|
|
16
|
+
* }))
|
|
17
|
+
*
|
|
18
|
+
* // or:
|
|
19
|
+
* <Typography component="h1" typography={
|
|
20
|
+
* {
|
|
21
|
+
* xs: "h3", // above xs
|
|
22
|
+
* sm: "h2" // above sm
|
|
23
|
+
* }
|
|
24
|
+
* }>
|
|
25
|
+
* Hello, world!
|
|
26
|
+
* </Typography>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
const meta = {
|
|
31
|
+
title: "smoot-design/Typography",
|
|
32
|
+
component: Typography,
|
|
33
|
+
};
|
|
34
|
+
export default meta;
|
|
35
|
+
const text = "The quick brown fox jumps over the lazy dog. ".repeat(10);
|
|
36
|
+
const INSTANCES = [
|
|
37
|
+
{ variant: "h1", children: "Heading level 1" },
|
|
38
|
+
{ variant: "h2", children: "Heading level 2" },
|
|
39
|
+
{ variant: "h3", children: "Heading level 3" },
|
|
40
|
+
{ variant: "h4", children: "Heading level 4" },
|
|
41
|
+
{ variant: "h5", children: "Heading level 5" },
|
|
42
|
+
{ variant: "subtitle1", children: "Subtitle level 1" },
|
|
43
|
+
{ variant: "subtitle2", children: "Subtitle level 2" },
|
|
44
|
+
{ variant: "subtitle3", children: "Subtitle level 3" },
|
|
45
|
+
{ variant: "subtitle4", children: "Subtitle level 4" },
|
|
46
|
+
{ variant: "body1", children: `body level 1... ${text}` },
|
|
47
|
+
{ variant: "body2", children: `body level 2... ${text}` },
|
|
48
|
+
{ variant: "body3", children: `body level 3... ${text}` },
|
|
49
|
+
{ variant: "body4", children: `body level 4... ${text}` },
|
|
50
|
+
];
|
|
51
|
+
/**
|
|
52
|
+
* Typography variants are shown below.
|
|
53
|
+
*
|
|
54
|
+
* **Note:** The typography variant is not related to the HTML element used. A
|
|
55
|
+
* `variant="h1"` component does not automatically render an `<h1>` element.
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export const Variants = {
|
|
59
|
+
render: () => {
|
|
60
|
+
return (React.createElement(Stack, { gap: "1rem" }, INSTANCES.map((props) => (React.createElement(Typography, Object.assign({ key: props.variant }, props))))));
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createTheme } from "@mui/material/styles";
|
|
2
|
+
const BREAKPOINT_VALUES = {
|
|
3
|
+
values: {
|
|
4
|
+
xs: 0,
|
|
5
|
+
sm: 600,
|
|
6
|
+
md: 900,
|
|
7
|
+
lg: 1280,
|
|
8
|
+
xl: 1536,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const { breakpoints } = createTheme({
|
|
12
|
+
breakpoints: BREAKPOINT_VALUES,
|
|
13
|
+
custom: {},
|
|
14
|
+
});
|
|
15
|
+
export { BREAKPOINT_VALUES, breakpoints };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThemeOptions } from "@mui/material/styles";
|
|
2
|
+
/**
|
|
3
|
+
* We don't use MUI's button directly, but ButtonBase does get used internally
|
|
4
|
+
* by some MUI components, so we override a few styles.
|
|
5
|
+
*/
|
|
6
|
+
declare const buttonBaseComponent: NonNullable<ThemeOptions["components"]>["MuiButtonBase"];
|
|
7
|
+
export { buttonBaseComponent };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We don't use MUI's button directly, but ButtonBase does get used internally
|
|
3
|
+
* by some MUI components, so we override a few styles.
|
|
4
|
+
*/
|
|
5
|
+
const buttonBaseComponent = {
|
|
6
|
+
defaultProps: {
|
|
7
|
+
disableRipple: true,
|
|
8
|
+
},
|
|
9
|
+
styleOverrides: {
|
|
10
|
+
root: {
|
|
11
|
+
":focus-visible": {
|
|
12
|
+
outline: "revert",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export { buttonBaseComponent };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { colors } from "./colors";
|
|
3
|
+
import { RiCloseLine } from "@remixicon/react";
|
|
4
|
+
const chipComponent = {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
size: "medium",
|
|
7
|
+
color: "default",
|
|
8
|
+
variant: "outlined",
|
|
9
|
+
deleteIcon: React.createElement(RiCloseLine, { "aria-hidden": "true" }),
|
|
10
|
+
},
|
|
11
|
+
styleOverrides: {
|
|
12
|
+
root: {
|
|
13
|
+
borderRadius: "100vh",
|
|
14
|
+
borderWidth: "1px",
|
|
15
|
+
},
|
|
16
|
+
deleteIcon: {
|
|
17
|
+
"&:hover": {
|
|
18
|
+
color: "inherit",
|
|
19
|
+
},
|
|
20
|
+
"&.MuiChip-deleteIconLarge": {
|
|
21
|
+
width: "16px",
|
|
22
|
+
height: "16px",
|
|
23
|
+
},
|
|
24
|
+
"&.MuiChip-deleteIconMedium": {
|
|
25
|
+
width: "14px",
|
|
26
|
+
height: "14px",
|
|
27
|
+
},
|
|
28
|
+
margin: "0 -2px 0 8px",
|
|
29
|
+
color: "inherit",
|
|
30
|
+
},
|
|
31
|
+
icon: {
|
|
32
|
+
margin: "0 8px 0 -2px",
|
|
33
|
+
color: "inherit",
|
|
34
|
+
"&.MuiChip-iconLarge": {
|
|
35
|
+
width: "16px",
|
|
36
|
+
height: "16px",
|
|
37
|
+
},
|
|
38
|
+
"&.MuiChip-iconMedium": {
|
|
39
|
+
width: "14px",
|
|
40
|
+
height: "14px",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
variants: [
|
|
45
|
+
{
|
|
46
|
+
props: { size: "medium" },
|
|
47
|
+
style: ({ theme }) => (Object.assign(Object.assign({}, theme.typography.body3), { boxSizing: "border-box", height: "24px", paddingRight: "12px", paddingLeft: "12px", ".MuiChip-label": {
|
|
48
|
+
paddingLeft: "0px",
|
|
49
|
+
paddingRight: "0px",
|
|
50
|
+
} })),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
props: { size: "large" },
|
|
54
|
+
style: ({ theme }) => (Object.assign(Object.assign({}, theme.typography.body2), { height: "32px", paddingLeft: "16px", paddingRight: "16px", ".MuiChip-label": {
|
|
55
|
+
paddingLeft: "0px",
|
|
56
|
+
paddingRight: "0px",
|
|
57
|
+
} })),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
props: { variant: "outlined" },
|
|
61
|
+
style: {
|
|
62
|
+
borderColor: colors.silverGrayLight,
|
|
63
|
+
color: colors.darkGray1,
|
|
64
|
+
"&.Mui-focusVisible": {
|
|
65
|
+
backgroundColor: "transparent",
|
|
66
|
+
},
|
|
67
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
68
|
+
color: colors.darkGray1,
|
|
69
|
+
borderColor: colors.silverGrayDark,
|
|
70
|
+
backgroundColor: "transparent", // mui has a default background color for hover
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
props: { variant: "outlinedWhite" },
|
|
76
|
+
style: {
|
|
77
|
+
backgroundColor: "white",
|
|
78
|
+
border: "1px solid",
|
|
79
|
+
borderColor: colors.silverGrayLight,
|
|
80
|
+
color: colors.darkGray1,
|
|
81
|
+
"&.Mui-focusVisible": {
|
|
82
|
+
backgroundColor: "white",
|
|
83
|
+
},
|
|
84
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
85
|
+
color: colors.darkGray1,
|
|
86
|
+
borderColor: colors.silverGrayDark,
|
|
87
|
+
backgroundColor: "white", // mui has a default background color hover
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
props: { variant: "gray" },
|
|
93
|
+
style: {
|
|
94
|
+
backgroundColor: colors.lightGray2,
|
|
95
|
+
border: "none",
|
|
96
|
+
color: colors.darkGray2,
|
|
97
|
+
"&.Mui-focusVisible": {
|
|
98
|
+
backgroundColor: colors.lightGray2,
|
|
99
|
+
},
|
|
100
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
101
|
+
color: colors.darkGray1,
|
|
102
|
+
backgroundColor: colors.silverGrayLight,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
props: { variant: "dark" },
|
|
108
|
+
style: {
|
|
109
|
+
backgroundColor: colors.silverGrayDark,
|
|
110
|
+
border: "none",
|
|
111
|
+
color: colors.white,
|
|
112
|
+
"&.Mui-focusVisible": {
|
|
113
|
+
backgroundColor: colors.silverGrayDark,
|
|
114
|
+
},
|
|
115
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
116
|
+
backgroundColor: colors.darkGray1,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
props: { variant: "darker" },
|
|
122
|
+
style: {
|
|
123
|
+
backgroundColor: colors.darkGray2,
|
|
124
|
+
border: `1px solid ${colors.darkGray1}`,
|
|
125
|
+
color: colors.white,
|
|
126
|
+
"&.Mui-focusVisible": {
|
|
127
|
+
backgroundColor: colors.darkGray2,
|
|
128
|
+
},
|
|
129
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
130
|
+
backgroundColor: colors.black,
|
|
131
|
+
border: `1px solid ${colors.silverGray}`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
props: { variant: "filled" },
|
|
137
|
+
style: {
|
|
138
|
+
backgroundColor: colors.mitRed,
|
|
139
|
+
border: "none",
|
|
140
|
+
color: colors.white,
|
|
141
|
+
"&.Mui-focusVisible": {
|
|
142
|
+
backgroundColor: colors.mitRed,
|
|
143
|
+
},
|
|
144
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
145
|
+
backgroundColor: colors.red,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
export { chipComponent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const colors: {
|
|
2
|
+
mitRed: string;
|
|
3
|
+
brightRed: string;
|
|
4
|
+
black: string;
|
|
5
|
+
white: string;
|
|
6
|
+
darkGray2: string;
|
|
7
|
+
darkGray1: string;
|
|
8
|
+
silverGrayDark: string;
|
|
9
|
+
silverGray: string;
|
|
10
|
+
silverGrayLight: string;
|
|
11
|
+
lightGray2: string;
|
|
12
|
+
lightGray1: string;
|
|
13
|
+
navGray: string;
|
|
14
|
+
darkPink: string;
|
|
15
|
+
pink: string;
|
|
16
|
+
lightPink: string;
|
|
17
|
+
darkPurple: string;
|
|
18
|
+
purple: string;
|
|
19
|
+
lightPurple: string;
|
|
20
|
+
darkBlue: string;
|
|
21
|
+
blue: string;
|
|
22
|
+
lightBlue: string;
|
|
23
|
+
darkGreen: string;
|
|
24
|
+
green: string;
|
|
25
|
+
lightGreen: string;
|
|
26
|
+
darkRed: string;
|
|
27
|
+
red: string;
|
|
28
|
+
lightRed: string;
|
|
29
|
+
orange: string;
|
|
30
|
+
yellow: string;
|
|
31
|
+
};
|
|
32
|
+
export { colors };
|