@okta/odyssey-react-mui 1.40.0 → 1.42.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.
Files changed (197) hide show
  1. package/dist/cjs/Autocomplete.cjs +10 -10
  2. package/dist/cjs/Autocomplete.cjs.map +1 -1
  3. package/dist/cjs/Breadcrumbs.cjs +1 -0
  4. package/dist/cjs/Breadcrumbs.cjs.map +1 -1
  5. package/dist/cjs/Link.cjs.map +1 -1
  6. package/dist/cjs/OdysseyCacheProvider.cjs.map +1 -1
  7. package/dist/cjs/Select.cjs +1 -1
  8. package/dist/cjs/Select.cjs.map +1 -1
  9. package/dist/cjs/Tag.cjs +9 -2
  10. package/dist/cjs/Tag.cjs.map +1 -1
  11. package/dist/cjs/createContrastColors.cjs +6 -2
  12. package/dist/cjs/createContrastColors.cjs.map +1 -1
  13. package/dist/cjs/getLogicalBoundaries.cjs +33 -0
  14. package/dist/cjs/getLogicalBoundaries.cjs.map +1 -0
  15. package/dist/cjs/labs/PageTemplate/PageTemplate.cjs +15 -4
  16. package/dist/cjs/labs/PageTemplate/PageTemplate.cjs.map +1 -1
  17. package/dist/cjs/properties/ts/odyssey-react-mui.cjs +2 -1
  18. package/dist/cjs/properties/ts/odyssey-react-mui.cjs.map +1 -1
  19. package/dist/cjs/properties/ts/odyssey-react-mui_eu.cjs +137 -0
  20. package/dist/cjs/properties/ts/odyssey-react-mui_eu.cjs.map +1 -0
  21. package/dist/cjs/theme/components.cjs +1 -0
  22. package/dist/cjs/theme/components.cjs.map +1 -1
  23. package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +0 -1
  24. package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
  25. package/dist/cjs/ui-shell/SideNav/SideNav.cjs +23 -18
  26. package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
  27. package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs +4 -3
  28. package/dist/cjs/ui-shell/SideNav/SideNavItemLinkContent.cjs.map +1 -1
  29. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs +10 -10
  30. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs.map +1 -1
  31. package/dist/cjs/ui-shell/UiShell.cjs +2 -0
  32. package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
  33. package/dist/cjs/ui-shell/UiShellProvider.cjs +6 -1
  34. package/dist/cjs/ui-shell/UiShellProvider.cjs.map +1 -1
  35. package/dist/cjs/ui-shell/renderUiShell.cjs +4 -2
  36. package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
  37. package/dist/cjs/ui-shell/useElementAtContainerEdge.cjs +74 -0
  38. package/dist/cjs/ui-shell/useElementAtContainerEdge.cjs.map +1 -0
  39. package/dist/cjs/ui-shell/useScrollState.cjs +4 -2
  40. package/dist/cjs/ui-shell/useScrollState.cjs.map +1 -1
  41. package/dist/cjs/useAutocomplete.cjs +2 -2
  42. package/dist/cjs/useAutocomplete.cjs.map +1 -1
  43. package/dist/cjs/useMountLifecycleEffect.cjs +3 -3
  44. package/dist/cjs/useMountLifecycleEffect.cjs.map +1 -1
  45. package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs +1 -1
  46. package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs.map +1 -1
  47. package/dist/esm/Autocomplete.js +10 -10
  48. package/dist/esm/Autocomplete.js.map +1 -1
  49. package/dist/esm/Breadcrumbs.js +1 -0
  50. package/dist/esm/Breadcrumbs.js.map +1 -1
  51. package/dist/esm/Link.js.map +1 -1
  52. package/dist/esm/OdysseyCacheProvider.js.map +1 -1
  53. package/dist/esm/Select.js +1 -1
  54. package/dist/esm/Select.js.map +1 -1
  55. package/dist/esm/Tag.js +9 -2
  56. package/dist/esm/Tag.js.map +1 -1
  57. package/dist/esm/createContrastColors.js +6 -2
  58. package/dist/esm/createContrastColors.js.map +1 -1
  59. package/dist/esm/getLogicalBoundaries.js +26 -0
  60. package/dist/esm/getLogicalBoundaries.js.map +1 -0
  61. package/dist/esm/labs/PageTemplate/PageTemplate.js +16 -5
  62. package/dist/esm/labs/PageTemplate/PageTemplate.js.map +1 -1
  63. package/dist/esm/properties/ts/odyssey-react-mui.js +2 -1
  64. package/dist/esm/properties/ts/odyssey-react-mui.js.map +1 -1
  65. package/dist/esm/properties/ts/odyssey-react-mui_eu.js +131 -0
  66. package/dist/esm/properties/ts/odyssey-react-mui_eu.js.map +1 -0
  67. package/dist/esm/theme/components.js +1 -0
  68. package/dist/esm/theme/components.js.map +1 -1
  69. package/dist/esm/ui-shell/NarrowUiShellContent.js +0 -1
  70. package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
  71. package/dist/esm/ui-shell/SideNav/SideNav.js +23 -18
  72. package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
  73. package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js +4 -3
  74. package/dist/esm/ui-shell/SideNav/SideNavItemLinkContent.js.map +1 -1
  75. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js +10 -10
  76. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js.map +1 -1
  77. package/dist/esm/ui-shell/UiShell.js +2 -0
  78. package/dist/esm/ui-shell/UiShell.js.map +1 -1
  79. package/dist/esm/ui-shell/UiShellProvider.js +6 -1
  80. package/dist/esm/ui-shell/UiShellProvider.js.map +1 -1
  81. package/dist/esm/ui-shell/renderUiShell.js +4 -2
  82. package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
  83. package/dist/esm/ui-shell/useElementAtContainerEdge.js +68 -0
  84. package/dist/esm/ui-shell/useElementAtContainerEdge.js.map +1 -0
  85. package/dist/esm/ui-shell/useScrollState.js +4 -2
  86. package/dist/esm/ui-shell/useScrollState.js.map +1 -1
  87. package/dist/esm/useAutocomplete.js +2 -2
  88. package/dist/esm/useAutocomplete.js.map +1 -1
  89. package/dist/esm/useMountLifecycleEffect.js +3 -3
  90. package/dist/esm/useMountLifecycleEffect.js.map +1 -1
  91. package/dist/esm/web-component/odysseyWebComponentVersion.generated.js +1 -1
  92. package/dist/esm/web-component/odysseyWebComponentVersion.generated.js.map +1 -1
  93. package/dist/index.cjs +1 -1
  94. package/dist/index.d.ts +1 -1
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.js +25 -0
  97. package/dist/index.mjs +1 -1
  98. package/dist/index.scss +1 -1
  99. package/dist/tsconfig.production.tsbuildinfo +1 -1
  100. package/dist/tsconfig.tsbuildinfo +1 -0
  101. package/dist/types/Autocomplete.d.ts +1 -1
  102. package/dist/types/Autocomplete.d.ts.map +1 -1
  103. package/dist/types/Breadcrumbs.d.ts.map +1 -1
  104. package/dist/types/CssBaseline.d.ts.map +1 -1
  105. package/dist/types/DataTable/reorderDataRowsLocally.d.ts.map +1 -1
  106. package/dist/types/DataTable/useRowReordering.d.ts.map +1 -1
  107. package/dist/types/DataTable/useScrollIndication.d.ts.map +1 -1
  108. package/dist/types/DatePickers/useOdysseyDateFields.d.ts.map +1 -1
  109. package/dist/types/Link.d.ts +3 -3
  110. package/dist/types/Link.d.ts.map +1 -1
  111. package/dist/types/NativeSelect.d.ts.map +1 -1
  112. package/dist/types/OdysseyCacheProvider.d.ts.map +1 -1
  113. package/dist/types/OdysseyTranslationProvider.d.ts +1 -1
  114. package/dist/types/OdysseyTranslationProvider.d.ts.map +1 -1
  115. package/dist/types/Pagination/usePagination.d.ts.map +1 -1
  116. package/dist/types/Select.d.ts.map +1 -1
  117. package/dist/types/Tag.d.ts.map +1 -1
  118. package/dist/types/addSpecificity.d.ts.map +1 -1
  119. package/dist/types/createContrastColors.d.ts +5 -1
  120. package/dist/types/createContrastColors.d.ts.map +1 -1
  121. package/dist/types/getLogicalBoundaries.d.ts +24 -0
  122. package/dist/types/getLogicalBoundaries.d.ts.map +1 -0
  123. package/dist/types/hexToRgb.d.ts.map +1 -1
  124. package/dist/types/i18n.d.ts +1 -0
  125. package/dist/types/i18n.d.ts.map +1 -1
  126. package/dist/types/inputUtils.d.ts.map +1 -1
  127. package/dist/types/labs/DataView/fetchData.d.ts.map +1 -1
  128. package/dist/types/labs/DataView/tableConstants.d.ts.map +1 -1
  129. package/dist/types/labs/DataView/testSupportData.d.ts.map +1 -1
  130. package/dist/types/labs/DataView/useFilterConversion.d.ts.map +1 -1
  131. package/dist/types/labs/GroupPicker.d.ts.map +1 -1
  132. package/dist/types/labs/OdysseyPickers/ComposablePicker.d.ts.map +1 -1
  133. package/dist/types/labs/OdysseyPickers/Picker.d.ts.map +1 -1
  134. package/dist/types/labs/OdysseyPickers/PickerVirtualizationListBox.d.ts.map +1 -1
  135. package/dist/types/labs/PageTemplate/PageTemplate.d.ts.map +1 -1
  136. package/dist/types/labs/PaginatedTable.d.ts.map +1 -1
  137. package/dist/types/labs/StaticTable.d.ts.map +1 -1
  138. package/dist/types/properties/ts/odyssey-react-mui.d.ts +1 -0
  139. package/dist/types/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  140. package/dist/types/properties/ts/odyssey-react-mui_eu.d.ts +131 -0
  141. package/dist/types/properties/ts/odyssey-react-mui_eu.d.ts.map +1 -0
  142. package/dist/types/remUtils.d.ts.map +1 -1
  143. package/dist/types/shadow-dom/shadow-dom.d.ts.map +1 -1
  144. package/dist/types/test-selectors/getByQuerySelector.d.ts.map +1 -1
  145. package/dist/types/test-selectors/getComputedAccessibleErrorMessageText.d.ts.map +1 -1
  146. package/dist/types/test-selectors/getComputedAccessibleText.d.ts.map +1 -1
  147. package/dist/types/test-selectors/interpolateString.d.ts.map +1 -1
  148. package/dist/types/test-selectors/linkedHtmlSelectors.d.ts.map +1 -1
  149. package/dist/types/test-selectors/queryOdysseySelector.d.ts +40 -36
  150. package/dist/types/test-selectors/queryOdysseySelector.d.ts.map +1 -1
  151. package/dist/types/test-selectors/querySelector.d.ts +6 -2
  152. package/dist/types/test-selectors/querySelector.d.ts.map +1 -1
  153. package/dist/types/test-selectors/sanityChecks.d.ts.map +1 -1
  154. package/dist/types/theme/components.d.ts.map +1 -1
  155. package/dist/types/theme/createOdysseyMuiTheme.d.ts.map +1 -1
  156. package/dist/types/theme/mixins.d.ts.map +1 -1
  157. package/dist/types/theme/palette.d.ts.map +1 -1
  158. package/dist/types/theme/pxToRem.d.ts.map +1 -1
  159. package/dist/types/theme/shape.d.ts.map +1 -1
  160. package/dist/types/theme/spacing.d.ts.map +1 -1
  161. package/dist/types/theme/typography.d.ts.map +1 -1
  162. package/dist/types/theme/useMediaQuery.d.ts.map +1 -1
  163. package/dist/types/ui-shell/AppSwitcher/AppSwitcherApp.d.ts.map +1 -1
  164. package/dist/types/ui-shell/InnerAppContainer.d.ts.map +1 -1
  165. package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
  166. package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
  167. package/dist/types/ui-shell/SideNav/SideNavItemContent.d.ts.map +1 -1
  168. package/dist/types/ui-shell/SideNav/SideNavItemLinkContent.d.ts.map +1 -1
  169. package/dist/types/ui-shell/SideNav/SideNavToggleButton.d.ts.map +1 -1
  170. package/dist/types/ui-shell/SideNav/SortableList/SortableItem.d.ts.map +1 -1
  171. package/dist/types/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.d.ts.map +1 -1
  172. package/dist/types/ui-shell/UiShell.d.ts +1 -1
  173. package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
  174. package/dist/types/ui-shell/UiShellProvider.d.ts +10 -4
  175. package/dist/types/ui-shell/UiShellProvider.d.ts.map +1 -1
  176. package/dist/types/ui-shell/bufferLatest.d.ts.map +1 -1
  177. package/dist/types/ui-shell/createMessageBus.d.ts.map +1 -1
  178. package/dist/types/ui-shell/createStore.d.ts.map +1 -1
  179. package/dist/types/ui-shell/renderUiShell.d.ts +2 -2
  180. package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
  181. package/dist/types/ui-shell/useElementAtContainerEdge.d.ts +43 -0
  182. package/dist/types/ui-shell/useElementAtContainerEdge.d.ts.map +1 -0
  183. package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts.map +1 -1
  184. package/dist/types/ui-shell/useScrollState.d.ts +6 -2
  185. package/dist/types/ui-shell/useScrollState.d.ts.map +1 -1
  186. package/dist/types/ui-shell/useUiShellBreakpoints.d.ts.map +1 -1
  187. package/dist/types/useAutocomplete.d.ts.map +1 -1
  188. package/dist/types/useContrastMode.d.ts.map +1 -1
  189. package/dist/types/useMountLifecycleEffect.d.ts.map +1 -1
  190. package/dist/types/useNormalizedKey.d.ts.map +1 -1
  191. package/dist/types/useSessionStorageState.d.ts.map +1 -1
  192. package/dist/types/useUniqueAlphabeticalId.d.ts.map +1 -1
  193. package/dist/types/useUniqueId.d.ts.map +1 -1
  194. package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts +1 -1
  195. package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts.map +1 -1
  196. package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
  197. package/package.json +13 -13
