@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.
Files changed (92) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/Autocomplete.js.map +1 -1
  3. package/dist/Checkbox.js +3 -2
  4. package/dist/Checkbox.js.map +1 -1
  5. package/dist/CheckboxGroup.js.map +1 -1
  6. package/dist/FieldComponentProps.js +2 -0
  7. package/dist/FieldComponentProps.js.map +1 -0
  8. package/dist/NativeSelect.js.map +1 -1
  9. package/dist/OdysseyCacheProvider.js +7 -1
  10. package/dist/OdysseyCacheProvider.js.map +1 -1
  11. package/dist/OdysseyProvider.js +3 -4
  12. package/dist/OdysseyProvider.js.map +1 -1
  13. package/dist/OdysseyThemeProvider.js +3 -3
  14. package/dist/OdysseyThemeProvider.js.map +1 -1
  15. package/dist/PasswordField.js.map +1 -1
  16. package/dist/Radio.js.map +1 -1
  17. package/dist/RadioGroup.js.map +1 -1
  18. package/dist/SearchField.js.map +1 -1
  19. package/dist/Select.js.map +1 -1
  20. package/dist/TextField.js +1 -0
  21. package/dist/TextField.js.map +1 -1
  22. package/dist/Tooltip.js +5 -1
  23. package/dist/Tooltip.js.map +1 -1
  24. package/dist/{createShadowDom.js → createShadowRootElement.js} +6 -11
  25. package/dist/createShadowRootElement.js.map +1 -0
  26. package/dist/index.js +2 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/src/Autocomplete.d.ts +2 -21
  29. package/dist/src/Autocomplete.d.ts.map +1 -1
  30. package/dist/src/Checkbox.d.ts +2 -13
  31. package/dist/src/Checkbox.d.ts.map +1 -1
  32. package/dist/src/CheckboxGroup.d.ts +2 -13
  33. package/dist/src/CheckboxGroup.d.ts.map +1 -1
  34. package/dist/src/FieldComponentProps.d.ts +42 -0
  35. package/dist/src/FieldComponentProps.d.ts.map +1 -0
  36. package/dist/src/NativeSelect.d.ts +3 -42
  37. package/dist/src/NativeSelect.d.ts.map +1 -1
  38. package/dist/src/OdysseyCacheProvider.d.ts +2 -2
  39. package/dist/src/OdysseyCacheProvider.d.ts.map +1 -1
  40. package/dist/src/OdysseyProvider.d.ts +1 -1
  41. package/dist/src/OdysseyProvider.d.ts.map +1 -1
  42. package/dist/src/OdysseyThemeProvider.d.ts +2 -2
  43. package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
  44. package/dist/src/PasswordField.d.ts +3 -58
  45. package/dist/src/PasswordField.d.ts.map +1 -1
  46. package/dist/src/Radio.d.ts +2 -9
  47. package/dist/src/Radio.d.ts.map +1 -1
  48. package/dist/src/RadioGroup.d.ts +2 -21
  49. package/dist/src/RadioGroup.d.ts.map +1 -1
  50. package/dist/src/SearchField.d.ts +3 -26
  51. package/dist/src/SearchField.d.ts.map +1 -1
  52. package/dist/src/Select.d.ts +2 -25
  53. package/dist/src/Select.d.ts.map +1 -1
  54. package/dist/src/TextField.d.ts +3 -58
  55. package/dist/src/TextField.d.ts.map +1 -1
  56. package/dist/src/Tooltip.d.ts +2 -1
  57. package/dist/src/Tooltip.d.ts.map +1 -1
  58. package/dist/src/{createShadowDom.d.ts → createShadowRootElement.d.ts} +2 -5
  59. package/dist/src/createShadowRootElement.d.ts.map +1 -0
  60. package/dist/src/index.d.ts +2 -1
  61. package/dist/src/index.d.ts.map +1 -1
  62. package/dist/src/theme/components.d.ts +2 -2
  63. package/dist/src/theme/components.d.ts.map +1 -1
  64. package/dist/src/theme/createOdysseyMuiTheme.d.ts +2 -2
  65. package/dist/theme/components.js +90 -70
  66. package/dist/theme/components.js.map +1 -1
  67. package/dist/theme/createOdysseyMuiTheme.js +2 -2
  68. package/dist/theme/createOdysseyMuiTheme.js.map +1 -1
  69. package/dist/tsconfig.production.tsbuildinfo +1 -1
  70. package/package.json +3 -3
  71. package/src/Autocomplete.tsx +6 -21
  72. package/src/Checkbox.tsx +6 -16
  73. package/src/CheckboxGroup.tsx +3 -13
  74. package/src/FieldComponentProps.ts +42 -0
  75. package/src/NativeSelect.tsx +6 -22
  76. package/src/OdysseyCacheProvider.tsx +12 -2
  77. package/src/OdysseyProvider.tsx +3 -4
  78. package/src/OdysseyThemeProvider.tsx +4 -4
  79. package/src/PasswordField.tsx +3 -29
  80. package/src/Radio.tsx +3 -9
  81. package/src/RadioGroup.tsx +6 -21
  82. package/src/SearchField.tsx +3 -13
  83. package/src/Select.tsx +8 -26
  84. package/src/TextField.tsx +4 -30
  85. package/src/Tooltip.tsx +7 -2
  86. package/src/createShadowRootElement.ts +21 -0
  87. package/src/index.ts +2 -1
  88. package/src/theme/components.tsx +34 -15
  89. package/src/theme/createOdysseyMuiTheme.ts +3 -3
  90. package/dist/createShadowDom.js.map +0 -1
  91. package/dist/src/createShadowDom.d.ts.map +0 -1
  92. 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.0",
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.0",
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": "03b8e69263df83250402101d7637a5ede3578099"
66
+ "gitHead": "01feb062b03dc39ba97724277fd289eaa0000a5b"
67
67
  }
