@okta/odyssey-react-mui 0.15.3 → 0.17.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/CHANGELOG.md +25 -0
- package/README.md +6 -2
- package/dist/Link.d.ts +1 -1
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +2 -15
- package/dist/Link.js.map +1 -1
- package/dist/OdysseyCacheProvider.d.ts +23 -0
- package/dist/OdysseyCacheProvider.d.ts.map +1 -0
- package/dist/OdysseyCacheProvider.js +36 -0
- package/dist/OdysseyCacheProvider.js.map +1 -0
- package/dist/OdysseyThemeProvider.d.ts +17 -0
- package/dist/OdysseyThemeProvider.d.ts.map +1 -0
- package/dist/OdysseyThemeProvider.js +29 -0
- package/dist/OdysseyThemeProvider.js.map +1 -0
- package/dist/PasswordInput.d.ts +1 -1
- package/dist/ThemeProvider.d.ts +3 -2
- package/dist/ThemeProvider.d.ts.map +1 -1
- package/dist/ThemeProvider.js +12 -6
- package/dist/ThemeProvider.js.map +1 -1
- package/dist/createUniqueAlphabeticalId.d.ts +14 -0
- package/dist/createUniqueAlphabeticalId.d.ts.map +1 -0
- package/dist/createUniqueAlphabeticalId.js +14 -0
- package/dist/createUniqueAlphabeticalId.js.map +1 -0
- package/dist/createUniqueId.d.ts.map +1 -1
- package/dist/createUniqueId.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +257 -148
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +1 -0
- package/dist/theme/typography.js.map +1 -1
- package/dist/useUniqueAlphabeticalId.d.ts +13 -0
- package/dist/useUniqueAlphabeticalId.d.ts.map +1 -0
- package/dist/useUniqueAlphabeticalId.js +18 -0
- package/dist/useUniqueAlphabeticalId.js.map +1 -0
- package/dist/useUniqueId.d.ts.map +1 -1
- package/dist/useUniqueId.js +1 -1
- package/dist/useUniqueId.js.map +1 -1
- package/package.json +7 -6
- package/src/Link.tsx +22 -24
- package/src/OdysseyCacheProvider.test.tsx +38 -0
- package/src/OdysseyCacheProvider.tsx +48 -0
- package/src/OdysseyThemeProvider.tsx +24 -0
- package/src/ThemeProvider.tsx +11 -5
- package/src/createUniqueAlphabeticalId.test.ts +22 -0
- package/src/createUniqueAlphabeticalId.ts +19 -0
- package/src/createUniqueId.ts +1 -1
- package/src/index.ts +9 -3
- package/src/theme/components.tsx +183 -69
- package/src/theme/typography.ts +1 -0
- package/src/useUniqueAlphabeticalId.ts +21 -0
- package/src/useUniqueId.ts +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import { render, screen } from "@testing-library/react";
|
|
14
|
+
import { Button } from "./";
|
|
15
|
+
import { OdysseyCacheProvider } from "./OdysseyCacheProvider";
|
|
16
|
+
|
|
17
|
+
// This component needs to be tested, even if it doesn't make much sense, because it can't be loaded by Storybook; therefore, any issues will only be seen by consumers of Odyssey.
|
|
18
|
+
describe("OdysseyCacheProvider", () => {
|
|
19
|
+
it("renders without crashing the app", () => {
|
|
20
|
+
expect(() =>
|
|
21
|
+
render(
|
|
22
|
+
<OdysseyCacheProvider>
|
|
23
|
+
<div />
|
|
24
|
+
</OdysseyCacheProvider>
|
|
25
|
+
)
|
|
26
|
+
).not.toThrow();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("themes a Button", () => {
|
|
30
|
+
render(
|
|
31
|
+
<OdysseyCacheProvider>
|
|
32
|
+
<Button>text</Button>
|
|
33
|
+
</OdysseyCacheProvider>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(screen.queryByRole("button")).toHaveTextContent("text");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
cspNonce: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
import createCache from "@emotion/cache";
|
|
20
|
+
import { CacheProvider } from "@emotion/react";
|
|
21
|
+
import { memo, ReactElement, useMemo } from "react";
|
|
22
|
+
|
|
23
|
+
import { useUniqueAlphabeticalId } from "./useUniqueAlphabeticalId";
|
|
24
|
+
|
|
25
|
+
const OdysseyCacheProvider = ({
|
|
26
|
+
children,
|
|
27
|
+
nonce,
|
|
28
|
+
}: {
|
|
29
|
+
children: ReactElement;
|
|
30
|
+
nonce?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
const uniqueAlphabeticalId = useUniqueAlphabeticalId();
|
|
33
|
+
|
|
34
|
+
const emotionCache = useMemo(
|
|
35
|
+
() =>
|
|
36
|
+
createCache({
|
|
37
|
+
key: uniqueAlphabeticalId,
|
|
38
|
+
nonce: nonce || window.cspNonce,
|
|
39
|
+
}),
|
|
40
|
+
[nonce, uniqueAlphabeticalId]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return <CacheProvider value={emotionCache}>{children}</CacheProvider>;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const MemoizedOdysseyCacheProvider = memo(OdysseyCacheProvider);
|
|
47
|
+
|
|
48
|
+
export { MemoizedOdysseyCacheProvider as OdysseyCacheProvider };
|
|
@@ -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 { ThemeProvider as MuiThemeProvider } from "@mui/material/styles";
|
|
14
|
+
import { memo, ReactElement } from "react";
|
|
15
|
+
|
|
16
|
+
import { odysseyTheme } from "./theme";
|
|
17
|
+
|
|
18
|
+
const OdysseyThemeProvider = ({ children }: { children: ReactElement }) => (
|
|
19
|
+
<MuiThemeProvider theme={odysseyTheme}>{children}</MuiThemeProvider>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const MemoizedOdysseyThemeProvider = memo(OdysseyThemeProvider);
|
|
23
|
+
|
|
24
|
+
export { MemoizedOdysseyThemeProvider as OdysseyThemeProvider };
|
package/src/ThemeProvider.tsx
CHANGED
|
@@ -10,11 +10,17 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import { ReactElement } from "react";
|
|
13
|
+
import { memo, ReactElement } from "react";
|
|
15
14
|
|
|
16
|
-
import {
|
|
15
|
+
import { OdysseyCacheProvider } from "./OdysseyCacheProvider";
|
|
16
|
+
import { OdysseyThemeProvider } from "./OdysseyThemeProvider";
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
<
|
|
18
|
+
const ThemeProvider = ({ children }: { children: ReactElement }) => (
|
|
19
|
+
<OdysseyCacheProvider>
|
|
20
|
+
<OdysseyThemeProvider>{children}</OdysseyThemeProvider>
|
|
21
|
+
</OdysseyCacheProvider>
|
|
20
22
|
);
|
|
23
|
+
|
|
24
|
+
const MemoizedThemeProvider = memo(ThemeProvider);
|
|
25
|
+
|
|
26
|
+
export { MemoizedThemeProvider as ThemeProvider };
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { createUniqueAlphabeticalId } from "./createUniqueAlphabeticalId";
|
|
14
|
+
|
|
15
|
+
describe("createUniqueAlphabeticalId", () => {
|
|
16
|
+
it("only has lowercase letters", () => {
|
|
17
|
+
const uniqueAlphabeticalId = createUniqueAlphabeticalId();
|
|
18
|
+
|
|
19
|
+
expect(uniqueAlphabeticalId.match(/[a-z]/)).not.toBeNull();
|
|
20
|
+
expect(uniqueAlphabeticalId.toLowerCase()).toBe(uniqueAlphabeticalId);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
// This is a random number chosen to shrink down the unique ID to an arbitrary length.
|
|
14
|
+
export const uniqueIdLength = 6;
|
|
15
|
+
|
|
16
|
+
export const createUniqueAlphabeticalId = () =>
|
|
17
|
+
Math.random()
|
|
18
|
+
.toString(36)
|
|
19
|
+
.replace(/[\d\.]/g, "");
|
package/src/createUniqueId.ts
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
// This is a random number chosen to shrink down the unique ID to an arbitrary length.
|
|
14
14
|
export const uniqueIdLength = 6;
|
|
15
15
|
|
|
16
|
-
export const createUniqueId = ()
|
|
16
|
+
export const createUniqueId = () =>
|
|
17
17
|
Math.random().toString(36).slice(-uniqueIdLength);
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,8 @@ export * from "./createUniqueId";
|
|
|
14
14
|
export * from "./Icon";
|
|
15
15
|
export * from "./iconDictionary";
|
|
16
16
|
export * from "./Link";
|
|
17
|
+
export * from "./OdysseyCacheProvider";
|
|
18
|
+
export * from "./OdysseyThemeProvider";
|
|
17
19
|
export * from "./PasswordInput";
|
|
18
20
|
export * from "./theme";
|
|
19
21
|
export * from "./ThemeProvider";
|
|
@@ -25,6 +27,7 @@ export {
|
|
|
25
27
|
Box,
|
|
26
28
|
Button,
|
|
27
29
|
Checkbox,
|
|
30
|
+
Chip,
|
|
28
31
|
CircularProgress,
|
|
29
32
|
CssBaseline,
|
|
30
33
|
Dialog,
|
|
@@ -37,9 +40,10 @@ export {
|
|
|
37
40
|
FormGroup,
|
|
38
41
|
FormHelperText,
|
|
39
42
|
FormLabel,
|
|
43
|
+
IconButton,
|
|
40
44
|
InputAdornment,
|
|
45
|
+
InputBase,
|
|
41
46
|
InputLabel,
|
|
42
|
-
OutlinedInput,
|
|
43
47
|
Radio,
|
|
44
48
|
RadioGroup,
|
|
45
49
|
Select,
|
|
@@ -66,6 +70,7 @@ export type {
|
|
|
66
70
|
BoxProps,
|
|
67
71
|
ButtonProps,
|
|
68
72
|
CheckboxProps,
|
|
73
|
+
ChipProps,
|
|
69
74
|
CircularProgressProps,
|
|
70
75
|
CssBaselineProps,
|
|
71
76
|
DialogProps,
|
|
@@ -78,9 +83,10 @@ export type {
|
|
|
78
83
|
FormGroupProps,
|
|
79
84
|
FormHelperTextProps,
|
|
80
85
|
FormLabelProps,
|
|
86
|
+
IconButtonProps,
|
|
81
87
|
InputAdornmentProps,
|
|
88
|
+
InputBaseProps,
|
|
82
89
|
InputLabelProps,
|
|
83
|
-
OutlinedInputProps,
|
|
84
90
|
RadioGroupProps,
|
|
85
91
|
RadioProps,
|
|
86
92
|
SelectProps,
|
|
@@ -104,6 +110,6 @@ export { TabContext, TabList, TabPanel } from "@mui/lab";
|
|
|
104
110
|
|
|
105
111
|
export type { TabContextProps, TabListProps, TabPanelProps } from "@mui/lab";
|
|
106
112
|
|
|
107
|
-
export {
|
|
113
|
+
export { default as FavoriteIcon } from "@mui/icons-material/Favorite";
|
|
108
114
|
|
|
109
115
|
export { visuallyHidden } from "@mui/utils";
|
package/src/theme/components.tsx
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
import type { ThemeOptions } from "@mui/material";
|
|
14
14
|
import type {} from "@mui/lab/themeAugmentation";
|
|
15
15
|
//import radioClasses from "@mui/material";
|
|
16
|
+
import { chipClasses } from "@mui/material/Chip";
|
|
16
17
|
import { dialogActionsClasses } from "@mui/material/DialogActions";
|
|
17
|
-
import {
|
|
18
|
+
import { inputBaseClasses } from "@mui/material/InputBase";
|
|
18
19
|
import { tableBodyClasses } from "@mui/material/TableBody";
|
|
19
20
|
import { tableCellClasses } from "@mui/material/TableCell";
|
|
20
21
|
import { tableHeadClasses } from "@mui/material/TableHead";
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
AlertTriangleFilledIcon,
|
|
26
27
|
ArrowDownIcon,
|
|
27
28
|
CheckCircleFilledIcon,
|
|
29
|
+
CloseCircleFilledIcon,
|
|
28
30
|
InformationCircleFilledIcon,
|
|
29
31
|
} from "../iconDictionary";
|
|
30
32
|
|
|
@@ -293,7 +295,7 @@ export const components: ThemeOptions["components"] = {
|
|
|
293
295
|
fontWeight: 600,
|
|
294
296
|
minWidth: "unset",
|
|
295
297
|
padding: `calc(${theme.spacing(3)} - 1px) ${theme.spacing(3)}`,
|
|
296
|
-
display: "inline-
|
|
298
|
+
display: "inline-flex",
|
|
297
299
|
position: "relative",
|
|
298
300
|
marginBlock: "0",
|
|
299
301
|
marginInline: "0",
|
|
@@ -326,9 +328,14 @@ export const components: ThemeOptions["components"] = {
|
|
|
326
328
|
},
|
|
327
329
|
|
|
328
330
|
".MuiButton-startIcon > *:nth-of-type(1)": {
|
|
329
|
-
fontSize: "
|
|
331
|
+
fontSize: "1.14285714em",
|
|
330
332
|
},
|
|
331
333
|
}),
|
|
334
|
+
startIcon: ({ theme }) => ({
|
|
335
|
+
display: "inline-flex",
|
|
336
|
+
margin: 0,
|
|
337
|
+
marginInlineEnd: theme.spacing(2),
|
|
338
|
+
}),
|
|
332
339
|
},
|
|
333
340
|
},
|
|
334
341
|
MuiButtonBase: {
|
|
@@ -374,6 +381,66 @@ export const components: ThemeOptions["components"] = {
|
|
|
374
381
|
}),
|
|
375
382
|
},
|
|
376
383
|
},
|
|
384
|
+
MuiChip: {
|
|
385
|
+
defaultProps: {
|
|
386
|
+
deleteIcon: <CloseCircleFilledIcon />,
|
|
387
|
+
},
|
|
388
|
+
styleOverrides: {
|
|
389
|
+
root: ({ theme, ownerState }) => ({
|
|
390
|
+
height: "auto",
|
|
391
|
+
paddingBlock: theme.spacing(2),
|
|
392
|
+
paddingInline: theme.spacing(3),
|
|
393
|
+
fontSize: theme.typography.body1.fontSize,
|
|
394
|
+
lineHeight: "1.14285714",
|
|
395
|
+
borderRadius: "1.5em",
|
|
396
|
+
backgroundColor: theme.palette.grey[100],
|
|
397
|
+
|
|
398
|
+
...(ownerState.onDelete && {
|
|
399
|
+
paddingInlineEnd: theme.spacing(2),
|
|
400
|
+
}),
|
|
401
|
+
|
|
402
|
+
[`& .${chipClasses.deleteIcon}`]: {
|
|
403
|
+
WebkitTapHighlightColor: "transparent",
|
|
404
|
+
color: theme.palette.text.secondary,
|
|
405
|
+
fontSize: "1em",
|
|
406
|
+
cursor: "pointer",
|
|
407
|
+
margin: "0",
|
|
408
|
+
marginInlineStart: theme.spacing(2),
|
|
409
|
+
|
|
410
|
+
"&:hover": {
|
|
411
|
+
color: theme.palette.text.primary,
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
[`&.${chipClasses.disabled}`]: {
|
|
416
|
+
opacity: 1,
|
|
417
|
+
pointerEvents: "none",
|
|
418
|
+
backgroundColor: theme.palette.grey[50],
|
|
419
|
+
color: theme.palette.text.secondary,
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
...(ownerState.clickable && {
|
|
423
|
+
"&:hover": {
|
|
424
|
+
backgroundColor: theme.palette.grey[200],
|
|
425
|
+
},
|
|
426
|
+
[`&.${chipClasses.focusVisible}`]: {
|
|
427
|
+
backgroundColor: theme.palette.grey[200],
|
|
428
|
+
outlineColor: theme.palette.primary.main,
|
|
429
|
+
outlineOffset: "2px",
|
|
430
|
+
outlineStyle: "solid",
|
|
431
|
+
outlineWidth: "2px",
|
|
432
|
+
},
|
|
433
|
+
"&:active": {
|
|
434
|
+
boxShadow: "none",
|
|
435
|
+
backgroundColor: theme.palette.grey[300],
|
|
436
|
+
},
|
|
437
|
+
}),
|
|
438
|
+
}),
|
|
439
|
+
label: {
|
|
440
|
+
padding: 0,
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
377
444
|
MuiCircularProgress: {
|
|
378
445
|
defaultProps: {
|
|
379
446
|
// TODO: defaultProps cannot take a theme object; needs workaround
|
|
@@ -542,6 +609,7 @@ export const components: ThemeOptions["components"] = {
|
|
|
542
609
|
},
|
|
543
610
|
styleOverrides: {
|
|
544
611
|
root: ({ theme }) => ({
|
|
612
|
+
fontSize: theme.typography.subtitle1.fontSize,
|
|
545
613
|
lineHeight: "1.33333333",
|
|
546
614
|
marginTop: theme.spacing(2),
|
|
547
615
|
".MuiFormLabel-root + &": {
|
|
@@ -598,35 +666,129 @@ export const components: ThemeOptions["components"] = {
|
|
|
598
666
|
}),
|
|
599
667
|
},
|
|
600
668
|
},
|
|
669
|
+
MuiInput: {
|
|
670
|
+
defaultProps: {
|
|
671
|
+
disableUnderline: true,
|
|
672
|
+
},
|
|
673
|
+
styleOverrides: {
|
|
674
|
+
root: {
|
|
675
|
+
"label + &": {
|
|
676
|
+
marginTop: 0,
|
|
677
|
+
},
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
},
|
|
601
681
|
MuiInputAdornment: {
|
|
602
682
|
defaultProps: {
|
|
603
683
|
variant: "outlined",
|
|
604
684
|
},
|
|
605
685
|
styleOverrides: {
|
|
606
|
-
root: ({ ownerState }) => ({
|
|
686
|
+
root: ({ theme, ownerState }) => ({
|
|
607
687
|
display: "flex",
|
|
688
|
+
minWidth: "1em",
|
|
689
|
+
maxHeight: "unset",
|
|
690
|
+
alignItems: "center",
|
|
691
|
+
whiteSpace: "nowrap",
|
|
692
|
+
color: theme.palette.action.active,
|
|
608
693
|
...(ownerState.position === "start" && {
|
|
609
|
-
|
|
694
|
+
marginInlineEnd: theme.spacing(2),
|
|
610
695
|
}),
|
|
611
696
|
...(ownerState.position === "end" && {
|
|
612
|
-
|
|
697
|
+
marginInlineStart: theme.spacing(2),
|
|
698
|
+
}),
|
|
699
|
+
...(ownerState.disablePointerEvents === true && {
|
|
700
|
+
pointerEvents: "none",
|
|
613
701
|
}),
|
|
614
702
|
}),
|
|
615
703
|
},
|
|
616
704
|
},
|
|
617
705
|
MuiInputBase: {
|
|
706
|
+
defaultProps: {
|
|
707
|
+
minRows: 3,
|
|
708
|
+
required: true,
|
|
709
|
+
},
|
|
618
710
|
styleOverrides: {
|
|
619
711
|
root: ({ ownerState, theme }) => ({
|
|
712
|
+
...theme.typography.body1,
|
|
713
|
+
flex: "1",
|
|
714
|
+
width: "auto",
|
|
715
|
+
color: theme.palette.text.primary,
|
|
620
716
|
lineHeight: "1.14285714",
|
|
717
|
+
borderWidth: theme.mixins.borderWidth,
|
|
718
|
+
borderStyle: theme.mixins.borderStyle,
|
|
719
|
+
borderRadius: theme.mixins.borderRadius,
|
|
720
|
+
borderColor: theme.palette.grey[500],
|
|
721
|
+
paddingBlock: `calc(${theme.spacing(3)} - ${theme.mixins.borderWidth})`,
|
|
722
|
+
paddingInline: theme.spacing(3),
|
|
723
|
+
|
|
724
|
+
...(ownerState.multiline && {
|
|
725
|
+
paddingBlock: theme.spacing(3),
|
|
726
|
+
paddingInline: theme.spacing(3),
|
|
727
|
+
...(ownerState.size === "small" && {
|
|
728
|
+
paddingBlock: theme.spacing(3),
|
|
729
|
+
paddingInline: theme.spacing(3),
|
|
730
|
+
}),
|
|
731
|
+
}),
|
|
732
|
+
|
|
733
|
+
...(ownerState.fullWidth && {
|
|
734
|
+
width: "100%",
|
|
735
|
+
}),
|
|
621
736
|
|
|
622
737
|
...(ownerState.readOnly === true && {
|
|
623
738
|
backgroundColor: theme.palette.grey[50],
|
|
624
739
|
}),
|
|
740
|
+
|
|
741
|
+
[`&:hover`]: {
|
|
742
|
+
borderColor: theme.palette.grey[900],
|
|
743
|
+
},
|
|
744
|
+
|
|
745
|
+
[`&.${inputBaseClasses.focused}`]: {
|
|
746
|
+
borderColor: theme.palette.primary.main,
|
|
747
|
+
outlineColor: theme.palette.primary.main,
|
|
748
|
+
outlineOffset: 0,
|
|
749
|
+
outlineStyle: "solid",
|
|
750
|
+
outlineWidth: "1px",
|
|
751
|
+
},
|
|
752
|
+
|
|
753
|
+
[`&.${inputBaseClasses.error}`]: {
|
|
754
|
+
borderColor: theme.palette.error.main,
|
|
755
|
+
},
|
|
756
|
+
|
|
757
|
+
[`&.${inputBaseClasses.error}:hover`]: {
|
|
758
|
+
borderColor: theme.palette.error.dark,
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
[`&.${inputBaseClasses.error}.${inputBaseClasses.focused}`]: {
|
|
762
|
+
borderColor: theme.palette.error.main,
|
|
763
|
+
outlineColor: theme.palette.error.main,
|
|
764
|
+
},
|
|
765
|
+
|
|
766
|
+
[`&.${inputBaseClasses.disabled}`]: {
|
|
767
|
+
color: theme.palette.text.disabled,
|
|
768
|
+
borderColor: theme.palette.action.disabled,
|
|
769
|
+
pointerEvents: "auto",
|
|
770
|
+
backgroundColor: theme.palette.grey[50],
|
|
771
|
+
cursor: "not-allowed",
|
|
772
|
+
},
|
|
625
773
|
}),
|
|
626
|
-
input: {
|
|
774
|
+
input: ({ theme }) => ({
|
|
627
775
|
boxSizing: "border-box",
|
|
628
776
|
height: "auto",
|
|
629
|
-
|
|
777
|
+
paddingBlock: 0,
|
|
778
|
+
paddingInline: 0,
|
|
779
|
+
|
|
780
|
+
[`.${inputBaseClasses.disabled} &`]: {
|
|
781
|
+
pointerEvents: "auto",
|
|
782
|
+
cursor: "not-allowed",
|
|
783
|
+
},
|
|
784
|
+
|
|
785
|
+
[`label[data-shrink=false] + .${inputBaseClasses.formControl} &`]: {
|
|
786
|
+
"&::placeholder": {
|
|
787
|
+
color: theme.palette.text.secondary,
|
|
788
|
+
opacity: "1 !important",
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
}),
|
|
630
792
|
},
|
|
631
793
|
},
|
|
632
794
|
MuiInputLabel: {
|
|
@@ -636,6 +798,8 @@ export const components: ThemeOptions["components"] = {
|
|
|
636
798
|
},
|
|
637
799
|
styleOverrides: {
|
|
638
800
|
root: ({ ownerState }) => ({
|
|
801
|
+
display: "flex",
|
|
802
|
+
justifyContent: "space-between",
|
|
639
803
|
// @ts-expect-error: Incorrect typing in MUI
|
|
640
804
|
...(ownerState.formControl && {
|
|
641
805
|
position: "initial",
|
|
@@ -724,7 +888,7 @@ export const components: ThemeOptions["components"] = {
|
|
|
724
888
|
},
|
|
725
889
|
MuiNativeSelect: {
|
|
726
890
|
defaultProps: {
|
|
727
|
-
variant: "
|
|
891
|
+
variant: "standard",
|
|
728
892
|
},
|
|
729
893
|
styleOverrides: {
|
|
730
894
|
icon: ({ theme }) => ({
|
|
@@ -732,66 +896,6 @@ export const components: ThemeOptions["components"] = {
|
|
|
732
896
|
}),
|
|
733
897
|
},
|
|
734
898
|
},
|
|
735
|
-
MuiOutlinedInput: {
|
|
736
|
-
defaultProps: {
|
|
737
|
-
notched: false,
|
|
738
|
-
minRows: 3,
|
|
739
|
-
},
|
|
740
|
-
styleOverrides: {
|
|
741
|
-
root: ({ ownerState, theme }) => ({
|
|
742
|
-
[`&:hover .${outlinedInputClasses.notchedOutline}`]: {
|
|
743
|
-
borderColor: theme.palette.text.primary,
|
|
744
|
-
},
|
|
745
|
-
[`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]:
|
|
746
|
-
{
|
|
747
|
-
borderColor: theme.palette.primary.main,
|
|
748
|
-
borderWidth: 2,
|
|
749
|
-
},
|
|
750
|
-
[`&.${outlinedInputClasses.error} .${outlinedInputClasses.notchedOutline}`]:
|
|
751
|
-
{
|
|
752
|
-
borderColor: theme.palette.error.main,
|
|
753
|
-
},
|
|
754
|
-
[`&.${outlinedInputClasses.error}:hover .${outlinedInputClasses.notchedOutline}`]:
|
|
755
|
-
{
|
|
756
|
-
borderColor: theme.palette.error.dark,
|
|
757
|
-
},
|
|
758
|
-
[`&.${outlinedInputClasses.error}.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]:
|
|
759
|
-
{
|
|
760
|
-
borderColor: theme.palette.error.main,
|
|
761
|
-
},
|
|
762
|
-
[`&.${outlinedInputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]:
|
|
763
|
-
{
|
|
764
|
-
borderColor: theme.palette.action.disabled,
|
|
765
|
-
pointerEvents: "auto",
|
|
766
|
-
},
|
|
767
|
-
[`&.${outlinedInputClasses.disabled}`]: {
|
|
768
|
-
backgroundColor: theme.palette.grey[50],
|
|
769
|
-
cursor: "not-allowed",
|
|
770
|
-
},
|
|
771
|
-
...(ownerState.startAdornment && {
|
|
772
|
-
paddingLeft: theme.spacing(3),
|
|
773
|
-
}),
|
|
774
|
-
...(ownerState.endAdornment && {
|
|
775
|
-
paddingRight: theme.spacing(3),
|
|
776
|
-
}),
|
|
777
|
-
...(ownerState.multiline && {
|
|
778
|
-
padding: "0",
|
|
779
|
-
...(ownerState.size === "small" && {
|
|
780
|
-
padding: "0",
|
|
781
|
-
}),
|
|
782
|
-
}),
|
|
783
|
-
}),
|
|
784
|
-
input: ({ theme }) => ({
|
|
785
|
-
padding: `calc(${theme.spacing(3)} - 1px) ${theme.spacing(3)}`,
|
|
786
|
-
borderWidth: theme.mixins.borderWidth,
|
|
787
|
-
borderStyle: theme.mixins.borderStyle,
|
|
788
|
-
borderColor: "transparent",
|
|
789
|
-
}),
|
|
790
|
-
notchedOutline: ({ theme }) => ({
|
|
791
|
-
borderColor: theme.palette.grey[500],
|
|
792
|
-
}),
|
|
793
|
-
},
|
|
794
|
-
},
|
|
795
899
|
MuiRadio: {
|
|
796
900
|
defaultProps: {
|
|
797
901
|
size: "small",
|
|
@@ -825,6 +929,16 @@ export const components: ThemeOptions["components"] = {
|
|
|
825
929
|
},
|
|
826
930
|
},
|
|
827
931
|
},
|
|
932
|
+
MuiSelect: {
|
|
933
|
+
defaultProps: {
|
|
934
|
+
variant: "standard",
|
|
935
|
+
},
|
|
936
|
+
styleOverrides: {
|
|
937
|
+
icon: ({ theme }) => ({
|
|
938
|
+
color: theme.palette.text.primary,
|
|
939
|
+
}),
|
|
940
|
+
},
|
|
941
|
+
},
|
|
828
942
|
MuiSvgIcon: {
|
|
829
943
|
defaultProps: {
|
|
830
944
|
fontSize: "inherit",
|
package/src/theme/typography.ts
CHANGED
|
@@ -64,6 +64,7 @@ export const typography: ThemeOptions["typography"] = {
|
|
|
64
64
|
marginBottom: Tokens.SpaceScale1,
|
|
65
65
|
},
|
|
66
66
|
subtitle1: {
|
|
67
|
+
color: Tokens.ColorPaletteNeutral600,
|
|
67
68
|
fontWeight: Tokens.FontWeightNormal,
|
|
68
69
|
fontSize: Tokens.FontScale0,
|
|
69
70
|
lineHeight: Tokens.FontLineHeightBody,
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { useMemo } from "react";
|
|
14
|
+
|
|
15
|
+
import { createUniqueAlphabeticalId } from "./createUniqueAlphabeticalId";
|
|
16
|
+
|
|
17
|
+
export const useUniqueAlphabeticalId = (id?: string) => {
|
|
18
|
+
const uniqueAlphabeticalId = useMemo(() => createUniqueAlphabeticalId(), []);
|
|
19
|
+
|
|
20
|
+
return id ?? uniqueAlphabeticalId;
|
|
21
|
+
};
|
package/src/useUniqueId.ts
CHANGED
|
@@ -14,8 +14,8 @@ import { useMemo } from "react";
|
|
|
14
14
|
|
|
15
15
|
import { createUniqueId } from "./createUniqueId";
|
|
16
16
|
|
|
17
|
-
export const useUniqueId = (id?: string)
|
|
17
|
+
export const useUniqueId = (id?: string) => {
|
|
18
18
|
const uniqueId = useMemo(() => createUniqueId(), []);
|
|
19
19
|
|
|
20
|
-
return id
|
|
20
|
+
return id ?? uniqueId;
|
|
21
21
|
};
|