@@ -23,12 +23,13 @@ const SideNavItemLabelContainer = styled("div", {
23
23
  odysseyDesignTokens,
24
24
  isIconVisible
25
25
  }) => ({
26
- width: "100%",
26
+ alignItems: "center",
27
27
  display: "flex",
28
28
  flexWrap: "wrap",
29
- alignItems: "center",
30
29
  fontSize: odysseyDesignTokens.TypographySizeBody,
31
- marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0
30
+ marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,
31
+ overflowWrap: "anywhere",
32
+ width: "100%"
32
33
  }));
33
34
  const SideNavItemLinkContent = ({
34
35
  count,
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavItemLinkContent.js","names":["styled","memo","useMemo","useOdysseyDesignTokens","Box","Status","Badge","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SideNavItemLabelContainer","shouldForwardProp","prop","odysseyDesignTokens","isIconVisible","width","display","flexWrap","alignItems","fontSize","TypographySizeBody","marginInlineStart","Spacing3","SideNavItemLinkContent","count","label","startIcon","endIcon","severity","statusLabel","translate","sideNavItemContentStyles","gap","Spacing1","Spacing2","children","Boolean","sx","badgeContent","MemoizedSideNavItemLinkContent","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavItemLinkContent.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, ReactNode, useMemo } from \"react\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Box } from \"../../Box.js\";\nimport { Status } from \"../../Status.js\";\nimport type { SideNavItem } from \"./types.js\";\nimport { Badge } from \"../../Badge.js\";\n\nconst SideNavItemLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isIconVisible\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isIconVisible: boolean;\n}>(({ odysseyDesignTokens, isIconVisible }) => ({\n width: \"100%\",\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n fontSize: odysseyDesignTokens.TypographySizeBody,\n marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,\n}));\n\nconst SideNavItemLinkContent = ({\n count,\n label,\n startIcon,\n endIcon,\n severity,\n statusLabel,\n translate,\n}: Pick<\n SideNavItem,\n | \"count\"\n | \"label\"\n | \"startIcon\"\n | \"endIcon\"\n | \"severity\"\n | \"statusLabel\"\n | \"translate\"\n>): ReactNode => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const sideNavItemContentStyles = useMemo(\n () => ({\n alignItems: \"center\",\n display: \"flex\",\n gap: odysseyDesignTokens.Spacing1,\n marginInlineStart: odysseyDesignTokens.Spacing2,\n }),\n [odysseyDesignTokens],\n );\n\n return (\n <>\n {startIcon && startIcon}\n <SideNavItemLabelContainer\n odysseyDesignTokens={odysseyDesignTokens}\n isIconVisible={Boolean(startIcon)}\n translate={translate}\n >\n {label}\n {!count && severity && (\n <Box sx={sideNavItemContentStyles}>\n {severity && (\n <Status severity={severity} label={statusLabel || \"\"} />\n )}\n </Box>\n )}\n {!severity && count && (\n <Box sx={sideNavItemContentStyles}>\n {count && <Badge badgeContent={count} />}\n </Box>\n )}\n </SideNavItemLabelContainer>\n {endIcon && endIcon}\n </>\n );\n};\nconst MemoizedSideNavItemLinkContent = memo(SideNavItemLinkContent);\nMemoizedSideNavItemLinkContent.displayName = \"SideNavItemLinkContent\";\n\nexport { MemoizedSideNavItemLinkContent as SideNavItemLinkContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAChD,SAEEC,sBAAsB,QACjB,qCAAqC;AAC5C,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,MAAM,QAAQ,iBAAiB;AAExC,SAASC,KAAK,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEvC,MAAMC,yBAAyB,GAAGb,MAAM,CAAC,KAAK,EAAE;EAC9Cc,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAAIA,IAAI,KAAK;AAC/C,CAAC,CAAC,CAGC,CAAC;EAAEC,mBAAmB;EAAEC;AAAc,CAAC,MAAM;EAC9CC,KAAK,EAAE,MAAM;EACbC,OAAO,EAAE,MAAM;EACfC,QAA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C,CACrC,CACN;IAAA,CACwB,CAAC,EAC3BG,OAAO,IAAIA,OAAO;EAAA,CACnB,CAAC;AAEP,CAAC;AACD,MAAMY,8BAA8B,GAAGzC,IAAI,CAACyB,sBAAsB,CAAC;AACnEgB,8BAA8B,CAACC,WAAW,GAAG,wBAAwB;AAErE,SAASD,8BAA8B,IAAIhB,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"SideNavItemLinkContent.js","names":["styled","memo","useMemo","useOdysseyDesignTokens","Box","Status","Badge","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SideNavItemLabelContainer","shouldForwardProp","prop","odysseyDesignTokens","isIconVisible","alignItems","display","flexWrap","fontSize","TypographySizeBody","marginInlineStart","Spacing3","overflowWrap","width","SideNavItemLinkContent","count","label","startIcon","endIcon","severity","statusLabel","translate","sideNavItemContentStyles","gap","Spacing1","Spacing2","children","Boolean","sx","badgeContent","MemoizedSideNavItemLinkContent","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavItemLinkContent.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, ReactNode, useMemo } from \"react\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Box } from \"../../Box.js\";\nimport { Status } from \"../../Status.js\";\nimport type { SideNavItem } from \"./types.js\";\nimport { Badge } from \"../../Badge.js\";\n\nconst SideNavItemLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isIconVisible\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isIconVisible: boolean;\n}>(({ odysseyDesignTokens, isIconVisible }) => ({\n alignItems: \"center\",\n display: \"flex\",\n flexWrap: \"wrap\",\n fontSize: odysseyDesignTokens.TypographySizeBody,\n marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,\n overflowWrap: \"anywhere\", // New way to do `wordBreak: \"break-word\"`. Source: https://developer.mozilla.org/en-US/docs/Web/CSS/word-break#break-word\n width: \"100%\",\n}));\n\nconst SideNavItemLinkContent = ({\n count,\n label,\n startIcon,\n endIcon,\n severity,\n statusLabel,\n translate,\n}: Pick<\n SideNavItem,\n | \"count\"\n | \"label\"\n | \"startIcon\"\n | \"endIcon\"\n | \"severity\"\n | \"statusLabel\"\n | \"translate\"\n>): ReactNode => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const sideNavItemContentStyles = useMemo(\n () => ({\n alignItems: \"center\",\n display: \"flex\",\n gap: odysseyDesignTokens.Spacing1,\n marginInlineStart: odysseyDesignTokens.Spacing2,\n }),\n [odysseyDesignTokens],\n );\n\n return (\n <>\n {startIcon && startIcon}\n <SideNavItemLabelContainer\n odysseyDesignTokens={odysseyDesignTokens}\n isIconVisible={Boolean(startIcon)}\n translate={translate}\n >\n {label}\n {!count && severity && (\n <Box sx={sideNavItemContentStyles}>\n {severity && (\n <Status severity={severity} label={statusLabel || \"\"} />\n )}\n </Box>\n )}\n {!severity && count && (\n <Box sx={sideNavItemContentStyles}>\n {count && <Badge badgeContent={count} />}\n </Box>\n )}\n </SideNavItemLabelContainer>\n {endIcon && endIcon}\n </>\n );\n};\nconst MemoizedSideNavItemLinkContent = memo(SideNavItemLinkContent);\nMemoizedSideNavItemLinkContent.displayName = \"SideNavItemLinkContent\";\n\nexport { MemoizedSideNavItemLinkContent as SideNavItemLinkContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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GACGT,SAAS,IAAIA,SAAS,EACvBpB,KAAA,CAACG,yBAAyB;MACxBG,mBAAmB,EAAEA,mBAAoB;MACzCC,aAAa,EAAEuB,OAAO,CAACV,SAAS,CAAE;MAClCI,SAAS,EAAEA,SAAU;MAAAK,QAAA,GAEpBV,KAAK,EACL,CAACD,KAAK,IAAII,QAAQ,IACjBxB,IAAA,CAACJ,GAAG;QAACqC,EAAE,EAAEN,wBAAyB;QAAAI,QAAA,EAC/BP,QAAQ,IACPxB,IAAA,CAACH,MAAM;UAAC2B,QAAQ,EAAEA,QAAS;UAACH,KAAK,EAAEI,WAAW,IAAI;QAAG,CAAE;MACxD,CACE,CACN,EACA,CAACD,QAAQ,IAAIJ,KAAK,IACjBpB,IAAA,CAACJ,GAAG;QAACqC,EAAE,EAAEN,wBAAyB;QAAAI,QAAA,EAC/BX,KAAK,IAAIpB,IAAA,CAACF,KAAK;UAACoC,YAAY,EAAEd;QAAM,CAAE;MAAC,CACrC,CACN;IAAA,CACwB,CAAC,EAC3BG,OAAO,IAAIA,OAAO;EAAA,CACnB,CAAC;AAEP,CAAC;AACD,MAAMY,8BAA8B,GAAG1C,IAAI,CAAC0B,sBAAsB,CAAC;AACnEgB,8BAA8B,CAACC,WAAW,GAAG,wBAAwB;AAErE,SAASD,8BAA8B,IAAIhB,sBAAsB","ignoreList":[]}
@@ -79,7 +79,7 @@ const StyledChevronRightIcon = styled(ChevronRightIcon, {
79
79
  transitionProperty: "transform",
80
80
  transitionTimingFunction: "ease-in-out"
81
81
  }));
