@okta/odyssey-react-mui 1.27.0 → 1.28.1
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 +23 -0
- package/dist/{Button.js → Buttons/BaseButton.js} +11 -10
- package/dist/Buttons/BaseButton.js.map +1 -0
- package/dist/{MenuButton.js → Buttons/BaseMenuButton.js} +30 -10
- package/dist/Buttons/BaseMenuButton.js.map +1 -0
- package/dist/Buttons/Button.js +24 -0
- package/dist/Buttons/Button.js.map +1 -0
- package/dist/Buttons/ButtonContext.js.map +1 -0
- package/dist/Buttons/MenuButton.js +25 -0
- package/dist/Buttons/MenuButton.js.map +1 -0
- package/dist/Buttons/MenuContext.js.map +1 -0
- package/dist/Buttons/MenuItem.js.map +1 -0
- package/dist/Buttons/index.js +18 -0
- package/dist/Buttons/index.js.map +1 -0
- package/dist/Card.js +1 -2
- package/dist/Card.js.map +1 -1
- package/dist/DataTable/DataTable.js +1 -2
- package/dist/DataTable/DataTable.js.map +1 -1
- package/dist/DataTable/DataTableRowActions.js +1 -2
- package/dist/DataTable/DataTableRowActions.js.map +1 -1
- package/dist/DataTable/DataTableSettings.js +1 -2
- package/dist/DataTable/DataTableSettings.js.map +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Dialog.js.map +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drawer.js.map +1 -1
- package/dist/FileUploader/FileUploader.js +1 -1
- package/dist/FileUploader/FileUploader.js.map +1 -1
- package/dist/Form.js.map +1 -1
- package/dist/Pagination/Pagination.js +1 -1
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Toast.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/index.scss +1 -1
- package/dist/labs/AppSwitcher/AppSwitcher.js +76 -0
- package/dist/labs/AppSwitcher/AppSwitcher.js.map +1 -0
- package/dist/labs/AppSwitcher/AppSwitcherApp.js +112 -0
- package/dist/labs/AppSwitcher/AppSwitcherApp.js.map +1 -0
- package/dist/labs/{SideNav → AppSwitcher}/OktaAura.js +16 -3
- package/dist/labs/AppSwitcher/OktaAura.js.map +1 -0
- package/dist/labs/AppSwitcher/index.js +13 -0
- package/dist/labs/AppSwitcher/index.js.map +1 -0
- package/dist/labs/AppTile.js +102 -65
- package/dist/labs/AppTile.js.map +1 -1
- package/dist/labs/DataFilters.js +1 -1
- package/dist/labs/DataFilters.js.map +1 -1
- package/dist/labs/DataTable.js.map +1 -1
- package/dist/labs/DataTablePagination.js +1 -1
- package/dist/labs/DataTablePagination.js.map +1 -1
- package/dist/labs/DataView/BulkActionsMenu.js +1 -2
- package/dist/labs/DataView/BulkActionsMenu.js.map +1 -1
- package/dist/labs/DataView/DataCard.js +53 -42
- package/dist/labs/DataView/DataCard.js.map +1 -1
- package/dist/labs/DataView/DataView.js +1 -1
- package/dist/labs/DataView/DataView.js.map +1 -1
- package/dist/labs/DataView/LayoutSwitcher.js +1 -2
- package/dist/labs/DataView/LayoutSwitcher.js.map +1 -1
- package/dist/labs/DataView/RowActions.js +1 -1
- package/dist/labs/DataView/RowActions.js.map +1 -1
- package/dist/labs/DataView/TableLayoutContent.js +1 -2
- package/dist/labs/DataView/TableLayoutContent.js.map +1 -1
- package/dist/labs/DataView/TableSettings.js +1 -2
- package/dist/labs/DataView/TableSettings.js.map +1 -1
- package/dist/labs/DatePicker.js +1 -1
- package/dist/labs/DatePicker.js.map +1 -1
- package/dist/labs/SideNav/SideNav.js +5 -4
- package/dist/labs/SideNav/SideNav.js.map +1 -1
- package/dist/labs/TopNav/UserProfile.js +16 -3
- package/dist/labs/TopNav/UserProfile.js.map +1 -1
- package/dist/labs/TopNav/UserProfileMenuButton.js +41 -0
- package/dist/labs/TopNav/UserProfileMenuButton.js.map +1 -0
- package/dist/labs/TopNav/index.js +1 -0
- package/dist/labs/TopNav/index.js.map +1 -1
- package/dist/labs/UiShell/UiShell.js +6 -5
- package/dist/labs/UiShell/UiShell.js.map +1 -1
- package/dist/labs/UiShell/UiShellContent.js +53 -13
- package/dist/labs/UiShell/UiShellContent.js.map +1 -1
- package/dist/labs/UiShell/renderUiShell.js +4 -0
- package/dist/labs/UiShell/renderUiShell.js.map +1 -1
- package/dist/labs/index.js +1 -0
- package/dist/labs/index.js.map +1 -1
- package/dist/src/{Button.d.ts → Buttons/BaseButton.d.ts} +12 -34
- package/dist/src/Buttons/BaseButton.d.ts.map +1 -0
- package/dist/src/{MenuButton.d.ts → Buttons/BaseMenuButton.d.ts} +37 -14
- package/dist/src/Buttons/BaseMenuButton.d.ts.map +1 -0
- package/dist/src/Buttons/Button.d.ts +16 -0
- package/dist/src/Buttons/Button.d.ts.map +1 -0
- package/dist/src/Buttons/ButtonContext.d.ts.map +1 -0
- package/dist/src/Buttons/MenuButton.d.ts +17 -0
- package/dist/src/Buttons/MenuButton.d.ts.map +1 -0
- package/dist/src/Buttons/MenuContext.d.ts.map +1 -0
- package/dist/src/{MenuItem.d.ts → Buttons/MenuItem.d.ts} +1 -1
- package/dist/src/Buttons/MenuItem.d.ts.map +1 -0
- package/dist/src/Buttons/index.d.ts +18 -0
- package/dist/src/Buttons/index.d.ts.map +1 -0
- package/dist/src/Card.d.ts +1 -2
- package/dist/src/Card.d.ts.map +1 -1
- package/dist/src/DataTable/DataTable.d.ts +1 -1
- package/dist/src/DataTable/DataTable.d.ts.map +1 -1
- package/dist/src/DataTable/DataTableRowActions.d.ts +1 -2
- package/dist/src/DataTable/DataTableRowActions.d.ts.map +1 -1
- package/dist/src/DataTable/DataTableSettings.d.ts.map +1 -1
- package/dist/src/Dialog.d.ts +1 -1
- package/dist/src/Dialog.d.ts.map +1 -1
- package/dist/src/Drawer.d.ts +1 -1
- package/dist/src/Drawer.d.ts.map +1 -1
- package/dist/src/Form.d.ts +1 -1
- package/dist/src/Form.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/labs/AppSwitcher/AppSwitcher.d.ts +20 -0
- package/dist/src/labs/AppSwitcher/AppSwitcher.d.ts.map +1 -0
- package/dist/src/labs/AppSwitcher/AppSwitcherApp.d.ts +24 -0
- package/dist/src/labs/AppSwitcher/AppSwitcherApp.d.ts.map +1 -0
- package/dist/src/labs/AppSwitcher/OktaAura.d.ts.map +1 -0
- package/dist/src/labs/AppSwitcher/index.d.ts +13 -0
- package/dist/src/labs/AppSwitcher/index.d.ts.map +1 -0
- package/dist/src/labs/AppTile.d.ts +6 -4
- package/dist/src/labs/AppTile.d.ts.map +1 -1
- package/dist/src/labs/DataTable.d.ts +1 -1
- package/dist/src/labs/DataTable.d.ts.map +1 -1
- package/dist/src/labs/DataView/BulkActionsMenu.d.ts.map +1 -1
- package/dist/src/labs/DataView/DataCard.d.ts +1 -2
- package/dist/src/labs/DataView/DataCard.d.ts.map +1 -1
- package/dist/src/labs/DataView/LayoutSwitcher.d.ts.map +1 -1
- package/dist/src/labs/DataView/RowActions.d.ts +1 -2
- package/dist/src/labs/DataView/RowActions.d.ts.map +1 -1
- package/dist/src/labs/DataView/TableLayoutContent.d.ts.map +1 -1
- package/dist/src/labs/DataView/TableSettings.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -1
- package/dist/src/labs/TopNav/UserProfile.d.ts +5 -1
- package/dist/src/labs/TopNav/UserProfile.d.ts.map +1 -1
- package/dist/src/labs/TopNav/UserProfileMenuButton.d.ts +17 -0
- package/dist/src/labs/TopNav/UserProfileMenuButton.d.ts.map +1 -0
- package/dist/src/labs/TopNav/index.d.ts +1 -0
- package/dist/src/labs/TopNav/index.d.ts.map +1 -1
- package/dist/src/labs/UiShell/UiShell.d.ts +2 -2
- package/dist/src/labs/UiShell/UiShell.d.ts.map +1 -1
- package/dist/src/labs/UiShell/UiShellContent.d.ts +19 -2
- package/dist/src/labs/UiShell/UiShellContent.d.ts.map +1 -1
- package/dist/src/labs/UiShell/renderUiShell.d.ts +2 -2
- package/dist/src/labs/UiShell/renderUiShell.d.ts.map +1 -1
- package/dist/src/labs/index.d.ts +1 -0
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/web-component/renderReactInWebComponent.d.ts +2 -2
- package/dist/src/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/dist/theme/components.js +25 -27
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/web-component/renderReactInWebComponent.js +6 -7
- package/dist/web-component/renderReactInWebComponent.js.map +1 -1
- package/package.json +3 -3
- package/src/{Button.tsx → Buttons/BaseButton.tsx} +48 -68
- package/src/{MenuButton.tsx → Buttons/BaseMenuButton.tsx} +94 -32
- package/src/Buttons/Button.tsx +30 -0
- package/src/Buttons/MenuButton.tsx +35 -0
- package/src/{MenuItem.tsx → Buttons/MenuItem.tsx} +1 -1
- package/src/Buttons/index.ts +22 -0
- package/src/Card.tsx +1 -3
- package/src/DataTable/DataTable.tsx +1 -2
- package/src/DataTable/DataTableRowActions.tsx +1 -3
- package/src/DataTable/DataTableSettings.tsx +1 -2
- package/src/Dialog.tsx +1 -1
- package/src/Drawer.tsx +1 -1
- package/src/FileUploader/FileUploader.tsx +1 -1
- package/src/Form.tsx +1 -1
- package/src/Pagination/Pagination.test.tsx +58 -36
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/Toast.tsx +1 -1
- package/src/index.ts +1 -3
- package/src/labs/AppSwitcher/AppSwitcher.tsx +94 -0
- package/src/labs/AppSwitcher/AppSwitcherApp.tsx +146 -0
- package/src/labs/{SideNav → AppSwitcher}/OktaAura.tsx +19 -4
- package/src/labs/AppSwitcher/index.ts +13 -0
- package/src/labs/AppTile.tsx +171 -85
- package/src/labs/DataFilters.tsx +1 -1
- package/src/labs/DataTable.tsx +1 -1
- package/src/labs/DataTablePagination.tsx +1 -1
- package/src/labs/DataView/BulkActionsMenu.tsx +1 -2
- package/src/labs/DataView/DataCard.tsx +56 -31
- package/src/labs/DataView/DataView.tsx +1 -1
- package/src/labs/DataView/LayoutSwitcher.tsx +1 -2
- package/src/labs/DataView/RowActions.tsx +1 -3
- package/src/labs/DataView/TableLayoutContent.tsx +1 -2
- package/src/labs/DataView/TableSettings.tsx +1 -2
- package/src/labs/DatePicker.tsx +1 -1
- package/src/labs/SideNav/SideNav.tsx +10 -4
- package/src/labs/TopNav/UserProfile.tsx +26 -2
- package/src/labs/TopNav/UserProfileMenuButton.tsx +57 -0
- package/src/labs/TopNav/index.ts +1 -0
- package/src/labs/UiShell/UiShell.test.tsx +23 -38
- package/src/labs/UiShell/UiShell.tsx +14 -6
- package/src/labs/UiShell/UiShellContent.tsx +85 -16
- package/src/labs/UiShell/renderUiShell.test.tsx +21 -15
- package/src/labs/UiShell/renderUiShell.tsx +8 -1
- package/src/labs/index.ts +1 -0
- package/src/theme/components.tsx +25 -28
- package/src/web-component/renderReactInWebComponent.ts +10 -5
- package/dist/Button.js.map +0 -1
- package/dist/ButtonContext.js.map +0 -1
- package/dist/MenuButton.js.map +0 -1
- package/dist/MenuContext.js.map +0 -1
- package/dist/MenuItem.js.map +0 -1
- package/dist/labs/SideNav/OktaAura.js.map +0 -1
- package/dist/src/Button.d.ts.map +0 -1
- package/dist/src/ButtonContext.d.ts.map +0 -1
- package/dist/src/MenuButton.d.ts.map +0 -1
- package/dist/src/MenuContext.d.ts.map +0 -1
- package/dist/src/MenuItem.d.ts.map +0 -1
- package/dist/src/labs/SideNav/OktaAura.d.ts.map +0 -1
- /package/dist/{ButtonContext.js → Buttons/ButtonContext.js} +0 -0
- /package/dist/{MenuContext.js → Buttons/MenuContext.js} +0 -0
- /package/dist/{MenuItem.js → Buttons/MenuItem.js} +0 -0
- /package/dist/src/{ButtonContext.d.ts → Buttons/ButtonContext.d.ts} +0 -0
- /package/dist/src/{MenuContext.d.ts → Buttons/MenuContext.d.ts} +0 -0
- /package/dist/src/labs/{SideNav → AppSwitcher}/OktaAura.d.ts +0 -0
- /package/src/{ButtonContext.tsx → Buttons/ButtonContext.tsx} +0 -0
- /package/src/{MenuContext.ts → Buttons/MenuContext.ts} +0 -0
|
@@ -14,6 +14,7 @@ import styled from "@emotion/styled";
|
|
|
14
14
|
import { memo } from "react";
|
|
15
15
|
import { useOdysseyDesignTokens } from "../../OdysseyDesignTokensContext.js";
|
|
16
16
|
import { Subordinate } from "../../Typography.js";
|
|
17
|
+
import { Box } from "../../Box.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
const UserProfileContainer = styled("div", {
|
|
@@ -35,12 +36,14 @@ const UserProfileIconContainer = styled("div", {
|
|
|
35
36
|
}));
|
|
36
37
|
const UserProfileInfoContainer = styled("div")(() => ({
|
|
37
38
|
display: "flex",
|
|
38
|
-
flexDirection: "column"
|
|
39
|
+
flexDirection: "column",
|
|
40
|
+
textAlign: "left"
|
|
39
41
|
}));
|
|
40
42
|
const UserProfile = ({
|
|
41
43
|
profileIcon,
|
|
42
44
|
userName,
|
|
43
|
-
orgName
|
|
45
|
+
orgName,
|
|
46
|
+
userNameEndIcon
|
|
44
47
|
}) => {
|
|
45
48
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
46
49
|
return _jsxs(UserProfileContainer, {
|
|
@@ -49,7 +52,17 @@ const UserProfile = ({
|
|
|
49
52
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
50
53
|
children: profileIcon
|
|
51
54
|
}), _jsxs(UserProfileInfoContainer, {
|
|
52
|
-
children: [
|
|
55
|
+
children: [userNameEndIcon ? _jsxs(Box, {
|
|
56
|
+
sx: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "row",
|
|
59
|
+
gap: odysseyDesignTokens.Spacing2
|
|
60
|
+
},
|
|
61
|
+
children: [_jsx(Subordinate, {
|
|
62
|
+
color: "textPrimary",
|
|
63
|
+
children: userName
|
|
64
|
+
}), userNameEndIcon]
|
|
65
|
+
}) : _jsx(Subordinate, {
|
|
53
66
|
color: "textPrimary",
|
|
54
67
|
children: userName
|
|
55
68
|
}), _jsx(Subordinate, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserProfile.js","names":["styled","memo","useOdysseyDesignTokens","Subordinate","jsx","_jsx","jsxs","_jsxs","UserProfileContainer","shouldForwardProp","prop","odysseyDesignTokens","display","alignItems","paddingInlineEnd","Spacing4","UserProfileIconContainer","Spacing2","UserProfileInfoContainer","flexDirection","UserProfile","profileIcon","userName","orgName","children","color","MemoizedUserProfile","displayName"],"sources":["../../../src/labs/TopNav/UserProfile.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 styled from \"@emotion/styled\";\nimport { memo, type ReactElement } from \"react\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Subordinate } from \"../../Typography\";\n\nconst UserProfileContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n paddingInlineEnd: odysseyDesignTokens.Spacing4,\n}));\n\nconst UserProfileIconContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n paddingInlineEnd: odysseyDesignTokens.Spacing2,\n}));\n\nconst UserProfileInfoContainer = styled(\"div\")(() => ({\n display: \"flex\",\n flexDirection: \"column\",\n}));\n\nexport type UserProfileProps = {\n /**\n * Logged in user profile icon to be displayed in the top nav\n */\n profileIcon?: ReactElement;\n /**\n * Logged in user info to be displayed in the top nav\n */\n userName: string;\n /**\n * Org name of the logged in user\n */\n orgName: string;\n};\n\nconst UserProfile = ({
|
|
1
|
+
{"version":3,"file":"UserProfile.js","names":["styled","memo","useOdysseyDesignTokens","Subordinate","Box","jsx","_jsx","jsxs","_jsxs","UserProfileContainer","shouldForwardProp","prop","odysseyDesignTokens","display","alignItems","paddingInlineEnd","Spacing4","UserProfileIconContainer","Spacing2","UserProfileInfoContainer","flexDirection","textAlign","UserProfile","profileIcon","userName","orgName","userNameEndIcon","children","sx","gap","color","MemoizedUserProfile","displayName"],"sources":["../../../src/labs/TopNav/UserProfile.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 styled from \"@emotion/styled\";\nimport { memo, type ReactElement } from \"react\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Subordinate } from \"../../Typography\";\nimport { Box } from \"../../Box\";\n\nconst UserProfileContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n paddingInlineEnd: odysseyDesignTokens.Spacing4,\n}));\n\nconst UserProfileIconContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n paddingInlineEnd: odysseyDesignTokens.Spacing2,\n}));\n\nconst UserProfileInfoContainer = styled(\"div\")(() => ({\n display: \"flex\",\n flexDirection: \"column\",\n textAlign: \"left\",\n}));\n\nexport type UserProfileProps = {\n /**\n * Logged in user profile icon to be displayed in the top nav\n */\n profileIcon?: ReactElement;\n /**\n * Logged in user info to be displayed in the top nav\n */\n userName: string;\n /**\n * Org name of the logged in user\n */\n orgName: string;\n /**\n * The icon element to display after the username\n */\n userNameEndIcon?: ReactElement;\n};\n\nconst UserProfile = ({\n profileIcon,\n userName,\n orgName,\n userNameEndIcon,\n}: UserProfileProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <UserProfileContainer odysseyDesignTokens={odysseyDesignTokens}>\n {profileIcon && (\n <UserProfileIconContainer odysseyDesignTokens={odysseyDesignTokens}>\n {profileIcon}\n </UserProfileIconContainer>\n )}\n\n <UserProfileInfoContainer>\n {userNameEndIcon ? (\n <Box\n sx={{\n display: \"flex\",\n flexDirection: \"row\",\n gap: odysseyDesignTokens.Spacing2,\n }}\n >\n <Subordinate color=\"textPrimary\">{userName}</Subordinate>\n {userNameEndIcon}\n </Box>\n ) : (\n <Subordinate color=\"textPrimary\">{userName}</Subordinate>\n )}\n <Subordinate color=\"textSecondary\">{orgName}</Subordinate>\n </UserProfileInfoContainer>\n </UserProfileContainer>\n );\n};\n\nconst MemoizedUserProfile = memo(UserProfile);\nMemoizedUserProfile.displayName = \"UserProfile\";\n\nexport { MemoizedUserProfile as UserProfile };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,QAA2B,OAAO;AAAC,SAI9CC,sBAAsB;AAAA,SAEfC,WAAW;AAAA,SACXC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA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AAE;QAAAS,QAAA,GAEFrB,IAAA,CAACH,WAAW;UAAC2B,KAAK,EAAC,aAAa;UAAAH,QAAA,EAAEH;QAAQ,CAAc,CAAC,EACxDE,eAAe;MAAA,CACb,CAAC,GAENpB,IAAA,CAACH,WAAW;QAAC2B,KAAK,EAAC,aAAa;QAAAH,QAAA,EAAEH;MAAQ,CAAc,CACzD,EACDlB,IAAA,CAACH,WAAW;QAAC2B,KAAK,EAAC,eAAe;QAAAH,QAAA,EAAEF;MAAO,CAAc,CAAC;IAAA,CAClC,CAAC;EAAA,CACP,CAAC;AAE3B,CAAC;AAED,MAAMM,mBAAmB,GAAG9B,IAAI,CAACqB,WAAW,CAAC;AAC7CS,mBAAmB,CAACC,WAAW,GAAG,aAAa;AAE/C,SAASD,mBAAmB,IAAIT,WAAW"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-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 } from "react";
|
|
14
|
+
import { UserProfile } from "./UserProfile.js";
|
|
15
|
+
import { ChevronDownIcon } from "../../icons.generated/index.js";
|
|
16
|
+
import { BaseMenuButton } from "../../Buttons/BaseMenuButton.js";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const UserProfileMenuButton = props => {
|
|
19
|
+
const {
|
|
20
|
+
profileIcon,
|
|
21
|
+
userName,
|
|
22
|
+
orgName,
|
|
23
|
+
userNameEndIcon,
|
|
24
|
+
...menuButtonProps
|
|
25
|
+
} = props;
|
|
26
|
+
return _jsx(BaseMenuButton, {
|
|
27
|
+
...menuButtonProps,
|
|
28
|
+
buttonVariant: "floating",
|
|
29
|
+
omitEndIcon: true,
|
|
30
|
+
buttonChildren: _jsx(UserProfile, {
|
|
31
|
+
profileIcon: profileIcon,
|
|
32
|
+
userName: userName,
|
|
33
|
+
orgName: orgName,
|
|
34
|
+
userNameEndIcon: userNameEndIcon ?? _jsx(ChevronDownIcon, {})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const MemoizedUserProfileMenuButton = memo(UserProfileMenuButton);
|
|
39
|
+
MemoizedUserProfileMenuButton.displayName = "UserProfileMenuButton";
|
|
40
|
+
export { MemoizedUserProfileMenuButton as UserProfileMenuButton };
|
|
41
|
+
//# sourceMappingURL=UserProfileMenuButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfileMenuButton.js","names":["memo","UserProfile","ChevronDownIcon","BaseMenuButton","jsx","_jsx","UserProfileMenuButton","props","profileIcon","userName","orgName","userNameEndIcon","menuButtonProps","buttonVariant","omitEndIcon","buttonChildren","MemoizedUserProfileMenuButton","displayName"],"sources":["../../../src/labs/TopNav/UserProfileMenuButton.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { memo } from \"react\";\nimport { UserProfile, UserProfileProps } from \"./UserProfile\";\nimport { ChevronDownIcon } from \"../../icons.generated\";\nimport {\n AdditionalBaseMenuButtonProps,\n BaseMenuButton,\n BaseMenuButtonProps,\n} from \"../../Buttons/BaseMenuButton\";\n\nexport type UserProfileMenuButtonProps = Omit<\n BaseMenuButtonProps,\n \"endIcon\" | \"variant\"\n> &\n AdditionalBaseMenuButtonProps &\n UserProfileProps;\n\nconst UserProfileMenuButton = (props: UserProfileMenuButtonProps) => {\n const {\n profileIcon,\n userName,\n orgName,\n userNameEndIcon,\n ...menuButtonProps\n } = props;\n return (\n <BaseMenuButton\n {...menuButtonProps}\n buttonVariant=\"floating\"\n omitEndIcon={true}\n buttonChildren={\n <UserProfile\n profileIcon={profileIcon}\n userName={userName}\n orgName={orgName}\n userNameEndIcon={userNameEndIcon ?? <ChevronDownIcon />}\n />\n }\n />\n );\n};\n\nconst MemoizedUserProfileMenuButton = memo(UserProfileMenuButton);\nMemoizedUserProfileMenuButton.displayName = \"UserProfileMenuButton\";\n\nexport { MemoizedUserProfileMenuButton as UserProfileMenuButton };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,OAAO;AAAC,SACpBC,WAAW;AAAA,SACXC,eAAe;AAAA,SAGtBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAWhB,MAAMC,qBAAqB,GAAIC,KAAiC,IAAK;EACnE,MAAM;IACJC,WAAW;IACXC,QAAQ;IACRC,OAAO;IACPC,eAAe;IACf,GAAGC;EACL,CAAC,GAAGL,KAAK;EACT,OACEF,IAAA,CAACF,cAAc;IAAA,GACTS,eAAe;IACnBC,aAAa,EAAC,UAAU;IACxBC,WAAW,EAAE,IAAK;IAClBC,cAAc,EACZV,IAAA,CAACJ,WAAW;MACVO,WAAW,EAAEA,WAAY;MACzBC,QAAQ,EAAEA,QAAS;MACnBC,OAAO,EAAEA,OAAQ;MACjBC,eAAe,EAAEA,eAAe,IAAIN,IAAA,CAACH,eAAe,IAAE;IAAE,CACzD;EACF,CACF,CAAC;AAEN,CAAC;AAED,MAAMc,6BAA6B,GAAGhB,IAAI,CAACM,qBAAqB,CAAC;AACjEU,6BAA6B,CAACC,WAAW,GAAG,uBAAuB;AAEnE,SAASD,6BAA6B,IAAIV,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/labs/TopNav/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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\nexport * from \"./TopNav\";\nexport * from \"./UserProfile\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/labs/TopNav/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-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\nexport * from \"./TopNav\";\nexport * from \"./UserProfile\";\nexport * from \"./UserProfileMenuButton\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAAA;AAAA"}
|
|
@@ -18,15 +18,14 @@ import { UiShellContent } from "./UiShellContent.js";
|
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const defaultComponentProps = {
|
|
21
|
-
sideNavProps:
|
|
22
|
-
|
|
23
|
-
sideNavItems: []
|
|
24
|
-
},
|
|
25
|
-
topNavProps: {}
|
|
21
|
+
sideNavProps: undefined,
|
|
22
|
+
topNavProps: undefined
|
|
26
23
|
};
|
|
27
24
|
const UiShell = ({
|
|
25
|
+
appBackgroundContrastMode,
|
|
28
26
|
appComponent,
|
|
29
27
|
appRootElement,
|
|
28
|
+
initialVisibleSections,
|
|
30
29
|
onError = console.error,
|
|
31
30
|
onSubscriptionCreated,
|
|
32
31
|
optionalComponents,
|
|
@@ -54,7 +53,9 @@ const UiShell = ({
|
|
|
54
53
|
onError: onError,
|
|
55
54
|
children: [_jsx(CssBaseline, {}), _jsx(UiShellContent, {
|
|
56
55
|
...componentProps,
|
|
56
|
+
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
57
57
|
appComponent: appComponent,
|
|
58
|
+
initialVisibleSections: initialVisibleSections,
|
|
58
59
|
onError: onError,
|
|
59
60
|
optionalComponents: optionalComponents
|
|
60
61
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiShell.js","names":["memo","useEffect","useState","ErrorBoundary","CssBaseline","OdysseyProvider","UiShellContent","jsx","_jsx","jsxs","_jsxs","defaultComponentProps","sideNavProps","
|
|
1
|
+
{"version":3,"file":"UiShell.js","names":["memo","useEffect","useState","ErrorBoundary","CssBaseline","OdysseyProvider","UiShellContent","jsx","_jsx","jsxs","_jsxs","defaultComponentProps","sideNavProps","undefined","topNavProps","UiShell","appBackgroundContrastMode","appComponent","appRootElement","initialVisibleSections","onError","console","error","onSubscriptionCreated","optionalComponents","stylesRootElement","subscribeToPropChanges","componentProps","setComponentProps","unsubscribe","fallback","children","emotionRootElement","shadowRootElement","MemoizedUiShell","displayName"],"sources":["../../../src/labs/UiShell/UiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { memo, useEffect, useState, type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { CssBaseline } from \"../../CssBaseline\";\nimport { OdysseyProvider } from \"../../OdysseyProvider\";\nimport {\n UiShellContent,\n type UiShellContentProps,\n type UiShellNavComponentProps,\n} from \"./UiShellContent\";\nimport { type ReactRootElements } from \"../../web-component\";\n\nexport const defaultComponentProps: UiShellNavComponentProps = {\n sideNavProps: undefined,\n topNavProps: undefined,\n} as const;\n\nexport type UiShellProps = {\n /**\n * Notifies when subscribed to prop changes.\n *\n * UI Shell listens to prop updates, and it won't subscribe synchronously. Because of that, this callback notifies when that subscription is ready.\n */\n onSubscriptionCreated: () => void;\n /**\n * This is a callback that provides a subscriber callback to listen for changes to state.\n * It allows UI Shell to listen for state changes.\n *\n * The props coming in this callback go directly to a React state; therefore, it shares the same signature and provides a previous state.\n */\n subscribeToPropChanges: (\n subscriber: (\n componentProps: SetStateAction<UiShellNavComponentProps>,\n ) => void,\n ) => () => void;\n} & Pick<ReactRootElements, \"appRootElement\" | \"stylesRootElement\"> &\n Pick<\n UiShellContentProps,\n | \"appBackgroundContrastMode\"\n | \"appComponent\"\n | \"initialVisibleSections\"\n | \"onError\"\n | \"optionalComponents\"\n >;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShell = ({\n appBackgroundContrastMode,\n appComponent,\n appRootElement,\n initialVisibleSections,\n onError = console.error,\n onSubscriptionCreated,\n optionalComponents,\n stylesRootElement,\n subscribeToPropChanges,\n}: UiShellProps) => {\n const [componentProps, setComponentProps] = useState(defaultComponentProps);\n\n useEffect(() => {\n const unsubscribe = subscribeToPropChanges((componentProps) => {\n // If for some reason nothing is passed as `componentProps`, we fallback on `defaultComponentProps` as a safety mechanism to ensure nothing breaks.\n setComponentProps(componentProps || defaultComponentProps);\n });\n\n onSubscriptionCreated();\n\n return () => {\n unsubscribe();\n };\n }, [onSubscriptionCreated, subscribeToPropChanges]);\n\n return (\n <ErrorBoundary fallback={appComponent} onError={onError}>\n <OdysseyProvider\n emotionRootElement={stylesRootElement}\n shadowRootElement={appRootElement}\n >\n <ErrorBoundary fallback={appComponent} onError={onError}>\n <CssBaseline />\n\n <UiShellContent\n {...componentProps}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appComponent={appComponent}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n optionalComponents={optionalComponents}\n />\n </ErrorBoundary>\n </OdysseyProvider>\n </ErrorBoundary>\n );\n};\n\nconst MemoizedUiShell = memo(UiShell);\nMemoizedUiShell.displayName = \"UiShell\";\n\nexport { MemoizedUiShell as UiShell };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAA6B,OAAO;AACtE,SAASC,aAAa,QAAQ,sBAAsB;AAAC,SAE5CC,WAAW;AAAA,SACXC,eAAe;AAAA,SAEtBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAMhB,OAAO,MAAMC,qBAA+C,GAAG;EAC7DC,YAAY,EAAEC,SAAS;EACvBC,WAAW,EAAED;AACf,CAAU;AAqCV,MAAME,OAAO,GAAGA,CAAC;EACf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Ae,IAAInB,OAAO"}
|
|
@@ -13,26 +13,33 @@
|
|
|
13
13
|
import styled from "@emotion/styled";
|
|
14
14
|
import { memo } from "react";
|
|
15
15
|
import { ErrorBoundary } from "react-error-boundary";
|
|
16
|
+
import { AppSwitcher } from "../AppSwitcher/index.js";
|
|
16
17
|
import { SideNav } from "../SideNav/index.js";
|
|
17
18
|
import { TopNav } from "../TopNav/index.js";
|
|
18
19
|
import { useOdysseyDesignTokens } from "../../OdysseyDesignTokensContext.js";
|
|
19
20
|
import { useScrollState } from "./useScrollState.js";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const emptySideNavItems = [];
|
|
22
24
|
const StyledAppContainer = styled("div", {
|
|
23
|
-
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
25
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "appBackgroundContrastMode"
|
|
24
26
|
})(({
|
|
27
|
+
appBackgroundContrastMode,
|
|
25
28
|
odysseyDesignTokens
|
|
26
29
|
}) => ({
|
|
27
30
|
gridArea: "app-content",
|
|
28
31
|
overflowX: "hidden",
|
|
29
32
|
overflowY: "auto",
|
|
30
33
|
paddingBlock: odysseyDesignTokens.Spacing5,
|
|
31
|
-
paddingInline: odysseyDesignTokens.Spacing8
|
|
34
|
+
paddingInline: odysseyDesignTokens.Spacing8,
|
|
35
|
+
backgroundColor: appBackgroundContrastMode === "highContrast" ? odysseyDesignTokens.HueNeutralWhite : odysseyDesignTokens.HueNeutral50
|
|
32
36
|
}));
|
|
33
37
|
const StyledBannersContainer = styled("div")(() => ({
|
|
34
38
|
gridArea: "banners"
|
|
35
39
|
}));
|
|
40
|
+
const StyledAppSwitcherContainer = styled("div")(() => ({
|
|
41
|
+
gridArea: "app-switcher"
|
|
42
|
+
}));
|
|
36
43
|
const StyledSideNavContainer = styled("div")(() => ({
|
|
37
44
|
gridArea: "side-nav"
|
|
38
45
|
}));
|
|
@@ -45,11 +52,11 @@ const StyledShellContainer = styled("div", {
|
|
|
45
52
|
display: "grid",
|
|
46
53
|
gridGap: 0,
|
|
47
54
|
gridTemplateAreas: `
|
|
48
|
-
"banners banners"
|
|
49
|
-
"side-nav top-nav"
|
|
50
|
-
"side-nav app-content"
|
|
55
|
+
"banners banners banners"
|
|
56
|
+
"app-switcher side-nav top-nav"
|
|
57
|
+
"app-switcher side-nav app-content"
|
|
51
58
|
`,
|
|
52
|
-
gridTemplateColumns: "auto 1fr",
|
|
59
|
+
gridTemplateColumns: "auto auto 1fr",
|
|
53
60
|
gridTemplateRows: "auto auto 1fr",
|
|
54
61
|
height: "100vh",
|
|
55
62
|
width: "100vw"
|
|
@@ -57,10 +64,14 @@ const StyledShellContainer = styled("div", {
|
|
|
57
64
|
const StyledTopNavContainer = styled("div")(() => ({
|
|
58
65
|
gridArea: "top-nav"
|
|
59
66
|
}));
|
|
67
|
+
export const subComponentNames = ["TopNav", "SideNav", "AppSwitcher"];
|
|
60
68
|
const UiShellContent = ({
|
|
69
|
+
appBackgroundContrastMode = "lowContrast",
|
|
61
70
|
appComponent,
|
|
71
|
+
initialVisibleSections = ["TopNav", "SideNav", "AppSwitcher"],
|
|
62
72
|
onError = console.error,
|
|
63
73
|
optionalComponents,
|
|
74
|
+
appSwitcherProps,
|
|
64
75
|
sideNavProps,
|
|
65
76
|
topNavProps
|
|
66
77
|
}) => {
|
|
@@ -73,8 +84,32 @@ const UiShellContent = ({
|
|
|
73
84
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
74
85
|
children: [_jsx(StyledBannersContainer, {
|
|
75
86
|
children: optionalComponents?.banners
|
|
76
|
-
}),
|
|
77
|
-
children:
|
|
87
|
+
}), _jsxs(StyledAppSwitcherContainer, {
|
|
88
|
+
children: [initialVisibleSections?.includes("AppSwitcher") && !appSwitcherProps && _jsx(ErrorBoundary, {
|
|
89
|
+
fallback: null,
|
|
90
|
+
onError: onError,
|
|
91
|
+
children: _jsx(AppSwitcher, {
|
|
92
|
+
isLoading: true,
|
|
93
|
+
appIcons: [],
|
|
94
|
+
selectedAppName: ""
|
|
95
|
+
})
|
|
96
|
+
}), appSwitcherProps && _jsx(ErrorBoundary, {
|
|
97
|
+
fallback: null,
|
|
98
|
+
onError: onError,
|
|
99
|
+
children: _jsx(AppSwitcher, {
|
|
100
|
+
...appSwitcherProps
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
}), _jsxs(StyledSideNavContainer, {
|
|
104
|
+
children: [initialVisibleSections?.includes("SideNav") && !sideNavProps && _jsx(ErrorBoundary, {
|
|
105
|
+
fallback: null,
|
|
106
|
+
onError: onError,
|
|
107
|
+
children: _jsx(SideNav, {
|
|
108
|
+
isLoading: true,
|
|
109
|
+
appName: "",
|
|
110
|
+
sideNavItems: emptySideNavItems
|
|
111
|
+
})
|
|
112
|
+
}), sideNavProps && _jsx(ErrorBoundary, {
|
|
78
113
|
fallback: null,
|
|
79
114
|
onError: onError,
|
|
80
115
|
children: _jsx(SideNav, {
|
|
@@ -88,9 +123,13 @@ const UiShellContent = ({
|
|
|
88
123
|
hasCustomFooter: false
|
|
89
124
|
})
|
|
90
125
|
})
|
|
91
|
-
})
|
|
92
|
-
}),
|
|
93
|
-
children: _jsx(ErrorBoundary, {
|
|
126
|
+
})]
|
|
127
|
+
}), _jsxs(StyledTopNavContainer, {
|
|
128
|
+
children: [initialVisibleSections?.includes("TopNav") && !topNavProps && _jsx(ErrorBoundary, {
|
|
129
|
+
fallback: null,
|
|
130
|
+
onError: onError,
|
|
131
|
+
children: _jsx(TopNav, {})
|
|
132
|
+
}), topNavProps && _jsx(ErrorBoundary, {
|
|
94
133
|
fallback: null,
|
|
95
134
|
onError: onError,
|
|
96
135
|
children: _jsx(TopNav, {
|
|
@@ -99,11 +138,12 @@ const UiShellContent = ({
|
|
|
99
138
|
leftSideComponent: optionalComponents?.topNavLeftSide,
|
|
100
139
|
rightSideComponent: optionalComponents?.topNavRightSide
|
|
101
140
|
})
|
|
102
|
-
})
|
|
141
|
+
})]
|
|
103
142
|
}), _jsx(StyledAppContainer, {
|
|
104
143
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
105
|
-
|
|
144
|
+
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
106
145
|
ref: scrollableContentRef,
|
|
146
|
+
tabIndex: 0,
|
|
107
147
|
children: appComponent
|
|
108
148
|
})]
|
|
109
149
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiShellContent.js","names":["styled","memo","ErrorBoundary","SideNav","TopNav","useOdysseyDesignTokens","useScrollState","jsx","_jsx","jsxs","_jsxs","StyledAppContainer","shouldForwardProp","prop","odysseyDesignTokens","gridArea","overflowX","overflowY","paddingBlock","Spacing5","paddingInline","Spacing8","StyledBannersContainer","StyledSideNavContainer","StyledShellContainer","backgroundColor","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","UiShellContent","appComponent","onError","console","error","optionalComponents","sideNavProps","topNavProps","isContentScrolled","scrollableContentRef","children","banners","fallback","hasCustomFooter","sideNavFooter","footerComponent","footerItems","undefined","isScrolled","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","tabIndex","ref","MemoizedUiShellContent","displayName"],"sources":["../../../src/labs/UiShell/UiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 styled from \"@emotion/styled\";\nimport { memo, type ReactElement, type ReactNode } from \"react\";\nimport { ErrorBoundary, ErrorBoundaryProps } from \"react-error-boundary\";\n\nimport { SideNav, type SideNavProps } from \"../SideNav\";\nimport { TopNav, type TopNavProps } from \"../TopNav\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { useScrollState } from \"./useScrollState\";\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n gridArea: \"app-content\",\n overflowX: \"hidden\",\n overflowY: \"auto\",\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n}));\n\nconst StyledBannersContainer = styled(\"div\")(() => ({\n gridArea: \"banners\",\n}));\n\nconst StyledSideNavContainer = styled(\"div\")(() => ({\n gridArea: \"side-nav\",\n}));\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners\"\n \"side-nav top-nav\"\n \"side-nav app-content\"\n `,\n gridTemplateColumns: \"auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")(() => ({\n gridArea: \"top-nav\",\n}));\n\nexport type UiShellNavComponentProps = {\n /**\n * Object that gets pass directly to the side nav component.\n */\n sideNavProps?: Omit<SideNavProps, \"footerComponent\">;\n /**\n * Object that gets pass directly to the top nav component.\n */\n topNavProps: Omit<TopNavProps, \"leftSideComponent\" | \"rightSideComponent\">;\n};\n\nexport type UiShellContentProps = {\n /**\n * React app component that renders as children in the correct location of the shell.\n */\n appComponent: ReactNode;\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, flagging \"p0\"s, and recovering UI Shell when errors occur.\n */\n onError?: ErrorBoundaryProps[\"onError\"];\n /**\n * Components that will render as children of various other components such as the top nav or side nav.\n */\n optionalComponents?: {\n banners?: ReactElement;\n sideNavFooter?: SideNavProps[\"footerComponent\"];\n topNavLeftSide?: TopNavProps[\"leftSideComponent\"];\n topNavRightSide?: TopNavProps[\"rightSideComponent\"];\n };\n} & UiShellNavComponentProps;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShellContent = ({\n appComponent,\n onError = console.error,\n optionalComponents,\n sideNavProps,\n topNavProps,\n}: UiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { isContentScrolled, scrollableContentRef } = useScrollState();\n\n return (\n <StyledShellContainer odysseyDesignTokens={odysseyDesignTokens}>\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledSideNavContainer>\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </StyledSideNavContainer>\n\n <StyledTopNavContainer>\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n isScrolled={isContentScrolled}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n </StyledTopNavContainer>\n\n <StyledAppContainer\n odysseyDesignTokens={odysseyDesignTokens}\n tabIndex={0}\n ref={scrollableContentRef}\n >\n {appComponent}\n </StyledAppContainer>\n </StyledShellContainer>\n );\n};\n\nconst MemoizedUiShellContent = memo(UiShellContent);\nMemoizedUiShellContent.displayName = \"UiShellContent\";\n\nexport { MemoizedUiShellContent as UiShellContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,QAA2C,OAAO;AAC/D,SAASC,aAAa,QAA4B,sBAAsB;AAAC,SAEhEC,OAAO;AAAA,SACPC,MAAM;AAAA,SAEbC,sBAAsB;AAAA,SAGfC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEvB,MAAMC,kBAAkB,GAAGX,MAAM,CAAC,KAAK,EAAE;EACvCY,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EAC/BC,QAAQ,EAAE,aAAa;EACvBC,SAAS,EAAE,QAAQ;EACnBC,SAAS,EAAE,MAAM;EACjBC,YAAY,EAAEJ,mBAAmB,CAACK,QAAQ;EAC1CC,aAAa,EAAEN,mBAAmB,CAACO;AACrC,CAAC,CAAC,CAAC;AAEH,MAAMC,sBAAsB,GAAGtB,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO;EAClDe,QAAQ,EAAE;AACZ,CAAC,CAAC,CAAC;AAEH,MAAMQ,sBAAsB,GAAGvB,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO;EAClDe,QAAQ,EAAE;AACZ,CAAC,CAAC,CAAC;AAEH,MAAMS,oBAAoB,GAAGxB,MAAM,CAAC,KAAK,EAAE;EACzCY,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EAC/BW,eAAe,EAAEX,mBAAmB,CAACY,YAAY;EACjDC,OAAO,EAAE,MAAM;EACfC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAG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,IAAA,CAACN,aAAa;QAAC6C,QAAQ,EAAE,IAAK;QAACV,OAAO,EAAEA,OAAQ;QAAAQ,QAAA,EAC9CrC,IAAA,CAACJ,MAAM;UAAA,GACDsC,WAAW;UACfW,UAAU,EAAEV,iBAAkB;UAC9BW,iBAAiB,EAAEd,kBAAkB,EAAEe,cAAe;UACtDC,kBAAkB,EAAEhB,kBAAkB,EAAEiB;QAAgB,CACzD;MAAC,CACW;IAAC,CACK,CAAC,EAExBjD,IAAA,CAACG,kBAAkB;MACjBG,mBAAmB,EAAEA,mBAAoB;MACzC4C,QAAQ,EAAE,CAAE;MACZC,GAAG,EAAEf,oBAAqB;MAAAC,QAAA,EAEzBT;IAAY,CACK,CAAC;EAAA,CACD,CAAC;AAE3B,CAAC;AAED,MAAMwB,sBAAsB,GAAG3D,IAAI,CAACkC,cAAc,CAAC;AACnDyB,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIzB,cAAc"}
|
|
1
|
+
{"version":3,"file":"UiShellContent.js","names":["styled","memo","ErrorBoundary","AppSwitcher","SideNav","TopNav","useOdysseyDesignTokens","useScrollState","jsx","_jsx","jsxs","_jsxs","emptySideNavItems","StyledAppContainer","shouldForwardProp","prop","appBackgroundContrastMode","odysseyDesignTokens","gridArea","overflowX","overflowY","paddingBlock","Spacing5","paddingInline","Spacing8","backgroundColor","HueNeutralWhite","HueNeutral50","StyledBannersContainer","StyledAppSwitcherContainer","StyledSideNavContainer","StyledShellContainer","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","subComponentNames","UiShellContent","appComponent","initialVisibleSections","onError","console","error","optionalComponents","appSwitcherProps","sideNavProps","topNavProps","isContentScrolled","scrollableContentRef","children","banners","includes","fallback","isLoading","appIcons","selectedAppName","appName","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","undefined","isScrolled","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","ref","tabIndex","MemoizedUiShellContent","displayName"],"sources":["../../../src/labs/UiShell/UiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 styled from \"@emotion/styled\";\nimport { memo, type ReactElement, type ReactNode } from \"react\";\nimport { ErrorBoundary, ErrorBoundaryProps } from \"react-error-boundary\";\n\nimport { AppSwitcher, type AppSwitcherProps } from \"../AppSwitcher\";\nimport { SideNav, type SideNavProps } from \"../SideNav\";\nimport { TopNav, type TopNavProps } from \"../TopNav\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { useScrollState } from \"./useScrollState\";\nimport { ContrastMode } from \"../../useContrastMode\";\n\nconst emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"appBackgroundContrastMode\",\n})<{\n appBackgroundContrastMode: ContrastMode;\n odysseyDesignTokens: DesignTokens;\n}>(({ appBackgroundContrastMode, odysseyDesignTokens }) => ({\n gridArea: \"app-content\",\n overflowX: \"hidden\",\n overflowY: \"auto\",\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n backgroundColor:\n appBackgroundContrastMode === \"highContrast\"\n ? odysseyDesignTokens.HueNeutralWhite\n : odysseyDesignTokens.HueNeutral50,\n}));\n\nconst StyledBannersContainer = styled(\"div\")(() => ({\n gridArea: \"banners\",\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")(() => ({\n gridArea: \"app-switcher\",\n}));\n\nconst StyledSideNavContainer = styled(\"div\")(() => ({\n gridArea: \"side-nav\",\n}));\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners banners\"\n \"app-switcher side-nav top-nav\"\n \"app-switcher side-nav app-content\"\n `,\n gridTemplateColumns: \"auto auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")(() => ({\n gridArea: \"top-nav\",\n}));\n\nexport const subComponentNames = [\"TopNav\", \"SideNav\", \"AppSwitcher\"] as const;\nexport type SubComponentName = (typeof subComponentNames)[number];\n\nexport type UiShellNavComponentProps = {\n /**\n * Object that gets pass directly to the app switcher component.\n */\n appSwitcherProps?: AppSwitcherProps;\n /**\n * Object that gets pass directly to the side nav component.\n */\n sideNavProps?: Omit<SideNavProps, \"footerComponent\">;\n /**\n * Object that gets pass directly to the top nav component.\n */\n topNavProps?: Omit<TopNavProps, \"leftSideComponent\" | \"rightSideComponent\">;\n};\n\nexport type UiShellContentProps = {\n /**\n * Sets the background color for the app content area.\n */\n appBackgroundContrastMode?: ContrastMode;\n /**\n * React app component that renders as children in the correct location of the shell.\n */\n appComponent: ReactNode;\n /**\n * Which parts of the UI Shell should be visible initially? For example,\n * if sideNavProps is undefined, should the space for the sidenav be initially visible?\n */\n initialVisibleSections?: SubComponentName[];\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, flagging \"p0\"s, and recovering UI Shell when errors occur.\n */\n onError?: ErrorBoundaryProps[\"onError\"];\n /**\n * Components that will render as children of various other components such as the top nav or side nav.\n */\n optionalComponents?: {\n banners?: ReactElement;\n sideNavFooter?: SideNavProps[\"footerComponent\"];\n topNavLeftSide?: TopNavProps[\"leftSideComponent\"];\n topNavRightSide?: TopNavProps[\"rightSideComponent\"];\n };\n} & UiShellNavComponentProps;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShellContent = ({\n appBackgroundContrastMode = \"lowContrast\",\n appComponent,\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n appSwitcherProps,\n sideNavProps,\n topNavProps,\n}: UiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { isContentScrolled, scrollableContentRef } = useScrollState();\n\n return (\n <StyledShellContainer odysseyDesignTokens={odysseyDesignTokens}>\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledAppSwitcherContainer>\n {\n /* If AppSwitcher should be initially visible and we have not yet received props, render AppSwitcher in the loading state */\n initialVisibleSections?.includes(\"AppSwitcher\") &&\n !appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher isLoading appIcons={[]} selectedAppName=\"\" />\n </ErrorBoundary>\n )\n }\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") && !sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav isLoading appName=\"\" sideNavItems={emptySideNavItems} />\n </ErrorBoundary>\n )\n }\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </StyledSideNavContainer>\n\n <StyledTopNavContainer>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") && !topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav />\n </ErrorBoundary>\n )\n }\n {topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n isScrolled={isContentScrolled}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )}\n </StyledTopNavContainer>\n\n <StyledAppContainer\n odysseyDesignTokens={odysseyDesignTokens}\n appBackgroundContrastMode={appBackgroundContrastMode}\n ref={scrollableContentRef}\n tabIndex={0}\n >\n {appComponent}\n </StyledAppContainer>\n </StyledShellContainer>\n );\n};\n\nconst MemoizedUiShellContent = memo(UiShellContent);\nMemoizedUiShellContent.displayName = \"UiShellContent\";\n\nexport { MemoizedUiShellContent as UiShellContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,QAA2C,OAAO;AAC/D,SAASC,aAAa,QAA4B,sBAAsB;AAAC,SAEhEC,WAAW;AAAA,SACXC,OAAO;AAAA,SACPC,MAAM;AAAA,SAEbC,sBAAsB;AAAA,SAGfC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAGvB,MAAMC,iBAAiB,GAAG,EAAyC;AAEnE,MAAMC,kBAAkB,GAAGb,MAAM,CAAC,KAAK,EAAE;EACvCc,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IA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wB;QAAgB,CACzD;MAAC,CACW,CAChB;IAAA,CACoB,CAAC,EAExB9D,IAAA,CAACI,kBAAkB;MACjBI,mBAAmB,EAAEA,mBAAoB;MACzCD,yBAAyB,EAAEA,yBAA0B;MACrDwD,GAAG,EAAEpB,oBAAqB;MAC1BqB,QAAQ,EAAE,CAAE;MAAApB,QAAA,EAEXX;IAAY,CACK,CAAC;EAAA,CACD,CAAC;AAE3B,CAAC;AAED,MAAMgC,sBAAsB,GAAGzE,IAAI,CAACwC,cAAc,CAAC;AACnDiC,sBAAsB,CAACC,WAAW,GAAG,gBAAgB;AAErD,SAASD,sBAAsB,IAAIjC,cAAc"}
|
|
@@ -24,7 +24,9 @@ export const optionalComponentSlotNames = {
|
|
|
24
24
|
topNavRightSide: "top-nav-right-side"
|
|
25
25
|
};
|
|
26
26
|
export const renderUiShell = ({
|
|
27
|
+
appBackgroundContrastMode,
|
|
27
28
|
appRootElement: explicitAppRootElement,
|
|
29
|
+
initialVisibleSections,
|
|
28
30
|
onError = console.error,
|
|
29
31
|
uiShellRootElement
|
|
30
32
|
}) => {
|
|
@@ -54,8 +56,10 @@ export const renderUiShell = ({
|
|
|
54
56
|
fallback: appComponent,
|
|
55
57
|
onError: onError,
|
|
56
58
|
children: _jsx(UiShell, {
|
|
59
|
+
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
57
60
|
appComponent: appComponent,
|
|
58
61
|
appRootElement: reactRootElements.appRootElement,
|
|
62
|
+
initialVisibleSections: initialVisibleSections,
|
|
59
63
|
onError: onError,
|
|
60
64
|
onSubscriptionCreated: publishSubscriptionCreated,
|
|
61
65
|
optionalComponents: Object.fromEntries(Object.entries(optionalComponentSlotNames).map(([optionalComponentKey, slotName]) => [optionalComponentKey, _jsx("slot", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUiShell.js","names":["ErrorBoundary","bufferLatest","createMessageBus","UiShell","renderReactInWebComponent","jsx","_jsx","uiShellDataAttribute","optionalComponentSlotNames","banners","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appRootElement","explicitAppRootElement","onError","console","error","uiShellRootElement","document","createElement","setAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","concat","appComponent","uiShellElement","getReactComponent","reactRootElements","fallback","children","onSubscriptionCreated","optionalComponents","name","stylesRootElement","webComponentRootElement","setComponentProps"],"sources":["../../../src/labs/UiShell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest\";\nimport { createMessageBus } from \"./createMessageBus\";\nimport { UiShell, UiShellProps } from \"./UiShell\";\nimport { renderReactInWebComponent } from \"../../web-component/renderReactInWebComponent\";\nimport { type UiShellNavComponentProps } from \"./UiShellContent\";\n\nexport const uiShellDataAttribute = \"data-unified-ui-shell\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appRootElement: explicitAppRootElement,\n onError = console.error,\n uiShellRootElement,\n}: {\n /**\n * HTML element used as the root for a React app.\n */\n appRootElement?: HTMLDivElement;\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * HTML element used as the root for UI Shell.\n */\n uiShellRootElement: HTMLElement;\n}) => {\n const appRootElement =\n explicitAppRootElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n uiShellRootElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n >;\n\n const webComponentChildren =\n Object.values(slottedElements).concat(appRootElement);\n\n const appComponent = <slot />;\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={appComponent} onError={onError}>\n <UiShell\n appComponent={appComponent}\n appRootElement={reactRootElements.appRootElement}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n stylesRootElement={reactRootElements.stylesRootElement}\n subscribeToPropChanges={subscribeToPropChanges}\n />\n </ErrorBoundary>\n ),\n webComponentRootElement: uiShellRootElement,\n webComponentChildren,\n });\n\n return {\n appRootElement,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,QAAQ,sBAAsB;AAAC,SAE5CC,YAAY;AAAA,SACZC,gBAAgB;AAAA,SAChBC,OAAO;AAAA,SACPC,yBAAyB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGlC,OAAO,MAAMC,oBAAoB,GAAG,uBAAuB;AAE3D,OAAO,MAAMC,0BAGZ,GAAG;EACFC,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AAWD,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,cAAc,EAAEC,sBAAsB;EACtCC,OAAO,GAAGC,OAAO,CAACC,KAAK;EACvBC;
|
|
1
|
+
{"version":3,"file":"renderUiShell.js","names":["ErrorBoundary","bufferLatest","createMessageBus","UiShell","renderReactInWebComponent","jsx","_jsx","uiShellDataAttribute","optionalComponentSlotNames","banners","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundContrastMode","appRootElement","explicitAppRootElement","initialVisibleSections","onError","console","error","uiShellRootElement","document","createElement","setAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","concat","appComponent","uiShellElement","getReactComponent","reactRootElements","fallback","children","onSubscriptionCreated","optionalComponents","name","stylesRootElement","webComponentRootElement","setComponentProps"],"sources":["../../../src/labs/UiShell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest\";\nimport { createMessageBus } from \"./createMessageBus\";\nimport { UiShell, UiShellProps } from \"./UiShell\";\nimport { renderReactInWebComponent } from \"../../web-component/renderReactInWebComponent\";\nimport { type UiShellNavComponentProps } from \"./UiShellContent\";\n\nexport const uiShellDataAttribute = \"data-unified-ui-shell\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appBackgroundContrastMode,\n appRootElement: explicitAppRootElement,\n initialVisibleSections,\n onError = console.error,\n uiShellRootElement,\n}: {\n /**\n * HTML element used as the root for a React app.\n */\n appRootElement?: HTMLDivElement;\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * HTML element used as the root for UI Shell.\n */\n uiShellRootElement: HTMLElement;\n} & Pick<\n UiShellProps,\n \"appBackgroundContrastMode\" | \"initialVisibleSections\"\n>) => {\n const appRootElement =\n explicitAppRootElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n uiShellRootElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n >;\n\n const webComponentChildren =\n Object.values(slottedElements).concat(appRootElement);\n\n const appComponent = <slot />;\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={appComponent} onError={onError}>\n <UiShell\n appBackgroundContrastMode={appBackgroundContrastMode}\n appComponent={appComponent}\n appRootElement={reactRootElements.appRootElement}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n stylesRootElement={reactRootElements.stylesRootElement}\n subscribeToPropChanges={subscribeToPropChanges}\n />\n </ErrorBoundary>\n ),\n webComponentRootElement: uiShellRootElement,\n webComponentChildren,\n });\n\n return {\n appRootElement,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,QAAQ,sBAAsB;AAAC,SAE5CC,YAAY;AAAA,SACZC,gBAAgB;AAAA,SAChBC,OAAO;AAAA,SACPC,yBAAyB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGlC,OAAO,MAAMC,oBAAoB,GAAG,uBAAuB;AAE3D,OAAO,MAAMC,0BAGZ,GAAG;EACFC,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AAWD,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,yBAAyB;EACzBC,cAAc,EAAEC,sBAAsB;EACtCC,sBAAsB;EACtBC,OAAO,GAAGC,OAAO,CAACC,KAAK;EACvBC;AAiBF,CAAC,KAAK;EACJ,MAAMN,cAAc,GAClBC,sBAAsB,IAAIM,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGzDF,kBAAkB,CAACG,YAAY,CAACjB,oBAAoB,EAAE,EAAE,CAAC;EAEzD,MAAM;IAAEkB,OAAO,EAAEC,kBAAkB;IAAEC,SAAS,EAAEC;EAAuB,CAAC,GACtE1B,gBAAgB,CAA2C,CAAC;EAE9D,MAAM;IACJuB,OAAO,EAAEI,0BAA0B;IACnCF,SAAS,EAAEG;EACb,CAAC,GAAG5B,gBAAgB,CAAC,CAAC;EAEtB,MAAM6B,iCAAiC,GAAG9B,YAAY,CAAC;IACrDwB,OAAO,EAAEC,kBAAkB;IAC3BC,SAAS,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B,EAAEA;MAAuB,CAChD;IAAC,CACW,CAChB;IACDyB,uBAAuB,EAAEhC,kBAAkB;IAC3CmB;EACF,CAAC,CAAC;EAEF,OAAO;IACLzB,cAAc;IACduC,iBAAiB,EAAEvB,iCAAiC;IACpDC,eAAe;IACfY;EACF,CAAC;AACH,CAAC"}
|
package/dist/labs/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./OdysseyPickers/index.js";
|
|
|
25
25
|
export * from "./PageTemplate.js";
|
|
26
26
|
export * from "./PaginatedTable.js";
|
|
27
27
|
export { GroupPicker } from "./GroupPicker.js";
|
|
28
|
+
export * from "./AppSwitcher/index.js";
|
|
28
29
|
export * from "./SideNav/NavAccordion.js";
|
|
29
30
|
export * from "./SideNav/index.js";
|
|
30
31
|
export * from "./TopNav/index.js";
|
package/dist/labs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["AdapterDateFns","LocalizationProvider","GroupPicker"],"sources":["../../src/labs/index.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\nexport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nexport { LocalizationProvider } from \"@mui/x-date-pickers\";\nexport type { LocalizationProviderProps } from \"@mui/x-date-pickers\";\n\n// export * from \"./AdaptablePicker\";\nexport * from \"./AppTile\";\nexport * from \"./DatePicker\";\nexport * from \"./datePickerTheme\";\n\nexport * from \"./DataView\";\n\n/** @deprecated Will be removed in a future Odyssey version in lieu of the one shipping with DataTable */\nexport * from \"./DataTablePagination\";\nexport * from \"./DataFilters\";\nexport * from \"./Layout\";\nexport * from \"./materialReactTableTypes\";\n/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */\nexport * from \"./StaticTable\";\nexport * from \"./OdysseyPickers\";\nexport * from \"./PageTemplate\";\n/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */\nexport * from \"./PaginatedTable\";\n\nexport {\n /** @deprecated Will be removed in a future Odyssey version. Use `PickerWithOptionAdornment` */\n GroupPicker,\n type GroupPickerOptionType,\n type GroupPickerProps,\n} from \"./GroupPicker\";\n\nexport * from \"./SideNav/NavAccordion\";\nexport * from \"./SideNav\";\nexport * from \"./TopNav\";\nexport * from \"./UiShell\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,oCAAoC;AACnE,SAASC,oBAAoB,QAAQ,qBAAqB;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAwBzDC,WAAW;AAAA;AAAA;AAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["AdapterDateFns","LocalizationProvider","GroupPicker"],"sources":["../../src/labs/index.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\nexport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nexport { LocalizationProvider } from \"@mui/x-date-pickers\";\nexport type { LocalizationProviderProps } from \"@mui/x-date-pickers\";\n\n// export * from \"./AdaptablePicker\";\nexport * from \"./AppTile\";\nexport * from \"./DatePicker\";\nexport * from \"./datePickerTheme\";\n\nexport * from \"./DataView\";\n\n/** @deprecated Will be removed in a future Odyssey version in lieu of the one shipping with DataTable */\nexport * from \"./DataTablePagination\";\nexport * from \"./DataFilters\";\nexport * from \"./Layout\";\nexport * from \"./materialReactTableTypes\";\n/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */\nexport * from \"./StaticTable\";\nexport * from \"./OdysseyPickers\";\nexport * from \"./PageTemplate\";\n/** @deprecated Will be removed in a future Odyssey version in lieu of DataTable */\nexport * from \"./PaginatedTable\";\n\nexport {\n /** @deprecated Will be removed in a future Odyssey version. Use `PickerWithOptionAdornment` */\n GroupPicker,\n type GroupPickerOptionType,\n type GroupPickerProps,\n} from \"./GroupPicker\";\n\nexport * from \"./AppSwitcher\";\nexport * from \"./SideNav/NavAccordion\";\nexport * from \"./SideNav\";\nexport * from \"./TopNav\";\nexport * from \"./UiShell\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,oCAAoC;AACnE,SAASC,oBAAoB,QAAQ,qBAAqB;AAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAwBzDC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
13
|
-
import { HTMLAttributes, ReactElement } from "react";
|
|
14
|
-
import type { HtmlProps } from "
|
|
15
|
-
import { FocusHandle } from "
|
|
13
|
+
import { HTMLAttributes, ReactElement, ReactNode } from "react";
|
|
14
|
+
import type { HtmlProps } from "../HtmlProps";
|
|
15
|
+
import { FocusHandle } from "../inputUtils";
|
|
16
16
|
export declare const buttonSizeValues: readonly ["small", "medium", "large"];
|
|
17
17
|
export declare const buttonTypeValues: readonly ["button", "submit", "reset"];
|
|
18
18
|
export declare const buttonVariantValues: readonly ["primary", "secondary", "danger", "dangerSecondary", "floating", "floatingAction"];
|
|
19
|
-
export type
|
|
19
|
+
export type BaseButtonProps = {
|
|
20
20
|
/**
|
|
21
21
|
* The ref forwarded to the Button
|
|
22
22
|
*/
|
|
@@ -58,20 +58,10 @@ export type ButtonProps = {
|
|
|
58
58
|
* The click event handler for the Button
|
|
59
59
|
*/
|
|
60
60
|
onClick?: MuiButtonProps["onClick"];
|
|
61
|
-
} & ({
|
|
62
61
|
/**
|
|
63
|
-
* The
|
|
64
|
-
*/
|
|
65
|
-
endIcon?: ReactElement;
|
|
66
|
-
/**
|
|
67
|
-
* The text content of the Button
|
|
62
|
+
* The contents of the button. Only available internal to Odyssey here in BaseButton. If set, label is ignored.
|
|
68
63
|
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The icon element to display at the start of the Button
|
|
72
|
-
*/
|
|
73
|
-
startIcon?: ReactElement;
|
|
74
|
-
} | {
|
|
64
|
+
children?: ReactNode;
|
|
75
65
|
/**
|
|
76
66
|
* The icon element to display at the end of the Button
|
|
77
67
|
*/
|
|
@@ -79,25 +69,13 @@ export type ButtonProps = {
|
|
|
79
69
|
/**
|
|
80
70
|
* The text content of the Button
|
|
81
71
|
*/
|
|
82
|
-
label?: string
|
|
83
|
-
/**
|
|
84
|
-
* The icon element to display at the start of the Button
|
|
85
|
-
*/
|
|
86
|
-
startIcon: ReactElement;
|
|
87
|
-
} | {
|
|
88
|
-
/**
|
|
89
|
-
* The icon element to display at the end of the Button
|
|
90
|
-
*/
|
|
91
|
-
endIcon: ReactElement;
|
|
92
|
-
/**
|
|
93
|
-
* The text content of the Button
|
|
94
|
-
*/
|
|
95
|
-
label?: never;
|
|
72
|
+
label?: string;
|
|
96
73
|
/**
|
|
97
74
|
* The icon element to display at the start of the Button
|
|
98
75
|
*/
|
|
99
76
|
startIcon?: ReactElement;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
77
|
+
};
|
|
78
|
+
export type AdditionalBaseButtonProps = Pick<HtmlProps, "ariaControls" | "ariaDescribedBy" | "ariaExpanded" | "ariaHasPopup" | "ariaLabel" | "ariaLabelledBy" | "tabIndex" | "testId" | "translate">;
|
|
79
|
+
declare const MemoizedBaseButton: import("react").MemoExoticComponent<({ ariaControls, ariaDescribedBy, ariaExpanded, ariaHasPopup, ariaLabel, ariaLabelledBy, buttonRef, endIcon, href, id, isDisabled, isFullWidth: isFullWidthProp, label, children, onClick, size, startIcon, tabIndex, testId, tooltipText, translate, type, variant: variantProp, }: BaseButtonProps & AdditionalBaseButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
80
|
+
export { MemoizedBaseButton as BaseButton };
|
|
81
|
+
//# sourceMappingURL=BaseButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseButton.d.ts","sourceRoot":"","sources":["../../../src/Buttons/BaseButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EACL,cAAc,EAEd,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,eAAO,MAAM,gBAAgB,uCAAwC,CAAC;AACtE,eAAO,MAAM,gBAAgB,wCAAyC,CAAC;AACvE,eAAO,MAAM,mBAAmB,8FAOtB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;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