@okta/odyssey-react-mui 0.21.1 → 0.21.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "React MUI components for Odyssey, Okta's design system",
5
5
  "author": "Okta, Inc.",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  "@mui/lab": "^5.0.0-alpha.117",
26
26
  "@mui/material": "^5.11.6",
27
27
  "@mui/utils": "^5.11.2",
28
- "@okta/odyssey-design-tokens": "0.21.1"
28
+ "@okta/odyssey-design-tokens": "0.21.2"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@emotion/react": "^11",
@@ -33,5 +33,5 @@
33
33
  "react": ">=17 <19",
34
34
  "react-dom": ">=17 <19"
35
35
  },
36
- "gitHead": "721bec01e965f923e751749922e1073f63066783"
36
+ "gitHead": "294f5141125cf05fe9fc7cbda318bd85a1adafad"
37
37
  }
package/src/Banner.tsx CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { AlertColor, AlertProps } from "@mui/material";
14
14
  import { memo } from "react";
15
- import { Alert, Link } from "./";
15
+ import { Alert, Link, visuallyHidden } from "./";
16
16
 
17
17
  export interface BannerProps {
18
18
  /**
@@ -55,6 +55,7 @@ const Banner = ({
55
55
  text,
56
56
  }: BannerProps) => (
57
57
  <Alert onClose={onClose} role={role} severity={severity} variant="banner">
58
+ <span style={visuallyHidden}>{severity}:</span>
58
59
  {text}
59
60
  {linkUrl && (
60
61
  <Link href={linkUrl} variant="monochrome">
package/src/Infobox.tsx CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  import { AlertColor } from "@mui/material";
14
14
  import { memo, ReactNode } from "react";
15
- import { Alert, AlertTitle } from ".";
15
+ import { Alert, AlertTitle, visuallyHidden } from ".";
16
16
 
17
17
  export interface InfoboxProps {
18
18
  /**
@@ -37,6 +37,7 @@ export interface InfoboxProps {
37
37
 
38
38
  const Infobox = ({ children, severity, role, title }: InfoboxProps) => (
39
39
  <Alert role={role} severity={severity} variant="infobox">
40
+ <span style={visuallyHidden}>{severity}: </span>
40
41
  {title && <AlertTitle>{title}</AlertTitle>}
41
42
  {children}
42
43
  </Alert>
package/src/TextField.tsx CHANGED
@@ -42,6 +42,10 @@ import {
42
42
  } from "./";
43
43
 
44
44
  export type TextFieldProps = {
45
+ /**
46
+ * If `true`, the component will receive focus automatically.
47
+ */
48
+ autoFocus?: boolean;
45
49
  /**
46
50
  * This prop helps users to fill forms faster, especially on mobile devices.
47
51
  * The name can be confusing, as it's more like an autofill.
@@ -126,6 +130,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
126
130
  (
127
131
  {
128
132
  autoCompleteType,
133
+ autoFocus,
129
134
  endAdornment,
130
135
  errorMessage,
131
136
  hint,
@@ -187,8 +192,10 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
187
192
  {hint && <FormHelperText id={hintId}>{hint}</FormHelperText>}
188
193
  <InputBase
189
194
  autoComplete={autoCompleteType}
195
+ /* eslint-disable-next-line jsx-a11y/no-autofocus */
196
+ autoFocus={autoFocus}
190
197
  endAdornment={
191
- inputType === "password" ? (
198
+ type === "password" ? (
192
199
  <InputAdornment position="end">
193
200
  <IconButton
194
201
  aria-label="toggle password visibility"
@@ -171,10 +171,6 @@ export const components: ThemeOptions["components"] = {
171
171
  backgroundColor: theme.palette.primary.dark,
172
172
  },
173
173
 
174
- "&:focus-visible": {
175
- outlineColor: theme.palette.primary.main,
176
- },
177
-
178
174
  "&:active": {
179
175
  backgroundColor: theme.palette.primary.main,
180
176
  },
@@ -197,10 +193,6 @@ export const components: ThemeOptions["components"] = {
197
193
  color: theme.palette.primary.main,
198
194
  },
199
195
 
200
- "&:focus-visible": {
201
- outlineColor: theme.palette.primary.main,
202
- },
203
-
204
196
  "&:active": {
205
197
  borderColor: theme.palette.primary.main,
206
198
  },
@@ -224,7 +216,7 @@ export const components: ThemeOptions["components"] = {
224
216
  },
225
217
 
226
218
  "&:focus-visible": {
227
- outlineColor: theme.palette.error.main,
219
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.error.main}`,
228
220
  backgroundColor: theme.palette.error.dark,
229
221
  },
230
222
 
@@ -249,15 +241,12 @@ export const components: ThemeOptions["components"] = {
249
241
  backgroundColor: "rgba(29, 29, 33, 0.1)",
250
242
  borderColor: "transparent",
251
243
  },
252
- "&:focus-visible": {
253
- outlineColor: theme.palette.primary.main,
254
- },
255
244
  "&:active": {
256
245
  backgroundColor: "rgba(29, 29, 33, 0.2)",
257
246
  borderColor: "transparent",
258
247
  },
259
248
  "&:disabled": {
260
- backgroundColor: "rgba(235, 235, 237, 0.6)",
249
+ backgroundColor: "transparent",
261
250
  color: theme.palette.text.secondary,
262
251
  borderColor: "transparent",
263
252
  },
@@ -312,15 +301,12 @@ export const components: ThemeOptions["components"] = {
312
301
  position: "relative",
313
302
  marginBlock: "0",
314
303
  marginInline: "0",
315
- transitionProperty:
316
- "color, background-color, border-color, outline-offset, outline-color",
304
+ transitionProperty: "color, background-color, border-color, box-shadow",
317
305
  transitionDuration: "100ms",
318
306
  transitionTimingFunction: "linear",
319
307
  borderWidth: theme.mixins.borderWidth,
320
308
  borderStyle: theme.mixins.borderStyle,
321
309
  borderRadius: theme.mixins.borderRadius,
322
- outlineColor: "transparent",
323
- outlineOffset: "0",
324
310
  fontSize: theme.typography.body1.fontSize,
325
311
  lineHeight: theme.typography.ui.lineHeight,
326
312
  whiteSpace: "nowrap",
@@ -330,9 +316,9 @@ export const components: ThemeOptions["components"] = {
330
316
  },
331
317
 
332
318
  "&:focus-visible": {
333
- outlineOffset: "2px",
334
- outlineStyle: "solid",
335
- outlineWidth: "2px",
319
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.primary.main}`,
320
+ outline: "2px solid transparent",
321
+ outlineOffset: "1px",
336
322
  },
337
323
 
338
324
  "&:disabled": {
@@ -395,12 +381,6 @@ export const components: ThemeOptions["components"] = {
395
381
  color: theme.palette.error.dark,
396
382
  },
397
383
  },
398
- "&.Mui-focusVisible": {
399
- outlineColor: theme.palette.primary.main,
400
- outlineOffset: 0,
401
- outlineStyle: "solid",
402
- outlineWidth: "2px",
403
- },
404
384
  }),
405
385
  },