82
- const defaultLocalButton = document.createElement("button");
82
+ const defaultLocalButton = typeof window === "undefined" ? null : document.createElement("button");
83
83
  const SideNavToggleButton = ({
84
84
  ariaControls,
85
85
  clickAreaPadding = 0,
@@ -102,18 +102,18 @@ const SideNavToggleButton = ({
102
102
  onHighlight?.(false);
103
103
  };
104
104
  const setFocusHighlighted = () => {
105
- onHighlight?.(buttonRef.current.matches(":focus-visible"));
105
+ onHighlight?.(Boolean(buttonRef.current?.matches(":focus-visible")));
106
106
  };
107
- buttonRef.current.addEventListener("mouseenter", setHighlighted);
108
- buttonRef.current.addEventListener("mouseleave", setUnhighlighted);
109
- buttonRef.current.addEventListener("focus", setFocusHighlighted, true);
110
- buttonRef.current.addEventListener("blur", setFocusHighlighted, true);
107
+ buttonRef.current?.addEventListener("mouseenter", setHighlighted);
108
+ buttonRef.current?.addEventListener("mouseleave", setUnhighlighted);
109
+ buttonRef.current?.addEventListener("focus", setFocusHighlighted, true);
110
+ buttonRef.current?.addEventListener("blur", setFocusHighlighted, true);
111
111
  setUnhighlighted();
112
112
  return () => {
113
- buttonRef.current.removeEventListener("mouseenter", setHighlighted);
114
- buttonRef.current.removeEventListener("mouseleave", setUnhighlighted);
115
- buttonRef.current.removeEventListener("focus", setFocusHighlighted, true);
116
- buttonRef.current.removeEventListener("blur", setFocusHighlighted, true);
113
+ buttonRef.current?.removeEventListener("mouseenter", setHighlighted);
114
+ buttonRef.current?.removeEventListener("mouseleave", setUnhighlighted);
115
+ buttonRef.current?.removeEventListener("focus", setFocusHighlighted, true);
116
+ buttonRef.current?.removeEventListener("blur", setFocusHighlighted, true);
117
117
  };
118
118
  }, [onHighlight]);
119
119
  const toggleLabel = useMemo(() => isSideNavCollapsed ? t("sidenav.toggle.expand") : t("sidenav.toggle.collapse"), [isSideNavCollapsed, t]);
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useEffect","useMemo","useRef","styled","useTranslation","MuiPropsContext","useOdysseyDesignTokens","Tooltip","UI_SHELL_OVERLAY_Z_INDEX","ChevronRightIcon","jsx","_jsx","SIDE_NAV_TOGGLE_ICON_SIZE","SIDE_NAV_TOGGLE_ICON_HALF_SIZE","StyledToggleButton","_Button","shouldForwardProp","prop","clickAreaPadding","odysseyDesignTokens","border","height","left","padding","position","width","zIndex","backgroundColor","borderColor","boxShadow","color","PalettePrimaryText","outline","HueNeutralWhite","borderRadius","ShadowScale1","content","top","StyledChevronRightIcon","isSideNavCollapsed","fontSize","undefined","right","transform","transitionDuration","TransitionDurationMain","transitionProperty","transitionTimingFunction","defaultLocalButton","document","createElement","SideNavToggleButton","ariaControls","id","onClick","onHighlight","tabIndex","t","buttonRef","setHighlighted","setUnhighlighted","setFocusHighlighted","current","matches","addEventListener","removeEventListener","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavToggleButton.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 useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Tooltip } from \"../../Tooltip.js\";\nimport { UI_SHELL_OVERLAY_Z_INDEX } from \"../uiShellSharedConstants.js\";\nimport { ChevronRightIcon } from \"../../icons.generated/ChevronRight.js\";\n\nexport const SIDE_NAV_TOGGLE_ICON_SIZE = 24;\nexport const SIDE_NAV_TOGGLE_ICON_HALF_SIZE = SIDE_NAV_TOGGLE_ICON_SIZE / 2;\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"clickAreaPadding\" && prop !== \"odysseyDesignTokens\",\n})<{\n clickAreaPadding: number;\n odysseyDesignTokens: DesignTokens;\n}>(({ clickAreaPadding, odysseyDesignTokens }) => ({\n border: 0,\n height: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n left: `-${clickAreaPadding * 2}px`,\n padding: 0,\n position: \"relative\",\n width: `calc(${SIDE_NAV_TOGGLE_ICON_SIZE}px + (${clickAreaPadding}px * 2))`,\n zIndex: UI_SHELL_OVERLAY_Z_INDEX,\n\n // `&&` is a CSS specificity override. Used here to counteract MUI Button styles.\n \"&&\": {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n boxShadow: \"none\",\n color: odysseyDesignTokens.PalettePrimaryText,\n },\n\n \"&:focus-visible\": {\n outline: \"none\",\n },\n\n \"&:hover, &:focus-visible\": {\n color: odysseyDesignTokens.HueNeutralWhite,\n },\n\n \"&::before\": {\n backgroundColor: odysseyDesignTokens.HueNeutralWhite,\n borderColor: \"transparent\",\n borderRadius: \"50%\",\n boxShadow: odysseyDesignTokens.ShadowScale1,\n color: odysseyDesignTokens.PalettePrimaryText,\n content: \"''\",\n height: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n left: `${clickAreaPadding * 2}px`,\n position: \"absolute\",\n top: 0,\n width: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n },\n\n \"&:hover::before, &:focus-visible::before\": {\n backgroundColor: odysseyDesignTokens.PalettePrimaryText,\n },\n}));\n\nconst StyledChevronRightIcon = styled(ChevronRightIcon, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSideNavCollapsed\",\n})<{\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n}>(({ isSideNavCollapsed, odysseyDesignTokens }) => ({\n fontSize: \"125%\",\n left: isSideNavCollapsed ? undefined : \"4px\",\n position: \"absolute\",\n right: isSideNavCollapsed ? \"4px\" : undefined,\n top: \"3px\",\n transform: isSideNavCollapsed ? \"rotate(0deg)\" : \"rotate(-180deg)\", // Leave this as `-180deg` so it rotates over the top, not the bottom.\n transitionDuration: odysseyDesignTokens.TransitionDurationMain,\n transitionProperty: \"transform\",\n transitionTimingFunction: \"ease-in-out\",\n}));\n\nexport type SideNavToggleButtonProps = {\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * Left padding in pixels for the click area of the button.\n *\n * Useful when moving the button around when trying to click it. This ensures the click area doesn't move to the right along with the button.\n */\n clickAreaPadding?: number;\n /**\n * HTML `id` attribute for the `<button>` element.\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * Click event handler for the `<button>` element.\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * Provides the hovered or focused state of the `<button>` element.\n */\n onHighlight?: (isHighlighted: boolean) => void;\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\n// This allows us to mutate the value with TypeScript. A singleton is fine because it gets overridden on render.\nconst defaultLocalButton = document.createElement(\"button\");\n\nconst SideNavToggleButton = ({\n ariaControls,\n clickAreaPadding = 0,\n id,\n isSideNavCollapsed,\n onClick,\n onHighlight,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const buttonRef = useRef(defaultLocalButton);\n\n useEffect(() => {\n const setHighlighted = () => {\n onHighlight?.(true);\n };\n\n const setUnhighlighted = () => {\n onHighlight?.(false);\n };\n\n const setFocusHighlighted = () => {\n onHighlight?.(buttonRef.current.matches(\":focus-visible\"));\n };\n\n buttonRef.current.addEventListener(\"mouseenter\", setHighlighted);\n\n buttonRef.current.addEventListener(\"mouseleave\", setUnhighlighted);\n\n buttonRef.current.addEventListener(\"focus\", setFocusHighlighted, true);\n\n buttonRef.current.addEventListener(\"blur\", setFocusHighlighted, true);\n\n setUnhighlighted();\n\n return () => {\n buttonRef.current.removeEventListener(\"mouseenter\", setHighlighted);\n\n buttonRef.current.removeEventListener(\"mouseleave\", setUnhighlighted);\n\n buttonRef.current.removeEventListener(\"focus\", setFocusHighlighted, true);\n\n buttonRef.current.removeEventListener(\"blur\", setFocusHighlighted, true);\n };\n }, [onHighlight]);\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n clickAreaPadding={clickAreaPadding}\n data-se=\"sidenav-toggle-button\"\n data-sidenav-toggle\n id={id}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element: HTMLButtonElement) => {\n if (element) {\n buttonRef.current = element;\n //@ts-expect-error `ref` is an optional prop, but TypeScript doesn't know this.\n muiProps.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n variant=\"floating\"\n >\n <StyledChevronRightIcon\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n clickAreaPadding,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,QACD,OAAO;AAC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BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAI1B,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useEffect","useMemo","useRef","styled","useTranslation","MuiPropsContext","useOdysseyDesignTokens","Tooltip","UI_SHELL_OVERLAY_Z_INDEX","ChevronRightIcon","jsx","_jsx","SIDE_NAV_TOGGLE_ICON_SIZE","SIDE_NAV_TOGGLE_ICON_HALF_SIZE","StyledToggleButton","_Button","shouldForwardProp","prop","clickAreaPadding","odysseyDesignTokens","border","height","left","padding","position","width","zIndex","backgroundColor","borderColor","boxShadow","color","PalettePrimaryText","outline","HueNeutralWhite","borderRadius","ShadowScale1","content","top","StyledChevronRightIcon","isSideNavCollapsed","fontSize","undefined","right","transform","transitionDuration","TransitionDurationMain","transitionProperty","transitionTimingFunction","defaultLocalButton","window","document","createElement","SideNavToggleButton","ariaControls","id","onClick","onHighlight","tabIndex","t","buttonRef","setHighlighted","setUnhighlighted","setFocusHighlighted","Boolean","current","matches","addEventListener","removeEventListener","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../../src/ui-shell/SideNav/SideNavToggleButton.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 useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Tooltip } from \"../../Tooltip.js\";\nimport { UI_SHELL_OVERLAY_Z_INDEX } from \"../uiShellSharedConstants.js\";\nimport { ChevronRightIcon } from \"../../icons.generated/ChevronRight.js\";\n\nexport const SIDE_NAV_TOGGLE_ICON_SIZE = 24;\nexport const SIDE_NAV_TOGGLE_ICON_HALF_SIZE = SIDE_NAV_TOGGLE_ICON_SIZE / 2;\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"clickAreaPadding\" && prop !== \"odysseyDesignTokens\",\n})<{\n clickAreaPadding: number;\n odysseyDesignTokens: DesignTokens;\n}>(({ clickAreaPadding, odysseyDesignTokens }) => ({\n border: 0,\n height: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n left: `-${clickAreaPadding * 2}px`,\n padding: 0,\n position: \"relative\",\n width: `calc(${SIDE_NAV_TOGGLE_ICON_SIZE}px + (${clickAreaPadding}px * 2))`,\n zIndex: UI_SHELL_OVERLAY_Z_INDEX,\n\n // `&&` is a CSS specificity override. Used here to counteract MUI Button styles.\n \"&&\": {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n boxShadow: \"none\",\n color: odysseyDesignTokens.PalettePrimaryText,\n },\n\n \"&:focus-visible\": {\n outline: \"none\",\n },\n\n \"&:hover, &:focus-visible\": {\n color: odysseyDesignTokens.HueNeutralWhite,\n },\n\n \"&::before\": {\n backgroundColor: odysseyDesignTokens.HueNeutralWhite,\n borderColor: \"transparent\",\n borderRadius: \"50%\",\n boxShadow: odysseyDesignTokens.ShadowScale1,\n color: odysseyDesignTokens.PalettePrimaryText,\n content: \"''\",\n height: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n left: `${clickAreaPadding * 2}px`,\n position: \"absolute\",\n top: 0,\n width: `${SIDE_NAV_TOGGLE_ICON_SIZE}px`,\n },\n\n \"&:hover::before, &:focus-visible::before\": {\n backgroundColor: odysseyDesignTokens.PalettePrimaryText,\n },\n}));\n\nconst StyledChevronRightIcon = styled(ChevronRightIcon, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSideNavCollapsed\",\n})<{\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n}>(({ isSideNavCollapsed, odysseyDesignTokens }) => ({\n fontSize: \"125%\",\n left: isSideNavCollapsed ? undefined : \"4px\",\n position: \"absolute\",\n right: isSideNavCollapsed ? \"4px\" : undefined,\n top: \"3px\",\n transform: isSideNavCollapsed ? \"rotate(0deg)\" : \"rotate(-180deg)\", // Leave this as `-180deg` so it rotates over the top, not the bottom.\n transitionDuration: odysseyDesignTokens.TransitionDurationMain,\n transitionProperty: \"transform\",\n transitionTimingFunction: \"ease-in-out\",\n}));\n\nexport type SideNavToggleButtonProps = {\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * Left padding in pixels for the click area of the button.\n *\n * Useful when moving the button around when trying to click it. This ensures the click area doesn't move to the right along with the button.\n */\n clickAreaPadding?: number;\n /**\n * HTML `id` attribute for the `<button>` element.\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * Click event handler for the `<button>` element.\n */\n onClick?: MuiButtonProps[\"onClick\"];\n /**\n * Provides the hovered or focused state of the `<button>` element.\n */\n onHighlight?: (isHighlighted: boolean) => void;\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\n// This allows us to mutate the value with TypeScript. A singleton is fine because it gets overridden on render.\nconst defaultLocalButton =\n typeof window === \"undefined\" ? null : document.createElement(\"button\");\n\nconst SideNavToggleButton = ({\n ariaControls,\n clickAreaPadding = 0,\n id,\n isSideNavCollapsed,\n onClick,\n onHighlight,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const buttonRef = useRef(defaultLocalButton);\n\n useEffect(() => {\n const setHighlighted = () => {\n onHighlight?.(true);\n };\n\n const setUnhighlighted = () => {\n onHighlight?.(false);\n };\n\n const setFocusHighlighted = () => {\n onHighlight?.(Boolean(buttonRef.current?.matches(\":focus-visible\")));\n };\n\n buttonRef.current?.addEventListener(\"mouseenter\", setHighlighted);\n\n buttonRef.current?.addEventListener(\"mouseleave\", setUnhighlighted);\n\n buttonRef.current?.addEventListener(\"focus\", setFocusHighlighted, true);\n\n buttonRef.current?.addEventListener(\"blur\", setFocusHighlighted, true);\n\n setUnhighlighted();\n\n return () => {\n buttonRef.current?.removeEventListener(\"mouseenter\", setHighlighted);\n\n buttonRef.current?.removeEventListener(\"mouseleave\", setUnhighlighted);\n\n buttonRef.current?.removeEventListener(\n \"focus\",\n setFocusHighlighted,\n true,\n );\n\n buttonRef.current?.removeEventListener(\"blur\", setFocusHighlighted, true);\n };\n }, [onHighlight]);\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n clickAreaPadding={clickAreaPadding}\n data-se=\"sidenav-toggle-button\"\n data-sidenav-toggle\n id={id}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element: HTMLButtonElement) => {\n if (element) {\n buttonRef.current = element;\n //@ts-expect-error `ref` is an optional prop, but TypeScript doesn't know this.\n muiProps.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n variant=\"floating\"\n >\n <StyledChevronRightIcon\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n clickAreaPadding,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAE9C,SAASC,eAAe,QAA6B,0BAA0B;AAC/E,SAEEC,sBAAsB,QACjB,qCAAqC;AAC5C,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,wBAAwB,QAAQ,8BAA8B;AACvE,SAASC,gBAAgB,QAAQ,uCAAuC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEzE,OAAO,MAAMC,yBAAyB,GAAG,EAAE;AAC3C,OAAO,MAAMC,8BAA8B,GAAGD,yBAAyB,GAAG,CAAC;AAE3E,MAAME,kBAAkB,GAAGX,MAAM,CAAAY,OAAA,EAAY;EAC3CC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,kBAAkB,IAAIA,IAAI,KAAK;AAC5C,CAAC,CAAC,CAGC,CAAC;EAAEC,gBAAgB;EAAEC;AAAoB,CAAC,MAAM;EACjDC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,GAAGT,yBAAyB,IAAI;EACxCU,IAAI,EAAE,IAAIJ,gBAAgB,GAAG,CAAC,IAAI;EAClC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A,QAAS;MACnBgB,OAAO,EAAC,UAAU;MAAAC,QAAA,EAElB/D,IAAA,CAAC2B,sBAAsB;QACrBC,kBAAkB,EAAEA,kBAAmB;QACvCpB,mBAAmB,EAAEA;MAAoB,CAC1C;IAAC,CACgB,CAAC;EAEzB,CAAC,EACD,CACEkC,YAAY,EACZnC,gBAAgB,EAChBoC,EAAE,EACFf,kBAAkB,EAClBpB,mBAAmB,EACnBoC,OAAO,EACPE,QAAQ,EACRW,WAAW,CAEf,CAAC;EAED,OACEzD,IAAA,CAACJ,OAAO;IAACoE,QAAQ,EAAC,aAAa;IAACC,SAAS,EAAC,OAAO;IAACC,IAAI,EAAET,WAAY;IAAAM,QAAA,EAClE/D,IAAA,CAACN,eAAe,CAACyE,QAAQ;MAAAJ,QAAA,EAAEL;IAAY,CAA2B;EAAC,CAC5D,CAAC;AAEd,CAAC;AAED,MAAMU,2BAA2B,GAAGjF,IAAI,CAACsD,mBAAmB,CAAC;AAC7D2B,2BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAI3B,mBAAmB","ignoreList":[]}
@@ -39,6 +39,7 @@ const UiShell = ({
39
39
  onSubscriptionCreated,
40
40
  optionalComponents,
41
41
  sideNavBackgroundColor,
42
+ sideNavBackgroundContrastColor,
42
43
  subscribeToCloseRightSideMenu,
43
44
  subscribeToCloseSideNavMenu,
44
45
  subscribeToPropChanges,
@@ -71,6 +72,7 @@ const UiShell = ({
71
72
  appBackgroundContrastMode: appBackgroundContrastMode,
72
73
  closeSideNavMenu: closeSideNavMenu,
73
74
  sideNavBackgroundColor: sideNavBackgroundColor,
75
+ sideNavBackgroundContrastColor: sideNavBackgroundContrastColor,
74
76
  subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu,
75
77
  subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu,
76
78
  topNavBackgroundColor: topNavBackgroundColor,
@@ -1 +1 @@
1
- {"version":3,"file":"UiShell.js","names":["memo","useEffect","useState","ErrorBoundary","CssBaseline","NarrowUiShellContent","OdysseyProvider","UiShellProvider","useUiShellBreakpoints","WideUiShellContent","jsx","_jsx","jsxs","_jsxs","defaultComponentProps","sideNavProps","undefined","topNavProps","errorComponent","UiShell","appBackgroundColor","appBackgroundContrastMode","appElement","appElementScrollingMode","breakpointConfig","closeSideNavMenu","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onSubscriptionCreated","optionalComponents","sideNavBackgroundColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","subscribeToPropChanges","topNavBackgroundColor","uiShellAppElement","uiShellStylesElement","componentProps","setComponentProps","activeBreakpoint","unsubscribe","fallback","children","emotionRootElement","shadowRootElement","hasSideNavProps","Boolean","hasSessionStorageState","isCollapsed","isCollapsible","MemoizedUiShell","displayName"],"sources":["../../../src/ui-shell/UiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useEffect, useState, type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { type ReactRootElements } from \"../web-component/createReactRootElements.js\";\nimport { CssBaseline } from \"../CssBaseline.js\";\nimport { NarrowUiShellContent } from \"./NarrowUiShellContent.js\";\nimport { OdysseyProvider } from \"../OdysseyProvider.js\";\nimport { UiShellProvider, UiShellProviderProps } from \"./UiShellProvider.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport {\n UiShellBreakpointConfig,\n useUiShellBreakpoints,\n} from \"./useUiShellBreakpoints.js\";\nimport { WideUiShellContent } from \"./WideUiShellContent.js\";\nimport { MessageBus } from \"./createMessageBus.js\";\n\nexport const defaultComponentProps: UiShellNavComponentProps = {\n sideNavProps: undefined,\n topNavProps: undefined,\n} as const;\n\nconst errorComponent = <div data-error />;\n\nexport type UiShellProps = {\n /**\n * Customized breakpoints for UI Shell.\n *\n * The defaults are set for you. Pass these only if your app doesn't work properly with the defaults (like Admin).\n */\n breakpointConfig?: UiShellBreakpointConfig;\n /**\n * Notifies when subscribed to prop changes.\n *\n * UI Shell listens to prop updates, and it won't subscribe synchronously. Because of that, this callback notifies when that subscription is ready.\n */\n onSubscriptionCreated: () => void;\n /**\n * This is a callback that provides a subscriber callback to listen for changes to state.\n * It allows UI Shell to listen for state changes.\n *\n * The props coming in this callback go directly to a React state; therefore, it shares the same signature and provides a previous state.\n */\n subscribeToPropChanges: MessageBus<\n SetStateAction<UiShellNavComponentProps>\n >[\"subscribe\"];\n /**\n * Element inside UI Shell's React root component renders into. If using a web component, this is going to exist inside it.\n */\n uiShellAppElement: ReactRootElements[\"appRootElement\"];\n /**\n * Typically, this is your `<head>` element. If using a web component, you need to create one yourself as Shadow DOM's don't have a `<head>`.\n */\n uiShellStylesElement: ReactRootElements[\"stylesRootElement\"];\n} & UiShellProviderProps &\n Pick<\n UiShellContentProps,\n | \"appElement\"\n | \"appElementScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"onError\"\n | \"optionalComponents\"\n >;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement,\n appElementScrollingMode,\n breakpointConfig,\n closeSideNavMenu,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n onSubscriptionCreated,\n optionalComponents,\n sideNavBackgroundColor,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n subscribeToPropChanges,\n topNavBackgroundColor,\n uiShellAppElement,\n uiShellStylesElement,\n}: UiShellProps) => {\n const [componentProps, setComponentProps] = useState(defaultComponentProps);\n\n const activeBreakpoint = useUiShellBreakpoints(breakpointConfig);\n\n useEffect(() => {\n const unsubscribe = subscribeToPropChanges((componentProps) => {\n // If for some reason nothing is passed as `componentProps`, we fallback on `defaultComponentProps` as a safety mechanism to ensure nothing breaks.\n setComponentProps(componentProps || defaultComponentProps);\n });\n\n onSubscriptionCreated();\n\n return () => {\n unsubscribe();\n };\n }, [onSubscriptionCreated, subscribeToPropChanges]);\n\n return activeBreakpoint === \"none\" ? null : (\n <ErrorBoundary fallback={errorComponent} onError={onError}>\n <OdysseyProvider\n emotionRootElement={uiShellStylesElement}\n shadowRootElement={uiShellAppElement}\n >\n <ErrorBoundary fallback={errorComponent} onError={onError}>\n <CssBaseline />\n\n <UiShellProvider\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n closeSideNavMenu={closeSideNavMenu}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n topNavBackgroundColor={topNavBackgroundColor}\n >\n {activeBreakpoint === \"narrow\" && (\n <NarrowUiShellContent\n {...componentProps}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n hasSideNavProps={Boolean(componentProps.sideNavProps)}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n optionalComponents={optionalComponents}\n />\n )}\n\n {(activeBreakpoint === \"medium\" || activeBreakpoint === \"wide\") && (\n <WideUiShellContent\n {...{\n ...componentProps,\n ...{\n sideNavProps: {\n ...componentProps.sideNavProps,\n hasSessionStorageState: activeBreakpoint === \"wide\",\n isCollapsed:\n activeBreakpoint === \"medium\" ||\n componentProps.sideNavProps?.isCollapsed,\n isCollapsible:\n activeBreakpoint === \"medium\" ||\n componentProps.sideNavProps?.isCollapsible,\n // We have to use `as` because sideNavProps expects you to have `sideNavItems` defined even though it had to be passed in `...componentProps.sideNavProps`.\n } as typeof componentProps.sideNavProps,\n },\n }}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n hasSideNavProps={Boolean(componentProps.sideNavProps)}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n optionalComponents={optionalComponents}\n />\n )}\n </UiShellProvider>\n </ErrorBoundary>\n </OdysseyProvider>\n </ErrorBoundary>\n );\n};\n\nconst MemoizedUiShell = memo(UiShell);\nMemoizedUiShell.displayName = \"UiShell\";\n\nexport { MemoizedUiShell as UiShell };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAA6B,OAAO;AACtE,SAASC,aAAa,QAAQ,sBAAsB;AAGpD,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAA8B,sBAAsB;AAK5E,SAEEC,qBAAqB,QAChB,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG7D,OAAO,MAAMC,qBAA+C,GAAG;EAC7DC,YAAY,EAAEC,SAAS;EACvBC,WAAW,EAAED;AACf,CAAU;AAEV,MAAME,cAAc,GAAGP,IAAA;EAAK;AAAU,CAAE,CAAC;AAkDzC,MAAMQ,OAAO,GAAGA,CAAC;EACfC,kBAAkB;EAClBC,yBAAyB;EACzBC,UAAU;EACVC,uBAAuB;EACvBC,gBAAgB;EAChBC,gBAAgB;EAChBC,4BAA4B;EAC5BC,sBAAsB;EACtBC,OAAO,GAAGC,OAAO,CAACC,KAAK;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ErrorBoundary","CssBaseline","NarrowUiShellContent","OdysseyProvider","UiShellProvider","useUiShellBreakpoints","WideUiShellContent","jsx","_jsx","jsxs","_jsxs","defaultComponentProps","sideNavProps","undefined","topNavProps","errorComponent","UiShell","appBackgroundColor","appBackgroundContrastMode","appElement","appElementScrollingMode","breakpointConfig","closeSideNavMenu","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onSubscriptionCreated","optionalComponents","sideNavBackgroundColor","sideNavBackgroundContrastColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","subscribeToPropChanges","topNavBackgroundColor","uiShellAppElement","uiShellStylesElement","componentProps","setComponentProps","activeBreakpoint","unsubscribe","fallback","children","emotionRootElement","shadowRootElement","hasSideNavProps","Boolean","hasSessionStorageState","isCollapsed","isCollapsible","MemoizedUiShell","displayName"],"sources":["../../../src/ui-shell/UiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useEffect, useState, type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { type ReactRootElements } from \"../web-component/createReactRootElements.js\";\nimport { CssBaseline } from \"../CssBaseline.js\";\nimport { NarrowUiShellContent } from \"./NarrowUiShellContent.js\";\nimport { OdysseyProvider } from \"../OdysseyProvider.js\";\nimport { UiShellProvider, UiShellProviderProps } from \"./UiShellProvider.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport {\n UiShellBreakpointConfig,\n useUiShellBreakpoints,\n} from \"./useUiShellBreakpoints.js\";\nimport { WideUiShellContent } from \"./WideUiShellContent.js\";\nimport { MessageBus } from \"./createMessageBus.js\";\n\nexport const defaultComponentProps: UiShellNavComponentProps = {\n sideNavProps: undefined,\n topNavProps: undefined,\n} as const;\n\nconst errorComponent = <div data-error />;\n\nexport type UiShellProps = {\n /**\n * Customized breakpoints for UI Shell.\n *\n * The defaults are set for you. Pass these only if your app doesn't work properly with the defaults (like Admin).\n */\n breakpointConfig?: UiShellBreakpointConfig;\n /**\n * Notifies when subscribed to prop changes.\n *\n * UI Shell listens to prop updates, and it won't subscribe synchronously. Because of that, this callback notifies when that subscription is ready.\n */\n onSubscriptionCreated: () => void;\n /**\n * This is a callback that provides a subscriber callback to listen for changes to state.\n * It allows UI Shell to listen for state changes.\n *\n * The props coming in this callback go directly to a React state; therefore, it shares the same signature and provides a previous state.\n */\n subscribeToPropChanges: MessageBus<\n SetStateAction<UiShellNavComponentProps>\n >[\"subscribe\"];\n /**\n * Element inside UI Shell's React root component renders into. If using a web component, this is going to exist inside it.\n */\n uiShellAppElement: ReactRootElements[\"appRootElement\"];\n /**\n * Typically, this is your `<head>` element. If using a web component, you need to create one yourself as Shadow DOM's don't have a `<head>`.\n */\n uiShellStylesElement: ReactRootElements[\"stylesRootElement\"];\n} & UiShellProviderProps &\n Pick<\n UiShellContentProps,\n | \"appElement\"\n | \"appElementScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"onError\"\n | \"optionalComponents\"\n >;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst UiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement,\n appElementScrollingMode,\n breakpointConfig,\n closeSideNavMenu,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n onSubscriptionCreated,\n optionalComponents,\n sideNavBackgroundColor,\n sideNavBackgroundContrastColor,\n subscribeToCloseRightSideMenu,\n subscribeToCloseSideNavMenu,\n subscribeToPropChanges,\n topNavBackgroundColor,\n uiShellAppElement,\n uiShellStylesElement,\n}: UiShellProps) => {\n const [componentProps, setComponentProps] = useState(defaultComponentProps);\n\n const activeBreakpoint = useUiShellBreakpoints(breakpointConfig);\n\n useEffect(() => {\n const unsubscribe = subscribeToPropChanges((componentProps) => {\n // If for some reason nothing is passed as `componentProps`, we fallback on `defaultComponentProps` as a safety mechanism to ensure nothing breaks.\n setComponentProps(componentProps || defaultComponentProps);\n });\n\n onSubscriptionCreated();\n\n return () => {\n unsubscribe();\n };\n }, [onSubscriptionCreated, subscribeToPropChanges]);\n\n return activeBreakpoint === \"none\" ? null : (\n <ErrorBoundary fallback={errorComponent} onError={onError}>\n <OdysseyProvider\n emotionRootElement={uiShellStylesElement}\n shadowRootElement={uiShellAppElement}\n >\n <ErrorBoundary fallback={errorComponent} onError={onError}>\n <CssBaseline />\n\n <UiShellProvider\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n closeSideNavMenu={closeSideNavMenu}\n sideNavBackgroundColor={sideNavBackgroundColor}\n sideNavBackgroundContrastColor={sideNavBackgroundContrastColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n topNavBackgroundColor={topNavBackgroundColor}\n >\n {activeBreakpoint === \"narrow\" && (\n <NarrowUiShellContent\n {...componentProps}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n hasSideNavProps={Boolean(componentProps.sideNavProps)}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n optionalComponents={optionalComponents}\n />\n )}\n\n {(activeBreakpoint === \"medium\" || activeBreakpoint === \"wide\") && (\n <WideUiShellContent\n {...{\n ...componentProps,\n ...{\n sideNavProps: {\n ...componentProps.sideNavProps,\n hasSessionStorageState: activeBreakpoint === \"wide\",\n isCollapsed:\n activeBreakpoint === \"medium\" ||\n componentProps.sideNavProps?.isCollapsed,\n isCollapsible:\n activeBreakpoint === \"medium\" ||\n componentProps.sideNavProps?.isCollapsible,\n // We have to use `as` because sideNavProps expects you to have `sideNavItems` defined even though it had to be passed in `...componentProps.sideNavProps`.\n } as typeof componentProps.sideNavProps,\n },\n }}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n hasSideNavProps={Boolean(componentProps.sideNavProps)}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n optionalComponents={optionalComponents}\n />\n )}\n </UiShellProvider>\n </ErrorBoundary>\n </OdysseyProvider>\n </ErrorBoundary>\n );\n};\n\nconst MemoizedUiShell = memo(UiShell);\nMemoizedUiShell.displayName = \"UiShell\";\n\nexport { MemoizedUiShell as UiShell };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,SAAS,EAAEC,QAAQ,QAA6B,OAAO;AACtE,SAASC,aAAa,QAAQ,sBAAsB;AAGpD,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAA8B,sBAAsB;AAK5E,SAEEC,qBAAqB,QAChB,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG7D,OAAO,MAAMC,qBAA+C,GAAG;EAC7DC,YAAY,EAAEC,SAAS;EACvBC,WAAW,EAAED;AACf,CAAU;AAEV,MAAME,cAAc,GAAGP,IAAA;EAAK;AAAU,CAAE,CAAC;AAkDzC,MAAMQ,OAAO,GAAGA,CAAC;EACfC,kBAAkB;EAClBC,yBAAyB;EACzBC,UAAU;EACVC,uBAAuB;EACvBC,gBAAgB;EAChBC,g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O,CAAC;AACrCmC,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAInC,OAAO","ignoreList":[]}
@@ -27,13 +27,18 @@ const UiShellProvider = ({
27
27
  children,
28
28
  closeSideNavMenu,
29
29
  sideNavBackgroundColor,
30
+ sideNavBackgroundContrastColor,
30
31
  subscribeToCloseRightSideMenu,
31
32
  subscribeToCloseSideNavMenu,
32
33
  topNavBackgroundColor
33
34
  }) => {
34
35
  const odysseyDesignTokens = useOdysseyDesignTokens();
35
36
  const defaultedSideNavBackgroundColor = sideNavBackgroundColor || odysseyDesignTokens.HueNeutralWhite;
36
- const sideNavContrastColors = defaultedSideNavBackgroundColor !== odysseyDesignTokens.HueNeutralWhite ? generateContrastColors(defaultedSideNavBackgroundColor, odysseyDesignTokens) : undefined;
37
+ const sideNavContrastColors = defaultedSideNavBackgroundColor !== odysseyDesignTokens.HueNeutralWhite ? generateContrastColors({
38
+ backgroundColor: sideNavBackgroundColor || defaultedSideNavBackgroundColor,
39
+ backgroundContrastColor: sideNavBackgroundContrastColor,
40
+ odysseyDesignTokens
41
+ }) : undefined;
37
42
  const isAppBackgroundHightContrast = appBackgroundContrastMode === "highContrast";
38
43
  const defaultTopAndAppBackgroundColor = isAppBackgroundHightContrast ? odysseyDesignTokens.HueNeutralWhite : odysseyDesignTokens.HueNeutral50;
39
44
  const topNavColor = topNavBackgroundColor || defaultTopAndAppBackgroundColor;
@@ -1 +1 @@
1
- {"version":3,"file":"UiShellProvider.js","names":["createContext","memo","useContext","useMemo","generateContrastColors","useOdysseyDesignTokens","createMessageBus","jsx","_jsx","defaultCloseSideNavMessageBus","defaultSubscribeToCloseRightSideMenu","UiShellContext","undefined","useUiShellContext","UiShellProvider","appBackgroundColor","appBackgroundContrastMode","children","closeSideNavMenu","sideNavBackgroundColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","topNavBackgroundColor","odysseyDesignTokens","defaultedSideNavBackgroundColor","HueNeutralWhite","sideNavContrastColors","isAppBackgroundHightContrast","defaultTopAndAppBackgroundColor","HueNeutral50","topNavColor","appContentBackgroundColor","memoizedContextValue","publish","subscribe","Provider","value","MemoizedUiShellProvider"],"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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,IAAI,EAEJC,UAAU,EACVC,OAAO,QACF,OAAO;AACd,SAEEC,sBAAsB,QACjB,4BAA4B;AACnC,SAASC,sBAAsB,QAAQ,kCAAkC;AACzE,SAASC,gBAAgB,QAAoB,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGrE,OAAO,MAAMC,6BAA6B,GAAGH,gBAAgB,CAAC,CAAC;AAC/D,OAAO,MAAMI,oCAAoC,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAmClE,MAAMC,cAAc,GAAGX,aAAa,CAA6BY,SAAS,CAAC;AAE3E,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACrC,OAAOX,UAAU,CAACS,cAAc,CAAC;AACnC,CAAC;AASD,MAAMG,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,GAAGlB,sBAAsB,CAAC,CAAC;EACpD,MAAMmB,+BAA+B,GACnCL,sBAAsB,IAAII,mBAAmB,CAACE,eAAe;EAE/D,MAAMC,qBAAqB,GACzBF,+BAA+B,KAAKD,mBAAmB,CAACE,eAAe,GACnErB,sBAAsB,CACpBoB,+BAA+B,EAC/BD,mBACF,CAAC,GACDX,SAAS;EAEf,MAAMe,4BAA4B,GAChCX,yBAAyB,KAAK,cAAc;EAE9C,MAAMY,+BAA+B,GAAGD,4BAA4B,GAChEJ,mBAAmB,CAACE,eAAe,GACnCF,mBAAmB,CAACM,YAAY;EAEpC,MAAMC,WAAW,GAAGR,qBAAqB,IAAIM,+BAA+B;EAE5E,MAAMG,yBAAyB,GAC7BhB,kBAAkB,IAAIa,+BAA+B;EAEvD,MAAMI,oBAAoB,GAAG7B,OAAO,CAClC,OAAO;IACLY,kBAAkB,EAAEgB,yBAAyB;IAC7Cb,gBAAgB,EACdA,gBAAgB,IAAIT,6BAA6B,CAACwB,OAAO;IAC3Dd,sBAAsB,EACpBA,sBAAsB,IAAII,mBAAmB,CAACE,eAAe;IAC/DC,qBAAqB;IACrBL,2BAA2B,EACzBA,2BAA2B,IAAIZ,6BAA6B,CAACyB,SAAS;IACxEd,6BAA6B,EAC3BA,6BAA6B,IAAIV,oCAAoC;IACvEY,qBAAqB,EAAEQ;EACzB,CAAC,CAAC,EACF,CACEC,yBAAyB,EACzBR,mBAAmB,CAACE,eAAe,EACnCP,gBAAgB,EAChBC,sBAAsB,EACtBO,qBAAqB,EACrBN,6BAA6B,EAC7BC,2BAA2B,EAC3BS,WAAW,CAEf,CAAC;EAED,OACEtB,IAAA,CAACG,cAAc,CAACwB,QAAQ;IAACC,KAAK,EAAEJ,oBAAqB;IAAAf,QAAA,EAClDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAED,MAAMoB,uBAAuB,GAAGpC,IAAI,CAACa,eAAe,CAAC;AAErD,SAASuB,uBAAuB,IAAIvB,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"UiShellProvider.js","names":["createContext","memo","useContext","useMemo","generateContrastColors","useOdysseyDesignTokens","createMessageBus","jsx","_jsx","defaultCloseSideNavMessageBus","defaultSubscribeToCloseRightSideMenu","UiShellContext","undefined","useUiShellContext","UiShellProvider","appBackgroundColor","appBackgroundContrastMode","children","closeSideNavMenu","sideNavBackgroundColor","sideNavBackgroundContrastColor","subscribeToCloseRightSideMenu","subscribeToCloseSideNavMenu","topNavBackgroundColor","odysseyDesignTokens","defaultedSideNavBackgroundColor","HueNeutralWhite","sideNavContrastColors","backgroundColor","backgroundContrastColor","isAppBackgroundHightContrast","defaultTopAndAppBackgroundColor","HueNeutral50","topNavColor","appContentBackgroundColor","memoizedContextValue","publish","subscribe","Provider","value","MemoizedUiShellProvider"],"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 * Custom background color for the app content area.\n */\n appBackgroundColor: string;\n /**\n * Custom background color for the side nav area.\n */\n sideNavBackgroundColor: string;\n /**\n * Custom color for fonts and other contrasted colors in the side nav area. Other contrast colors are derived from this one.\n *\n * If not passed, it gets computed from Odyssey.\n */\n sideNavBackgroundContrastColor?: string;\n sideNavContrastColors?: ContrastColors;\n /**\n * 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 sideNavBackgroundContrastColor,\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 backgroundColor:\n sideNavBackgroundColor || defaultedSideNavBackgroundColor,\n backgroundContrastColor: sideNavBackgroundContrastColor,\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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,IAAI,EAEJC,UAAU,EACVC,OAAO,QACF,OAAO;AACd,SAEEC,sBAAsB,QACjB,4BAA4B;AACnC,SAASC,sBAAsB,QAAQ,kCAAkC;AACzE,SAASC,gBAAgB,QAAoB,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGrE,OAAO,MAAMC,6BAA6B,GAAGH,gBAAgB,CAAC,CAAC;AAC/D,OAAO,MAAMI,oCAAoC,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAyClE,MAAMC,cAAc,GAAGX,aAAa,CAA6BY,SAAS,CAAC;AAE3E,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACrC,OAAOX,UAAU,CAACS,cAAc,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sBAAsB,EACtBQ,qBAAqB,EACrBN,6BAA6B,EAC7BC,2BAA2B,EAC3BW,WAAW,CAEf,CAAC;EAED,OACEzB,IAAA,CAACG,cAAc,CAAC2B,QAAQ;IAACC,KAAK,EAAEJ,oBAAqB;IAAAlB,QAAA,EAClDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAED,MAAMuB,uBAAuB,GAAGvC,IAAI,CAACa,eAAe,CAAC;AAErD,SAAS0B,uBAAuB,IAAI1B,eAAe","ignoreList":[]}
@@ -36,6 +36,7 @@ export const renderUiShell = ({
36
36
  onRender,
37
37
  parentElement,
38
38
  sideNavBackgroundColor,
39
+ sideNavBackgroundContrastColor,
39
40
  topNavBackgroundColor
40
41
  }) => {
41
42
  const appElement = providedAppElement || document.createElement("div");
@@ -87,6 +88,7 @@ export const renderUiShell = ({
87
88
  name: slotName
88
89
  })])),
89
90
  sideNavBackgroundColor: sideNavBackgroundColor,
91
+ sideNavBackgroundContrastColor: sideNavBackgroundContrastColor,
90
92
  subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu,
91
93
  subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu,
92
94
  subscribeToPropChanges: subscribeToPropChanges,
@@ -95,8 +97,8 @@ export const renderUiShell = ({
95
97
  uiShellStylesElement: reactRootElements.stylesRootElement
96
98
  })
97
99
  }),
98
- webComponentParentElement: parentElement,
99
- webComponentChildren
100
+ webComponentChildren,
101
+ webComponentParentElement: parentElement
100
102
  });
101
103
  const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(() => {
102
104
  unsubscribeFromUnifiedUiShellRendered();
@@ -1 +1 @@
1
- {"version":3,"file":"renderUiShell.js","names":["ErrorBoundary","bufferLatest","createMessageBus","UiShell","uiShellDataAttribute","renderReactInWebComponent","jsx","_jsx","optionalComponentSlotNames","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onRender","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","getReactComponent","reactRootElements","fallback","children","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","unsubscribeFromUnifiedUiShellRendered","setComponentProps","appendChild"],"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, PublishMessage } 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\nexport type SlottedElements = Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n>;\n\nexport type RenderedUiShell = {\n closeRightSideMenu: PublishMessage<void>;\n closeSideNavMenu: PublishMessage<void>;\n setComponentProps: ReturnType<\n typeof bufferLatest<SetStateAction<UiShellNavComponentProps>>\n >;\n slottedElements: SlottedElements;\n uiShellElement: ReturnType<typeof renderReactInWebComponent>;\n} & Partial<Pick<UiShellProps, \"appElement\">>;\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 onRender,\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 * Notify once when React has rendered UI Shell the first time.\n */\n onRender?: (renderedUiShell: RenderedUiShell) => 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 SlottedElements;\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 const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(\n () => {\n unsubscribeFromUnifiedUiShellRendered();\n\n onRender?.({\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n });\n },\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,gBAAgB,QAAwB,uBAAuB;AACxE,SAASC,OAAO,QAAsB,cAAc;AAEpD,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,SAASC,yBAAyB,QAAQ,+CAA+C;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,OAAO,MAAMC,0BAGZ,GAAG;EACFC,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AA0BD,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,kBAAkB;EAClBC,yBAAyB;EACzBC,UAAU,EAAEC,kBAAkB;EAC9BC,uBAAuB;EACvBC,gBAAgB;EAChBC,4BAA4B;EAC5BC,sBAAsB;EACtBC,OAAO,GAAGC,OAAO,CAACC,KAAK;EACvBC,QAAQ;EACRC,aAAa;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AC;EACJ,CACF,CAAC;EAED3B,aAAa,CAAC0C,WAAW,CAACpD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVuB,kBAAkB;IAClBE,gBAAgB;IAChB0B,iBAAiB,EAAE7B,iCAAiC;IACpDK,eAAe;IACfU;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"renderUiShell.js","names":["ErrorBoundary","bufferLatest","createMessageBus","UiShell","uiShellDataAttribute","renderReactInWebComponent","jsx","_jsx","optionalComponentSlotNames","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onRender","parentElement","sideNavBackgroundColor","sideNavBackgroundContrastColor","topNavBackgroundColor","document","createElement","setAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","getReactComponent","reactRootElements","fallback","children","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","unsubscribeFromUnifiedUiShellRendered","setComponentProps","appendChild"],"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, PublishMessage } 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\nexport type SlottedElements = Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n>;\n\nexport type RenderedUiShell = {\n closeRightSideMenu: PublishMessage<void>;\n closeSideNavMenu: PublishMessage<void>;\n setComponentProps: ReturnType<\n typeof bufferLatest<SetStateAction<UiShellNavComponentProps>>\n >;\n slottedElements: SlottedElements;\n uiShellElement: ReturnType<typeof renderReactInWebComponent>;\n} & Partial<Pick<UiShellProps, \"appElement\">>;\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 onRender,\n parentElement,\n sideNavBackgroundColor,\n sideNavBackgroundContrastColor,\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 * Notify once when React has rendered UI Shell the first time.\n */\n onRender?: (renderedUiShell: RenderedUiShell) => 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 | \"sideNavBackgroundContrastColor\"\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 SlottedElements;\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 sideNavBackgroundContrastColor={sideNavBackgroundContrastColor}\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 webComponentChildren,\n webComponentParentElement: parentElement,\n });\n\n const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(\n () => {\n unsubscribeFromUnifiedUiShellRendered();\n\n onRender?.({\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n });\n },\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,gBAAgB,QAAwB,uBAAuB;AACxE,SAASC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CAAE;QACFvB,sBAAsB,EAAEA,sBAAuB;QAC/CC,8BAA8B,EAAEA,8BAA+B;QAC/Da,6BAA6B,EAAEA,6BAA8B;QAC7DE,2BAA2B,EAAEA,2BAA4B;QACzDP,sBAAsB,EAAEA,sBAAuB;QAC/CP,qBAAqB,EAAEA,qBAAsB;QAC7CiC,iBAAiB,EAAEN,iBAAiB,CAACO,cAAe;QACpDC,oBAAoB,EAAER,iBAAiB,CAACS;MAAkB,CAC3D;IAAC,CACW,CAChB;IACDb,oBAAoB;IACpBc,yBAAyB,EAAExC;EAC7B,CAAC,CAAC;EAEF,MAAMyC,qCAAqC,GAAG7B,6BAA6B,CACzE,MAAM;IACJ6B,qCAAqC,CAAC,CAAC;IAEvC1C,QAAQ,GAAG;MACTT,UAAU;MACVwB,kBAAkB;MAClBE,gBAAgB;MAChB0B,iBAAiB,EAAE7B,iCAAiC;MACpDK,eAAe;MACfU;IACF,CAAC,CAAC;EACJ,CACF,CAAC;EAED5B,aAAa,CAAC2C,WAAW,CAACrD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVwB,kBAAkB;IAClBE,gBAAgB;IAChB0B,iBAAiB,EAAE7B,iCAAiC;IACpDK,eAAe;IACfU;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { useEffect, useState, useRef, useCallback } from "react";
14
+ import { getLogicalBoundaries } from "../getLogicalBoundaries.js";
15
+ const defaultEdgeState = {
16
+ isAtContainerInlineStart: null,
17
+ isAtContainerInlineEnd: null,
18
+ isAtContainerBlockStart: null,
19
+ isAtContainerBlockEnd: null
20
+ };
21
+ export function useElementAtContainerEdge({
22
+ containerElement,
23
+ element,
24
+ monitoringElement
25
+ }) {
26
+ const [edgeState, setEdgeState] = useState(defaultEdgeState);
27
+ const requestedAnimationFrameIdRef = useRef(0);
28
+ const resolvedMonitoringElement = monitoringElement ?? element?.parentElement;
29
+ const updateEdgeState = useCallback(() => {
30
+ cancelAnimationFrame(requestedAnimationFrameIdRef.current);
31
+ requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {
32
+ if (element) {
33
+ const elementBoundaries = getLogicalBoundaries(element);
34
+ const containerBoundaries = getLogicalBoundaries(containerElement ?? document.body);
35
+ setEdgeState({
36
+ isAtContainerInlineStart: elementBoundaries.left === containerBoundaries.left,
37
+ isAtContainerInlineEnd: elementBoundaries.right === containerBoundaries.right,
38
+ isAtContainerBlockStart: elementBoundaries.top === containerBoundaries.top,
39
+ isAtContainerBlockEnd: elementBoundaries.bottom === containerBoundaries.bottom
40
+ });
41
+ } else {
42
+ setEdgeState(defaultEdgeState);
43
+ }
44
+ });
45
+ }, [containerElement, element]);
46
+ useEffect(() => {
47
+ const mutationObserver = new MutationObserver(() => {
48
+ updateEdgeState();
49
+ });
50
+ if (resolvedMonitoringElement) {
51
+ mutationObserver.observe(resolvedMonitoringElement, {
52
+ attributes: true,
53
+ attributeFilter: ["style"],
54
+ childList: true,
55
+ subtree: true
56
+ });
57
+ }
58
+ window.addEventListener("resize", updateEdgeState);
59
+ updateEdgeState();
60
+ return () => {
61
+ cancelAnimationFrame(requestedAnimationFrameIdRef.current);
62
+ mutationObserver.disconnect();
63
+ window.removeEventListener("resize", updateEdgeState);
64
+ };
65
+ }, [resolvedMonitoringElement, updateEdgeState]);
66
+ return edgeState;
67
+ }
68
+ //# sourceMappingURL=useElementAtContainerEdge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementAtContainerEdge.js","names":["useEffect","useState","useRef","useCallback","getLogicalBoundaries","defaultEdgeState","isAtContainerInlineStart","isAtContainerInlineEnd","isAtContainerBlockStart","isAtContainerBlockEnd","useElementAtContainerEdge","containerElement","element","monitoringElement","edgeState","setEdgeState","requestedAnimationFrameIdRef","resolvedMonitoringElement","parentElement","updateEdgeState","cancelAnimationFrame","current","requestAnimationFrame","elementBoundaries","containerBoundaries","document","body","left","right","top","bottom","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","window","addEventListener","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useElementAtContainerEdge.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 { useEffect, useState, useRef, useCallback } from \"react\";\nimport { getLogicalBoundaries } from \"../getLogicalBoundaries.js\";\n\nconst defaultEdgeState = {\n isAtContainerInlineStart: null,\n isAtContainerInlineEnd: null,\n isAtContainerBlockStart: null,\n isAtContainerBlockEnd: null,\n};\n\ntype EdgeState =\n | {\n isAtContainerInlineStart: null;\n isAtContainerInlineEnd: null;\n isAtContainerBlockStart: null;\n isAtContainerBlockEnd: null;\n }\n | {\n isAtContainerInlineStart: boolean;\n isAtContainerInlineEnd: boolean;\n isAtContainerBlockStart: boolean;\n isAtContainerBlockEnd: boolean;\n };\n\n/**\n * Determines if an element is at the edge of its container.\n *\n * If `element` is `null`, all returned edge state values will be `null`.\n */\nexport function useElementAtContainerEdge({\n containerElement,\n element,\n monitoringElement,\n}: {\n /**\n * The container element against which the edges are checked. If not provided, it defaults to the document body.\n */\n containerElement?: HTMLElement | null;\n /**\n * The element whose edges you want to track.\n */\n element?: HTMLElement | null;\n /**\n * The element whose mutations you want to track. If not provided, it defaults to the parent element of the `element`.\n */\n monitoringElement?: HTMLElement | null;\n}) {\n const [edgeState, setEdgeState] = useState<EdgeState>(defaultEdgeState);\n\n const requestedAnimationFrameIdRef = useRef(0);\n\n const resolvedMonitoringElement = monitoringElement ?? element?.parentElement;\n\n // will check the position of the element and update state accordingly\n const updateEdgeState = useCallback(() => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n\n requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {\n if (element) {\n const elementBoundaries = getLogicalBoundaries(element);\n const containerBoundaries = getLogicalBoundaries(\n containerElement ?? document.body,\n );\n\n setEdgeState({\n isAtContainerInlineStart:\n elementBoundaries.left === containerBoundaries.left,\n isAtContainerInlineEnd:\n elementBoundaries.right === containerBoundaries.right,\n isAtContainerBlockStart:\n elementBoundaries.top === containerBoundaries.top,\n isAtContainerBlockEnd:\n elementBoundaries.bottom === containerBoundaries.bottom,\n });\n } else {\n setEdgeState(defaultEdgeState);\n }\n });\n }, [containerElement, element]);\n\n useEffect(() => {\n // Listen for mutations that might affect position\n const mutationObserver = new MutationObserver(() => {\n updateEdgeState();\n });\n\n if (resolvedMonitoringElement) {\n mutationObserver.observe(resolvedMonitoringElement, {\n attributes: true,\n attributeFilter: [\"style\"],\n childList: true,\n subtree: true,\n });\n }\n\n // Listen for window resize, which can affect position\n window.addEventListener(\"resize\", updateEdgeState);\n\n // Initial check\n updateEdgeState();\n\n // cleanup function to remove listeners and observer\n return () => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n mutationObserver.disconnect();\n window.removeEventListener(\"resize\", updateEdgeState);\n };\n }, [resolvedMonitoringElement, updateEdgeState]);\n\n return edgeState;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAE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,CAAC;EACJ,CAAC,EAAE,CAACM,gBAAgB,EAAEC,OAAO,CAAC,CAAC;EAE/BZ,SAAS,CAAC,MAAM;IAEd,MAAM+B,gBAAgB,GAAG,IAAIC,gBAAgB,CAAC,MAAM;MAClDb,eAAe,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,IAAIF,yBAAyB,EAAE;MAC7Bc,gBAAgB,CAACE,OAAO,CAAChB,yBAAyB,EAAE;QAClDiB,UAAU,EAAE,IAAI;QAChBC,eAAe,EAAE,CAAC,OAAO,CAAC;QAC1BC,SAAS,EAAE,IAAI;QACfC,OAAO,EAAE;MACX,CAAC,CAAC;IACJ;IAGAC,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAEpB,eAAe,CAAC;IAGlDA,eAAe,CAAC,CAAC;IAGjB,OAAO,MAAM;MACXC,oBAAoB,CAACJ,4BAA4B,CAACK,OAAO,CAAC;MAC1DU,gBAAgB,CAACS,UAAU,CAAC,CAAC;MAC7BF,MAAM,CAACG,mBAAmB,CAAC,QAAQ,EAAEtB,eAAe,CAAC;IACvD,CAAC;EACH,CAAC,EAAE,CAACF,yBAAyB,EAAEE,eAAe,CAAC,CAAC;EAEhD,OAAOL,SAAS;AAClB","ignoreList":[]}
@@ -28,7 +28,7 @@ export const getNestedScrollContainers = containerElement => Array.from(containe
28
28
  containerElement,
29
29
  element
30
30
  })).filter(scrollHeightElement => getIsYAxisScrollContainer(scrollHeightElement));
31
- export const fakeDefaultContainerElement = document.createElement("div");
31
+ export const fakeDefaultContainerElement = typeof window === "undefined" ? null : document.createElement("div");
32
32
  export const useScrollState = containerElement => {
33
33
  const [isScrolled, setIsScrolled] = useState(false);
34
34
  const requestedAnimationFrameIdRef = useRef(0);
@@ -51,7 +51,9 @@ export const useScrollState = containerElement => {
51
51
  }, [updateScrollState]);
52
52
  const updateScrollableElements = useCallback(() => {
53
53
  const computedContainerElement = containerElement || fakeDefaultContainerElement;
54
- scrollableElementsRef.current = getNestedScrollContainers(computedContainerElement).concat(computedContainerElement);
54
+ if (computedContainerElement) {
55
+ scrollableElementsRef.current = getNestedScrollContainers(computedContainerElement).concat(computedContainerElement);
56
+ }
55
57
  }, [containerElement]);
56
58
  const updateScrollListeners = useCallback(() => {
57
59
  removeScrollEventListeners();
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollState.js","names":["useCallback","useEffect","useRef","useState","getIsScrollHeightElement","containerElement","element","containerElementHeight","getBoundingClientRect","height","elementHeight","getIsYAxisScrollContainer","overflowY","window","getComputedStyle","getIsYAxisScrolling","scrollHeight","clientHeight","getNestedScrollContainers","Array","from","querySelectorAll","filter","scrollHeightElement","fakeDefaultContainerElement","document","createElement","useScrollState","isScrolled","setIsScrolled","requestedAnimationFrameIdRef","scrollableElementsRef","updateScrollState","cancelAnimationFrame","current","requestAnimationFrame","reduce","scrollableElement","scrollTop","addScrollEventListeners","forEach","addEventListener","removeScrollEventListeners","removeEventListener","updateScrollableElements","computedContainerElement","concat","updateScrollListeners","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","disconnect","isContentScrolled"],"sources":["../../../src/ui-shell/useScrollState.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 { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const getIsScrollHeightElement = ({\n containerElement,\n element,\n}: {\n containerElement: HTMLElement;\n element: HTMLElement;\n}) => {\n const containerElementHeight =\n containerElement.getBoundingClientRect().height;\n const elementHeight = element.getBoundingClientRect().height;\n\n return elementHeight - containerElementHeight >= 0;\n};\n\nexport const getIsYAxisScrollContainer = (element: HTMLElement) => {\n const overflowY = window.getComputedStyle(element).overflowY;\n\n return overflowY === \"auto\" || overflowY === \"scroll\";\n};\n\nexport const getIsYAxisScrolling = (element: HTMLElement) =>\n element.scrollHeight > element.clientHeight\n ? getIsYAxisScrollContainer(element)\n : false;\n\nexport const getNestedScrollContainers = (containerElement: HTMLElement) =>\n Array.from(containerElement.querySelectorAll<HTMLElement>(\"*\"))\n .filter((element) =>\n getIsScrollHeightElement({\n containerElement,\n element,\n }),\n )\n .filter((scrollHeightElement) =>\n getIsYAxisScrollContainer(scrollHeightElement),\n );\n\nexport const fakeDefaultContainerElement = document.createElement(\"div\");\n\nexport const useScrollState = <\n ContainerElement extends HTMLElement = HTMLDivElement,\n>(\n /**\n * The element containing a scroll area.\n */\n containerElement: ContainerElement | null,\n) => {\n const [isScrolled, setIsScrolled] = useState(false);\n\n const requestedAnimationFrameIdRef = useRef(0);\n const scrollableElementsRef = useRef<HTMLElement[]>([]);\n\n const updateScrollState = useCallback(() => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n\n requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {\n setIsScrolled(\n scrollableElementsRef.current.reduce(\n (isScrolled, scrollableElement) =>\n isScrolled || scrollableElement.scrollTop > 0,\n false,\n ),\n );\n });\n }, []);\n\n const addScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.addEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const removeScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.removeEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const updateScrollableElements = useCallback(() => {\n const computedContainerElement =\n containerElement || fakeDefaultContainerElement;\n\n scrollableElementsRef.current = getNestedScrollContainers(\n computedContainerElement,\n ).concat(computedContainerElement);\n }, [containerElement]);\n\n const updateScrollListeners = useCallback(() => {\n removeScrollEventListeners();\n updateScrollableElements();\n addScrollEventListeners();\n updateScrollState();\n }, [\n addScrollEventListeners,\n removeScrollEventListeners,\n updateScrollableElements,\n updateScrollState,\n ]);\n\n useEffect(() => {\n const mutationObserver = new MutationObserver(() => {\n updateScrollListeners();\n });\n\n if (containerElement) {\n mutationObserver.observe(containerElement, {\n attributes: true,\n attributeFilter: [\"style\"],\n childList: true,\n subtree: true,\n });\n }\n\n updateScrollListeners();\n\n return () => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n removeScrollEventListeners();\n mutationObserver.disconnect();\n };\n }, [containerElement, removeScrollEventListeners, updateScrollListeners]);\n\n return {\n isContentScrolled: isScrolled,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEhE,OAAO,MAAMC,wBAAwB,GAAGA,CAAC;EACvCC,gBAAgB;EAChBC;AAIF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAC1BF,gBAAgB,CAACG,qBAAqB,CAAC,CAAC,CAACC,MAAM;EACjD,MAAMC,aAAa,GAAGJ,OAAO,CAACE,qBAAqB,CAAC,CAAC,CAACC,MAAM;EAE5D,OAAOC,aAAa,GAAGH,sBAAsB,IAAI,CAAC;AACpD,CAAC;AAED,OAAO,MAAMI,yBAAyB,GAAIL,OAAoB,IAAK;EACjE,MAAMM,SAAS,GAAGC,MAAM,CAACC,gBAAgB,CAACR,OAAO,CAAC,CAACM,SAAS;EAE5D,OAAOA,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,QAAQ;AACvD,CAAC;AAED,OAAO,MAAMG,mBAAmB,GAAIT,OAAoB,IACtDA,OAAO,CAACU,YAAY,GAAGV,OAAO,CAACW,YAAY,GACvCN,yBAAyB,CAACL,OAAO,CAAC,GAClC,KAAK;AAEX,OAAO,MAAMY,yBAAyB,GAAIb,gBAA6B,IACrEc,K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C,0BAA0B,EAAEK,qBAAqB,CAAC,CAAC;EAEzE,OAAO;IACLS,iBAAiB,EAAE5B;EACrB,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useScrollState.js","names":["useCallback","useEffect","useRef","useState","getIsScrollHeightElement","containerElement","element","containerElementHeight","getBoundingClientRect","height","elementHeight","getIsYAxisScrollContainer","overflowY","window","getComputedStyle","getIsYAxisScrolling","scrollHeight","clientHeight","getNestedScrollContainers","Array","from","querySelectorAll","filter","scrollHeightElement","fakeDefaultContainerElement","document","createElement","useScrollState","isScrolled","setIsScrolled","requestedAnimationFrameIdRef","scrollableElementsRef","updateScrollState","cancelAnimationFrame","current","requestAnimationFrame","reduce","scrollableElement","scrollTop","addScrollEventListeners","forEach","addEventListener","removeScrollEventListeners","removeEventListener","updateScrollableElements","computedContainerElement","concat","updateScrollListeners","mutationObserver","MutationObserver","observe","attributes","attributeFilter","childList","subtree","disconnect","isContentScrolled"],"sources":["../../../src/ui-shell/useScrollState.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 { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const getIsScrollHeightElement = ({\n containerElement,\n element,\n}: {\n containerElement: HTMLElement;\n element: HTMLElement;\n}) => {\n const containerElementHeight =\n containerElement.getBoundingClientRect().height;\n const elementHeight = element.getBoundingClientRect().height;\n\n return elementHeight - containerElementHeight >= 0;\n};\n\nexport const getIsYAxisScrollContainer = (element: HTMLElement) => {\n const overflowY = window.getComputedStyle(element).overflowY;\n\n return overflowY === \"auto\" || overflowY === \"scroll\";\n};\n\nexport const getIsYAxisScrolling = (element: HTMLElement) =>\n element.scrollHeight > element.clientHeight\n ? getIsYAxisScrollContainer(element)\n : false;\n\nexport const getNestedScrollContainers = (containerElement: HTMLElement) =>\n Array.from(containerElement.querySelectorAll<HTMLElement>(\"*\"))\n .filter((element) =>\n getIsScrollHeightElement({\n containerElement,\n element,\n }),\n )\n .filter((scrollHeightElement) =>\n getIsYAxisScrollContainer(scrollHeightElement),\n );\n\nexport const fakeDefaultContainerElement =\n typeof window === \"undefined\" ? null : document.createElement(\"div\");\n\nexport const useScrollState = <\n ContainerElement extends HTMLElement = HTMLDivElement,\n>(\n /**\n * The element containing a scroll area.\n */\n containerElement: ContainerElement | null,\n) => {\n const [isScrolled, setIsScrolled] = useState(false);\n\n const requestedAnimationFrameIdRef = useRef(0);\n const scrollableElementsRef = useRef<HTMLElement[]>([]);\n\n const updateScrollState = useCallback(() => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n\n requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {\n setIsScrolled(\n scrollableElementsRef.current.reduce(\n (isScrolled, scrollableElement) =>\n isScrolled || scrollableElement.scrollTop > 0,\n false,\n ),\n );\n });\n }, []);\n\n const addScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.addEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const removeScrollEventListeners = useCallback(() => {\n scrollableElementsRef.current.forEach((scrollableElement) => {\n scrollableElement.removeEventListener(\"scroll\", updateScrollState);\n });\n }, [updateScrollState]);\n\n const updateScrollableElements = useCallback(() => {\n const computedContainerElement =\n containerElement || fakeDefaultContainerElement;\n\n if (computedContainerElement) {\n scrollableElementsRef.current = getNestedScrollContainers(\n computedContainerElement,\n ).concat(computedContainerElement);\n }\n }, [containerElement]);\n\n const updateScrollListeners = useCallback(() => {\n removeScrollEventListeners();\n updateScrollableElements();\n addScrollEventListeners();\n updateScrollState();\n }, [\n addScrollEventListeners,\n removeScrollEventListeners,\n updateScrollableElements,\n updateScrollState,\n ]);\n\n useEffect(() => {\n const mutationObserver = new MutationObserver(() => {\n updateScrollListeners();\n });\n\n if (containerElement) {\n mutationObserver.observe(containerElement, {\n attributes: true,\n attributeFilter: [\"style\"],\n childList: true,\n subtree: true,\n });\n }\n\n updateScrollListeners();\n\n return () => {\n cancelAnimationFrame(requestedAnimationFrameIdRef.current);\n removeScrollEventListeners();\n mutationObserver.disconnect();\n };\n }, [containerElement, removeScrollEventListeners, updateScrollListeners]);\n\n return {\n isContentScrolled: isScrolled,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEhE,OAAO,MAAMC,wBAAwB,GAAGA,CAAC;EACvCC,gBAAgB;EAChBC;AAIF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAC1BF,gBAAgB,CAACG,qBAAqB,CAAC,CAAC,CAACC,MAAM;EACjD,MAAMC,aAAa,GAAGJ,OAAO,CAACE,qBAAqB,CAAC,CAAC,CAACC,MAAM;EAE5D,OAAOC,aAAa,GAAGH,sBAAsB,IAAI,CAAC;AACpD,CAAC;AAED,OAAO,MAAMI,yBAAyB,GAAIL,OAAoB,IAAK;EACjE,MAAMM,SAAS,GAAGC,MAAM,CAACC,gBAAgB,CAACR,OAAO,CAAC,CAACM,SAAS;EAE5D,OAAOA,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,QAAQ;AACvD,CAAC;AAED,OAAO,MAAMG,mBAAmB,GAAIT,OAAoB,IACtDA,OAAO,CAACU,YAAY,GAAGV,OAAO,CAACW,YAAY,GACvCN,yBAAyB,CAACL,OAAO,CAAC,GAClC,KAAK;AAEX,OAAO,MAAMY,yBAAyB,GAAIb,gBAA6B,IACrEc,KAAK,CAACC,IAAI,CAACf,gBAAgB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AC/B,CAAC;EACH,CAAC,EAAE,CAAClD,gBAAgB,EAAEqC,0BAA0B,EAAEK,qBAAqB,CAAC,CAAC;EAEzE,OAAO;IACLS,iBAAiB,EAAE5B;EACrB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -47,9 +47,9 @@ export const useAutocomplete = ({
47
47
  return value === undefined ? defaultValue : undefined;
48
48
  }, [defaultValue, hasMultipleChoices, value]);
49
49
  const valueProps = useInputValues({
50
+ controlState: controlledStateRef.current,
50
51
  defaultValue: defaultValueProp,
51
- value: value,
52
- controlState: controlledStateRef.current
52
+ value
53
53
  });
54
54
  const inputValueProp = useMemo(() => {
55
55
  if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {