@okta/odyssey-react-mui 0.21.2 → 0.21.4

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 (42) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/Banner.js +2 -3
  3. package/dist/Banner.js.map +1 -1
  4. package/dist/CheckboxGroup.js +2 -3
  5. package/dist/CheckboxGroup.js.map +1 -1
  6. package/dist/CircularProgress.js +12 -0
  7. package/dist/CircularProgress.js.map +1 -0
  8. package/dist/Infobox.js +2 -3
  9. package/dist/Infobox.js.map +1 -1
  10. package/dist/RadioGroup.js +2 -3
  11. package/dist/RadioGroup.js.map +1 -1
  12. package/dist/ScreenReaderText.js +30 -0
  13. package/dist/ScreenReaderText.js.map +1 -0
  14. package/dist/TextField.js +2 -3
  15. package/dist/TextField.js.map +1 -1
  16. package/dist/index.js +3 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/src/CircularProgress.d.ts +16 -0
  19. package/dist/src/CircularProgress.d.ts.map +1 -0
  20. package/dist/src/Link.d.ts +1 -1
  21. package/dist/src/RadioGroup.d.ts.map +1 -1
  22. package/dist/src/ScreenReaderText.d.ts +21 -0
  23. package/dist/src/ScreenReaderText.d.ts.map +1 -0
  24. package/dist/src/index.d.ts +4 -2
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/theme/components.d.ts.map +1 -1
  27. package/dist/theme/components.js +132 -23
  28. package/dist/theme/components.js.map +1 -1
  29. package/dist/theme/palette.js +1 -1
  30. package/dist/theme/palette.js.map +1 -1
  31. package/dist/tsconfig.production.tsbuildinfo +1 -1
  32. package/package.json +5 -5
  33. package/src/Banner.tsx +2 -2
  34. package/src/CheckboxGroup.tsx +2 -2
  35. package/src/CircularProgress.tsx +24 -0
  36. package/src/Infobox.tsx +2 -2
  37. package/src/RadioGroup.tsx +2 -2
  38. package/src/ScreenReaderText.tsx +36 -0
  39. package/src/TextField.tsx +2 -2
  40. package/src/index.ts +2 -2
  41. package/src/theme/components.tsx +151 -18
  42. package/src/theme/palette.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "0.21.2",
3
+ "version": "0.21.4",
4
4
  "description": "React MUI components for Odyssey, Okta's design system",
5
5
  "author": "Okta, Inc.",
6
6
  "license": "Apache-2.0",
@@ -10,8 +10,8 @@
10
10
  "types": "dist/src/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "default": "./dist/index.js",
14
- "types": "./dist/src/index.d.ts"
13
+ "types": "./dist/src/index.d.ts",
14
+ "default": "./dist/index.js"
15
15
  }
16
16
  },
17
17
  "repository": {
@@ -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.2"
28
+ "@okta/odyssey-design-tokens": "0.21.4"
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": "294f5141125cf05fe9fc7cbda318bd85a1adafad"
36
+ "gitHead": "facb0d98d72297e662093673a0e0ee8d7e226be2"
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, visuallyHidden } from "./";
15
+ import { Alert, Link, ScreenReaderText } from "./";
16
16
 
