@mitodl/smoot-design 6.0.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/remoteTutorDrawer.es.js +5860 -5807
- package/dist/bundles/remoteTutorDrawer.umd.js +40 -40
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.js +2 -2
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +3 -1
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +61 -20
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +74 -27
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +241 -0
- package/dist/cjs/components/AiChat/AiChat.js +2 -11
- package/dist/cjs/components/AiChat/AiChat.test.js +31 -0
- package/dist/cjs/components/AiChat/EntryScreen.js +0 -1
- package/dist/cjs/components/TabButtons/TabButtonList.d.ts +10 -1
- package/dist/cjs/components/TabButtons/TabButtonList.js +12 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +5 -1
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.js +2 -2
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +3 -1
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +62 -21
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +9 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +73 -26
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +239 -0
- package/dist/esm/components/AiChat/AiChat.js +2 -11
- package/dist/esm/components/AiChat/AiChat.test.js +31 -0
- package/dist/esm/components/AiChat/EntryScreen.js +0 -1
- package/dist/esm/components/TabButtons/TabButtonList.d.ts +10 -1
- package/dist/esm/components/TabButtons/TabButtonList.js +12 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -40,10 +40,10 @@ const classes = {
|
|
|
40
40
|
bottomSection: "MitAiChat--bottomSection",
|
|
41
41
|
};
|
|
42
42
|
const Container = styled.div();
|
|
43
|
-
const ChatScreen = styled.div(({ externalScroll, theme }) => (Object.assign({ padding: "16px
|
|
43
|
+
const ChatScreen = styled.div(({ externalScroll, theme }) => (Object.assign({ padding: "16px 32px 0", [theme.breakpoints.down("md")]: {
|
|
44
44
|
padding: "16px 16px 0",
|
|
45
45
|
}, boxSizing: "border-box", background: "white", position: "absolute", bottom: 0, top: 0, left: 0, right: 0, zIndex: 1 }, (externalScroll && {
|
|
46
|
-
padding: "0
|
|
46
|
+
padding: "0 32px",
|
|
47
47
|
[theme.breakpoints.down("md")]: {
|
|
48
48
|
padding: "0 16px",
|
|
49
49
|
},
|
|
@@ -183,15 +183,6 @@ const AiChat = (_a) => {
|
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
setShowEntryScreen(false);
|
|
186
|
-
if (entryScreenTitle && !initialMessages) {
|
|
187
|
-
setInitialMessages([
|
|
188
|
-
{
|
|
189
|
-
role: "assistant",
|
|
190
|
-
content: entryScreenTitle,
|
|
191
|
-
id: `initial-${Math.random().toString().slice(2)}-0`,
|
|
192
|
-
},
|
|
193
|
-
]);
|
|
194
|
-
}
|
|
195
186
|
append({ role: "user", content: prompt });
|
|
196
187
|
} })) : (React.createElement(ChatScreen, { className: classes.chatScreenContainer, "data-testid": "ai-chat-screen", externalScroll: externalScroll, ref: chatScreenRef },
|
|
197
188
|
React.createElement(ChatContainer, Object.assign({ className: classNames(className, classes.root), externalScroll: externalScroll }, others),
|
|
@@ -175,4 +175,35 @@ describe("AiChat", () => {
|
|
|
175
175
|
const alert = yield screen.findByRole("alert");
|
|
176
176
|
expect(alert).toHaveTextContent("An unexpected error has occurred");
|
|
177
177
|
}));
|
|
178
|
+
test("Shows the entry screen if entryScreenEnabled is true", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
|
+
setup({
|
|
180
|
+
entryScreenEnabled: true,
|
|
181
|
+
entryScreenTitle: "Entry Screen Title",
|
|
182
|
+
});
|
|
183
|
+
yield expect(screen.getByText("Entry Screen Title")).toBeInTheDocument();
|
|
184
|
+
}));
|
|
185
|
+
test("User can submit a prompt from the entry screen", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
+
setup({
|
|
187
|
+
entryScreenEnabled: true,
|
|
188
|
+
entryScreenTitle: "Entry Screen Title",
|
|
189
|
+
initialMessages: [],
|
|
190
|
+
conversationStarters: [],
|
|
191
|
+
});
|
|
192
|
+
yield user.click(screen.getByRole("textbox"));
|
|
193
|
+
yield user.paste("User message");
|
|
194
|
+
yield user.click(screen.getByRole("button", { name: "Send" }));
|
|
195
|
+
const messages = getMessages();
|
|
196
|
+
expect(messages[0]).toHaveTextContent("User message");
|
|
197
|
+
}));
|
|
198
|
+
test("User can click starter on the entry screen to submit a prompt", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
199
|
+
setup({
|
|
200
|
+
entryScreenEnabled: true,
|
|
201
|
+
entryScreenTitle: "Entry Screen Title",
|
|
202
|
+
initialMessages: [],
|
|
203
|
+
conversationStarters: [{ content: "Starter 1" }],
|
|
204
|
+
});
|
|
205
|
+
yield user.click(screen.getByRole("button", { name: "Starter 1" }));
|
|
206
|
+
const messages = getMessages();
|
|
207
|
+
expect(messages[0]).toHaveTextContent("Starter 1");
|
|
208
|
+
}));
|
|
178
209
|
});
|
|
@@ -3,7 +3,7 @@ import type { TabProps } from "@mui/material/Tab";
|
|
|
3
3
|
import type { TabListProps } from "@mui/lab/TabList";
|
|
4
4
|
import type { ButtonLinkProps } from "../Button/Button";
|
|
5
5
|
type StyleVariant = "chat";
|
|
6
|
-
|
|
6
|
+
type TabButtonListProps = TabListProps & {
|
|
7
7
|
styleVariant?: StyleVariant;
|
|
8
8
|
};
|
|
9
9
|
declare const TabButtonList: React.FC<TabButtonListProps>;
|
|
@@ -11,6 +11,15 @@ declare const TabLinkInner: React.ForwardRefExoticComponent<Omit<ButtonLinkProps
|
|
|
11
11
|
type TabButtonProps = Omit<TabProps<"button">, "color"> & {
|
|
12
12
|
styleVariant?: StyleVariant;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Wrapper around [MUI Tab](https://mui.com/material-ui/api/tab/) using our
|
|
16
|
+
* Button as the `component` implementation.
|
|
17
|
+
*/
|
|
14
18
|
declare const TabButton: (props: TabButtonProps) => React.JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Wrapper around [MUI Tab](https://mui.com/material-ui/api/tab/) using our
|
|
21
|
+
* ButtonLink as the `component` implementation.
|
|
22
|
+
*/
|
|
15
23
|
declare const TabButtonLink: ({ ...props }: TabProps<typeof TabLinkInner>) => React.JSX.Element;
|
|
16
24
|
export { TabButtonList, TabButton, TabButtonLink };
|
|
25
|
+
export type { TabButtonListProps, TabButtonProps };
|
|
@@ -20,7 +20,10 @@ const defaultTabListProps = {
|
|
|
20
20
|
allowScrollButtonsMobile: true,
|
|
21
21
|
scrollButtons: "auto",
|
|
22
22
|
};
|
|
23
|
-
const TabButtonList = styled((
|
|
23
|
+
const TabButtonList = styled((_a) => {
|
|
24
|
+
var { styleVariant } = _a, props = __rest(_a, ["styleVariant"]);
|
|
25
|
+
return (React.createElement(MuiTabList, Object.assign({}, defaultTabListProps, props)));
|
|
26
|
+
})(({ theme, styleVariant }) => (Object.assign({ minHeight: "unset", ".MuiTabs-indicator": {
|
|
24
27
|
display: "none",
|
|
25
28
|
}, ".MuiTabs-flexContainer": {
|
|
26
29
|
gap: "8px",
|
|
@@ -73,7 +76,15 @@ const TabLinkInner = React.forwardRef((props, ref) => {
|
|
|
73
76
|
return React.createElement(TabLinkStyled, Object.assign({}, defaultTabButtonProps, others, { ref: ref }));
|
|
74
77
|
});
|
|
75
78
|
TabLinkInner.displayName = "TabLinkInner";
|
|
79
|
+
/**
|
|
80
|
+
* Wrapper around [MUI Tab](https://mui.com/material-ui/api/tab/) using our
|
|
81
|
+
* Button as the `component` implementation.
|
|
82
|
+
*/
|
|
76
83
|
const TabButton = (props) => (React.createElement(MuiTab, Object.assign({}, props, { component: TabButtonInner })));
|
|
84
|
+
/**
|
|
85
|
+
* Wrapper around [MUI Tab](https://mui.com/material-ui/api/tab/) using our
|
|
86
|
+
* ButtonLink as the `component` implementation.
|
|
87
|
+
*/
|
|
77
88
|
const TabButtonLink = (_a) => {
|
|
78
89
|
var props = __rest(_a, []);
|
|
79
90
|
return (React.createElement(MuiTab, Object.assign({}, props, { component: TabLinkInner })));
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export { TextField } from "./components/TextField/TextField";
|
|
|
12
12
|
export type { TextFieldProps } from "./components/TextField/TextField";
|
|
13
13
|
export { SrAnnouncer } from "./components/SrAnnouncer/SrAnnouncer";
|
|
14
14
|
export type { SrAnnouncerProps } from "./components/SrAnnouncer/SrAnnouncer";
|
|
15
|
+
export { TabButton, TabButtonLink, TabButtonList, } from "./components/TabButtons/TabButtonList";
|
|
15
16
|
export { VisuallyHidden } from "./components/VisuallyHidden/VisuallyHidden";
|
package/dist/esm/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { ActionButton, ActionButtonLink, } from "./components/Button/ActionButto
|
|
|
7
7
|
export { Input } from "./components/Input/Input";
|
|
8
8
|
export { TextField } from "./components/TextField/TextField";
|
|
9
9
|
export { SrAnnouncer } from "./components/SrAnnouncer/SrAnnouncer";
|
|
10
|
+
export { TabButton, TabButtonLink, TabButtonList, } from "./components/TabButtons/TabButtonList";
|
|
10
11
|
export { VisuallyHidden } from "./components/VisuallyHidden/VisuallyHidden";
|