@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.
Files changed (243) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +31 -0
  3. package/dist/bundles/remoteTutorDrawer.es.js +38347 -0
  4. package/dist/bundles/remoteTutorDrawer.umd.js +207 -0
  5. package/dist/cjs/ai.d.ts +3 -0
  6. package/dist/cjs/ai.js +5 -0
  7. package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
  8. package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.js +87 -0
  9. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +57 -0
  10. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +276 -0
  11. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
  12. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +283 -0
  13. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
  14. package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +241 -0
  15. package/dist/cjs/bundles/remoteTutorDrawer.d.ts +7 -0
  16. package/dist/cjs/bundles/remoteTutorDrawer.js +40 -0
  17. package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
  18. package/dist/cjs/components/AiChat/AiChat.js +247 -0
  19. package/dist/cjs/components/AiChat/AiChat.stories.d.ts +21 -0
  20. package/dist/cjs/components/AiChat/AiChat.stories.js +243 -0
  21. package/dist/cjs/components/AiChat/AiChat.test.d.ts +1 -0
  22. package/dist/cjs/components/AiChat/AiChat.test.js +211 -0
  23. package/dist/cjs/components/AiChat/ChatTitle.d.ts +8 -0
  24. package/dist/cjs/components/AiChat/ChatTitle.js +43 -0
  25. package/dist/cjs/components/AiChat/EntryScreen.d.ts +11 -0
  26. package/dist/cjs/components/AiChat/EntryScreen.js +123 -0
  27. package/dist/cjs/components/AiChat/TimLogo.d.ts +5 -0
  28. package/dist/cjs/components/AiChat/TimLogo.js +15 -0
  29. package/dist/cjs/components/AiChat/test-utils/api.d.ts +2 -0
  30. package/dist/cjs/components/AiChat/test-utils/api.js +125 -0
  31. package/dist/cjs/components/AiChat/types.d.ts +82 -0
  32. package/dist/cjs/components/AiChat/types.js +3 -0
  33. package/dist/cjs/components/AiChat/utils.d.ts +9 -0
  34. package/dist/cjs/components/AiChat/utils.js +41 -0
  35. package/dist/cjs/components/Alert/Alert.d.ts +15 -0
  36. package/dist/cjs/components/Alert/Alert.js +62 -0
  37. package/dist/cjs/components/Alert/Alert.stories.d.ts +8 -0
  38. package/dist/cjs/components/Alert/Alert.stories.js +53 -0
  39. package/dist/cjs/components/Button/ActionButton.d.ts +30 -0
  40. package/dist/cjs/components/Button/ActionButton.js +73 -0
  41. package/dist/cjs/components/Button/ActionButton.stories.d.ts +15 -0
  42. package/dist/cjs/components/Button/ActionButton.stories.js +113 -0
  43. package/dist/cjs/components/Button/Button.d.ts +54 -0
  44. package/dist/cjs/components/Button/Button.js +240 -0
  45. package/dist/cjs/components/Button/Button.stories.d.ts +17 -0
  46. package/dist/cjs/components/Button/Button.stories.js +135 -0
  47. package/dist/cjs/components/Button/Button.test.d.ts +1 -0
  48. package/dist/cjs/components/Button/Button.test.js +46 -0
  49. package/dist/cjs/components/ImageAdapter/ImageAdapter.d.ts +23 -0
  50. package/dist/cjs/components/ImageAdapter/ImageAdapter.js +30 -0
  51. package/dist/cjs/components/Input/Input.d.ts +116 -0
  52. package/dist/cjs/components/Input/Input.js +237 -0
  53. package/dist/cjs/components/Input/Input.stories.d.ts +19 -0
  54. package/dist/cjs/components/Input/Input.stories.js +135 -0
  55. package/dist/cjs/components/Input/Input.test.d.ts +1 -0
  56. package/dist/cjs/components/Input/Input.test.js +32 -0
  57. package/dist/cjs/components/LinkAdapter/LinkAdapter.d.ts +23 -0
  58. package/dist/cjs/components/LinkAdapter/LinkAdapter.js +34 -0
  59. package/dist/cjs/components/ScrollSnap/ScrollSnap.d.ts +19 -0
  60. package/dist/cjs/components/ScrollSnap/ScrollSnap.js +59 -0
  61. package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
  62. package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.js +43 -0
  63. package/dist/cjs/components/ScrollSnap/useScrollSnap.d.ts +6 -0
  64. package/dist/cjs/components/ScrollSnap/useScrollSnap.js +36 -0
  65. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
  66. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.js +43 -0
  67. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
  68. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.js +44 -0
  69. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
  70. package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.js +62 -0
  71. package/dist/cjs/components/TabButtons/TabButtonList.d.ts +25 -0
  72. package/dist/cjs/components/TabButtons/TabButtonList.js +97 -0
  73. package/dist/cjs/components/TabButtons/TabButtonList.stories.d.ts +24 -0
  74. package/dist/cjs/components/TabButtons/TabButtonList.stories.js +139 -0
  75. package/dist/cjs/components/TextField/TextField.d.ts +29 -0
  76. package/dist/cjs/components/TextField/TextField.js +33 -0
  77. package/dist/cjs/components/TextField/TextField.stories.d.ts +10 -0
  78. package/dist/cjs/components/TextField/TextField.stories.js +136 -0
  79. package/dist/cjs/components/TextField/TextField.test.d.ts +1 -0
  80. package/dist/cjs/components/TextField/TextField.test.js +77 -0
  81. package/dist/cjs/components/ThemeProvider/ThemeProvider.d.ts +21 -0
  82. package/dist/cjs/components/ThemeProvider/ThemeProvider.js +86 -0
  83. package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
  84. package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.js +102 -0
  85. package/dist/cjs/components/ThemeProvider/Typography.stories.d.ts +39 -0
  86. package/dist/cjs/components/ThemeProvider/Typography.stories.js +65 -0
  87. package/dist/cjs/components/ThemeProvider/breakpoints.d.ts +4 -0
  88. package/dist/cjs/components/ThemeProvider/breakpoints.js +19 -0
  89. package/dist/cjs/components/ThemeProvider/buttons.d.ts +7 -0
  90. package/dist/cjs/components/ThemeProvider/buttons.js +20 -0
  91. package/dist/cjs/components/ThemeProvider/chips.d.ts +3 -0
  92. package/dist/cjs/components/ThemeProvider/chips.js +154 -0
  93. package/dist/cjs/components/ThemeProvider/colors.d.ts +32 -0
  94. package/dist/cjs/components/ThemeProvider/colors.js +35 -0
  95. package/dist/cjs/components/ThemeProvider/typography.d.ts +18 -0
  96. package/dist/cjs/components/ThemeProvider/typography.js +173 -0
  97. package/dist/cjs/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
  98. package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js +33 -0
  99. package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
  100. package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.js +13 -0
  101. package/dist/cjs/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
  102. package/dist/cjs/components/internal/FormHelpers/FormHelpers.js +78 -0
  103. package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
  104. package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.js +93 -0
  105. package/dist/cjs/index.d.ts +16 -0
  106. package/dist/cjs/index.js +30 -0
  107. package/dist/cjs/jest-setup.d.ts +1 -0
  108. package/dist/cjs/jest-setup.js +18 -0
  109. package/dist/cjs/jsdom-extended.d.ts +6 -0
  110. package/dist/cjs/jsdom-extended.js +14 -0
  111. package/dist/cjs/story-utils/index.d.ts +6 -0
  112. package/dist/cjs/story-utils/index.js +17 -0
  113. package/dist/cjs/utils/composeRefs.d.ts +7 -0
  114. package/dist/cjs/utils/composeRefs.js +20 -0
  115. package/dist/cjs/utils/composeRefs.test.d.ts +1 -0
  116. package/dist/cjs/utils/composeRefs.test.js +19 -0
  117. package/dist/cjs/utils/useDevCheckStable.d.ts +8 -0
  118. package/dist/cjs/utils/useDevCheckStable.js +29 -0
  119. package/dist/cjs/utils/useInterval.d.ts +7 -0
  120. package/dist/cjs/utils/useInterval.js +25 -0
  121. package/dist/esm/ai.d.ts +3 -0
  122. package/dist/esm/ai.js +1 -0
  123. package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
  124. package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.js +83 -0
  125. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +57 -0
  126. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +273 -0
  127. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
  128. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +280 -0
  129. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
  130. package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +239 -0
  131. package/dist/esm/bundles/remoteTutorDrawer.d.ts +7 -0
  132. package/dist/esm/bundles/remoteTutorDrawer.js +37 -0
  133. package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
  134. package/dist/esm/components/AiChat/AiChat.js +244 -0
  135. package/dist/esm/components/AiChat/AiChat.stories.d.ts +21 -0
  136. package/dist/esm/components/AiChat/AiChat.stories.js +240 -0
  137. package/dist/esm/components/AiChat/AiChat.test.d.ts +1 -0
  138. package/dist/esm/components/AiChat/AiChat.test.js +209 -0
  139. package/dist/esm/components/AiChat/ChatTitle.d.ts +8 -0
  140. package/dist/esm/components/AiChat/ChatTitle.js +40 -0
  141. package/dist/esm/components/AiChat/EntryScreen.d.ts +11 -0
  142. package/dist/esm/components/AiChat/EntryScreen.js +120 -0
  143. package/dist/esm/components/AiChat/TimLogo.d.ts +5 -0
  144. package/dist/esm/components/AiChat/TimLogo.js +13 -0
  145. package/dist/esm/components/AiChat/test-utils/api.d.ts +2 -0
  146. package/dist/esm/components/AiChat/test-utils/api.js +122 -0
  147. package/dist/esm/components/AiChat/types.d.ts +82 -0
  148. package/dist/esm/components/AiChat/types.js +2 -0
  149. package/dist/esm/components/AiChat/utils.d.ts +9 -0
  150. package/dist/esm/components/AiChat/utils.js +38 -0
  151. package/dist/esm/components/Alert/Alert.d.ts +15 -0
  152. package/dist/esm/components/Alert/Alert.js +59 -0
  153. package/dist/esm/components/Alert/Alert.stories.d.ts +8 -0
  154. package/dist/esm/components/Alert/Alert.stories.js +50 -0
  155. package/dist/esm/components/Button/ActionButton.d.ts +30 -0
  156. package/dist/esm/components/Button/ActionButton.js +68 -0
  157. package/dist/esm/components/Button/ActionButton.stories.d.ts +15 -0
  158. package/dist/esm/components/Button/ActionButton.stories.js +110 -0
  159. package/dist/esm/components/Button/Button.d.ts +54 -0
  160. package/dist/esm/components/Button/Button.js +232 -0
  161. package/dist/esm/components/Button/Button.stories.d.ts +17 -0
  162. package/dist/esm/components/Button/Button.stories.js +132 -0
  163. package/dist/esm/components/Button/Button.test.d.ts +1 -0
  164. package/dist/esm/components/Button/Button.test.js +44 -0
  165. package/dist/esm/components/ImageAdapter/ImageAdapter.d.ts +23 -0
  166. package/dist/esm/components/ImageAdapter/ImageAdapter.js +27 -0
  167. package/dist/esm/components/Input/Input.d.ts +116 -0
  168. package/dist/esm/components/Input/Input.js +232 -0
  169. package/dist/esm/components/Input/Input.stories.d.ts +19 -0
  170. package/dist/esm/components/Input/Input.stories.js +132 -0
  171. package/dist/esm/components/Input/Input.test.d.ts +1 -0
  172. package/dist/esm/components/Input/Input.test.js +30 -0
  173. package/dist/esm/components/LinkAdapter/LinkAdapter.d.ts +23 -0
  174. package/dist/esm/components/LinkAdapter/LinkAdapter.js +31 -0
  175. package/dist/esm/components/ScrollSnap/ScrollSnap.d.ts +19 -0
  176. package/dist/esm/components/ScrollSnap/ScrollSnap.js +56 -0
  177. package/dist/esm/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
  178. package/dist/esm/components/ScrollSnap/ScrollSnap.stories.js +40 -0
  179. package/dist/esm/components/ScrollSnap/useScrollSnap.d.ts +6 -0
  180. package/dist/esm/components/ScrollSnap/useScrollSnap.js +33 -0
  181. package/dist/esm/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
  182. package/dist/esm/components/SrAnnouncer/SrAnnouncer.js +40 -0
  183. package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
  184. package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.js +41 -0
  185. package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
  186. package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.js +60 -0
  187. package/dist/esm/components/TabButtons/TabButtonList.d.ts +25 -0
  188. package/dist/esm/components/TabButtons/TabButtonList.js +92 -0
  189. package/dist/esm/components/TabButtons/TabButtonList.stories.d.ts +24 -0
  190. package/dist/esm/components/TabButtons/TabButtonList.stories.js +136 -0
  191. package/dist/esm/components/TextField/TextField.d.ts +29 -0
  192. package/dist/esm/components/TextField/TextField.js +30 -0
  193. package/dist/esm/components/TextField/TextField.stories.d.ts +10 -0
  194. package/dist/esm/components/TextField/TextField.stories.js +133 -0
  195. package/dist/esm/components/TextField/TextField.test.d.ts +1 -0
  196. package/dist/esm/components/TextField/TextField.test.js +75 -0
  197. package/dist/esm/components/ThemeProvider/ThemeProvider.d.ts +21 -0
  198. package/dist/esm/components/ThemeProvider/ThemeProvider.js +82 -0
  199. package/dist/esm/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
  200. package/dist/esm/components/ThemeProvider/ThemeProvider.stories.js +99 -0
  201. package/dist/esm/components/ThemeProvider/Typography.stories.d.ts +39 -0
  202. package/dist/esm/components/ThemeProvider/Typography.stories.js +62 -0
  203. package/dist/esm/components/ThemeProvider/breakpoints.d.ts +4 -0
  204. package/dist/esm/components/ThemeProvider/breakpoints.js +15 -0
  205. package/dist/esm/components/ThemeProvider/buttons.d.ts +7 -0
  206. package/dist/esm/components/ThemeProvider/buttons.js +17 -0
  207. package/dist/esm/components/ThemeProvider/chips.d.ts +3 -0
  208. package/dist/esm/components/ThemeProvider/chips.js +151 -0
  209. package/dist/esm/components/ThemeProvider/colors.d.ts +32 -0
  210. package/dist/esm/components/ThemeProvider/colors.js +32 -0
  211. package/dist/esm/components/ThemeProvider/typography.d.ts +18 -0
  212. package/dist/esm/components/ThemeProvider/typography.js +167 -0
  213. package/dist/esm/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
  214. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +30 -0
  215. package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
  216. package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.js +10 -0
  217. package/dist/esm/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
  218. package/dist/esm/components/internal/FormHelpers/FormHelpers.js +73 -0
  219. package/dist/esm/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
  220. package/dist/esm/components/internal/FormHelpers/FormHelpers.test.js +91 -0
  221. package/dist/esm/index.d.ts +16 -0
  222. package/dist/esm/index.js +11 -0
  223. package/dist/esm/jest-setup.d.ts +1 -0
  224. package/dist/esm/jest-setup.js +16 -0
  225. package/dist/esm/jsdom-extended.d.ts +6 -0
  226. package/dist/esm/jsdom-extended.js +12 -0
  227. package/dist/esm/story-utils/index.d.ts +6 -0
  228. package/dist/esm/story-utils/index.js +13 -0
  229. package/dist/esm/utils/composeRefs.d.ts +7 -0
  230. package/dist/esm/utils/composeRefs.js +17 -0
  231. package/dist/esm/utils/composeRefs.test.d.ts +1 -0
  232. package/dist/esm/utils/composeRefs.test.js +17 -0
  233. package/dist/esm/utils/useDevCheckStable.d.ts +8 -0
  234. package/dist/esm/utils/useDevCheckStable.js +26 -0
  235. package/dist/esm/utils/useInterval.d.ts +7 -0
  236. package/dist/esm/utils/useInterval.js +22 -0
  237. package/dist/tsconfig.tsbuildinfo +1 -0
  238. package/dist/type-augmentation/TypescriptDocs.mdx +17 -0
  239. package/dist/type-augmentation/imports.d.ts +3 -0
  240. package/dist/type-augmentation/index.d.ts +3 -0
  241. package/dist/type-augmentation/theme.d.ts +105 -0
  242. package/dist/type-augmentation/typography.d.ts +54 -0
  243. package/package.json +155 -0
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden";
3
+ import { useEffect } from "react";
4
+ import { useDevCheckStable } from "../../utils/useDevCheckStable";
5
+ const DEFAULT_PROPS = {
6
+ loadingMessages: [
7
+ { delay: 1500, text: "Loading" },
8
+ { delay: 4000, text: "Still loading" },
9
+ ],
10
+ };
11
+ /**
12
+ * A component that announces messages to screen readers as they come in.
13
+ */
14
+ const SrAnnouncer = ({ message, isLoading, loadingMessages = DEFAULT_PROPS.loadingMessages, }) => {
15
+ var _a;
16
+ const [loadingMsgIndex, setLoadingMsgIndex] = React.useState(-1);
17
+ /**
18
+ * If loadingMessages changes, the timeouts are reset.
19
+ * Desirable if the change is real, undesirable if it's a mistake (e.g., by
20
+ * passing an array literal as a prop).
21
+ */
22
+ useDevCheckStable(loadingMessages, "SrAnnouncer: loadingMessages changed (by ===) unexpectedly. This may interfere with loading message visibility");
23
+ useEffect(() => {
24
+ setLoadingMsgIndex(-1);
25
+ }, [isLoading, loadingMessages]);
26
+ useEffect(() => {
27
+ const next = loadingMessages[loadingMsgIndex + 1];
28
+ if (!isLoading || !next)
29
+ return () => { };
30
+ const id = setTimeout(() => {
31
+ setLoadingMsgIndex(loadingMsgIndex + 1);
32
+ }, next.delay);
33
+ return () => {
34
+ clearTimeout(id);
35
+ };
36
+ }, [isLoading, loadingMsgIndex, loadingMessages]);
37
+ const loadingTxt = (_a = loadingMessages[loadingMsgIndex]) === null || _a === void 0 ? void 0 : _a.text;
38
+ return (React.createElement(VisuallyHidden, { "aria-atomic": "true", "aria-live": "polite" }, isLoading ? loadingTxt : message));
39
+ };
40
+ export { SrAnnouncer };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { SrAnnouncer } from "./SrAnnouncer";
3
+ declare const meta: Meta<typeof SrAnnouncer>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SrAnnouncer>;
6
+ export declare const ScreenreaderAnnouncements: Story;
@@ -0,0 +1,41 @@
1
+ import * as React from "react";
2
+ import { SrAnnouncer } from "./SrAnnouncer";
3
+ import styled from "@emotion/styled";
4
+ const Container = styled.div(({ forceVisible }) => [
5
+ forceVisible && {
6
+ width: "100% !important",
7
+ height: "100px !important",
8
+ "& > *:first-of-type": {
9
+ width: "unset !important",
10
+ height: "unset !important",
11
+ clipPath: "none !important",
12
+ clip: "unset !important",
13
+ position: "unset !important",
14
+ },
15
+ },
16
+ ]);
17
+ const meta = {
18
+ title: "smoot-design/ScreenreaderAnnouncer",
19
+ component: SrAnnouncer,
20
+ decorators: function Decorator(Story) {
21
+ const [forceVisible, setForceVisible] = React.useState(true);
22
+ return (React.createElement(React.Fragment, null,
23
+ React.createElement("label", null,
24
+ "Force Visible:",
25
+ React.createElement("input", { type: "checkbox", checked: forceVisible, onChange: (e) => setForceVisible(e.target.checked) }),
26
+ React.createElement("p", null, "By default, the content of this story is visually hidden.")),
27
+ React.createElement("hr", null),
28
+ React.createElement(Container, { forceVisible: forceVisible },
29
+ React.createElement(Story, null))));
30
+ },
31
+ args: {
32
+ message: "A message to read to user",
33
+ isLoading: true,
34
+ loadingMessages: [
35
+ { delay: 1000, text: "Loading" },
36
+ { delay: 3000, text: "Still loading" },
37
+ ],
38
+ },
39
+ };
40
+ export default meta;
41
+ export const ScreenreaderAnnouncements = {};
@@ -0,0 +1,60 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import * as React from "react";
11
+ import { render, act } from "@testing-library/react";
12
+ import { SrAnnouncer } from "./SrAnnouncer";
13
+ const sleep = (ms) => {
14
+ act(() => {
15
+ jest.advanceTimersByTime(ms);
16
+ });
17
+ };
18
+ describe("SrAnnouncer", () => {
19
+ beforeEach(() => {
20
+ jest.useFakeTimers();
21
+ jest.clearAllTimers();
22
+ });
23
+ test("Renders a message when not loading", () => {
24
+ const { container } = render(React.createElement(SrAnnouncer, { message: "Hello, world!", isLoading: false }));
25
+ expect(container.textContent).toBe("Hello, world!");
26
+ });
27
+ test("Renders a loading message when loading", () => __awaiter(void 0, void 0, void 0, function* () {
28
+ const loadingMessages = [
29
+ { delay: 100, text: "Loading 1" },
30
+ { delay: 200, text: "Loading 2" },
31
+ ];
32
+ const { container, rerender } = render(React.createElement(SrAnnouncer, { message: "Hello, world!", loadingMessages: loadingMessages, isLoading: true }));
33
+ expect(container.textContent).toBe("");
34
+ sleep(100);
35
+ expect(container.textContent).toBe("Loading 1");
36
+ sleep(100);
37
+ expect(container.textContent).toBe("Loading 1");
38
+ sleep(100);
39
+ expect(container.textContent).toBe("Loading 2");
40
+ sleep(1000);
41
+ expect(container.textContent).toBe("Loading 2");
42
+ rerender(React.createElement(SrAnnouncer, { message: "Hello, world!", loadingMessages: loadingMessages, isLoading: false }));
43
+ expect(container.textContent).toBe("Hello, world!");
44
+ rerender(React.createElement(SrAnnouncer, { message: "Hello, world!", loadingMessages: loadingMessages, isLoading: true }));
45
+ expect(container.textContent).toBe("");
46
+ sleep(100);
47
+ expect(container.textContent).toBe("Loading 1");
48
+ sleep(100);
49
+ expect(container.textContent).toBe("Loading 1");
50
+ sleep(100);
51
+ expect(container.textContent).toBe("Loading 2");
52
+ }));
53
+ test("Warns if loadingMessages changes unexpectedly", () => {
54
+ const error = jest.spyOn(console, "error").mockImplementation(() => { });
55
+ const { rerender } = render(React.createElement(SrAnnouncer, { message: "Hello, world!", isLoading: true }));
56
+ rerender(React.createElement(SrAnnouncer, { message: "Hello, world!", isLoading: true, loadingMessages: [{ delay: 100, text: "Loading" }] }));
57
+ expect(error).toHaveBeenCalled();
58
+ error.mockRestore();
59
+ });
60
+ });
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+ import type { TabProps } from "@mui/material/Tab";
3
+ import type { TabListProps } from "@mui/lab/TabList";
4
+ import type { ButtonLinkProps } from "../Button/Button";
5
+ type StyleVariant = "chat";
6
+ type TabButtonListProps = TabListProps & {
7
+ styleVariant?: StyleVariant;
8
+ };
9
+ declare const TabButtonList: React.FC<TabButtonListProps>;
10
+ declare const TabLinkInner: React.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
11
+ type TabButtonProps = Omit<TabProps<"button">, "color"> & {
12
+ styleVariant?: StyleVariant;
13
+ };
14
+ /**
15
+ * Wrapper around [MUI Tab](https://mui.com/material-ui/api/tab/) using our
16
+ * Button as the `component` implementation.
17
+ */
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
+ */
23
+ declare const TabButtonLink: ({ ...props }: TabProps<typeof TabLinkInner>) => React.JSX.Element;
24
+ export { TabButtonList, TabButton, TabButtonLink };
25
+ export type { TabButtonListProps, TabButtonProps };
@@ -0,0 +1,92 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import * as React from "react";
13
+ import MuiTab from "@mui/material/Tab";
14
+ import MuiTabList from "@mui/lab/TabList";
15
+ import styled from "@emotion/styled";
16
+ import { Button, ButtonLink } from "../Button/Button";
17
+ import { css } from "@emotion/react";
18
+ const defaultTabListProps = {
19
+ variant: "scrollable",
20
+ allowScrollButtonsMobile: true,
21
+ scrollButtons: "auto",
22
+ };
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": {
27
+ display: "none",
28
+ }, ".MuiTabs-flexContainer": {
29
+ gap: "8px",
30
+ alignItems: "center",
31
+ }, ".MuiTabs-scroller": {
32
+ display: "flex",
33
+ } }, (styleVariant === "chat" && {
34
+ flexGrow: 1,
35
+ ".MuiTabs-flexContainer": {
36
+ flexGrow: 1,
37
+ gap: "8px",
38
+ alignItems: "center",
39
+ backgroundColor: theme.custom.colors.lightGray1,
40
+ padding: "4px",
41
+ borderRadius: "8px",
42
+ },
43
+ button: Object.assign({ flexGrow: 1, backgroundColor: "transparent" }, theme.typography.body2),
44
+ "button[aria-selected=true], button[aria-selected=true]:hover": {
45
+ backgroundColor: theme.custom.colors.darkGray1,
46
+ color: theme.custom.colors.white,
47
+ cursor: "default",
48
+ },
49
+ }))));
50
+ const tabStyles = ({ theme }) => css({
51
+ minWidth: "auto",
52
+ ":focus-visible": {
53
+ outlineOffset: "-1px",
54
+ },
55
+ '&[aria-selected="true"]': {
56
+ backgroundColor: theme.custom.colors.white,
57
+ borderColor: theme.custom.colors.darkGray2,
58
+ },
59
+ });
60
+ const TabButtonStyled = styled(Button)(tabStyles);
61
+ const TabLinkStyled = styled(ButtonLink)(tabStyles);
62
+ const defaultTabButtonProps = {
63
+ variant: "tertiary",
64
+ size: "small",
65
+ };
66
+ const TabButtonInner = React.forwardRef(
67
+ // Omits the `className` prop from the underlying Button so that MUI does not
68
+ // style it. We style it ourselves.
69
+ (props, ref) => {
70
+ const { className } = props, others = __rest(props, ["className"]);
71
+ return React.createElement(TabButtonStyled, Object.assign({}, defaultTabButtonProps, others, { ref: ref }));
72
+ });
73
+ TabButtonInner.displayName = "TabButtonInner";
74
+ const TabLinkInner = React.forwardRef((props, ref) => {
75
+ const { className } = props, others = __rest(props, ["className"]);
76
+ return React.createElement(TabLinkStyled, Object.assign({}, defaultTabButtonProps, others, { ref: ref }));
77
+ });
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
+ */
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
+ */
88
+ const TabButtonLink = (_a) => {
89
+ var props = __rest(_a, []);
90
+ return (React.createElement(MuiTab, Object.assign({}, props, { component: TabLinkInner })));
91
+ };
92
+ export { TabButtonList, TabButton, TabButtonLink };
@@ -0,0 +1,24 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import type { TabButtonListProps } from "./TabButtonList";
3
+ type StoryProps = TabButtonListProps & {
4
+ count: number;
5
+ };
6
+ declare const meta: Meta<StoryProps>;
7
+ export default meta;
8
+ type Story = StoryObj<StoryProps>;
9
+ /**
10
+ * Use `TabButtonList` and `TabButton` to render a list of tabs styled as our tertiary buttons:
11
+ */
12
+ export declare const ButtonTabs: Story;
13
+ /**
14
+ * `TabButtonList` chat style variant:
15
+ */
16
+ export declare const ButtonTabsChatVariant: Story;
17
+ /**
18
+ * By default, the tabs will be scrollable if there are too many to fit in the container:
19
+ */
20
+ export declare const ManyButtonTabs: Story;
21
+ /**
22
+ * Use `TabButtonLink` for tabs that should affect the URL:
23
+ */
24
+ export declare const LinkTabs: Story;
@@ -0,0 +1,136 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ /* eslint-disable react-hooks/rules-of-hooks */
13
+ import * as React from "react";
14
+ import { useState } from "react";
15
+ import { TabButtonList, TabButton, TabButtonLink } from "./TabButtonList";
16
+ import TabContext from "@mui/lab/TabContext";
17
+ import { Button } from "../Button/Button";
18
+ import Stack from "@mui/material/Stack";
19
+ import TabPanel from "@mui/lab/TabPanel";
20
+ import Typography from "@mui/material/Typography";
21
+ import { faker } from "@faker-js/faker/locale/en";
22
+ import Container from "@mui/material/Container";
23
+ const meta = {
24
+ title: "smoot-design/TabButtons",
25
+ argTypes: {
26
+ variant: {
27
+ options: ["scrollable", "fullWidth", "standard"],
28
+ control: { type: "radio" },
29
+ },
30
+ styleVariant: {
31
+ options: ["default", "chat"],
32
+ control: { type: "radio" },
33
+ defaultValue: "default",
34
+ },
35
+ scrollButtons: {
36
+ options: ["auto", true, false],
37
+ control: { type: "radio" },
38
+ },
39
+ },
40
+ args: {
41
+ count: 4,
42
+ variant: "scrollable",
43
+ allowScrollButtonsMobile: true,
44
+ scrollButtons: "auto",
45
+ },
46
+ render: (_a) => {
47
+ var { count } = _a, others = __rest(_a, ["count"]);
48
+ const [value, setValue] = React.useState("tab1");
49
+ return (React.createElement(Container, { maxWidth: "sm" },
50
+ React.createElement(TabContext, { value: value },
51
+ React.createElement(Stack, { direction: "row" },
52
+ React.createElement(TabButtonList, Object.assign({}, others, { onChange: (_event, val) => setValue(val) }), Array(count)
53
+ .fill(null)
54
+ .map((_, i) => (React.createElement(TabButton, { key: `tab-${i}`, value: `tab${i + 1}`, label: `Tab ${i + 1}` })))),
55
+ React.createElement(Stack, { direction: "row", justifyContent: "end", sx: { paddingLeft: "16px" } },
56
+ React.createElement(Button, null, "Other UI"))),
57
+ Array(count)
58
+ .fill(null)
59
+ .map((_, i) => (React.createElement(TabPanel, { key: `tab-${i}`, value: `tab${i + 1}` },
60
+ React.createElement(Typography, { variant: "h4", component: "h4" },
61
+ "Header ",
62
+ i + 1),
63
+ faker.lorem.paragraphs(2)))))));
64
+ },
65
+ };
66
+ export default meta;
67
+ /**
68
+ * Use `TabButtonList` and `TabButton` to render a list of tabs styled as our tertiary buttons:
69
+ */
70
+ export const ButtonTabs = {};
71
+ /**
72
+ * `TabButtonList` chat style variant:
73
+ */
74
+ export const ButtonTabsChatVariant = {
75
+ args: {
76
+ styleVariant: "chat",
77
+ variant: "fullWidth",
78
+ visibleScrollbar: false,
79
+ },
80
+ render: (_a) => {
81
+ var { count } = _a, others = __rest(_a, ["count"]);
82
+ const [value, setValue] = React.useState("tab1");
83
+ return (React.createElement(Container, { maxWidth: "sm" },
84
+ React.createElement(TabContext, { value: value },
85
+ React.createElement(Stack, { direction: "row" },
86
+ React.createElement(TabButtonList, Object.assign({}, others, { onChange: (_event, val) => setValue(val) }), Array(count)
87
+ .fill(null)
88
+ .map((_, i) => (React.createElement(TabButton, { key: `tab-${i}`, value: `tab${i + 1}`, label: `Tab ${i + 1}` }))))),
89
+ Array(count)
90
+ .fill(null)
91
+ .map((_, i) => (React.createElement(TabPanel, { key: `tab-${i}`, value: `tab${i + 1}` },
92
+ React.createElement(Typography, { variant: "h4", component: "h4" },
93
+ "Header ",
94
+ i + 1),
95
+ faker.lorem.paragraphs(2)))))));
96
+ },
97
+ };
98
+ /**
99
+ * By default, the tabs will be scrollable if there are too many to fit in the container:
100
+ */
101
+ export const ManyButtonTabs = {
102
+ args: {
103
+ count: 12,
104
+ },
105
+ };
106
+ /**
107
+ * Use `TabButtonLink` for tabs that should affect the URL:
108
+ */
109
+ export const LinkTabs = {
110
+ parameters: {
111
+ nextjs: {
112
+ appDirectory: true,
113
+ navigation: {
114
+ pathname: "/#link2",
115
+ },
116
+ },
117
+ },
118
+ render: () => {
119
+ const [hash, setHash] = useState(() => window.location.hash);
120
+ React.useEffect(() => {
121
+ const handler = () => setHash(window.location.hash);
122
+ window.addEventListener("hashchange", handler);
123
+ return () => {
124
+ window.removeEventListener("hashchange", handler);
125
+ };
126
+ }, []);
127
+ return (React.createElement("div", null,
128
+ "Current Location:",
129
+ React.createElement("pre", null, hash),
130
+ React.createElement(TabContext, { value: hash },
131
+ React.createElement(TabButtonList, null,
132
+ React.createElement(TabButtonLink, { value: "#link1", href: "#link1", label: "Tab 1" }),
133
+ React.createElement(TabButtonLink, { value: "#link2", href: "#link2", label: "Tab 2" }),
134
+ React.createElement(TabButtonLink, { value: "#link3", href: "#link3", label: "Tab 3" })))));
135
+ },
136
+ };
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import type { InputProps } from "../Input/Input";
3
+ import type { FormFieldWrapperProps } from "../internal/FormHelpers/FormHelpers";
4
+ type TextFieldProps = Omit<FormFieldWrapperProps, "children"> & {
5
+ name: string;
6
+ disabled?: boolean;
7
+ value?: string | null;
8
+ size?: InputProps["size"];
9
+ placeholder?: string;
10
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
11
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
12
+ fullWidth?: boolean;
13
+ /**
14
+ * Props forwarded to root of `<Input />`
15
+ */
16
+ InputProps?: InputProps;
17
+ } & Pick<InputProps, "type" | "startAdornment" | "endAdornment" | "multiline" | "required" | "minRows" | "inputProps">;
18
+ /**
19
+ * A form field for text input. Supports labels, help text, error text, and
20
+ * start/end adornments. Add `multiline` for a text area.
21
+ *
22
+ * - [TextField Documentation](https://mitodl.github.io/smoot-design/https://mitodl.github.io/smoot-design/)
23
+ *
24
+ * **Note:** This component shares a name a purpose with MUI's TextField, but
25
+ * does not share its entire API.
26
+ */
27
+ declare const TextField: React.FC<TextFieldProps>;
28
+ export { TextField };
29
+ export type { TextFieldProps };
@@ -0,0 +1,30 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import * as React from "react";
13
+ import { Input } from "../Input/Input";
14
+ import { FormFieldWrapper } from "../internal/FormHelpers/FormHelpers";
15
+ /**
16
+ * A form field for text input. Supports labels, help text, error text, and
17
+ * start/end adornments. Add `multiline` for a text area.
18
+ *
19
+ * - [TextField Documentation](https://mitodl.github.io/smoot-design/https://mitodl.github.io/smoot-design/)
20
+ *
21
+ * **Note:** This component shares a name a purpose with MUI's TextField, but
22
+ * does not share its entire API.
23
+ */
24
+ const TextField = ({ label, size, value, name, placeholder, helpText, errorText, error, required, disabled, onChange, onBlur, multiline, type, startAdornment, endAdornment, minRows, className, id, InputProps, inputProps, fullWidth, }) => {
25
+ return (React.createElement(FormFieldWrapper, { id: id, label: label, required: required, helpText: helpText, error: error, errorText: errorText, className: className, fullWidth: fullWidth }, (_a) => {
26
+ var { labelId } = _a, childProps = __rest(_a, ["labelId"]);
27
+ return (React.createElement(Input, Object.assign({ size: size, value: value, name: name, placeholder: placeholder, onChange: onChange, onBlur: onBlur, multiline: multiline, type: type, startAdornment: startAdornment, endAdornment: endAdornment, minRows: minRows, disabled: disabled, inputProps: inputProps }, InputProps, childProps)));
28
+ }));
29
+ };
30
+ export { TextField };
@@ -0,0 +1,10 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { TextField } from "./TextField";
3
+ declare const meta: Meta<typeof TextField>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TextField>;
6
+ export declare const Simple: Story;
7
+ export declare const Sizes: Story;
8
+ export declare const Widths: Story;
9
+ export declare const Adornments: Story;
10
+ export declare const States: Story;
@@ -0,0 +1,133 @@
1
+ import * as React from "react";
2
+ import { TextField } from "./TextField";
3
+ import { AdornmentButton } from "../Input/Input";
4
+ import Stack from "@mui/material/Stack";
5
+ import Grid from "@mui/material/Grid";
6
+ import { RiSearchLine, RiCalendarLine, RiCloseLine } from "@remixicon/react";
7
+ import { fn } from "@storybook/test";
8
+ import { enumValues } from "../../story-utils";
9
+ const SIZES = enumValues({
10
+ small: true,
11
+ medium: true,
12
+ large: true,
13
+ chat: true,
14
+ hero: true,
15
+ });
16
+ const ADORNMENTS = {
17
+ None: undefined,
18
+ SearchIcon: (React.createElement(AdornmentButton, null,
19
+ React.createElement(RiSearchLine, null))),
20
+ CalendarTodayIcon: (React.createElement(AdornmentButton, null,
21
+ React.createElement(RiCalendarLine, null))),
22
+ CloseIcon: (React.createElement(AdornmentButton, null,
23
+ React.createElement(RiCloseLine, null))),
24
+ "Close and Calendar": (React.createElement(React.Fragment, null,
25
+ React.createElement(AdornmentButton, null,
26
+ React.createElement(RiCloseLine, null)),
27
+ React.createElement(AdornmentButton, null,
28
+ React.createElement(RiCalendarLine, null)))),
29
+ };
30
+ const meta = {
31
+ title: "smoot-design/TextField",
32
+ component: TextField,
33
+ argTypes: {
34
+ size: {
35
+ options: SIZES,
36
+ control: { type: "select" },
37
+ },
38
+ startAdornment: {
39
+ options: Object.keys(ADORNMENTS),
40
+ mapping: ADORNMENTS,
41
+ control: { type: "select" },
42
+ },
43
+ endAdornment: {
44
+ options: Object.keys(ADORNMENTS),
45
+ mapping: ADORNMENTS,
46
+ control: { type: "select" },
47
+ },
48
+ },
49
+ args: {
50
+ onChange: fn(),
51
+ multiline: false,
52
+ disabled: false,
53
+ value: "some value",
54
+ placeholder: "placeholder",
55
+ label: "Label",
56
+ helpText: "Help text the quick brown fox jumps over the lazy dog",
57
+ errorText: "Error text the quick brown fox jumps over the lazy dog",
58
+ },
59
+ };
60
+ export default meta;
61
+ export const Simple = {
62
+ render: (args) => {
63
+ return React.createElement(TextField, Object.assign({}, args));
64
+ },
65
+ };
66
+ export const Sizes = {
67
+ render: (args) => {
68
+ return (React.createElement(Stack, { direction: "row", gap: 1 },
69
+ React.createElement(TextField, Object.assign({}, args, { size: "small" })),
70
+ React.createElement(TextField, Object.assign({}, args, { size: "medium" })),
71
+ React.createElement(TextField, Object.assign({}, args, { size: "large" })),
72
+ React.createElement(TextField, Object.assign({}, args, { size: "hero" }))));
73
+ },
74
+ argTypes: { size: { table: { disable: true } } },
75
+ };
76
+ export const Widths = {
77
+ render: (args) => {
78
+ return (React.createElement(Stack, { direction: "column", gap: 1 },
79
+ React.createElement(TextField, Object.assign({}, args, { label: "default" })),
80
+ React.createElement(TextField, Object.assign({}, args, { label: "fullWidth", fullWidth: true }))));
81
+ },
82
+ argTypes: { fullWidth: { table: { disable: true } } },
83
+ };
84
+ export const Adornments = {
85
+ render: (args) => {
86
+ const adornments = [
87
+ { startAdornment: ADORNMENTS.SearchIcon },
88
+ { endAdornment: ADORNMENTS.CloseIcon },
89
+ {
90
+ startAdornment: ADORNMENTS.SearchIcon,
91
+ endAdornment: ADORNMENTS["Close and Calendar"],
92
+ },
93
+ ];
94
+ return (React.createElement(Grid, { container: true, maxWidth: "600px", spacing: 2 }, Object.values(adornments).flatMap((props, i) => SIZES.map((size) => {
95
+ return (React.createElement(Grid, { item: true, xs: 6, key: `${i}-${size}` },
96
+ React.createElement(TextField, Object.assign({}, args, { size: size }, props))));
97
+ }))));
98
+ },
99
+ argTypes: {
100
+ startAdornment: { table: { disable: true } },
101
+ endAdornment: { table: { disable: true } },
102
+ },
103
+ };
104
+ export const States = {
105
+ render: (args) => {
106
+ return (React.createElement(Grid, { container: true, spacing: 2, alignItems: "top", maxWidth: "400px" },
107
+ React.createElement(Grid, { item: true, xs: 4 }, "Placeholder"),
108
+ React.createElement(Grid, { item: true, xs: 8 },
109
+ React.createElement(TextField, Object.assign({}, args, { value: "" }))),
110
+ React.createElement(Grid, { item: true, xs: 4 }, "Default"),
111
+ React.createElement(Grid, { item: true, xs: 8 },
112
+ React.createElement(TextField, Object.assign({}, args))),
113
+ React.createElement(Grid, { item: true, xs: 4 }, "Required"),
114
+ React.createElement(Grid, { item: true, xs: 8 },
115
+ React.createElement(TextField, Object.assign({ required: true }, args))),
116
+ React.createElement(Grid, { item: true, xs: 4 }, "Error"),
117
+ React.createElement(Grid, { item: true, xs: 8 },
118
+ React.createElement(TextField, Object.assign({}, args, { error: true }))),
119
+ React.createElement(Grid, { item: true, xs: 4 }, "Disabled"),
120
+ React.createElement(Grid, { item: true, xs: 8 },
121
+ React.createElement(TextField, Object.assign({}, args, { disabled: true })))));
122
+ },
123
+ args: {
124
+ placeholder: "This is placeholder text.",
125
+ value: "Some value",
126
+ },
127
+ argTypes: {
128
+ placeholder: { table: { disable: true } },
129
+ value: { table: { disable: true } },
130
+ error: { table: { disable: true } },
131
+ disabled: { table: { disable: true } },
132
+ },
133
+ };
@@ -0,0 +1 @@
1
+ export {};