@okta/odyssey-react-mui 0.21.3 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okta/odyssey-react-mui",
3
- "version": "0.21.3",
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",
@@ -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.3"
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": "06e016c9b7228f30babae07b3b23be04ceaa2f77"
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";