@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,9 @@
|
|
|
1
|
+
import { UseChatOptions } from "ai/react";
|
|
2
|
+
import type { RequestOpts } from "./types";
|
|
3
|
+
declare const useAiChat: (requestOpts: RequestOpts, opts: UseChatOptions) => import("@ai-sdk/react").UseChatHelpers & {
|
|
4
|
+
addToolResult: ({ toolCallId, result, }: {
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
result: any;
|
|
7
|
+
}) => void;
|
|
8
|
+
};
|
|
9
|
+
export { useAiChat };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useAiChat = void 0;
|
|
13
|
+
const react_1 = require("ai/react");
|
|
14
|
+
const react_2 = require("react");
|
|
15
|
+
const identity = (x) => x;
|
|
16
|
+
const getFetcher = (requestOpts) => (url, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.body) !== "string") {
|
|
19
|
+
console.error("Unexpected body type.");
|
|
20
|
+
return window.fetch(url, opts);
|
|
21
|
+
}
|
|
22
|
+
const messages = JSON.parse(opts === null || opts === void 0 ? void 0 : opts.body).messages;
|
|
23
|
+
const transformBody = (_a = requestOpts.transformBody) !== null && _a !== void 0 ? _a : identity;
|
|
24
|
+
const options = Object.assign(Object.assign(Object.assign(Object.assign({}, opts), { body: JSON.stringify(transformBody(messages)) }), requestOpts.fetchOpts), { headers: Object.assign(Object.assign(Object.assign({}, opts === null || opts === void 0 ? void 0 : opts.headers), { "Content-Type": "application/json" }), (_b = requestOpts.fetchOpts) === null || _b === void 0 ? void 0 : _b.headers) });
|
|
25
|
+
return fetch(url, options);
|
|
26
|
+
});
|
|
27
|
+
const useAiChat = (requestOpts, opts) => {
|
|
28
|
+
const fetcher = (0, react_2.useMemo)(() => getFetcher(requestOpts), [requestOpts]);
|
|
29
|
+
return (0, react_1.useChat)(Object.assign({ api: requestOpts.apiUrl, streamProtocol: "text", fetch: fetcher, onFinish: (message) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!requestOpts.onFinish)
|
|
32
|
+
return;
|
|
33
|
+
if (message.role === "assistant" || message.role === "user") {
|
|
34
|
+
(_a = requestOpts.onFinish) === null || _a === void 0 ? void 0 : _a.call(requestOpts, message);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.info("Unexpected message role.", message);
|
|
38
|
+
}
|
|
39
|
+
} }, opts));
|
|
40
|
+
};
|
|
41
|
+
exports.useAiChat = useAiChat;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { AlertColor } from "@mui/material/Alert";
|
|
3
|
+
type AlertProps = {
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
closable?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
severity?: AlertColor;
|
|
8
|
+
/**
|
|
9
|
+
* Alert Content
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
declare const Alert: React.FC<AlertProps>;
|
|
14
|
+
export { Alert };
|
|
15
|
+
export type { AlertProps };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Alert = void 0;
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const styled_1 = require("@emotion/styled");
|
|
7
|
+
const Alert_1 = require("@mui/material/Alert");
|
|
8
|
+
const getColor = (theme, severity) => {
|
|
9
|
+
return {
|
|
10
|
+
info: theme.custom.colors.blue,
|
|
11
|
+
success: theme.custom.colors.green,
|
|
12
|
+
warning: theme.custom.colors.orange,
|
|
13
|
+
error: theme.custom.colors.lightRed,
|
|
14
|
+
}[severity];
|
|
15
|
+
};
|
|
16
|
+
const AlertStyled = (0, styled_1.default)(Alert_1.default)(({ theme, severity }) => ({
|
|
17
|
+
padding: "11px 16px",
|
|
18
|
+
borderRadius: 4,
|
|
19
|
+
borderWidth: 2,
|
|
20
|
+
borderStyle: "solid",
|
|
21
|
+
borderColor: getColor(theme, severity),
|
|
22
|
+
background: "#FFF",
|
|
23
|
+
".MuiAlert-message": Object.assign(Object.assign({}, theme.typography.body2), { color: theme.custom.colors.darkGray2, alignSelf: "center" }),
|
|
24
|
+
"> div": {
|
|
25
|
+
paddingTop: 0,
|
|
26
|
+
paddingBottom: 0,
|
|
27
|
+
},
|
|
28
|
+
".MuiAlert-icon": {
|
|
29
|
+
marginRight: 8,
|
|
30
|
+
svg: {
|
|
31
|
+
width: 16,
|
|
32
|
+
fill: getColor(theme, severity),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
button: {
|
|
36
|
+
padding: 0,
|
|
37
|
+
":hover": {
|
|
38
|
+
margin: 0,
|
|
39
|
+
background: "none",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
const Hidden = styled_1.default.span({ display: "none" });
|
|
44
|
+
const Alert = ({ visible = true, severity = "info", closable, children, className, }) => {
|
|
45
|
+
const [_visible, setVisible] = React.useState(visible);
|
|
46
|
+
const id = React.useId();
|
|
47
|
+
const onCloseClick = () => {
|
|
48
|
+
setVisible(false);
|
|
49
|
+
};
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
setVisible(visible);
|
|
52
|
+
}, [visible]);
|
|
53
|
+
if (!_visible) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (React.createElement(AlertStyled, { severity: severity, onClose: closable ? onCloseClick : undefined, role: "alert", "aria-describedby": id, className: className },
|
|
57
|
+
children,
|
|
58
|
+
React.createElement(Hidden, { id: id },
|
|
59
|
+
severity,
|
|
60
|
+
" message")));
|
|
61
|
+
};
|
|
62
|
+
exports.Alert = Alert;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Alert } from "./Alert";
|
|
3
|
+
declare const meta: Meta<typeof Alert>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Alert>;
|
|
6
|
+
export declare const Basic: Story;
|
|
7
|
+
export declare const Closable: Story;
|
|
8
|
+
export declare const Variants: Story;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Variants = exports.Closable = exports.Basic = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const Alert_1 = require("./Alert");
|
|
6
|
+
const Stack_1 = require("@mui/material/Stack");
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "smoot-design/Alert",
|
|
9
|
+
component: Alert_1.Alert,
|
|
10
|
+
};
|
|
11
|
+
exports.default = meta;
|
|
12
|
+
exports.Basic = {
|
|
13
|
+
args: {
|
|
14
|
+
severity: "info",
|
|
15
|
+
},
|
|
16
|
+
render: (args) => (React.createElement(Alert_1.Alert, Object.assign({}, args),
|
|
17
|
+
"Alert with severity \"",
|
|
18
|
+
args.severity,
|
|
19
|
+
"\"")),
|
|
20
|
+
};
|
|
21
|
+
exports.Closable = {
|
|
22
|
+
args: {
|
|
23
|
+
severity: "warning",
|
|
24
|
+
closable: true,
|
|
25
|
+
},
|
|
26
|
+
render: (args) => (React.createElement(Alert_1.Alert, Object.assign({}, args),
|
|
27
|
+
"Closable alert with severity \"",
|
|
28
|
+
args.severity,
|
|
29
|
+
"\"")),
|
|
30
|
+
};
|
|
31
|
+
exports.Variants = {
|
|
32
|
+
argTypes: {
|
|
33
|
+
severity: {
|
|
34
|
+
table: {
|
|
35
|
+
disable: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
closable: {
|
|
39
|
+
table: {
|
|
40
|
+
disable: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
render: (args) => (React.createElement(Stack_1.default, { direction: "column", gap: 2, sx: { my: 2 } },
|
|
45
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { severity: "info" }), "Alert with severity \"info\""),
|
|
46
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { closable: true, severity: "info" }), "Closable alert with severity \"info\""),
|
|
47
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { severity: "success" }), "Alert with severity \"success\""),
|
|
48
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { closable: true, severity: "success" }), "Closable alert with severity \"success\""),
|
|
49
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { severity: "warning" }), "Alert with severity \"warning\""),
|
|
50
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { closable: true, severity: "warning" }), "Closable alert with severity \"warning\""),
|
|
51
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { severity: "error" }), "Alert with severity \"error\""),
|
|
52
|
+
React.createElement(Alert_1.Alert, Object.assign({}, args, { closable: true, severity: "error" }), "Closable alert with severity \"error\""))),
|
|
53
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DEFAULT_PROPS } from "./Button";
|
|
3
|
+
import type { ButtonStyleProps } from "./Button";
|
|
4
|
+
import type { LinkAdapterPropsOverrides } from "../LinkAdapter/LinkAdapter";
|
|
5
|
+
type ActionButtonStyleProps = Omit<ButtonStyleProps, "startIcon" | "endIcon">;
|
|
6
|
+
type ActionButtonProps = ActionButtonStyleProps & React.ComponentProps<"button">;
|
|
7
|
+
/**
|
|
8
|
+
* A button that should contain a remixicon icon and nothing else.
|
|
9
|
+
* See [ActionButton docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs).
|
|
10
|
+
*
|
|
11
|
+
* See also:
|
|
12
|
+
* - [ActionButtonLink](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs#links)
|
|
13
|
+
* - [Button](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-button--docs) for text buttons
|
|
14
|
+
*/
|
|
15
|
+
declare const ActionButton: import("@emotion/styled").StyledComponent<Omit<ActionButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement> & {
|
|
16
|
+
theme?: import("@emotion/react").Theme;
|
|
17
|
+
}, {}, {}>;
|
|
18
|
+
type ActionButtonLinkProps = ActionButtonStyleProps & React.ComponentProps<"a"> & {
|
|
19
|
+
Component?: React.ElementType;
|
|
20
|
+
} & LinkAdapterPropsOverrides;
|
|
21
|
+
/**
|
|
22
|
+
* See [ActionButtonLink docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs#links)
|
|
23
|
+
*/
|
|
24
|
+
declare const ActionButtonLink: import("@emotion/styled").StyledComponent<Omit<ActionButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement> & {
|
|
25
|
+
theme?: import("@emotion/react").Theme;
|
|
26
|
+
} & ActionButtonStyleProps & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
27
|
+
Component?: React.ElementType;
|
|
28
|
+
} & LinkAdapterPropsOverrides, {}, {}>;
|
|
29
|
+
export { ActionButton, ActionButtonLink, DEFAULT_PROPS };
|
|
30
|
+
export type { ActionButtonProps, ActionButtonLinkProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.DEFAULT_PROPS = exports.ActionButtonLink = exports.ActionButton = void 0;
|
|
15
|
+
const React = require("react");
|
|
16
|
+
const styled_1 = require("@emotion/styled");
|
|
17
|
+
const typography_1 = require("../ThemeProvider/typography");
|
|
18
|
+
const Button_1 = require("./Button");
|
|
19
|
+
Object.defineProperty(exports, "DEFAULT_PROPS", { enumerable: true, get: function () { return Button_1.DEFAULT_PROPS; } });
|
|
20
|
+
const actionStyles = (size) => {
|
|
21
|
+
return {
|
|
22
|
+
minWidth: "auto",
|
|
23
|
+
padding: 0,
|
|
24
|
+
height: {
|
|
25
|
+
small: "32px",
|
|
26
|
+
medium: "40px",
|
|
27
|
+
large: "48px",
|
|
28
|
+
}[size],
|
|
29
|
+
width: {
|
|
30
|
+
small: "32px",
|
|
31
|
+
medium: "40px",
|
|
32
|
+
large: "48px",
|
|
33
|
+
}[size],
|
|
34
|
+
"& svg, & .MuiSvgIcon-root": {
|
|
35
|
+
width: "1em",
|
|
36
|
+
height: "1em",
|
|
37
|
+
fontSize: (0, typography_1.pxToRem)({
|
|
38
|
+
small: 20,
|
|
39
|
+
medium: 24,
|
|
40
|
+
large: 32,
|
|
41
|
+
}[size]),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A button that should contain a remixicon icon and nothing else.
|
|
47
|
+
* See [ActionButton docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs).
|
|
48
|
+
*
|
|
49
|
+
* See also:
|
|
50
|
+
* - [ActionButtonLink](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs#links)
|
|
51
|
+
* - [Button](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-button--docs) for text buttons
|
|
52
|
+
*/
|
|
53
|
+
const ActionButton = (0, styled_1.default)(React.forwardRef(function Root(props, ref) {
|
|
54
|
+
return React.createElement(Button_1.ButtonRoot, Object.assign({ ref: ref, type: "button" }, props));
|
|
55
|
+
}))(({ size = Button_1.DEFAULT_PROPS.size, responsive, theme }) => {
|
|
56
|
+
return [
|
|
57
|
+
actionStyles(size),
|
|
58
|
+
responsive && {
|
|
59
|
+
[theme.breakpoints.down("sm")]: actionStyles(Button_1.RESPONSIVE_SIZES[size]),
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
});
|
|
63
|
+
exports.ActionButton = ActionButton;
|
|
64
|
+
ActionButton.displayName = "ActionButton";
|
|
65
|
+
/**
|
|
66
|
+
* See [ActionButtonLink docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs#links)
|
|
67
|
+
*/
|
|
68
|
+
const ActionButtonLink = ActionButton.withComponent((_a) => {
|
|
69
|
+
var { Component } = _a, props = __rest(_a, ["Component"]);
|
|
70
|
+
return React.createElement(Button_1.ButtonLinkRoot, Object.assign({ Component: Component }, props));
|
|
71
|
+
});
|
|
72
|
+
exports.ActionButtonLink = ActionButtonLink;
|
|
73
|
+
ActionButtonLink.displayName = "ActionButtonLink";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ActionButton } from "./ActionButton";
|
|
3
|
+
declare const meta: Meta<typeof ActionButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ActionButton>;
|
|
6
|
+
export declare const VariantsAndEdge: Story;
|
|
7
|
+
/**
|
|
8
|
+
* `ActionButtonLink` is styled as a `ActionButton` that renders an anchor tag.
|
|
9
|
+
*
|
|
10
|
+
* To use a custom link component (E.g. `Link` from `react-router` or `next/link`),
|
|
11
|
+
* pass it as the `Component` prop. Alternatively, customize the project-wide
|
|
12
|
+
* default link adapter via [Theme's LinkAdapter](../?path=/docs/smoot-design-themeprovider--docs)
|
|
13
|
+
*/
|
|
14
|
+
export declare const Links: Story;
|
|
15
|
+
export declare const Showcase: Story;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Showcase = exports.Links = exports.VariantsAndEdge = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const ActionButton_1 = require("./ActionButton");
|
|
6
|
+
const Grid2_1 = require("@mui/material/Grid2");
|
|
7
|
+
const Stack_1 = require("@mui/material/Stack");
|
|
8
|
+
const react_1 = require("@remixicon/react");
|
|
9
|
+
const test_1 = require("@storybook/test");
|
|
10
|
+
const story_utils_1 = require("../../story-utils");
|
|
11
|
+
const ICONS = {
|
|
12
|
+
None: undefined,
|
|
13
|
+
ArrowBackIcon: React.createElement(react_1.RiArrowLeftLine, null),
|
|
14
|
+
DeleteIcon: React.createElement(react_1.RiDeleteBinLine, null),
|
|
15
|
+
TestTubeIcon: React.createElement(react_1.RiTestTubeLine, null),
|
|
16
|
+
};
|
|
17
|
+
const VARIANTS = (0, story_utils_1.enumValues)({
|
|
18
|
+
primary: true,
|
|
19
|
+
secondary: true,
|
|
20
|
+
tertiary: true,
|
|
21
|
+
bordered: true,
|
|
22
|
+
text: true,
|
|
23
|
+
});
|
|
24
|
+
const STABLE_VARIANTS = VARIANTS.filter((v) => !v.startsWith("unstable"));
|
|
25
|
+
const SIZES = (0, story_utils_1.enumValues)({
|
|
26
|
+
small: true,
|
|
27
|
+
medium: true,
|
|
28
|
+
large: true,
|
|
29
|
+
});
|
|
30
|
+
const EDGES = (0, story_utils_1.enumValues)({
|
|
31
|
+
circular: true,
|
|
32
|
+
rounded: true,
|
|
33
|
+
none: true,
|
|
34
|
+
});
|
|
35
|
+
const meta = {
|
|
36
|
+
title: "smoot-design/ActionButton",
|
|
37
|
+
component: ActionButton_1.ActionButton,
|
|
38
|
+
argTypes: {
|
|
39
|
+
variant: {
|
|
40
|
+
control: { type: "select" },
|
|
41
|
+
table: {
|
|
42
|
+
defaultValue: { summary: ActionButton_1.DEFAULT_PROPS.variant },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
control: { type: "select" },
|
|
47
|
+
table: {
|
|
48
|
+
defaultValue: { summary: ActionButton_1.DEFAULT_PROPS.size },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
edge: {
|
|
52
|
+
control: { type: "select" },
|
|
53
|
+
table: {
|
|
54
|
+
defaultValue: { summary: ActionButton_1.DEFAULT_PROPS.edge },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
args: {
|
|
59
|
+
onClick: (0, test_1.fn)(),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
exports.default = meta;
|
|
63
|
+
exports.VariantsAndEdge = {
|
|
64
|
+
render: (args) => (React.createElement(React.Fragment, null,
|
|
65
|
+
React.createElement(Stack_1.default, { direction: "row", gap: 2, sx: { my: 2 } },
|
|
66
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "none", variant: "primary" }), ICONS.DeleteIcon),
|
|
67
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "none", variant: "secondary" }), ICONS.DeleteIcon),
|
|
68
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "none", variant: "tertiary" }), ICONS.DeleteIcon),
|
|
69
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "none", variant: "bordered" }), ICONS.DeleteIcon),
|
|
70
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "none", variant: "text" }), ICONS.DeleteIcon)),
|
|
71
|
+
React.createElement(Stack_1.default, { direction: "row", gap: 2, sx: { my: 2 } },
|
|
72
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "rounded", variant: "primary" }), ICONS.DeleteIcon),
|
|
73
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "rounded", variant: "secondary" }), ICONS.DeleteIcon),
|
|
74
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "rounded", variant: "tertiary" }), ICONS.DeleteIcon),
|
|
75
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "rounded", variant: "bordered" }), ICONS.DeleteIcon),
|
|
76
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "rounded", variant: "text" }), ICONS.DeleteIcon)),
|
|
77
|
+
React.createElement(Stack_1.default, { direction: "row", gap: 2, sx: { my: 2 } },
|
|
78
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "circular", variant: "primary" }), ICONS.DeleteIcon),
|
|
79
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "circular", variant: "secondary" }), ICONS.DeleteIcon),
|
|
80
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "circular", variant: "tertiary" }), ICONS.DeleteIcon),
|
|
81
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "circular", variant: "bordered" }), ICONS.DeleteIcon),
|
|
82
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({}, args, { edge: "circular", variant: "text" }), ICONS.DeleteIcon)))),
|
|
83
|
+
tags: ["main"],
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `ActionButtonLink` is styled as a `ActionButton` that renders an anchor tag.
|
|
87
|
+
*
|
|
88
|
+
* To use a custom link component (E.g. `Link` from `react-router` or `next/link`),
|
|
89
|
+
* pass it as the `Component` prop. Alternatively, customize the project-wide
|
|
90
|
+
* default link adapter via [Theme's LinkAdapter](../?path=/docs/smoot-design-themeprovider--docs)
|
|
91
|
+
*/
|
|
92
|
+
exports.Links = {
|
|
93
|
+
render: () => (React.createElement(Stack_1.default, { direction: "row", gap: 2, sx: { my: 2 } },
|
|
94
|
+
React.createElement(ActionButton_1.ActionButtonLink, { href: "#fake", variant: "primary" }, ICONS.DeleteIcon),
|
|
95
|
+
React.createElement(ActionButton_1.ActionButtonLink, { href: "#fake", variant: "secondary" }, ICONS.DeleteIcon),
|
|
96
|
+
React.createElement(ActionButton_1.ActionButtonLink, { href: "#fake", variant: "tertiary" }, ICONS.DeleteIcon),
|
|
97
|
+
React.createElement(ActionButton_1.ActionButtonLink, { href: "#fake", variant: "bordered" }, ICONS.DeleteIcon),
|
|
98
|
+
React.createElement(ActionButton_1.ActionButtonLink, { href: "#fake", variant: "text" }, ICONS.DeleteIcon))),
|
|
99
|
+
};
|
|
100
|
+
exports.Showcase = {
|
|
101
|
+
render: (args) => (React.createElement(Grid2_1.default, { container: true, sx: { maxWidth: "750px" }, rowGap: 2 }, STABLE_VARIANTS.flatMap((variant) => EDGES.flatMap((edge) => (React.createElement(React.Fragment, { key: `${variant}-${edge}` },
|
|
102
|
+
React.createElement(Grid2_1.default, { size: { xs: 12, sm: 3 }, alignItems: "center" },
|
|
103
|
+
React.createElement("code", null,
|
|
104
|
+
"variant=",
|
|
105
|
+
variant,
|
|
106
|
+
React.createElement("br", null),
|
|
107
|
+
"edge=",
|
|
108
|
+
edge)),
|
|
109
|
+
SIZES.flatMap((size) => Object.entries(ICONS)
|
|
110
|
+
.filter(([_key, icon]) => icon)
|
|
111
|
+
.map(([iconKey, icon]) => (React.createElement(Grid2_1.default, { size: { xs: 4, sm: 1 }, key: `${size}-${iconKey}` },
|
|
112
|
+
React.createElement(ActionButton_1.ActionButton, Object.assign({ variant: variant, edge: edge, size: size }, args), icon))))))))))),
|
|
113
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { LinkAdapterPropsOverrides } from "../LinkAdapter/LinkAdapter";
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "bordered";
|
|
4
|
+
type ButtonSize = "small" | "medium" | "large";
|
|
5
|
+
type ButtonEdge = "circular" | "rounded" | "none";
|
|
6
|
+
type ButtonStyleProps = {
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
edge?: ButtonEdge;
|
|
10
|
+
/**
|
|
11
|
+
* Display an icon before the button text
|
|
12
|
+
*/
|
|
13
|
+
startIcon?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Display an icon after the button text.
|
|
16
|
+
*/
|
|
17
|
+
endIcon?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* If true (default: `false`), the button will become one size smaller at the
|
|
20
|
+
* `sm` breakpoint.
|
|
21
|
+
* - large -> medium
|
|
22
|
+
* - medium -> small
|
|
23
|
+
* - small -> small
|
|
24
|
+
*/
|
|
25
|
+
responsive?: boolean;
|
|
26
|
+
color?: "secondary";
|
|
27
|
+
};
|
|
28
|
+
declare const DEFAULT_PROPS: Required<Omit<ButtonStyleProps, "startIcon" | "endIcon" | "color">>;
|
|
29
|
+
declare const RESPONSIVE_SIZES: Record<ButtonSize, ButtonSize>;
|
|
30
|
+
declare const ButtonRoot: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
} & ButtonStyleProps, React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
34
|
+
declare const ButtonLinkRoot: import("@emotion/styled").StyledComponent<Omit<import("../LinkAdapter/LinkAdapter").LinkAdapterProps, "ref"> & React.RefAttributes<HTMLAnchorElement> & {
|
|
35
|
+
theme?: import("@emotion/react").Theme;
|
|
36
|
+
} & ButtonStyleProps, {}, {}>;
|
|
37
|
+
type ButtonProps = ButtonStyleProps & React.ComponentProps<"button">;
|
|
38
|
+
/**
|
|
39
|
+
* Our standard button component. See [Button Docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-button--docs).
|
|
40
|
+
*
|
|
41
|
+
* See also:
|
|
42
|
+
* - [ButtonLink](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-button--docs#links)
|
|
43
|
+
* - [ActionButton](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-actionbutton--docs) for icon-only uses
|
|
44
|
+
*/
|
|
45
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
type ButtonLinkProps = ButtonStyleProps & React.ComponentProps<"a"> & {
|
|
47
|
+
Component?: React.ElementType;
|
|
48
|
+
} & LinkAdapterPropsOverrides;
|
|
49
|
+
/**
|
|
50
|
+
* See [ButtonLink docs](https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-button--docs#links)
|
|
51
|
+
*/
|
|
52
|
+
declare const ButtonLink: React.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
53
|
+
export { Button, ButtonLink, ButtonRoot, DEFAULT_PROPS, ButtonLinkRoot, RESPONSIVE_SIZES, };
|
|
54
|
+
export type { ButtonProps, ButtonLinkProps, ButtonStyleProps, ButtonSize };
|