@@ -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
- } & SeleniumProps;
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
- } & SeleniumProps;
64
+ } & Pick<FieldComponentProps, "id" | "isDisabled" | "name"> &
65
+ SeleniumProps;
76
66
 
77
67
  const Checkbox = ({
78
68
  ariaLabel,
@@ -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
- } & SeleniumProps;
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
+ };
@@ -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
- } & SeleniumProps;
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({
@@ -35,8 +35,7 @@ export type OdysseyProviderProps = OdysseyCacheProviderProps &
35
35
  const OdysseyProvider = ({
36
36
  children,
37
37
  designTokensOverride,
38
- emotionRootElement,
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
- shadowRootElement={shadowRootElement}
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
- shadowRootElement?: HTMLDivElement;
28
+ shadowDomElement?: HTMLDivElement;
29
29
  themeOverride?: ThemeOptions;
30
30
  };
31
31
 
32
32
  const OdysseyThemeProvider = ({
33
33
  children,
34
34
  designTokensOverride,
35
- shadowRootElement,
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
- shadowRootElement,
46
+ shadowDomElement,
47
47
  }),
48
- [odysseyTokens, shadowRootElement]
48
+ [odysseyTokens, shadowDomElement]
49
49
  );
50
50
 
51
51
  const customOdysseyTheme = useMemo(
@@ -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
- } & SeleniumProps;
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
- } & SeleniumProps;
38
+ } & Pick<FieldComponentProps, "isDisabled" | "name"> &
39
+ SeleniumProps;
46
40
 
47
41
  const Radio = ({
48
42
  isChecked,
@@ -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
- } & SeleniumProps;
45
+ } & Pick<
46
+ FieldComponentProps,
47
+ "errorMessage" | "hint" | "id" | "isDisabled" | "name"
48
+ > &
49
+ SeleniumProps;
65
50
 
66
51
  const RadioGroup = ({
67
52
  children,
@@ -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
- } & SeleniumProps;
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 type { SeleniumProps } from "./SeleniumProps";
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
- } & SeleniumProps;
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