@mitodl/smoot-design 0.0.0-0a23f44
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 +35 -0
- package/dist/bundles/aiDrawerManager.es.js +38832 -0
- package/dist/bundles/aiDrawerManager.es.js.map +1 -0
- package/dist/bundles/aiDrawerManager.umd.js +245 -0
- package/dist/bundles/aiDrawerManager.umd.js.map +1 -0
- package/dist/bundles/remoteTutorDrawer.es.js +38832 -0
- package/dist/bundles/remoteTutorDrawer.es.js.map +1 -0
- package/dist/bundles/remoteTutorDrawer.umd.js +245 -0
- package/dist/bundles/remoteTutorDrawer.umd.js.map +1 -0
- package/dist/cjs/VERSION.d.ts +12 -0
- package/dist/cjs/VERSION.js +15 -0
- package/dist/cjs/ai.d.ts +3 -0
- package/dist/cjs/ai.js +9 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawer.d.ts +55 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawer.js +262 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawer.stories.d.ts +17 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawer.stories.js +264 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.d.ts +12 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.js +51 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.stories.d.ts +6 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.stories.js +267 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.test.d.ts +1 -0
- package/dist/cjs/bundles/AiDrawer/AiDrawerManager.test.js +245 -0
- package/dist/cjs/bundles/AiDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/cjs/bundles/AiDrawer/FlashcardsScreen.js +87 -0
- package/dist/cjs/bundles/aiDrawerManager.d.ts +6 -0
- package/dist/cjs/bundles/aiDrawerManager.js +44 -0
- package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
- package/dist/cjs/components/AiChat/AiChat.js +267 -0
- package/dist/cjs/components/AiChat/AiChat.stories.d.ts +17 -0
- package/dist/cjs/components/AiChat/AiChat.stories.js +194 -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/AiChatContext.d.ts +26 -0
- package/dist/cjs/components/AiChat/AiChatContext.js +106 -0
- package/dist/cjs/components/AiChat/AiChatContext.stories.d.ts +14 -0
- package/dist/cjs/components/AiChat/AiChatContext.stories.js +75 -0
- package/dist/cjs/components/AiChat/AiChatMarkdown.stories.d.ts +15 -0
- package/dist/cjs/components/AiChat/AiChatMarkdown.stories.js +282 -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/EllipsisIcon.d.ts +6 -0
- package/dist/cjs/components/AiChat/EllipsisIcon.js +17 -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/Markdown.d.ts +7 -0
- package/dist/cjs/components/AiChat/Markdown.js +14 -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 +164 -0
- package/dist/cjs/components/AiChat/types.d.ts +96 -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 +58 -0
- package/dist/cjs/components/Button/Button.js +261 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +18 -0
- package/dist/cjs/components/Button/Button.stories.js +148 -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/Checkbox/Checkbox.d.ts +20 -0
- package/dist/cjs/components/Checkbox/Checkbox.js +85 -0
- package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/dist/cjs/components/Checkbox/Checkbox.stories.js +33 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.d.ts +21 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.js +43 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.stories.d.ts +8 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.stories.js +50 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.test.d.ts +1 -0
- package/dist/cjs/components/CheckboxChoiceField/CheckboxChoiceField.test.js +52 -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/RadioChoiceField/BooleanRadioChoiceField.stories.d.ts +6 -0
- package/dist/cjs/components/RadioChoiceField/BooleanRadioChoiceField.stories.js +47 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.d.ts +45 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.js +69 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.stories.d.ts +6 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.stories.js +55 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.test.d.ts +1 -0
- package/dist/cjs/components/RadioChoiceField/RadioChoiceField.test.js +53 -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 +25 -0
- package/dist/cjs/index.js +44 -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/retryingFetch.d.ts +19 -0
- package/dist/cjs/utils/retryingFetch.js +98 -0
- package/dist/cjs/utils/retryingFetch.test.d.ts +1 -0
- package/dist/cjs/utils/retryingFetch.test.js +48 -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/VERSION.d.ts +12 -0
- package/dist/esm/VERSION.js +12 -0
- package/dist/esm/ai.d.ts +3 -0
- package/dist/esm/ai.js +2 -0
- package/dist/esm/bundles/AiDrawer/AiDrawer.d.ts +55 -0
- package/dist/esm/bundles/AiDrawer/AiDrawer.js +259 -0
- package/dist/esm/bundles/AiDrawer/AiDrawer.stories.d.ts +17 -0
- package/dist/esm/bundles/AiDrawer/AiDrawer.stories.js +261 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.d.ts +12 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.js +48 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.stories.d.ts +6 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.stories.js +264 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.test.d.ts +1 -0
- package/dist/esm/bundles/AiDrawer/AiDrawerManager.test.js +243 -0
- package/dist/esm/bundles/AiDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/esm/bundles/AiDrawer/FlashcardsScreen.js +83 -0
- package/dist/esm/bundles/aiDrawerManager.d.ts +6 -0
- package/dist/esm/bundles/aiDrawerManager.js +41 -0
- package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
- package/dist/esm/components/AiChat/AiChat.js +263 -0
- package/dist/esm/components/AiChat/AiChat.stories.d.ts +17 -0
- package/dist/esm/components/AiChat/AiChat.stories.js +191 -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/AiChatContext.d.ts +26 -0
- package/dist/esm/components/AiChat/AiChatContext.js +102 -0
- package/dist/esm/components/AiChat/AiChatContext.stories.d.ts +14 -0
- package/dist/esm/components/AiChat/AiChatContext.stories.js +72 -0
- package/dist/esm/components/AiChat/AiChatMarkdown.stories.d.ts +15 -0
- package/dist/esm/components/AiChat/AiChatMarkdown.stories.js +279 -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/EllipsisIcon.d.ts +6 -0
- package/dist/esm/components/AiChat/EllipsisIcon.js +15 -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/Markdown.d.ts +7 -0
- package/dist/esm/components/AiChat/Markdown.js +12 -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 +161 -0
- package/dist/esm/components/AiChat/types.d.ts +96 -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 +58 -0
- package/dist/esm/components/Button/Button.js +252 -0
- package/dist/esm/components/Button/Button.stories.d.ts +18 -0
- package/dist/esm/components/Button/Button.stories.js +145 -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/Checkbox/Checkbox.d.ts +20 -0
- package/dist/esm/components/Checkbox/Checkbox.js +81 -0
- package/dist/esm/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/dist/esm/components/Checkbox/Checkbox.stories.js +30 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.d.ts +21 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.js +40 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.stories.d.ts +8 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.stories.js +47 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.test.d.ts +1 -0
- package/dist/esm/components/CheckboxChoiceField/CheckboxChoiceField.test.js +50 -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/RadioChoiceField/BooleanRadioChoiceField.stories.d.ts +6 -0
- package/dist/esm/components/RadioChoiceField/BooleanRadioChoiceField.stories.js +44 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.d.ts +45 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.js +65 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.stories.d.ts +6 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.stories.js +52 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.test.d.ts +1 -0
- package/dist/esm/components/RadioChoiceField/RadioChoiceField.test.js +51 -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 +25 -0
- package/dist/esm/index.js +16 -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/retryingFetch.d.ts +19 -0
- package/dist/esm/utils/retryingFetch.js +96 -0
- package/dist/esm/utils/retryingFetch.test.d.ts +1 -0
- package/dist/esm/utils/retryingFetch.test.js +46 -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 +159 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated at build time.
|
|
3
|
+
* Run node ./scripts/set_version.js to update the version.
|
|
4
|
+
* Do not update this file manually.
|
|
5
|
+
*
|
|
6
|
+
* NOTES:
|
|
7
|
+
* - In development, VERSION will always be "0.0.0"
|
|
8
|
+
* - The version should not simply be imported from package.json. This would
|
|
9
|
+
* result in all of the package.json being included in the bundled code, which
|
|
10
|
+
* is not desired.
|
|
11
|
+
*/
|
|
12
|
+
export declare const VERSION = "0.0.0-0a23f44";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This file is auto-generated at build time.
|
|
6
|
+
* Run node ./scripts/set_version.js to update the version.
|
|
7
|
+
* Do not update this file manually.
|
|
8
|
+
*
|
|
9
|
+
* NOTES:
|
|
10
|
+
* - In development, VERSION will always be "0.0.0"
|
|
11
|
+
* - The version should not simply be imported from package.json. This would
|
|
12
|
+
* result in all of the package.json being included in the bundled code, which
|
|
13
|
+
* is not desired.
|
|
14
|
+
*/
|
|
15
|
+
exports.VERSION = "0.0.0-0a23f44";
|
package/dist/cjs/ai.d.ts
ADDED
package/dist/cjs/ai.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAiChat = exports.AiChatProvider = exports.AiChatDisplay = exports.AiChat = void 0;
|
|
4
|
+
var AiChat_1 = require("./components/AiChat/AiChat");
|
|
5
|
+
Object.defineProperty(exports, "AiChat", { enumerable: true, get: function () { return AiChat_1.AiChat; } });
|
|
6
|
+
Object.defineProperty(exports, "AiChatDisplay", { enumerable: true, get: function () { return AiChat_1.AiChatDisplay; } });
|
|
7
|
+
var AiChatContext_1 = require("./components/AiChat/AiChatContext");
|
|
8
|
+
Object.defineProperty(exports, "AiChatProvider", { enumerable: true, get: function () { return AiChatContext_1.AiChatProvider; } });
|
|
9
|
+
Object.defineProperty(exports, "useAiChat", { enumerable: true, get: function () { return AiChatContext_1.useAiChat; } });
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import type { AiChatProps, AiChatMessage } from "../../components/AiChat/types";
|
|
3
|
+
type AiDrawerInitMessage = {
|
|
4
|
+
type: "smoot-design::ai-drawer-open" | "smoot-design::tutor-drawer-open";
|
|
5
|
+
payload: {
|
|
6
|
+
blockType?: "problem" | "video";
|
|
7
|
+
target?: string;
|
|
8
|
+
/**
|
|
9
|
+
* If the title begins "AskTIM", it is styled as the AskTIM logo.
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
chat: {
|
|
13
|
+
chatId?: AiChatProps["chatId"];
|
|
14
|
+
conversationStarters?: AiChatProps["conversationStarters"];
|
|
15
|
+
initialMessages?: AiChatProps["initialMessages"];
|
|
16
|
+
apiUrl: AiChatProps["requestOpts"]["apiUrl"];
|
|
17
|
+
requestBody?: Record<string, unknown>;
|
|
18
|
+
entryScreenEnabled?: AiChatProps["entryScreenEnabled"];
|
|
19
|
+
entryScreenTitle?: AiChatProps["entryScreenTitle"];
|
|
20
|
+
};
|
|
21
|
+
summary?: {
|
|
22
|
+
apiUrl: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type AiDrawerProps = {
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Transform the body of the request before sending it to the server.
|
|
30
|
+
* Its result will be merged with the per-message requestBody opt, with
|
|
31
|
+
* transformBody taking precedence.
|
|
32
|
+
*
|
|
33
|
+
* *This cannot be supplied via message events since the function is not serializable.*
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
transformBody?: (messages: AiChatMessage[]) => Iterable<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Fetch options to be passed to the fetch call.
|
|
39
|
+
*
|
|
40
|
+
* NOTE: By default, the credentials are set to "include" to enable thread-
|
|
41
|
+
* identifying cookies.
|
|
42
|
+
*/
|
|
43
|
+
fetchOpts?: AiChatProps["requestOpts"]["fetchOpts"];
|
|
44
|
+
/**
|
|
45
|
+
* Pass to target a specific drawer instance where multiple are on the page.
|
|
46
|
+
*/
|
|
47
|
+
/** @deprecated The AiDrawerManager now handles multiple AiDrawer instance removing the need to target */
|
|
48
|
+
target?: string;
|
|
49
|
+
payload?: AiDrawerInitMessage["payload"];
|
|
50
|
+
open?: boolean;
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
};
|
|
53
|
+
declare const AiDrawer: FC<AiDrawerProps>;
|
|
54
|
+
export { AiDrawer };
|
|
55
|
+
export type { AiDrawerProps, AiDrawerInitMessage };
|
|
@@ -0,0 +1,262 @@
|
|
|
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.AiDrawer = void 0;
|
|
13
|
+
// @format
|
|
14
|
+
const React = require("react");
|
|
15
|
+
const react_1 = require("react");
|
|
16
|
+
const styled_1 = require("@emotion/styled");
|
|
17
|
+
const react_markdown_1 = require("react-markdown");
|
|
18
|
+
const rehype_raw_1 = require("rehype-raw");
|
|
19
|
+
const react_2 = require("@remixicon/react");
|
|
20
|
+
const Drawer_1 = require("@mui/material/Drawer");
|
|
21
|
+
const TabButtonList_1 = require("../../components/TabButtons/TabButtonList");
|
|
22
|
+
const Typography_1 = require("@mui/material/Typography");
|
|
23
|
+
const TabContext_1 = require("@mui/lab/TabContext");
|
|
24
|
+
const TabPanel_1 = require("@mui/lab/TabPanel");
|
|
25
|
+
const AiChat_1 = require("../../components/AiChat/AiChat");
|
|
26
|
+
const ActionButton_1 = require("../../components/Button/ActionButton");
|
|
27
|
+
const FlashcardsScreen_1 = require("./FlashcardsScreen");
|
|
28
|
+
const VERSION_1 = require("../../VERSION");
|
|
29
|
+
const Header = styled_1.default.div(({ theme }) => ({
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
gap: "4px",
|
|
34
|
+
color: theme.custom.colors.white,
|
|
35
|
+
position: "sticky",
|
|
36
|
+
top: 0,
|
|
37
|
+
padding: "32px 0 16px 0",
|
|
38
|
+
zIndex: 2,
|
|
39
|
+
backgroundColor: theme.custom.colors.white,
|
|
40
|
+
borderRadius: 0,
|
|
41
|
+
}));
|
|
42
|
+
const Title = styled_1.default.div(({ theme }) => ({
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "8px",
|
|
46
|
+
color: theme.custom.colors.darkGray2,
|
|
47
|
+
img: {
|
|
48
|
+
width: "24px",
|
|
49
|
+
height: "24px",
|
|
50
|
+
},
|
|
51
|
+
svg: {
|
|
52
|
+
fill: theme.custom.colors.red,
|
|
53
|
+
width: "24px",
|
|
54
|
+
height: "24px",
|
|
55
|
+
flexShrink: 0,
|
|
56
|
+
},
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
p: {
|
|
59
|
+
textOverflow: "ellipsis",
|
|
60
|
+
overflow: "hidden",
|
|
61
|
+
whiteSpace: "nowrap",
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
64
|
+
const CloseButton = (0, styled_1.default)(ActionButton_1.ActionButton)(({ theme }) => ({
|
|
65
|
+
backgroundColor: theme.custom.colors.lightGray2,
|
|
66
|
+
"&&:hover": {
|
|
67
|
+
backgroundColor: theme.custom.colors.red,
|
|
68
|
+
color: theme.custom.colors.white,
|
|
69
|
+
},
|
|
70
|
+
zIndex: 3,
|
|
71
|
+
flexShrink: 0,
|
|
72
|
+
}));
|
|
73
|
+
const StyledTabButtonList = (0, styled_1.default)(TabButtonList_1.TabButtonList)(({ theme }) => ({
|
|
74
|
+
padding: "0 0 16px",
|
|
75
|
+
backgroundColor: theme.custom.colors.white,
|
|
76
|
+
position: "sticky",
|
|
77
|
+
top: "88px",
|
|
78
|
+
zIndex: 2,
|
|
79
|
+
overflow: "visible",
|
|
80
|
+
}));
|
|
81
|
+
const StyledTabPanel = (0, styled_1.default)(TabPanel_1.default)({
|
|
82
|
+
padding: "0",
|
|
83
|
+
height: "calc(100% - 138px)",
|
|
84
|
+
position: "relative",
|
|
85
|
+
});
|
|
86
|
+
const StyledAiChat = (0, styled_1.default)(AiChat_1.AiChat)(({ hasTabs, theme }) => ({
|
|
87
|
+
".MitAiChat--entryScreenContainer": {
|
|
88
|
+
padding: hasTabs ? "114px 0 24px" : "168px 32px 24px",
|
|
89
|
+
[theme.breakpoints.down("md")]: {
|
|
90
|
+
padding: hasTabs ? "114px 0 24px" : "168px 16px 24px",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
".MitAiChat--chatScreenContainer": {
|
|
94
|
+
padding: hasTabs ? 0 : "0 32px",
|
|
95
|
+
[theme.breakpoints.down("md")]: {
|
|
96
|
+
padding: hasTabs ? 0 : "0 16px",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
".MitAiChat--messagesContainer": {
|
|
100
|
+
paddingTop: hasTabs ? "8px" : "88px",
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
103
|
+
const StyledHTML = styled_1.default.div(({ theme }) => (Object.assign(Object.assign({ color: theme.custom.colors.darkGray2, backgroundColor: theme.custom.colors.white, padding: "12px 0 100px" }, theme.typography.body2), { "p:first-of-type": {
|
|
104
|
+
marginTop: 0,
|
|
105
|
+
}, "p:last-of-type": {
|
|
106
|
+
marginBottom: 0,
|
|
107
|
+
}, "ol, ul": {
|
|
108
|
+
paddingInlineStart: "32px",
|
|
109
|
+
li: {
|
|
110
|
+
margin: "16px 0",
|
|
111
|
+
},
|
|
112
|
+
}, ul: {
|
|
113
|
+
marginInlineStart: "-16px",
|
|
114
|
+
}, a: {
|
|
115
|
+
color: theme.custom.colors.red,
|
|
116
|
+
fontWeight: "normal",
|
|
117
|
+
} })));
|
|
118
|
+
const identity = (x) => x;
|
|
119
|
+
const DEFAULT_FETCH_OPTS = {
|
|
120
|
+
credentials: "include",
|
|
121
|
+
};
|
|
122
|
+
const useContentFetch = (contentUrl) => {
|
|
123
|
+
const [response, setResponse] = (0, react_1.useState)(null);
|
|
124
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
125
|
+
(0, react_1.useEffect)(() => {
|
|
126
|
+
if (!contentUrl)
|
|
127
|
+
return;
|
|
128
|
+
const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
setLoading(true);
|
|
130
|
+
try {
|
|
131
|
+
const response = yield fetch(contentUrl);
|
|
132
|
+
const result = yield response.json();
|
|
133
|
+
if (!result.results) {
|
|
134
|
+
throw new Error("Unexpected response");
|
|
135
|
+
}
|
|
136
|
+
const [contentFile] = result.results;
|
|
137
|
+
if (!contentFile) {
|
|
138
|
+
throw new Error("No result found");
|
|
139
|
+
}
|
|
140
|
+
setResponse({
|
|
141
|
+
summary: contentFile.summary,
|
|
142
|
+
flashcards: contentFile.flashcards,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
console.error("Error fetching content", error);
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
setLoading(false);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
fetchData();
|
|
153
|
+
}, [contentUrl]);
|
|
154
|
+
return { response, loading };
|
|
155
|
+
};
|
|
156
|
+
const DEFAULT_PROBLEM_INITIAL_MESSAGES = [
|
|
157
|
+
{
|
|
158
|
+
role: "assistant",
|
|
159
|
+
content: "Let's try to work on this problem together. It would be great to hear how you're thinking about solving it. Can you walk me through the approach you're considering?",
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
const DEFAULT_VIDEO_ENTRY_SCREEN_TITLE = "What do you want to know about this video?";
|
|
163
|
+
const DEFAULT_VIDEO_STARTERS = [
|
|
164
|
+
{ content: "What are the most important concepts introduced in the video?" },
|
|
165
|
+
{
|
|
166
|
+
content: "What examples are used to illustrate concepts covered in the video?",
|
|
167
|
+
},
|
|
168
|
+
{ content: "What are the key terms introduced in this video?" },
|
|
169
|
+
];
|
|
170
|
+
const ChatComponent = ({ payload, transformBody, fetchOpts, scrollElement, entryScreenEnabled, entryScreenTitle, conversationStarters, initialMessages, hasTabs, needsMathJax, }) => {
|
|
171
|
+
if (!payload)
|
|
172
|
+
return null;
|
|
173
|
+
return (React.createElement(StyledAiChat, { key: payload.chatId, chatId: payload.chatId, conversationStarters: conversationStarters, initialMessages: initialMessages, scrollElement: scrollElement, entryScreenEnabled: entryScreenEnabled, entryScreenTitle: entryScreenTitle, requestOpts: {
|
|
174
|
+
transformBody: (messages) => (Object.assign(Object.assign({}, payload.requestBody), transformBody === null || transformBody === void 0 ? void 0 : transformBody(messages))),
|
|
175
|
+
apiUrl: payload.apiUrl,
|
|
176
|
+
fetchOpts: Object.assign(Object.assign({}, DEFAULT_FETCH_OPTS), fetchOpts),
|
|
177
|
+
}, hasTabs: hasTabs, useMathJax: needsMathJax }));
|
|
178
|
+
};
|
|
179
|
+
const randomItems = (array, count) => {
|
|
180
|
+
const shuffled = [...array].sort(() => 0.5 - Math.random());
|
|
181
|
+
return shuffled.slice(0, count);
|
|
182
|
+
};
|
|
183
|
+
const AiDrawer = ({ transformBody = identity, className, fetchOpts, payload, open, onClose, }) => {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
185
|
+
const [tab, setTab] = (0, react_1.useState)("chat");
|
|
186
|
+
const { response } = useContentFetch((_a = payload === null || payload === void 0 ? void 0 : payload.summary) === null || _a === void 0 ? void 0 : _a.apiUrl);
|
|
187
|
+
const [_wasKeyboardFocus, setWasKeyboardFocus] = (0, react_1.useState)(false);
|
|
188
|
+
const mouseInteracted = (0, react_1.useRef)(false);
|
|
189
|
+
const handleMouseDown = () => {
|
|
190
|
+
mouseInteracted.current = true;
|
|
191
|
+
};
|
|
192
|
+
const handleFocus = () => {
|
|
193
|
+
if (!mouseInteracted.current) {
|
|
194
|
+
setWasKeyboardFocus(true);
|
|
195
|
+
}
|
|
196
|
+
mouseInteracted.current = false;
|
|
197
|
+
};
|
|
198
|
+
const [scrollElement, setScrollElement] = (0, react_1.useState)(null);
|
|
199
|
+
const paperRefCallback = (node) => {
|
|
200
|
+
if (node) {
|
|
201
|
+
setScrollElement(node);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
(0, react_1.useEffect)(() => {
|
|
205
|
+
var _a;
|
|
206
|
+
(_a = scrollElement === null || scrollElement === void 0 ? void 0 : scrollElement.scrollTo) === null || _a === void 0 ? void 0 : _a.call(scrollElement, {
|
|
207
|
+
top: tab === "chat" ? scrollElement.scrollHeight : 0,
|
|
208
|
+
});
|
|
209
|
+
}, [tab, scrollElement]);
|
|
210
|
+
const conversationStarters = (0, react_1.useMemo)(() => {
|
|
211
|
+
var _a;
|
|
212
|
+
if (!payload)
|
|
213
|
+
return [];
|
|
214
|
+
return (payload.chat.conversationStarters ||
|
|
215
|
+
(((_a = response === null || response === void 0 ? void 0 : response.flashcards) === null || _a === void 0 ? void 0 : _a.length) && response.flashcards.length >= 3
|
|
216
|
+
? randomItems(response.flashcards, 3).map((flashcard) => ({
|
|
217
|
+
content: flashcard.question,
|
|
218
|
+
}))
|
|
219
|
+
: DEFAULT_VIDEO_STARTERS));
|
|
220
|
+
}, [payload, response]);
|
|
221
|
+
if (!payload) {
|
|
222
|
+
return React.createElement("div", { "data-testid": "ai-drawer-waiting" });
|
|
223
|
+
}
|
|
224
|
+
const { title, blockType, chat } = payload;
|
|
225
|
+
const hasTabs = blockType === "video";
|
|
226
|
+
return (React.createElement(Drawer_1.default, { "data-smoot-version": VERSION_1.VERSION, className: className, PaperProps: {
|
|
227
|
+
ref: paperRefCallback,
|
|
228
|
+
sx: {
|
|
229
|
+
width: "900px",
|
|
230
|
+
maxWidth: "100%",
|
|
231
|
+
boxSizing: "border-box",
|
|
232
|
+
padding: {
|
|
233
|
+
xs: "0 16px",
|
|
234
|
+
md: "0 32px",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
}, anchor: "right", open: open, onClose: onClose, role: "dialog", "aria-modal": "true", keepMounted: true },
|
|
238
|
+
React.createElement(Header, null,
|
|
239
|
+
React.createElement(Title, null,
|
|
240
|
+
title ? React.createElement(react_2.RiSparkling2Line, null) : null,
|
|
241
|
+
React.createElement(Typography_1.default, { variant: "body1", component: "h1" }, (title === null || title === void 0 ? void 0 : title.includes("AskTIM")) ? (React.createElement(React.Fragment, null,
|
|
242
|
+
"Ask",
|
|
243
|
+
React.createElement("strong", null, "TIM"),
|
|
244
|
+
title.replace("AskTIM", ""))) : (title))),
|
|
245
|
+
React.createElement(CloseButton, { variant: "text", size: "medium", onClick: onClose, "aria-label": "Close" },
|
|
246
|
+
React.createElement(react_2.RiCloseLine, null))),
|
|
247
|
+
blockType === "problem" ? (React.createElement(ChatComponent, { payload: chat, transformBody: transformBody, fetchOpts: fetchOpts, scrollElement: scrollElement, entryScreenEnabled: (_b = chat === null || chat === void 0 ? void 0 : chat.entryScreenEnabled) !== null && _b !== void 0 ? _b : false, entryScreenTitle: chat.entryScreenTitle, initialMessages: chat.initialMessages || DEFAULT_PROBLEM_INITIAL_MESSAGES, hasTabs: hasTabs, needsMathJax: true })) : null,
|
|
248
|
+
blockType === "video" ? (React.createElement(TabContext_1.default, { value: tab },
|
|
249
|
+
React.createElement(StyledTabButtonList, { styleVariant: "chat", onChange: (e, tab) => setTab(tab) },
|
|
250
|
+
React.createElement(TabButtonList_1.TabButton, { value: "chat", label: "Chat" }),
|
|
251
|
+
((_c = response === null || response === void 0 ? void 0 : response.flashcards) === null || _c === void 0 ? void 0 : _c.length) ? (React.createElement(TabButtonList_1.TabButton, { value: "flashcards", label: "Flashcards", onMouseDown: handleMouseDown, onFocus: handleFocus })) : null,
|
|
252
|
+
React.createElement(TabButtonList_1.TabButton, { value: "summary", label: "Summary" })),
|
|
253
|
+
React.createElement(StyledTabPanel, { value: "chat", keepMounted: true },
|
|
254
|
+
React.createElement(ChatComponent, { payload: chat, transformBody: transformBody, fetchOpts: fetchOpts, scrollElement: scrollElement, entryScreenEnabled: (_d = chat === null || chat === void 0 ? void 0 : chat.entryScreenEnabled) !== null && _d !== void 0 ? _d : true, entryScreenTitle: (_e = chat.entryScreenTitle) !== null && _e !== void 0 ? _e : DEFAULT_VIDEO_ENTRY_SCREEN_TITLE, conversationStarters: conversationStarters, initialMessages: chat.initialMessages, hasTabs: hasTabs, needsMathJax: false })),
|
|
255
|
+
((_f = response === null || response === void 0 ? void 0 : response.flashcards) === null || _f === void 0 ? void 0 : _f.length) ? (React.createElement(StyledTabPanel, { value: "flashcards" },
|
|
256
|
+
React.createElement(FlashcardsScreen_1.FlashcardsScreen, { flashcards: response === null || response === void 0 ? void 0 : response.flashcards, wasKeyboardFocus: _wasKeyboardFocus }))) : null,
|
|
257
|
+
React.createElement(StyledTabPanel, { value: "summary" },
|
|
258
|
+
React.createElement(Typography_1.default, { variant: "h4", component: "h4" }),
|
|
259
|
+
React.createElement(StyledHTML, null,
|
|
260
|
+
React.createElement(react_markdown_1.default, { rehypePlugins: [rehype_raw_1.default] }, (_g = response === null || response === void 0 ? void 0 : response.summary) !== null && _g !== void 0 ? _g : ""))))) : null));
|
|
261
|
+
};
|
|
262
|
+
exports.AiDrawer = AiDrawer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AiDrawer } from "./AiDrawer";
|
|
3
|
+
declare const meta: Meta<typeof AiDrawer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AiDrawer>;
|
|
6
|
+
export declare const ProblemStory: Story;
|
|
7
|
+
export declare const ProblemDefaultInitialMessagesStory: Story;
|
|
8
|
+
export declare const EntryScreenStory: Story;
|
|
9
|
+
/**
|
|
10
|
+
* The chat entry screen is shown by default for the video blocks Tutor drawer.
|
|
11
|
+
*/
|
|
12
|
+
export declare const VideoStory: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Where conversation starters are not provided, they will be selected at random from the returned flashcard questions
|
|
15
|
+
* or from `DEFAULT_VIDEO_STARTERS` provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare const FlashcardConversationStartersStory: Story;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlashcardConversationStartersStory = exports.VideoStory = exports.EntryScreenStory = exports.ProblemDefaultInitialMessagesStory = exports.ProblemStory = void 0;
|
|
4
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const msw_1 = require("msw");
|
|
7
|
+
const api_1 = require("../../components/AiChat/test-utils/api");
|
|
8
|
+
const AiDrawer_1 = require("./AiDrawer");
|
|
9
|
+
const better_react_mathjax_1 = require("better-react-mathjax");
|
|
10
|
+
const Button_1 = require("@mui/material/Button");
|
|
11
|
+
const TEST_API_STREAMING = "http://localhost:4567/streaming";
|
|
12
|
+
const CONTENT_FILE_URL = "http://localhost:4567/api/v1/contentfiles/?edx_module_id=1";
|
|
13
|
+
const INITIAL_MESSAGES = [
|
|
14
|
+
{
|
|
15
|
+
content: "Hi! What are you interested in learning about?",
|
|
16
|
+
role: "assistant",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
const STARTERS = [
|
|
20
|
+
{ content: "I'm interested in quantum computing" },
|
|
21
|
+
{ content: "I want to understand global warming. " },
|
|
22
|
+
{ content: "I am curious about AI applications for business" },
|
|
23
|
+
];
|
|
24
|
+
const meta = {
|
|
25
|
+
title: "smoot-design/AI/AiDrawer",
|
|
26
|
+
component: AiDrawer_1.AiDrawer,
|
|
27
|
+
render: ({ payload }) => {
|
|
28
|
+
const [open, setOpen] = React.useState(false);
|
|
29
|
+
return (React.createElement(React.Fragment, null,
|
|
30
|
+
React.createElement(Button_1.default, { variant: "outlined", onClick: () => setOpen(true) }, "Open Drawer"),
|
|
31
|
+
React.createElement("p", null, "Message data:"),
|
|
32
|
+
React.createElement("pre", null, JSON.stringify({ payload }, null, 2)),
|
|
33
|
+
React.createElement(better_react_mathjax_1.MathJaxContext, null,
|
|
34
|
+
React.createElement(AiDrawer_1.AiDrawer, { payload: payload, open: open, onClose: () => setOpen(false) }))));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
exports.default = meta;
|
|
38
|
+
exports.ProblemStory = {
|
|
39
|
+
args: {
|
|
40
|
+
payload: {
|
|
41
|
+
blockType: "problem",
|
|
42
|
+
target: "problem-frame",
|
|
43
|
+
title: "AskTIM for help with Problem: Derivatives 1.1",
|
|
44
|
+
chat: {
|
|
45
|
+
apiUrl: TEST_API_STREAMING,
|
|
46
|
+
initialMessages: INITIAL_MESSAGES,
|
|
47
|
+
conversationStarters: STARTERS,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
exports.ProblemDefaultInitialMessagesStory = {
|
|
53
|
+
args: {
|
|
54
|
+
payload: {
|
|
55
|
+
blockType: "problem",
|
|
56
|
+
target: "problem-frame-default-initial-messages",
|
|
57
|
+
title: "AskTIM for help with Problem: Derivatives 1.1",
|
|
58
|
+
chat: {
|
|
59
|
+
apiUrl: TEST_API_STREAMING,
|
|
60
|
+
conversationStarters: STARTERS,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
exports.EntryScreenStory = {
|
|
66
|
+
args: {
|
|
67
|
+
payload: {
|
|
68
|
+
blockType: "problem",
|
|
69
|
+
target: "entry-screen-frame",
|
|
70
|
+
chat: {
|
|
71
|
+
apiUrl: TEST_API_STREAMING,
|
|
72
|
+
initialMessages: INITIAL_MESSAGES,
|
|
73
|
+
conversationStarters: STARTERS,
|
|
74
|
+
entryScreenEnabled: true,
|
|
75
|
+
entryScreenTitle: "AskTIM about this problem",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The chat entry screen is shown by default for the video blocks Tutor drawer.
|
|
82
|
+
*/
|
|
83
|
+
exports.VideoStory = {
|
|
84
|
+
args: {
|
|
85
|
+
payload: {
|
|
86
|
+
blockType: "video",
|
|
87
|
+
target: "video-frame",
|
|
88
|
+
chat: {
|
|
89
|
+
apiUrl: TEST_API_STREAMING,
|
|
90
|
+
conversationStarters: STARTERS,
|
|
91
|
+
},
|
|
92
|
+
summary: {
|
|
93
|
+
apiUrl: CONTENT_FILE_URL,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
parameters: {
|
|
98
|
+
msw: {
|
|
99
|
+
handlers: [
|
|
100
|
+
msw_1.http.get(CONTENT_FILE_URL, () => {
|
|
101
|
+
return msw_1.HttpResponse.json(sampleResponse);
|
|
102
|
+
}),
|
|
103
|
+
...api_1.handlers,
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Where conversation starters are not provided, they will be selected at random from the returned flashcard questions
|
|
110
|
+
* or from `DEFAULT_VIDEO_STARTERS` provided.
|
|
111
|
+
*/
|
|
112
|
+
exports.FlashcardConversationStartersStory = {
|
|
113
|
+
args: {
|
|
114
|
+
payload: {
|
|
115
|
+
blockType: "video",
|
|
116
|
+
target: "starters-frame",
|
|
117
|
+
chat: {
|
|
118
|
+
apiUrl: TEST_API_STREAMING,
|
|
119
|
+
},
|
|
120
|
+
summary: {
|
|
121
|
+
apiUrl: CONTENT_FILE_URL,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
parameters: {
|
|
126
|
+
msw: {
|
|
127
|
+
handlers: [
|
|
128
|
+
msw_1.http.get(CONTENT_FILE_URL, () => {
|
|
129
|
+
return msw_1.HttpResponse.json(sampleResponse);
|
|
130
|
+
}),
|
|
131
|
+
...api_1.handlers,
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
// From https://api.rc.learn.mit.edu/api/v1/contentfiles/?edx_module_id=asset-v1%3AMITxT%2B3.012Sx%2B3T2024%2Btype%40asset%2Bblock%400cc53e11-1f91-4ed8-8bab-0d873db8cb90-en.srt
|
|
137
|
+
const sampleResponse = {
|
|
138
|
+
count: 1,
|
|
139
|
+
next: null,
|
|
140
|
+
previous: null,
|
|
141
|
+
results: [
|
|
142
|
+
{
|
|
143
|
+
id: 16649919,
|
|
144
|
+
run_id: 7462,
|
|
145
|
+
run_title: "Structure of Materials",
|
|
146
|
+
run_slug: null,
|
|
147
|
+
departments: [
|
|
148
|
+
{
|
|
149
|
+
department_id: "3",
|
|
150
|
+
name: "Materials Science and Engineering",
|
|
151
|
+
channel_url: "https://rc.learn.mit.edu/c/department/materials-science-and-engineering/",
|
|
152
|
+
school: {
|
|
153
|
+
id: 2,
|
|
154
|
+
name: "School of Engineering",
|
|
155
|
+
url: "https://engineering.mit.edu/",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
semester: null,
|
|
160
|
+
year: null,
|
|
161
|
+
topics: [
|
|
162
|
+
{
|
|
163
|
+
id: 732,
|
|
164
|
+
name: "Science & Math",
|
|
165
|
+
icon: "RiTestTubeLine",
|
|
166
|
+
parent: null,
|
|
167
|
+
channel_url: "https://rc.learn.mit.edu/c/topic/science-math/",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 734,
|
|
171
|
+
name: "Chemistry",
|
|
172
|
+
icon: "RiTestTubeLine",
|
|
173
|
+
parent: 732,
|
|
174
|
+
channel_url: "https://rc.learn.mit.edu/c/topic/chemistry/",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 748,
|
|
178
|
+
name: "Engineering",
|
|
179
|
+
icon: "RiRobot2Line",
|
|
180
|
+
parent: null,
|
|
181
|
+
channel_url: "https://rc.learn.mit.edu/c/topic/engineering/",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 755,
|
|
185
|
+
name: "Materials Science and Engineering",
|
|
186
|
+
icon: "RiRobot2Line",
|
|
187
|
+
parent: 748,
|
|
188
|
+
channel_url: "https://rc.learn.mit.edu/c/topic/materials-science-and-engineering/",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
key: "asset-v1:MITxT+3.012Sx+3T2024+type@asset+block@0cc53e11-1f91-4ed8-8bab-0d873db8cb90-en.srt",
|
|
192
|
+
uid: null,
|
|
193
|
+
title: null,
|
|
194
|
+
description: null,
|
|
195
|
+
url: null,
|
|
196
|
+
content_feature_type: [],
|
|
197
|
+
content_type: "file",
|
|
198
|
+
content: " So with this, we will conclude a discussion about the glasses. And I mentioned that there is another class of materials that we'll talk about that form amorphous materials, and they are called polymers. And one very important concept that we will introduce in terms of the polymers is called a random walk model. And it helps us to understand what is the structure of the polymers and how they look in different solvents, how they behave at different temperatures, et cetera. So you've probably heard about polymers. Some of you do know about the internal structure of the polymers. But the polymers, in general, are materials that are composed of individual units that are connected among each other to form relatively long chains. So the name itself comes from Latin that means many parts or units. So it simply means that one individual structural unit within the polymer is composed of many identical or different units. So there are many naturally occurring polymers. So for example, cotton, leather, rubber, wool, et cetera, they're all polymers. And what they all have again in common is that they have the structural units that they're interconnected among each other. There are many biopolymers, so DNA molecules, for example. They belong into the class of polymers simply because they have individual structural units that are connected in a relatively long chain. What we will mostly talk about are synthetic polymers. So these are the polymers that are man-made. And it turns out that they're mostly organic in composition. And I just gave you a couple of examples. So again, most of them are composed of hydrocarbons. They can have other elements, but again, mostly carbon and hydrogen. So one example that they would like to give you is ethylene. So the ethylene itself are two carbon atoms that they're connected among each other, and then each is surrounded by two hydrogen atoms. So this is a monomer, ethylene. if I make a polymer out of the structural unit, I will end up in polyethylene. So you've probably heard about this particular polymer. And its composition would be it is as follows. So you would, again, have carbon atoms that they're connected among each other. And they're surrounded by hydrogen atoms. And there would be many, many of them connected among each other. And again this would be my structural unit, or this would be my monomer. So the polyethylene would be, again, how I would typically write this is would be CH2 CH2, et cetera. And there would be n of them. And this n can be arbitrary. So we will see that there can be polyethylene polymers that are relatively short in the chain length, but some of them are relatively long. Another example would be vinyl chloride, or PVC in the polymer phase. So the vinyl chloride, again, the structure of the PVC would be that, again, you have carbon atoms that are connected among each other. You have hydrogen atoms that is surrounding one, but one has a chlorine atom. And this would be a monomer. And there would be, again, a number or n of these individual monitor units that would be connected among each other. And again, how we typically present this polymers is, again, we have individual units, or monomers, that are connected among each other in a relatively long chain. So this would be a relatively low molecular weight polymer, meaning that each polymer chain is relatively short. Or this would represent the high molecular weight polymer, meaning that the number of the monomer units is relatively high. So do you happen to know about what is the number of monomers in a typical polymer? What would be your guess? Here of we are drawing maybe 10 of them or maybe 30 of them. Yes? A couple thousands. Couple of thousands, that's right. So just to illustrate that fact, the molecular weight, typical molecular weight of a polymer would be, let's say, 10 to the fourth up to 10 to 15 grams per mole. And the molecular weight of an individual ethylene units would be C2 H2 is 28 grams per mole. So you can see that in individual polymer unit can have thousands and thousands of these individual monomer units. So these are very, very long chains. So how do we understand the structure of these materials when there are a number and number of these chains that are somehow forming the solid material? So to understand that we will represent polymers in a form that is shown here. So in other words, just to understand what this image here represents, if this was an example or representation of a polymer chain right-- these are just paper clips that they clip together-- if this is my monument, this would be a polymer chain. So if you have a material, if you have a solid material, if you have a piece of a polymer in the solid form, it's very, very unlikely, almost impossible to have this in a crystalline form where all of the chains are aligned like this. And they are periodically arranged in space. How this polymer units or polymer chains actually look like in this polymer is that they're somehow they form this type of a structure. So they are somehow clumped together, or they form as something that looks like a mess. So the question that we are trying to answer and that we will try to answer in the next couple of minutes is, how do we describe that mess? How do I describe whether the extension of this chain will be like this, or perhaps this chain will collapse completely like this? And this will strongly depend on the environment. For example, if you have a polymer in a specific solvent, how it behaves in that solvent and how far this chain extends in space will strongly depend on the interaction of that polymer with the solvent. But the main idea is that we are trying to quantify how far in space that chain expands. And to do that, we will use this random walk model that I will try to explain in the next couple of minutes. So the random walk model simply describes a set of steps that each monomer is taking. So this particular image shows a very, very long chain. And each individual component of this chain is a single monomer. So we are trying to quantify how this polymer chain behaves in space. So what we're doing is that we are describing a random walk model in which we are trying to make steps of individual monomers units, and we are trying to understand how they arrange in space. So you might be familiar with the random walk model, for example, from Brownian motion. So if you think about Brownian motion or how particles move in different liquids, you would use this random walk model. So it's a similar way how we describe, for example, diffusion of the atoms, et cetera. So one way to think about this is to have so-called a lattice random walk model, in which each unit, monomer unit is taking a step. So this arrow here will represent one monomer. So I'm going from the starting position to the end position of the monomer. And the lattice this random walk model would assume that each of these monomer units is making a specific steps in lattice. So this would be an example of a specific structure where, again, the lattice and the angle, where the length of this arrow, the monomer size, and the angle are fixed. So the angle is 90 degrees always. So in the lattice random walk model, the length of each step and the angle are fixed. And this would explain very well diffusion within a material-- So when you assume that each step has a very well-defined length and a very well-defined angle. On the other hand, in polymers, this angle is not necessarily fixed. So if I have one monomer unit, there is no reason to believe that the next monomer unit will be 90 degrees relatively to that first step. So we will develop something that is called variable angle of random walk model. So this is the variable angle of a random walk. Again, we are assuming that each step is, of the same length, which we'll call l. So the next monomer unit has the same length l, but it can have any angle relative to the first one. And so in this particular case, the length is fixed, but the angle is random. And this would be a very good example of a random walk model applied to polymers. ",
|
|
199
|
+
content_title: "",
|
|
200
|
+
content_author: null,
|
|
201
|
+
content_language: null,
|
|
202
|
+
image_src: null,
|
|
203
|
+
resource_id: "5124",
|
|
204
|
+
resource_readable_id: "course-v1:MITxT+3.012Sx",
|
|
205
|
+
course_number: ["course-v1:MITxT+3.012Sx"],
|
|
206
|
+
file_type: null,
|
|
207
|
+
file_extension: ".srt",
|
|
208
|
+
offered_by: {
|
|
209
|
+
code: "mitx",
|
|
210
|
+
name: "MITx",
|
|
211
|
+
channel_url: "https://rc.learn.mit.edu/c/unit/mitx/",
|
|
212
|
+
},
|
|
213
|
+
platform: {
|
|
214
|
+
code: "mitxonline",
|
|
215
|
+
name: "MITx Online",
|
|
216
|
+
},
|
|
217
|
+
run_readable_id: "course-v1:MITxT+3.012Sx+3T2024",
|
|
218
|
+
edx_module_id: "asset-v1:MITxT+3.012Sx+3T2024+type@asset+block@0cc53e11-1f91-4ed8-8bab-0d873db8cb90-en.srt",
|
|
219
|
+
summary: 'The video discusses polymers, a class of materials composed of long chains of interconnected structural units or monomers. Key points include:\n\n1. **Definition and Structure**: Polymers consist of many repeating units, which can be identical or different. They can be naturally occurring (like cotton and DNA) or synthetic (like polyethylene and PVC).\n\n2. **Monomers and Polymers**: Monomers are the individual units that make up polymers. For example, ethylene is a monomer that forms polyethylene when linked together. The molecular weight of polymers can be very high, often ranging from 10,000 to 10^15 grams per mole.\n\n3. **Random Walk Model**: This model is introduced to understand the structure and behavior of polymers in different environments. It describes how individual monomers take steps in space, akin to Brownian motion. \n\n4. **Lattice Random Walk vs. Variable Angle Random Walk**: The lattice model assumes fixed step lengths and angles, while the variable angle model allows for random angles between steps, better representing the behavior of polymer chains.\n\n5. **Impact of Environment**: The extension and arrangement of polymer chains depend on their interactions with solvents and environmental conditions, leading to a "messy" structure rather than a crystalline form.\n\nOverall, the video emphasizes the complexity and variability in the structure and behavior of polymers, which can be modeled using random walk principles.',
|
|
220
|
+
flashcards: [
|
|
221
|
+
{
|
|
222
|
+
answer: "The main topic is about polymers and their structure, particularly the random walk model.",
|
|
223
|
+
question: "What is the main topic discussed in the transcript regarding materials?",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
answer: "Polymers are materials composed of individual units connected to form long chains, derived from the Latin term meaning 'many parts or units'.",
|
|
227
|
+
question: "What does the term 'polymers' mean?",
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
answer: "Examples of naturally occurring polymers include cotton, leather, rubber, and wool.",
|
|
231
|
+
question: "Can you name some naturally occurring polymers mentioned in the transcript?",
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
answer: "Synthetic polymers are man-made polymers, mostly organic in composition, primarily composed of hydrocarbons.",
|
|
235
|
+
question: "What is a synthetic polymer?",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
answer: "The monomer for polyethylene is ethylene, which consists of two carbon atoms connected to each other, each surrounded by two hydrogen atoms.",
|
|
239
|
+
question: "What is the monomer for polyethylene?",
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
answer: "The typical molecular weight of a polymer ranges from 10^4 to 10^15 grams per mole.",
|
|
243
|
+
question: "What is the typical molecular weight range for polymers?",
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
answer: "The random walk model helps to describe how polymer chains behave in space and their arrangement in different environments.",
|
|
247
|
+
question: "What does the random walk model help to describe in polymers?",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
answer: "In the lattice random walk model, each step has a fixed length and angle (90 degrees), while in the variable angle random walk model, the length is fixed but the angle can vary.",
|
|
251
|
+
question: "How does the lattice random walk model differ from the variable angle random walk model?",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
answer: "An example of a polymer derived from vinyl chloride is PVC (polyvinyl chloride).",
|
|
255
|
+
question: "What is an example of a polymer mentioned that is derived from vinyl chloride?",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
answer: "The interactions of polymers with solvents strongly influence how far the polymer chain extends in space.",
|
|
259
|
+
question: "How do the interactions of polymers with solvents affect their behavior?",
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
};
|