17
17
  export interface BannerProps {
18
18
  /**
@@ -55,7 +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
+ <ScreenReaderText>{severity}:</ScreenReaderText>
59
59
  {text}
60
60
  {linkUrl && (
61
61
  <Link href={linkUrl} variant="monochrome">
@@ -18,7 +18,7 @@ import {
18
18
  FormGroup,
19
19
  FormHelperText,
20
20
  FormLabel,
21
- visuallyHidden,
21
+ ScreenReaderText,
22
22
  } from ".";
23
23
 
24
24
  export type CheckboxGroupProps = {
@@ -61,7 +61,7 @@ const CheckboxGroup = ({
61
61
  <FormGroup aria-describedby={ariaDescribedBy}>{children}</FormGroup>
62
62
  {errorMessage && (
63
63
  <FormHelperText id={`${name}-error`} error>
64
- <span style={visuallyHidden}>Error:</span> {errorMessage}
64
+ <ScreenReaderText>Error:</ScreenReaderText> {errorMessage}
65
65
  </FormHelperText>
66
66
  )}
67
67
  </FormControl>
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright (c) 2022-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
+ import { CircularProgress as MuiCircularProgress } from "@mui/material";
14
+
15
+ export type CircularProgressProps = {
16
+ value?: number;
17
+ };
18
+
19
+ export const CircularProgress = ({ value }: CircularProgressProps) => (
20
+ <MuiCircularProgress
21
+ value={value}
22
+ variant={value ? "determinate" : "indeterminate"}
23
+ />
24
+ );
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, visuallyHidden } from ".";
15
+ import { Alert, AlertTitle, ScreenReaderText } from ".";
16
16
 
17
17
  export interface InfoboxProps {
18
18
  /**
@@ -37,7 +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
+ <ScreenReaderText>{severity}: </ScreenReaderText>
41
41
  {title && <AlertTitle>{title}</AlertTitle>}
42
42
  {children}
43
43
  </Alert>
@@ -17,8 +17,8 @@ import {
17
17
  FormControl,
18
18
  FormLabel,
19
19
  FormHelperText,
20
- visuallyHidden,
21
20
  Radio,
21
+ ScreenReaderText,
22
22
  useUniqueId,
23
23
  RadioProps,
24
24
  } from ".";
@@ -104,7 +104,7 @@ const RadioGroup = ({
104
104
  </MuiRadioGroup>
105
105
  {errorMessage && (
106
106
  <FormHelperText id={`${uniqueName}-error`} error>
107
- <span style={visuallyHidden}>Error:</span> {errorMessage}
107
+ <ScreenReaderText>Error:</ScreenReaderText> {errorMessage}
108
108
  </FormHelperText>
109
109
  )}
110
110
  </FormControl>
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright (c) 2022-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
+ import { memo, ReactNode } from "react";
14
+ import { Box, visuallyHidden } from "./";
15
+
16
+ export type ScreenReaderTextProps = {
17
+ /**
18
+ * The visually-hidden text.
19
+ */
20
+ children: ReactNode;
21
+ };
22
+
23
+ /**
24
+ * MUI sx expects you pass in a CSS object, not an object with CSS.
25
+ * They seem identical, but only if you create a new object like this will MUI be happy with the type of visuallyHidden.
26
+ * It's otherwise a regular object with CSS properties.
27
+ */
28
+ const style = { ...visuallyHidden };
29
+
30
+ const ScreenReaderText = ({ children }: ScreenReaderTextProps) => (
31
+ <Box sx={style}>{children}</Box>
32
+ );
33
+
34
+ const MemoizedScreenReaderText = memo(ScreenReaderText);
35
+
36
+ export { MemoizedScreenReaderText as ScreenReaderText };
package/src/TextField.tsx CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  SearchIcon,
39
39
  Typography,
40
40
  useUniqueId,
41
- visuallyHidden,
41
+ ScreenReaderText,
42
42
  } from "./";
43
43
 
