@okta/odyssey-react-mui 1.0.2 → 1.1.1
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/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/dist/Autocomplete.js +9 -3
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Banner.js +3 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.js +8 -4
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +3 -1
- package/dist/Button.js.map +1 -1
- package/dist/Callout.js +2 -0
- package/dist/Callout.js.map +1 -1
- package/dist/Checkbox.js +6 -2
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.js +5 -7
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/CircularProgress.js +2 -0
- package/dist/CircularProgress.js.map +1 -1
- package/dist/Dialog.js +2 -0
- package/dist/Dialog.js.map +1 -1
- package/dist/Field.js.map +1 -1
- package/dist/FieldError.js +2 -0
- package/dist/FieldError.js.map +1 -1
- package/dist/FieldHint.js +2 -0
- package/dist/FieldHint.js.map +1 -1
- package/dist/FieldLabel.js +3 -1
- package/dist/FieldLabel.js.map +1 -1
- package/dist/Fieldset.js +3 -1
- package/dist/Fieldset.js.map +1 -1
- package/dist/Form.js +5 -3
- package/dist/Form.js.map +1 -1
- package/dist/Link.js +3 -1
- package/dist/Link.js.map +1 -1
- package/dist/MenuButton.js +8 -2
- package/dist/MenuButton.js.map +1 -1
- package/dist/MenuItem.js +6 -2
- package/dist/MenuItem.js.map +1 -1
- package/dist/NativeSelect.js +3 -1
- package/dist/NativeSelect.js.map +1 -1
- package/dist/OdysseyI18n.js +2 -0
- package/dist/OdysseyI18n.js.map +1 -1
- package/dist/OdysseyProvider.js +7 -4
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +3 -6
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/OdysseyTranslationProvider.types.js +1 -1
- package/dist/OdysseyTranslationProvider.types.js.map +1 -1
- package/dist/PasswordField.js +9 -8
- package/dist/PasswordField.js.map +1 -1
- package/dist/Radio.js +2 -0
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +5 -2
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchField.js +11 -10
- package/dist/SearchField.js.map +1 -1
- package/dist/Select.js +8 -5
- package/dist/Select.js.map +1 -1
- package/dist/SeleniumProps.js +2 -0
- package/dist/SeleniumProps.js.map +1 -0
- package/dist/Status.js +4 -2
- package/dist/Status.js.map +1 -1
- package/dist/Tabs.js +11 -4
- package/dist/Tabs.js.map +1 -1
- package/dist/Tag.js +4 -2
- package/dist/Tag.js.map +1 -1
- package/dist/TagList.js +3 -1
- package/dist/TagList.js.map +1 -1
- package/dist/TextField.js +6 -2
- package/dist/TextField.js.map +1 -1
- package/dist/Toast.js +2 -0
- package/dist/Toast.js.map +1 -1
- package/dist/Tooltip.js +2 -0
- package/dist/Tooltip.js.map +1 -1
- package/dist/Typography.js +71 -37
- package/dist/Typography.js.map +1 -1
- package/dist/labs/DatePicker.js +4 -2
- package/dist/labs/DatePicker.js.map +1 -1
- package/dist/labs/PaginatedTable.js +6 -4
- package/dist/labs/PaginatedTable.js.map +1 -1
- package/dist/labs/StaticTable.js +9 -4
- package/dist/labs/StaticTable.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +7 -2
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Banner.d.ts +3 -2
- package/dist/src/Banner.d.ts.map +1 -1
- package/dist/src/Box.d.ts +9 -2
- package/dist/src/Box.d.ts.map +1 -1
- package/dist/src/Button.d.ts +3 -2
- package/dist/src/Button.d.ts.map +1 -1
- package/dist/src/Callout.d.ts +3 -2
- package/dist/src/Callout.d.ts.map +1 -1
- package/dist/src/Checkbox.d.ts +8 -3
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +3 -6
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/CircularProgress.d.ts +3 -2
- package/dist/src/CircularProgress.d.ts.map +1 -1
- package/dist/src/Dialog.d.ts +3 -2
- package/dist/src/Dialog.d.ts.map +1 -1
- package/dist/src/Field.d.ts +2 -1
- package/dist/src/Field.d.ts.map +1 -1
- package/dist/src/FieldError.d.ts +3 -2
- package/dist/src/FieldError.d.ts.map +1 -1
- package/dist/src/FieldHint.d.ts +3 -2
- package/dist/src/FieldHint.d.ts.map +1 -1
- package/dist/src/FieldLabel.d.ts +3 -2
- package/dist/src/FieldLabel.d.ts.map +1 -1
- package/dist/src/Fieldset.d.ts +3 -2
- package/dist/src/Fieldset.d.ts.map +1 -1
- package/dist/src/Form.d.ts +3 -2
- package/dist/src/Form.d.ts.map +1 -1
- package/dist/src/Link.d.ts +3 -2
- package/dist/src/Link.d.ts.map +1 -1
- package/dist/src/MenuButton.d.ts +12 -3
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/MenuItem.d.ts +5 -4
- package/dist/src/MenuItem.d.ts.map +1 -1
- package/dist/src/NativeSelect.d.ts +56 -2
- package/dist/src/NativeSelect.d.ts.map +1 -1
- package/dist/src/OdysseyI18n.d.ts +15 -0
- package/dist/src/OdysseyI18n.d.ts.map +1 -1
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.types.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.types.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts +70 -2
- package/dist/src/PasswordField.d.ts.map +1 -1
- package/dist/src/Radio.d.ts +3 -2
- package/dist/src/Radio.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +8 -3
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/SearchField.d.ts +58 -2
- package/dist/src/SearchField.d.ts.map +1 -1
- package/dist/src/Select.d.ts +60 -2
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/SeleniumProps.d.ts +20 -0
- package/dist/src/SeleniumProps.d.ts.map +1 -0
- package/dist/src/Status.d.ts +3 -2
- package/dist/src/Status.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts +9 -3
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/src/Tag.d.ts +3 -2
- package/dist/src/Tag.d.ts.map +1 -1
- package/dist/src/TagList.d.ts +3 -2
- package/dist/src/TagList.d.ts.map +1 -1
- package/dist/src/TextField.d.ts +86 -2
- package/dist/src/TextField.d.ts.map +1 -1
- package/dist/src/Toast.d.ts +3 -2
- package/dist/src/Toast.d.ts.map +1 -1
- package/dist/src/Tooltip.d.ts +3 -2
- package/dist/src/Tooltip.d.ts.map +1 -1
- package/dist/src/Typography.d.ts +14 -45
- package/dist/src/Typography.d.ts.map +1 -1
- package/dist/src/labs/DatePicker.d.ts +5 -1
- package/dist/src/labs/DatePicker.d.ts.map +1 -1
- package/dist/src/labs/PaginatedTable.d.ts.map +1 -1
- package/dist/src/labs/StaticTable.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +38 -10
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/src/Autocomplete.tsx +13 -2
- package/src/Banner.tsx +11 -2
- package/src/Box.tsx +11 -5
- package/src/Button.tsx +6 -1
- package/src/Callout.tsx +5 -3
- package/src/Checkbox.tsx +14 -4
- package/src/CheckboxGroup.tsx +6 -10
- package/src/CircularProgress.tsx +5 -1
- package/src/Dialog.tsx +5 -2
- package/src/Field.tsx +2 -0
- package/src/FieldError.tsx +5 -3
- package/src/FieldHint.tsx +9 -3
- package/src/FieldLabel.tsx +5 -3
- package/src/Fieldset.tsx +4 -1
- package/src/Form.tsx +7 -4
- package/src/Link.tsx +18 -3
- package/src/MenuButton.tsx +33 -4
- package/src/MenuItem.tsx +11 -6
- package/src/NativeSelect.tsx +7 -2
- package/src/OdysseyI18n.ts +2 -0
- package/src/OdysseyProvider.tsx +9 -6
- package/src/OdysseyThemeProvider.tsx +4 -6
- package/src/OdysseyTranslationProvider.types.ts +1 -0
- package/src/PasswordField.tsx +18 -10
- package/src/Radio.tsx +5 -1
- package/src/RadioGroup.tsx +12 -4
- package/src/SearchField.tsx +23 -15
- package/src/Select.tsx +16 -6
- package/src/SeleniumProps.ts +20 -0
- package/src/Status.tsx +15 -3
- package/src/Tabs.tsx +18 -4
- package/src/Tag.tsx +12 -3
- package/src/TagList.tsx +4 -2
- package/src/TextField.tsx +14 -2
- package/src/Toast.tsx +4 -1
- package/src/Tooltip.tsx +4 -1
- package/src/Typography.tsx +76 -28
- package/src/labs/DatePicker.tsx +15 -7
- package/src/labs/PaginatedTable.tsx +12 -3
- package/src/labs/README.md +2 -2
- package/src/labs/StaticTable.tsx +13 -3
- package/src/theme/components.tsx +43 -9
package/src/Status.tsx
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { Chip } from "@mui/material";
|
|
14
14
|
|
|
15
15
|
import { useMuiProps } from "./MuiPropsContext";
|
|
16
|
+
import type { SeleniumProps } from "./SeleniumProps";
|
|
16
17
|
|
|
17
18
|
export const statusSeverityValues = [
|
|
18
19
|
"default",
|
|
@@ -35,12 +36,23 @@ export type StatusProps = {
|
|
|
35
36
|
* The style of the Status indicator
|
|
36
37
|
*/
|
|
37
38
|
variant?: (typeof statusVariantValues)[number];
|
|
38
|
-
};
|
|
39
|
+
} & SeleniumProps;
|
|
39
40
|
|
|
40
|
-
export const Status = ({
|
|
41
|
+
export const Status = ({
|
|
42
|
+
label,
|
|
43
|
+
severity,
|
|
44
|
+
testId,
|
|
45
|
+
variant = "lamp",
|
|
46
|
+
}: StatusProps) => {
|
|
41
47
|
const muiProps = useMuiProps();
|
|
42
48
|
|
|
43
49
|
return (
|
|
44
|
-
<Chip
|
|
50
|
+
<Chip
|
|
51
|
+
{...muiProps}
|
|
52
|
+
color={severity}
|
|
53
|
+
data-se={testId}
|
|
54
|
+
label={label}
|
|
55
|
+
variant={variant}
|
|
56
|
+
/>
|
|
45
57
|
);
|
|
46
58
|
};
|
package/src/Tabs.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import React, {
|
|
|
15
15
|
ReactNode,
|
|
16
16
|
memo,
|
|
17
17
|
useCallback,
|
|
18
|
+
useEffect,
|
|
18
19
|
useState,
|
|
19
20
|
} from "react";
|
|
20
21
|
import { Tab as MuiTab } from "@mui/material";
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
TabPanel as MuiTabPanel,
|
|
24
25
|
TabContext as MuiTabContext,
|
|
25
26
|
} from "@mui/lab";
|
|
27
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
26
28
|
|
|
27
29
|
export type TabItemProps = {
|
|
28
30
|
/**
|
|
@@ -45,7 +47,7 @@ export type TabItemProps = {
|
|
|
45
47
|
* The value associated with the TabItem
|
|
46
48
|
*/
|
|
47
49
|
value?: string;
|
|
48
|
-
};
|
|
50
|
+
} & SeleniumProps;
|
|
49
51
|
|
|
50
52
|
export type TabsProps = {
|
|
51
53
|
/**
|
|
@@ -53,17 +55,22 @@ export type TabsProps = {
|
|
|
53
55
|
*/
|
|
54
56
|
ariaLabel?: string;
|
|
55
57
|
/**
|
|
56
|
-
*
|
|
58
|
+
* @deprecated please use the `value` prop instead
|
|
59
|
+
* When `value` is provided, `initialValue` isn't used.
|
|
57
60
|
*/
|
|
58
61
|
initialValue?: string;
|
|
59
62
|
/**
|
|
60
63
|
* The TabItems to be included in the Tabs group
|
|
61
64
|
*/
|
|
62
65
|
tabs: TabItemProps[];
|
|
66
|
+
/**
|
|
67
|
+
* Identifier for the selected tab.
|
|
68
|
+
*/
|
|
69
|
+
value?: string;
|
|
63
70
|
};
|
|
64
71
|
|
|
65
|
-
const Tabs = ({ ariaLabel, initialValue
|
|
66
|
-
const [tabState, setTabState] = useState(initialValue);
|
|
72
|
+
const Tabs = ({ ariaLabel, initialValue, tabs, value }: TabsProps) => {
|
|
73
|
+
const [tabState, setTabState] = useState(initialValue ?? value ?? "0");
|
|
67
74
|
|
|
68
75
|
const onChange = useCallback(
|
|
69
76
|
(_event: React.SyntheticEvent, newState: string) => {
|
|
@@ -72,11 +79,18 @@ const Tabs = ({ ariaLabel, initialValue = "0", tabs }: TabsProps) => {
|
|
|
72
79
|
[]
|
|
73
80
|
);
|
|
74
81
|
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (value !== undefined) {
|
|
84
|
+
setTabState(value);
|
|
85
|
+
}
|
|
86
|
+
}, [value]);
|
|
87
|
+
|
|
75
88
|
return (
|
|
76
89
|
<MuiTabContext value={tabState}>
|
|
77
90
|
<MuiTabList onChange={onChange} aria-label={ariaLabel}>
|
|
78
91
|
{tabs.map((tab, index) => (
|
|
79
92
|
<MuiTab
|
|
93
|
+
data-se={tab.testId}
|
|
80
94
|
disabled={tab.isDisabled}
|
|
81
95
|
icon={tab.startIcon}
|
|
82
96
|
label={tab.label}
|
package/src/Tag.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { Chip as MuiChip, ChipProps as MuiChipProps } from "@mui/material";
|
|
|
14
14
|
import { memo, ReactElement, useCallback, useContext } from "react";
|
|
15
15
|
import { TagListContext } from "./TagListContext";
|
|
16
16
|
import { MuiPropsContext } from "./MuiPropsContext";
|
|
17
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
17
18
|
|
|
18
19
|
export type TagProps = {
|
|
19
20
|
icon?: ReactElement;
|
|
@@ -30,9 +31,16 @@ export type TagProps = {
|
|
|
30
31
|
* Callback fired when the remove button of the Tag is clicked
|
|
31
32
|
*/
|
|
32
33
|
onRemove?: MuiChipProps["onDelete"];
|
|
33
|
-
};
|
|
34
|
+
} & SeleniumProps;
|
|
34
35
|
|
|
35
|
-
const Tag = ({
|
|
36
|
+
const Tag = ({
|
|
37
|
+
icon,
|
|
38
|
+
isDisabled,
|
|
39
|
+
label,
|
|
40
|
+
onClick,
|
|
41
|
+
onRemove,
|
|
42
|
+
testId,
|
|
43
|
+
}: TagProps) => {
|
|
36
44
|
const { chipElementType } = useContext(TagListContext);
|
|
37
45
|
|
|
38
46
|
const renderTag = useCallback(
|
|
@@ -42,6 +50,7 @@ const Tag = ({ icon, isDisabled, label, onClick, onRemove }: TagProps) => {
|
|
|
42
50
|
aria-disabled={isDisabled}
|
|
43
51
|
clickable={onClick ? true : false}
|
|
44
52
|
component={chipElementType}
|
|
53
|
+
data-se={testId}
|
|
45
54
|
disabled={isDisabled}
|
|
46
55
|
icon={icon}
|
|
47
56
|
label={label}
|
|
@@ -49,7 +58,7 @@ const Tag = ({ icon, isDisabled, label, onClick, onRemove }: TagProps) => {
|
|
|
49
58
|
onDelete={onRemove}
|
|
50
59
|
/>
|
|
51
60
|
),
|
|
52
|
-
[chipElementType, icon, isDisabled, label, onClick, onRemove]
|
|
61
|
+
[chipElementType, icon, isDisabled, label, onClick, onRemove, testId]
|
|
53
62
|
);
|
|
54
63
|
|
|
55
64
|
return <MuiPropsContext.Consumer>{renderTag}</MuiPropsContext.Consumer>;
|
package/src/TagList.tsx
CHANGED
|
@@ -14,15 +14,16 @@ import { Tag } from "./Tag";
|
|
|
14
14
|
import { Stack } from "@mui/material";
|
|
15
15
|
import { memo, ReactElement, useMemo } from "react";
|
|
16
16
|
import { ChipElementType, TagListContext } from "./TagListContext";
|
|
17
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
17
18
|
|
|
18
19
|
export type TagListProps = {
|
|
19
20
|
/**
|
|
20
21
|
* The Tag or array of Tags within the TagList
|
|
21
22
|
*/
|
|
22
23
|
children: ReactElement<typeof Tag> | Array<ReactElement<typeof Tag>>;
|
|
23
|
-
};
|
|
24
|
+
} & SeleniumProps;
|
|
24
25
|
|
|
25
|
-
const TagList = ({ children }: TagListProps) => {
|
|
26
|
+
const TagList = ({ children, testId }: TagListProps) => {
|
|
26
27
|
const providerValue = useMemo<{
|
|
27
28
|
chipElementType: ChipElementType;
|
|
28
29
|
}>(
|
|
@@ -35,6 +36,7 @@ const TagList = ({ children }: TagListProps) => {
|
|
|
35
36
|
return (
|
|
36
37
|
<Stack
|
|
37
38
|
component="ul"
|
|
39
|
+
data-se={testId}
|
|
38
40
|
direction="row"
|
|
39
41
|
spacing={2}
|
|
40
42
|
useFlexGap
|
package/src/TextField.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "react";
|
|
23
23
|
|
|
24
24
|
import { Field } from "./Field";
|
|
25
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
25
26
|
|
|
26
27
|
export const textFieldTypeValues = [
|
|
27
28
|
"email",
|
|
@@ -78,6 +79,10 @@ export type TextFieldProps = {
|
|
|
78
79
|
* The label for the `input` element.
|
|
79
80
|
*/
|
|
80
81
|
label: string;
|
|
82
|
+
/**
|
|
83
|
+
* The name of the `input` element. Defaults to the `id` if not set.
|
|
84
|
+
*/
|
|
85
|
+
name?: string;
|
|
81
86
|
/**
|
|
82
87
|
* Callback fired when the `input` element loses focus.
|
|
83
88
|
*/
|
|
@@ -106,7 +111,7 @@ export type TextFieldProps = {
|
|
|
106
111
|
* The value of the `input` element, required for a controlled component.
|
|
107
112
|
*/
|
|
108
113
|
value?: string;
|
|
109
|
-
};
|
|
114
|
+
} & SeleniumProps;
|
|
110
115
|
|
|
111
116
|
const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
112
117
|
(
|
|
@@ -122,11 +127,13 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
122
127
|
isOptional = false,
|
|
123
128
|
isReadOnly,
|
|
124
129
|
label,
|
|
130
|
+
name: nameOverride,
|
|
125
131
|
onBlur,
|
|
126
132
|
onChange,
|
|
127
133
|
onFocus,
|
|
128
134
|
placeholder,
|
|
129
135
|
startAdornment,
|
|
136
|
+
testId,
|
|
130
137
|
type = "text",
|
|
131
138
|
value,
|
|
132
139
|
},
|
|
@@ -139,6 +146,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
139
146
|
autoComplete={autoCompleteType}
|
|
140
147
|
/* eslint-disable-next-line jsx-a11y/no-autofocus */
|
|
141
148
|
autoFocus={hasInitialFocus}
|
|
149
|
+
data-se={testId}
|
|
142
150
|
endAdornment={
|
|
143
151
|
endAdornment && (
|
|
144
152
|
<InputAdornment position="end">{endAdornment}</InputAdornment>
|
|
@@ -146,13 +154,14 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
146
154
|
}
|
|
147
155
|
id={id}
|
|
148
156
|
multiline={isMultiline}
|
|
149
|
-
name={id}
|
|
157
|
+
name={nameOverride ?? id}
|
|
150
158
|
onBlur={onBlur}
|
|
151
159
|
onChange={onChange}
|
|
152
160
|
onFocus={onFocus}
|
|
153
161
|
placeholder={placeholder}
|
|
154
162
|
readOnly={isReadOnly}
|
|
155
163
|
ref={ref}
|
|
164
|
+
required={!isOptional}
|
|
156
165
|
startAdornment={
|
|
157
166
|
startAdornment && (
|
|
158
167
|
<InputAdornment position="start">{startAdornment}</InputAdornment>
|
|
@@ -167,13 +176,16 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
167
176
|
hasInitialFocus,
|
|
168
177
|
endAdornment,
|
|
169
178
|
isMultiline,
|
|
179
|
+
nameOverride,
|
|
170
180
|
onChange,
|
|
171
181
|
onFocus,
|
|
172
182
|
onBlur,
|
|
173
183
|
placeholder,
|
|
184
|
+
isOptional,
|
|
174
185
|
isReadOnly,
|
|
175
186
|
ref,
|
|
176
187
|
startAdornment,
|
|
188
|
+
testId,
|
|
177
189
|
type,
|
|
178
190
|
value,
|
|
179
191
|
]
|
package/src/Toast.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { Link } from "./Link";
|
|
|
17
17
|
import { CloseIcon } from "./icons.generated";
|
|
18
18
|
import { Button } from "./Button";
|
|
19
19
|
import { useTranslation } from "react-i18next";
|
|
20
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
20
21
|
|
|
21
22
|
export const toastRoleValues = ["status", "alert"] as const;
|
|
22
23
|
export const toastSeverityValues = [
|
|
@@ -69,7 +70,7 @@ export type ToastProps = {
|
|
|
69
70
|
* The text content of the Toast
|
|
70
71
|
*/
|
|
71
72
|
text: string;
|
|
72
|
-
};
|
|
73
|
+
} & SeleniumProps;
|
|
73
74
|
|
|
74
75
|
const ClickAwayListenerProps = { onClickAway: () => false };
|
|
75
76
|
|
|
@@ -82,6 +83,7 @@ const Toast = ({
|
|
|
82
83
|
onHide: onHideProp,
|
|
83
84
|
role,
|
|
84
85
|
severity,
|
|
86
|
+
testId,
|
|
85
87
|
text,
|
|
86
88
|
}: ToastProps) => {
|
|
87
89
|
const { t } = useTranslation();
|
|
@@ -119,6 +121,7 @@ const Toast = ({
|
|
|
119
121
|
/>
|
|
120
122
|
)
|
|
121
123
|
}
|
|
124
|
+
data-se={testId}
|
|
122
125
|
role={role}
|
|
123
126
|
severity={severity}
|
|
124
127
|
variant="toast"
|
package/src/Tooltip.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import type { TooltipProps as MuiTooltipProps } from "@mui/material";
|
|
|
15
15
|
|
|
16
16
|
import { MuiPropsChild } from "./MuiPropsChild";
|
|
17
17
|
import { ReactElement } from "react";
|
|
18
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
18
19
|
|
|
19
20
|
export type TooltipProps = {
|
|
20
21
|
/**
|
|
@@ -33,15 +34,17 @@ export type TooltipProps = {
|
|
|
33
34
|
* The text to display in the Tooltip
|
|
34
35
|
*/
|
|
35
36
|
text: string;
|
|
36
|
-
};
|
|
37
|
+
} & SeleniumProps;
|
|
37
38
|
|
|
38
39
|
export const Tooltip = ({
|
|
39
40
|
ariaType,
|
|
40
41
|
children,
|
|
41
42
|
placement = "top",
|
|
43
|
+
testId,
|
|
42
44
|
text,
|
|
43
45
|
}: TooltipProps) => (
|
|
44
46
|
<MuiTooltip
|
|
47
|
+
data-se={testId}
|
|
45
48
|
describeChild={ariaType === "description"}
|
|
46
49
|
placement={placement}
|
|
47
50
|
title={text}
|
package/src/Typography.tsx
CHANGED
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
Typography as MuiTypography,
|
|
15
15
|
TypographyProps as MuiTypographyProps,
|
|
16
16
|
} from "@mui/material";
|
|
17
|
-
import { ElementType, ReactNode, useMemo } from "react";
|
|
17
|
+
import { ElementType, ReactNode, memo, useMemo } from "react";
|
|
18
|
+
import { SeleniumProps } from "./SeleniumProps";
|
|
18
19
|
|
|
19
20
|
export type TypographyVariantValue =
|
|
20
21
|
| "h1"
|
|
@@ -85,9 +86,9 @@ export type TypographyProps = {
|
|
|
85
86
|
* The variant of Typography to render.
|
|
86
87
|
*/
|
|
87
88
|
variant?: keyof typeof typographyVariantMapping;
|
|
88
|
-
};
|
|
89
|
+
} & SeleniumProps;
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
const Typography = ({
|
|
91
92
|
ariaDescribedBy,
|
|
92
93
|
ariaLabel,
|
|
93
94
|
ariaLabelledBy,
|
|
@@ -95,6 +96,7 @@ export const Typography = ({
|
|
|
95
96
|
classes,
|
|
96
97
|
color,
|
|
97
98
|
component: componentProp,
|
|
99
|
+
testId,
|
|
98
100
|
variant = "body",
|
|
99
101
|
}: TypographyProps) => {
|
|
100
102
|
const component = useMemo(() => {
|
|
@@ -102,7 +104,7 @@ export const Typography = ({
|
|
|
102
104
|
if (variant === "body") {
|
|
103
105
|
return "p";
|
|
104
106
|
} else if (variant === "subordinate" || variant === "support") {
|
|
105
|
-
return "
|
|
107
|
+
return "p";
|
|
106
108
|
} else {
|
|
107
109
|
return variant;
|
|
108
110
|
}
|
|
@@ -112,21 +114,23 @@ export const Typography = ({
|
|
|
112
114
|
|
|
113
115
|
return (
|
|
114
116
|
<MuiTypography
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
aria-describedby={ariaDescribedBy}
|
|
118
|
+
aria-label={ariaLabel}
|
|
119
|
+
aria-labelledby={ariaLabelledBy}
|
|
118
120
|
children={children}
|
|
119
121
|
classes={classes}
|
|
120
122
|
color={color}
|
|
121
123
|
component={component}
|
|
124
|
+
data-se={testId}
|
|
122
125
|
variant={typographyVariantMapping[variant]}
|
|
123
126
|
/>
|
|
124
127
|
);
|
|
125
128
|
};
|
|
126
129
|
|
|
127
|
-
|
|
130
|
+
const MemoizedTypography = memo(Typography);
|
|
131
|
+
MemoizedTypography.displayName = "Typography";
|
|
128
132
|
|
|
129
|
-
|
|
133
|
+
const Heading1 = ({
|
|
130
134
|
ariaDescribedBy,
|
|
131
135
|
ariaLabel,
|
|
132
136
|
ariaLabelledBy,
|
|
@@ -134,6 +138,7 @@ export const Heading1 = ({
|
|
|
134
138
|
classes,
|
|
135
139
|
color,
|
|
136
140
|
component,
|
|
141
|
+
testId,
|
|
137
142
|
}: TypographyProps) => (
|
|
138
143
|
<Typography
|
|
139
144
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -143,13 +148,15 @@ export const Heading1 = ({
|
|
|
143
148
|
classes={classes}
|
|
144
149
|
color={color}
|
|
145
150
|
component={component}
|
|
151
|
+
data-se={testId}
|
|
146
152
|
variant="h1"
|
|
147
153
|
/>
|
|
148
154
|
);
|
|
149
155
|
|
|
150
|
-
|
|
156
|
+
const MemoizedHeading1 = memo(Heading1);
|
|
157
|
+
MemoizedHeading1.displayName = "Heading1";
|
|
151
158
|
|
|
152
|
-
|
|
159
|
+
const Heading2 = ({
|
|
153
160
|
ariaDescribedBy,
|
|
154
161
|
ariaLabel,
|
|
155
162
|
ariaLabelledBy,
|
|
@@ -157,6 +164,7 @@ export const Heading2 = ({
|
|
|
157
164
|
classes,
|
|
158
165
|
color,
|
|
159
166
|
component,
|
|
167
|
+
testId,
|
|
160
168
|
}: TypographyProps) => (
|
|
161
169
|
<Typography
|
|
162
170
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -166,13 +174,15 @@ export const Heading2 = ({
|
|
|
166
174
|
classes={classes}
|
|
167
175
|
color={color}
|
|
168
176
|
component={component}
|
|
177
|
+
data-se={testId}
|
|
169
178
|
variant="h2"
|
|
170
179
|
/>
|
|
171
180
|
);
|
|
172
181
|
|
|
173
|
-
|
|
182
|
+
const MemoizedHeading2 = memo(Heading2);
|
|
183
|
+
MemoizedHeading2.displayName = "Heading2";
|
|
174
184
|
|
|
175
|
-
|
|
185
|
+
const Heading3 = ({
|
|
176
186
|
ariaDescribedBy,
|
|
177
187
|
ariaLabel,
|
|
178
188
|
ariaLabelledBy,
|
|
@@ -180,6 +190,7 @@ export const Heading3 = ({
|
|
|
180
190
|
classes,
|
|
181
191
|
color,
|
|
182
192
|
component,
|
|
193
|
+
testId,
|
|
183
194
|
}: TypographyProps) => (
|
|
184
195
|
<Typography
|
|
185
196
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -189,13 +200,15 @@ export const Heading3 = ({
|
|
|
189
200
|
classes={classes}
|
|
190
201
|
color={color}
|
|
191
202
|
component={component}
|
|
203
|
+
data-se={testId}
|
|
192
204
|
variant="h3"
|
|
193
205
|
/>
|
|
194
206
|
);
|
|
195
207
|
|
|
196
|
-
|
|
208
|
+
const MemoizedHeading3 = memo(Heading3);
|
|
209
|
+
MemoizedHeading3.displayName = "Heading3";
|
|
197
210
|
|
|
198
|
-
|
|
211
|
+
const Heading4 = ({
|
|
199
212
|
ariaDescribedBy,
|
|
200
213
|
ariaLabel,
|
|
201
214
|
ariaLabelledBy,
|
|
@@ -203,6 +216,7 @@ export const Heading4 = ({
|
|
|
203
216
|
classes,
|
|
204
217
|
color,
|
|
205
218
|
component,
|
|
219
|
+
testId,
|
|
206
220
|
}: TypographyProps) => (
|
|
207
221
|
<Typography
|
|
208
222
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -212,13 +226,15 @@ export const Heading4 = ({
|
|
|
212
226
|
classes={classes}
|
|
213
227
|
color={color}
|
|
214
228
|
component={component}
|
|
229
|
+
data-se={testId}
|
|
215
230
|
variant="h4"
|
|
216
231
|
/>
|
|
217
232
|
);
|
|
218
233
|
|
|
219
|
-
|
|
234
|
+
const MemoizedHeading4 = memo(Heading4);
|
|
235
|
+
MemoizedHeading4.displayName = "Heading4";
|
|
220
236
|
|
|
221
|
-
|
|
237
|
+
const Heading5 = ({
|
|
222
238
|
ariaDescribedBy,
|
|
223
239
|
ariaLabel,
|
|
224
240
|
ariaLabelledBy,
|
|
@@ -226,6 +242,7 @@ export const Heading5 = ({
|
|
|
226
242
|
classes,
|
|
227
243
|
color,
|
|
228
244
|
component,
|
|
245
|
+
testId,
|
|
229
246
|
}: TypographyProps) => (
|
|
230
247
|
<Typography
|
|
231
248
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -235,13 +252,15 @@ export const Heading5 = ({
|
|
|
235
252
|
classes={classes}
|
|
236
253
|
color={color}
|
|
237
254
|
component={component}
|
|
255
|
+
data-se={testId}
|
|
238
256
|
variant="h5"
|
|
239
257
|
/>
|
|
240
258
|
);
|
|
241
259
|
|
|
242
|
-
|
|
260
|
+
const MemoizedHeading5 = memo(Heading5);
|
|
261
|
+
MemoizedHeading5.displayName = "Heading5";
|
|
243
262
|
|
|
244
|
-
|
|
263
|
+
const Heading6 = ({
|
|
245
264
|
ariaDescribedBy,
|
|
246
265
|
ariaLabel,
|
|
247
266
|
ariaLabelledBy,
|
|
@@ -249,6 +268,7 @@ export const Heading6 = ({
|
|
|
249
268
|
classes,
|
|
250
269
|
color,
|
|
251
270
|
component,
|
|
271
|
+
testId,
|
|
252
272
|
}: TypographyProps) => (
|
|
253
273
|
<Typography
|
|
254
274
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -258,13 +278,15 @@ export const Heading6 = ({
|
|
|
258
278
|
classes={classes}
|
|
259
279
|
color={color}
|
|
260
280
|
component={component}
|
|
281
|
+
data-se={testId}
|
|
261
282
|
variant="h6"
|
|
262
283
|
/>
|
|
263
284
|
);
|
|
264
285
|
|
|
265
|
-
|
|
286
|
+
const MemoizedHeading6 = memo(Heading6);
|
|
287
|
+
MemoizedHeading6.displayName = "Heading6";
|
|
266
288
|
|
|
267
|
-
|
|
289
|
+
const Paragraph = ({
|
|
268
290
|
ariaDescribedBy,
|
|
269
291
|
ariaLabel,
|
|
270
292
|
ariaLabelledBy,
|
|
@@ -272,6 +294,7 @@ export const Paragraph = ({
|
|
|
272
294
|
classes,
|
|
273
295
|
color,
|
|
274
296
|
component,
|
|
297
|
+
testId,
|
|
275
298
|
}: TypographyProps) => (
|
|
276
299
|
<Typography
|
|
277
300
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -281,13 +304,15 @@ export const Paragraph = ({
|
|
|
281
304
|
classes={classes}
|
|
282
305
|
color={color}
|
|
283
306
|
component={component}
|
|
307
|
+
data-se={testId}
|
|
284
308
|
variant="body"
|
|
285
309
|
/>
|
|
286
310
|
);
|
|
287
311
|
|
|
288
|
-
|
|
312
|
+
const MemoizedParagraph = memo(Paragraph);
|
|
313
|
+
MemoizedParagraph.displayName = "Paragraph";
|
|
289
314
|
|
|
290
|
-
|
|
315
|
+
const Subordinate = ({
|
|
291
316
|
ariaDescribedBy,
|
|
292
317
|
ariaLabel,
|
|
293
318
|
ariaLabelledBy,
|
|
@@ -295,6 +320,7 @@ export const Subordinate = ({
|
|
|
295
320
|
classes,
|
|
296
321
|
color,
|
|
297
322
|
component,
|
|
323
|
+
testId,
|
|
298
324
|
}: TypographyProps) => (
|
|
299
325
|
<Typography
|
|
300
326
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -304,13 +330,15 @@ export const Subordinate = ({
|
|
|
304
330
|
classes={classes}
|
|
305
331
|
color={color}
|
|
306
332
|
component={component}
|
|
333
|
+
data-se={testId}
|
|
307
334
|
variant="subordinate"
|
|
308
335
|
/>
|
|
309
336
|
);
|
|
310
337
|
|
|
311
|
-
|
|
338
|
+
const MemoizedSubordinate = memo(Subordinate);
|
|
339
|
+
MemoizedSubordinate.displayName = "Subordinate";
|
|
312
340
|
|
|
313
|
-
|
|
341
|
+
const Support = ({
|
|
314
342
|
ariaDescribedBy,
|
|
315
343
|
ariaLabel,
|
|
316
344
|
ariaLabelledBy,
|
|
@@ -318,6 +346,7 @@ export const Support = ({
|
|
|
318
346
|
classes,
|
|
319
347
|
color,
|
|
320
348
|
component,
|
|
349
|
+
testId,
|
|
321
350
|
}: TypographyProps) => (
|
|
322
351
|
<Typography
|
|
323
352
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -327,13 +356,15 @@ export const Support = ({
|
|
|
327
356
|
classes={classes}
|
|
328
357
|
color={color}
|
|
329
358
|
component={component}
|
|
359
|
+
data-se={testId}
|
|
330
360
|
variant="support"
|
|
331
361
|
/>
|
|
332
362
|
);
|
|
333
363
|
|
|
334
|
-
|
|
364
|
+
const MemoizedSupport = memo(Support);
|
|
365
|
+
MemoizedSupport.displayName = "Support";
|
|
335
366
|
|
|
336
|
-
|
|
367
|
+
const Legend = ({
|
|
337
368
|
ariaDescribedBy,
|
|
338
369
|
ariaLabel,
|
|
339
370
|
ariaLabelledBy,
|
|
@@ -341,6 +372,7 @@ export const Legend = ({
|
|
|
341
372
|
classes,
|
|
342
373
|
color,
|
|
343
374
|
component,
|
|
375
|
+
testId,
|
|
344
376
|
}: TypographyProps) => (
|
|
345
377
|
<Typography
|
|
346
378
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -350,8 +382,24 @@ export const Legend = ({
|
|
|
350
382
|
classes={classes}
|
|
351
383
|
color={color}
|
|
352
384
|
component={component}
|
|
385
|
+
data-se={testId}
|
|
353
386
|
variant="legend"
|
|
354
387
|
/>
|
|
355
388
|
);
|
|
356
389
|
|
|
357
|
-
|
|
390
|
+
const MemoizedLegend = memo(Legend);
|
|
391
|
+
MemoizedLegend.displayName = "Legend";
|
|
392
|
+
|
|
393
|
+
export {
|
|
394
|
+
MemoizedTypography as Typography,
|
|
395
|
+
MemoizedHeading1 as Heading1,
|
|
396
|
+
MemoizedHeading2 as Heading2,
|
|
397
|
+
MemoizedHeading3 as Heading3,
|
|
398
|
+
MemoizedHeading4 as Heading4,
|
|
399
|
+
MemoizedHeading5 as Heading5,
|
|
400
|
+
MemoizedHeading6 as Heading6,
|
|
401
|
+
MemoizedLegend as Legend,
|
|
402
|
+
MemoizedParagraph as Paragraph,
|
|
403
|
+
MemoizedSubordinate as Subordinate,
|
|
404
|
+
MemoizedSupport as Support,
|
|
405
|
+
};
|
package/src/labs/DatePicker.tsx
CHANGED
|
@@ -19,23 +19,31 @@ import { useCallback } from "react";
|
|
|
19
19
|
|
|
20
20
|
export type DatePickerProps<TInputDate, TDate> = {
|
|
21
21
|
label: MuiDatePickerProps<TInputDate, TDate>["label"];
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, the `input` element is not required.
|
|
24
|
+
*/
|
|
25
|
+
isOptional?: boolean;
|
|
22
26
|
onChange: MuiDatePickerProps<TInputDate, TDate>["onChange"];
|
|
23
27
|
value: MuiDatePickerProps<TInputDate, TDate>["value"];
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
export const DatePicker = <TInputDate, TDate>({
|
|
27
31
|
label,
|
|
32
|
+
isOptional = false,
|
|
28
33
|
onChange,
|
|
29
34
|
value = null,
|
|
30
35
|
}: DatePickerProps<TInputDate, TDate>) => {
|
|
31
|
-
const renderInput = useCallback(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const renderInput = useCallback(
|
|
37
|
+
({ InputProps, ...props }) => {
|
|
38
|
+
const combinedProps = {
|
|
39
|
+
...InputProps,
|
|
40
|
+
...props,
|
|
41
|
+
};
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
return <InputBase {...combinedProps} required={!isOptional} />;
|
|
44
|
+
},
|
|
45
|
+
[isOptional]
|
|
46
|
+
);
|
|
39
47
|
|
|
40
48
|
return (
|
|
41
49
|
<MuiDatePicker
|