@okta/odyssey-react-mui 1.6.0 → 1.6.2
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 +13 -0
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Checkbox.js +3 -2
- package/dist/Checkbox.js.map +1 -1
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/FieldComponentProps.js +2 -0
- package/dist/FieldComponentProps.js.map +1 -0
- package/dist/NativeSelect.js.map +1 -1
- package/dist/OdysseyCacheProvider.js +7 -1
- package/dist/OdysseyCacheProvider.js.map +1 -1
- package/dist/OdysseyProvider.js +3 -4
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +3 -3
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/PasswordField.js.map +1 -1
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchField.js.map +1 -1
- package/dist/Select.js.map +1 -1
- package/dist/TextField.js +1 -0
- package/dist/TextField.js.map +1 -1
- package/dist/Tooltip.js +5 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/{createShadowDom.js → createShadowRootElement.js} +6 -11
- package/dist/createShadowRootElement.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +2 -21
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Checkbox.d.ts +2 -13
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/CheckboxGroup.d.ts +2 -13
- package/dist/src/CheckboxGroup.d.ts.map +1 -1
- package/dist/src/FieldComponentProps.d.ts +42 -0
- package/dist/src/FieldComponentProps.d.ts.map +1 -0
- package/dist/src/NativeSelect.d.ts +3 -42
- package/dist/src/NativeSelect.d.ts.map +1 -1
- package/dist/src/OdysseyCacheProvider.d.ts +2 -2
- 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 -2
- package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts +3 -58
- package/dist/src/PasswordField.d.ts.map +1 -1
- package/dist/src/Radio.d.ts +2 -9
- package/dist/src/Radio.d.ts.map +1 -1
- package/dist/src/RadioGroup.d.ts +2 -21
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/SearchField.d.ts +3 -26
- package/dist/src/SearchField.d.ts.map +1 -1
- package/dist/src/Select.d.ts +2 -25
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/TextField.d.ts +3 -58
- package/dist/src/TextField.d.ts.map +1 -1
- package/dist/src/Tooltip.d.ts +2 -1
- package/dist/src/Tooltip.d.ts.map +1 -1
- package/dist/src/{createShadowDom.d.ts → createShadowRootElement.d.ts} +2 -5
- package/dist/src/createShadowRootElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts +2 -2
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/createOdysseyMuiTheme.d.ts +2 -2
- package/dist/theme/components.js +90 -70
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/createOdysseyMuiTheme.js +2 -2
- package/dist/theme/createOdysseyMuiTheme.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Autocomplete.tsx +6 -21
- package/src/Checkbox.tsx +6 -16
- package/src/CheckboxGroup.tsx +3 -13
- package/src/FieldComponentProps.ts +42 -0
- package/src/NativeSelect.tsx +6 -22
- package/src/OdysseyCacheProvider.tsx +12 -2
- package/src/OdysseyProvider.tsx +3 -4
- package/src/OdysseyThemeProvider.tsx +4 -4
- package/src/PasswordField.tsx +3 -29
- package/src/Radio.tsx +3 -9
- package/src/RadioGroup.tsx +6 -21
- package/src/SearchField.tsx +3 -13
- package/src/Select.tsx +8 -26
- package/src/TextField.tsx +4 -30
- package/src/Tooltip.tsx +7 -2
- package/src/createShadowRootElement.ts +21 -0
- package/src/index.ts +2 -1
- package/src/theme/components.tsx +34 -15
- package/src/theme/createOdysseyMuiTheme.ts +3 -3
- package/dist/createShadowDom.js.map +0 -1
- package/dist/src/createShadowDom.d.ts.map +0 -1
- package/src/createShadowDom.ts +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okta/odyssey-react-mui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "React MUI components for Odyssey, Okta's design system",
|
|
5
5
|
"author": "Okta, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@mui/system": "^5.14.9",
|
|
52
52
|
"@mui/utils": "^5.11.2",
|
|
53
53
|
"@mui/x-date-pickers": "^5.0.15",
|
|
54
|
-
"@okta/odyssey-design-tokens": "1.6.
|
|
54
|
+
"@okta/odyssey-design-tokens": "1.6.2",
|
|
55
55
|
"date-fns": "^2.30.0",
|
|
56
56
|
"i18next": "^23.5.1",
|
|
57
57
|
"material-react-table": "^1.14.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": ">=17 <19",
|
|
64
64
|
"react-dom": ">=17 <19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "01feb062b03dc39ba97724277fd289eaa0000a5b"
|
|
67
67
|
}
|
package/src/Autocomplete.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import { memo, useCallback } from "react";
|
|
19
19
|
|
|
20
20
|
import { Field } from "./Field";
|
|
21
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
21
22
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
22
23
|
|
|
23
24
|
export type AutocompleteProps<
|
|
@@ -25,10 +26,6 @@ export type AutocompleteProps<
|
|
|
25
26
|
HasMultipleChoices extends boolean | undefined,
|
|
26
27
|
IsCustomValueAllowed extends boolean | undefined
|
|
27
28
|
> = {
|
|
28
|
-
/**
|
|
29
|
-
* The error message for the Select
|
|
30
|
-
*/
|
|
31
|
-
errorMessage?: string;
|
|
32
29
|
/**
|
|
33
30
|
* Enables multiple choice selection
|
|
34
31
|
*/
|
|
@@ -38,14 +35,6 @@ export type AutocompleteProps<
|
|
|
38
35
|
undefined,
|
|
39
36
|
IsCustomValueAllowed
|
|
40
37
|
>["multiple"];
|
|
41
|
-
/**
|
|
42
|
-
* The hint text for the Autocomplete input
|
|
43
|
-
*/
|
|
44
|
-
hint?: string;
|
|
45
|
-
/**
|
|
46
|
-
* The id attribute of the Select
|
|
47
|
-
*/
|
|
48
|
-
id?: string;
|
|
49
38
|
/**
|
|
50
39
|
* Allows the input of custom values
|
|
51
40
|
*/
|
|
@@ -73,10 +62,6 @@ export type AutocompleteProps<
|
|
|
73
62
|
undefined,
|
|
74
63
|
IsCustomValueAllowed
|
|
75
64
|
>["loading"];
|
|
76
|
-
/**
|
|
77
|
-
* If `true`, the `input` element is not required.
|
|
78
|
-
*/
|
|
79
|
-
isOptional?: boolean;
|
|
80
65
|
/**
|
|
81
66
|
* Makes the Autocomplete input read-only
|
|
82
67
|
*/
|
|
@@ -90,10 +75,6 @@ export type AutocompleteProps<
|
|
|
90
75
|
* The label text for the autocomplete input
|
|
91
76
|
*/
|
|
92
77
|
label: string;
|
|
93
|
-
/**
|
|
94
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
95
|
-
*/
|
|
96
|
-
name?: string;
|
|
97
78
|
/**
|
|
98
79
|
* Callback fired when the autocomplete loses focus.
|
|
99
80
|
*/
|
|
@@ -148,7 +129,11 @@ export type AutocompleteProps<
|
|
|
148
129
|
undefined,
|
|
149
130
|
IsCustomValueAllowed
|
|
150
131
|
>["value"];
|
|
151
|
-
} &
|
|
132
|
+
} & Pick<
|
|
133
|
+
FieldComponentProps,
|
|
134
|
+
"errorMessage" | "hint" | "id" | "isOptional" | "name"
|
|
135
|
+
> &
|
|
136
|
+
SeleniumProps;
|
|
152
137
|
|
|
153
138
|
const Autocomplete = <
|
|
154
139
|
OptionType,
|
package/src/Checkbox.tsx
CHANGED
|
@@ -10,15 +10,16 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { useTranslation } from "react-i18next";
|
|
14
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
13
15
|
import {
|
|
14
16
|
Checkbox as MuiCheckbox,
|
|
15
17
|
CheckboxProps as MuiCheckboxProps,
|
|
16
18
|
FormControlLabel,
|
|
17
19
|
} from "@mui/material";
|
|
18
|
-
import { Typography } from "./Typography";
|
|
19
|
-
import { memo, useCallback, useMemo, useState } from "react";
|
|
20
|
-
import { useTranslation } from "react-i18next";
|
|
21
20
|
|
|
21
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
22
|
+
import { Typography } from "./Typography";
|
|
22
23
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
23
24
|
|
|
24
25
|
export const checkboxValidityValues = ["valid", "invalid", "inherit"] as const;
|
|
@@ -32,18 +33,10 @@ export type CheckboxProps = {
|
|
|
32
33
|
* The ID of the element that labels the Checkbox
|
|
33
34
|
*/
|
|
34
35
|
ariaLabelledBy?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The id of the `input` element.
|
|
37
|
-
*/
|
|
38
|
-
id?: string;
|
|
39
36
|
/**
|
|
40
37
|
* Determines whether the Checkbox is checked
|
|
41
38
|
*/
|
|
42
39
|
isDefaultChecked?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Determines whether the Checkbox is disabled
|
|
45
|
-
*/
|
|
46
|
-
isDisabled?: boolean;
|
|
47
40
|
/**
|
|
48
41
|
* Determines whether the Checkbox is in an indeterminate state
|
|
49
42
|
*/
|
|
@@ -56,10 +49,6 @@ export type CheckboxProps = {
|
|
|
56
49
|
* The label text for the Checkbox
|
|
57
50
|
*/
|
|
58
51
|
label?: string;
|
|
59
|
-
/**
|
|
60
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
61
|
-
*/
|
|
62
|
-
name?: string;
|
|
63
52
|
/**
|
|
64
53
|
* The change event handler for the Checkbox
|
|
65
54
|
*/
|
|
@@ -72,7 +61,8 @@ export type CheckboxProps = {
|
|
|
72
61
|
* The value attribute of the Checkbox
|
|
73
62
|
*/
|
|
74
63
|
value?: string;
|
|
75
|
-
} &
|
|
64
|
+
} & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> &
|
|
65
|
+
SeleniumProps;
|
|
76
66
|
|
|
77
67
|
const Checkbox = ({
|
|
78
68
|
ariaLabel,
|
package/src/CheckboxGroup.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { memo, ReactElement, useCallback } from "react";
|
|
|
15
15
|
|
|
16
16
|
import { Checkbox } from "./Checkbox";
|
|
17
17
|
import { Field } from "./Field";
|
|
18
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
18
19
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
19
20
|
|
|
20
21
|
export type CheckboxGroupProps = {
|
|
@@ -24,18 +25,6 @@ export type CheckboxGroupProps = {
|
|
|
24
25
|
children:
|
|
25
26
|
| ReactElement<typeof Checkbox>
|
|
26
27
|
| Array<ReactElement<typeof Checkbox>>;
|
|
27
|
-
/**
|
|
28
|
-
* The error message for the CheckboxGroup
|
|
29
|
-
*/
|
|
30
|
-
errorMessage?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The hint text for the CheckboxGroup
|
|
33
|
-
*/
|
|
34
|
-
hint?: string;
|
|
35
|
-
/**
|
|
36
|
-
* If `true`, the CheckboxGroup is disabled
|
|
37
|
-
*/
|
|
38
|
-
isDisabled?: boolean;
|
|
39
28
|
/**
|
|
40
29
|
* If `true`, the CheckboxGroup is required
|
|
41
30
|
*/
|
|
@@ -44,7 +33,8 @@ export type CheckboxGroupProps = {
|
|
|
44
33
|
* The label text for the CheckboxGroup
|
|
45
34
|
*/
|
|
46
35
|
label: string;
|
|
47
|
-
} &
|
|
36
|
+
} & Pick<FieldComponentProps, "errorMessage" | "hint" | "isDisabled"> &
|
|
37
|
+
SeleniumProps;
|
|
48
38
|
|
|
49
39
|
const CheckboxGroup = ({
|
|
50
40
|
children,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2021-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 type FieldComponentProps = {
|
|
14
|
+
/**
|
|
15
|
+
* If `error` is not undefined, the `input` will indicate an error.
|
|
16
|
+
*/
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The helper text content.
|
|
20
|
+
*/
|
|
21
|
+
hint?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The id of the `input` element.
|
|
24
|
+
*/
|
|
25
|
+
id?: string;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, the component is disabled.
|
|
28
|
+
*/
|
|
29
|
+
isDisabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* If `true`, the `input` element is not required.
|
|
32
|
+
*/
|
|
33
|
+
isOptional?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* It prevents the user from changing the value of the field
|
|
36
|
+
*/
|
|
37
|
+
isReadOnly?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The name of the `input` element. Defaults to the `id` if not set.
|
|
40
|
+
*/
|
|
41
|
+
name?: string;
|
|
42
|
+
};
|
package/src/NativeSelect.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { ReactElement, forwardRef, memo, useCallback } from "react";
|
|
|
14
14
|
import { Select as MuiSelect } from "@mui/material";
|
|
15
15
|
import { SelectProps as MuiSelectProps } from "@mui/material";
|
|
16
16
|
import { Field } from "./Field";
|
|
17
|
-
|
|
17
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
18
18
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
19
19
|
|
|
20
20
|
export type NativeSelectOption = {
|
|
@@ -32,30 +32,10 @@ export type NativeSelectProps = {
|
|
|
32
32
|
* The default value of the NativeSelect. Only applicable if `value` is not provided
|
|
33
33
|
*/
|
|
34
34
|
defaultValue?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The error message for the NativeSelect
|
|
37
|
-
*/
|
|
38
|
-
errorMessage?: string;
|
|
39
|
-
/**
|
|
40
|
-
* The hint text for the NativeSelect
|
|
41
|
-
*/
|
|
42
|
-
hint?: string;
|
|
43
|
-
/**
|
|
44
|
-
* The id attribute of the NativeSelect
|
|
45
|
-
*/
|
|
46
|
-
id?: string;
|
|
47
|
-
/**
|
|
48
|
-
* If `true`, the NativeSelect is disabled
|
|
49
|
-
*/
|
|
50
|
-
isDisabled?: boolean;
|
|
51
35
|
/**
|
|
52
36
|
* If `true`, the NativeSelect allows multiple selections
|
|
53
37
|
*/
|
|
54
38
|
isMultiSelect?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* If `true`, the NativeSelect is optional
|
|
57
|
-
*/
|
|
58
|
-
isOptional?: boolean;
|
|
59
39
|
/**
|
|
60
40
|
* The label text for the NativeSelect
|
|
61
41
|
*/
|
|
@@ -76,7 +56,11 @@ export type NativeSelectProps = {
|
|
|
76
56
|
* The value or values selected in the NativeSelect
|
|
77
57
|
*/
|
|
78
58
|
value?: string | string[];
|
|
79
|
-
} &
|
|
59
|
+
} & Pick<
|
|
60
|
+
FieldComponentProps,
|
|
61
|
+
"errorMessage" | "hint" | "id" | "isDisabled" | "isOptional"
|
|
62
|
+
> &
|
|
63
|
+
SeleniumProps;
|
|
80
64
|
|
|
81
65
|
const NativeSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(
|
|
82
66
|
(
|
|
@@ -28,19 +28,29 @@ export type OdysseyCacheProviderProps = {
|
|
|
28
28
|
* Emotion renders into this HTML element.
|
|
29
29
|
* When enabling this prop, Emotion renders at the top of this component rather than the bottom like it does in the HTML `<head>`.
|
|
30
30
|
*/
|
|
31
|
-
emotionRootElement?: HTMLStyleElement;
|
|
32
31
|
nonce?: string;
|
|
32
|
+
shadowDomElement?: HTMLDivElement;
|
|
33
33
|
stylisPlugins?: StylisPlugin[];
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const OdysseyCacheProvider = ({
|
|
37
37
|
children,
|
|
38
|
-
emotionRootElement,
|
|
39
38
|
nonce,
|
|
39
|
+
shadowDomElement,
|
|
40
40
|
stylisPlugins,
|
|
41
41
|
}: OdysseyCacheProviderProps) => {
|
|
42
42
|
const uniqueAlphabeticalId = useUniqueAlphabeticalId();
|
|
43
43
|
|
|
44
|
+
const emotionRootElement = useMemo(() => {
|
|
45
|
+
const emotionRootElement = document.createElement("div");
|
|
46
|
+
|
|
47
|
+
emotionRootElement.setAttribute("data-emotion-root", "data-emotion-root");
|
|
48
|
+
|
|
49
|
+
shadowDomElement?.prepend?.(emotionRootElement);
|
|
50
|
+
|
|
51
|
+
return emotionRootElement;
|
|
52
|
+
}, [shadowDomElement]);
|
|
53
|
+
|
|
44
54
|
const emotionCache = useMemo(
|
|
45
55
|
() =>
|
|
46
56
|
createCache({
|
package/src/OdysseyProvider.tsx
CHANGED
|
@@ -35,8 +35,7 @@ export type OdysseyProviderProps = OdysseyCacheProviderProps &
|
|
|
35
35
|
const OdysseyProvider = ({
|
|
36
36
|
children,
|
|
37
37
|
designTokensOverride,
|
|
38
|
-
|
|
39
|
-
shadowRootElement,
|
|
38
|
+
shadowDomElement,
|
|
40
39
|
languageCode,
|
|
41
40
|
nonce,
|
|
42
41
|
stylisPlugins,
|
|
@@ -44,13 +43,13 @@ const OdysseyProvider = ({
|
|
|
44
43
|
translationOverrides,
|
|
45
44
|
}: OdysseyProviderProps) => (
|
|
46
45
|
<OdysseyCacheProvider
|
|
47
|
-
emotionRootElement={emotionRootElement}
|
|
48
46
|
nonce={nonce}
|
|
47
|
+
shadowDomElement={shadowDomElement}
|
|
49
48
|
stylisPlugins={stylisPlugins}
|
|
50
49
|
>
|
|
51
50
|
<OdysseyThemeProvider
|
|
52
51
|
designTokensOverride={designTokensOverride}
|
|
53
|
-
|
|
52
|
+
shadowDomElement={shadowDomElement}
|
|
54
53
|
themeOverride={themeOverride}
|
|
55
54
|
>
|
|
56
55
|
<ScopedCssBaseline>
|
|
@@ -25,14 +25,14 @@ import { OdysseyDesignTokensContext } from "./OdysseyDesignTokensContext";
|
|
|
25
25
|
export type OdysseyThemeProviderProps = {
|
|
26
26
|
children: ReactNode;
|
|
27
27
|
designTokensOverride?: DesignTokensOverride;
|
|
28
|
-
|
|
28
|
+
shadowDomElement?: HTMLDivElement;
|
|
29
29
|
themeOverride?: ThemeOptions;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const OdysseyThemeProvider = ({
|
|
33
33
|
children,
|
|
34
34
|
designTokensOverride,
|
|
35
|
-
|
|
35
|
+
shadowDomElement,
|
|
36
36
|
themeOverride,
|
|
37
37
|
}: OdysseyThemeProviderProps) => {
|
|
38
38
|
const odysseyTokens = useMemo(
|
|
@@ -43,9 +43,9 @@ const OdysseyThemeProvider = ({
|
|
|
43
43
|
() =>
|
|
44
44
|
createOdysseyMuiTheme({
|
|
45
45
|
odysseyTokens,
|
|
46
|
-
|
|
46
|
+
shadowDomElement,
|
|
47
47
|
}),
|
|
48
|
-
[odysseyTokens,
|
|
48
|
+
[odysseyTokens, shadowDomElement]
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
const customOdysseyTheme = useMemo(
|
package/src/PasswordField.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
|
|
23
23
|
import { ShowIcon, HideIcon } from "./icons.generated";
|
|
24
24
|
import { Field } from "./Field";
|
|
25
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
25
26
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
26
27
|
import { useTranslation } from "react-i18next";
|
|
27
28
|
|
|
@@ -32,10 +33,6 @@ export type PasswordFieldProps = {
|
|
|
32
33
|
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
33
34
|
*/
|
|
34
35
|
autoCompleteType?: "current-password" | "new-password";
|
|
35
|
-
/**
|
|
36
|
-
* If `error` is not undefined, the `input` will indicate an error.
|
|
37
|
-
*/
|
|
38
|
-
errorMessage?: string;
|
|
39
36
|
/**
|
|
40
37
|
* If `true`, the component will receive focus automatically.
|
|
41
38
|
*/
|
|
@@ -44,34 +41,10 @@ export type PasswordFieldProps = {
|
|
|
44
41
|
* If `true`, the show/hide icon is not shown to the user
|
|
45
42
|
*/
|
|
46
43
|
hasShowPassword?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The helper text content.
|
|
49
|
-
*/
|
|
50
|
-
hint?: string;
|
|
51
|
-
/**
|
|
52
|
-
* The id of the `input` element.
|
|
53
|
-
*/
|
|
54
|
-
id?: string;
|
|
55
|
-
/**
|
|
56
|
-
* If `true`, the component is disabled.
|
|
57
|
-
*/
|
|
58
|
-
isDisabled?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* If `true`, the `input` element is not required.
|
|
61
|
-
*/
|
|
62
|
-
isOptional?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* It prevents the user from changing the value of the field
|
|
65
|
-
*/
|
|
66
|
-
isReadOnly?: boolean;
|
|
67
44
|
/**
|
|
68
45
|
* The label for the `input` element.
|
|
69
46
|
*/
|
|
70
47
|
label: string;
|
|
71
|
-
/**
|
|
72
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
73
|
-
*/
|
|
74
|
-
name?: string;
|
|
75
48
|
/**
|
|
76
49
|
* Callback fired when the `input` element loses focus.
|
|
77
50
|
*/
|
|
@@ -92,7 +65,8 @@ export type PasswordFieldProps = {
|
|
|
92
65
|
* The value of the `input` element, required for a controlled component.
|
|
93
66
|
*/
|
|
94
67
|
value?: string;
|
|
95
|
-
} &
|
|
68
|
+
} & FieldComponentProps &
|
|
69
|
+
SeleniumProps;
|
|
96
70
|
|
|
97
71
|
const PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(
|
|
98
72
|
(
|
package/src/Radio.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { memo } from "react";
|
|
|
15
15
|
|
|
16
16
|
import { FormControlLabel } from "@mui/material";
|
|
17
17
|
|
|
18
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
18
19
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
19
20
|
|
|
20
21
|
export type RadioProps = {
|
|
@@ -22,10 +23,6 @@ export type RadioProps = {
|
|
|
22
23
|
* If `true`, the Radio is selected
|
|
23
24
|
*/
|
|
24
25
|
isChecked?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* If `true`, the Radio is disabled
|
|
27
|
-
*/
|
|
28
|
-
isDisabled?: boolean;
|
|
29
26
|
/**
|
|
30
27
|
* If `true`, the Radio has an invalid value
|
|
31
28
|
*/
|
|
@@ -34,15 +31,12 @@ export type RadioProps = {
|
|
|
34
31
|
* The label text for the Radio
|
|
35
32
|
*/
|
|
36
33
|
label: string;
|
|
37
|
-
/**
|
|
38
|
-
* The name attribute of the Radio
|
|
39
|
-
*/
|
|
40
|
-
name?: string;
|
|
41
34
|
/**
|
|
42
35
|
* The value attribute of the Radio
|
|
43
36
|
*/
|
|
44
37
|
value: string;
|
|
45
|
-
} &
|
|
38
|
+
} & Pick<FieldComponentProps, "isDisabled" | "name"> &
|
|
39
|
+
SeleniumProps;
|
|
46
40
|
|
|
47
41
|
const Radio = ({
|
|
48
42
|
isChecked,
|
package/src/RadioGroup.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import { memo, ReactElement, useCallback } from "react";
|
|
|
18
18
|
|
|
19
19
|
import { Radio, RadioProps } from "./Radio";
|
|
20
20
|
import { Field } from "./Field";
|
|
21
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
21
22
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
22
23
|
|
|
23
24
|
export type RadioGroupProps = {
|
|
@@ -29,30 +30,10 @@ export type RadioGroupProps = {
|
|
|
29
30
|
* The text value of the Radio that should be selected by default
|
|
30
31
|
*/
|
|
31
32
|
defaultValue?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The error text for an invalid RadioGroup
|
|
34
|
-
*/
|
|
35
|
-
errorMessage?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Optional hint text
|
|
38
|
-
*/
|
|
39
|
-
hint?: string;
|
|
40
|
-
/**
|
|
41
|
-
* The id of the `input` element.
|
|
42
|
-
*/
|
|
43
|
-
id?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Disables the whole RadioGroup
|
|
46
|
-
*/
|
|
47
|
-
isDisabled?: boolean;
|
|
48
33
|
/**
|
|
49
34
|
* The text label for the RadioGroup
|
|
50
35
|
*/
|
|
51
36
|
label: string;
|
|
52
|
-
/**
|
|
53
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
54
|
-
*/
|
|
55
|
-
name?: string;
|
|
56
37
|
/**
|
|
57
38
|
* Listen for changes in the browser that change `value`
|
|
58
39
|
*/
|
|
@@ -61,7 +42,11 @@ export type RadioGroupProps = {
|
|
|
61
42
|
* The `value` on the selected Radio
|
|
62
43
|
*/
|
|
63
44
|
value?: RadioProps["value"];
|
|
64
|
-
} &
|
|
45
|
+
} & Pick<
|
|
46
|
+
FieldComponentProps,
|
|
47
|
+
"errorMessage" | "hint" | "id" | "isDisabled" | "name"
|
|
48
|
+
> &
|
|
49
|
+
SeleniumProps;
|
|
65
50
|
|
|
66
51
|
const RadioGroup = ({
|
|
67
52
|
children,
|
package/src/SearchField.tsx
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
|
|
24
24
|
import { CloseCircleFilledIcon, SearchIcon } from "./icons.generated";
|
|
25
25
|
import { Field } from "./Field";
|
|
26
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
26
27
|
import type { SeleniumProps } from "./SeleniumProps";
|
|
27
28
|
|
|
28
29
|
export type SearchFieldProps = {
|
|
@@ -36,22 +37,10 @@ export type SearchFieldProps = {
|
|
|
36
37
|
* If `true`, the component will receive focus automatically.
|
|
37
38
|
*/
|
|
38
39
|
hasInitialFocus?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* The id of the `input` element.
|
|
41
|
-
*/
|
|
42
|
-
id?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If `true`, the component is disabled.
|
|
45
|
-
*/
|
|
46
|
-
isDisabled?: boolean;
|
|
47
40
|
/**
|
|
48
41
|
* This label won't show up visually, but it's required for accessibility.
|
|
49
42
|
*/
|
|
50
43
|
label: string;
|
|
51
|
-
/**
|
|
52
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
53
|
-
*/
|
|
54
|
-
name?: string;
|
|
55
44
|
/**
|
|
56
45
|
* Callback fired when the `input` element loses focus.
|
|
57
46
|
*/
|
|
@@ -76,7 +65,8 @@ export type SearchFieldProps = {
|
|
|
76
65
|
* The value of the `input` element, required for a controlled component.
|
|
77
66
|
*/
|
|
78
67
|
value?: string;
|
|
79
|
-
} &
|
|
68
|
+
} & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> &
|
|
69
|
+
SeleniumProps;
|
|
80
70
|
|
|
81
71
|
const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(
|
|
82
72
|
(
|
package/src/Select.tsx
CHANGED
|
@@ -21,9 +21,11 @@ import {
|
|
|
21
21
|
Select as MuiSelect,
|
|
22
22
|
} from "@mui/material";
|
|
23
23
|
import { SelectProps as MuiSelectProps } from "@mui/material";
|
|
24
|
+
|
|
24
25
|
import { Field } from "./Field";
|
|
25
|
-
import
|
|
26
|
+
import { FieldComponentProps } from "./FieldComponentProps";
|
|
26
27
|
import { CheckIcon } from "./icons.generated";
|
|
28
|
+
import type { SeleniumProps } from "./SeleniumProps";
|
|
27
29
|
|
|
28
30
|
export type SelectOption = {
|
|
29
31
|
text: string;
|
|
@@ -38,43 +40,19 @@ export type SelectProps<
|
|
|
38
40
|
Value extends SelectValueType<HasMultipleChoices>,
|
|
39
41
|
HasMultipleChoices extends boolean
|
|
40
42
|
> = {
|
|
41
|
-
/**
|
|
42
|
-
* The error message for the Select
|
|
43
|
-
*/
|
|
44
|
-
errorMessage?: string;
|
|
45
43
|
/**
|
|
46
44
|
* If `true`, the Select allows multiple selections
|
|
47
45
|
*/
|
|
48
46
|
hasMultipleChoices?: HasMultipleChoices;
|
|
49
|
-
/**
|
|
50
|
-
* The hint text for the Select
|
|
51
|
-
*/
|
|
52
|
-
hint?: string;
|
|
53
|
-
/**
|
|
54
|
-
* The id attribute of the Select
|
|
55
|
-
*/
|
|
56
|
-
id?: string;
|
|
57
|
-
/**
|
|
58
|
-
* If `true`, the Select is disabled
|
|
59
|
-
*/
|
|
60
|
-
isDisabled?: boolean;
|
|
61
47
|
/**
|
|
62
48
|
* @deprecated Use `hasMultipleChoices` instead.
|
|
63
49
|
*/
|
|
64
50
|
/** **Deprecated:** use `hasMultipleChoices` */
|
|
65
51
|
isMultiSelect?: HasMultipleChoices;
|
|
66
|
-
/**
|
|
67
|
-
* If `true`, the Select is optional
|
|
68
|
-
*/
|
|
69
|
-
isOptional?: boolean;
|
|
70
52
|
/**
|
|
71
53
|
* The label text for the Select
|
|
72
54
|
*/
|
|
73
55
|
label: string;
|
|
74
|
-
/**
|
|
75
|
-
* The name of the `input` element. Defaults to the `id` if not set.
|
|
76
|
-
*/
|
|
77
|
-
name?: string;
|
|
78
56
|
/**
|
|
79
57
|
* Callback fired when the Select loses focus
|
|
80
58
|
*/
|
|
@@ -95,7 +73,11 @@ export type SelectProps<
|
|
|
95
73
|
* The value or values selected in the Select
|
|
96
74
|
*/
|
|
97
75
|
value?: Value;
|
|
98
|
-
} &
|
|
76
|
+
} & Pick<
|
|
77
|
+
FieldComponentProps,
|
|
78
|
+
"errorMessage" | "hint" | "id" | "isDisabled" | "isOptional" | "name"
|
|
79
|
+
> &
|
|
80
|
+
SeleniumProps;
|
|
99
81
|
|
|
100
82
|
/**
|
|
101
83
|
* Options in Odyssey <Select> are passed as an array, which can contain any combination
|