@okta/odyssey-react-mui 1.10.3 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
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.10.3",
54
+ "@okta/odyssey-design-tokens": "1.11.0",
55
55
  "date-fns": "^2.30.0",
56
56
  "i18next": "^23.5.1",
57
57
  "material-react-table": "^2.0.2",
@@ -63,5 +63,5 @@
63
63
  "react": ">=17 <19",
64
64
  "react-dom": ">=17 <19"
65
65
  },
66
- "gitHead": "a6212214c614cc9e2b6199d805e253d4fad586a4"
66
+ "gitHead": "36ec4393909bdea95455892c4a9eb65c38ea0857"
67
67
  }
package/src/Accordion.tsx CHANGED
@@ -20,12 +20,17 @@ import {
20
20
  } from "@mui/material";
21
21
  import { ChevronDownIcon } from "./icons.generated";
22
22
  import { Support } from "./Typography";
23
+ import { useUniqueId } from "./useUniqueId";
23
24
 
24
25
  export type AccordionProps = {
25
26
  /**
26
27
  * The content of the Accordion itself
27
28
  */
28
29
  children: ReactNode;
30
+ /**
31
+ * Defines IDs for the header and the content of the Accordion
32
+ */
33
+ id?: string;
29
34
  /**
30
35
  * The label text for the AccordionSummary
31
36
  */
@@ -66,12 +71,16 @@ const Accordion = ({
66
71
  children,
67
72
  label,
68
73
  hasShadow = true,
74
+ id: idOverride,
69
75
  isDefaultExpanded,
70
76
  isDisabled,
71
77
  isExpanded,
72
78
  onChange,
73
79
  translate,
74
80
  }: AccordionProps) => {
81
+ const id = useUniqueId(idOverride);
82
+ const headerId = `${id}-header`;
83
+ const contentId = `${id}-content`;
75
84
  return (
76
85
  <MuiAccordion
77
86
  defaultExpanded={isDefaultExpanded}
@@ -81,12 +90,18 @@ const Accordion = ({
81
90
  onChange={onChange}
82
91
  className={hasShadow ? `hasShadow` : undefined}
83
92
  >
84
- <MuiAccordionSummary expandIcon={<ChevronDownIcon />}>
93
+ <MuiAccordionSummary
94
+ aria-controls={contentId}
95
+ expandIcon={<ChevronDownIcon />}
96
+ id={headerId}
97
+ >
85
98
  <Support component="div" translate={translate}>
86
99
  {label}
87
100
  </Support>
88
101
  </MuiAccordionSummary>
89
- <MuiAccordionDetails>{children}</MuiAccordionDetails>
102
+ <MuiAccordionDetails aria-labelledby={headerId}>
103
+ {children}
104
+ </MuiAccordionDetails>
90
105
  </MuiAccordion>
91
106
  );
92
107
  };
@@ -39,6 +39,7 @@ export type CheckboxGroupProps = {
39
39
  | "errorMessageList"
40
40
  | "hint"
41
41
  | "HintLinkComponent"
42
+ | "id"
42
43
  | "isDisabled"
43
44
  > &
44
45
  AllowedProps;
@@ -49,6 +50,7 @@ const CheckboxGroup = ({
49
50
  errorMessageList,
50
51
  hint,
51
52
  HintLinkComponent,
53
+ id: idOverride,
52
54
  isDisabled,
53
55
  isRequired = false,
54
56
  label,
@@ -56,12 +58,13 @@ const CheckboxGroup = ({
56
58
  translate,
57
59
  }: CheckboxGroupProps) => {
58
60
  const renderFieldComponent = useCallback(
59
- ({ ariaDescribedBy, errorMessageElementId, labelElementId }) => (
61
+ ({ ariaDescribedBy, errorMessageElementId, id, labelElementId }) => (
60
62
  <MuiFormGroup
61
63
  aria-describedby={ariaDescribedBy}
62
64
  aria-errormessage={errorMessageElementId}
63
65
  aria-labelledby={labelElementId}
64
66
  data-se={testId}
67
+ id={id}
65
68
  translate={translate}
66
69
  >
67
70
  {children}
@@ -78,6 +81,7 @@ const CheckboxGroup = ({
78
81
  hasVisibleLabel={true}
79
82
  hint={hint}
80
83
  HintLinkComponent={HintLinkComponent}
84
+ id={idOverride}
81
85
  isDisabled={isDisabled}
82
86
  isOptional={!isRequired}
83
87
  label={label}
@@ -165,11 +165,13 @@ const PasswordField = forwardRef<HTMLInputElement, PasswordFieldProps>(
165
165
  hasShowPassword && (
166
166
  <InputAdornment position="end">
167
167
  <IconButton
168
+ aria-controls={id}
168
169
  aria-label={
169
170
  inputType === "password"
170
171
  ? t("passwordfield.icon.label.show")
171
172
  : t("passwordfield.icon.label.hide")
172
173
  }
174
+ aria-pressed={inputType === "text"}
173
175
  onClick={togglePasswordVisibility}
174
176
  >
175
177
  {inputType === "password" ? <ShowIcon /> : <HideIcon />}