@okta/odyssey-react-mui 1.34.0 → 1.35.2
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/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/DataView/TableLayoutContent.cjs +4 -1
- package/dist/cjs/labs/DataView/TableLayoutContent.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/theme/StringWithValue.cjs +6 -0
- package/dist/cjs/theme/StringWithValue.cjs.map +1 -0
- package/dist/cjs/theme/components.cjs +2590 -2592
- package/dist/cjs/theme/components.cjs.map +1 -1
- package/dist/cjs/theme/useMediaQuery.cjs +4 -4
- package/dist/cjs/theme/useMediaQuery.cjs.map +1 -1
- package/dist/cjs/ui-shell/InnerAppContainer.cjs +60 -0
- package/dist/cjs/ui-shell/InnerAppContainer.cjs.map +1 -0
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +6 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/TopNav/TopNav.cjs +1 -6
- package/dist/cjs/ui-shell/TopNav/TopNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +6 -5
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +8 -3
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/index.cjs +29 -9
- package/dist/cjs/ui-shell/index.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +2 -0
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs +2 -1
- package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs.map +1 -1
- package/dist/cjs/ui-shell/useUiShellBreakpoints.cjs +20 -15
- package/dist/cjs/ui-shell/useUiShellBreakpoints.cjs.map +1 -1
- package/dist/cjs/web-component/renderReactInWebComponent.cjs +21 -7
- package/dist/cjs/web-component/renderReactInWebComponent.cjs.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/DataView/TableLayoutContent.js +4 -1
- package/dist/esm/labs/DataView/TableLayoutContent.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/theme/StringWithValue.js +2 -0
- package/dist/esm/theme/StringWithValue.js.map +1 -0
- package/dist/esm/theme/components.js +2607 -2609
- package/dist/esm/theme/components.js.map +1 -1
- package/dist/esm/theme/useMediaQuery.js +5 -5
- package/dist/esm/theme/useMediaQuery.js.map +1 -1
- package/dist/esm/ui-shell/InnerAppContainer.js +56 -0
- package/dist/esm/ui-shell/InnerAppContainer.js.map +1 -0
- package/dist/esm/ui-shell/NarrowUiShellContent.js +6 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/TopNav/TopNav.js +1 -6
- package/dist/esm/ui-shell/TopNav/TopNav.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +6 -5
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +8 -3
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/index.js +3 -1
- package/dist/esm/ui-shell/index.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +2 -0
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js +2 -1
- package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js.map +1 -1
- package/dist/esm/ui-shell/useUiShellBreakpoints.js +19 -14
- package/dist/esm/ui-shell/useUiShellBreakpoints.js.map +1 -1
- package/dist/esm/web-component/renderReactInWebComponent.js +19 -5
- package/dist/esm/web-component/renderReactInWebComponent.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/tsconfig.tsbuildinfo +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/DataView/TableLayoutContent.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/theme/StringWithValue.d.ts +13 -0
- package/dist/types/theme/StringWithValue.d.ts.map +1 -0
- package/dist/types/theme/components.d.ts.map +1 -1
- package/dist/types/theme/useMediaQuery.d.ts +2 -1
- package/dist/types/theme/useMediaQuery.d.ts.map +1 -1
- package/dist/types/ui-shell/InnerAppContainer.d.ts +35 -0
- package/dist/types/ui-shell/InnerAppContainer.d.ts.map +1 -0
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/TopNav/TopNav.d.ts +1 -1
- package/dist/types/ui-shell/TopNav/TopNav.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts +8 -1
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/index.d.ts +3 -1
- package/dist/types/ui-shell/index.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +2 -2
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts.map +1 -1
- package/dist/types/ui-shell/useUiShellBreakpoints.d.ts +15 -5
- package/dist/types/ui-shell/useUiShellBreakpoints.d.ts.map +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
UiShell: true
|
|
7
|
+
UiShell: true,
|
|
8
|
+
adminAppUiShellBreakpoints: true
|
|
8
9
|
};
|
|
9
10
|
Object.defineProperty(exports, "UiShell", {
|
|
10
11
|
enumerable: true,
|
|
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "UiShell", {
|
|
|
12
13
|
return _UiShell.UiShell;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "adminAppUiShellBreakpoints", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _useUiShellBreakpoints.adminAppUiShellBreakpoints;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
var _index = require("./AppSwitcher/index.cjs");
|
|
16
23
|
Object.keys(_index).forEach(function (key) {
|
|
17
24
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,6 +31,18 @@ Object.keys(_index).forEach(function (key) {
|
|
|
24
31
|
}
|
|
25
32
|
});
|
|
26
33
|
});
|
|
34
|
+
var _InnerAppContainer = require("./InnerAppContainer.cjs");
|
|
35
|
+
Object.keys(_InnerAppContainer).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
38
|
+
if (key in exports && exports[key] === _InnerAppContainer[key]) return;
|
|
39
|
+
Object.defineProperty(exports, key, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _InnerAppContainer[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
27
46
|
var _NarrowUiShellContent = require("./NarrowUiShellContent.cjs");
|
|
28
47
|
Object.keys(_NarrowUiShellContent).forEach(function (key) {
|
|
29
48
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -96,29 +115,30 @@ Object.keys(_useHasUiShell).forEach(function (key) {
|
|
|
96
115
|
}
|
|
97
116
|
});
|
|
98
117
|
});
|
|
99
|
-
var
|
|
100
|
-
Object.keys(
|
|
118
|
+
var _WideUiShellContent = require("./WideUiShellContent.cjs");
|
|
119
|
+
Object.keys(_WideUiShellContent).forEach(function (key) {
|
|
101
120
|
if (key === "default" || key === "__esModule") return;
|
|
102
121
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
103
|
-
if (key in exports && exports[key] ===
|
|
122
|
+
if (key in exports && exports[key] === _WideUiShellContent[key]) return;
|
|
104
123
|
Object.defineProperty(exports, key, {
|
|
105
124
|
enumerable: true,
|
|
106
125
|
get: function () {
|
|
107
|
-
return
|
|
126
|
+
return _WideUiShellContent[key];
|
|
108
127
|
}
|
|
109
128
|
});
|
|
110
129
|
});
|
|
111
|
-
var
|
|
112
|
-
Object.keys(
|
|
130
|
+
var _renderReactInWebComponent = require("../web-component/renderReactInWebComponent.cjs");
|
|
131
|
+
Object.keys(_renderReactInWebComponent).forEach(function (key) {
|
|
113
132
|
if (key === "default" || key === "__esModule") return;
|
|
114
133
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
115
|
-
if (key in exports && exports[key] ===
|
|
134
|
+
if (key in exports && exports[key] === _renderReactInWebComponent[key]) return;
|
|
116
135
|
Object.defineProperty(exports, key, {
|
|
117
136
|
enumerable: true,
|
|
118
137
|
get: function () {
|
|
119
|
-
return
|
|
138
|
+
return _renderReactInWebComponent[key];
|
|
120
139
|
}
|
|
121
140
|
});
|
|
122
141
|
});
|
|
123
142
|
var _UiShell = require("./UiShell.cjs");
|
|
143
|
+
var _useUiShellBreakpoints = require("./useUiShellBreakpoints.cjs");
|
|
124
144
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["_index","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_NarrowUiShellContent","_renderUiShell","_index2","_index3","_uiShellContentTypes","_useHasUiShell","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["_index","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_InnerAppContainer","_NarrowUiShellContent","_renderUiShell","_index2","_index3","_uiShellContentTypes","_useHasUiShell","_WideUiShellContent","_renderReactInWebComponent","_UiShell","_useUiShellBreakpoints"],"sources":["../../../src/ui-shell/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 \"./AppSwitcher/index.js\";\nexport * from \"./InnerAppContainer.js\";\nexport * from \"./NarrowUiShellContent.js\";\nexport * from \"./renderUiShell.js\";\nexport * from \"./SideNav/index.js\";\nexport * from \"./TopNav/index.js\";\nexport * from \"./uiShellContentTypes.js\";\nexport * from \"./useHasUiShell.js\";\nexport * from \"./WideUiShellContent.js\";\n\nexport * from \"../web-component/renderReactInWebComponent.js\"; // This is located here because some teams use React v17, and this uses React v18's `ReactDOM/client` import which isn't in older versions.\n\nexport { UiShell, type UiShellProps } from \"./UiShell.js\";\nexport { adminAppUiShellBreakpoints } from \"./useUiShellBreakpoints.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,kBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,kBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,kBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,c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AAAS,0BAAA,CAAAjB,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAkB,QAAA,GAAAtB,OAAA;AACA,IAAAuB,sBAAA,GAAAvB,OAAA","ignoreList":[]}
|
|
@@ -35,6 +35,7 @@ const renderUiShell = ({
|
|
|
35
35
|
appBackgroundContrastMode,
|
|
36
36
|
appElement: providedAppElement,
|
|
37
37
|
appElementScrollingMode,
|
|
38
|
+
breakpointConfig,
|
|
38
39
|
hasStandardAppContentPadding,
|
|
39
40
|
initialVisibleSections,
|
|
40
41
|
onError = console.error,
|
|
@@ -77,6 +78,7 @@ const renderUiShell = ({
|
|
|
77
78
|
}),
|
|
78
79
|
onError: onError,
|
|
79
80
|
children: (0, _jsxRuntime.jsx)(_UiShell.UiShell, {
|
|
81
|
+
breakpointConfig: breakpointConfig,
|
|
80
82
|
appBackgroundColor: appBackgroundColor,
|
|
81
83
|
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
82
84
|
appElement: appElement,
|
|
@@ -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","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,EA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AAEA,qBAAsB;QAC7CwC,iBAAiB,EAAET,iBAAiB,CAACU,cAAe;QACpDC,oBAAoB,EAAEX,iBAAiB,CAACY;MAAkB,CAC3D;IAAC,CACW,CAChB;IACDC,yBAAyB,EAAE9C,aAAa;IACxC4B;EACF,CAAC,CAAC;EAEF5B,aAAa,CAAC+C,WAAW,CAACvD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVwB,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAC/C,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","breakpointConfig","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 breakpointConfig,\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 | \"breakpointConfig\"\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 breakpointConfig={breakpointConfig}\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;EAClB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CAC3D;IAAC,CACW,CAChB;IACDC,yBAAyB,EAAE9C,aAAa;IACxC4B;EACF,CAAC,CAAC;EAEF5B,aAAa,CAAC+C,WAAW,CAACxD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVyB,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAChD,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -33,7 +33,6 @@ const setStylesToMatchElement = ({
|
|
|
33
33
|
appContainerElement.style.setProperty("left", `${appContentReferenceRectangle.left - parentElementRectangle.left}px`);
|
|
34
34
|
appContainerElement.style.setProperty("width", `${appContentReferenceRectangle.width}px`);
|
|
35
35
|
appContainerElement.style.setProperty("height", `${appContentReferenceRectangle.height}px`);
|
|
36
|
-
appContainerElement.style.setProperty("z-index", "1");
|
|
37
36
|
Object.entries(additionalStyles).forEach(([cssPropertyName, cssPropertyValue]) => {
|
|
38
37
|
appContainerElement.style.setProperty(convertCamelCaseToKebabCase(cssPropertyName), String(cssPropertyValue));
|
|
39
38
|
});
|
|
@@ -49,6 +48,8 @@ const useMatchAppElementToUiShellAppArea = ({
|
|
|
49
48
|
const odysseyDesignTokens = (0, _OdysseyDesignTokensContext.useOdysseyDesignTokens)();
|
|
50
49
|
const parentContainerRef = (0, _react.useRef)(null);
|
|
51
50
|
const appContainerElementStyles = (0, _react.useMemo)(() => ({
|
|
51
|
+
boxSizing: "border-box",
|
|
52
|
+
zIndex: 1,
|
|
52
53
|
...(paddingMode === "comfortable" ? {
|
|
53
54
|
paddingBlock: odysseyDesignTokens.Spacing5,
|
|
54
55
|
paddingInline: odysseyDesignTokens.Spacing8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchAppElementToUiShellAppArea.cjs","names":["_react","require","_OdysseyDesignTokensContext","convertCamelCaseToKebabCase","string","replace","toLowerCase","exports","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","parentElement","appContentReferenceRectangle","getBoundingClientRect","parentElementRectangle","style","setProperty","top","left","width","height","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","useMatchAppElementToUiShellAppArea","appElement","appElementScrollingMode","paddingMode","uiShellAppAreaRef","uiShellResizableRefs","odysseyDesignTokens","useOdysseyDesignTokens","parentContainerRef","useRef","appContainerElementStyles","useMemo","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","useEffect","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","resizingElements","map","resizingRef","filter","element","Boolean","observer","ResizeObserver","resizingElement","addEventListener","observe","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useMatchAppElementToUiShellAppArea.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 { CSSProperties, RefObject, useEffect, useMemo, useRef } from \"react\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { UiShellContentProps } from \"./uiShellContentTypes.js\";\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n parentElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n parentElement: HTMLElement;\n}) => {\n const appContentReferenceRectangle =\n appContentReferenceElement.getBoundingClientRect();\n const parentElementRectangle = parentElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\n \"top\",\n `${appContentReferenceRectangle.top - parentElementRectangle.top}px`,\n );\n appContainerElement.style.setProperty(\n \"left\",\n `${appContentReferenceRectangle.left - parentElementRectangle.left}px`,\n );\n appContainerElement.style.setProperty(\n \"width\",\n `${appContentReferenceRectangle.width}px`,\n );\n appContainerElement.style.setProperty(\n \"height\",\n `${appContentReferenceRectangle.height}px`,\n );\n appContainerElement.style.setProperty(\"z-index\", \"1\");\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\nexport type UseMatchAppElementToUiShellAppAreaProps = {\n /**\n * Padding around the app area. \"comfortable\" is designed for wider views whereas \"compact\" is designed for narrower views.\n */\n paddingMode: \"comfortable\" | \"compact\" | \"none\";\n /**\n * Ref for the App Container in UI Shell. This should be the one inside the Shell, **not** the element we're going to align.\n */\n uiShellAppAreaRef: RefObject<HTMLDivElement>;\n /**\n * Array of refs of items that indirectly resize the app content area such as \"side nav\" and \"top nav\".\n */\n uiShellResizableRefs: Array<RefObject<HTMLDivElement>>;\n} & Pick<UiShellContentProps, \"appElement\" | \"appElementScrollingMode\">;\n\nexport const useMatchAppElementToUiShellAppArea = ({\n appElement,\n appElementScrollingMode,\n paddingMode,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n}: UseMatchAppElementToUiShellAppAreaProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const parentContainerRef = useRef<HTMLDivElement>(null);\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n ...(paddingMode === \"comfortable\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n }\n : {}),\n ...(paddingMode === \"compact\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing5,\n }\n : {}),\n ...(appElementScrollingMode === \"horizontal\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n ...(appElementScrollingMode === \"vertical\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [appElementScrollingMode, paddingMode, odysseyDesignTokens],\n );\n\n useEffect(() => {\n // Once `appContainerRef` is rendered, we can position `appContainerElement` on top to match.\n if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n\n animationFrameId = requestAnimationFrame(() => {\n if (uiShellAppAreaRef.current && parentContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: uiShellAppAreaRef.current,\n appContainerElement: appElement,\n parentElement: parentContainerRef.current,\n });\n }\n });\n };\n\n // These refs might change by the time we unsubscribe, so we need to keep references to the original elements.\n const resizingElements = uiShellResizableRefs\n .map((resizingRef) => resizingRef.current)\n .filter((element): element is NonNullable<typeof element> =>\n Boolean(element),\n );\n\n // Set up a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n\n // document.addEventListener(\"ready\", updateStyles);\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.addEventListener(\"transitionend\", updateStyles);\n\n observer.observe(resizingElement);\n });\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.removeEventListener(\"transitionend\", updateStyles);\n });\n };\n }\n return () => {};\n }, [appElement, appContainerElementStyles, uiShellAppAreaRef]);\n\n return {\n parentContainerRef,\n };\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD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","require","_OdysseyDesignTokensContext","convertCamelCaseToKebabCase","string","replace","toLowerCase","exports","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","parentElement","appContentReferenceRectangle","getBoundingClientRect","parentElementRectangle","style","setProperty","top","left","width","height","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","useMatchAppElementToUiShellAppArea","appElement","appElementScrollingMode","paddingMode","uiShellAppAreaRef","uiShellResizableRefs","odysseyDesignTokens","useOdysseyDesignTokens","parentContainerRef","useRef","appContainerElementStyles","useMemo","boxSizing","zIndex","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","useEffect","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","resizingElements","map","resizingRef","filter","element","Boolean","observer","ResizeObserver","resizingElement","addEventListener","observe","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useMatchAppElementToUiShellAppArea.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 { CSSProperties, RefObject, useEffect, useMemo, useRef } from \"react\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { UiShellContentProps } from \"./uiShellContentTypes.js\";\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n parentElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n parentElement: HTMLElement;\n}) => {\n const appContentReferenceRectangle =\n appContentReferenceElement.getBoundingClientRect();\n const parentElementRectangle = parentElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\n \"top\",\n `${appContentReferenceRectangle.top - parentElementRectangle.top}px`,\n );\n appContainerElement.style.setProperty(\n \"left\",\n `${appContentReferenceRectangle.left - parentElementRectangle.left}px`,\n );\n appContainerElement.style.setProperty(\n \"width\",\n `${appContentReferenceRectangle.width}px`,\n );\n appContainerElement.style.setProperty(\n \"height\",\n `${appContentReferenceRectangle.height}px`,\n );\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\nexport type UseMatchAppElementToUiShellAppAreaProps = {\n /**\n * Padding around the app area. \"comfortable\" is designed for wider views whereas \"compact\" is designed for narrower views.\n */\n paddingMode: \"comfortable\" | \"compact\" | \"none\";\n /**\n * Ref for the App Container in UI Shell. This should be the one inside the Shell, **not** the element we're going to align.\n */\n uiShellAppAreaRef: RefObject<HTMLDivElement>;\n /**\n * Array of refs of items that indirectly resize the app content area such as \"side nav\" and \"top nav\".\n */\n uiShellResizableRefs: Array<RefObject<HTMLDivElement>>;\n} & Pick<UiShellContentProps, \"appElement\" | \"appElementScrollingMode\">;\n\nexport const useMatchAppElementToUiShellAppArea = ({\n appElement,\n appElementScrollingMode,\n paddingMode,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n}: UseMatchAppElementToUiShellAppAreaProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const parentContainerRef = useRef<HTMLDivElement>(null);\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n boxSizing: \"border-box\",\n zIndex: 1,\n ...(paddingMode === \"comfortable\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n }\n : {}),\n\n ...(paddingMode === \"compact\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing5,\n }\n : {}),\n\n ...(appElementScrollingMode === \"horizontal\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n\n ...(appElementScrollingMode === \"vertical\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [appElementScrollingMode, paddingMode, odysseyDesignTokens],\n );\n\n useEffect(() => {\n // Once `appContainerRef` is rendered, we can position `appContainerElement` on top to match.\n if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n\n animationFrameId = requestAnimationFrame(() => {\n if (uiShellAppAreaRef.current && parentContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: uiShellAppAreaRef.current,\n appContainerElement: appElement,\n parentElement: parentContainerRef.current,\n });\n }\n });\n };\n\n // These refs might change by the time we unsubscribe, so we need to keep references to the original elements.\n const resizingElements = uiShellResizableRefs\n .map((resizingRef) => resizingRef.current)\n .filter((element): element is NonNullable<typeof element> =>\n Boolean(element),\n );\n\n // Set up a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n\n // document.addEventListener(\"ready\", updateStyles);\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.addEventListener(\"transitionend\", updateStyles);\n\n observer.observe(resizingElement);\n });\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.removeEventListener(\"transitionend\", updateStyles);\n });\n };\n }\n return () => {};\n }, [appElement, appContainerElementStyles, uiShellAppAreaRef]);\n\n return {\n parentContainer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,GAAAA,kCAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useUiShellBreakpoints = exports.
|
|
6
|
+
exports.useUiShellBreakpoints = exports.defaultUiShellBreakpointConfig = exports.adminAppUiShellBreakpoints = void 0;
|
|
7
7
|
var _useMediaQuery = require("../theme/useMediaQuery.cjs");
|
|
8
8
|
/*!
|
|
9
9
|
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
@@ -17,23 +17,28 @@ var _useMediaQuery = require("../theme/useMediaQuery.cjs");
|
|
|
17
17
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const defaultUiShellBreakpointConfig = exports.defaultUiShellBreakpointConfig = {
|
|
21
|
+
narrow: 0,
|
|
22
|
+
medium: 600,
|
|
23
|
+
wide: 800
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const adminAppUiShellBreakpoints = exports.adminAppUiShellBreakpoints = {
|
|
26
|
+
narrow: 0,
|
|
27
|
+
medium: 600,
|
|
28
|
+
wide: 1304
|
|
29
|
+
};
|
|
30
|
+
const useUiShellBreakpoints = (breakpointConfig = defaultUiShellBreakpointConfig) => {
|
|
31
|
+
const isNarrowView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${breakpointConfig.narrow}px)`);
|
|
32
|
+
const isMediumView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${breakpointConfig.medium}px)`);
|
|
33
|
+
const isWideView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${breakpointConfig.wide}px)`);
|
|
34
|
+
if (isWideView) {
|
|
35
|
+
return "wide";
|
|
31
36
|
}
|
|
32
|
-
if (
|
|
33
|
-
return "
|
|
37
|
+
if (isMediumView) {
|
|
38
|
+
return "medium";
|
|
34
39
|
}
|
|
35
|
-
if (
|
|
36
|
-
return "
|
|
40
|
+
if (isNarrowView) {
|
|
41
|
+
return "narrow";
|
|
37
42
|
}
|
|
38
43
|
return "none";
|
|
39
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUiShellBreakpoints.cjs","names":["_useMediaQuery","require","
|
|
1
|
+
{"version":3,"file":"useUiShellBreakpoints.cjs","names":["_useMediaQuery","require","defaultUiShellBreakpointConfig","exports","narrow","medium","wide","adminAppUiShellBreakpoints","useUiShellBreakpoints","breakpointConfig","isNarrowView","useMediaQuery","isMediumView","isWideView"],"sources":["../../../src/ui-shell/useUiShellBreakpoints.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 { useMediaQuery } from \"../theme/useMediaQuery.js\";\n\nexport type UiShellBreakpointConfig = {\n narrow: number;\n medium: number;\n wide: number;\n};\n\nexport const defaultUiShellBreakpointConfig = {\n narrow: 0,\n medium: 600,\n wide: 800,\n} as const satisfies UiShellBreakpointConfig;\n\nexport const adminAppUiShellBreakpoints = {\n narrow: 0,\n medium: 600,\n wide: 1304,\n} as const satisfies UiShellBreakpointConfig;\n\nexport const useUiShellBreakpoints = (\n breakpointConfig: UiShellBreakpointConfig = defaultUiShellBreakpointConfig,\n): keyof UiShellBreakpointConfig | \"none\" => {\n const isNarrowView = useMediaQuery(\n `(min-width: ${breakpointConfig.narrow}px)`,\n );\n\n const isMediumView = useMediaQuery(\n `(min-width: ${breakpointConfig.medium}px)`,\n );\n\n const isWideView = useMediaQuery(`(min-width: ${breakpointConfig.wide}px)`);\n\n if (isWideView) {\n return \"wide\";\n }\n\n if (isMediumView) {\n return \"medium\";\n }\n\n if (isNarrowView) {\n return \"narrow\";\n }\n\n // This is a failsafe in case we don't have any media queries on page load or if media queries were improperly defined (no `0` case). With the default breakpoints, it will never be `\"none\"`.\n return \"none\";\n};\n"],"mappings":";;;;;;AAYA,IAAAA,cAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUO,MAAMC,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GAAG;EAC5CE,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,GAAG;EACXC,IAAI,EAAE;AACR,CAA4C;AAErC,MAAMC,0BAA0B,GAAAJ,OAAA,CAAAI,0BAAA,GAAG;EACxCH,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,GAAG;EACXC,IAAI,EAAE;AACR,CAA4C;AAErC,MAAME,qBAAqB,GAAGA,CACnCC,gBAAyC,GAAGP,8BAA8B,KAC/B;EAC3C,MAAMQ,YAAY,GAAG,IAAAC,4BAAa,EAChC,eAAeF,gBAAgB,CAACL,MAAM,KACxC,CAAC;EAED,MAAMQ,YAAY,GAAG,IAAAD,4BAAa,EAChC,eAAeF,gBAAgB,CAACJ,MAAM,KACxC,CAAC;EAED,MAAMQ,UAAU,GAAG,IAAAF,4BAAa,EAAC,eAAeF,gBAAgB,CAACH,IAAI,KAAK,CAAC;EAE3E,IAAIO,UAAU,EAAE;IACd,OAAO,MAAM;EACf;EAEA,IAAID,YAAY,EAAE;IAChB,OAAO,QAAQ;EACjB;EAEA,IAAIF,YAAY,EAAE;IAChB,OAAO,QAAQ;EACjB;EAGA,OAAO,MAAM;AACf,CAAC;AAACP,OAAA,CAAAK,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -40,6 +40,7 @@ function __transformExtension(filepath, extMapping) {
|
|
|
40
40
|
const reactWebComponentElementName = exports.reactWebComponentElementName = "odyssey-react-web-component";
|
|
41
41
|
const SsrFriendlyHtmlElementClass = "HTMLElement" in globalThis ? HTMLElement : class {};
|
|
42
42
|
class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {
|
|
43
|
+
reactRootPromise = Promise.resolve(null);
|
|
43
44
|
constructor(getReactComponent) {
|
|
44
45
|
super();
|
|
45
46
|
this.getReactComponent = getReactComponent;
|
|
@@ -58,17 +59,30 @@ class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {
|
|
|
58
59
|
this.reactRootElements.stylesRootElement.appendChild(styleElement);
|
|
59
60
|
shadowRoot.appendChild(this.reactRootElements.stylesRootElement);
|
|
60
61
|
shadowRoot.appendChild(this.reactRootElements.appRootElement);
|
|
61
|
-
this.reactRootPromise = (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(__transformExtension("react-dom/client", {
|
|
62
|
-
".js": ".cjs"
|
|
63
|
-
})).then(({
|
|
64
|
-
createRoot
|
|
65
|
-
}) => createRoot(this.reactRootElements.appRootElement));
|
|
66
62
|
}
|
|
67
63
|
connectedCallback() {
|
|
68
|
-
this.reactRootPromise.then(reactRoot =>
|
|
64
|
+
this.reactRootPromise = this.reactRootPromise.then(reactRoot => {
|
|
65
|
+
if (reactRoot) {
|
|
66
|
+
throw new Error(`connectedCallback fired when reactRoot is already mounted.`);
|
|
67
|
+
}
|
|
68
|
+
return (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(__transformExtension("react-dom/client", {
|
|
69
|
+
".js": ".cjs"
|
|
70
|
+
})).then(({
|
|
71
|
+
createRoot
|
|
72
|
+
}) => createRoot(this.reactRootElements.appRootElement));
|
|
73
|
+
}).then(reactRoot => {
|
|
74
|
+
reactRoot.render(this.getReactComponent(this.reactRootElements));
|
|
75
|
+
return reactRoot;
|
|
76
|
+
});
|
|
69
77
|
}
|
|
70
78
|
disconnectedCallback() {
|
|
71
|
-
this.reactRootPromise.then(reactRoot =>
|
|
79
|
+
this.reactRootPromise = this.reactRootPromise.then(reactRoot => {
|
|
80
|
+
if (!reactRoot) {
|
|
81
|
+
throw new Error(`disconnectedCallback fired when reactRoot is already unmounted.`);
|
|
82
|
+
}
|
|
83
|
+
reactRoot.unmount();
|
|
84
|
+
return null;
|
|
85
|
+
});
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
88
|
exports.ReactInWebComponentElement = ReactInWebComponentElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderReactInWebComponent.cjs","names":["_createReactRootElements","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","reactWebComponentElementName","exports","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","ReactInWebComponentElement","constructor","getReactComponent","reactRootElements","createReactRootElements","styleElement","document","createElement","shadowRoot","attachShadow","mode","innerHTML","setAttribute","window","cspNonce","stylesRootElement","appendChild","appRootElement","reactRootPromise","specifier","Promise","then","s","createRoot","connectedCallback","reactRoot","render","disconnectedCallback","unmount","customElements","define","renderReactInWebComponent","webComponentChildren","webComponentParentElement","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.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\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\n\nimport {\n createReactRootElements,\n type ReactRootElements,\n} from \"./createReactRootElements.js\";\n\nexport const reactWebComponentElementName = \"odyssey-react-web-component\";\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {\n getReactComponent: GetReactComponentInWebComponent;\n reactRootElements: ReactRootElements;\n reactRootPromise: Promise<Root>;\n\n constructor(getReactComponent: GetReactComponentInWebComponent) {\n super();\n\n this.getReactComponent = getReactComponent;\n this.reactRootElements = createReactRootElements();\n\n const styleElement = document.createElement(\"style\");\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n\n styleElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n\n styleElement.setAttribute(\"nonce\", window.cspNonce);\n\n this.reactRootElements.stylesRootElement.appendChild(styleElement);\n shadowRoot.appendChild(this.reactRootElements.stylesRootElement);\n shadowRoot.appendChild(this.reactRootElements.appRootElement);\n\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n this.reactRootPromise = import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.reactRootElements.appRootElement),\n );\n }\n\n connectedCallback() {\n this.reactRootPromise.then((reactRoot) =>\n reactRoot.render(this.getReactComponent(this.reactRootElements)),\n );\n }\n\n disconnectedCallback() {\n this.reactRootPromise.then((reactRoot) => reactRoot.unmount());\n }\n}\n\nif (\n \"customElements\" in globalThis &&\n !customElements.get(reactWebComponentElementName)\n) {\n customElements.define(\n reactWebComponentElementName,\n ReactInWebComponentElement,\n );\n}\n\nexport type RenderReactInWebComponentProps = {\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n} & (\n | {\n /**\n * The React app renders in the web component, but the web component needs to be rendered in the document.\n *\n * This is the element the web component is rendered into.\n */\n webComponentParentElement: HTMLElement;\n webComponentRootElement?: never;\n }\n | {\n webComponentParentElement?: HTMLElement;\n /**\n * @deprecated Use `webComponentParentElement` instead.\n */\n webComponentRootElement: HTMLElement;\n }\n);\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n getReactComponent,\n webComponentChildren,\n webComponentParentElement,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = new ReactInWebComponentElement(getReactComponent);\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n if (webComponentParentElement) {\n webComponentParentElement.appendChild(reactElement);\n }\n // Remove this condition when `webComponentRootElement` is no longer a prop.\n else if (webComponentRootElement) {\n webComponentRootElement.appendChild(reactElement);\n }\n\n return reactElement;\n};\n"],"mappings":";;;;;;AAeA,IAAAA,wBAAA,GAAAC,OAAA;AAGsC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAA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B;EACjB8B,oBAAoB;EACpBC,yBAAyB;EACzBC;AAC8B,CAAC,KAAK;EACpC,MAAMC,YAAY,GAAG,IAAInC,0BAA0B,CAACE,iBAAiB,CAAC;EAEtE,IAAI8B,oBAAoB,EAAE;IACxB,CAACI,KAAK,CAACC,OAAO,CAACL,oBAAoB,CAAC,GAChCA,oBAAoB,GACpB,CAACA,oBAAoB,CAAC,EACxBM,OAAO,CAAEC,iBAAiB,IAAK;MAC/BJ,YAAY,CAACnB,WAAW,CAACuB,iBAAiB,CAAC;IAC7C,CAAC,CAAC;EACJ;EAEA,IAAIN,yBAAyB,EAAE;IAC7BA,yBAAyB,CAACjB,WAAW,CAACmB,YAAY,CAAC;EACrD,CAAC,MAEI,IAAID,uBAAuB,EAAE;IAChCA,uBAAuB,CAAClB,WAAW,CAACmB,YAAY,CAAC;EACnD;EAEA,OAAOA,YAAY;AACrB,CAAC;AAACvC,OAAA,CAAAmC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderReactInWebComponent.cjs","names":["_createReactRootElements","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","reactWebComponentElementName","exports","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","ReactInWebComponentElement","reactRootPromise","Promise","resolve","constructor","getReactComponent","reactRootElements","createReactRootElements","styleElement","document","createElement","shadowRoot","attachShadow","mode","innerHTML","setAttribute","window","cspNonce","stylesRootElement","appendChild","appRootElement","connectedCallback","then","reactRoot","Error","specifier","s","createRoot","render","disconnectedCallback","unmount","customElements","define","renderReactInWebComponent","webComponentChildren","webComponentParentElement","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.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\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\n\nimport {\n createReactRootElements,\n type ReactRootElements,\n} from \"./createReactRootElements.js\";\n\nexport const reactWebComponentElementName = \"odyssey-react-web-component\";\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {\n getReactComponent: GetReactComponentInWebComponent;\n reactRootElements: ReactRootElements;\n reactRootPromise: Promise<Root | null> = Promise.resolve(null);\n\n constructor(getReactComponent: GetReactComponentInWebComponent) {\n super();\n\n this.getReactComponent = getReactComponent;\n this.reactRootElements = createReactRootElements();\n\n const styleElement = document.createElement(\"style\");\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n\n styleElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n\n styleElement.setAttribute(\"nonce\", window.cspNonce);\n\n this.reactRootElements.stylesRootElement.appendChild(styleElement);\n shadowRoot.appendChild(this.reactRootElements.stylesRootElement);\n shadowRoot.appendChild(this.reactRootElements.appRootElement);\n }\n\n connectedCallback() {\n this.reactRootPromise = this.reactRootPromise\n .then((reactRoot) => {\n if (reactRoot) {\n // Shouldn't ever happen\n throw new Error(\n `connectedCallback fired when reactRoot is already mounted.`,\n );\n }\n\n // Ensure react root is available before mounting\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n return import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.reactRootElements.appRootElement),\n );\n })\n .then((reactRoot) => {\n reactRoot.render(this.getReactComponent(this.reactRootElements));\n return reactRoot;\n });\n }\n\n disconnectedCallback() {\n this.reactRootPromise = this.reactRootPromise.then((reactRoot) => {\n if (!reactRoot) {\n // Shouldn't ever happen\n throw new Error(\n `disconnectedCallback fired when reactRoot is already unmounted.`,\n );\n }\n\n reactRoot.unmount();\n // Set root to null. We don't want to attempt to render to a root that's already been unmounted.\n return null;\n });\n }\n}\n\nif (\n \"customElements\" in globalThis &&\n !customElements.get(reactWebComponentElementName)\n) {\n customElements.define(\n reactWebComponentElementName,\n ReactInWebComponentElement,\n );\n}\n\nexport type RenderReactInWebComponentProps = {\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n} & (\n | {\n /**\n * The React app renders in the web component, but the web component needs to be rendered in the document.\n *\n * This is the element the web component is rendered into.\n */\n webComponentParentElement: HTMLElement;\n webComponentRootElement?: never;\n }\n | {\n webComponentParentElement?: HTMLElement;\n /**\n * @deprecated Use `webComponentParentElement` instead.\n */\n webComponentRootElement: HTMLElement;\n }\n);\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n getReactComponent,\n webComponentChildren,\n webComponentParentElement,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = new ReactInWebComponentElement(getReactComponent);\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n if (webComponentParentElement) {\n webComponentParentElement.appendChild(reactElement);\n }\n // Remove this condition when `webComponentRootElement` is no longer a prop.\n else if (webComponentRootElement) {\n webComponentRootElement.appendChild(reactElement);\n }\n\n return reactElement;\n};\n"],"mappings":";;;;;;AAeA,IAAAA,wBAAA,GAAAC,OAAA;AAGsC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAe,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAd,CAAA,EAAAe,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA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sB,iBAAiB,CAAC;IAC7C,CAAC,CAAC;EACJ;EAEA,IAAIN,yBAAyB,EAAE;IAC7BA,yBAAyB,CAAChB,WAAW,CAACkB,YAAY,CAAC;EACrD,CAAC,MAEI,IAAID,uBAAuB,EAAE;IAChCA,uBAAuB,CAACjB,WAAW,CAACkB,YAAY,CAAC;EACnD;EAEA,OAAOA,YAAY;AACrB,CAAC;AAACzC,OAAA,CAAAqC,yBAAA,GAAAA,yBAAA","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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AAG,EAAE5B,gBAAiB;MAAAT,QAAA,EAErBoB;IAAO,CACK,CAAC,EAEfE,aAAa,CAACgB,MAAM,GAAG,CAAC,IACvBhD,IAAA,CAAAiD,cAAA;MAAAvC,QAAA,EACGsB,aAAa,CAACkB,GAAG,CAAC,CAACC,YAAY,EAAEC,KAAK,KACrCD,YAAY,GAAG1D,YAAY,CAAC0D,YAAY,EAAE;QAAEE,GAAG,EAAED;MAAM,CAAC,CAAC,GAAG,IAC9D;IAAC,CACY,CAChB;EAAA,CACQ,CAAC;AAEhB,CAAC;AAED,MAAME,cAAc,GAAG5D,IAAI,CAACS,MAAM,CAAC;AACnCmD,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, {
|