@databiosphere/findable-ui 23.0.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/.storybook/preview.js +4 -37
- package/CHANGELOG.md +25 -0
- package/jest.config.js +1 -0
- package/lib/components/Export/components/ExportForm/exportForm.styles.d.ts +2 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
- package/lib/components/Loading/loading.stories.d.ts +3 -31
- package/lib/components/Login/components/Button/button.styles.d.ts +1 -1
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepContent/stepContent.styles.js +17 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.js +4 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.d.ts +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/constants.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.js +27 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.d.ts +9 -0
- package/lib/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.js +38 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.js +11 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.js +9 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.js +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.d.ts +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.js +20 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.js +1 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/constants.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.js +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.d.ts +7 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.js +21 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.js +5 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/constants.js +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.d.ts +2 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.js +6 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.d.ts +3 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.js +12 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/contants.js +15 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.js +37 -0
- package/lib/components/Stepper/components/Step/constants.d.ts +2 -0
- package/lib/components/Stepper/components/Step/constants.js +4 -0
- package/lib/components/Stepper/components/Step/step.d.ts +3 -0
- package/lib/components/Stepper/components/Step/step.js +6 -0
- package/lib/components/Stepper/components/Step/step.styles.d.ts +5 -0
- package/lib/components/Stepper/components/Step/step.styles.js +31 -0
- package/lib/components/Stepper/components/Step/stories/contants.d.ts +4 -0
- package/lib/components/Stepper/components/Step/stories/contants.js +14 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.d.ts +8 -0
- package/lib/components/Stepper/components/Step/stories/step.stories.js +62 -0
- package/lib/components/common/Form/components/Input/input.styles.d.ts +1 -1
- package/lib/components/common/Form/components/Select/select.js +2 -1
- package/lib/components/common/Form/components/Select/select.styles.d.ts +1 -1
- package/lib/components/common/Input/input.styles.d.ts +1 -1
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/KeyElType/keyElType.js +6 -2
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.d.ts +2 -5
- package/lib/components/common/KeyValuePairs/components/ValueElType/valueElType.js +6 -2
- package/lib/storybook/controls/constants.d.ts +4 -0
- package/lib/storybook/controls/constants.js +6 -0
- package/lib/storybook/controls/types.d.ts +4 -0
- package/lib/storybook/controls/types.js +5 -0
- package/lib/storybook/controls/utils.d.ts +9 -0
- package/lib/storybook/controls/utils.js +10 -0
- package/lib/storybook/decorators.d.ts +2 -0
- package/lib/storybook/decorators.js +11 -0
- package/lib/storybook/loremIpsum.d.ts +4 -0
- package/lib/storybook/loremIpsum.js +4 -0
- package/lib/storybook/parameters.d.ts +2 -0
- package/lib/storybook/parameters.js +12 -0
- package/lib/styles/common/mui/stepper.d.ts +7 -0
- package/lib/styles/common/mui/stepper.js +7 -0
- package/lib/styles/common/mui/svgIcon.d.ts +9 -0
- package/lib/styles/common/mui/svgIcon.js +26 -0
- package/lib/styles/common/mui/typography.js +1 -0
- package/lib/tests/mui/constants.d.ts +4 -0
- package/lib/tests/mui/constants.js +4 -0
- package/lib/theme/common/components.js +0 -4
- package/lib/theme/common/typography.d.ts +5 -1
- package/lib/theme/common/typography.js +10 -1
- package/lib/theme/theme.js +1 -0
- package/lib/utils/tests.d.ts +12 -0
- package/lib/utils/tests.js +20 -0
- package/package.json +1 -1
- package/src/components/Loading/loading.stories.tsx +2 -2
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.styles.ts +18 -0
- package/src/components/Stepper/components/Step/components/StepContent/stepContent.tsx +16 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.styles.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/completedIcon.tsx +20 -0
- package/src/components/Stepper/components/Step/components/StepIcon/components/CompletedIcon/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepIcon/constants.ts +1 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.styles.ts +32 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stepIcon.tsx +21 -0
- package/src/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories.tsx +52 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/constants.ts +14 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/icon.tsx +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/contants.ts +6 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/stories/icon.stories.tsx +30 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/components/Icon/types.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/constants.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.styles.ts +8 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/label.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Label/stories/label.stories.tsx +31 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/constants.ts +7 -0
- package/src/components/Stepper/components/Step/components/StepLabel/components/Optional/optional.tsx +9 -0
- package/src/components/Stepper/components/Step/components/StepLabel/constants.ts +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.styles.ts +13 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stepLabel.tsx +10 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/contants.ts +19 -0
- package/src/components/Stepper/components/Step/components/StepLabel/stories/stepLabel.stories.tsx +48 -0
- package/src/components/Stepper/components/Step/constants.ts +6 -0
- package/src/components/Stepper/components/Step/step.styles.ts +33 -0
- package/src/components/Stepper/components/Step/step.tsx +12 -0
- package/src/components/Stepper/components/Step/stories/contants.ts +18 -0
- package/src/components/Stepper/components/Step/stories/step.stories.tsx +87 -0
- package/src/components/common/Form/components/Select/select.tsx +8 -1
- package/src/components/common/KeyValuePairs/components/KeyElType/keyElType.tsx +14 -9
- package/src/components/common/KeyValuePairs/components/ValueElType/valueElType.tsx +8 -9
- package/src/storybook/controls/constants.ts +12 -0
- package/src/storybook/controls/types.ts +4 -0
- package/src/storybook/controls/utils.ts +18 -0
- package/src/storybook/decorators.tsx +17 -0
- package/src/storybook/loremIpsum.ts +5 -0
- package/src/storybook/parameters.ts +14 -0
- package/src/styles/common/mui/stepper.ts +14 -0
- package/src/styles/common/mui/svgIcon.ts +35 -0
- package/src/styles/common/mui/typography.ts +1 -0
- package/src/tests/mui/constants.ts +4 -0
- package/src/theme/common/components.ts +0 -4
- package/src/theme/common/typography.ts +11 -0
- package/src/theme/theme.ts +1 -0
- package/src/utils/tests.ts +20 -0
- package/tests/setup.ts +6 -0
- package/tests/stepIcon.test.tsx +42 -0
- package/types/data-explorer-ui.d.ts +3 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Stepper } from "@mui/material";
|
|
2
|
+
import { Meta, StoryObj, composeStories } from "@storybook/react";
|
|
3
|
+
import React, { ComponentProps } from "react";
|
|
4
|
+
import { CONTROL_TYPE } from "../../../../../storybook/controls/types";
|
|
5
|
+
import { configureControls } from "../../../../../storybook/controls/utils";
|
|
6
|
+
import { LOREM_IPSUM } from "../../../../../storybook/loremIpsum";
|
|
7
|
+
import { STEPPER_PROPS } from "../../../../../styles/common/mui/stepper";
|
|
8
|
+
import { StepContent } from "../components/StepContent/stepContent";
|
|
9
|
+
import * as stories from "../components/StepLabel/stories/stepLabel.stories";
|
|
10
|
+
import { Step } from "../step";
|
|
11
|
+
import { BOOLEAN_CONTROLS, DISABLED_CONTROLS } from "./contants";
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
Active: ActiveStepLabel,
|
|
15
|
+
Completed: CompletedStepLabel,
|
|
16
|
+
Default: StepLabel,
|
|
17
|
+
} = composeStories(stories);
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof Step> = {
|
|
20
|
+
argTypes: {
|
|
21
|
+
...configureControls<ComponentProps<typeof Step>>(
|
|
22
|
+
DISABLED_CONTROLS,
|
|
23
|
+
CONTROL_TYPE.DISABLED
|
|
24
|
+
),
|
|
25
|
+
...configureControls<ComponentProps<typeof Step>>(
|
|
26
|
+
BOOLEAN_CONTROLS,
|
|
27
|
+
CONTROL_TYPE.BOOLEAN
|
|
28
|
+
),
|
|
29
|
+
index: { control: { type: "number" } },
|
|
30
|
+
},
|
|
31
|
+
component: Step,
|
|
32
|
+
decorators: [
|
|
33
|
+
(Story, context): JSX.Element => (
|
|
34
|
+
<Stepper
|
|
35
|
+
connector={null}
|
|
36
|
+
orientation={STEPPER_PROPS.ORIENTATION.VERTICAL}
|
|
37
|
+
sx={{
|
|
38
|
+
display: "grid",
|
|
39
|
+
gridTemplateColumns: "minmax(auto, 816px)",
|
|
40
|
+
height: "100vh",
|
|
41
|
+
placeContent: "center center",
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<Story {...context} />
|
|
45
|
+
</Stepper>
|
|
46
|
+
),
|
|
47
|
+
],
|
|
48
|
+
parameters: { layout: "fullscreen" },
|
|
49
|
+
title: "Components/Stepper/Step",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default meta;
|
|
53
|
+
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
export const Active: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
active: true,
|
|
59
|
+
children: [
|
|
60
|
+
<ActiveStepLabel key="label" />,
|
|
61
|
+
<StepContent key="step-content">{LOREM_IPSUM.LONG}</StepContent>,
|
|
62
|
+
],
|
|
63
|
+
completed: false,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Completed: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
active: false,
|
|
70
|
+
children: [
|
|
71
|
+
<CompletedStepLabel key="label" />,
|
|
72
|
+
<StepContent key="step-content">{LOREM_IPSUM.LONG}</StepContent>,
|
|
73
|
+
],
|
|
74
|
+
completed: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Default: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
active: false,
|
|
81
|
+
children: [
|
|
82
|
+
<StepLabel key="label" />,
|
|
83
|
+
<StepContent key="step-content">{LOREM_IPSUM.LONG}</StepContent>,
|
|
84
|
+
],
|
|
85
|
+
completed: false,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "@mui/material";
|
|
6
6
|
import React, { ReactNode } from "react";
|
|
7
7
|
import { TEXT_BODY_400 } from "../../../../../theme/common/typography";
|
|
8
|
+
import { DropDownIcon } from "./components/DropDownIcon/dropDownIcon";
|
|
8
9
|
import { InputFormControl } from "./select.styles";
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -29,7 +30,13 @@ export const Select = ({
|
|
|
29
30
|
return (
|
|
30
31
|
<InputFormControl className={className} isFilled={isFilled}>
|
|
31
32
|
{label && <Typography variant={TEXT_BODY_400}>{label}</Typography>}
|
|
32
|
-
<MSelect
|
|
33
|
+
<MSelect
|
|
34
|
+
fullWidth
|
|
35
|
+
IconComponent={DropDownIcon}
|
|
36
|
+
inputProps={{ onBlur }}
|
|
37
|
+
size="small"
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
33
40
|
{children}
|
|
34
41
|
</MSelect>
|
|
35
42
|
</InputFormControl>
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { Typography } from "@mui/material";
|
|
2
|
-
import React
|
|
1
|
+
import { Typography, TypographyProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../styles/common/mui/typography";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Basic KeyValuePairs "key" wrapper component.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
|
-
export interface KeyElTypeProps {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
9
|
export const KeyElType = ({
|
|
13
10
|
children,
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
color = TYPOGRAPHY_PROPS.COLOR.INK_LIGHT,
|
|
12
|
+
component = "div",
|
|
13
|
+
variant = TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES,
|
|
14
|
+
...props /* MuiTypographyProps */
|
|
15
|
+
}: TypographyProps): JSX.Element => {
|
|
16
16
|
return (
|
|
17
|
-
<Typography
|
|
17
|
+
<Typography
|
|
18
|
+
color={color}
|
|
19
|
+
component={component}
|
|
20
|
+
variant={variant}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
18
23
|
{children}
|
|
19
24
|
</Typography>
|
|
20
25
|
);
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { Typography } from "@mui/material";
|
|
2
|
-
import React
|
|
1
|
+
import { Typography, TypographyProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../styles/common/mui/typography";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Basic KeyValuePairs "value" wrapper component.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
|
-
export interface ValueElTypeProps {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
9
|
export const ValueElType = ({
|
|
13
10
|
children,
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
component = "div",
|
|
12
|
+
variant = TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400_2_LINES,
|
|
13
|
+
...props /* MuiTypographyProps */
|
|
14
|
+
}: TypographyProps): JSX.Element => {
|
|
16
15
|
return (
|
|
17
|
-
<Typography variant=
|
|
16
|
+
<Typography component={component} variant={variant} {...props}>
|
|
18
17
|
{children}
|
|
19
18
|
</Typography>
|
|
20
19
|
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArgTypes } from "@storybook/react";
|
|
2
|
+
import { CONTROL_TYPE } from "./types";
|
|
3
|
+
|
|
4
|
+
export const CONTROL_CONFIG_MAP: Record<
|
|
5
|
+
CONTROL_TYPE,
|
|
6
|
+
ArgTypes[keyof ArgTypes]["control"]
|
|
7
|
+
> = {
|
|
8
|
+
[CONTROL_TYPE.BOOLEAN]: { type: "boolean" },
|
|
9
|
+
[CONTROL_TYPE.DISABLED]: false,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const MUI_CONTROLS = ["classes", "className", "ref", "sx"] as const;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args, ArgTypes } from "@storybook/react";
|
|
2
|
+
import { CONTROL_CONFIG_MAP } from "./constants";
|
|
3
|
+
import { CONTROL_TYPE } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configures controls for specified keys with the given control type.
|
|
7
|
+
* @param keys - ArgType keys.
|
|
8
|
+
* @param controlType - The type of control to apply (from CONTROL_TYPE enum).
|
|
9
|
+
* @returns An object of ArgTypes with the specified control configuration.
|
|
10
|
+
*/
|
|
11
|
+
export function configureControls<TArg = Args>(
|
|
12
|
+
keys: (keyof TArg)[],
|
|
13
|
+
controlType: CONTROL_TYPE
|
|
14
|
+
): Partial<ArgTypes<TArg>> {
|
|
15
|
+
return Object.fromEntries(
|
|
16
|
+
keys.map((key) => [key, { control: CONTROL_CONFIG_MAP[controlType] }])
|
|
17
|
+
) as Partial<ArgTypes<TArg>>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
|
|
2
|
+
import { CssBaseline, ThemeProvider } from "@mui/material";
|
|
3
|
+
import { Preview } from "@storybook/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { createAppTheme } from "../theme/theme";
|
|
6
|
+
|
|
7
|
+
export const decorators: Preview["decorators"] = (Story, context) => {
|
|
8
|
+
const theme = createAppTheme();
|
|
9
|
+
return (
|
|
10
|
+
<EmotionThemeProvider theme={theme}>
|
|
11
|
+
<ThemeProvider theme={theme}>
|
|
12
|
+
<CssBaseline />
|
|
13
|
+
<Story {...context} />
|
|
14
|
+
</ThemeProvider>
|
|
15
|
+
</EmotionThemeProvider>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const LOREM_IPSUM = {
|
|
2
|
+
LONG: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
|
3
|
+
SHORT:
|
|
4
|
+
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.",
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Preview } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
export const parameters: Preview["parameters"] = {
|
|
4
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
5
|
+
controls: {
|
|
6
|
+
expanded: true,
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/,
|
|
10
|
+
},
|
|
11
|
+
sort: "alpha",
|
|
12
|
+
},
|
|
13
|
+
layout: "centered",
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StepperProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type StepperPropsOptions = {
|
|
4
|
+
ORIENTATION: typeof ORIENTATION;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const ORIENTATION: Record<string, StepperProps["orientation"]> = {
|
|
8
|
+
HORIZONTAL: "horizontal",
|
|
9
|
+
VERTICAL: "vertical",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const STEPPER_PROPS: StepperPropsOptions = {
|
|
13
|
+
ORIENTATION,
|
|
14
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvgIconProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type SvgIconPropsOptions = {
|
|
4
|
+
COLOR: typeof COLOR;
|
|
5
|
+
FONT_SIZE: typeof FONT_SIZE;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const COLOR: Record<string, SvgIconProps["color"]> = {
|
|
9
|
+
ACTION: "action",
|
|
10
|
+
DISABLED: "disabled",
|
|
11
|
+
ERROR: "error",
|
|
12
|
+
INFO: "info",
|
|
13
|
+
INHERIT: "inherit",
|
|
14
|
+
INK_LIGHT: "inkLight",
|
|
15
|
+
INK_MAIN: "inkMain",
|
|
16
|
+
PRIMARY: "primary",
|
|
17
|
+
SECONDARY: "secondary",
|
|
18
|
+
SUCCESS: "success",
|
|
19
|
+
WARNING: "warning",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const FONT_SIZE: Record<string, SvgIconProps["fontSize"]> = {
|
|
23
|
+
INHERIT: "inherit",
|
|
24
|
+
LARGE: "large",
|
|
25
|
+
MEDIUM: "medium",
|
|
26
|
+
SMALL: "small",
|
|
27
|
+
XSMALL: "xsmall",
|
|
28
|
+
XXLARGE: "xxlarge",
|
|
29
|
+
XXSMALL: "xxsmall",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const SVG_ICON_PROPS: SvgIconPropsOptions = {
|
|
33
|
+
COLOR,
|
|
34
|
+
FONT_SIZE,
|
|
35
|
+
};
|
|
@@ -18,6 +18,7 @@ const VARIANT: Record<string, TypographyOwnProps["variant"]> = {
|
|
|
18
18
|
TEXT_BODY_SMALL_400: "text-body-small-400",
|
|
19
19
|
TEXT_HEADING_LARGE: "text-heading-large",
|
|
20
20
|
TEXT_HEADING_SMALL: "text-heading-small",
|
|
21
|
+
TEXT_HEADING_XSMALL: "text-heading-xsmall",
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export const TYPOGRAPHY_PROPS: TypographyPropsOptions = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Components, Theme } from "@mui/material";
|
|
2
|
-
import { DropDownIcon } from "../../components/common/Form/components/Select/components/DropDownIcon/dropDownIcon";
|
|
3
2
|
import { CHIP_PROPS } from "../../styles/common/mui/chip";
|
|
4
3
|
import { desktopUp, mobileUp, tabletUp } from "./breakpoints";
|
|
5
4
|
import {
|
|
@@ -1180,9 +1179,6 @@ export const MuiRadio = (theme: Theme): Components["MuiRadio"] => {
|
|
|
1180
1179
|
* MuiSelect Component
|
|
1181
1180
|
*/
|
|
1182
1181
|
export const MuiSelect: Components["MuiSelect"] = {
|
|
1183
|
-
defaultProps: {
|
|
1184
|
-
IconComponent: DropDownIcon,
|
|
1185
|
-
},
|
|
1186
1182
|
styleOverrides: {
|
|
1187
1183
|
select: {
|
|
1188
1184
|
minHeight: "unset",
|
|
@@ -20,6 +20,7 @@ const TYPOGRAPHY = {
|
|
|
20
20
|
TEXT_HEADING_LARGE: "text-heading-large",
|
|
21
21
|
TEXT_HEADING_SMALL: "text-heading-small",
|
|
22
22
|
TEXT_HEADING_XLARGE: "text-heading-xlarge",
|
|
23
|
+
TEXT_HEADING_XSMALL: "text-heading-xsmall",
|
|
23
24
|
TEXT_UPPERCASE_500: "text-uppercase-500",
|
|
24
25
|
} as const;
|
|
25
26
|
export const {
|
|
@@ -37,6 +38,7 @@ export const {
|
|
|
37
38
|
TEXT_HEADING_LARGE,
|
|
38
39
|
TEXT_HEADING_SMALL,
|
|
39
40
|
TEXT_HEADING_XLARGE,
|
|
41
|
+
TEXT_HEADING_XSMALL,
|
|
40
42
|
TEXT_UPPERCASE_500,
|
|
41
43
|
} = TYPOGRAPHY;
|
|
42
44
|
|
|
@@ -189,6 +191,15 @@ export const textHeadingXLarge: CSSProperties = {
|
|
|
189
191
|
},
|
|
190
192
|
};
|
|
191
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Typography Option "text-heading-xsmall"
|
|
196
|
+
*/
|
|
197
|
+
export const textHeadingXSmall: CSSProperties = {
|
|
198
|
+
fontSize: 16,
|
|
199
|
+
fontWeight: 500,
|
|
200
|
+
lineHeight: "24px",
|
|
201
|
+
};
|
|
202
|
+
|
|
192
203
|
/**
|
|
193
204
|
* Typography Option "text-uppercase-500"
|
|
194
205
|
*/
|
package/src/theme/theme.ts
CHANGED
|
@@ -55,6 +55,7 @@ export function createAppTheme(customOptions?: ThemeOptions): Theme {
|
|
|
55
55
|
[T.TEXT_HEADING_LARGE]: T.textHeadingLarge,
|
|
56
56
|
[T.TEXT_HEADING_SMALL]: T.textHeadingSmall,
|
|
57
57
|
[T.TEXT_HEADING_XLARGE]: T.textHeadingXLarge,
|
|
58
|
+
[T.TEXT_HEADING_XSMALL]: T.textHeadingXSmall,
|
|
58
59
|
[T.TEXT_UPPERCASE_500]: T.textUppercase500,
|
|
59
60
|
fontFamily: T.fontFamily,
|
|
60
61
|
},
|
package/src/utils/tests.ts
CHANGED
|
@@ -17,3 +17,23 @@ export function getAnchorEl(id: string): HTMLAnchorElement {
|
|
|
17
17
|
export function getButtonById(id: string): HTMLButtonElement {
|
|
18
18
|
return screen.getByTestId(id);
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns class names of the given element.
|
|
23
|
+
* @param element - Element.
|
|
24
|
+
* @returns element class names.
|
|
25
|
+
*/
|
|
26
|
+
export function getClassNames(element?: Element | null): string | null {
|
|
27
|
+
if (!element) return null;
|
|
28
|
+
return element.getAttribute("class");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns tag name of the given element.
|
|
33
|
+
* @param element - Element.
|
|
34
|
+
* @returns element tag name.
|
|
35
|
+
*/
|
|
36
|
+
export function getTagName(element?: Element | null): string | null {
|
|
37
|
+
if (!element) return null;
|
|
38
|
+
return element.tagName.toLowerCase();
|
|
39
|
+
}
|
package/tests/setup.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { setProjectAnnotations } from "@storybook/react";
|
|
2
|
+
import { decorators } from "../src/storybook/decorators";
|
|
3
|
+
import { parameters } from "../src/storybook/parameters";
|
|
4
|
+
|
|
5
|
+
// Set project annotations once before all tests
|
|
6
|
+
setProjectAnnotations({ decorators, parameters });
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { composeStories } from "@storybook/react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { STEP_ICON_TEST_ID } from "../src/components/Stepper/components/Step/components/StepIcon/constants";
|
|
5
|
+
import * as stories from "../src/components/Stepper/components/Step/components/StepIcon/stories/stepIcon.stories";
|
|
6
|
+
import { MUI_CLASSES } from "../src/tests/mui/constants";
|
|
7
|
+
import { getClassNames, getTagName } from "../src/utils/tests";
|
|
8
|
+
|
|
9
|
+
const { Active, Completed, Default } = composeStories(stories);
|
|
10
|
+
|
|
11
|
+
describe("StepIcon", () => {
|
|
12
|
+
it("renders correctly", () => {
|
|
13
|
+
render(<Default testId={STEP_ICON_TEST_ID} />);
|
|
14
|
+
const stepIconEl = screen.getByTestId(STEP_ICON_TEST_ID);
|
|
15
|
+
expect(stepIconEl).not.toBeNull();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("renders inactive step icon", () => {
|
|
19
|
+
render(<Default testId={STEP_ICON_TEST_ID} />);
|
|
20
|
+
const stepIconEl = screen.getByTestId(STEP_ICON_TEST_ID);
|
|
21
|
+
expect(stepIconEl.textContent).toEqual("1");
|
|
22
|
+
expect(getClassNames(stepIconEl)).not.toContain(MUI_CLASSES.ACTIVE);
|
|
23
|
+
expect(getClassNames(stepIconEl)).not.toContain(MUI_CLASSES.COMPLETED);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("renders active step icon", () => {
|
|
27
|
+
render(<Active testId={STEP_ICON_TEST_ID} />);
|
|
28
|
+
const stepIconEl = screen.getByTestId(STEP_ICON_TEST_ID);
|
|
29
|
+
expect(stepIconEl.textContent).toEqual("1");
|
|
30
|
+
expect(getClassNames(stepIconEl)).toContain(MUI_CLASSES.ACTIVE);
|
|
31
|
+
expect(getClassNames(stepIconEl)).not.toContain(MUI_CLASSES.COMPLETED);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("renders completed step icon", () => {
|
|
35
|
+
render(<Completed testId={STEP_ICON_TEST_ID} />);
|
|
36
|
+
const stepIconEl = screen.getByTestId(STEP_ICON_TEST_ID);
|
|
37
|
+
expect(stepIconEl.textContent).not.toEqual("1");
|
|
38
|
+
expect(getClassNames(stepIconEl)).not.toContain(MUI_CLASSES.ACTIVE);
|
|
39
|
+
expect(getClassNames(stepIconEl)).toContain(MUI_CLASSES.COMPLETED);
|
|
40
|
+
expect(getTagName(stepIconEl.firstElementChild)).toBe("path");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -203,6 +203,7 @@ declare module "@mui/material/styles" {
|
|
|
203
203
|
"text-heading-large": TypographyStyleOptions;
|
|
204
204
|
"text-heading-small": TypographyStyleOptions;
|
|
205
205
|
"text-heading-xlarge": TypographyStyleOptions;
|
|
206
|
+
"text-heading-xsmall": TypographyStyleOptions;
|
|
206
207
|
"text-uppercase-500": TypographyStyleOptions;
|
|
207
208
|
}
|
|
208
209
|
|
|
@@ -221,6 +222,7 @@ declare module "@mui/material/styles" {
|
|
|
221
222
|
"text-heading-large"?: TypographyStyleOptions;
|
|
222
223
|
"text-heading-small"?: TypographyStyleOptions;
|
|
223
224
|
"text-heading-xlarge"?: TypographyStyleOptions;
|
|
225
|
+
"text-heading-xsmall"?: TypographyStyleOptions;
|
|
224
226
|
"text-uppercase-500"?: TypographyStyleOptions;
|
|
225
227
|
}
|
|
226
228
|
}
|
|
@@ -253,6 +255,7 @@ declare module "@mui/material/Typography" {
|
|
|
253
255
|
"text-heading-large": true;
|
|
254
256
|
"text-heading-small": true;
|
|
255
257
|
"text-heading-xlarge": true;
|
|
258
|
+
"text-heading-xsmall": true;
|
|
256
259
|
"text-uppercase-500": true;
|
|
257
260
|
}
|
|
258
261
|
}
|