406
386
  },
@@ -729,7 +709,7 @@ export const components: ThemeOptions["components"] = {
729
709
  },
730
710
  },
731
711
 
732
- p: {
712
+ "p:not([class])": {
733
713
  maxWidth: theme.mixins.maxWidth,
734
714
  marginBlockStart: 0,
735
715
  marginBlockEnd: theme.spacing(4),
@@ -994,14 +974,14 @@ export const components: ThemeOptions["components"] = {
994
974
  root: ({ theme }) => ({
995
975
  fontSize: theme.typography.subtitle1.fontSize,
996
976
  lineHeight: "1.33333333",
997
- marginTop: theme.spacing(2),
977
+ marginBlockStart: theme.spacing(2),
998
978
  ".MuiFormLabel-root + &": {
999
- marginTop: `-${theme.spacing(1)}`,
979
+ marginBlockStart: `-${theme.spacing(1)}`,
1000
980
  color: theme.palette.text.secondary,
1001
981
  },
1002
- marginBottom: theme.spacing(2),
982
+ marginBlockEnd: theme.spacing(2),
1003
983
  "&:last-child": {
1004
- marginBottom: 0,
984
+ marginBlockEnd: 0,
1005
985
  },
1006
986
  textAlign: "start",
1007
987
  }),
@@ -1121,10 +1101,9 @@ export const components: ThemeOptions["components"] = {
1121
1101
 
1122
1102
  [`&.${inputBaseClasses.focused}`]: {
1123
1103
  borderColor: theme.palette.primary.main,
1124
- outlineColor: theme.palette.primary.main,
1125
- outlineOffset: 0,
1126
- outlineStyle: "solid",
1127
- outlineWidth: "1px",
1104
+ boxShadow: `0 0 0 1px ${theme.palette.primary.main}`,
1105
+ outline: "2px solid transparent",
1106
+ outlineOffset: "1px",
1128
1107
  },
1129
1108
 
1130
1109
  [`&.${inputBaseClasses.error}`]: {
@@ -1137,7 +1116,7 @@ export const components: ThemeOptions["components"] = {
1137
1116
 
1138
1117
  [`&.${inputBaseClasses.error}.${inputBaseClasses.focused}`]: {
1139
1118
  borderColor: theme.palette.error.main,
1140
- outlineColor: theme.palette.error.main,
1119
+ boxShadow: `0 0 0 1px ${theme.palette.error.main}`,
1141
1120
  },
1142
1121
 
1143
1122
  [`&.${inputBaseClasses.disabled}`]: {