@mitodl/smoot-design 0.0.0-355a925
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/remoteTutorDrawer.es.js +38364 -0
- package/dist/bundles/remoteTutorDrawer.umd.js +207 -0
- package/dist/cjs/ai.d.ts +3 -0
- package/dist/cjs/ai.js +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.js +87 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +56 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +276 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +284 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +241 -0
- package/dist/cjs/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/cjs/bundles/remoteTutorDrawer.js +40 -0
- package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
- package/dist/cjs/components/AiChat/AiChat.js +226 -0
- package/dist/cjs/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/cjs/components/AiChat/AiChat.stories.js +243 -0
- package/dist/cjs/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/cjs/components/AiChat/AiChat.test.js +211 -0
- package/dist/cjs/components/AiChat/AiChatContext.d.ts +22 -0
- package/dist/cjs/components/AiChat/AiChatContext.js +105 -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/ChatTitle.d.ts +8 -0
- package/dist/cjs/components/AiChat/ChatTitle.js +43 -0
- package/dist/cjs/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/cjs/components/AiChat/EntryScreen.js +123 -0
- package/dist/cjs/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/cjs/components/AiChat/TimLogo.js +15 -0
- package/dist/cjs/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/cjs/components/AiChat/test-utils/api.js +125 -0
- package/dist/cjs/components/AiChat/types.d.ts +86 -0
- package/dist/cjs/components/AiChat/types.js +3 -0
- package/dist/cjs/components/Alert/Alert.d.ts +15 -0
- package/dist/cjs/components/Alert/Alert.js +62 -0
- package/dist/cjs/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/cjs/components/Alert/Alert.stories.js +53 -0
- package/dist/cjs/components/Button/ActionButton.d.ts +30 -0
- package/dist/cjs/components/Button/ActionButton.js +73 -0
- package/dist/cjs/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/cjs/components/Button/ActionButton.stories.js +113 -0
- package/dist/cjs/components/Button/Button.d.ts +54 -0
- package/dist/cjs/components/Button/Button.js +240 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +17 -0
- package/dist/cjs/components/Button/Button.stories.js +135 -0
- package/dist/cjs/components/Button/Button.test.d.ts +1 -0
- package/dist/cjs/components/Button/Button.test.js +46 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.js +30 -0
- package/dist/cjs/components/Input/Input.d.ts +116 -0
- package/dist/cjs/components/Input/Input.js +237 -0
- package/dist/cjs/components/Input/Input.stories.d.ts +19 -0
- package/dist/cjs/components/Input/Input.stories.js +135 -0
- package/dist/cjs/components/Input/Input.test.d.ts +1 -0
- package/dist/cjs/components/Input/Input.test.js +32 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.js +34 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.js +59 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.js +43 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.js +36 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.js +43 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.js +44 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.js +62 -0
- package/dist/cjs/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/cjs/components/TabButtons/TabButtonList.js +97 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.js +139 -0
- package/dist/cjs/components/TextField/TextField.d.ts +29 -0
- package/dist/cjs/components/TextField/TextField.js +33 -0
- package/dist/cjs/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/cjs/components/TextField/TextField.stories.js +136 -0
- package/dist/cjs/components/TextField/TextField.test.d.ts +1 -0
- package/dist/cjs/components/TextField/TextField.test.js +77 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.js +86 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.js +102 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.js +65 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.js +19 -0
- package/dist/cjs/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/cjs/components/ThemeProvider/buttons.js +20 -0
- package/dist/cjs/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/cjs/components/ThemeProvider/chips.js +154 -0
- package/dist/cjs/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/cjs/components/ThemeProvider/colors.js +35 -0
- package/dist/cjs/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/cjs/components/ThemeProvider/typography.js +173 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js +33 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.js +13 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.js +78 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.js +93 -0
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/jest-setup.d.ts +1 -0
- package/dist/cjs/jest-setup.js +18 -0
- package/dist/cjs/jsdom-extended.d.ts +6 -0
- package/dist/cjs/jsdom-extended.js +14 -0
- package/dist/cjs/story-utils/index.d.ts +6 -0
- package/dist/cjs/story-utils/index.js +17 -0
- package/dist/cjs/utils/composeRefs.d.ts +7 -0
- package/dist/cjs/utils/composeRefs.js +20 -0
- package/dist/cjs/utils/composeRefs.test.d.ts +1 -0
- package/dist/cjs/utils/composeRefs.test.js +19 -0
- package/dist/cjs/utils/useDevCheckStable.d.ts +8 -0
- package/dist/cjs/utils/useDevCheckStable.js +29 -0
- package/dist/cjs/utils/useInterval.d.ts +7 -0
- package/dist/cjs/utils/useInterval.js +25 -0
- package/dist/esm/ai.d.ts +3 -0
- package/dist/esm/ai.js +2 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.js +83 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +56 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +273 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +16 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +281 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +239 -0
- package/dist/esm/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/esm/bundles/remoteTutorDrawer.js +37 -0
- package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
- package/dist/esm/components/AiChat/AiChat.js +222 -0
- package/dist/esm/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/esm/components/AiChat/AiChat.stories.js +240 -0
- package/dist/esm/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/esm/components/AiChat/AiChat.test.js +209 -0
- package/dist/esm/components/AiChat/AiChatContext.d.ts +22 -0
- package/dist/esm/components/AiChat/AiChatContext.js +101 -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/ChatTitle.d.ts +8 -0
- package/dist/esm/components/AiChat/ChatTitle.js +40 -0
- package/dist/esm/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/esm/components/AiChat/EntryScreen.js +120 -0
- package/dist/esm/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/esm/components/AiChat/TimLogo.js +13 -0
- package/dist/esm/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/esm/components/AiChat/test-utils/api.js +122 -0
- package/dist/esm/components/AiChat/types.d.ts +86 -0
- package/dist/esm/components/AiChat/types.js +2 -0
- package/dist/esm/components/Alert/Alert.d.ts +15 -0
- package/dist/esm/components/Alert/Alert.js +59 -0
- package/dist/esm/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/esm/components/Alert/Alert.stories.js +50 -0
- package/dist/esm/components/Button/ActionButton.d.ts +30 -0
- package/dist/esm/components/Button/ActionButton.js +68 -0
- package/dist/esm/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/esm/components/Button/ActionButton.stories.js +110 -0
- package/dist/esm/components/Button/Button.d.ts +54 -0
- package/dist/esm/components/Button/Button.js +232 -0
- package/dist/esm/components/Button/Button.stories.d.ts +17 -0
- package/dist/esm/components/Button/Button.stories.js +132 -0
- package/dist/esm/components/Button/Button.test.d.ts +1 -0
- package/dist/esm/components/Button/Button.test.js +44 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.js +27 -0
- package/dist/esm/components/Input/Input.d.ts +116 -0
- package/dist/esm/components/Input/Input.js +232 -0
- package/dist/esm/components/Input/Input.stories.d.ts +19 -0
- package/dist/esm/components/Input/Input.stories.js +132 -0
- package/dist/esm/components/Input/Input.test.d.ts +1 -0
- package/dist/esm/components/Input/Input.test.js +30 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.js +31 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.js +56 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.js +40 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.js +33 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.js +40 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.js +41 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.js +60 -0
- package/dist/esm/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/esm/components/TabButtons/TabButtonList.js +92 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.js +136 -0
- package/dist/esm/components/TextField/TextField.d.ts +29 -0
- package/dist/esm/components/TextField/TextField.js +30 -0
- package/dist/esm/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/esm/components/TextField/TextField.stories.js +133 -0
- package/dist/esm/components/TextField/TextField.test.d.ts +1 -0
- package/dist/esm/components/TextField/TextField.test.js +75 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.js +82 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.js +99 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.js +62 -0
- package/dist/esm/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/esm/components/ThemeProvider/breakpoints.js +15 -0
- package/dist/esm/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/esm/components/ThemeProvider/buttons.js +17 -0
- package/dist/esm/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/esm/components/ThemeProvider/chips.js +151 -0
- package/dist/esm/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/esm/components/ThemeProvider/colors.js +32 -0
- package/dist/esm/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/esm/components/ThemeProvider/typography.js +167 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +30 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.js +10 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.js +73 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.js +91 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/jest-setup.d.ts +1 -0
- package/dist/esm/jest-setup.js +16 -0
- package/dist/esm/jsdom-extended.d.ts +6 -0
- package/dist/esm/jsdom-extended.js +12 -0
- package/dist/esm/story-utils/index.d.ts +6 -0
- package/dist/esm/story-utils/index.js +13 -0
- package/dist/esm/utils/composeRefs.d.ts +7 -0
- package/dist/esm/utils/composeRefs.js +17 -0
- package/dist/esm/utils/composeRefs.test.d.ts +1 -0
- package/dist/esm/utils/composeRefs.test.js +17 -0
- package/dist/esm/utils/useDevCheckStable.d.ts +8 -0
- package/dist/esm/utils/useDevCheckStable.js +26 -0
- package/dist/esm/utils/useInterval.d.ts +7 -0
- package/dist/esm/utils/useInterval.js +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/type-augmentation/TypescriptDocs.mdx +17 -0
- package/dist/type-augmentation/imports.d.ts +3 -0
- package/dist/type-augmentation/index.d.ts +3 -0
- package/dist/type-augmentation/theme.d.ts +105 -0
- package/dist/type-augmentation/typography.d.ts +54 -0
- package/package.json +155 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { colors } from "./colors";
|
|
3
|
+
import { RiCloseLine } from "@remixicon/react";
|
|
4
|
+
const chipComponent = {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
size: "medium",
|
|
7
|
+
color: "default",
|
|
8
|
+
variant: "outlined",
|
|
9
|
+
deleteIcon: React.createElement(RiCloseLine, { "aria-hidden": "true" }),
|
|
10
|
+
},
|
|
11
|
+
styleOverrides: {
|
|
12
|
+
root: {
|
|
13
|
+
borderRadius: "100vh",
|
|
14
|
+
borderWidth: "1px",
|
|
15
|
+
},
|
|
16
|
+
deleteIcon: {
|
|
17
|
+
"&:hover": {
|
|
18
|
+
color: "inherit",
|
|
19
|
+
},
|
|
20
|
+
"&.MuiChip-deleteIconLarge": {
|
|
21
|
+
width: "16px",
|
|
22
|
+
height: "16px",
|
|
23
|
+
},
|
|
24
|
+
"&.MuiChip-deleteIconMedium": {
|
|
25
|
+
width: "14px",
|
|
26
|
+
height: "14px",
|
|
27
|
+
},
|
|
28
|
+
margin: "0 -2px 0 8px",
|
|
29
|
+
color: "inherit",
|
|
30
|
+
},
|
|
31
|
+
icon: {
|
|
32
|
+
margin: "0 8px 0 -2px",
|
|
33
|
+
color: "inherit",
|
|
34
|
+
"&.MuiChip-iconLarge": {
|
|
35
|
+
width: "16px",
|
|
36
|
+
height: "16px",
|
|
37
|
+
},
|
|
38
|
+
"&.MuiChip-iconMedium": {
|
|
39
|
+
width: "14px",
|
|
40
|
+
height: "14px",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
variants: [
|
|
45
|
+
{
|
|
46
|
+
props: { size: "medium" },
|
|
47
|
+
style: ({ theme }) => (Object.assign(Object.assign({}, theme.typography.body3), { boxSizing: "border-box", height: "24px", paddingRight: "12px", paddingLeft: "12px", ".MuiChip-label": {
|
|
48
|
+
paddingLeft: "0px",
|
|
49
|
+
paddingRight: "0px",
|
|
50
|
+
} })),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
props: { size: "large" },
|
|
54
|
+
style: ({ theme }) => (Object.assign(Object.assign({}, theme.typography.body2), { height: "32px", paddingLeft: "16px", paddingRight: "16px", ".MuiChip-label": {
|
|
55
|
+
paddingLeft: "0px",
|
|
56
|
+
paddingRight: "0px",
|
|
57
|
+
} })),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
props: { variant: "outlined" },
|
|
61
|
+
style: {
|
|
62
|
+
borderColor: colors.silverGrayLight,
|
|
63
|
+
color: colors.darkGray1,
|
|
64
|
+
"&.Mui-focusVisible": {
|
|
65
|
+
backgroundColor: "transparent",
|
|
66
|
+
},
|
|
67
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
68
|
+
color: colors.darkGray1,
|
|
69
|
+
borderColor: colors.silverGrayDark,
|
|
70
|
+
backgroundColor: "transparent", // mui has a default background color for hover
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
props: { variant: "outlinedWhite" },
|
|
76
|
+
style: {
|
|
77
|
+
backgroundColor: "white",
|
|
78
|
+
border: "1px solid",
|
|
79
|
+
borderColor: colors.silverGrayLight,
|
|
80
|
+
color: colors.darkGray1,
|
|
81
|
+
"&.Mui-focusVisible": {
|
|
82
|
+
backgroundColor: "white",
|
|
83
|
+
},
|
|
84
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
85
|
+
color: colors.darkGray1,
|
|
86
|
+
borderColor: colors.silverGrayDark,
|
|
87
|
+
backgroundColor: "white", // mui has a default background color hover
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
props: { variant: "gray" },
|
|
93
|
+
style: {
|
|
94
|
+
backgroundColor: colors.lightGray2,
|
|
95
|
+
border: "none",
|
|
96
|
+
color: colors.darkGray2,
|
|
97
|
+
"&.Mui-focusVisible": {
|
|
98
|
+
backgroundColor: colors.lightGray2,
|
|
99
|
+
},
|
|
100
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
101
|
+
color: colors.darkGray1,
|
|
102
|
+
backgroundColor: colors.silverGrayLight,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
props: { variant: "dark" },
|
|
108
|
+
style: {
|
|
109
|
+
backgroundColor: colors.silverGrayDark,
|
|
110
|
+
border: "none",
|
|
111
|
+
color: colors.white,
|
|
112
|
+
"&.Mui-focusVisible": {
|
|
113
|
+
backgroundColor: colors.silverGrayDark,
|
|
114
|
+
},
|
|
115
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
116
|
+
backgroundColor: colors.darkGray1,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
props: { variant: "darker" },
|
|
122
|
+
style: {
|
|
123
|
+
backgroundColor: colors.darkGray2,
|
|
124
|
+
border: `1px solid ${colors.darkGray1}`,
|
|
125
|
+
color: colors.white,
|
|
126
|
+
"&.Mui-focusVisible": {
|
|
127
|
+
backgroundColor: colors.darkGray2,
|
|
128
|
+
},
|
|
129
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
130
|
+
backgroundColor: colors.black,
|
|
131
|
+
border: `1px solid ${colors.silverGray}`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
props: { variant: "filled" },
|
|
137
|
+
style: {
|
|
138
|
+
backgroundColor: colors.mitRed,
|
|
139
|
+
border: "none",
|
|
140
|
+
color: colors.white,
|
|
141
|
+
"&.Mui-focusVisible": {
|
|
142
|
+
backgroundColor: colors.mitRed,
|
|
143
|
+
},
|
|
144
|
+
"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover": {
|
|
145
|
+
backgroundColor: colors.red,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
export { chipComponent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const colors: {
|
|
2
|
+
mitRed: string;
|
|
3
|
+
brightRed: string;
|
|
4
|
+
black: string;
|
|
5
|
+
white: string;
|
|
6
|
+
darkGray2: string;
|
|
7
|
+
darkGray1: string;
|
|
8
|
+
silverGrayDark: string;
|
|
9
|
+
silverGray: string;
|
|
10
|
+
silverGrayLight: string;
|
|
11
|
+
lightGray2: string;
|
|
12
|
+
lightGray1: string;
|
|
13
|
+
navGray: string;
|
|
14
|
+
darkPink: string;
|
|
15
|
+
pink: string;
|
|
16
|
+
lightPink: string;
|
|
17
|
+
darkPurple: string;
|
|
18
|
+
purple: string;
|
|
19
|
+
lightPurple: string;
|
|
20
|
+
darkBlue: string;
|
|
21
|
+
blue: string;
|
|
22
|
+
lightBlue: string;
|
|
23
|
+
darkGreen: string;
|
|
24
|
+
green: string;
|
|
25
|
+
lightGreen: string;
|
|
26
|
+
darkRed: string;
|
|
27
|
+
red: string;
|
|
28
|
+
lightRed: string;
|
|
29
|
+
orange: string;
|
|
30
|
+
yellow: string;
|
|
31
|
+
};
|
|
32
|
+
export { colors };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const colors = {
|
|
2
|
+
mitRed: "#750014",
|
|
3
|
+
brightRed: "#FF1423",
|
|
4
|
+
black: "#000000",
|
|
5
|
+
white: "#FFFFFF",
|
|
6
|
+
darkGray2: "#212326",
|
|
7
|
+
darkGray1: "#40464C",
|
|
8
|
+
silverGrayDark: "#626A73",
|
|
9
|
+
silverGray: "#8B959E",
|
|
10
|
+
silverGrayLight: "#B8C2CC",
|
|
11
|
+
lightGray2: "#DDE1E6",
|
|
12
|
+
lightGray1: "#F3F4F8",
|
|
13
|
+
navGray: "#303337",
|
|
14
|
+
darkPink: "#750062",
|
|
15
|
+
pink: "#FF14F0",
|
|
16
|
+
lightPink: "#FFB3FF",
|
|
17
|
+
darkPurple: "#3E006B",
|
|
18
|
+
purple: "#93F",
|
|
19
|
+
lightPurple: "#BFB3FF",
|
|
20
|
+
darkBlue: "#002896",
|
|
21
|
+
blue: "#1966FF",
|
|
22
|
+
lightBlue: "#99EBFF",
|
|
23
|
+
darkGreen: "#004D1A",
|
|
24
|
+
green: "#00AD00",
|
|
25
|
+
lightGreen: "#AF3",
|
|
26
|
+
darkRed: "#83192A",
|
|
27
|
+
red: "#A31F34",
|
|
28
|
+
lightRed: "#D02E44",
|
|
29
|
+
orange: "#FAB005",
|
|
30
|
+
yellow: "#FFEB00",
|
|
31
|
+
};
|
|
32
|
+
export { colors };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ThemeOptions } from "@mui/material/styles";
|
|
2
|
+
/**
|
|
3
|
+
* This function converts from pixels to rems, assuming a base font size of 16px
|
|
4
|
+
* (which is the default for most modern browsers).
|
|
5
|
+
*
|
|
6
|
+
* Using this function, we can:
|
|
7
|
+
* - match desgins that are in pixels for default font size
|
|
8
|
+
* - allow users to scale the font size up or down by chaning base font size.
|
|
9
|
+
*
|
|
10
|
+
* For example, a Chrome user might specify a base font size of 20px ("large")
|
|
11
|
+
* in their browser settings. Then, `pxToRem(32)` would actually be 40px for
|
|
12
|
+
* that user.
|
|
13
|
+
*/
|
|
14
|
+
declare const pxToRem: (px: number) => string;
|
|
15
|
+
declare const globalSettings: ThemeOptions["typography"];
|
|
16
|
+
declare const component: NonNullable<ThemeOptions["components"]>["MuiTypography"];
|
|
17
|
+
declare const typography: import("@mui/material/styles").TypographyVariants;
|
|
18
|
+
export { globalSettings, component, pxToRem, typography };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createTheme } from "@mui/material/styles";
|
|
2
|
+
const fontWeights = {
|
|
3
|
+
text: {
|
|
4
|
+
roman: 400,
|
|
5
|
+
medium: 500,
|
|
6
|
+
bold: 700,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This function converts from pixels to rems, assuming a base font size of 16px
|
|
11
|
+
* (which is the default for most modern browsers).
|
|
12
|
+
*
|
|
13
|
+
* Using this function, we can:
|
|
14
|
+
* - match desgins that are in pixels for default font size
|
|
15
|
+
* - allow users to scale the font size up or down by chaning base font size.
|
|
16
|
+
*
|
|
17
|
+
* For example, a Chrome user might specify a base font size of 20px ("large")
|
|
18
|
+
* in their browser settings. Then, `pxToRem(32)` would actually be 40px for
|
|
19
|
+
* that user.
|
|
20
|
+
*/
|
|
21
|
+
const pxToRem = (px) => `${px / 16}rem`;
|
|
22
|
+
const globalSettings = {
|
|
23
|
+
// Note: Figma calls this "Neue Haas Grotesk Text", but that is incorrect based on Adobe's font family.
|
|
24
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
25
|
+
fontWeightLight: fontWeights.text.roman,
|
|
26
|
+
fontWeightRegular: fontWeights.text.roman,
|
|
27
|
+
fontWeightMedium: fontWeights.text.medium,
|
|
28
|
+
fontWeightBold: fontWeights.text.bold,
|
|
29
|
+
h1: {
|
|
30
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
31
|
+
fontWeight: fontWeights.text.bold,
|
|
32
|
+
fontStyle: "normal",
|
|
33
|
+
fontSize: pxToRem(52),
|
|
34
|
+
lineHeight: pxToRem(60),
|
|
35
|
+
},
|
|
36
|
+
h2: {
|
|
37
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
38
|
+
fontWeight: fontWeights.text.bold,
|
|
39
|
+
fontStyle: "normal",
|
|
40
|
+
fontSize: pxToRem(34),
|
|
41
|
+
lineHeight: pxToRem(40),
|
|
42
|
+
},
|
|
43
|
+
h3: {
|
|
44
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
45
|
+
fontWeight: fontWeights.text.bold,
|
|
46
|
+
fontStyle: "normal",
|
|
47
|
+
fontSize: pxToRem(28),
|
|
48
|
+
lineHeight: pxToRem(36),
|
|
49
|
+
},
|
|
50
|
+
h4: {
|
|
51
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
52
|
+
fontWeight: fontWeights.text.bold,
|
|
53
|
+
fontStyle: "normal",
|
|
54
|
+
fontSize: pxToRem(24),
|
|
55
|
+
lineHeight: pxToRem(30),
|
|
56
|
+
},
|
|
57
|
+
h5: {
|
|
58
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
59
|
+
fontWeight: fontWeights.text.medium,
|
|
60
|
+
fontStyle: "normal",
|
|
61
|
+
fontSize: pxToRem(18),
|
|
62
|
+
lineHeight: pxToRem(22),
|
|
63
|
+
},
|
|
64
|
+
subtitle1: {
|
|
65
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
66
|
+
fontWeight: fontWeights.text.medium,
|
|
67
|
+
fontStyle: "normal",
|
|
68
|
+
fontSize: pxToRem(16),
|
|
69
|
+
lineHeight: pxToRem(20),
|
|
70
|
+
},
|
|
71
|
+
subtitle2: {
|
|
72
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
73
|
+
fontWeight: fontWeights.text.medium,
|
|
74
|
+
fontStyle: "normal",
|
|
75
|
+
fontSize: pxToRem(14),
|
|
76
|
+
lineHeight: pxToRem(18),
|
|
77
|
+
},
|
|
78
|
+
subtitle3: {
|
|
79
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
80
|
+
fontWeight: fontWeights.text.medium,
|
|
81
|
+
fontStyle: "normal",
|
|
82
|
+
fontSize: pxToRem(12),
|
|
83
|
+
lineHeight: pxToRem(16),
|
|
84
|
+
},
|
|
85
|
+
subtitle4: {
|
|
86
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
87
|
+
fontWeight: fontWeights.text.medium,
|
|
88
|
+
fontStyle: "normal",
|
|
89
|
+
fontSize: pxToRem(10),
|
|
90
|
+
lineHeight: pxToRem(14),
|
|
91
|
+
},
|
|
92
|
+
body1: {
|
|
93
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
94
|
+
fontWeight: fontWeights.text.roman,
|
|
95
|
+
fontStyle: "normal",
|
|
96
|
+
fontSize: pxToRem(16),
|
|
97
|
+
lineHeight: pxToRem(20),
|
|
98
|
+
},
|
|
99
|
+
body2: {
|
|
100
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
101
|
+
fontWeight: fontWeights.text.roman,
|
|
102
|
+
fontStyle: "normal",
|
|
103
|
+
fontSize: pxToRem(14),
|
|
104
|
+
lineHeight: pxToRem(18),
|
|
105
|
+
},
|
|
106
|
+
body3: {
|
|
107
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
108
|
+
fontWeight: fontWeights.text.roman,
|
|
109
|
+
fontStyle: "normal",
|
|
110
|
+
fontSize: pxToRem(12),
|
|
111
|
+
lineHeight: pxToRem(16),
|
|
112
|
+
},
|
|
113
|
+
body4: {
|
|
114
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
115
|
+
fontWeight: fontWeights.text.roman,
|
|
116
|
+
fontStyle: "normal",
|
|
117
|
+
fontSize: pxToRem(10),
|
|
118
|
+
lineHeight: pxToRem(14),
|
|
119
|
+
},
|
|
120
|
+
buttonLarge: {
|
|
121
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
122
|
+
fontWeight: fontWeights.text.medium,
|
|
123
|
+
fontStyle: "normal",
|
|
124
|
+
fontSize: pxToRem(16),
|
|
125
|
+
lineHeight: pxToRem(20),
|
|
126
|
+
},
|
|
127
|
+
button: {
|
|
128
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
129
|
+
fontWeight: fontWeights.text.medium,
|
|
130
|
+
fontStyle: "normal",
|
|
131
|
+
fontSize: pxToRem(14),
|
|
132
|
+
lineHeight: pxToRem(18),
|
|
133
|
+
textTransform: "none",
|
|
134
|
+
},
|
|
135
|
+
buttonSmall: {
|
|
136
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
137
|
+
fontWeight: fontWeights.text.medium,
|
|
138
|
+
fontStyle: "normal",
|
|
139
|
+
fontSize: pxToRem(12),
|
|
140
|
+
lineHeight: pxToRem(16),
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const component = {
|
|
144
|
+
defaultProps: {
|
|
145
|
+
variantMapping: {
|
|
146
|
+
h1: "span",
|
|
147
|
+
h2: "span",
|
|
148
|
+
h3: "span",
|
|
149
|
+
h4: "span",
|
|
150
|
+
h5: "span",
|
|
151
|
+
body1: "p",
|
|
152
|
+
body2: "p",
|
|
153
|
+
body3: "p",
|
|
154
|
+
body4: "p",
|
|
155
|
+
subtitle1: "p",
|
|
156
|
+
subtitle2: "p",
|
|
157
|
+
subtitle3: "p",
|
|
158
|
+
subtitle4: "p",
|
|
159
|
+
button: "span",
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
const { typography } = createTheme({
|
|
164
|
+
typography: globalSettings,
|
|
165
|
+
custom: {},
|
|
166
|
+
});
|
|
167
|
+
export { globalSettings, component, pxToRem, typography };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VisuallyHidden is a utility component that hides its children from sighted
|
|
3
|
+
* users, but keeps them accessible to screen readers.
|
|
4
|
+
*
|
|
5
|
+
* Often, screenreader-only content can be handled with an `aria-label`. However,
|
|
6
|
+
* occasionally we need actual elements.
|
|
7
|
+
*
|
|
8
|
+
* Example:
|
|
9
|
+
* - a visually hidden aria-live section that reads announcements that
|
|
10
|
+
* isual users can ascertain in some other way.
|
|
11
|
+
* - a visually hidden Heading for a section whose purpose is clear for sighted users
|
|
12
|
+
* - a visually hidden description used for aria-describeddby
|
|
13
|
+
* - There is an aria-description attribute that can be used to provide a
|
|
14
|
+
* without an actual element on the page. However, it is introduced in
|
|
15
|
+
* ARIA 1.3 (working draft), not compatible with some screen readers, and
|
|
16
|
+
* flagged problematic by our linting.
|
|
17
|
+
*
|
|
18
|
+
* The CSS here is based on https://inclusive-components.design/tooltips-toggletips/
|
|
19
|
+
*/
|
|
20
|
+
declare const VisuallyHidden: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
as?: React.ElementType;
|
|
23
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
24
|
+
export { VisuallyHidden };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
/**
|
|
3
|
+
* VisuallyHidden is a utility component that hides its children from sighted
|
|
4
|
+
* users, but keeps them accessible to screen readers.
|
|
5
|
+
*
|
|
6
|
+
* Often, screenreader-only content can be handled with an `aria-label`. However,
|
|
7
|
+
* occasionally we need actual elements.
|
|
8
|
+
*
|
|
9
|
+
* Example:
|
|
10
|
+
* - a visually hidden aria-live section that reads announcements that
|
|
11
|
+
* isual users can ascertain in some other way.
|
|
12
|
+
* - a visually hidden Heading for a section whose purpose is clear for sighted users
|
|
13
|
+
* - a visually hidden description used for aria-describeddby
|
|
14
|
+
* - There is an aria-description attribute that can be used to provide a
|
|
15
|
+
* without an actual element on the page. However, it is introduced in
|
|
16
|
+
* ARIA 1.3 (working draft), not compatible with some screen readers, and
|
|
17
|
+
* flagged problematic by our linting.
|
|
18
|
+
*
|
|
19
|
+
* The CSS here is based on https://inclusive-components.design/tooltips-toggletips/
|
|
20
|
+
*/
|
|
21
|
+
const VisuallyHidden = styled.span({
|
|
22
|
+
clipPath: "inset(100%)",
|
|
23
|
+
clip: "rect(1px, 1px, 1px, 1px)",
|
|
24
|
+
height: "1px",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
position: "absolute",
|
|
27
|
+
whiteSpace: "nowrap",
|
|
28
|
+
width: "1px",
|
|
29
|
+
});
|
|
30
|
+
export { VisuallyHidden };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { VisuallyHidden } from "./VisuallyHidden";
|
|
3
|
+
declare const meta: Meta<typeof VisuallyHidden>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof VisuallyHidden>;
|
|
6
|
+
export declare const ScreenreaderOnly: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VisuallyHidden } from "./VisuallyHidden";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "smoot-design/VisuallyHidden",
|
|
4
|
+
component: VisuallyHidden,
|
|
5
|
+
args: {
|
|
6
|
+
children: "Not visible, but screen readers can still read this text.",
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export const ScreenreaderOnly = {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Description: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
} & {
|
|
6
|
+
error?: boolean;
|
|
7
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
type ControlLabelProps = {
|
|
9
|
+
htmlFor: string;
|
|
10
|
+
label: React.ReactNode;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const ControlLabel: React.FC<ControlLabelProps>;
|
|
16
|
+
type FormFieldWrapperProps = {
|
|
17
|
+
label: React.ReactNode;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
helpText?: string;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
errorText?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
fullWidth?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The id of the input element. If not provided, a unique id will be generated.
|
|
26
|
+
*/
|
|
27
|
+
id?: string;
|
|
28
|
+
children: (childProps: {
|
|
29
|
+
id: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
error?: boolean;
|
|
32
|
+
fullWidth?: boolean;
|
|
33
|
+
labelId: string;
|
|
34
|
+
"aria-describedby"?: string;
|
|
35
|
+
}) => React.ReactNode;
|
|
36
|
+
};
|
|
37
|
+
declare const FormFieldWrapper: React.FC<FormFieldWrapperProps>;
|
|
38
|
+
export { FormFieldWrapper, ControlLabel, Description };
|
|
39
|
+
export type { FormFieldWrapperProps, ControlLabelProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { RiErrorWarningLine } from "@remixicon/react";
|
|
4
|
+
import Typography from "@mui/material/Typography";
|
|
5
|
+
const Required = styled.span(({ theme }) => ({
|
|
6
|
+
color: theme.custom.colors.lightRed,
|
|
7
|
+
marginLeft: "4px",
|
|
8
|
+
}));
|
|
9
|
+
const Description = styled.div(({ theme, error }) => [
|
|
10
|
+
Object.assign(Object.assign({}, theme.typography.body2), { color: error
|
|
11
|
+
? theme.custom.colors.lightRed
|
|
12
|
+
: theme.custom.colors.silverGrayDark }),
|
|
13
|
+
error && {
|
|
14
|
+
textIndent: "-24px",
|
|
15
|
+
paddingLeft: "24px",
|
|
16
|
+
"> svg:first-of-type": {
|
|
17
|
+
marginRight: "4px",
|
|
18
|
+
transform: "translateY(2px)",
|
|
19
|
+
width: "18px",
|
|
20
|
+
height: "18px",
|
|
21
|
+
position: "relative",
|
|
22
|
+
top: "2px",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
const Container = styled.div(({ fullWidth }) => [
|
|
27
|
+
{
|
|
28
|
+
display: "inline-flex",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
alignItems: "start",
|
|
31
|
+
"> *:not(:last-child)": {
|
|
32
|
+
marginBottom: "4px",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
fullWidth && {
|
|
36
|
+
width: "100%",
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
const ControlLabel = ({ htmlFor, label, required, id, fullWidth, }) => {
|
|
40
|
+
return (React.createElement(Typography, { id: id, component: "label", htmlFor: htmlFor, variant: "subtitle2", sx: { marginBottom: "4px", width: fullWidth ? "100%" : "auto" } },
|
|
41
|
+
label,
|
|
42
|
+
required ? React.createElement(Required, { "aria-hidden": "true" }, "*") : null));
|
|
43
|
+
};
|
|
44
|
+
const FormFieldWrapper = ({ label, required, helpText, error, errorText, className, fullWidth, id, children, }) => {
|
|
45
|
+
const fallbackInputId = React.useId();
|
|
46
|
+
const inputId = id || fallbackInputId;
|
|
47
|
+
const helpId = React.useId();
|
|
48
|
+
const errorId = React.useId();
|
|
49
|
+
const labelId = React.useId();
|
|
50
|
+
/**
|
|
51
|
+
* aria-errormessage would be more semantic for the error message but has
|
|
52
|
+
* somewhat limited support. See https://github.com/w3c/aria/issues/2048 for
|
|
53
|
+
* some related information.
|
|
54
|
+
*/
|
|
55
|
+
const describedBy = [helpText && helpId, error && errorText && errorId]
|
|
56
|
+
.filter(Boolean)
|
|
57
|
+
.join(" ") || undefined;
|
|
58
|
+
return (React.createElement(Container, { className: className, fullWidth: fullWidth },
|
|
59
|
+
React.createElement(ControlLabel, { htmlFor: inputId, id: labelId, label: label, required: required, fullWidth: fullWidth }),
|
|
60
|
+
children({
|
|
61
|
+
id: inputId,
|
|
62
|
+
error,
|
|
63
|
+
required,
|
|
64
|
+
labelId,
|
|
65
|
+
fullWidth,
|
|
66
|
+
"aria-describedby": describedBy,
|
|
67
|
+
}),
|
|
68
|
+
helpText && React.createElement(Description, { id: helpId }, helpText),
|
|
69
|
+
error && errorText && (React.createElement(Description, { id: errorId, error: true },
|
|
70
|
+
React.createElement(RiErrorWarningLine, { fontSize: "inherit" }),
|
|
71
|
+
errorText))));
|
|
72
|
+
};
|
|
73
|
+
export { FormFieldWrapper, ControlLabel, Description };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|