@okta/odyssey-react-mui 1.33.0 → 1.35.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/dist/cjs/Buttons/BaseButton.cjs +1 -1
- package/dist/cjs/Buttons/BaseButton.cjs.map +1 -1
- package/dist/cjs/Dialog.cjs +9 -1
- package/dist/cjs/Dialog.cjs.map +1 -1
- package/dist/cjs/Select.cjs +3 -1
- package/dist/cjs/Select.cjs.map +1 -1
- package/dist/cjs/Typography.cjs +8 -4
- package/dist/cjs/Typography.cjs.map +1 -1
- package/dist/cjs/labs/DatePickers/DateTimePicker.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/PickerWithOptionAdornment.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/SearchDropdown.cjs +269 -0
- package/dist/cjs/labs/OdysseyPickers/SearchDropdown.cjs.map +1 -0
- package/dist/cjs/labs/OdysseyPickers/index.cjs +9 -1
- package/dist/cjs/labs/OdysseyPickers/index.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +19 -6
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +2 -2
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs +3 -3
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +6 -0
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShellProvider.cjs +11 -8
- package/dist/cjs/ui-shell/UiShellProvider.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +2 -2
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +13 -0
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs +2 -1
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs.map +1 -1
- package/dist/esm/Buttons/BaseButton.js +1 -1
- package/dist/esm/Buttons/BaseButton.js.map +1 -1
- package/dist/esm/Dialog.js +9 -1
- package/dist/esm/Dialog.js.map +1 -1
- package/dist/esm/Select.js +3 -1
- package/dist/esm/Select.js.map +1 -1
- package/dist/esm/Typography.js +8 -4
- package/dist/esm/Typography.js.map +1 -1
- package/dist/esm/labs/DatePickers/DateTimePicker.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/PickerWithOptionAdornment.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/SearchDropdown.js +263 -0
- package/dist/esm/labs/OdysseyPickers/SearchDropdown.js.map +1 -0
- package/dist/esm/labs/OdysseyPickers/index.js +1 -0
- package/dist/esm/labs/OdysseyPickers/index.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +20 -7
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNav.js +2 -2
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js +3 -3
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +6 -0
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/UiShellProvider.js +9 -7
- package/dist/esm/ui-shell/UiShellProvider.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +13 -0
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/uiShellSharedConstants.js +1 -0
- package/dist/esm/ui-shell/uiShellSharedConstants.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.scss +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/types/Buttons/BaseButton.d.ts +1 -1
- package/dist/types/Dialog.d.ts.map +1 -1
- package/dist/types/Select.d.ts +1 -0
- package/dist/types/Select.d.ts.map +1 -1
- package/dist/types/Typography.d.ts +6 -2
- package/dist/types/Typography.d.ts.map +1 -1
- package/dist/types/labs/DatePickers/DateTimePicker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/SearchDropdown.d.ts +33 -0
- package/dist/types/labs/OdysseyPickers/SearchDropdown.d.ts.map +1 -0
- package/dist/types/labs/OdysseyPickers/index.d.ts +2 -0
- package/dist/types/labs/OdysseyPickers/index.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts +5 -20
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShellProvider.d.ts +33 -6
- package/dist/types/ui-shell/UiShellProvider.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +2 -0
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts +1 -0
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useUiShellContext = exports.UiShellProvider = void 0;
|
|
6
|
+
exports.useUiShellContext = exports.defaultSubscribeToCloseRightSideMenu = exports.defaultCloseSideNavMessageBus = exports.UiShellProvider = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _createContrastColors = require("../createContrastColors.cjs");
|
|
9
9
|
var _OdysseyDesignTokensContext = require("../OdysseyDesignTokensContext.cjs");
|
|
@@ -21,6 +21,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
const defaultCloseSideNavMessageBus = exports.defaultCloseSideNavMessageBus = (0, _createMessageBus.createMessageBus)();
|
|
25
|
+
const defaultSubscribeToCloseRightSideMenu = () => () => {};
|
|
26
|
+
exports.defaultSubscribeToCloseRightSideMenu = defaultSubscribeToCloseRightSideMenu;
|
|
24
27
|
const UiShellContext = (0, _react.createContext)(undefined);
|
|
25
28
|
const useUiShellContext = () => {
|
|
26
29
|
return (0, _react.useContext)(UiShellContext);
|
|
@@ -30,7 +33,10 @@ const UiShellProvider = ({
|
|
|
30
33
|
appBackgroundColor,
|
|
31
34
|
appBackgroundContrastMode = "lowContrast",
|
|
32
35
|
children,
|
|
36
|
+
closeSideNavMenu,
|
|
33
37
|
sideNavBackgroundColor,
|
|
38
|
+
subscribeToCloseRightSideMenu,
|
|
39
|
+
subscribeToCloseSideNavMenu,
|
|
34
40
|
topNavBackgroundColor
|
|
35
41
|
}) => {
|
|
36
42
|
const odysseyDesignTokens = (0, _OdysseyDesignTokensContext.useOdysseyDesignTokens)();
|
|
@@ -40,18 +46,15 @@ const UiShellProvider = ({
|
|
|
40
46
|
const defaultTopAndAppBackgroundColor = isAppBackgroundHightContrast ? odysseyDesignTokens.HueNeutralWhite : odysseyDesignTokens.HueNeutral50;
|
|
41
47
|
const topNavColor = topNavBackgroundColor || defaultTopAndAppBackgroundColor;
|
|
42
48
|
const appContentBackgroundColor = appBackgroundColor || defaultTopAndAppBackgroundColor;
|
|
43
|
-
const {
|
|
44
|
-
publish: publishSideNavItemClicked,
|
|
45
|
-
subscribe: subscribeSideNavItemClicked
|
|
46
|
-
} = (0, _react.useMemo)(() => (0, _createMessageBus.createMessageBus)(), []);
|
|
47
49
|
const memoizedContextValue = (0, _react.useMemo)(() => ({
|
|
48
50
|
appBackgroundColor: appContentBackgroundColor,
|
|
49
|
-
|
|
51
|
+
closeSideNavMenu: closeSideNavMenu ?? defaultCloseSideNavMessageBus.publish,
|
|
50
52
|
sideNavBackgroundColor: sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite,
|
|
51
53
|
sideNavContrastColors,
|
|
52
|
-
|
|
54
|
+
subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu ?? defaultCloseSideNavMessageBus.subscribe,
|
|
55
|
+
subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu ?? defaultSubscribeToCloseRightSideMenu,
|
|
53
56
|
topNavBackgroundColor: topNavColor
|
|
54
|
-
}), [appContentBackgroundColor, odysseyDesignTokens,
|
|
57
|
+
}), [appContentBackgroundColor, odysseyDesignTokens.HueNeutralWhite, closeSideNavMenu, sideNavBackgroundColor, sideNavContrastColors, subscribeToCloseRightSideMenu, subscribeToCloseSideNavMenu, topNavColor]);
|
|
55
58
|
return (0, _jsxRuntime.jsx)(UiShellContext.Provider, {
|
|
56
59
|
value: memoizedContextValue,
|
|
57
60
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiShellProvider.cjs","names":["_react","require","_createContrastColors","_OdysseyDesignTokensContext","_createMessageBus","_jsxRuntime","UiShellContext","createContext","undefined","useUiShellContext","useContext","
|
|
1
|
+
{"version":3,"file":"UiShellProvider.cjs","names":["_react","require","_createContrastColors","_OdysseyDesignTokensContext","_createMessageBus","_jsxRuntime","defaultCloseSideNavMessageBus","exports","createMessageBus","defaultSubscribeToCloseRightSideMenu","UiShellContext","createContext","undefined","useUiShellContext","useContext","UiShellProvider","appBackgroundColor","appBackgroundContrastMode","children","closeSideNavMenu","sideNavBackgroundColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","topNavBackgroundColor","odysseyDesignTokens","useOdysseyDesignTokens","defaultedSideNavBackgroundColor","HueNeutralWhite","sideNavContrastColors","generateContrastColors","isAppBackgroundHightContrast","defaultTopAndAppBackgroundColor","HueNeutral50","topNavColor","appContentBackgroundColor","memoizedContextValue","useMemo","publish","subscribe","jsx","Provider","value","MemoizedUiShellProvider","memo"],"sources":["../../../src/ui-shell/UiShellProvider.tsx"],"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 {\n createContext,\n memo,\n PropsWithChildren,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n ContrastColors,\n generateContrastColors,\n} from \"../createContrastColors.js\";\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { createMessageBus, MessageBus } from \"./createMessageBus.js\";\nimport { ContrastMode } from \"../useContrastMode.js\";\n\nexport const defaultCloseSideNavMessageBus = createMessageBus();\nexport const defaultSubscribeToCloseRightSideMenu = () => () => {};\n\nexport type UiShellColors = {\n /**\n * Sets a custom background color for the app content area.\n */\n appBackgroundColor: string;\n /**\n * Sets a custom background color for the side nav area.\n */\n sideNavBackgroundColor: string;\n sideNavContrastColors?: ContrastColors;\n /**\n * Sets a custom background color for the top nav area.\n */\n topNavBackgroundColor: string;\n};\n\nexport type UiShellContext = {\n /**\n * This is a callback that publishes a change to all subscribers listening for when to close the side nav.\n */\n closeSideNavMenu: MessageBus<void>[\"publish\"];\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 a publisher that asks us to close the side nav.\n */\n subscribeToCloseSideNavMenu: MessageBus<void>[\"subscribe\"];\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 a publisher that asks us to close the right-side menu.\n */\n subscribeToCloseRightSideMenu: MessageBus<void>[\"subscribe\"];\n} & UiShellColors;\n\nconst UiShellContext = createContext<UiShellContext | undefined>(undefined);\n\nexport const useUiShellContext = () => {\n return useContext(UiShellContext);\n};\n\nexport type UiShellProviderProps = {\n /**\n * Sets either a gray or white background color for the app content area.\n */\n appBackgroundContrastMode?: ContrastMode;\n} & Partial<UiShellContext>;\n\nconst UiShellProvider = ({\n appBackgroundColor,\n appBackgroundContrastMode = \"lowContrast\",\n children,\n closeSideNavMenu,\n sideNavBackgroundColor,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n topNavBackgroundColor,\n}: PropsWithChildren<UiShellProviderProps>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const defaultedSideNavBackgroundColor =\n sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite;\n\n const sideNavContrastColors =\n defaultedSideNavBackgroundColor !== odysseyDesignTokens.HueNeutralWhite\n ? generateContrastColors(\n defaultedSideNavBackgroundColor,\n odysseyDesignTokens,\n )\n : undefined;\n\n const isAppBackgroundHightContrast =\n appBackgroundContrastMode === \"highContrast\";\n\n const defaultTopAndAppBackgroundColor = isAppBackgroundHightContrast\n ? odysseyDesignTokens.HueNeutralWhite\n : odysseyDesignTokens.HueNeutral50;\n\n const topNavColor = topNavBackgroundColor || defaultTopAndAppBackgroundColor;\n\n const appContentBackgroundColor =\n appBackgroundColor || defaultTopAndAppBackgroundColor;\n\n const memoizedContextValue = useMemo(\n () => ({\n appBackgroundColor: appContentBackgroundColor,\n closeSideNavMenu:\n closeSideNavMenu ?? defaultCloseSideNavMessageBus.publish,\n sideNavBackgroundColor:\n sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite,\n sideNavContrastColors,\n subscribeToCloseSideNavMenu:\n subscribeToCloseSideNavMenu ?? defaultCloseSideNavMessageBus.subscribe,\n subscribeToCloseRightSideMenu:\n subscribeToCloseRightSideMenu ?? defaultSubscribeToCloseRightSideMenu,\n topNavBackgroundColor: topNavColor,\n }),\n [\n appContentBackgroundColor,\n odysseyDesignTokens.HueNeutralWhite,\n closeSideNavMenu,\n sideNavBackgroundColor,\n sideNavContrastColors,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n topNavColor,\n ],\n );\n\n return (\n <UiShellContext.Provider value={memoizedContextValue}>\n {children}\n </UiShellContext.Provider>\n );\n};\n\nconst MemoizedUiShellProvider = memo(UiShellProvider);\n\nexport { MemoizedUiShellProvider as UiShellProvider };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAAqE,IAAAI,WAAA,GAAAJ,OAAA;AAxBrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBO,MAAMK,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,IAAAE,kCAAgB,EAAC,CAAC;AACxD,MAAMC,oCAAoC,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAACF,OAAA,CAAAE,oCAAA,GAAAA,oCAAA;AAmCnE,MAAMC,cAAc,GAAG,IAAAC,oBAAa,EAA6BC,SAAS,CAAC;AAEpE,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACrC,OAAO,IAAAC,iBAAU,EAACJ,cAAc,CAAC;AACnC,CAAC;AAACH,OAAA,CAAAM,iBAAA,GAAAA,iBAAA;AASF,MAAME,eAAe,GAAGA,CAAC;EACvBC,kBAAkB;EAClBC,yBAAyB,GAAG,aAAa;EACzCC,QAAQ;EACRC,gBAAgB;EAChBC,sBAAsB;EACtBC,6BAA6B;EAC7BC,2BAA2B;EAC3BC;AACuC,CAAC,KAAK;EAC7C,MAAMC,mBAAmB,GAAG,IAAAC,kDAAsB,EAAC,CAAC;EACpD,MAAM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
|
@@ -14,6 +14,7 @@ var _index3 = require("./TopNav/index.cjs");
|
|
|
14
14
|
var _useScrollState = require("./useScrollState.cjs");
|
|
15
15
|
var _useMatchAppElementToUiShellAppArea = require("./useMatchAppElementToUiShellAppArea.cjs");
|
|
16
16
|
var _UiShellProvider = require("./UiShellProvider.cjs");
|
|
17
|
+
var _uiShellSharedConstants = require("./uiShellSharedConstants.cjs");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
/*!
|
|
@@ -28,7 +29,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
28
29
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
|
-
const emptySideNavItems = [];
|
|
32
32
|
const StyledAppContainer = (0, _styled.default)("div", {
|
|
33
33
|
shouldForwardProp: prop => prop !== "appBackgroundColor" && prop !== "odysseyDesignTokens"
|
|
34
34
|
})(({
|
|
@@ -123,7 +123,7 @@ const WideUiShellContent = ({
|
|
|
123
123
|
onError: onError,
|
|
124
124
|
children: (0, _jsxRuntime.jsx)(_index2.SideNav, {
|
|
125
125
|
isLoading: true,
|
|
126
|
-
sideNavItems: emptySideNavItems
|
|
126
|
+
sideNavItems: _uiShellSharedConstants.emptySideNavItems
|
|
127
127
|
})
|
|
128
128
|
}), sideNavProps && (0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
129
129
|
fallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WideUiShellContent.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactErrorBoundary","_index","_OdysseyDesignTokensContext","_index2","_index3","_useScrollState","_useMatchAppElementToUiShellAppArea","_UiShellProvider","_jsxRuntime","e","__esModule","default","emptySideNavItems","StyledAppContainer","styled","shouldForwardProp","prop","appBackgroundColor","gridArea","backgroundColor","StyledAppSwitcherContainer","StyledBannersContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","WideUiShellContent","appElement","appElementScrollingMode","appSwitcherProps","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","optionalComponents","sideNavProps","topNavProps","useOdysseyDesignTokens","uiShellContext","useUiShellContext","isContentScrolled","useScrollState","sideNavContainerRef","useRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","useMatchAppElementToUiShellAppArea","paddingMode","uiShellResizableRefs","jsxs","ref","children","jsx","banners","includes","ErrorBoundary","fallback","AppSwitcher","isLoading","appIcons","selectedAppName","undefined","SideNav","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","TopNav","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","isScrolled","tabIndex","MemoizedWideUiShellContent","exports","memo","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.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, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport { SideNav, type SideNavProps } from \"./SideNav/index.js\";\nimport { TopNav } from \"./TopNav/index.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { useMatchAppElementToUiShellAppArea } from \"./useMatchAppElementToUiShellAppArea.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\n\nconst emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"appBackgroundColor\" && prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n gridArea: \"app-content\",\n backgroundColor: appBackgroundColor,\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")({\n gridArea: \"app-switcher\",\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 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 type WideUiShellContentProps = UiShellNavComponentProps &\n UiShellContentProps;\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 WideUiShellContent = ({\n appElement,\n appElementScrollingMode,\n appSwitcherProps,\n hasStandardAppContentPadding = true,\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n sideNavProps,\n topNavProps,\n}: WideUiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const uiShellContext = useUiShellContext();\n\n const { isContentScrolled } = useScrollState(appElement);\n\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellAppAreaRef = useRef<HTMLDivElement>(null);\n\n const { parentContainerRef } = useMatchAppElementToUiShellAppArea({\n appElement,\n appElementScrollingMode,\n paddingMode: hasStandardAppContentPadding ? \"comfortable\" : \"none\",\n uiShellAppAreaRef,\n uiShellResizableRefs: [\n sideNavContainerRef,\n topNavContainerRef,\n uiShellAppAreaRef,\n ],\n });\n\n return (\n <StyledShellContainer\n odysseyDesignTokens={odysseyDesignTokens}\n ref={parentContainerRef}\n >\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\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav isLoading sideNavItems={emptySideNavItems} />\n </ErrorBoundary>\n )\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 ref={topNavContainerRef}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\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 appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={uiShellAppAreaRef}\n />\n </StyledShellContainer>\n );\n};\n\nconst MemoizedWideUiShellContent = memo(WideUiShellContent);\nMemoizedWideUiShellContent.displayName = \"WideUiShellContent\";\n\nexport { MemoizedWideUiShellContent as WideUiShellContent };\n"],"mappings":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AAQA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,mCAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AAAwE,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,uBAAAY,C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ACzD;MAAC,CACW,CAChB;IAAA,CACoB,CAAC,EAExB,IAAA1E,WAAA,CAAAsD,GAAA,EAACjD,kBAAkB;MACjBI,kBAAkB,EAAE8B,cAAc,EAAE9B,kBAAmB;MACvDmE,QAAQ,EAAE,CAAE;MACZxB,GAAG,EAAEN;IAAkB,CACxB,CAAC;EAAA,CACkB,CAAC;AAE3B,CAAC;AAED,MAAM+B,0BAA0B,GAAAC,OAAA,CAAApD,kBAAA,GAAG,IAAAqD,WAAI,EAACrD,kBAAkB,CAAC;AAC3DmD,0BAA0B,CAACG,WAAW,GAAG,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"WideUiShellContent.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactErrorBoundary","_index","_OdysseyDesignTokensContext","_index2","_index3","_useScrollState","_useMatchAppElementToUiShellAppArea","_UiShellProvider","_uiShellSharedConstants","_jsxRuntime","e","__esModule","default","StyledAppContainer","styled","shouldForwardProp","prop","appBackgroundColor","gridArea","backgroundColor","StyledAppSwitcherContainer","StyledBannersContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","WideUiShellContent","appElement","appElementScrollingMode","appSwitcherProps","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","optionalComponents","sideNavProps","topNavProps","useOdysseyDesignTokens","uiShellContext","useUiShellContext","isContentScrolled","useScrollState","sideNavContainerRef","useRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","useMatchAppElementToUiShellAppArea","paddingMode","uiShellResizableRefs","jsxs","ref","children","jsx","banners","includes","ErrorBoundary","fallback","AppSwitcher","isLoading","appIcons","selectedAppName","undefined","SideNav","sideNavItems","emptySideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","TopNav","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","isScrolled","tabIndex","MemoizedWideUiShellContent","exports","memo","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.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, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport { SideNav } from \"./SideNav/index.js\";\nimport { TopNav } from \"./TopNav/index.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { useMatchAppElementToUiShellAppArea } from \"./useMatchAppElementToUiShellAppArea.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\nimport { emptySideNavItems } from \"./uiShellSharedConstants.js\";\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"appBackgroundColor\" && prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n gridArea: \"app-content\",\n backgroundColor: appBackgroundColor,\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")({\n gridArea: \"app-switcher\",\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 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 type WideUiShellContentProps = UiShellNavComponentProps &\n UiShellContentProps;\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 WideUiShellContent = ({\n appElement,\n appElementScrollingMode,\n appSwitcherProps,\n hasStandardAppContentPadding = true,\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n sideNavProps,\n topNavProps,\n}: WideUiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const uiShellContext = useUiShellContext();\n\n const { isContentScrolled } = useScrollState(appElement);\n\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellAppAreaRef = useRef<HTMLDivElement>(null);\n\n const { parentContainerRef } = useMatchAppElementToUiShellAppArea({\n appElement,\n appElementScrollingMode,\n paddingMode: hasStandardAppContentPadding ? \"comfortable\" : \"none\",\n uiShellAppAreaRef,\n uiShellResizableRefs: [\n sideNavContainerRef,\n topNavContainerRef,\n uiShellAppAreaRef,\n ],\n });\n\n return (\n <StyledShellContainer\n odysseyDesignTokens={odysseyDesignTokens}\n ref={parentContainerRef}\n >\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\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav isLoading sideNavItems={emptySideNavItems} />\n </ErrorBoundary>\n )\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 ref={topNavContainerRef}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\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 appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={uiShellAppAreaRef}\n />\n </StyledShellContainer>\n );\n};\n\nconst MemoizedWideUiShellContent = memo(WideUiShellContent);\nMemoizedWideUiShellContent.displayName = \"WideUiShellContent\";\n\nexport { MemoizedWideUiShellContent as WideUiShellContent };\n"],"mappings":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AAQA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,mCAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AAAgE,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA9BhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBA,MAAMG,kBAAkB,GAAG,IAAAC,eAAM,EAAC,KAAK,EAAE;EACvCC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,oBAAoB,IAAIA,IAAI,KAAK;AAC9C,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAmB,CAAC,MAAM;EAC9BC,QAAQ,EAAE,aAAa;EACvBC,eAAe,EAAEF;AACnB,CAAC,CAAC,CAAC;AAEH,MAAMG,0BAA0B,GAAG,IAAAN,eAAM,EAAC,KAAK,CAAC,CAAC;EAC/CI,QAAQ,EAAE;AACZ,CAAC,CAAC;AAEF,MAAMG,sBAAsB,GAAG,IAAAP,eAAM,EAAC,KAAK,C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mBAAA,CAAAiE,aAAa;QAACC,QAAQ,EAAE,IAAK;QAAC1B,OAAO,EAAEA,OAAQ;QAAAqB,QAAA,EAC9C,IAAApD,WAAA,CAAAqD,GAAA,EAAC1D,OAAA,CAAA2E,MAAM;UACLC,iBAAiB,EAAErC,kBAAkB,EAAEsC,cAAe;UACtDC,kBAAkB,EAAEvC,kBAAkB,EAAEwC;QAAgB,CACzD;MAAC,CACW,CAChB,EAGJtC,WAAW,IACV,IAAApC,WAAA,CAAAqD,GAAA,EAAC9D,mBAAA,CAAAiE,aAAa;QAACC,QAAQ,EAAE,IAAK;QAAC1B,OAAO,EAAEA,OAAQ;QAAAqB,QAAA,EAC9C,IAAApD,WAAA,CAAAqD,GAAA,EAAC1D,OAAA,CAAA2E,MAAM;UAAA,GACDlC,WAAW;UACfuC,UAAU,EAAEnC,iBAAkB;UAC9B+B,iBAAiB,EAAErC,kBAAkB,EAAEsC,cAAe;UACtDC,kBAAkB,EAAEvC,kBAAkB,EAAEwC;QAAgB,CACzD;MAAC,CACW,CAChB;IAAA,CACoB,CAAC,EAExB,IAAA1E,WAAA,CAAAqD,GAAA,EAACjD,kBAAkB;MACjBI,kBAAkB,EAAE8B,cAAc,EAAE9B,kBAAmB;MACvDoE,QAAQ,EAAE,CAAE;MACZzB,GAAG,EAAEN;IAAkB,CACxB,CAAC;EAAA,CACkB,CAAC;AAE3B,CAAC;AAED,MAAMgC,0BAA0B,GAAAC,OAAA,CAAArD,kBAAA,GAAG,IAAAsD,WAAI,EAACtD,kBAAkB,CAAC;AAC3DoD,0BAA0B,CAACG,WAAW,GAAG,oBAAoB","ignoreList":[]}
|
|
@@ -56,6 +56,14 @@ const renderUiShell = ({
|
|
|
56
56
|
publish: publishPropChanges,
|
|
57
57
|
subscribe: subscribeToReactAppSubscribed
|
|
58
58
|
});
|
|
59
|
+
const {
|
|
60
|
+
publish: closeRightSideMenu,
|
|
61
|
+
subscribe: subscribeToCloseRightSideMenu
|
|
62
|
+
} = (0, _createMessageBus.createMessageBus)();
|
|
63
|
+
const {
|
|
64
|
+
publish: closeSideNavMenu,
|
|
65
|
+
subscribe: subscribeToCloseSideNavMenu
|
|
66
|
+
} = (0, _createMessageBus.createMessageBus)();
|
|
59
67
|
const slottedElements = Object.fromEntries(Object.entries(optionalComponentSlotNames).map(([optionalComponentKey, slotName]) => {
|
|
60
68
|
const element = document.createElement("div");
|
|
61
69
|
element.setAttribute("slot", slotName);
|
|
@@ -73,6 +81,7 @@ const renderUiShell = ({
|
|
|
73
81
|
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
74
82
|
appElement: appElement,
|
|
75
83
|
appElementScrollingMode: appElementScrollingMode,
|
|
84
|
+
closeSideNavMenu: closeSideNavMenu,
|
|
76
85
|
hasStandardAppContentPadding: hasStandardAppContentPadding,
|
|
77
86
|
initialVisibleSections: initialVisibleSections,
|
|
78
87
|
onError: onError,
|
|
@@ -81,6 +90,8 @@ const renderUiShell = ({
|
|
|
81
90
|
name: slotName
|
|
82
91
|
})])),
|
|
83
92
|
sideNavBackgroundColor: sideNavBackgroundColor,
|
|
93
|
+
subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu,
|
|
94
|
+
subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu,
|
|
84
95
|
subscribeToPropChanges: subscribeToPropChanges,
|
|
85
96
|
topNavBackgroundColor: topNavBackgroundColor,
|
|
86
97
|
uiShellAppElement: reactRootElements.appRootElement,
|
|
@@ -93,6 +104,8 @@ const renderUiShell = ({
|
|
|
93
104
|
parentElement.appendChild(appElement);
|
|
94
105
|
return {
|
|
95
106
|
appElement,
|
|
107
|
+
closeRightSideMenu,
|
|
108
|
+
closeSideNavMenu,
|
|
96
109
|
setComponentProps: publishAfterReactAppReadyForProps,
|
|
97
110
|
slottedElements,
|
|
98
111
|
uiShellElement
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","appendChild","setComponentProps"],"sources":["../../../src/ui-shell/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.js\";\nimport { createMessageBus } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\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 appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n parentElement,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n}: {\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 container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || 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 parentElement.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 = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentParentElement: parentElement,\n webComponentChildren,\n });\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GA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AChB;IACDC,yBAAyB,EAAE1C,aAAa;IACxCwB;EACF,CAAC,CAAC;EAEFxB,aAAa,CAAC2C,WAAW,CAACnD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVoD,iBAAiB,EAAE9B,iCAAiC;IACpDE,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAC3C,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","appendChild","setComponentProps"],"sources":["../../../src/ui-shell/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.js\";\nimport { createMessageBus } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\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 appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n parentElement,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n}: {\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 container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || 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 parentElement.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 {\n publish: closeRightSideMenu,\n subscribe: subscribeToCloseRightSideMenu,\n } = createMessageBus();\n\n const { publish: closeSideNavMenu, subscribe: subscribeToCloseSideNavMenu } =\n createMessageBus();\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 = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n closeSideNavMenu={closeSideNavMenu}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentParentElement: parentElement,\n webComponentChildren,\n });\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AAA0F,IAAAM,WAAA,GAAAN,OAAA;AApB1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMO,0BAGZ,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EACFE,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AAWM,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,kBAAkB;EAClBC,yBAAyB;EACzBC,UAAU,EAAEC,kBAAkB;EAC9BC,uBAAuB;EACvBC,4BAA4B;EAC5BC,sBAAsB;EACtBC,OAAO,GAAGC,OAAO,CAACC,KAAK;EACvBC,aAAa;EACbC,sBAAsB;EACtBC;AAoBwC,CAAC,KAAK;EAC9C,MAAMV,UAAU,GAAGC,kBA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OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.UI_SHELL_OVERLAY_Z_INDEX = exports.UI_SHELL_BASE_Z_INDEX = exports.TOP_NAV_HEIGHT = exports.SIDE_NAV_WIDTH = exports.SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = void 0;
|
|
6
|
+
exports.emptySideNavItems = exports.UI_SHELL_OVERLAY_Z_INDEX = exports.UI_SHELL_BASE_Z_INDEX = exports.TOP_NAV_HEIGHT = exports.SIDE_NAV_WIDTH = exports.SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = void 0;
|
|
7
7
|
/*!
|
|
8
8
|
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
9
9
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -19,4 +19,5 @@ const SIDE_NAV_WIDTH = exports.SIDE_NAV_WIDTH = "300px";
|
|
|
19
19
|
const TOP_NAV_HEIGHT = exports.TOP_NAV_HEIGHT = `${64 / 14}rem`;
|
|
20
20
|
const UI_SHELL_BASE_Z_INDEX = exports.UI_SHELL_BASE_Z_INDEX = 100;
|
|
21
21
|
const UI_SHELL_OVERLAY_Z_INDEX = exports.UI_SHELL_OVERLAY_Z_INDEX = 200;
|
|
22
|
+
const emptySideNavItems = exports.emptySideNavItems = [];
|
|
22
23
|
//# sourceMappingURL=uiShellSharedConstants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiShellSharedConstants.cjs","names":["SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION","exports","SIDE_NAV_WIDTH","TOP_NAV_HEIGHT","UI_SHELL_BASE_Z_INDEX","UI_SHELL_OVERLAY_Z_INDEX"],"sources":["../../../src/ui-shell/uiShellSharedConstants.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-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\n// It's important to bring all our constant values together, so we can change them in one location and ensure the values are all correct relative to each other.\n// This also lends us the capability of swapping these out for a more robust solution in the future.\n\n/* The side nav collapse icon is placed absolutely from the top (Logo container + nav header height) to align it in the middle of the nav header text */\nexport const SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = \"77px\";\n\nexport const SIDE_NAV_WIDTH = \"300px\";\n\nexport const TOP_NAV_HEIGHT = `${64 / 14}rem`;\n\nexport const UI_SHELL_BASE_Z_INDEX = 100;\n\nexport const UI_SHELL_OVERLAY_Z_INDEX = 200;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"file":"uiShellSharedConstants.cjs","names":["SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION","exports","SIDE_NAV_WIDTH","TOP_NAV_HEIGHT","UI_SHELL_BASE_Z_INDEX","UI_SHELL_OVERLAY_Z_INDEX","emptySideNavItems"],"sources":["../../../src/ui-shell/uiShellSharedConstants.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-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 { SideNavProps } from \"./SideNav/types.js\";\n\n// It's important to bring all our constant values together, so we can change them in one location and ensure the values are all correct relative to each other.\n// This also lends us the capability of swapping these out for a more robust solution in the future.\n\n/* The side nav collapse icon is placed absolutely from the top (Logo container + nav header height) to align it in the middle of the nav header text */\nexport const SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = \"77px\";\n\nexport const SIDE_NAV_WIDTH = \"300px\";\n\nexport const TOP_NAV_HEIGHT = `${64 / 14}rem`;\n\nexport const UI_SHELL_BASE_Z_INDEX = 100;\n\nexport const UI_SHELL_OVERLAY_Z_INDEX = 200;\n\nexport const emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAQO,MAAMA,wCAAwC,GAAAC,OAAA,CAAAD,wCAAA,GAAG,MAAM;AAEvD,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO;AAE9B,MAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK;AAEtC,MAAMC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,GAAG,GAAG;AAEjC,MAAMC,wBAAwB,GAAAJ,OAAA,CAAAI,wBAAA,GAAG,GAAG;AAEpC,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAG,EAAyC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","useButton","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","buttonSizeValues","buttonTypeValues","buttonVariantValues","BaseButton","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","muiProps","localButtonRef","buttonContext","focus","current","renderButton","_Button","disabled","fullWidth","ref","element","ariaType","placement","text","Consumer","MemoizedBaseButton","displayName"],"sources":["../../../src/Buttons/BaseButton.tsx"],"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 { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n ReactNode,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useButton } from \"./ButtonContext.js\";\nimport type { HtmlProps } from \"../HtmlProps.js\";\nimport { FocusHandle } from \"../inputUtils.js\";\nimport {\n MuiPropsContext,\n MuiPropsContextType,\n useMuiProps,\n} from \"../MuiPropsContext.js\";\nimport { Tooltip } from \"../Tooltip.js\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"danger\",\n \"dangerSecondary\",\n \"floating\",\n \"floatingAction\",\n] as const;\n\nexport type BaseButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * Optional href to render the button as a link\n */\n href?: string;\n /**\n * The ID of the Button\n */\n id?: string;\n /**\n * Determines whether the Button is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Button should take up the full available width\n */\n isFullWidth?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n /**\n * The type of the HTML button element\n */\n type?: (typeof buttonTypeValues)[number];\n /**\n * The variant of the Button\n */\n variant: (typeof buttonVariantValues)[number] | \"tertiary\";\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * The contents of the button. Only available internal to Odyssey here in BaseButton. If set, label is ignored.\n */\n children?: ReactNode;\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The text content of the Button\n */\n label?: string;\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n};\n\n// These are split and exported separately from the above because wrappers of this (e.g. Button) will\n// want to omit children, which they cannot do from the combined union type. Instead, they should\n// omit from BaseButtonProps, then union with the AdditionalBaseButtonProps (as seen in Button)\nexport type AdditionalBaseButtonProps = Pick<\n HtmlProps,\n | \"ariaControls\"\n | \"ariaDescribedBy\"\n | \"ariaExpanded\"\n | \"ariaHasPopup\"\n | \"ariaLabel\"\n | \"ariaLabelledBy\"\n | \"tabIndex\"\n | \"testId\"\n | \"translate\"\n>;\n\nconst BaseButton = ({\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n buttonRef,\n endIcon,\n href,\n id,\n isDisabled,\n isFullWidth: isFullWidthProp,\n label = \"\",\n children,\n onClick,\n size = \"medium\",\n startIcon,\n tabIndex,\n testId,\n tooltipText,\n translate,\n type = \"button\",\n variant: variantProp,\n}: BaseButtonProps & AdditionalBaseButtonProps) => {\n const muiProps = useMuiProps();\n\n // We're deprecating the \"tertiary\" variant, so map it to\n // \"secondary\" in lieu of making a breaking change\n const variant = variantProp === \"tertiary\" ? \"secondary\" : variantProp;\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const buttonContext = useButton();\n const isFullWidth = useMemo(\n () =>\n buttonContext.isFullWidth ? buttonContext.isFullWidth : isFullWidthProp,\n [buttonContext, isFullWidthProp],\n );\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <MuiButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n data-se={testId}\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n href={href}\n id={id}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<\n HTMLButtonElement | HTMLAnchorElement\n >\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n size={size}\n startIcon={startIcon}\n tabIndex={tabIndex}\n translate={translate}\n type={type}\n variant={variant}\n >\n {children ?? label}\n </MuiButton>\n );\n },\n [\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n endIcon,\n href,\n id,\n isDisabled,\n isFullWidth,\n label,\n children,\n onClick,\n size,\n startIcon,\n tabIndex,\n testId,\n translate,\n type,\n variant,\n ],\n );\n\n if (tooltipText) {\n return (\n <Tooltip ariaType=\"description\" placement=\"top\" text={tooltipText}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n }\n\n return renderButton(muiProps);\n};\n\nconst MemoizedBaseButton = memo(BaseButton);\nMemoizedBaseButton.displayName = \"BaseButton\";\n\nexport { MemoizedBaseButton as BaseButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EAGJC,WAAW,EACXC,mB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H,WAAW,EAAE;IACf,OACEzB,IAAA,CAACF,OAAO;MAAC2C,QAAQ,EAAC,aAAa;MAACC,SAAS,EAAC,KAAK;MAACC,IAAI,EAAElB,WAAY;MAAAN,QAAA,EAChEnB,IAAA,CAACJ,eAAe,CAACgD,QAAQ;QAAAzB,QAAA,EAAEgB;MAAY,CAA2B;IAAC,CAC5D,CAAC;EAEd;EAEA,OAAOA,YAAY,CAACL,QAAQ,CAAC;AAC/B,CAAC;AAED,MAAMe,kBAAkB,GAAGvD,IAAI,CAACc,UAAU,CAAC;AAC3CyC,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIzC,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BaseButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","useButton","MuiPropsContext","useMuiProps","Tooltip","jsx","_jsx","buttonSizeValues","buttonTypeValues","buttonVariantValues","BaseButton","ariaControls","ariaDescribedBy","ariaExpanded","ariaHasPopup","ariaLabel","ariaLabelledBy","buttonRef","children","endIcon","href","id","isDisabled","isFullWidth","isFullWidthProp","label","onClick","size","startIcon","tabIndex","testId","tooltipText","translate","type","variant","variantProp","muiProps","localButtonRef","buttonContext","focus","current","renderButton","_Button","disabled","fullWidth","ref","element","ariaType","placement","text","Consumer","MemoizedBaseButton","displayName"],"sources":["../../../src/Buttons/BaseButton.tsx"],"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 { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n ReactElement,\n ReactNode,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport { useButton } from \"./ButtonContext.js\";\nimport type { HtmlProps } from \"../HtmlProps.js\";\nimport { FocusHandle } from \"../inputUtils.js\";\nimport {\n MuiPropsContext,\n MuiPropsContextType,\n useMuiProps,\n} from \"../MuiPropsContext.js\";\nimport { Tooltip } from \"../Tooltip.js\";\n\nexport const buttonSizeValues = [\"small\", \"medium\", \"large\"] as const;\nexport const buttonTypeValues = [\"button\", \"submit\", \"reset\"] as const;\nexport const buttonVariantValues = [\n \"primary\",\n \"secondary\",\n \"danger\",\n \"dangerSecondary\",\n \"floating\",\n \"floatingAction\",\n] as const;\n\nexport type BaseButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * Optional href to render the button as a link\n */\n href?: string;\n /**\n * The ID of the Button\n */\n id?: string;\n /**\n * Determines whether the Button is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Button should take up the full available width\n */\n isFullWidth?: boolean;\n /**\n * The size of the button\n */\n size?: (typeof buttonSizeValues)[number];\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The tooltip text for the Button if it's icon-only\n */\n tooltipText?: string;\n /**\n * The type of the HTML button element\n */\n type?: (typeof buttonTypeValues)[number];\n /**\n * The variant of the Button\n */\n variant: (typeof buttonVariantValues)[number] | \"tertiary\";\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * The contents of the button. Only available internal to Odyssey here in BaseButton. If set, label is ignored.\n */\n children?: ReactNode;\n /**\n * The icon element to display at the end of the Button\n */\n endIcon?: ReactElement;\n /**\n * The text content of the Button\n */\n label?: string;\n /**\n * The icon element to display at the start of the Button\n */\n startIcon?: ReactElement;\n};\n\n// These are split and exported separately from the above because wrappers of this (e.g. Button) will\n// want to omit children, which they cannot do from the combined union type. Instead, they should\n// omit from BaseButtonProps, then union with the AdditionalBaseButtonProps (as seen in Button)\nexport type AdditionalBaseButtonProps = Pick<\n HtmlProps,\n | \"ariaControls\"\n | \"ariaDescribedBy\"\n | \"ariaExpanded\"\n | \"ariaHasPopup\"\n | \"ariaLabel\"\n | \"ariaLabelledBy\"\n | \"tabIndex\"\n | \"testId\"\n | \"translate\"\n>;\n\nconst BaseButton = ({\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n buttonRef,\n children,\n endIcon,\n href,\n id,\n isDisabled,\n isFullWidth: isFullWidthProp,\n label = \"\",\n onClick,\n size = \"medium\",\n startIcon,\n tabIndex,\n testId,\n tooltipText,\n translate,\n type = \"button\",\n variant: variantProp,\n}: BaseButtonProps & AdditionalBaseButtonProps) => {\n const muiProps = useMuiProps();\n\n // We're deprecating the \"tertiary\" variant, so map it to\n // \"secondary\" in lieu of making a breaking change\n const variant = variantProp === \"tertiary\" ? \"secondary\" : variantProp;\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const buttonContext = useButton();\n const isFullWidth = useMemo(\n () =>\n buttonContext.isFullWidth ? buttonContext.isFullWidth : isFullWidthProp,\n [buttonContext, isFullWidthProp],\n );\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <MuiButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n data-se={testId}\n disabled={isDisabled}\n endIcon={endIcon}\n fullWidth={isFullWidth}\n href={href}\n id={id}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<\n HTMLButtonElement | HTMLAnchorElement\n >\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n size={size}\n startIcon={startIcon}\n tabIndex={tabIndex}\n translate={translate}\n type={type}\n variant={variant}\n >\n {children ?? label}\n </MuiButton>\n );\n },\n [\n ariaControls,\n ariaDescribedBy,\n ariaExpanded,\n ariaHasPopup,\n ariaLabel,\n ariaLabelledBy,\n endIcon,\n href,\n id,\n isDisabled,\n isFullWidth,\n label,\n children,\n onClick,\n size,\n startIcon,\n tabIndex,\n testId,\n translate,\n type,\n variant,\n ],\n );\n\n if (tooltipText) {\n return (\n <Tooltip ariaType=\"description\" placement=\"top\" text={tooltipText}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n }\n\n return renderButton(muiProps);\n};\n\nconst MemoizedBaseButton = memo(BaseButton);\nMemoizedBaseButton.displayName = \"BaseButton\";\n\nexport { MemoizedBaseButton as BaseButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EAGJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AAEd,SAASC,SAAS,QAAQ,oBAAoB;AAG9C,SACEC,eAAe,EAEfC,WAAW,QACN,uBAAuB;AAC9B,SAASC,OAAO,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExC,OAAO,MAAMC,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AACrE,OAAO,MAAMC,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAU;AACtE,OAAO,MAAMC,mBAAmB,GAAG,CACjC,SAAS,EACT,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,gBAAgB,CACR;AA8EV,MAAMC,UAAU,GAAGA,CAAC;EAClBC,YAAY;EACZC,eAAe;EACfC,YAAY;EACZC,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ACPK,OAAO,EAAEA,OAAQ;MACjBmB,GAAG,EAAGC,OAAO,IAAK;QAChB,IAAIA,OAAO,EAAE;UAETT,cAAc,CAGdG,OAAO,GAAGM,OAAO;UAEnBV,QAAQ,EAAES,GAAG,GAAGC,OAAO,CAAC;QAC1B;MACF,CAAE;MACFnB,IAAI,EAAEA,IAAK;MACXC,SAAS,EAAEA,SAAU;MACrBC,QAAQ,EAAEA,QAAS;MACnBG,SAAS,EAAEA,SAAU;MACrBC,IAAI,EAAEA,IAAK;MACXC,OAAO,EAAEA,OAAQ;MAAAhB,QAAA,EAEhBA,QAAQ,IAAIO;IAAK,CACT,CAAC;EAEhB,CAAC,EACD,CACEd,YAAY,EACZC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,cAAc,EACdG,OAAO,EACPC,IAAI,EACJC,EAAE,EACFC,UAAU,EACVC,WAAW,EACXE,KAAK,EACLP,QAAQ,EACRQ,OAAO,EACPC,IAAI,EACJC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNE,SAAS,EACTC,IAAI,EACJC,OAAO,CAEX,CAAC;EAED,IAAIH,WAAW,EAAE;IACf,OACEzB,IAAA,CAACF,OAAO;MAAC2C,QAAQ,EAAC,aAAa;MAACC,SAAS,EAAC,KAAK;MAACC,IAAI,EAAElB,WAAY;MAAAb,QAAA,EAChEZ,IAAA,CAACJ,eAAe,CAACgD,QAAQ;QAAAhC,QAAA,EAAEuB;MAAY,CAA2B;IAAC,CAC5D,CAAC;EAEd;EAEA,OAAOA,YAAY,CAACL,QAAQ,CAAC;AAC/B,CAAC;AAED,MAAMe,kBAAkB,GAAGvD,IAAI,CAACc,UAAU,CAAC;AAC3CyC,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIzC,UAAU","ignoreList":[]}
|
package/dist/esm/Dialog.js
CHANGED
|
@@ -19,6 +19,7 @@ import { useTranslation } from "react-i18next";
|
|
|
19
19
|
import { Button } from "./Buttons/index.js";
|
|
20
20
|
import { CloseIcon } from "./icons.generated/index.js";
|
|
21
21
|
import { cloneElement, memo, useState, useEffect, useRef } from "react";
|
|
22
|
+
import { useUniqueId } from "./useUniqueId.js";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
const Dialog = ({
|
|
24
25
|
primaryCallToActionComponent,
|
|
@@ -39,6 +40,8 @@ const Dialog = ({
|
|
|
39
40
|
} = useTranslation();
|
|
40
41
|
const [isContentScrollable, setIsContentScrollable] = useState(false);
|
|
41
42
|
const dialogContentRef = useRef(null);
|
|
43
|
+
const dialogTitleId = useUniqueId();
|
|
44
|
+
const dialogLabelId = useUniqueId();
|
|
42
45
|
useEffect(() => {
|
|
43
46
|
let frameId;
|
|
44
47
|
const handleContentScroll = () => {
|
|
@@ -64,9 +67,14 @@ const Dialog = ({
|
|
|
64
67
|
"data-se": testId,
|
|
65
68
|
open: isOpen,
|
|
66
69
|
onClose: onClose,
|
|
70
|
+
"aria-labelledby": dialogLabelId,
|
|
67
71
|
children: [_jsxs(_DialogTitle, {
|
|
72
|
+
id: dialogTitleId,
|
|
68
73
|
translate: translate,
|
|
69
|
-
children: [
|
|
74
|
+
children: [_jsx("span", {
|
|
75
|
+
id: dialogLabelId,
|
|
76
|
+
children: title
|
|
77
|
+
}), _jsx(Button, {
|
|
70
78
|
ariaLabel: t("close.text"),
|
|
71
79
|
onClick: onClose,
|
|
72
80
|
size: "small",
|
package/dist/esm/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["useTranslation","Button","CloseIcon","cloneElement","memo","useState","useEffect","useRef","jsx","_jsx","jsxs","_jsxs","Dialog","primaryCallToActionComponent","secondaryCallToActionComponent","tertiaryCallToActionComponent","callToActionFirstComponent","callToActionSecondComponent","callToActionLastComponent","children","isOpen","onClose","testId","title","translate","t","isContentScrollable","setIsContentScrollable","dialogContentRef","frameId","handleContentScroll","dialogContentElement","current","cancelAnimationFrame","scrollHeight","clientHeight","requestAnimationFrame","content","_DialogContentText","actionButtons","filter","Boolean","_Dialog","open","_DialogTitle","ariaLabel","onClick","size","startIcon","variant","_DialogContent","tabIndex","dividers","ref","length","_DialogActions","map","actionButton","index","key","MemoizedDialog","displayName"],"sources":["../../src/Dialog.tsx"],"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 { useTranslation } from \"react-i18next\";\nimport {\n Dialog as MuiDialog,\n DialogTitle,\n DialogContent,\n DialogContentText,\n DialogActions,\n} from \"@mui/material\";\nimport { Button } from \"./Buttons/index.js\";\nimport { CloseIcon } from \"./icons.generated/index.js\";\nimport {\n cloneElement,\n memo,\n useState,\n useEffect,\n useRef,\n ReactElement,\n ReactNode,\n} from \"react\";\n\nimport type { HtmlProps } from \"./HtmlProps.js\";\n\nexport type DialogProps = {\n /**\n * @deprecated `aria-label` for close button comes from translation file\n */\n ariaLabel?: string;\n\n /**\n * An optional Button object to be situated in the Dialog footer as the primary call to action.\n */\n primaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `primaryCallToActionComponent` instead.\n */\n callToActionFirstComponent?: ReactElement<typeof Button>;\n /**\n * An optional Button object to be situated in the Dialog footer as the secondary call to action, alongside the `primaryCallToActionComponent`.\n */\n secondaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `secondaryCallToActionComponent` instead.\n */\n callToActionSecondComponent?: ReactElement<typeof Button>;\n /**\n * An optional Button object to be situated in the Dialog footer as the tertiary call to action, alongside the other `callToAction` components.\n */\n tertiaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `tertiaryCallToActionComponent` instead.\n */\n callToActionLastComponent?: ReactElement<typeof Button>;\n /**\n * The content of the Dialog. May be a `string` or any other `ReactNode` or array of `ReactNode`s.\n */\n children: ReactNode;\n\n /**\n * When set to `true`, the Dialog will be visible.\n */\n isOpen: boolean;\n\n /**\n * Callback that controls what happens when the Dialog is dismissed.\n */\n onClose: () => void;\n\n /**\n * The title of the Dialog.\n */\n title: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Dialog = ({\n primaryCallToActionComponent,\n secondaryCallToActionComponent,\n tertiaryCallToActionComponent,\n callToActionFirstComponent,\n callToActionSecondComponent,\n callToActionLastComponent,\n children,\n isOpen,\n onClose,\n testId,\n title,\n translate,\n}: DialogProps) => {\n const { t } = useTranslation();\n const [isContentScrollable, setIsContentScrollable] = useState(false);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let frameId: number;\n\n const handleContentScroll = () => {\n const dialogContentElement = dialogContentRef.current;\n if (dialogContentElement) {\n cancelAnimationFrame(frameId);\n setIsContentScrollable(\n dialogContentElement.scrollHeight > dialogContentElement.clientHeight,\n );\n }\n frameId = requestAnimationFrame(handleContentScroll);\n };\n\n if (isOpen) {\n frameId = requestAnimationFrame(handleContentScroll);\n }\n\n return () => {\n cancelAnimationFrame(frameId);\n };\n }, [isOpen]);\n\n const content =\n typeof children === \"string\" ? (\n <DialogContentText>{children}</DialogContentText>\n ) : (\n children\n );\n\n // Prioritize new action button format (|| used as a fallback)\n const actionButtons = [\n tertiaryCallToActionComponent || callToActionLastComponent,\n secondaryCallToActionComponent || callToActionSecondComponent,\n primaryCallToActionComponent || callToActionFirstComponent,\n ].filter(Boolean);\n\n return (\n <MuiDialog
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["useTranslation","Button","CloseIcon","cloneElement","memo","useState","useEffect","useRef","useUniqueId","jsx","_jsx","jsxs","_jsxs","Dialog","primaryCallToActionComponent","secondaryCallToActionComponent","tertiaryCallToActionComponent","callToActionFirstComponent","callToActionSecondComponent","callToActionLastComponent","children","isOpen","onClose","testId","title","translate","t","isContentScrollable","setIsContentScrollable","dialogContentRef","dialogTitleId","dialogLabelId","frameId","handleContentScroll","dialogContentElement","current","cancelAnimationFrame","scrollHeight","clientHeight","requestAnimationFrame","content","_DialogContentText","actionButtons","filter","Boolean","_Dialog","open","_DialogTitle","id","ariaLabel","onClick","size","startIcon","variant","_DialogContent","tabIndex","dividers","ref","length","_DialogActions","map","actionButton","index","key","MemoizedDialog","displayName"],"sources":["../../src/Dialog.tsx"],"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 { useTranslation } from \"react-i18next\";\nimport {\n Dialog as MuiDialog,\n DialogTitle,\n DialogContent,\n DialogContentText,\n DialogActions,\n} from \"@mui/material\";\nimport { Button } from \"./Buttons/index.js\";\nimport { CloseIcon } from \"./icons.generated/index.js\";\nimport {\n cloneElement,\n memo,\n useState,\n useEffect,\n useRef,\n ReactElement,\n ReactNode,\n} from \"react\";\n\nimport type { HtmlProps } from \"./HtmlProps.js\";\nimport { useUniqueId } from \"./useUniqueId.js\";\n\nexport type DialogProps = {\n /**\n * @deprecated `aria-label` for close button comes from translation file\n */\n ariaLabel?: string;\n\n /**\n * An optional Button object to be situated in the Dialog footer as the primary call to action.\n */\n primaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `primaryCallToActionComponent` instead.\n */\n callToActionFirstComponent?: ReactElement<typeof Button>;\n /**\n * An optional Button object to be situated in the Dialog footer as the secondary call to action, alongside the `primaryCallToActionComponent`.\n */\n secondaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `secondaryCallToActionComponent` instead.\n */\n callToActionSecondComponent?: ReactElement<typeof Button>;\n /**\n * An optional Button object to be situated in the Dialog footer as the tertiary call to action, alongside the other `callToAction` components.\n */\n tertiaryCallToActionComponent?: ReactElement<typeof Button>;\n /**\n * @deprecated Will be removed in a future Odyssey version. Use `tertiaryCallToActionComponent` instead.\n */\n callToActionLastComponent?: ReactElement<typeof Button>;\n /**\n * The content of the Dialog. May be a `string` or any other `ReactNode` or array of `ReactNode`s.\n */\n children: ReactNode;\n\n /**\n * When set to `true`, the Dialog will be visible.\n */\n isOpen: boolean;\n\n /**\n * Callback that controls what happens when the Dialog is dismissed.\n */\n onClose: () => void;\n\n /**\n * The title of the Dialog.\n */\n title: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst Dialog = ({\n primaryCallToActionComponent,\n secondaryCallToActionComponent,\n tertiaryCallToActionComponent,\n callToActionFirstComponent,\n callToActionSecondComponent,\n callToActionLastComponent,\n children,\n isOpen,\n onClose,\n testId,\n title,\n translate,\n}: DialogProps) => {\n const { t } = useTranslation();\n const [isContentScrollable, setIsContentScrollable] = useState(false);\n const dialogContentRef = useRef<HTMLDivElement>(null);\n const dialogTitleId = useUniqueId();\n const dialogLabelId = useUniqueId();\n\n useEffect(() => {\n let frameId: number;\n\n const handleContentScroll = () => {\n const dialogContentElement = dialogContentRef.current;\n if (dialogContentElement) {\n cancelAnimationFrame(frameId);\n setIsContentScrollable(\n dialogContentElement.scrollHeight > dialogContentElement.clientHeight,\n );\n }\n frameId = requestAnimationFrame(handleContentScroll);\n };\n\n if (isOpen) {\n frameId = requestAnimationFrame(handleContentScroll);\n }\n\n return () => {\n cancelAnimationFrame(frameId);\n };\n }, [isOpen]);\n\n const content =\n typeof children === \"string\" ? (\n <DialogContentText>{children}</DialogContentText>\n ) : (\n children\n );\n\n // Prioritize new action button format (|| used as a fallback)\n const actionButtons = [\n tertiaryCallToActionComponent || callToActionLastComponent,\n secondaryCallToActionComponent || callToActionSecondComponent,\n primaryCallToActionComponent || callToActionFirstComponent,\n ].filter(Boolean);\n\n return (\n <MuiDialog\n data-se={testId}\n open={isOpen}\n onClose={onClose}\n aria-labelledby={dialogLabelId}\n >\n <DialogTitle\n id={dialogTitleId} // We need to explicitly unset `id` for MUI to automatically set it based on the `aria-labelledby` prop passed to `MuiDialog`\n translate={translate}\n >\n <span id={dialogLabelId}>{title}</span>\n <Button\n ariaLabel={t(\"close.text\")}\n onClick={onClose}\n size=\"small\"\n startIcon={<CloseIcon />}\n variant=\"floating\"\n />\n </DialogTitle>\n <DialogContent\n {...(isContentScrollable && {\n // Sets tabIndex on content element if scrollable so content is easier to navigate with the keyboard\n tabIndex: 0,\n })}\n dividers={isContentScrollable}\n ref={dialogContentRef}\n >\n {content}\n </DialogContent>\n\n {actionButtons.length > 0 && (\n <DialogActions>\n {actionButtons.map((actionButton, index) =>\n actionButton ? cloneElement(actionButton, { key: index }) : null,\n )}\n </DialogActions>\n )}\n </MuiDialog>\n );\n};\n\nconst MemoizedDialog = memo(Dialog);\nMemoizedDialog.displayName = \"Dialog\";\n\nexport { MemoizedDialog as Dialog };\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAQ9C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SACEC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,SAAS,EACTC,MAAM,QAGD,OAAO;AAGd,SAASC,WAAW,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IA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D,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAInD,MAAM","ignoreList":[]}
|
package/dist/esm/Select.js
CHANGED
|
@@ -195,7 +195,8 @@ const Select = ({
|
|
|
195
195
|
return {
|
|
196
196
|
text: option.text,
|
|
197
197
|
value,
|
|
198
|
-
type: option.type === "heading" ? "heading" : "option"
|
|
198
|
+
type: option.type === "heading" ? "heading" : "option",
|
|
199
|
+
lang: option.language
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
202
|
return {
|
|
@@ -256,6 +257,7 @@ const Select = ({
|
|
|
256
257
|
"data-empty": !option.text,
|
|
257
258
|
value: option.value,
|
|
258
259
|
selected: isSelected,
|
|
260
|
+
lang: option.lang,
|
|
259
261
|
children: [hasMultipleChoices && _jsx(_Checkbox, {
|
|
260
262
|
checked: isSelected
|
|
261
263
|
}), option.text, !hasMultipleChoices && internalSelectedValues === option.value && _jsx(_ListItemSecondaryAction, {
|