44
44
  export type TextFieldProps = {
@@ -232,7 +232,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
232
232
  />
233
233
  {errorMessage && (
234
234
  <FormHelperText error id={errorId}>
235
- <span style={visuallyHidden}>Error:</span>
235
+ <ScreenReaderText>Error:</ScreenReaderText>
236
236
  {errorMessage}
237
237
  </FormHelperText>
238
238
  )}
package/src/index.ts CHANGED
@@ -16,7 +16,6 @@ export {
16
16
  Box,
17
17
  Button,
18
18
  Chip,
19
- CircularProgress,
20
19
  createTheme,
21
20
  CssBaseline,
22
21
  Dialog,
@@ -69,7 +68,6 @@ export type {
69
68
  BoxProps,
70
69
  ButtonProps,
71
70
  ChipProps,
72
- CircularProgressProps,
73
71
  CssBaselineProps,
74
72
  DialogProps,
75
73
  DialogActionsProps,
@@ -127,6 +125,7 @@ export { deepmerge, visuallyHidden } from "@mui/utils";
127
125
  export * from "./Banner";
128
126
  export * from "./Checkbox";
129
127
  export * from "./CheckboxGroup";
128
+ export * from "./CircularProgress";
130
129
  export * from "./createUniqueId";
131
130
  export * from "./Icon";
132
131
  export * from "./iconDictionary";
@@ -139,6 +138,7 @@ export * from "./OdysseyThemeProvider";
139
138
  export * from "./PasswordInput";
140
139
  export * from "./Radio";
141
140
  export * from "./RadioGroup";
141
+ export * from "./ScreenReaderText";
142
142
  export * from "./Status";
143
143
  export * from "./TextField";
144
144
  export * from "./theme";
@@ -32,10 +32,12 @@ import { tooltipClasses } from "@mui/material/Tooltip";
32
32
  import {
33
33
  AlertTriangleFilledIcon,
34
34
  ArrowDownIcon,
35
+ CheckIcon,
35
36
  CheckCircleFilledIcon,
36
37
  ChevronDownIcon,
37
38
  CloseCircleFilledIcon,
38
39
  InformationCircleFilledIcon,
40
+ SubtractIcon,
39
41
  } from "../iconDictionary";
40
42
 
41
43
  export const components: ThemeOptions["components"] = {
@@ -362,23 +364,87 @@ export const components: ThemeOptions["components"] = {
362
364
  MuiCheckbox: {
363
365
  defaultProps: {
364
366
  size: "small",
367
+ icon: <></>,
368
+ checkedIcon: <CheckIcon />,
369
+ indeterminateIcon: <SubtractIcon />,
365
370
  },
366
371
  styleOverrides: {
367
372
  root: ({ theme }) => ({
368
- borderRadius: "4px",
369
- "&:hover": {
373
+ width: `${theme.typography.ui.lineHeight}em`,
374
+ height: `${theme.typography.ui.lineHeight}em`,
375
+ borderRadius: theme.mixins.borderRadius,
376
+ borderWidth: theme.mixins.borderWidth,
377
+ borderStyle: theme.mixins.borderStyle,
378
+ borderColor: theme.palette.grey[500],
379
+ padding: 0,
380
+ boxShadow: `0 0 0 0 transparent`,
381
+ transition: theme.transitions.create(
382
+ ["border-color", "background-color", "box-shadow"],
383
+ {
384
+ duration: theme.transitions.duration.short,
385
+ }
386
+ ),
387
+
388
+ ".MuiSvgIcon-root": {
389
+ color: theme.palette.common.white,
390
+ width: "0.5em",
391
+ height: "0.5em",
392
+ transition: theme.transitions.create(["color"], {
393
+ duration: theme.transitions.duration.short,
394
+ }),
395
+ },
396
+
397
+ "&.Mui-checked": {
398
+ backgroundColor: theme.palette.primary.main,
399
+ borderColor: theme.palette.primary.main,
400
+
401
+ ".MuiFormControlLabel-root:hover > &": {
402
+ backgroundColor: theme.palette.primary.dark,
403
+ borderColor: theme.palette.primary.dark,
404
+ },
405
+ },
406
+
407
+ ".MuiFormControlLabel-root:hover > &": {
370
408
  backgroundColor: "transparent",
409
+ borderColor: theme.palette.grey[900],
410
+ },
411
+ ".Mui-error:hover > &": {
412
+ borderColor: theme.palette.error.dark,
413
+
414
+ "&.Mui-checked": {
415
+ backgroundColor: theme.palette.error.dark,
416
+ borderColor: theme.palette.error.dark,
417
+ },
371
418
  },
372
- padding: 0,
373
419
  ".Mui-error > &": {
374
- color: theme.palette.error.main,
375
- "&:hover": {
376
- color: theme.palette.error.dark,
420
+ borderColor: theme.palette.error.main,
421
+
422
+ "&.Mui-checked": {
423
+ backgroundColor: theme.palette.error.main,
424
+ borderColor: theme.palette.error.main,
425
+ },
426
+
427
+ "&.Mui-focusVisible": {
428
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.error.main}`,
377
429
  },
378
430
  },
379
- ".Mui-error > &.Mui-checked": {
380
- "&:hover": {
381
- color: theme.palette.error.dark,
431
+ "&.Mui-focusVisible": {
432
+ borderColor: theme.palette.grey[900],
433
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.primary.main}`,
434
+ outline: "2px solid transparent",
435
+ outlineOffset: "1px",
436
+ },
437
+ "&.Mui-disabled": {
438
+ backgroundColor: theme.palette.grey[50],
439
+ borderColor: theme.palette.grey[300],
440
+
441
+ ".Mui-error > &": {
442
+ backgroundColor: theme.palette.grey[50],
443
+ borderColor: theme.palette.grey[300],
444
+ },
445
+
446
+ ".MuiSvgIcon-root": {
447
+ color: theme.palette.common.black,
382
448
  },
383
449
  },
384
450
  }),
@@ -1086,12 +1152,21 @@ export const components: ThemeOptions["components"] = {
1086
1152
  borderStyle: theme.mixins.borderStyle,
1087
1153
  borderRadius: theme.mixins.borderRadius,
1088
1154
  borderColor: theme.palette.grey[500],
1155
+ boxShadow: `0 0 0 0 transparent`,
1156
+ backgroundColor: theme.palette.common.white,
1157
+ transition: theme.transitions.create(
1158
+ ["border-color", "background-color", "box-shadow"],
1159
+ {
1160
+ duration: theme.transitions.duration.short,
1161
+ }
1162
+ ),
1089
1163
 
1090
1164
  ...(ownerState.fullWidth && {
1091
1165
  width: "100%",
1092
1166
  }),
1093
1167
 
1094
1168
  ...(ownerState.readOnly === true && {
1169
+ borderColor: "transparent",
1095
1170
  backgroundColor: theme.palette.grey[50],
1096
1171
  }),
1097
1172
 
@@ -1365,24 +1440,82 @@ export const components: ThemeOptions["components"] = {
1365
1440
  MuiRadio: {
1366
1441
  defaultProps: {
1367
1442
  size: "small",
1443
+ icon: <></>,
1444
+ checkedIcon: <></>,
1368
1445
  },
1369
1446
  styleOverrides: {
1370
1447
  root: ({ theme }) => ({
1371
- "&:hover": {
1448
+ width: `${theme.typography.ui.lineHeight}em`,
1449
+ height: `${theme.typography.ui.lineHeight}em`,
1450
+ borderRadius: `${theme.typography.ui.lineHeight}em`,
1451
+ borderWidth: theme.mixins.borderWidth,
1452
+ borderStyle: theme.mixins.borderStyle,
1453
+ borderColor: theme.palette.grey[500],
1454
+ padding: 0,
1455
+ boxShadow: `0 0 0 0 transparent`,
1456
+ transition: theme.transitions.create(
1457
+ ["border-color", "background-color", "box-shadow"],
1458
+ {
1459
+ duration: theme.transitions.duration.short,
1460
+ }
1461
+ ),
1462
+
1463
+ "&::before": {
1464
+ content: "''",
1465
+ position: "absolute",
1466
+ width: "0.5em",
1467
+ height: "0.5em",
1468
+ borderRadius: "50%",
1372
1469
  backgroundColor: "transparent",
1470
+ transition: theme.transitions.create(["background-color"], {
1471
+ duration: theme.transitions.duration.short,
1472
+ }),
1473
+ },
1474
+
1475
+ ".MuiFormControlLabel-root:hover > &": {
1476
+ backgroundColor: "transparent",
1477
+ borderColor: theme.palette.grey[900],
1478
+ },
1479
+ ".Mui-error:hover > &": {
1480
+ backgroundColor: "transparent",
1481
+ borderColor: theme.palette.error.dark,
1482
+ "&::before": {
1483
+ backgroundColor: theme.palette.error.dark,
1484
+ },
1373
1485
  },
1374
- padding: 0,
1375
1486
  ".Mui-error > &": {
1376
- color: theme.palette.error.main,
1377
- "&:hover": {
1378
- color: theme.palette.error.dark,
1487
+ borderColor: theme.palette.error.main,
1488
+ "&::before": {
1489
+ backgroundColor: theme.palette.error.main,
1490
+ },
1491
+
1492
+ "&.Mui-focusVisible": {
1493
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.error.main}`,
1379
1494
  },
1380
1495
  },
1381
1496
  "&.Mui-focusVisible": {
1382
- outlineColor: theme.palette.primary.main,
1383
- outlineOffset: 0,
1384
- outlineStyle: "solid",
1385
- outlineWidth: "2px",
1497
+ borderColor: theme.palette.grey[900],
1498
+ boxShadow: `0 0 0 2px ${theme.palette.background.default}, 0 0 0 4px ${theme.palette.primary.main}`,
1499
+ outline: "2px solid transparent",
1500
+ outlineOffset: "1px",
1501
+ },
1502
+ "&.Mui-checked": {
1503
+ position: "relative",
1504
+
1505
+ "&::before": {
1506
+ backgroundColor: theme.palette.primary.main,
1507
+ },
1508
+ },
1509
+ ".Mui-error > &.Mui-checked::before": {
1510
+ backgroundColor: theme.palette.error.main,
1511
+ },
1512
+ "&.Mui-disabled": {
1513
+ backgroundColor: theme.palette.grey[50],
1514
+ borderColor: theme.palette.grey[300],
1515
+
1516
+ "&::before": {
1517
+ backgroundColor: theme.palette.grey[300],
1518
+ },
1386
1519
  },
1387
1520
  }),
1388
1521
  },
@@ -80,7 +80,7 @@ export const palette: ThemeOptions["palette"] = {
80
80
  text: {
81
81
  primary: Tokens.ColorPaletteNeutral900,
82
82
  secondary: Tokens.ColorPaletteNeutral600,
83
- disabled: Tokens.ColorPaletteNeutral500,
83
+ disabled: Tokens.ColorPaletteNeutral600,
84
84
  },
85
85
  divider: Tokens.ColorBorderDisplay,
86
86
  background: {