@okta/odyssey-react-mui 1.0.2 → 1.2.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/CHANGELOG.md +54 -0
- package/README.md +1 -1
- package/dist/Autocomplete.js +20 -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/OdysseyCacheProvider.js +4 -1
- package/dist/OdysseyCacheProvider.js.map +1 -1
- package/dist/OdysseyProvider.js +12 -5
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +8 -7
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/OdysseyTranslationProvider.js +1 -1
- package/dist/OdysseyTranslationProvider.js.map +1 -1
- package/dist/OdysseyTranslationProvider.types.js +1 -1
- package/dist/OdysseyTranslationProvider.types.js.map +1 -1
- package/dist/PasswordField.js +18 -9
- 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 +39 -35
- 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 -59
- package/dist/Typography.js.map +1 -1
- package/dist/createShadowDom.js +26 -0
- package/dist/createShadowDom.js.map +1 -0
- package/dist/{OdysseyI18n.js → i18n.js} +5 -2
- package/dist/i18n.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.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/labs/datePickerTheme.js +4 -2
- package/dist/labs/datePickerTheme.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +2 -0
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +29 -4
- 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/OdysseyCacheProvider.d.ts +6 -1
- package/dist/src/OdysseyCacheProvider.d.ts.map +1 -1
- package/dist/src/OdysseyProvider.d.ts +1 -1
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/OdysseyThemeProvider.d.ts +2 -1
- package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.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 +78 -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 +7 -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 -49
- package/dist/src/Typography.d.ts.map +1 -1
- package/dist/src/createShadowDom.d.ts +16 -0
- package/dist/src/createShadowDom.d.ts.map +1 -0
- package/dist/src/{OdysseyI18n.d.ts → i18n.d.ts} +20 -2
- package/dist/src/i18n.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.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/properties/ts/odyssey-react-mui.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts +4 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/createOdysseyMuiTheme.d.ts +23 -0
- package/dist/src/theme/createOdysseyMuiTheme.d.ts.map +1 -0
- package/dist/src/theme/mixins.d.ts +3 -1
- package/dist/src/theme/mixins.d.ts.map +1 -1
- package/dist/src/theme/palette.d.ts +3 -1
- package/dist/src/theme/palette.d.ts.map +1 -1
- package/dist/src/theme/shape.d.ts +3 -1
- package/dist/src/theme/shape.d.ts.map +1 -1
- package/dist/src/theme/spacing.d.ts +3 -1
- package/dist/src/theme/spacing.d.ts.map +1 -1
- package/dist/src/theme/theme.d.ts +1 -8
- package/dist/src/theme/theme.d.ts.map +1 -1
- package/dist/src/theme/typography.d.ts +3 -1
- package/dist/src/theme/typography.d.ts.map +1 -1
- package/dist/theme/components.js +118 -73
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/createOdysseyMuiTheme.js +51 -0
- package/dist/theme/createOdysseyMuiTheme.js.map +1 -0
- package/dist/theme/mixins.js +4 -1
- package/dist/theme/mixins.js.map +1 -1
- package/dist/theme/palette.js +4 -1
- package/dist/theme/palette.js.map +1 -1
- package/dist/theme/shape.js +4 -1
- package/dist/theme/shape.js.map +1 -1
- package/dist/theme/spacing.js +4 -1
- package/dist/theme/spacing.js.map +1 -1
- package/dist/theme/theme.js +1 -20
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/typography.js +4 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/src/Autocomplete.tsx +56 -4
- 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/OdysseyCacheProvider.tsx +9 -1
- package/src/OdysseyProvider.tsx +18 -8
- package/src/OdysseyThemeProvider.tsx +12 -8
- package/src/OdysseyTranslationProvider.test.tsx +2 -2
- package/src/OdysseyTranslationProvider.tsx +1 -1
- package/src/OdysseyTranslationProvider.types.ts +1 -0
- package/src/PasswordField.tsx +37 -13
- package/src/Radio.tsx +5 -1
- package/src/RadioGroup.tsx +12 -4
- package/src/SearchField.tsx +23 -15
- package/src/Select.tsx +154 -149
- 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 -54
- package/src/createShadowDom.ts +46 -0
- package/src/{OdysseyI18n.ts → i18n.ts} +4 -2
- package/src/index.ts +1 -0
- 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/labs/datePickerTheme.tsx +2 -2
- package/src/properties/odyssey-react-mui.properties +2 -0
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/theme/components.tsx +69 -18
- package/src/theme/createOdysseyMuiTheme.ts +47 -0
- package/src/theme/mixins.ts +5 -1
- package/src/theme/palette.ts +5 -3
- package/src/theme/shape.ts +5 -1
- package/src/theme/spacing.ts +5 -3
- package/src/theme/theme.ts +1 -26
- package/src/theme/typography.ts +5 -3
- package/dist/OdysseyI18n.js.map +0 -1
- package/dist/src/OdysseyI18n.d.ts.map +0 -1
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"
|
|
@@ -69,10 +70,6 @@ export type TypographyProps = {
|
|
|
69
70
|
* The text content of the component.
|
|
70
71
|
*/
|
|
71
72
|
children: ReactNode;
|
|
72
|
-
/**
|
|
73
|
-
* Additional classes to add to the component.
|
|
74
|
-
*/
|
|
75
|
-
classes?: object;
|
|
76
73
|
/**
|
|
77
74
|
* The color of the text.
|
|
78
75
|
*/
|
|
@@ -85,16 +82,16 @@ export type TypographyProps = {
|
|
|
85
82
|
* The variant of Typography to render.
|
|
86
83
|
*/
|
|
87
84
|
variant?: keyof typeof typographyVariantMapping;
|
|
88
|
-
};
|
|
85
|
+
} & SeleniumProps;
|
|
89
86
|
|
|
90
|
-
|
|
87
|
+
const Typography = ({
|
|
91
88
|
ariaDescribedBy,
|
|
92
89
|
ariaLabel,
|
|
93
90
|
ariaLabelledBy,
|
|
94
91
|
children,
|
|
95
|
-
classes,
|
|
96
92
|
color,
|
|
97
93
|
component: componentProp,
|
|
94
|
+
testId,
|
|
98
95
|
variant = "body",
|
|
99
96
|
}: TypographyProps) => {
|
|
100
97
|
const component = useMemo(() => {
|
|
@@ -102,7 +99,7 @@ export const Typography = ({
|
|
|
102
99
|
if (variant === "body") {
|
|
103
100
|
return "p";
|
|
104
101
|
} else if (variant === "subordinate" || variant === "support") {
|
|
105
|
-
return "
|
|
102
|
+
return "p";
|
|
106
103
|
} else {
|
|
107
104
|
return variant;
|
|
108
105
|
}
|
|
@@ -112,246 +109,271 @@ export const Typography = ({
|
|
|
112
109
|
|
|
113
110
|
return (
|
|
114
111
|
<MuiTypography
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
aria-describedby={ariaDescribedBy}
|
|
113
|
+
aria-label={ariaLabel}
|
|
114
|
+
aria-labelledby={ariaLabelledBy}
|
|
118
115
|
children={children}
|
|
119
|
-
classes={classes}
|
|
120
116
|
color={color}
|
|
121
117
|
component={component}
|
|
118
|
+
data-se={testId}
|
|
122
119
|
variant={typographyVariantMapping[variant]}
|
|
123
120
|
/>
|
|
124
121
|
);
|
|
125
122
|
};
|
|
126
123
|
|
|
127
|
-
|
|
124
|
+
const MemoizedTypography = memo(Typography);
|
|
125
|
+
MemoizedTypography.displayName = "Typography";
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
const Heading1 = ({
|
|
130
128
|
ariaDescribedBy,
|
|
131
129
|
ariaLabel,
|
|
132
130
|
ariaLabelledBy,
|
|
133
131
|
children,
|
|
134
|
-
classes,
|
|
135
132
|
color,
|
|
136
133
|
component,
|
|
134
|
+
testId,
|
|
137
135
|
}: TypographyProps) => (
|
|
138
136
|
<Typography
|
|
139
137
|
ariaDescribedBy={ariaDescribedBy}
|
|
140
138
|
ariaLabel={ariaLabel}
|
|
141
139
|
ariaLabelledBy={ariaLabelledBy}
|
|
142
140
|
children={children}
|
|
143
|
-
classes={classes}
|
|
144
141
|
color={color}
|
|
145
142
|
component={component}
|
|
143
|
+
data-se={testId}
|
|
146
144
|
variant="h1"
|
|
147
145
|
/>
|
|
148
146
|
);
|
|
149
147
|
|
|
150
|
-
|
|
148
|
+
const MemoizedHeading1 = memo(Heading1);
|
|
149
|
+
MemoizedHeading1.displayName = "Heading1";
|
|
151
150
|
|
|
152
|
-
|
|
151
|
+
const Heading2 = ({
|
|
153
152
|
ariaDescribedBy,
|
|
154
153
|
ariaLabel,
|
|
155
154
|
ariaLabelledBy,
|
|
156
155
|
children,
|
|
157
|
-
classes,
|
|
158
156
|
color,
|
|
159
157
|
component,
|
|
158
|
+
testId,
|
|
160
159
|
}: TypographyProps) => (
|
|
161
160
|
<Typography
|
|
162
161
|
ariaDescribedBy={ariaDescribedBy}
|
|
163
162
|
ariaLabel={ariaLabel}
|
|
164
163
|
ariaLabelledBy={ariaLabelledBy}
|
|
165
164
|
children={children}
|
|
166
|
-
classes={classes}
|
|
167
165
|
color={color}
|
|
168
166
|
component={component}
|
|
167
|
+
data-se={testId}
|
|
169
168
|
variant="h2"
|
|
170
169
|
/>
|
|
171
170
|
);
|
|
172
171
|
|
|
173
|
-
|
|
172
|
+
const MemoizedHeading2 = memo(Heading2);
|
|
173
|
+
MemoizedHeading2.displayName = "Heading2";
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
const Heading3 = ({
|
|
176
176
|
ariaDescribedBy,
|
|
177
177
|
ariaLabel,
|
|
178
178
|
ariaLabelledBy,
|
|
179
179
|
children,
|
|
180
|
-
classes,
|
|
181
180
|
color,
|
|
182
181
|
component,
|
|
182
|
+
testId,
|
|
183
183
|
}: TypographyProps) => (
|
|
184
184
|
<Typography
|
|
185
185
|
ariaDescribedBy={ariaDescribedBy}
|
|
186
186
|
ariaLabel={ariaLabel}
|
|
187
187
|
ariaLabelledBy={ariaLabelledBy}
|
|
188
188
|
children={children}
|
|
189
|
-
classes={classes}
|
|
190
189
|
color={color}
|
|
191
190
|
component={component}
|
|
191
|
+
data-se={testId}
|
|
192
192
|
variant="h3"
|
|
193
193
|
/>
|
|
194
194
|
);
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
const MemoizedHeading3 = memo(Heading3);
|
|
197
|
+
MemoizedHeading3.displayName = "Heading3";
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
const Heading4 = ({
|
|
199
200
|
ariaDescribedBy,
|
|
200
201
|
ariaLabel,
|
|
201
202
|
ariaLabelledBy,
|
|
202
203
|
children,
|
|
203
|
-
classes,
|
|
204
204
|
color,
|
|
205
205
|
component,
|
|
206
|
+
testId,
|
|
206
207
|
}: TypographyProps) => (
|
|
207
208
|
<Typography
|
|
208
209
|
ariaDescribedBy={ariaDescribedBy}
|
|
209
210
|
ariaLabel={ariaLabel}
|
|
210
211
|
ariaLabelledBy={ariaLabelledBy}
|
|
211
212
|
children={children}
|
|
212
|
-
classes={classes}
|
|
213
213
|
color={color}
|
|
214
214
|
component={component}
|
|
215
|
+
data-se={testId}
|
|
215
216
|
variant="h4"
|
|
216
217
|
/>
|
|
217
218
|
);
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
const MemoizedHeading4 = memo(Heading4);
|
|
221
|
+
MemoizedHeading4.displayName = "Heading4";
|
|
220
222
|
|
|
221
|
-
|
|
223
|
+
const Heading5 = ({
|
|
222
224
|
ariaDescribedBy,
|
|
223
225
|
ariaLabel,
|
|
224
226
|
ariaLabelledBy,
|
|
225
227
|
children,
|
|
226
|
-
classes,
|
|
227
228
|
color,
|
|
228
229
|
component,
|
|
230
|
+
testId,
|
|
229
231
|
}: TypographyProps) => (
|
|
230
232
|
<Typography
|
|
231
233
|
ariaDescribedBy={ariaDescribedBy}
|
|
232
234
|
ariaLabel={ariaLabel}
|
|
233
235
|
ariaLabelledBy={ariaLabelledBy}
|
|
234
236
|
children={children}
|
|
235
|
-
classes={classes}
|
|
236
237
|
color={color}
|
|
237
238
|
component={component}
|
|
239
|
+
data-se={testId}
|
|
238
240
|
variant="h5"
|
|
239
241
|
/>
|
|
240
242
|
);
|
|
241
243
|
|
|
242
|
-
|
|
244
|
+
const MemoizedHeading5 = memo(Heading5);
|
|
245
|
+
MemoizedHeading5.displayName = "Heading5";
|
|
243
246
|
|
|
244
|
-
|
|
247
|
+
const Heading6 = ({
|
|
245
248
|
ariaDescribedBy,
|
|
246
249
|
ariaLabel,
|
|
247
250
|
ariaLabelledBy,
|
|
248
251
|
children,
|
|
249
|
-
classes,
|
|
250
252
|
color,
|
|
251
253
|
component,
|
|
254
|
+
testId,
|
|
252
255
|
}: TypographyProps) => (
|
|
253
256
|
<Typography
|
|
254
257
|
ariaDescribedBy={ariaDescribedBy}
|
|
255
258
|
ariaLabel={ariaLabel}
|
|
256
259
|
ariaLabelledBy={ariaLabelledBy}
|
|
257
260
|
children={children}
|
|
258
|
-
classes={classes}
|
|
259
261
|
color={color}
|
|
260
262
|
component={component}
|
|
263
|
+
data-se={testId}
|
|
261
264
|
variant="h6"
|
|
262
265
|
/>
|
|
263
266
|
);
|
|
264
267
|
|
|
265
|
-
|
|
268
|
+
const MemoizedHeading6 = memo(Heading6);
|
|
269
|
+
MemoizedHeading6.displayName = "Heading6";
|
|
266
270
|
|
|
267
|
-
|
|
271
|
+
const Paragraph = ({
|
|
268
272
|
ariaDescribedBy,
|
|
269
273
|
ariaLabel,
|
|
270
274
|
ariaLabelledBy,
|
|
271
275
|
children,
|
|
272
|
-
classes,
|
|
273
276
|
color,
|
|
274
277
|
component,
|
|
278
|
+
testId,
|
|
275
279
|
}: TypographyProps) => (
|
|
276
280
|
<Typography
|
|
277
281
|
ariaDescribedBy={ariaDescribedBy}
|
|
278
282
|
ariaLabel={ariaLabel}
|
|
279
283
|
ariaLabelledBy={ariaLabelledBy}
|
|
280
284
|
children={children}
|
|
281
|
-
classes={classes}
|
|
282
285
|
color={color}
|
|
283
286
|
component={component}
|
|
287
|
+
data-se={testId}
|
|
284
288
|
variant="body"
|
|
285
289
|
/>
|
|
286
290
|
);
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
const MemoizedParagraph = memo(Paragraph);
|
|
293
|
+
MemoizedParagraph.displayName = "Paragraph";
|
|
289
294
|
|
|
290
|
-
|
|
295
|
+
const Subordinate = ({
|
|
291
296
|
ariaDescribedBy,
|
|
292
297
|
ariaLabel,
|
|
293
298
|
ariaLabelledBy,
|
|
294
299
|
children,
|
|
295
|
-
classes,
|
|
296
300
|
color,
|
|
297
301
|
component,
|
|
302
|
+
testId,
|
|
298
303
|
}: TypographyProps) => (
|
|
299
304
|
<Typography
|
|
300
305
|
ariaDescribedBy={ariaDescribedBy}
|
|
301
306
|
ariaLabel={ariaLabel}
|
|
302
307
|
ariaLabelledBy={ariaLabelledBy}
|
|
303
308
|
children={children}
|
|
304
|
-
classes={classes}
|
|
305
309
|
color={color}
|
|
306
310
|
component={component}
|
|
311
|
+
data-se={testId}
|
|
307
312
|
variant="subordinate"
|
|
308
313
|
/>
|
|
309
314
|
);
|
|
310
315
|
|
|
311
|
-
|
|
316
|
+
const MemoizedSubordinate = memo(Subordinate);
|
|
317
|
+
MemoizedSubordinate.displayName = "Subordinate";
|
|
312
318
|
|
|
313
|
-
|
|
319
|
+
const Support = ({
|
|
314
320
|
ariaDescribedBy,
|
|
315
321
|
ariaLabel,
|
|
316
322
|
ariaLabelledBy,
|
|
317
323
|
children,
|
|
318
|
-
classes,
|
|
319
324
|
color,
|
|
320
325
|
component,
|
|
326
|
+
testId,
|
|
321
327
|
}: TypographyProps) => (
|
|
322
328
|
<Typography
|
|
323
329
|
ariaDescribedBy={ariaDescribedBy}
|
|
324
330
|
ariaLabel={ariaLabel}
|
|
325
331
|
ariaLabelledBy={ariaLabelledBy}
|
|
326
332
|
children={children}
|
|
327
|
-
classes={classes}
|
|
328
333
|
color={color}
|
|
329
334
|
component={component}
|
|
335
|
+
data-se={testId}
|
|
330
336
|
variant="support"
|
|
331
337
|
/>
|
|
332
338
|
);
|
|
333
339
|
|
|
334
|
-
|
|
340
|
+
const MemoizedSupport = memo(Support);
|
|
341
|
+
MemoizedSupport.displayName = "Support";
|
|
335
342
|
|
|
336
|
-
|
|
343
|
+
const Legend = ({
|
|
337
344
|
ariaDescribedBy,
|
|
338
345
|
ariaLabel,
|
|
339
346
|
ariaLabelledBy,
|
|
340
347
|
children,
|
|
341
|
-
classes,
|
|
342
348
|
color,
|
|
343
349
|
component,
|
|
350
|
+
testId,
|
|
344
351
|
}: TypographyProps) => (
|
|
345
352
|
<Typography
|
|
346
353
|
ariaDescribedBy={ariaDescribedBy}
|
|
347
354
|
ariaLabel={ariaLabel}
|
|
348
355
|
ariaLabelledBy={ariaLabelledBy}
|
|
349
356
|
children={children}
|
|
350
|
-
classes={classes}
|
|
351
357
|
color={color}
|
|
352
358
|
component={component}
|
|
359
|
+
data-se={testId}
|
|
353
360
|
variant="legend"
|
|
354
361
|
/>
|
|
355
362
|
);
|
|
356
363
|
|
|
357
|
-
|
|
364
|
+
const MemoizedLegend = memo(Legend);
|
|
365
|
+
MemoizedLegend.displayName = "Legend";
|
|
366
|
+
|
|
367
|
+
export {
|
|
368
|
+
MemoizedTypography as Typography,
|
|
369
|
+
MemoizedHeading1 as Heading1,
|
|
370
|
+
MemoizedHeading2 as Heading2,
|
|
371
|
+
MemoizedHeading3 as Heading3,
|
|
372
|
+
MemoizedHeading4 as Heading4,
|
|
373
|
+
MemoizedHeading5 as Heading5,
|
|
374
|
+
MemoizedHeading6 as Heading6,
|
|
375
|
+
MemoizedLegend as Legend,
|
|
376
|
+
MemoizedParagraph as Paragraph,
|
|
377
|
+
MemoizedSubordinate as Subordinate,
|
|
378
|
+
MemoizedSupport as Support,
|
|
379
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const createShadowDom = (containerElement: HTMLElement) => {
|
|
14
|
+
const shadowContainer = containerElement.attachShadow({ mode: "open" });
|
|
15
|
+
const emotionRootElement = document.createElement("style");
|
|
16
|
+
const shadowRootElement = document.createElement("div");
|
|
17
|
+
|
|
18
|
+
shadowContainer.appendChild(emotionRootElement);
|
|
19
|
+
shadowContainer.appendChild(shadowRootElement);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
emotionRootElement,
|
|
23
|
+
shadowRootElement,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// --DOCS--
|
|
28
|
+
|
|
29
|
+
// const {
|
|
30
|
+
// emotionRootElement,
|
|
31
|
+
// shadowRootElement,
|
|
32
|
+
// } = (
|
|
33
|
+
// createShadowDom(
|
|
34
|
+
// document.querySelector('#root') as HTMLElement
|
|
35
|
+
// )
|
|
36
|
+
// )
|
|
37
|
+
|
|
38
|
+
// ReactDOM
|
|
39
|
+
// .createRoot(
|
|
40
|
+
// shadowRootElement
|
|
41
|
+
// )
|
|
42
|
+
// .render(
|
|
43
|
+
// <OdysseyProvider emotionRootElement={emotionRootElement} shadowRootElement={shadowRootElement}>
|
|
44
|
+
// <App />
|
|
45
|
+
// </OdysseyProvider>
|
|
46
|
+
// )
|
|
@@ -39,6 +39,7 @@ import { translation as sv } from "./properties/ts/odyssey-react-mui_sv";
|
|
|
39
39
|
import { translation as th } from "./properties/ts/odyssey-react-mui_th";
|
|
40
40
|
import { translation as tr } from "./properties/ts/odyssey-react-mui_tr";
|
|
41
41
|
import { translation as uk } from "./properties/ts/odyssey-react-mui_uk";
|
|
42
|
+
import { translation as vi } from "./properties/ts/odyssey-react-mui_vi";
|
|
42
43
|
import { translation as zhCN } from "./properties/ts/odyssey-react-mui_zh_CN";
|
|
43
44
|
import { translation as znTW } from "./properties/ts/odyssey-react-mui_zh_TW";
|
|
44
45
|
|
|
@@ -76,6 +77,7 @@ export const resources = {
|
|
|
76
77
|
th,
|
|
77
78
|
tr,
|
|
78
79
|
uk,
|
|
80
|
+
vi,
|
|
79
81
|
zh_CN: zhCN,
|
|
80
82
|
zh_TW: znTW,
|
|
81
83
|
};
|
|
@@ -101,5 +103,5 @@ Object.entries(resources).forEach(([locale, property]) => {
|
|
|
101
103
|
i18n.addResourceBundle(locale, defaultNS, property);
|
|
102
104
|
});
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
export
|
|
106
|
+
export const odysseyTranslate = i18n.t.bind(i18n);
|
|
107
|
+
export { i18n };
|
package/src/index.ts
CHANGED
|
@@ -74,6 +74,7 @@ export * from "./MenuItem";
|
|
|
74
74
|
export * from "./NativeSelect";
|
|
75
75
|
export * from "./NullElement";
|
|
76
76
|
export * from "./OdysseyCacheProvider";
|
|
77
|
+
export { odysseyTranslate } from "./i18n";
|
|
77
78
|
export * from "./OdysseyProvider";
|
|
78
79
|
export * from "./OdysseyThemeProvider";
|
|
79
80
|
export * from "./OdysseyTranslationProvider";
|
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
|
|
@@ -82,7 +82,7 @@ const PaginatedTable = <TData extends DefaultMaterialReactTableData>({
|
|
|
82
82
|
const [globalFilter, setGlobalFilter] = useState<string>();
|
|
83
83
|
|
|
84
84
|
useEffect(() => {
|
|
85
|
-
if (globalFilter) {
|
|
85
|
+
if (globalFilter !== undefined) {
|
|
86
86
|
onGlobalFilterChange?.(globalFilter);
|
|
87
87
|
}
|
|
88
88
|
}, [globalFilter, onGlobalFilterChange]);
|
|
@@ -194,14 +194,23 @@ const PaginatedTable = <TData extends DefaultMaterialReactTableData>({
|
|
|
194
194
|
|
|
195
195
|
const modifiedState = useMemo(
|
|
196
196
|
() => ({
|
|
197
|
-
...state,
|
|
198
197
|
pagination: {
|
|
199
198
|
pageIndex: pagination.pageIndex,
|
|
200
199
|
pageSize: pagination.pageSize,
|
|
201
200
|
},
|
|
202
201
|
rowSelection,
|
|
202
|
+
globalFilter,
|
|
203
|
+
columnFilters,
|
|
204
|
+
...state,
|
|
203
205
|
}),
|
|
204
|
-
[
|
|
206
|
+
[
|
|
207
|
+
pagination.pageIndex,
|
|
208
|
+
pagination.pageSize,
|
|
209
|
+
rowSelection,
|
|
210
|
+
globalFilter,
|
|
211
|
+
columnFilters,
|
|
212
|
+
state,
|
|
213
|
+
]
|
|
205
214
|
);
|
|
206
215
|
|
|
207
216
|
const muiToolbarAlertBannerProps: AlertProps = useMemo(
|
package/src/labs/README.md
CHANGED
|
@@ -20,10 +20,10 @@ This project follows semantic versioning conventions:
|
|
|
20
20
|
|
|
21
21
|
## Getting Started
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
To use Odyssey Labs, import as:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
|
|
26
|
+
import from "@okta/odyssey-react-mui/labs"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Components
|