@okta/odyssey-react-mui 0.16.1 → 0.18.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 +121 -0
- package/README.md +7 -19
- package/dist/Banner.d.ts +47 -0
- package/dist/Banner.d.ts.map +1 -0
- package/dist/Banner.js +41 -0
- package/dist/Banner.js.map +1 -0
- package/dist/Link.d.ts +1 -1
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +2 -1
- 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 +19 -0
- package/dist/OdysseyThemeProvider.d.ts.map +1 -0
- package/dist/OdysseyThemeProvider.js +32 -0
- package/dist/OdysseyThemeProvider.js.map +1 -0
- package/dist/PasswordInput.d.ts +1 -1
- package/dist/PasswordInput.d.ts.map +1 -1
- package/dist/Radio.d.ts +19 -0
- package/dist/Radio.d.ts.map +1 -0
- package/dist/Radio.js +32 -0
- package/dist/Radio.js.map +1 -0
- package/dist/RadioGroup.d.ts +47 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +59 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/Status.d.ts +23 -0
- package/dist/Status.d.ts.map +1 -0
- package/dist/Status.js +25 -0
- package/dist/Status.js.map +1 -0
- package/dist/TextField.d.ts +87 -0
- package/dist/TextField.d.ts.map +1 -0
- package/dist/TextField.js +100 -0
- package/dist/TextField.js.map +1 -0
- 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/iconDictionary/Add.d.ts +1 -1
- package/dist/iconDictionary/Add.d.ts.map +1 -1
- package/dist/iconDictionary/AddCircle.d.ts +1 -1
- package/dist/iconDictionary/AddCircle.d.ts.map +1 -1
- package/dist/iconDictionary/AlertCircle.d.ts +1 -1
- package/dist/iconDictionary/AlertCircle.d.ts.map +1 -1
- package/dist/iconDictionary/AlertCircleFilled.d.ts +1 -1
- package/dist/iconDictionary/AlertCircleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/AlertTriangleFilled.d.ts +1 -1
- package/dist/iconDictionary/AlertTriangleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/Anchor.d.ts +1 -1
- package/dist/iconDictionary/Anchor.d.ts.map +1 -1
- package/dist/iconDictionary/ArrowDown.d.ts +1 -1
- package/dist/iconDictionary/ArrowDown.d.ts.map +1 -1
- package/dist/iconDictionary/ArrowLeft.d.ts +1 -1
- package/dist/iconDictionary/ArrowLeft.d.ts.map +1 -1
- package/dist/iconDictionary/ArrowRight.d.ts +1 -1
- package/dist/iconDictionary/ArrowRight.d.ts.map +1 -1
- package/dist/iconDictionary/ArrowUp.d.ts +1 -1
- package/dist/iconDictionary/ArrowUp.d.ts.map +1 -1
- package/dist/iconDictionary/ArrowUpDown.d.ts +1 -1
- package/dist/iconDictionary/ArrowUpDown.d.ts.map +1 -1
- package/dist/iconDictionary/Calendar.d.ts +1 -1
- package/dist/iconDictionary/Calendar.d.ts.map +1 -1
- package/dist/iconDictionary/Check.d.ts +1 -1
- package/dist/iconDictionary/Check.d.ts.map +1 -1
- package/dist/iconDictionary/CheckCircleFilled.d.ts +1 -1
- package/dist/iconDictionary/CheckCircleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/ChevronDown.d.ts +1 -1
- package/dist/iconDictionary/ChevronDown.d.ts.map +1 -1
- package/dist/iconDictionary/ChevronUp.d.ts +1 -1
- package/dist/iconDictionary/ChevronUp.d.ts.map +1 -1
- package/dist/iconDictionary/Close.d.ts +1 -1
- package/dist/iconDictionary/Close.d.ts.map +1 -1
- package/dist/iconDictionary/CloseCircleFilled.d.ts +1 -1
- package/dist/iconDictionary/CloseCircleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/Copy.d.ts +1 -1
- package/dist/iconDictionary/Copy.d.ts.map +1 -1
- package/dist/iconDictionary/Delete.d.ts +1 -1
- package/dist/iconDictionary/Delete.d.ts.map +1 -1
- package/dist/iconDictionary/Download.d.ts +1 -1
- package/dist/iconDictionary/Download.d.ts.map +1 -1
- package/dist/iconDictionary/DragHandle.d.ts +1 -1
- package/dist/iconDictionary/DragHandle.d.ts.map +1 -1
- package/dist/iconDictionary/Edit.d.ts +1 -1
- package/dist/iconDictionary/Edit.d.ts.map +1 -1
- package/dist/iconDictionary/ExternalLink.d.ts +1 -1
- package/dist/iconDictionary/ExternalLink.d.ts.map +1 -1
- package/dist/iconDictionary/Eye.d.ts +1 -1
- package/dist/iconDictionary/Eye.d.ts.map +1 -1
- package/dist/iconDictionary/EyeOff.d.ts +1 -1
- package/dist/iconDictionary/EyeOff.d.ts.map +1 -1
- package/dist/iconDictionary/Filter.d.ts +1 -1
- package/dist/iconDictionary/Filter.d.ts.map +1 -1
- package/dist/iconDictionary/Globe.d.ts +1 -1
- package/dist/iconDictionary/Globe.d.ts.map +1 -1
- package/dist/iconDictionary/Home.d.ts +1 -1
- package/dist/iconDictionary/Home.d.ts.map +1 -1
- package/dist/iconDictionary/InformationCircle.d.ts +1 -1
- package/dist/iconDictionary/InformationCircle.d.ts.map +1 -1
- package/dist/iconDictionary/InformationCircleFilled.d.ts +1 -1
- package/dist/iconDictionary/InformationCircleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/Notification.d.ts +1 -1
- package/dist/iconDictionary/Notification.d.ts.map +1 -1
- package/dist/iconDictionary/OverflowVertical.d.ts +1 -1
- package/dist/iconDictionary/OverflowVertical.d.ts.map +1 -1
- package/dist/iconDictionary/QuestionCircle.d.ts +1 -1
- package/dist/iconDictionary/QuestionCircle.d.ts.map +1 -1
- package/dist/iconDictionary/QuestionCircleFilled.d.ts +1 -1
- package/dist/iconDictionary/QuestionCircleFilled.d.ts.map +1 -1
- package/dist/iconDictionary/Search.d.ts +1 -1
- package/dist/iconDictionary/Search.d.ts.map +1 -1
- package/dist/iconDictionary/Settings.d.ts +1 -1
- package/dist/iconDictionary/Settings.d.ts.map +1 -1
- package/dist/iconDictionary/Subtract.d.ts +1 -1
- package/dist/iconDictionary/Subtract.d.ts.map +1 -1
- package/dist/iconDictionary/User.d.ts +1 -1
- package/dist/iconDictionary/User.d.ts.map +1 -1
- package/dist/iconDictionary/UserGroup.d.ts +1 -1
- package/dist/iconDictionary/UserGroup.d.ts.map +1 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +645 -174
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/components.types.d.ts +5 -0
- package/dist/theme/components.types.d.ts.map +1 -1
- package/dist/theme/components.types.js.map +1 -1
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +6 -0
- package/dist/theme/typography.js.map +1 -1
- package/dist/theme/typography.types.d.ts +3 -3
- package/dist/theme/typography.types.d.ts.map +1 -1
- package/dist/theme/typography.types.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 +8 -7
- package/src/Banner.tsx +69 -0
- package/src/Link.tsx +21 -23
- package/src/OdysseyCacheProvider.test.tsx +38 -0
- package/src/OdysseyCacheProvider.tsx +48 -0
- package/src/OdysseyThemeProvider.tsx +44 -0
- package/src/Radio.tsx +28 -0
- package/src/RadioGroup.tsx +105 -0
- package/src/Status.tsx +29 -0
- package/src/TextField.tsx +220 -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 +35 -14
- package/src/theme/components.tsx +585 -85
- package/src/theme/components.types.ts +7 -0
- package/src/theme/typography.ts +6 -0
- package/src/theme/typography.types.ts +3 -3
- package/src/useUniqueAlphabeticalId.ts +21 -0
- package/src/useUniqueId.ts +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
export declare const useUniqueAlphabeticalId: (id?: string) => string;
|
|
13
|
+
//# sourceMappingURL=useUniqueAlphabeticalId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUniqueAlphabeticalId.d.ts","sourceRoot":"","sources":["../src/useUniqueAlphabeticalId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,eAAO,MAAM,uBAAuB,QAAS,MAAM,WAIlD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { useMemo } from "react";
|
|
13
|
+
import { createUniqueAlphabeticalId } from "./createUniqueAlphabeticalId.js";
|
|
14
|
+
export const useUniqueAlphabeticalId = id => {
|
|
15
|
+
const uniqueAlphabeticalId = useMemo(() => createUniqueAlphabeticalId(), []);
|
|
16
|
+
return id ?? uniqueAlphabeticalId;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useUniqueAlphabeticalId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUniqueAlphabeticalId.js","names":["useMemo","createUniqueAlphabeticalId","useUniqueAlphabeticalId","id","uniqueAlphabeticalId"],"sources":["../src/useUniqueAlphabeticalId.ts"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useMemo } from \"react\";\n\nimport { createUniqueAlphabeticalId } from \"./createUniqueAlphabeticalId\";\n\nexport const useUniqueAlphabeticalId = (id?: string) => {\n const uniqueAlphabeticalId = useMemo(() => createUniqueAlphabeticalId(), []);\n\n return id ?? uniqueAlphabeticalId;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAT,QAAwB,OAAxB;SAESC,0B;AAET,OAAO,MAAMC,uBAAuB,GAAIC,EAAD,IAAiB;EACtD,MAAMC,oBAAoB,GAAGJ,OAAO,CAAC,MAAMC,0BAA0B,EAAjC,EAAqC,EAArC,CAApC;EAEA,OAAOE,EAAE,IAAIC,oBAAb;AACD,CAJM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniqueId.d.ts","sourceRoot":"","sources":["../src/useUniqueId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,eAAO,MAAM,WAAW,QAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"useUniqueId.d.ts","sourceRoot":"","sources":["../src/useUniqueId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,eAAO,MAAM,WAAW,QAAS,MAAM,WAItC,CAAC"}
|
package/dist/useUniqueId.js
CHANGED
|
@@ -13,6 +13,6 @@ import { useMemo } from "react";
|
|
|
13
13
|
import { createUniqueId } from "./createUniqueId.js";
|
|
14
14
|
export const useUniqueId = id => {
|
|
15
15
|
const uniqueId = useMemo(() => createUniqueId(), []);
|
|
16
|
-
return id
|
|
16
|
+
return id ?? uniqueId;
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=useUniqueId.js.map
|
package/dist/useUniqueId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniqueId.js","names":["useMemo","createUniqueId","useUniqueId","id","uniqueId"],"sources":["../src/useUniqueId.ts"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useMemo } from \"react\";\n\nimport { createUniqueId } from \"./createUniqueId\";\n\nexport const useUniqueId = (id?: string)
|
|
1
|
+
{"version":3,"file":"useUniqueId.js","names":["useMemo","createUniqueId","useUniqueId","id","uniqueId"],"sources":["../src/useUniqueId.ts"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useMemo } from \"react\";\n\nimport { createUniqueId } from \"./createUniqueId\";\n\nexport const useUniqueId = (id?: string) => {\n const uniqueId = useMemo(() => createUniqueId(), []);\n\n return id ?? uniqueId;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAT,QAAwB,OAAxB;SAESC,c;AAET,OAAO,MAAMC,WAAW,GAAIC,EAAD,IAAiB;EAC1C,MAAMC,QAAQ,GAAGJ,OAAO,CAAC,MAAMC,cAAc,EAArB,EAAyB,EAAzB,CAAxB;EAEA,OAAOE,EAAE,IAAIC,QAAb;AACD,CAJM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okta/odyssey-react-mui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "React MUI components for Odyssey, Okta's design system",
|
|
5
5
|
"author": "Okta, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,11 +19,12 @@
|
|
|
19
19
|
"directory": "packages/odyssey-react-mui"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@mui/
|
|
24
|
-
"@mui/
|
|
25
|
-
"@mui/
|
|
26
|
-
"@
|
|
22
|
+
"@emotion/cache": "^11.10.5",
|
|
23
|
+
"@mui/icons-material": "^5.11.0",
|
|
24
|
+
"@mui/lab": "^5.0.0-alpha.117",
|
|
25
|
+
"@mui/material": "^5.11.6",
|
|
26
|
+
"@mui/utils": "^5.11.2",
|
|
27
|
+
"@okta/odyssey-design-tokens": "0.18.0"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@emotion/react": "^11",
|
|
@@ -31,5 +32,5 @@
|
|
|
31
32
|
"react": ">=17 <19",
|
|
32
33
|
"react-dom": ">=17 <19"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "83ced7625d94ed499ed408a382d151f96ecac238"
|
|
35
36
|
}
|
package/src/Banner.tsx
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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 { AlertColor, AlertProps } from "@mui/material";
|
|
14
|
+
import { memo } from "react";
|
|
15
|
+
import { Alert, Link } from "./";
|
|
16
|
+
|
|
17
|
+
export interface BannerProps {
|
|
18
|
+
/**
|
|
19
|
+
* Determine the color and icon of the alert
|
|
20
|
+
*/
|
|
21
|
+
severity?: AlertColor;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the ARIA role of the alert
|
|
24
|
+
* ("status" for something that dynamically updates, null for something
|
|
25
|
+
* unchanging)
|
|
26
|
+
*/
|
|
27
|
+
role?: "status";
|
|
28
|
+
/**
|
|
29
|
+
* The text content of the alert
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* The function that's fired when the user clicks the close button. If undefined,
|
|
34
|
+
* the close button will not be shown.
|
|
35
|
+
*/
|
|
36
|
+
onClose?: AlertProps["onClose"];
|
|
37
|
+
/**
|
|
38
|
+
* If defined, the alert will include a link to the URL
|
|
39
|
+
*/
|
|
40
|
+
linkUrl?: string;
|
|
41
|
+
/**
|
|
42
|
+
* If linkUrl is not undefined, this is the text of the link.
|
|
43
|
+
* If left blank, it defaults to "Learn more".
|
|
44
|
+
* Note that linkText does nothing if linkUrl is not defined
|
|
45
|
+
*/
|
|
46
|
+
linkText?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const Banner = ({
|
|
50
|
+
onClose,
|
|
51
|
+
severity = "info",
|
|
52
|
+
role,
|
|
53
|
+
linkUrl,
|
|
54
|
+
linkText = "Learn more",
|
|
55
|
+
text,
|
|
56
|
+
}: BannerProps) => (
|
|
57
|
+
<Alert onClose={onClose} role={role} severity={severity} variant="banner">
|
|
58
|
+
{text}
|
|
59
|
+
{linkUrl && (
|
|
60
|
+
<Link href={linkUrl} variant="monochrome">
|
|
61
|
+
{linkText}
|
|
62
|
+
</Link>
|
|
63
|
+
)}
|
|
64
|
+
</Alert>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const MemoizedBanner = memo(Banner);
|
|
68
|
+
|
|
69
|
+
export { MemoizedBanner as Banner };
|
package/src/Link.tsx
CHANGED
|
@@ -19,26 +19,24 @@ export interface LinkProps extends MuiLinkProps {
|
|
|
19
19
|
icon?: ReactElement;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const Link = forwardRef<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
);
|
|
22
|
+
export const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
|
|
23
|
+
const { icon, children, target } = props;
|
|
24
|
+
return (
|
|
25
|
+
<MuiLink {...props} ref={ref}>
|
|
26
|
+
{icon && <span className="Link-icon">{icon}</span>}
|
|
27
|
+
{children}
|
|
28
|
+
{target === "_blank" && (
|
|
29
|
+
<span className="Link-indicator" role="presentation">
|
|
30
|
+
<SvgIcon viewBox="0 0 16 16">
|
|
31
|
+
<path
|
|
32
|
+
fillRule="evenodd"
|
|
33
|
+
clipRule="evenodd"
|
|
34
|
+
d="M13.2929 2H7.99998V1H14.5C14.7761 1 15 1.22386 15 1.5V8H14V2.70711L6.35353 10.3536L5.64642 9.64645L13.2929 2ZM1.5 4H1V4.5V14.5V15H1.5H11.5H12V14.5V8H11V14H2V5H8V4H1.5Z"
|
|
35
|
+
fill="currentColor"
|
|
36
|
+
/>
|
|
37
|
+
</SvgIcon>
|
|
38
|
+
</span>
|
|
39
|
+
)}
|
|
40
|
+
</MuiLink>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
@@ -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,44 @@
|
|
|
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 {
|
|
14
|
+
createTheme,
|
|
15
|
+
ThemeOptions,
|
|
16
|
+
ThemeProvider as MuiThemeProvider,
|
|
17
|
+
} from "@mui/material/styles";
|
|
18
|
+
import { deepmerge } from "@mui/utils";
|
|
19
|
+
import { memo, ReactElement, useMemo } from "react";
|
|
20
|
+
|
|
21
|
+
import { odysseyTheme } from "./theme";
|
|
22
|
+
|
|
23
|
+
const OdysseyThemeProvider = ({
|
|
24
|
+
children,
|
|
25
|
+
customTheme,
|
|
26
|
+
}: {
|
|
27
|
+
children: ReactElement;
|
|
28
|
+
customTheme?: ThemeOptions;
|
|
29
|
+
}) => {
|
|
30
|
+
const customOdysseyTheme = useMemo(
|
|
31
|
+
() => customTheme && createTheme(deepmerge(odysseyTheme, customTheme)),
|
|
32
|
+
[customTheme]
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<MuiThemeProvider theme={customOdysseyTheme ?? odysseyTheme}>
|
|
37
|
+
{children}
|
|
38
|
+
</MuiThemeProvider>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const MemoizedOdysseyThemeProvider = memo(OdysseyThemeProvider);
|
|
43
|
+
|
|
44
|
+
export { MemoizedOdysseyThemeProvider as OdysseyThemeProvider };
|
package/src/Radio.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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 { FormControlLabel } from "./";
|
|
14
|
+
import { Radio as MuiRadio } from "@mui/material";
|
|
15
|
+
import { memo } from "react";
|
|
16
|
+
|
|
17
|
+
export type RadioProps = {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Radio = ({ label, value }: RadioProps) => (
|
|
23
|
+
<FormControlLabel control={<MuiRadio />} label={label} value={value} />
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const MemoizedRadio = memo(Radio);
|
|
27
|
+
|
|
28
|
+
export { MemoizedRadio as Radio };
|
|
@@ -0,0 +1,105 @@
|
|
|
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 {
|
|
14
|
+
FormControl,
|
|
15
|
+
FormLabel,
|
|
16
|
+
FormHelperText,
|
|
17
|
+
visuallyHidden,
|
|
18
|
+
Radio,
|
|
19
|
+
useUniqueId,
|
|
20
|
+
} from "./";
|
|
21
|
+
import { RadioGroup as MuiRadioGroup } from "@mui/material";
|
|
22
|
+
import { memo, ReactElement, useMemo } from "react";
|
|
23
|
+
|
|
24
|
+
export interface RadioGroupProps {
|
|
25
|
+
/**
|
|
26
|
+
* The <Radio> components within the group. Must include two or more.
|
|
27
|
+
*/
|
|
28
|
+
children: Array<ReactElement<typeof Radio>>;
|
|
29
|
+
/**
|
|
30
|
+
* The text value of the radio that should be selected by default
|
|
31
|
+
*/
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The error text for an invalid group
|
|
35
|
+
*/
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional hint text
|
|
39
|
+
*/
|
|
40
|
+
hint?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Disables the whole radio group
|
|
43
|
+
*/
|
|
44
|
+
isDisabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The text label for the radio group
|
|
47
|
+
*/
|
|
48
|
+
label: string;
|
|
49
|
+
/**
|
|
50
|
+
* The name of the radio group, which only needs to be changed
|
|
51
|
+
* if there are multiple radio groups on the same screen
|
|
52
|
+
*/
|
|
53
|
+
name?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const RadioGroup = ({
|
|
57
|
+
children,
|
|
58
|
+
defaultValue,
|
|
59
|
+
errorMessage,
|
|
60
|
+
hint,
|
|
61
|
+
isDisabled,
|
|
62
|
+
label,
|
|
63
|
+
name,
|
|
64
|
+
}: RadioGroupProps) => {
|
|
65
|
+
const ariaDescribedBy = useMemo(
|
|
66
|
+
() =>
|
|
67
|
+
errorMessage || hint
|
|
68
|
+
? [hint && `${name}-hint`, errorMessage && `${name}-error`]
|
|
69
|
+
.filter(Boolean)
|
|
70
|
+
.join(" ")
|
|
71
|
+
: undefined,
|
|
72
|
+
[errorMessage, hint, name]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const uniqueName = useUniqueId(name);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<FormControl
|
|
79
|
+
component="fieldset"
|
|
80
|
+
disabled={isDisabled}
|
|
81
|
+
error={Boolean(errorMessage)}
|
|
82
|
+
>
|
|
83
|
+
<FormLabel component="legend">{label}</FormLabel>
|
|
84
|
+
{hint && (
|
|
85
|
+
<FormHelperText id={`${uniqueName}-hint`}>{hint}</FormHelperText>
|
|
86
|
+
)}
|
|
87
|
+
<MuiRadioGroup
|
|
88
|
+
aria-describedby={ariaDescribedBy}
|
|
89
|
+
defaultValue={defaultValue}
|
|
90
|
+
name={uniqueName}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</MuiRadioGroup>
|
|
94
|
+
{errorMessage && (
|
|
95
|
+
<FormHelperText id={`${uniqueName}-error`} error>
|
|
96
|
+
<span style={visuallyHidden}>Error:</span> {errorMessage}
|
|
97
|
+
</FormHelperText>
|
|
98
|
+
)}
|
|
99
|
+
</FormControl>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const MemoizedRadioGroup = memo(RadioGroup);
|
|
104
|
+
|
|
105
|
+
export { MemoizedRadioGroup as RadioGroup };
|
package/src/Status.tsx
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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 { Chip } from "./";
|
|
14
|
+
|
|
15
|
+
export interface StatusProps {
|
|
16
|
+
/**
|
|
17
|
+
* Determine the color and icon of the alert
|
|
18
|
+
*/
|
|
19
|
+
severity: "default" | "error" | "info" | "success" | "warning";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The text content of the status
|
|
23
|
+
*/
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Status = ({ severity, label }: StatusProps) => (
|
|
28
|
+
<Chip label={label} color={severity} variant="status" />
|
|
29
|
+
);
|