@mitodl/smoot-design 0.0.0-preview215f7ae3fa
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 +27 -0
- package/dist/bundles/aiChat.es.js +24812 -0
- package/dist/bundles/aiChat.umd.js +161 -0
- package/dist/cjs/ai.d.ts +2 -0
- package/dist/cjs/ai.js +5 -0
- package/dist/cjs/bundles/aiChat.d.ts +6 -0
- package/dist/cjs/bundles/aiChat.js +13 -0
- package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
- package/dist/cjs/components/AiChat/AiChat.js +150 -0
- package/dist/cjs/components/AiChat/AiChat.stories.d.ts +11 -0
- package/dist/cjs/components/AiChat/AiChat.stories.js +76 -0
- package/dist/cjs/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/cjs/components/AiChat/AiChat.test.js +130 -0
- package/dist/cjs/components/AiChat/story-utils.d.ts +3 -0
- package/dist/cjs/components/AiChat/story-utils.js +100 -0
- package/dist/cjs/components/AiChat/types.d.ts +45 -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 +31 -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 +116 -0
- package/dist/cjs/components/Button/Button.d.ts +56 -0
- package/dist/cjs/components/Button/Button.js +273 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +17 -0
- package/dist/cjs/components/Button/Button.stories.js +138 -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/Input/Input.d.ts +115 -0
- package/dist/cjs/components/Input/Input.js +219 -0
- package/dist/cjs/components/Input/Input.stories.d.ts +19 -0
- package/dist/cjs/components/Input/Input.stories.js +134 -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/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/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 +135 -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 +23 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.js +90 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.d.ts +58 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.js +97 -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 +20 -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 +174 -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 +28 -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 +2 -0
- package/dist/esm/ai.js +1 -0
- package/dist/esm/bundles/aiChat.d.ts +6 -0
- package/dist/esm/bundles/aiChat.js +10 -0
- package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
- package/dist/esm/components/AiChat/AiChat.js +147 -0
- package/dist/esm/components/AiChat/AiChat.stories.d.ts +11 -0
- package/dist/esm/components/AiChat/AiChat.stories.js +73 -0
- package/dist/esm/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/esm/components/AiChat/AiChat.test.js +128 -0
- package/dist/esm/components/AiChat/story-utils.d.ts +3 -0
- package/dist/esm/components/AiChat/story-utils.js +96 -0
- package/dist/esm/components/AiChat/types.d.ts +45 -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 +28 -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 +113 -0
- package/dist/esm/components/Button/Button.d.ts +56 -0
- package/dist/esm/components/Button/Button.js +265 -0
- package/dist/esm/components/Button/Button.stories.d.ts +17 -0
- package/dist/esm/components/Button/Button.stories.js +135 -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/Input/Input.d.ts +115 -0
- package/dist/esm/components/Input/Input.js +214 -0
- package/dist/esm/components/Input/Input.stories.d.ts +19 -0
- package/dist/esm/components/Input/Input.stories.js +131 -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/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/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 +132 -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 +23 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.js +86 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.d.ts +58 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.js +94 -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 +16 -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 +168 -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/index.d.ts +2 -0
- package/dist/type-augmentation/theme.d.ts +103 -0
- package/dist/type-augmentation/typography.d.ts +54 -0
- package/package.json +141 -0
|
@@ -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,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
const colors = {
|
|
5
|
+
mitRed: "#750014",
|
|
6
|
+
brightRed: "#FF1423",
|
|
7
|
+
black: "#000000",
|
|
8
|
+
white: "#FFFFFF",
|
|
9
|
+
darkGray2: "#212326",
|
|
10
|
+
darkGray1: "#40464C",
|
|
11
|
+
silverGrayDark: "#626A73",
|
|
12
|
+
silverGray: "#8B959E",
|
|
13
|
+
silverGrayLight: "#B8C2CC",
|
|
14
|
+
lightGray2: "#DDE1E6",
|
|
15
|
+
lightGray1: "#F3F4F8",
|
|
16
|
+
navGray: "#303337",
|
|
17
|
+
darkPink: "#750062",
|
|
18
|
+
pink: "#FF14F0",
|
|
19
|
+
lightPink: "#FFB3FF",
|
|
20
|
+
darkPurple: "#3E006B",
|
|
21
|
+
purple: "#93F",
|
|
22
|
+
lightPurple: "#BFB3FF",
|
|
23
|
+
darkBlue: "#002896",
|
|
24
|
+
blue: "#1966FF",
|
|
25
|
+
lightBlue: "#99EBFF",
|
|
26
|
+
darkGreen: "#004D1A",
|
|
27
|
+
green: "#00AD00",
|
|
28
|
+
lightGreen: "#AF3",
|
|
29
|
+
darkRed: "#83192A",
|
|
30
|
+
red: "#A31F34",
|
|
31
|
+
lightRed: "#D02E44",
|
|
32
|
+
orange: "#FAB005",
|
|
33
|
+
yellow: "#FFEB00",
|
|
34
|
+
};
|
|
35
|
+
exports.colors = 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,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typography = exports.pxToRem = exports.component = exports.globalSettings = void 0;
|
|
4
|
+
const styles_1 = require("@mui/material/styles");
|
|
5
|
+
const fontWeights = {
|
|
6
|
+
text: {
|
|
7
|
+
roman: 400,
|
|
8
|
+
medium: 500,
|
|
9
|
+
bold: 700,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* This function converts from pixels to rems, assuming a base font size of 16px
|
|
14
|
+
* (which is the default for most modern browsers).
|
|
15
|
+
*
|
|
16
|
+
* Using this function, we can:
|
|
17
|
+
* - match desgins that are in pixels for default font size
|
|
18
|
+
* - allow users to scale the font size up or down by chaning base font size.
|
|
19
|
+
*
|
|
20
|
+
* For example, a Chrome user might specify a base font size of 20px ("large")
|
|
21
|
+
* in their browser settings. Then, `pxToRem(32)` would actually be 40px for
|
|
22
|
+
* that user.
|
|
23
|
+
*/
|
|
24
|
+
const pxToRem = (px) => `${px / 16}rem`;
|
|
25
|
+
exports.pxToRem = pxToRem;
|
|
26
|
+
const globalSettings = {
|
|
27
|
+
// Note: Figma calls this "Neue Haas Grotesk Text", but that is incorrect based on Adobe's font family.
|
|
28
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
29
|
+
fontWeightLight: fontWeights.text.roman,
|
|
30
|
+
fontWeightRegular: fontWeights.text.roman,
|
|
31
|
+
fontWeightMedium: fontWeights.text.medium,
|
|
32
|
+
fontWeightBold: fontWeights.text.bold,
|
|
33
|
+
h1: {
|
|
34
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
35
|
+
fontWeight: fontWeights.text.bold,
|
|
36
|
+
fontStyle: "normal",
|
|
37
|
+
fontSize: pxToRem(52),
|
|
38
|
+
lineHeight: pxToRem(60),
|
|
39
|
+
},
|
|
40
|
+
h2: {
|
|
41
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
42
|
+
fontWeight: fontWeights.text.bold,
|
|
43
|
+
fontStyle: "normal",
|
|
44
|
+
fontSize: pxToRem(34),
|
|
45
|
+
lineHeight: pxToRem(40),
|
|
46
|
+
},
|
|
47
|
+
h3: {
|
|
48
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
49
|
+
fontWeight: fontWeights.text.bold,
|
|
50
|
+
fontStyle: "normal",
|
|
51
|
+
fontSize: pxToRem(28),
|
|
52
|
+
lineHeight: pxToRem(36),
|
|
53
|
+
},
|
|
54
|
+
h4: {
|
|
55
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
56
|
+
fontWeight: fontWeights.text.bold,
|
|
57
|
+
fontStyle: "normal",
|
|
58
|
+
fontSize: pxToRem(24),
|
|
59
|
+
lineHeight: pxToRem(30),
|
|
60
|
+
},
|
|
61
|
+
h5: {
|
|
62
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
63
|
+
fontWeight: fontWeights.text.medium,
|
|
64
|
+
fontStyle: "normal",
|
|
65
|
+
fontSize: pxToRem(18),
|
|
66
|
+
lineHeight: pxToRem(22),
|
|
67
|
+
},
|
|
68
|
+
subtitle1: {
|
|
69
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
70
|
+
fontWeight: fontWeights.text.medium,
|
|
71
|
+
fontStyle: "normal",
|
|
72
|
+
fontSize: pxToRem(16),
|
|
73
|
+
lineHeight: pxToRem(20),
|
|
74
|
+
},
|
|
75
|
+
subtitle2: {
|
|
76
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
77
|
+
fontWeight: fontWeights.text.medium,
|
|
78
|
+
fontStyle: "normal",
|
|
79
|
+
fontSize: pxToRem(14),
|
|
80
|
+
lineHeight: pxToRem(18),
|
|
81
|
+
},
|
|
82
|
+
subtitle3: {
|
|
83
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
84
|
+
fontWeight: fontWeights.text.medium,
|
|
85
|
+
fontStyle: "normal",
|
|
86
|
+
fontSize: pxToRem(12),
|
|
87
|
+
lineHeight: pxToRem(16),
|
|
88
|
+
},
|
|
89
|
+
subtitle4: {
|
|
90
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
91
|
+
fontWeight: fontWeights.text.medium,
|
|
92
|
+
fontStyle: "normal",
|
|
93
|
+
fontSize: pxToRem(10),
|
|
94
|
+
lineHeight: pxToRem(14),
|
|
95
|
+
},
|
|
96
|
+
body1: {
|
|
97
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
98
|
+
fontWeight: fontWeights.text.roman,
|
|
99
|
+
fontStyle: "normal",
|
|
100
|
+
fontSize: pxToRem(16),
|
|
101
|
+
lineHeight: pxToRem(20),
|
|
102
|
+
},
|
|
103
|
+
body2: {
|
|
104
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
105
|
+
fontWeight: fontWeights.text.roman,
|
|
106
|
+
fontStyle: "normal",
|
|
107
|
+
fontSize: pxToRem(14),
|
|
108
|
+
lineHeight: pxToRem(18),
|
|
109
|
+
},
|
|
110
|
+
body3: {
|
|
111
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
112
|
+
fontWeight: fontWeights.text.roman,
|
|
113
|
+
fontStyle: "normal",
|
|
114
|
+
fontSize: pxToRem(12),
|
|
115
|
+
lineHeight: pxToRem(16),
|
|
116
|
+
},
|
|
117
|
+
body4: {
|
|
118
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
119
|
+
fontWeight: fontWeights.text.roman,
|
|
120
|
+
fontStyle: "normal",
|
|
121
|
+
fontSize: pxToRem(10),
|
|
122
|
+
lineHeight: pxToRem(14),
|
|
123
|
+
},
|
|
124
|
+
buttonLarge: {
|
|
125
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
126
|
+
fontWeight: fontWeights.text.medium,
|
|
127
|
+
fontStyle: "normal",
|
|
128
|
+
fontSize: pxToRem(16),
|
|
129
|
+
lineHeight: pxToRem(20),
|
|
130
|
+
},
|
|
131
|
+
button: {
|
|
132
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
133
|
+
fontWeight: fontWeights.text.medium,
|
|
134
|
+
fontStyle: "normal",
|
|
135
|
+
fontSize: pxToRem(14),
|
|
136
|
+
lineHeight: pxToRem(18),
|
|
137
|
+
textTransform: "none",
|
|
138
|
+
},
|
|
139
|
+
buttonSmall: {
|
|
140
|
+
fontFamily: "neue-haas-grotesk-text, sans-serif",
|
|
141
|
+
fontWeight: fontWeights.text.medium,
|
|
142
|
+
fontStyle: "normal",
|
|
143
|
+
fontSize: pxToRem(12),
|
|
144
|
+
lineHeight: pxToRem(16),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
exports.globalSettings = globalSettings;
|
|
148
|
+
const component = {
|
|
149
|
+
defaultProps: {
|
|
150
|
+
variantMapping: {
|
|
151
|
+
h1: "span",
|
|
152
|
+
h2: "span",
|
|
153
|
+
h3: "span",
|
|
154
|
+
h4: "span",
|
|
155
|
+
h5: "span",
|
|
156
|
+
body1: "p",
|
|
157
|
+
body2: "p",
|
|
158
|
+
body3: "p",
|
|
159
|
+
body4: "p",
|
|
160
|
+
subtitle1: "p",
|
|
161
|
+
subtitle2: "p",
|
|
162
|
+
subtitle3: "p",
|
|
163
|
+
subtitle4: "p",
|
|
164
|
+
button: "span",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
exports.component = component;
|
|
169
|
+
const { typography } = (0, styles_1.createTheme)({
|
|
170
|
+
typography: globalSettings,
|
|
171
|
+
// @ts-expect-error: we only care about typography from this theme
|
|
172
|
+
custom: {},
|
|
173
|
+
});
|
|
174
|
+
exports.typography = 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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisuallyHidden = void 0;
|
|
4
|
+
const styled_1 = require("@emotion/styled");
|
|
5
|
+
/**
|
|
6
|
+
* VisuallyHidden is a utility component that hides its children from sighted
|
|
7
|
+
* users, but keeps them accessible to screen readers.
|
|
8
|
+
*
|
|
9
|
+
* Often, screenreader-only content can be handled with an `aria-label`. However,
|
|
10
|
+
* occasionally we need actual elements.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* - a visually hidden aria-live section that reads announcements that
|
|
14
|
+
* isual users can ascertain in some other way.
|
|
15
|
+
* - a visually hidden Heading for a section whose purpose is clear for sighted users
|
|
16
|
+
* - a visually hidden description used for aria-describeddby
|
|
17
|
+
* - There is an aria-description attribute that can be used to provide a
|
|
18
|
+
* without an actual element on the page. However, it is introduced in
|
|
19
|
+
* ARIA 1.3 (working draft), not compatible with some screen readers, and
|
|
20
|
+
* flagged problematic by our linting.
|
|
21
|
+
*
|
|
22
|
+
* The CSS here is based on https://inclusive-components.design/tooltips-toggletips/
|
|
23
|
+
*/
|
|
24
|
+
const VisuallyHidden = styled_1.default.span({
|
|
25
|
+
clipPath: "inset(100%)",
|
|
26
|
+
clip: "rect(1px, 1px, 1px, 1px)",
|
|
27
|
+
height: "1px",
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
whiteSpace: "nowrap",
|
|
31
|
+
width: "1px",
|
|
32
|
+
});
|
|
33
|
+
exports.VisuallyHidden = 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,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScreenreaderOnly = void 0;
|
|
4
|
+
const VisuallyHidden_1 = require("./VisuallyHidden");
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "smoot-design/VisuallyHidden",
|
|
7
|
+
component: VisuallyHidden_1.VisuallyHidden,
|
|
8
|
+
args: {
|
|
9
|
+
children: "Not visible, but screen readers can still read this text.",
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = meta;
|
|
13
|
+
exports.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,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Description = exports.ControlLabel = exports.FormFieldWrapper = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const styled_1 = require("@emotion/styled");
|
|
6
|
+
const react_1 = require("@remixicon/react");
|
|
7
|
+
const Typography_1 = require("@mui/material/Typography");
|
|
8
|
+
const Required = styled_1.default.span(({ theme }) => ({
|
|
9
|
+
color: theme.custom.colors.lightRed,
|
|
10
|
+
marginLeft: "4px",
|
|
11
|
+
}));
|
|
12
|
+
const Description = styled_1.default.div(({ theme, error }) => [
|
|
13
|
+
Object.assign(Object.assign({}, theme.typography.body2), { color: error
|
|
14
|
+
? theme.custom.colors.lightRed
|
|
15
|
+
: theme.custom.colors.silverGrayDark }),
|
|
16
|
+
error && {
|
|
17
|
+
textIndent: "-24px",
|
|
18
|
+
paddingLeft: "24px",
|
|
19
|
+
"> svg:first-of-type": {
|
|
20
|
+
marginRight: "4px",
|
|
21
|
+
transform: "translateY(2px)",
|
|
22
|
+
width: "18px",
|
|
23
|
+
height: "18px",
|
|
24
|
+
position: "relative",
|
|
25
|
+
top: "2px",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
exports.Description = Description;
|
|
30
|
+
const Container = styled_1.default.div(({ fullWidth }) => [
|
|
31
|
+
{
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
alignItems: "start",
|
|
35
|
+
"> *:not(:last-child)": {
|
|
36
|
+
marginBottom: "4px",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
fullWidth && {
|
|
40
|
+
width: "100%",
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
const ControlLabel = ({ htmlFor, label, required, id, fullWidth, }) => {
|
|
44
|
+
return (React.createElement(Typography_1.default, { id: id, component: "label", htmlFor: htmlFor, variant: "subtitle2", sx: { marginBottom: "4px", width: fullWidth ? "100%" : "auto" } },
|
|
45
|
+
label,
|
|
46
|
+
required ? React.createElement(Required, { "aria-hidden": "true" }, "*") : null));
|
|
47
|
+
};
|
|
48
|
+
exports.ControlLabel = ControlLabel;
|
|
49
|
+
const FormFieldWrapper = ({ label, required, helpText, error, errorText, className, fullWidth, id, children, }) => {
|
|
50
|
+
const fallbackInputId = React.useId();
|
|
51
|
+
const inputId = id || fallbackInputId;
|
|
52
|
+
const helpId = React.useId();
|
|
53
|
+
const errorId = React.useId();
|
|
54
|
+
const labelId = React.useId();
|
|
55
|
+
/**
|
|
56
|
+
* aria-errormessage would be more semantic for the error message but has
|
|
57
|
+
* somewhat limited support. See https://github.com/w3c/aria/issues/2048 for
|
|
58
|
+
* some related information.
|
|
59
|
+
*/
|
|
60
|
+
const describedBy = [helpText && helpId, error && errorText && errorId]
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join(" ") || undefined;
|
|
63
|
+
return (React.createElement(Container, { className: className, fullWidth: fullWidth },
|
|
64
|
+
React.createElement(ControlLabel, { htmlFor: inputId, id: labelId, label: label, required: required, fullWidth: fullWidth }),
|
|
65
|
+
children({
|
|
66
|
+
id: inputId,
|
|
67
|
+
error,
|
|
68
|
+
required,
|
|
69
|
+
labelId,
|
|
70
|
+
fullWidth,
|
|
71
|
+
"aria-describedby": describedBy,
|
|
72
|
+
}),
|
|
73
|
+
helpText && React.createElement(Description, { id: helpId }, helpText),
|
|
74
|
+
error && errorText && (React.createElement(Description, { id: errorId, error: true },
|
|
75
|
+
React.createElement(react_1.RiErrorWarningLine, { fontSize: "inherit" }),
|
|
76
|
+
errorText))));
|
|
77
|
+
};
|
|
78
|
+
exports.FormFieldWrapper = FormFieldWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const React = require("react");
|
|
15
|
+
const react_1 = require("@testing-library/react");
|
|
16
|
+
const FormHelpers_1 = require("./FormHelpers");
|
|
17
|
+
const ThemeProvider_1 = require("../../../components/ThemeProvider/ThemeProvider");
|
|
18
|
+
const en_1 = require("@faker-js/faker/locale/en");
|
|
19
|
+
const assertDescription = ({ text, total, exists, }) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const input = react_1.screen.getByRole("textbox");
|
|
22
|
+
const describedBy = input.getAttribute("aria-describedby");
|
|
23
|
+
const descriptionIds = (_a = describedBy === null || describedBy === void 0 ? void 0 : describedBy.split(" ")) !== null && _a !== void 0 ? _a : [];
|
|
24
|
+
if (total === 0) {
|
|
25
|
+
expect(describedBy).toBe(null);
|
|
26
|
+
}
|
|
27
|
+
expect(descriptionIds.length).toBe(total);
|
|
28
|
+
const description = react_1.screen.queryByText(text);
|
|
29
|
+
expect(!!description).toBe(exists);
|
|
30
|
+
if (exists) {
|
|
31
|
+
expect(description).toBeInTheDocument();
|
|
32
|
+
expect(descriptionIds).toContain(description === null || description === void 0 ? void 0 : description.id);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
describe("FormFieldWrapper", () => {
|
|
36
|
+
const setup = (props) => {
|
|
37
|
+
const defaults = {
|
|
38
|
+
name: "test-name",
|
|
39
|
+
value: "test-value",
|
|
40
|
+
label: "test-label",
|
|
41
|
+
};
|
|
42
|
+
const { rerender: _rerender } = (0, react_1.render)(React.createElement(FormHelpers_1.FormFieldWrapper, Object.assign({}, defaults, props), (_a) => {
|
|
43
|
+
var { error, labelId, fullWidth } = _a, childProps = __rest(_a, ["error", "labelId", "fullWidth"]);
|
|
44
|
+
return (React.createElement("input", Object.assign({}, childProps)));
|
|
45
|
+
}), {
|
|
46
|
+
wrapper: ThemeProvider_1.ThemeProvider,
|
|
47
|
+
});
|
|
48
|
+
const rerender = (newProps) => {
|
|
49
|
+
_rerender(React.createElement(FormHelpers_1.FormFieldWrapper, Object.assign({}, defaults, newProps), (_a) => {
|
|
50
|
+
var { error, labelId, fullWidth } = _a, childProps = __rest(_a, ["error", "labelId", "fullWidth"]);
|
|
51
|
+
return (React.createElement("input", Object.assign({}, childProps)));
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
return { rerender };
|
|
55
|
+
};
|
|
56
|
+
it("Labels the input", () => {
|
|
57
|
+
const label = en_1.faker.lorem.words();
|
|
58
|
+
setup({ label });
|
|
59
|
+
const input = react_1.screen.getByRole("textbox", { name: label });
|
|
60
|
+
expect(input).toBeInstanceOf(HTMLInputElement);
|
|
61
|
+
});
|
|
62
|
+
it("Has a description only if description provided", () => {
|
|
63
|
+
const label = en_1.faker.lorem.words();
|
|
64
|
+
const helpText = en_1.faker.lorem.words();
|
|
65
|
+
const { rerender } = setup({ label, helpText });
|
|
66
|
+
assertDescription({ text: helpText, total: 1, exists: true });
|
|
67
|
+
rerender({ label });
|
|
68
|
+
assertDescription({ text: helpText, total: 0, exists: false });
|
|
69
|
+
});
|
|
70
|
+
it("Has an error message only if errorText provided AND error=true", () => {
|
|
71
|
+
const label = en_1.faker.lorem.words();
|
|
72
|
+
const errorText = en_1.faker.lorem.words();
|
|
73
|
+
const { rerender } = setup({ label, errorText, error: true });
|
|
74
|
+
assertDescription({ text: errorText, total: 1, exists: true });
|
|
75
|
+
rerender({ label, errorText });
|
|
76
|
+
assertDescription({ text: errorText, total: 0, exists: false });
|
|
77
|
+
rerender({ label, error: true });
|
|
78
|
+
assertDescription({ text: errorText, total: 0, exists: false });
|
|
79
|
+
rerender({ label, errorText, error: true });
|
|
80
|
+
assertDescription({ text: errorText, total: 1, exists: true });
|
|
81
|
+
});
|
|
82
|
+
it("Shows both description and errormessage if both provided and error", () => {
|
|
83
|
+
const label = en_1.faker.lorem.words();
|
|
84
|
+
const errorText = en_1.faker.lorem.words();
|
|
85
|
+
const helpText = en_1.faker.lorem.words();
|
|
86
|
+
const { rerender } = setup({ label, errorText, helpText });
|
|
87
|
+
assertDescription({ text: helpText, total: 1, exists: true });
|
|
88
|
+
assertDescription({ text: errorText, total: 1, exists: false });
|
|
89
|
+
rerender({ label, errorText, helpText, error: true });
|
|
90
|
+
assertDescription({ text: helpText, total: 2, exists: true });
|
|
91
|
+
assertDescription({ text: errorText, total: 2, exists: true });
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as styled } from "@emotion/styled";
|
|
2
|
+
export { css, Global } from "@emotion/react";
|
|
3
|
+
export { AppRouterCacheProvider as NextJsAppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter";
|
|
4
|
+
export { ThemeProvider, createTheme, } from "./components/ThemeProvider/ThemeProvider";
|
|
5
|
+
export { Button, ButtonLink } from "./components/Button/Button";
|
|
6
|
+
export type { ButtonProps, ButtonLinkProps } from "./components/Button/Button";
|
|
7
|
+
export { ActionButton, ActionButtonLink, } from "./components/Button/ActionButton";
|
|
8
|
+
export type { ActionButtonProps, ActionButtonLinkProps, } from "./components/Button/ActionButton";
|
|
9
|
+
export type { LinkAdapterPropsOverrides } from "./components/LinkAdapter/LinkAdapter";
|
|
10
|
+
export { Input } from "./components/Input/Input";
|
|
11
|
+
export type { InputProps } from "./components/Input/Input";
|
|
12
|
+
export { TextField } from "./components/TextField/TextField";
|
|
13
|
+
export type { TextFieldProps } from "./components/TextField/TextField";
|
|
14
|
+
export { SrAnnouncer } from "./components/SrAnnouncer/SrAnnouncer";
|
|
15
|
+
export type { SrAnnouncerProps } from "./components/SrAnnouncer/SrAnnouncer";
|
|
16
|
+
export { VisuallyHidden } from "./components/VisuallyHidden/VisuallyHidden";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.VisuallyHidden = exports.SrAnnouncer = exports.TextField = exports.Input = exports.ActionButtonLink = exports.ActionButton = exports.ButtonLink = exports.Button = exports.createTheme = exports.ThemeProvider = exports.NextJsAppRouterCacheProvider = exports.Global = exports.css = exports.styled = void 0;
|
|
5
|
+
var styled_1 = require("@emotion/styled");
|
|
6
|
+
Object.defineProperty(exports, "styled", { enumerable: true, get: function () { return styled_1.default; } });
|
|
7
|
+
var react_1 = require("@emotion/react");
|
|
8
|
+
Object.defineProperty(exports, "css", { enumerable: true, get: function () { return react_1.css; } });
|
|
9
|
+
Object.defineProperty(exports, "Global", { enumerable: true, get: function () { return react_1.Global; } });
|
|
10
|
+
var v15_appRouter_1 = require("@mui/material-nextjs/v15-appRouter");
|
|
11
|
+
Object.defineProperty(exports, "NextJsAppRouterCacheProvider", { enumerable: true, get: function () { return v15_appRouter_1.AppRouterCacheProvider; } });
|
|
12
|
+
var ThemeProvider_1 = require("./components/ThemeProvider/ThemeProvider");
|
|
13
|
+
Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return ThemeProvider_1.ThemeProvider; } });
|
|
14
|
+
Object.defineProperty(exports, "createTheme", { enumerable: true, get: function () { return ThemeProvider_1.createTheme; } });
|
|
15
|
+
var Button_1 = require("./components/Button/Button");
|
|
16
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
17
|
+
Object.defineProperty(exports, "ButtonLink", { enumerable: true, get: function () { return Button_1.ButtonLink; } });
|
|
18
|
+
var ActionButton_1 = require("./components/Button/ActionButton");
|
|
19
|
+
Object.defineProperty(exports, "ActionButton", { enumerable: true, get: function () { return ActionButton_1.ActionButton; } });
|
|
20
|
+
Object.defineProperty(exports, "ActionButtonLink", { enumerable: true, get: function () { return ActionButton_1.ActionButtonLink; } });
|
|
21
|
+
var Input_1 = require("./components/Input/Input");
|
|
22
|
+
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });
|
|
23
|
+
var TextField_1 = require("./components/TextField/TextField");
|
|
24
|
+
Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return TextField_1.TextField; } });
|
|
25
|
+
var SrAnnouncer_1 = require("./components/SrAnnouncer/SrAnnouncer");
|
|
26
|
+
Object.defineProperty(exports, "SrAnnouncer", { enumerable: true, get: function () { return SrAnnouncer_1.SrAnnouncer; } });
|
|
27
|
+
var VisuallyHidden_1 = require("./components/VisuallyHidden/VisuallyHidden");
|
|
28
|
+
Object.defineProperty(exports, "VisuallyHidden", { enumerable: true, get: function () { return VisuallyHidden_1.VisuallyHidden; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
5
|
+
const failOnConsole = require("jest-fail-on-console");
|
|
6
|
+
failOnConsole();
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
const scrollBy = jest.fn();
|
|
9
|
+
HTMLElement.prototype.scrollBy = scrollBy;
|
|
10
|
+
});
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
/**
|
|
13
|
+
* Clear all mock call counts between tests.
|
|
14
|
+
* This does NOT clear mock implementations.
|
|
15
|
+
* Mock implementations are always cleared between test files.
|
|
16
|
+
*/
|
|
17
|
+
jest.clearAllMocks();
|
|
18
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TestEnvironment } from "jest-environment-jsdom";
|
|
2
|
+
import { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment";
|
|
3
|
+
declare class JSDOMEnvironmentExtended extends TestEnvironment {
|
|
4
|
+
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
|
|
5
|
+
}
|
|
6
|
+
export default JSDOMEnvironmentExtended;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Jest environment extended with Web APIs para tranbajar con MSW
|
|
4
|
+
const jest_environment_jsdom_1 = require("jest-environment-jsdom");
|
|
5
|
+
class JSDOMEnvironmentExtended extends jest_environment_jsdom_1.TestEnvironment {
|
|
6
|
+
constructor(config, context) {
|
|
7
|
+
super(config, context);
|
|
8
|
+
this.global.TransformStream = TransformStream;
|
|
9
|
+
this.global.ReadableStream = ReadableStream;
|
|
10
|
+
this.global.Response = Response;
|
|
11
|
+
this.global.TextDecoderStream = TextDecoderStream;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = JSDOMEnvironmentExtended;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A type helper just to make sure an array contains union values.
|
|
3
|
+
*/
|
|
4
|
+
declare const enumValues: <T extends string | undefined>(obj: Record<NonNullable<T>, unknown>) => NonNullable<T>[];
|
|
5
|
+
declare const gitLink: (filepath: string) => string;
|
|
6
|
+
export { enumValues, gitLink };
|