@okta/odyssey-react-mui 1.35.2 → 1.36.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 (115) hide show
  1. package/dist/cjs/DatePickers/useOdysseyDateFields.cjs +2 -2
  2. package/dist/cjs/DatePickers/useOdysseyDateFields.cjs.map +1 -1
  3. package/dist/cjs/Field.cjs +1 -1
  4. package/dist/cjs/Field.cjs.map +1 -1
  5. package/dist/cjs/Pagination/Pagination.cjs +0 -6
  6. package/dist/cjs/Pagination/Pagination.cjs.map +1 -1
  7. package/dist/cjs/StringWithValue.cjs.map +1 -0
  8. package/dist/cjs/inputUtils.cjs +1 -1
  9. package/dist/cjs/inputUtils.cjs.map +1 -1
  10. package/dist/cjs/labs/DataFilters.cjs +4 -4
  11. package/dist/cjs/labs/DataFilters.cjs.map +1 -1
  12. package/dist/cjs/labs/DataView/DataCard.cjs +18 -18
  13. package/dist/cjs/labs/DataView/DataCard.cjs.map +1 -1
  14. package/dist/cjs/labs/DataView/DataView.cjs +10 -10
  15. package/dist/cjs/labs/DataView/DataView.cjs.map +1 -1
  16. package/dist/cjs/labs/DataView/useFilterConversion.cjs +1 -1
  17. package/dist/cjs/labs/DataView/useFilterConversion.cjs.map +1 -1
  18. package/dist/cjs/theme/useMediaQuery.cjs +1 -1
  19. package/dist/cjs/theme/useMediaQuery.cjs.map +1 -1
  20. package/dist/cjs/ui-shell/SideNav/SideNav.cjs +108 -60
  21. package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
  22. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs +84 -112
  23. package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs.map +1 -1
  24. package/dist/cjs/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.cjs +26 -0
  25. package/dist/cjs/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.cjs.map +1 -0
  26. package/dist/cjs/ui-shell/WideUiShellContent.cjs +2 -1
  27. package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
  28. package/dist/cjs/ui-shell/index.cjs +8 -1
  29. package/dist/cjs/ui-shell/index.cjs.map +1 -1
  30. package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs +1 -1
  31. package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs.map +1 -1
  32. package/dist/cjs/ui-shell/useScrollState.cjs +71 -21
  33. package/dist/cjs/ui-shell/useScrollState.cjs.map +1 -1
  34. package/dist/cjs/useMountLifecycleEffect.cjs +36 -0
  35. package/dist/cjs/useMountLifecycleEffect.cjs.map +1 -0
  36. package/dist/cjs/useSessionStorageState.cjs +64 -0
  37. package/dist/cjs/useSessionStorageState.cjs.map +1 -0
  38. package/dist/cjs/web-component/createReactRootElements.cjs +5 -3
  39. package/dist/cjs/web-component/createReactRootElements.cjs.map +1 -1
  40. package/dist/esm/DatePickers/useOdysseyDateFields.js +2 -2
  41. package/dist/esm/DatePickers/useOdysseyDateFields.js.map +1 -1
  42. package/dist/esm/Field.js +1 -1
  43. package/dist/esm/Field.js.map +1 -1
  44. package/dist/esm/Pagination/Pagination.js +0 -6
  45. package/dist/esm/Pagination/Pagination.js.map +1 -1
  46. package/dist/esm/StringWithValue.js.map +1 -0
  47. package/dist/esm/inputUtils.js +1 -1
  48. package/dist/esm/inputUtils.js.map +1 -1
  49. package/dist/esm/labs/DataFilters.js +4 -4
  50. package/dist/esm/labs/DataFilters.js.map +1 -1
  51. package/dist/esm/labs/DataView/DataCard.js +18 -18
  52. package/dist/esm/labs/DataView/DataCard.js.map +1 -1
  53. package/dist/esm/labs/DataView/DataView.js +10 -10
  54. package/dist/esm/labs/DataView/DataView.js.map +1 -1
  55. package/dist/esm/labs/DataView/useFilterConversion.js +1 -1
  56. package/dist/esm/labs/DataView/useFilterConversion.js.map +1 -1
  57. package/dist/esm/theme/useMediaQuery.js +1 -1
  58. package/dist/esm/theme/useMediaQuery.js.map +1 -1
  59. package/dist/esm/ui-shell/SideNav/SideNav.js +109 -61
  60. package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
  61. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js +85 -113
  62. package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js.map +1 -1
  63. package/dist/esm/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.js +19 -0
  64. package/dist/esm/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.js.map +1 -0
  65. package/dist/esm/ui-shell/WideUiShellContent.js +2 -1
  66. package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
  67. package/dist/esm/ui-shell/index.js +1 -1
  68. package/dist/esm/ui-shell/index.js.map +1 -1
  69. package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js +1 -1
  70. package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js.map +1 -1
  71. package/dist/esm/ui-shell/useScrollState.js +67 -21
  72. package/dist/esm/ui-shell/useScrollState.js.map +1 -1
  73. package/dist/esm/useMountLifecycleEffect.js +29 -0
  74. package/dist/esm/useMountLifecycleEffect.js.map +1 -0
  75. package/dist/esm/useSessionStorageState.js +56 -0
  76. package/dist/esm/useSessionStorageState.js.map +1 -0
  77. package/dist/esm/web-component/createReactRootElements.js +4 -2
  78. package/dist/esm/web-component/createReactRootElements.js.map +1 -1
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.mjs +1 -1
  81. package/dist/index.scss +1 -1
  82. package/dist/tsconfig.production.tsbuildinfo +1 -1
  83. package/dist/tsconfig.tsbuildinfo +1 -1
  84. package/dist/types/DatePickers/useOdysseyDateFields.d.ts.map +1 -1
  85. package/dist/types/Pagination/Pagination.d.ts.map +1 -1
  86. package/dist/types/StringWithValue.d.ts.map +1 -0
  87. package/dist/types/labs/DataView/DataCard.d.ts.map +1 -1
  88. package/dist/types/labs/DataView/DataView.d.ts.map +1 -1
  89. package/dist/types/theme/useMediaQuery.d.ts +1 -1
  90. package/dist/types/theme/useMediaQuery.d.ts.map +1 -1
  91. package/dist/types/ui-shell/SideNav/SideNav.d.ts +2 -0
  92. package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
  93. package/dist/types/ui-shell/SideNav/SideNavToggleButton.d.ts +15 -8
  94. package/dist/types/ui-shell/SideNav/SideNavToggleButton.d.ts.map +1 -1
  95. package/dist/types/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.d.ts +17 -0
  96. package/dist/types/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.d.ts.map +1 -0
  97. package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
  98. package/dist/types/ui-shell/index.d.ts +1 -1
  99. package/dist/types/ui-shell/index.d.ts.map +1 -1
  100. package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts.map +1 -1
  101. package/dist/types/ui-shell/useScrollState.d.ts +9 -1
  102. package/dist/types/ui-shell/useScrollState.d.ts.map +1 -1
  103. package/dist/types/useMountLifecycleEffect.d.ts +16 -0
  104. package/dist/types/useMountLifecycleEffect.d.ts.map +1 -0
  105. package/dist/types/useSessionStorageState.d.ts +20 -0
  106. package/dist/types/useSessionStorageState.d.ts.map +1 -0
  107. package/dist/types/web-component/createReactRootElements.d.ts +2 -0
  108. package/dist/types/web-component/createReactRootElements.d.ts.map +1 -1
  109. package/package.json +14 -11
  110. package/dist/cjs/theme/StringWithValue.cjs.map +0 -1
  111. package/dist/esm/theme/StringWithValue.js.map +0 -1
  112. package/dist/types/theme/StringWithValue.d.ts.map +0 -1
  113. /package/dist/cjs/{theme/StringWithValue.cjs → StringWithValue.cjs} +0 -0
  114. /package/dist/esm/{theme/StringWithValue.js → StringWithValue.js} +0 -0
  115. /package/dist/types/{theme/StringWithValue.d.ts → StringWithValue.d.ts} +0 -0
@@ -0,0 +1,19 @@
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 { useSessionStorageState } from "../../useSessionStorageState.js";
14
+ export const sessionStorageKey = "__uiShell-sideNav-isCollapsed";
15
+ export const useIsSideNavCollapsedSessionStorage = isSideNavInitiallyCollapsed => useSessionStorageState({
16
+ initialState: isSideNavInitiallyCollapsed,
17
+ key: sessionStorageKey
18
+ });
19
+ //# sourceMappingURL=useIsSideNavCollapsedSessionStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsSideNavCollapsedSessionStorage.js","names":["useSessionStorageState","sessionStorageKey","useIsSideNavCollapsedSessionStorage","isSideNavInitiallyCollapsed","initialState","key"],"sources":["../../../../src/ui-shell/SideNav/useIsSideNavCollapsedSessionStorage.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 { useSessionStorageState } from \"../../useSessionStorageState.js\";\n\nexport const sessionStorageKey = \"__uiShell-sideNav-isCollapsed\";\n\nexport const useIsSideNavCollapsedSessionStorage = (\n isSideNavInitiallyCollapsed: boolean,\n) =>\n useSessionStorageState({\n initialState: isSideNavInitiallyCollapsed,\n key: sessionStorageKey,\n });\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,iCAAiC;AAExE,OAAO,MAAMC,iBAAiB,GAAG,+BAA+B;AAEhE,OAAO,MAAMC,mCAAmC,GAC9CC,2BAAoC,IAEpCH,sBAAsB,CAAC;EACrBI,YAAY,EAAED,2BAA2B;EACzCE,GAAG,EAAEJ;AACP,CAAC,CAAC","ignoreList":[]}
@@ -23,6 +23,7 @@ import { useMatchAppElementToUiShellAppArea } from "./useMatchAppElementToUiShel
23
23
  import { useUiShellContext } from "./UiShellProvider.js";
24
24
  import { emptySideNavItems } from "./uiShellSharedConstants.js";
25
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ const appSwitcherDefaultAppIcons = [];
26
27
  const StyledAppContainer = styled("div", {
27
28
  shouldForwardProp: prop => prop !== "appBackgroundColor" && prop !== "odysseyDesignTokens"
28
29
  })(({
@@ -101,8 +102,8 @@ const WideUiShellContent = ({
101
102
  fallback: null,
102
103
  onError: onError,
103
104
  children: _jsx(AppSwitcher, {
105
+ appIcons: appSwitcherDefaultAppIcons,
104
106
  isLoading: true,
105
- appIcons: [],
106
107
  selectedAppName: ""
107
108
  })
108
109
  }), appSwitcherProps && _jsx(ErrorBoundary, {
@@ -1 +1 @@
1
- {"version":3,"file":"WideUiShellContent.js","names":["styled","memo","useRef","ErrorBoundary","AppSwitcher","InnerAppContainer","useOdysseyDesignTokens","SideNav","TopNav","useScrollState","useMatchAppElementToUiShellAppArea","useUiShellContext","emptySideNavItems","jsx","_jsx","jsxs","_jsxs","StyledAppContainer","shouldForwardProp","prop","appBackgroundColor","backgroundColor","gridArea","pointerEvents","position","StyledAppSwitcherContainer","StyledBannersContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","WideUiShellContent","appElement","appElementScrollingMode","appSwitcherProps","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","optionalComponents","sideNavProps","topNavProps","uiShellContext","isContentScrolled","sideNavContainerRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","paddingMode","uiShellResizableRefs","ref","children","banners","includes","fallback","isLoading","appIcons","selectedAppName","undefined","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","tabIndex","MemoizedWideUiShellContent","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport { InnerAppContainer } from \"./InnerAppContainer.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { SideNav } from \"./SideNav/index.js\";\nimport { TopNav } from \"./TopNav/index.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { useMatchAppElementToUiShellAppArea } from \"./useMatchAppElementToUiShellAppArea.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\nimport { emptySideNavItems } from \"./uiShellSharedConstants.js\";\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"appBackgroundColor\" && prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n backgroundColor: appBackgroundColor,\n gridArea: \"app-content\",\n pointerEvents: \"none\",\n position: \"relative\",\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")({\n gridArea: \"app-switcher\",\n});\n\nconst StyledBannersContainer = styled(\"div\")({\n gridArea: \"banners\",\n});\n\nconst StyledSideNavContainer = styled(\"div\")({\n gridArea: \"side-nav\",\n});\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners banners\"\n \"app-switcher side-nav top-nav\"\n \"app-switcher side-nav app-content\"\n `,\n gridTemplateColumns: \"auto auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")({\n gridArea: \"top-nav\",\n});\n\nexport type WideUiShellContentProps = UiShellNavComponentProps &\n UiShellContentProps;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst WideUiShellContent = ({\n appElement,\n appElementScrollingMode,\n appSwitcherProps,\n hasStandardAppContentPadding = true,\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n sideNavProps,\n topNavProps,\n}: WideUiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const uiShellContext = useUiShellContext();\n\n const { isContentScrolled } = useScrollState(appElement);\n\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellAppAreaRef = useRef<HTMLDivElement>(null);\n\n const { parentContainerRef } = useMatchAppElementToUiShellAppArea({\n appElement,\n appElementScrollingMode,\n paddingMode: hasStandardAppContentPadding ? \"comfortable\" : \"none\",\n uiShellAppAreaRef,\n uiShellResizableRefs: [\n sideNavContainerRef,\n topNavContainerRef,\n uiShellAppAreaRef,\n ],\n });\n\n return (\n <StyledShellContainer\n odysseyDesignTokens={odysseyDesignTokens}\n ref={parentContainerRef}\n >\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledAppSwitcherContainer>\n {\n /* If AppSwitcher should be initially visible and we have not yet received props, render AppSwitcher in the loading state */\n initialVisibleSections?.includes(\"AppSwitcher\") &&\n !appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher isLoading appIcons={[]} selectedAppName=\"\" />\n </ErrorBoundary>\n )\n }\n\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav isLoading sideNavItems={emptySideNavItems} />\n </ErrorBoundary>\n )\n }\n\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </StyledSideNavContainer>\n\n <StyledTopNavContainer ref={topNavContainerRef}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\n }\n\n {topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )}\n </StyledTopNavContainer>\n\n <StyledAppContainer\n appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={uiShellAppAreaRef}\n >\n <InnerAppContainer isContentScrolled={isContentScrolled} />\n </StyledAppContainer>\n </StyledShellContainer>\n );\n};\n\nconst MemoizedWideUiShellContent = memo(WideUiShellContent);\nMemoizedWideUiShellContent.displayName = \"WideUiShellContent\";\n\nexport { MemoizedWideUiShellContent as WideUiShellContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACpC,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SACEC,sBAAsB,QAEjB,kCAAkC;AACzC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,kCAAkC,QAAQ,yCAAyC;AAK5F,SAAwBC,iBAAiB,QAAQ,sBAAsB;AACvE,SAASC,iBAAiB,QAAQ,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhE,MAAMC,kBAAkB,GAAGjB,MAAM,CAAC,KAAK,EAAE;EACvCkB,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAA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E,iBAAiB,EAAEzB,kBAAkB,EAAE0B,cAAe;UACtDC,kBAAkB,EAAE3B,kBAAkB,EAAE4B;QAAgB,CACzD;MAAC,CACW,CAChB,EAGJ1B,WAAW,IACVpC,IAAA,CAACX,aAAa;QAAC4D,QAAQ,EAAE,IAAK;QAAClB,OAAO,EAAEA,OAAQ;QAAAe,QAAA,EAC9C9C,IAAA,CAACN,MAAM;UAAA,GACD0C,WAAW;UACfuB,iBAAiB,EAAEzB,kBAAkB,EAAE0B,cAAe;UACtDC,kBAAkB,EAAE3B,kBAAkB,EAAE4B;QAAgB,CACzD;MAAC,CACW,CAChB;IAAA,CACoB,CAAC,EAExB9D,IAAA,CAACG,kBAAkB;MACjBG,kBAAkB,EAAE+B,cAAc,EAAE/B,kBAAmB;MACvDyD,QAAQ,EAAE,CAAE;MACZlB,GAAG,EAAEJ,iBAAkB;MAAAK,QAAA,EAEvB9C,IAAA,CAACT,iBAAiB;QAAC+C,iBAAiB,EAAEA;MAAkB,CAAE;IAAC,CACzC,CAAC;EAAA,CACD,CAAC;AAE3B,CAAC;AAED,MAAM0B,0BAA0B,GAAG7E,IAAI,CAACsC,kBAAkB,CAAC;AAC3DuC,0BAA0B,CAACC,WAAW,GAAG,oBAAoB;AAE7D,SAASD,0BAA0B,IAAIvC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"WideUiShellContent.js","names":["styled","memo","useRef","ErrorBoundary","AppSwitcher","InnerAppContainer","useOdysseyDesignTokens","SideNav","TopNav","useScrollState","useMatchAppElementToUiShellAppArea","useUiShellContext","emptySideNavItems","jsx","_jsx","jsxs","_jsxs","appSwitcherDefaultAppIcons","StyledAppContainer","shouldForwardProp","prop","appBackgroundColor","backgroundColor","gridArea","pointerEvents","position","StyledAppSwitcherContainer","StyledBannersContainer","StyledSideNavContainer","StyledShellContainer","odysseyDesignTokens","HueNeutral50","display","gridGap","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","height","width","StyledTopNavContainer","WideUiShellContent","appElement","appElementScrollingMode","appSwitcherProps","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","optionalComponents","sideNavProps","topNavProps","uiShellContext","isContentScrolled","sideNavContainerRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","paddingMode","uiShellResizableRefs","ref","children","banners","includes","fallback","appIcons","isLoading","selectedAppName","undefined","sideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","tabIndex","MemoizedWideUiShellContent","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport { AppSwitcherAppIconData } from \"./AppSwitcher/AppSwitcherApp.js\";\nimport { InnerAppContainer } from \"./InnerAppContainer.js\";\nimport {\n useOdysseyDesignTokens,\n type DesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { SideNav } from \"./SideNav/index.js\";\nimport { TopNav } from \"./TopNav/index.js\";\nimport { useScrollState } from \"./useScrollState.js\";\nimport { useMatchAppElementToUiShellAppArea } from \"./useMatchAppElementToUiShellAppArea.js\";\nimport {\n UiShellNavComponentProps,\n UiShellContentProps,\n} from \"./uiShellContentTypes.js\";\nimport { UiShellColors, useUiShellContext } from \"./UiShellProvider.js\";\nimport { emptySideNavItems } from \"./uiShellSharedConstants.js\";\n\nconst appSwitcherDefaultAppIcons = [] satisfies AppSwitcherAppIconData[];\n\nconst StyledAppContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"appBackgroundColor\" && prop !== \"odysseyDesignTokens\",\n})<{\n appBackgroundColor?: UiShellColors[\"appBackgroundColor\"];\n}>(({ appBackgroundColor }) => ({\n backgroundColor: appBackgroundColor,\n gridArea: \"app-content\",\n pointerEvents: \"none\",\n position: \"relative\",\n}));\n\nconst StyledAppSwitcherContainer = styled(\"div\")({\n gridArea: \"app-switcher\",\n});\n\nconst StyledBannersContainer = styled(\"div\")({\n gridArea: \"banners\",\n});\n\nconst StyledSideNavContainer = styled(\"div\")({\n gridArea: \"side-nav\",\n});\n\nconst StyledShellContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n display: \"grid\",\n gridGap: 0,\n gridTemplateAreas: `\n \"banners banners banners\"\n \"app-switcher side-nav top-nav\"\n \"app-switcher side-nav app-content\"\n `,\n gridTemplateColumns: \"auto auto 1fr\",\n gridTemplateRows: \"auto auto 1fr\",\n height: \"100vh\",\n width: \"100vw\",\n}));\n\nconst StyledTopNavContainer = styled(\"div\")({\n gridArea: \"top-nav\",\n});\n\nexport type WideUiShellContentProps = UiShellNavComponentProps &\n UiShellContentProps;\n\n/**\n * Our new Unified Platform UI Shell.\n *\n * This includes the top and side navigation as well as the footer and provides a spot for your app to render into.\n *\n * If an error occurs, this will revert to only showing the app.\n */\nconst WideUiShellContent = ({\n appElement,\n appElementScrollingMode,\n appSwitcherProps,\n hasStandardAppContentPadding = true,\n initialVisibleSections = [\"TopNav\", \"SideNav\", \"AppSwitcher\"],\n onError = console.error,\n optionalComponents,\n sideNavProps,\n topNavProps,\n}: WideUiShellContentProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const uiShellContext = useUiShellContext();\n\n const { isContentScrolled } = useScrollState(appElement);\n\n const sideNavContainerRef = useRef<HTMLDivElement>(null);\n const topNavContainerRef = useRef<HTMLDivElement>(null);\n const uiShellAppAreaRef = useRef<HTMLDivElement>(null);\n\n const { parentContainerRef } = useMatchAppElementToUiShellAppArea({\n appElement,\n appElementScrollingMode,\n paddingMode: hasStandardAppContentPadding ? \"comfortable\" : \"none\",\n uiShellAppAreaRef,\n uiShellResizableRefs: [\n sideNavContainerRef,\n topNavContainerRef,\n uiShellAppAreaRef,\n ],\n });\n\n return (\n <StyledShellContainer\n odysseyDesignTokens={odysseyDesignTokens}\n ref={parentContainerRef}\n >\n <StyledBannersContainer>\n {optionalComponents?.banners}\n </StyledBannersContainer>\n\n <StyledAppSwitcherContainer>\n {\n /* If AppSwitcher should be initially visible and we have not yet received props, render AppSwitcher in the loading state */\n initialVisibleSections?.includes(\"AppSwitcher\") &&\n !appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher\n appIcons={appSwitcherDefaultAppIcons}\n isLoading\n selectedAppName=\"\"\n />\n </ErrorBoundary>\n )\n }\n\n {appSwitcherProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <AppSwitcher {...appSwitcherProps} />\n </ErrorBoundary>\n )}\n </StyledAppSwitcherContainer>\n\n <StyledSideNavContainer ref={sideNavContainerRef}>\n {\n /* If SideNav should be initially visible and we have not yet received props, render SideNav with minimal inputs */\n initialVisibleSections?.includes(\"SideNav\") &&\n sideNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav isLoading sideNavItems={emptySideNavItems} />\n </ErrorBoundary>\n )\n }\n\n {sideNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <SideNav\n {...{\n ...sideNavProps,\n ...(sideNavProps.hasCustomFooter &&\n optionalComponents?.sideNavFooter\n ? {\n footerComponent: optionalComponents.sideNavFooter,\n footerItems: undefined,\n hasCustomFooter: sideNavProps.hasCustomFooter,\n }\n : {\n footerItems: sideNavProps.footerItems,\n hasCustomFooter: false,\n }),\n }}\n />\n </ErrorBoundary>\n )}\n </StyledSideNavContainer>\n\n <StyledTopNavContainer ref={topNavContainerRef}>\n {\n /* If TopNav should be initially visible and we have not yet received props, render Topnav with minimal inputs */\n initialVisibleSections?.includes(\"TopNav\") &&\n topNavProps === undefined && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )\n }\n\n {topNavProps && (\n <ErrorBoundary fallback={null} onError={onError}>\n <TopNav\n {...topNavProps}\n leftSideComponent={optionalComponents?.topNavLeftSide}\n rightSideComponent={optionalComponents?.topNavRightSide}\n />\n </ErrorBoundary>\n )}\n </StyledTopNavContainer>\n\n <StyledAppContainer\n appBackgroundColor={uiShellContext?.appBackgroundColor}\n tabIndex={0}\n ref={uiShellAppAreaRef}\n >\n <InnerAppContainer isContentScrolled={isContentScrolled} />\n </StyledAppContainer>\n </StyledShellContainer>\n );\n};\n\nconst MemoizedWideUiShellContent = memo(WideUiShellContent);\nMemoizedWideUiShellContent.displayName = \"WideUiShellContent\";\n\nexport { MemoizedWideUiShellContent as WideUiShellContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACpC,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SACEC,sBAAsB,QAEjB,kCAAkC;AACzC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,kCAAkC,QAAQ,yCAAyC;AAK5F,SAAwBC,iBAAiB,QAAQ,sBAAs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EAAEL,kBAAmB;MAAAM,QAAA,GAG3ChB,sBAAsB,EAAEkB,QAAQ,CAAC,QAAQ,CAAC,IACxCZ,WAAW,KAAKiB,SAAS,IACvBtD,IAAA,CAACX,aAAa;QAAC6D,QAAQ,EAAE,IAAK;QAAClB,OAAO,EAAEA,OAAQ;QAAAe,QAAA,EAC9C/C,IAAA,CAACN,MAAM;UACLkE,iBAAiB,EAAEzB,kBAAkB,EAAE0B,cAAe;UACtDC,kBAAkB,EAAE3B,kBAAkB,EAAE4B;QAAgB,CACzD;MAAC,CACW,CAChB,EAGJ1B,WAAW,IACVrC,IAAA,CAACX,aAAa;QAAC6D,QAAQ,EAAE,IAAK;QAAClB,OAAO,EAAEA,OAAQ;QAAAe,QAAA,EAC9C/C,IAAA,CAACN,MAAM;UAAA,GACD2C,WAAW;UACfuB,iBAAiB,EAAEzB,kBAAkB,EAAE0B,cAAe;UACtDC,kBAAkB,EAAE3B,kBAAkB,EAAE4B;QAAgB,CACzD;MAAC,CACW,CAChB;IAAA,CACoB,CAAC,EAExB/D,IAAA,CAACI,kBAAkB;MACjBG,kBAAkB,EAAE+B,cAAc,EAAE/B,kBAAmB;MACvDyD,QAAQ,EAAE,CAAE;MACZlB,GAAG,EAAEJ,iBAAkB;MAAAK,QAAA,EAEvB/C,IAAA,CAACT,iBAAiB;QAACgD,iBAAiB,EAAEA;MAAkB,CAAE;IAAC,CACzC,CAAC;EAAA,CACD,CAAC;AAE3B,CAAC;AAED,MAAM0B,0BAA0B,GAAG9E,IAAI,CAACuC,kBAAkB,CAAC;AAC3DuC,0BAA0B,CAACC,WAAW,GAAG,oBAAoB;AAE7D,SAASD,0BAA0B,IAAIvC,kBAAkB","ignoreList":[]}
@@ -21,5 +21,5 @@ export * from "./useHasUiShell.js";
21
21
  export * from "./WideUiShellContent.js";
22
22
  export * from "../web-component/renderReactInWebComponent.js";
23
23
  export { UiShell } from "./UiShell.js";
24
- export { adminAppUiShellBreakpoints } from "./useUiShellBreakpoints.js";
24
+ export { adminAppUiShellBreakpoints, useUiShellBreakpoints } from "./useUiShellBreakpoints.js";
25
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["UiShell","adminAppUiShellBreakpoints"],"sources":["../../../src/ui-shell/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport * from \"./AppSwitcher/index.js\";\nexport * from \"./InnerAppContainer.js\";\nexport * from \"./NarrowUiShellContent.js\";\nexport * from \"./renderUiShell.js\";\nexport * from \"./SideNav/index.js\";\nexport * from \"./TopNav/index.js\";\nexport * from \"./uiShellContentTypes.js\";\nexport * from \"./useHasUiShell.js\";\nexport * from \"./WideUiShellContent.js\";\n\nexport * from \"../web-component/renderReactInWebComponent.js\"; // This is located here because some teams use React v17, and this uses React v18's `ReactDOM/client` import which isn't in older versions.\n\nexport { UiShell, type UiShellProps } from \"./UiShell.js\";\nexport { adminAppUiShellBreakpoints } from \"./useUiShellBreakpoints.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,2BAA2B;AACzC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,0BAA0B;AACxC,cAAc,oBAAoB;AAClC,cAAc,yBAAyB;AAEvC,cAAc,+CAA+C;AAE7D,SAASA,OAAO,QAA2B,cAAc;AACzD,SAASC,0BAA0B,QAAQ,4BAA4B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["UiShell","adminAppUiShellBreakpoints","useUiShellBreakpoints"],"sources":["../../../src/ui-shell/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport * from \"./AppSwitcher/index.js\";\nexport * from \"./InnerAppContainer.js\";\nexport * from \"./NarrowUiShellContent.js\";\nexport * from \"./renderUiShell.js\";\nexport * from \"./SideNav/index.js\";\nexport * from \"./TopNav/index.js\";\nexport * from \"./uiShellContentTypes.js\";\nexport * from \"./useHasUiShell.js\";\nexport * from \"./WideUiShellContent.js\";\n\nexport * from \"../web-component/renderReactInWebComponent.js\"; // This is located here because some teams use React v17, and this uses React v18's `ReactDOM/client` import which isn't in older versions.\n\nexport { UiShell, type UiShellProps } from \"./UiShell.js\";\nexport {\n adminAppUiShellBreakpoints,\n useUiShellBreakpoints,\n} from \"./useUiShellBreakpoints.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,2BAA2B;AACzC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,0BAA0B;AACxC,cAAc,oBAAoB;AAClC,cAAc,yBAAyB;AAEvC,cAAc,+CAA+C;AAE7D,SAASA,OAAO,QAA2B,cAAc;AACzD,SACEC,0BAA0B,EAC1BC,qBAAqB,QAChB,4BAA4B","ignoreList":[]}
@@ -92,7 +92,7 @@ export const useMatchAppElementToUiShellAppArea = ({
92
92
  };
93
93
  }
94
94
  return () => {};
95
- }, [appElement, appContainerElementStyles, uiShellAppAreaRef]);
95
+ }, [appElement, appContainerElementStyles, uiShellAppAreaRef, uiShellResizableRefs]);
96
96
  return {
97
97
  parentContainerRef
98
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useMatchAppElementToUiShellAppArea.js","names":["useEffect","useMemo","useRef","useOdysseyDesignTokens","convertCamelCaseToKebabCase","string","replace","toLowerCase","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","parentElement","appContentReferenceRectangle","getBoundingClientRect","parentElementRectangle","style","setProperty","top","left","width","height","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","useMatchAppElementToUiShellAppArea","appElement","appElementScrollingMode","paddingMode","uiShellAppAreaRef","uiShellResizableRefs","odysseyDesignTokens","parentContainerRef","appContainerElementStyles","boxSizing","zIndex","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","resizingElements","map","resizingRef","filter","element","Boolean","observer","ResizeObserver","resizingElement","addEventListener","observe","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useMatchAppElementToUiShellAppArea.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, RefObject, useEffect, useMemo, useRef } from \"react\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { UiShellContentProps } from \"./uiShellContentTypes.js\";\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n parentElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n parentElement: HTMLElement;\n}) => {\n const appContentReferenceRectangle =\n appContentReferenceElement.getBoundingClientRect();\n const parentElementRectangle = parentElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\n \"top\",\n `${appContentReferenceRectangle.top - parentElementRectangle.top}px`,\n );\n appContainerElement.style.setProperty(\n \"left\",\n `${appContentReferenceRectangle.left - parentElementRectangle.left}px`,\n );\n appContainerElement.style.setProperty(\n \"width\",\n `${appContentReferenceRectangle.width}px`,\n );\n appContainerElement.style.setProperty(\n \"height\",\n `${appContentReferenceRectangle.height}px`,\n );\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\nexport type UseMatchAppElementToUiShellAppAreaProps = {\n /**\n * Padding around the app area. \"comfortable\" is designed for wider views whereas \"compact\" is designed for narrower views.\n */\n paddingMode: \"comfortable\" | \"compact\" | \"none\";\n /**\n * Ref for the App Container in UI Shell. This should be the one inside the Shell, **not** the element we're going to align.\n */\n uiShellAppAreaRef: RefObject<HTMLDivElement>;\n /**\n * Array of refs of items that indirectly resize the app content area such as \"side nav\" and \"top nav\".\n */\n uiShellResizableRefs: Array<RefObject<HTMLDivElement>>;\n} & Pick<UiShellContentProps, \"appElement\" | \"appElementScrollingMode\">;\n\nexport const useMatchAppElementToUiShellAppArea = ({\n appElement,\n appElementScrollingMode,\n paddingMode,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n}: UseMatchAppElementToUiShellAppAreaProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const parentContainerRef = useRef<HTMLDivElement>(null);\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n boxSizing: \"border-box\",\n zIndex: 1,\n ...(paddingMode === \"comfortable\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n }\n : {}),\n\n ...(paddingMode === \"compact\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing5,\n }\n : {}),\n\n ...(appElementScrollingMode === \"horizontal\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n\n ...(appElementScrollingMode === \"vertical\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [appElementScrollingMode, paddingMode, odysseyDesignTokens],\n );\n\n useEffect(() => {\n // Once `appContainerRef` is rendered, we can position `appContainerElement` on top to match.\n if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n\n animationFrameId = requestAnimationFrame(() => {\n if (uiShellAppAreaRef.current && parentContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: uiShellAppAreaRef.current,\n appContainerElement: appElement,\n parentElement: parentContainerRef.current,\n });\n }\n });\n };\n\n // These refs might change by the time we unsubscribe, so we need to keep references to the original elements.\n const resizingElements = uiShellResizableRefs\n .map((resizingRef) => resizingRef.current)\n .filter((element): element is NonNullable<typeof element> =>\n Boolean(element),\n );\n\n // Set up a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n\n // document.addEventListener(\"ready\", updateStyles);\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.addEventListener(\"transitionend\", updateStyles);\n\n observer.observe(resizingElement);\n });\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.removeEventListener(\"transitionend\", updateStyles);\n });\n };\n }\n return () => {};\n }, [appElement, appContainerElementStyles, uiShellAppAreaRef]);\n\n return {\n parentContainerRef,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAmCA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE5E,SAASC,sBAAsB,QAAQ,kCAAkC;AAGzE,OAAO,MAAMC,2BAA2B,GAAIC,MAAc,IACxDA,MAAM,CAACC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAACC,WAAW,CAAC,CAAC;AAEjD,OAAO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,gBAAgB;EAChBC,mBAAmB;EACnBC,0BAA0B;EAC1BC;AAMF,CAAC,KAAK;EACJ,MAAMC,4BAA4B,GAChCF,0BAA0B,CAACG,qBAAqB,CAAC,CAAC;EACpD,MAAMC,sBAAsB,GAAGH,aAAa,CAACE,qBAAqB,CAAC,CAAC;EAEpEJ,mBAAmB,CAACM,KAAK,CAACC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;EAC7DP,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,KAAK,EACL,GAAGJ,4BAA4B,CAACK,GAAG,GAAGH,sBAAsB,CAACG,GAAG,IAClE,CAAC;EACDR,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,MAAM,EACN,GAAGJ,4BAA4B,CAACM,IAAI,GAAGJ,sBAAsB,CAACI,IAAI,IACpE,CAAC;EACDT,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,OAAO,EACP,GAAGJ,4BAA4B,CAACO,KAAK,IACvC,CAAC;EACDV,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,QAAQ,EACR,GAAGJ,4BA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AAC;EACjB,CAAC,EAAE,CAAClB,UAAU,EAAEO,yBAAyB,EAAEJ,iBAAiB,CAAC,CAAC;EAE9D,OAAO;IACLG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useMatchAppElementToUiShellAppArea.js","names":["useEffect","useMemo","useRef","useOdysseyDesignTokens","convertCamelCaseToKebabCase","string","replace","toLowerCase","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","parentElement","appContentReferenceRectangle","getBoundingClientRect","parentElementRectangle","style","setProperty","top","left","width","height","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","useMatchAppElementToUiShellAppArea","appElement","appElementScrollingMode","paddingMode","uiShellAppAreaRef","uiShellResizableRefs","odysseyDesignTokens","parentContainerRef","appContainerElementStyles","boxSizing","zIndex","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","resizingElements","map","resizingRef","filter","element","Boolean","observer","ResizeObserver","resizingElement","addEventListener","observe","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useMatchAppElementToUiShellAppArea.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, RefObject, useEffect, useMemo, useRef } from \"react\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { UiShellContentProps } from \"./uiShellContentTypes.js\";\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n parentElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n parentElement: HTMLElement;\n}) => {\n const appContentReferenceRectangle =\n appContentReferenceElement.getBoundingClientRect();\n const parentElementRectangle = parentElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\n \"top\",\n `${appContentReferenceRectangle.top - parentElementRectangle.top}px`,\n );\n appContainerElement.style.setProperty(\n \"left\",\n `${appContentReferenceRectangle.left - parentElementRectangle.left}px`,\n );\n appContainerElement.style.setProperty(\n \"width\",\n `${appContentReferenceRectangle.width}px`,\n );\n appContainerElement.style.setProperty(\n \"height\",\n `${appContentReferenceRectangle.height}px`,\n );\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\nexport type UseMatchAppElementToUiShellAppAreaProps = {\n /**\n * Padding around the app area. \"comfortable\" is designed for wider views whereas \"compact\" is designed for narrower views.\n */\n paddingMode: \"comfortable\" | \"compact\" | \"none\";\n /**\n * Ref for the App Container in UI Shell. This should be the one inside the Shell, **not** the element we're going to align.\n */\n uiShellAppAreaRef: RefObject<HTMLDivElement>;\n /**\n * Array of refs of items that indirectly resize the app content area such as \"side nav\" and \"top nav\".\n */\n uiShellResizableRefs: Array<RefObject<HTMLDivElement>>;\n} & Pick<UiShellContentProps, \"appElement\" | \"appElementScrollingMode\">;\n\nexport const useMatchAppElementToUiShellAppArea = ({\n appElement,\n appElementScrollingMode,\n paddingMode,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n}: UseMatchAppElementToUiShellAppAreaProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const parentContainerRef = useRef<HTMLDivElement>(null);\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n boxSizing: \"border-box\",\n zIndex: 1,\n ...(paddingMode === \"comfortable\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n }\n : {}),\n\n ...(paddingMode === \"compact\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing5,\n }\n : {}),\n\n ...(appElementScrollingMode === \"horizontal\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n\n ...(appElementScrollingMode === \"vertical\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [appElementScrollingMode, paddingMode, odysseyDesignTokens],\n );\n\n useEffect(() => {\n // Once `appContainerRef` is rendered, we can position `appContainerElement` on top to match.\n if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n\n animationFrameId = requestAnimationFrame(() => {\n if (uiShellAppAreaRef.current && parentContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: uiShellAppAreaRef.current,\n appContainerElement: appElement,\n parentElement: parentContainerRef.current,\n });\n }\n });\n };\n\n // These refs might change by the time we unsubscribe, so we need to keep references to the original elements.\n const resizingElements = uiShellResizableRefs\n .map((resizingRef) => resizingRef.current)\n .filter((element): element is NonNullable<typeof element> =>\n Boolean(element),\n );\n\n // Set up a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n\n // document.addEventListener(\"ready\", updateStyles);\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.addEventListener(\"transitionend\", updateStyles);\n\n observer.observe(resizingElement);\n });\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.removeEventListener(\"transitionend\", updateStyles);\n });\n };\n }\n return () => {};\n }, [\n appElement,\n appContainerElementStyles,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n ]);\n\n return {\n parentContainerRef,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAmCA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE5E,SAASC,sBAAsB,QAAQ,kCAAkC;AAGzE,OAAO,MAAMC,2BAA2B,GAAIC,MAAc,IACxDA,MAAM,CAACC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAACC,WAAW,CAAC,CAAC;AAEjD,OAAO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,gBAAgB;EAChBC,mBAAmB;EACnBC,0BAA0B;EAC1BC;AAMF,CAAC,KAAK;EACJ,MAAMC,4BAA4B,GAChCF,0BAA0B,CAACG,qBAAqB,CAAC,CAAC;EACpD,MAAMC,sBAAsB,GAAGH,aAAa,CAACE,qBAAqB,CAAC,CAAC;EAEpEJ,mBAAmB,CAACM,KAAK,CAACC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;EAC7DP,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,KAAK,EACL,GAAGJ,4BAA4B,CAACK,GAAG,GAAGH,sBAAsB,CAACG,GAAG,IAClE,CAAC;EACDR,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,MAAM,EACN,GAAGJ,4BAA4B,CAACM,IAAI,GAAGJ,sBAAsB,CAACI,IAAI,IACpE,CAAC;EACDT,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,OAAO,EACP,GAAGJ,4BAA4B,CAACO,KAAK,IACvC,CAAC;EACDV,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,QAAQ,EACR,GAAGJ,4BAA4B,CAACQ,MAAM,IACxC,C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DlB,UAAU,EACVO,yBAAyB,EACzBJ,iBAAiB,EACjBC,oBAAoB,CACrB,CAAC;EAEF,OAAO;IACLE;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -10,30 +10,76 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { useEffect, useMemo, useState } from "react";
14
- export const useScrollState = scrollableContentElement => {
15
- const [isContentScrolled, setIsContentScrolled] = useState(false);
16
- const scrollableElement = useMemo(() => scrollableContentElement, [scrollableContentElement]);
17
- useEffect(() => {
18
- if (scrollableElement) {
19
- let requestedAnimationFrameId;
20
- const updateScrollState = () => {
21
- cancelAnimationFrame(requestedAnimationFrameId);
22
- requestedAnimationFrameId = requestAnimationFrame(() => {
23
- setIsContentScrolled(scrollableElement.scrollTop > 0);
24
- });
25
- };
13
+ import { useCallback, useEffect, useRef, useState } from "react";
14
+ export const getIsScrollHeightElement = ({
15
+ containerElement,
16
+ scrollableElement
17
+ }) => {
18
+ const containerElementHeight = containerElement.getBoundingClientRect().height;
19
+ const scrollableElementHeight = scrollableElement.getBoundingClientRect().height;
20
+ return scrollableElementHeight - containerElementHeight >= 0;
21
+ };
22
+ export const getIsYAxisScrollContainer = element => {
23
+ const overflowY = window.getComputedStyle(element).overflowY;
24
+ return overflowY === "auto" || overflowY === "scroll";
25
+ };
26
+ export const getIsYAxisScrolling = element => element.scrollHeight > element.clientHeight ? getIsYAxisScrollContainer(element) : false;
27
+ export const getNestedScrollContainers = containerElement => Array.from(containerElement.querySelectorAll("*")).filter(element => getIsYAxisScrollContainer(element)).filter(scrollableElement => getIsScrollHeightElement({
28
+ containerElement,
29
+ scrollableElement
30
+ }));
31
+ export const fakeDefaultContainerElement = document.createElement("div");
32
+ export const useScrollState = containerElement => {
33
+ const [isScrolled, setIsScrolled] = useState(false);
34
+ const requestedAnimationFrameIdRef = useRef(0);
35
+ const scrollableElementsRef = useRef([]);
36
+ const updateScrollState = useCallback(() => {
37
+ cancelAnimationFrame(requestedAnimationFrameIdRef.current);
38
+ requestedAnimationFrameIdRef.current = requestAnimationFrame(() => {
39
+ setIsScrolled(scrollableElementsRef.current.reduce((isScrolled, scrollableElement) => isScrolled || scrollableElement.scrollTop > 0, false));
40
+ });
41
+ }, []);
42
+ const addScrollEventListeners = useCallback(() => {
43
+ scrollableElementsRef.current.forEach(scrollableElement => {
26
44
  scrollableElement.addEventListener("scroll", updateScrollState);
27
- updateScrollState();
28
- return () => {
29
- scrollableElement.removeEventListener("scroll", updateScrollState);
30
- cancelAnimationFrame(requestedAnimationFrameId);
31
- };
45
+ });
46
+ }, [updateScrollState]);
47
+ const removeScrollEventListeners = useCallback(() => {
48
+ scrollableElementsRef.current.forEach(scrollableElement => {
49
+ scrollableElement.removeEventListener("scroll", updateScrollState);
50
+ });
51
+ }, [updateScrollState]);
52
+ const updateScrollableElements = useCallback(() => {
53
+ const computedContainerElement = containerElement || fakeDefaultContainerElement;
54
+ scrollableElementsRef.current = getNestedScrollContainers(computedContainerElement).concat(computedContainerElement);
55
+ }, [containerElement]);
56
+ const updateScrollListeners = useCallback(() => {
57
+ removeScrollEventListeners();
58
+ updateScrollableElements();
59
+ addScrollEventListeners();
60
+ updateScrollState();
61
+ }, [addScrollEventListeners, removeScrollEventListeners, updateScrollableElements, updateScrollState]);
62
+ useEffect(() => {
63
+ const mutationObserver = new MutationObserver(() => {
64
+ updateScrollListeners();
65
+ });
66
+ if (containerElement) {
67
+ mutationObserver.observe(containerElement, {
68
+ attributes: true,
69
+ attributeFilter: ["style"],
70
+ childList: true,
71
+ subtree: true
72
+ });
32
73
  }
33
- return () => {};
34
- }, [scrollableElement]);
74
+ updateScrollListeners();
75
+ return () => {
76
+ cancelAnimationFrame(requestedAnimationFrameIdRef.current);
77
+ removeScrollEventListeners();
78
+ mutationObserver.disconnect();
79
+ };
80
+ }, [containerElement, removeScrollEventListeners, updateScrollListeners]);
35
81
  return {
36
- isContentScrolled
82
+ isContentScrolled: isScrolled
37
83
  };
38
84
  };
39
85
  //# sourceMappingURL=useScrollState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollState.js","names":["useEffect","useMemo","useState","useScrollState","scrollableContentElement","isContentScrolled","setIsContentScrolled","scrollableElement","requestedAnimationFrameId","updateScrollState","cancelAnimationFrame","requestAnimationFrame","scrollTop","addEventListener","removeEventListener"],"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 { useEffect, useMemo, useState } from \"react\";\n\nexport const useScrollState = <\n ScrollableContentElement extends HTMLElement = HTMLDivElement,\n>(\n scrollableContentElement?: ScrollableContentElement,\n) => {\n const [isContentScrolled, setIsContentScrolled] = useState(false);\n\n const scrollableElement = useMemo(\n () => scrollableContentElement,\n [scrollableContentElement],\n );\n\n useEffect(() => {\n if (scrollableElement) {\n let requestedAnimationFrameId: number;\n\n const updateScrollState = () => {\n cancelAnimationFrame(requestedAnimationFrameId);\n\n requestedAnimationFrameId = requestAnimationFrame(() => {\n setIsContentScrolled(scrollableElement.scrollTop > 0);\n });\n };\n\n scrollableElement.addEventListener(\"scroll\", updateScrollState);\n\n updateScrollState();\n\n return () => {\n scrollableElement.removeEventListener(\"scroll\", updateScrollState);\n\n cancelAnimationFrame(requestedAnimationFrameId);\n };\n }\n\n return () => {};\n }, [scrollableElement]);\n\n return {\n isContentScrolled,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,OAAO,MAAMC,cAAc,GAGzBC,wBAAmD,IAChD;EACH,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGJ,QAAQ,CAAC,KAAK,CAAC;EAEjE,MAAMK,iBAAiB,GAAGN,OAAO,CAC/B,MAAMG,wBAAwB,EAC9B,CAACA,wBAAwB,CAC3B,CAAC;EAEDJ,SAAS,CAAC,MAAM;IACd,IAAIO,iBAAiB,EAAE;MACrB,IAAIC,yBAAiC;MAErC,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;QAC9BC,oBAAoB,CAACF,yBAAyB,CAAC;QAE/CA,yBAAyB,GAAGG,qBAAqB,CAAC,MAAM;UACtDL,oBAAoB,CAACC,iBAAiB,CAACK,SAAS,GAAG,CAAC,CAAC;QACvD,CAAC,CAAC;MACJ,CAAC;MAEDL,iBAAiB,CAACM,gBAAgB,CAAC,QAAQ,EAAEJ,iBAAiB,CAAC;MAE/DA,iBAAiB,CAAC,CAAC;MAEnB,OAAO,MAAM;QACXF,iBAAiB,CAACO,mBAAmB,CAAC,QAAQ,EAAEL,iBAAiB,CAAC;QAElEC,oBAAoB,CAACF,yBAAyB,CAAC;MACjD,CAAC;IACH;IAEA,OAAO,MAAM,CAAC,CAAC;EACjB,CAAC,EAAE,CAACD,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IACLF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useScrollState.js","names":["useCallback","useEffect","useRef","useState","getIsScrollHeightElement","containerElement","scrollableElement","containerElementHeight","getBoundingClientRect","height","scrollableElementHeight","getIsYAxisScrollContainer","element","overflowY","window","getComputedStyle","getIsYAxisScrolling","scrollHeight","clientHeight","getNestedScrollContainers","Array","from","querySelectorAll","filter","fakeDefaultContainerElement","document","createElement","useScrollState","isScrolled","setIsScrolled","requestedAnimationFrameIdRef","scrollableElementsRef","updateScrollState","cancelAnimationFrame","current","requestAnimationFrame","reduce","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 scrollableElement,\n}: {\n containerElement: HTMLElement;\n scrollableElement: HTMLElement;\n}) => {\n const containerElementHeight =\n containerElement.getBoundingClientRect().height;\n const scrollableElementHeight =\n scrollableElement.getBoundingClientRect().height;\n\n return scrollableElementHeight - 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) => getIsYAxisScrollContainer(element))\n .filter((scrollableElement) =>\n getIsScrollHeightElement({\n containerElement,\n scrollableElement,\n }),\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,E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5BE,wBAAwB,CAAC,CAAC;IAC1BL,uBAAuB,CAAC,CAAC;IACzBN,iBAAiB,CAAC,CAAC;EACrB,CAAC,EAAE,CACDM,uBAAuB,EACvBG,0BAA0B,EAC1BE,wBAAwB,EACxBX,iBAAiB,CAClB,CAAC;EAEF/B,SAAS,CAAC,MAAM;IACd,MAAM8C,gBAAgB,GAAG,IAAIC,gBAAgB,CAAC,MAAM;MAClDF,qBAAqB,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,IAAIzC,gBAAgB,EAAE;MACpB0C,gBAAgB,CAACE,OAAO,CAAC5C,gBAAgB,EAAE;QACzC6C,UAAU,EAAE,IAAI;QAChBC,eAAe,EAAE,CAAC,OAAO,CAAC;QAC1BC,SAAS,EAAE,IAAI;QACfC,OAAO,EAAE;MACX,CAAC,CAAC;IACJ;IAEAP,qBAAqB,CAAC,CAAC;IAEvB,OAAO,MAAM;MACXb,oBAAoB,CAACH,4BAA4B,CAACI,OAAO,CAAC;MAC1DO,0BAA0B,CAAC,CAAC;MAC5BM,gBAAgB,CAACO,UAAU,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,CAACjD,gBAAgB,EAAEoC,0BAA0B,EAAEK,qBAAqB,CAAC,CAAC;EAEzE,OAAO;IACLS,iBAAiB,EAAE3B;EACrB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,29 @@
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, useRef } from "react";
14
+ export const useMountLifecycleEffect = ({
15
+ onMount,
16
+ onUpdate
17
+ }) => {
18
+ const hasSetSessionStorageRef = useRef(false);
19
+ const onMountRef = useRef(onMount);
20
+ useEffect(() => {
21
+ if (hasSetSessionStorageRef.current) {
22
+ onUpdate?.();
23
+ } else {
24
+ hasSetSessionStorageRef.current = true;
25
+ onMountRef.current?.();
26
+ }
27
+ }, [onUpdate]);
28
+ };
29
+ //# sourceMappingURL=useMountLifecycleEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMountLifecycleEffect.js","names":["useEffect","useRef","useMountLifecycleEffect","onMount","onUpdate","hasSetSessionStorageRef","onMountRef","current"],"sources":["../../src/useMountLifecycleEffect.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, useRef } from \"react\";\n\nexport const useMountLifecycleEffect = ({\n onMount,\n onUpdate,\n}: {\n onMount?: () => void;\n onUpdate?: () => void;\n}) => {\n const hasSetSessionStorageRef = useRef(false);\n const onMountRef = useRef(onMount);\n\n useEffect(() => {\n if (hasSetSessionStorageRef.current) {\n onUpdate?.();\n } else {\n hasSetSessionStorageRef.current = true;\n onMountRef.current?.();\n }\n }, [onUpdate]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,OAAO;EACPC;AAIF,CAAC,KAAK;EACJ,MAAMC,uBAAuB,GAAGJ,MAAM,CAAC,KAAK,CAAC;EAC7C,MAAMK,UAAU,GAAGL,MAAM,CAACE,OAAO,CAAC;EAElCH,SAAS,CAAC,MAAM;IACd,IAAIK,uBAAuB,CAACE,OAAO,EAAE;MACnCH,QAAQ,GAAG,CAAC;IACd,CAAC,MAAM;MACLC,uBAAuB,CAACE,OAAO,GAAG,IAAI;MACtCD,UAAU,CAACC,OAAO,GAAG,CAAC;IACxB;EACF,CAAC,EAAE,CAACH,QAAQ,CAAC,CAAC;AAChB,CAAC","ignoreList":[]}
@@ -0,0 +1,56 @@
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 { useCallback, useEffect, useMemo, useState } from "react";
14
+ import { useMountLifecycleEffect } from "./useMountLifecycleEffect.js";
15
+ export const getSessionStorageValue = key => {
16
+ const sessionStorageValue = window.sessionStorage.getItem(key);
17
+ try {
18
+ if (typeof sessionStorageValue === "string") {
19
+ return JSON.parse(sessionStorageValue);
20
+ }
21
+ return null;
22
+ } catch {
23
+ if (typeof sessionStorageValue === "string") {
24
+ return sessionStorageValue;
25
+ }
26
+ return null;
27
+ }
28
+ };
29
+ export const useSessionStorageState = ({
30
+ initialState,
31
+ key
32
+ }) => {
33
+ if (!key) {
34
+ throw new Error("You must pass a value for `key`.");
35
+ }
36
+ const sessionState = useMemo(() => getSessionStorageValue(key), [key]);
37
+ const setSessionState = useCallback(value => {
38
+ const sessionStorageState = typeof value === "undefined" ? "" : JSON.stringify(value);
39
+ window.sessionStorage.setItem(key, sessionStorageState);
40
+ }, [key]);
41
+ const [localState, setLocalState] = useState(() => sessionState ?? initialState);
42
+ useEffect(() => {
43
+ setSessionState(localState);
44
+ }, [localState, setSessionState]);
45
+ const onUpdate = useCallback(() => {
46
+ setLocalState(sessionState ?? initialState);
47
+ }, [initialState, sessionState]);
48
+ useMountLifecycleEffect({
49
+ onUpdate
50
+ });
51
+ return {
52
+ sessionState: localState,
53
+ setSessionState: setLocalState
54
+ };
55
+ };
56
+ //# sourceMappingURL=useSessionStorageState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionStorageState.js","names":["useCallback","useEffect","useMemo","useState","useMountLifecycleEffect","getSessionStorageValue","key","sessionStorageValue","window","sessionStorage","getItem","JSON","parse","useSessionStorageState","initialState","Error","sessionState","setSessionState","value","sessionStorageState","stringify","setItem","localState","setLocalState","onUpdate"],"sources":["../../src/useSessionStorageState.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 { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useMountLifecycleEffect } from \"./useMountLifecycleEffect.js\";\n\nexport const getSessionStorageValue = <Value>(key: string): Value | null => {\n const sessionStorageValue = window.sessionStorage.getItem(key);\n\n try {\n if (typeof sessionStorageValue === \"string\") {\n return JSON.parse(sessionStorageValue) as Value;\n }\n\n return null;\n } catch {\n if (typeof sessionStorageValue === \"string\") {\n return sessionStorageValue as Value;\n }\n\n return null;\n }\n};\n\nexport const useSessionStorageState = <Value>({\n initialState,\n key,\n}: {\n initialState: Value;\n key: string;\n}) => {\n if (!key) {\n throw new Error(\"You must pass a value for `key`.\");\n }\n\n const sessionState = useMemo(() => getSessionStorageValue<Value>(key), [key]);\n\n const setSessionState = useCallback(\n (value: Value) => {\n const sessionStorageState =\n typeof value === \"undefined\" ? \"\" : JSON.stringify(value);\n\n window.sessionStorage.setItem(key, sessionStorageState);\n },\n [key],\n );\n\n const [localState, setLocalState] = useState<Value>(\n () => sessionState ?? initialState,\n );\n\n // This keeps session storage's state based on local state.\n useEffect(() => {\n setSessionState(localState);\n }, [localState, setSessionState]);\n\n // This updates when `key` is updated.\n const onUpdate = useCallback(() => {\n setLocalState(sessionState ?? initialState);\n }, [initialState, sessionState]);\n\n useMountLifecycleEffect({\n onUpdate,\n });\n\n return {\n sessionState: localState,\n setSessionState: setLocalState,\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,MAAMC,sBAAsB,GAAWC,GAAW,IAAmB;EAC1E,MAAMC,mBAAmB,GAAGC,MAAM,CAACC,cAAc,CAACC,OAAO,CAACJ,GAAG,CAAC;EAE9D,IAAI;IACF,IAAI,OAAOC,mBAAmB,KAAK,QAAQ,EAAE;MAC3C,OAAOI,IAAI,CAACC,KAAK,CAACL,mBAAmB,CAAC;IACxC;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,MAAM;IACN,IAAI,OAAOA,mBAAmB,KAAK,QAAQ,EAAE;MAC3C,OAAOA,mBAAmB;IAC5B;IAEA,OAAO,IAAI;EACb;AACF,CAAC;AAED,OAAO,MAAMM,sBAAsB,GAAGA,CAAQ;EAC5CC,YAAY;EACZR;AAIF,CAAC,KAAK;EACJ,IAAI,CAACA,GAAG,EAAE;IACR,MAAM,IAAIS,KAAK,CAAC,kCAAkC,CAAC;EACrD;EAEA,MAAMC,YAAY,GAAGd,OAAO,CAAC,MAAMG,sBAAsB,CAAQC,GAAG,CAAC,EAAE,CAACA,GAAG,CAAC,CAAC;EAE7E,MAAMW,eAAe,GAAGjB,WAAW,CAChCkB,KAAY,IAAK;IAChB,MAAMC,mBAAmB,GACvB,OAAOD,KAAK,KAAK,WAAW,GAAG,EAAE,GAAGP,IAAI,CAACS,SAAS,CAACF,KAAK,CAAC;IAE3DV,MAAM,CAACC,cAAc,CAACY,OAAO,CAACf,GAAG,EAAEa,mBAAmB,CAAC;EACzD,CAAC,EACD,CAACb,GAAG,CACN,CAAC;EAED,MAAM,CAACgB,UAAU,EAAEC,aAAa,CAAC,GAAGpB,QAAQ,CAC1C,MAAMa,YAAY,IAAIF,YACxB,CAAC;EAGDb,SAAS,CAAC,MAAM;IACdgB,eAAe,CAACK,UAAU,CAAC;EAC7B,CAAC,EAAE,CAACA,UAAU,EAAEL,eAAe,CAAC,CAAC;EAGjC,MAAMO,QAAQ,GAAGxB,WAAW,CAAC,MAAM;IACjCuB,aAAa,CAACP,YAAY,IAAIF,YAAY,CAAC;EAC7C,CAAC,EAAE,CAACA,YAAY,EAAEE,YAAY,CAAC,CAAC;EAEhCZ,uBAAuB,CAAC;IACtBoB;EACF,CAAC,CAAC;EAEF,OAAO;IACLR,YAAY,EAAEM,UAAU;IACxBL,eAAe,EAAEM;EACnB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -10,12 +10,14 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ export const appRootElementId = "app-root";
14
+ export const stylesRootElementId = "style-root";
13
15
  export const createReactRootElements = () => {
14
16
  const appRootElement = document.createElement("div");
15
17
  const stylesRootElement = document.createElement("div");
16
18
  appRootElement.style.setProperty("height", "inherit");
17
- appRootElement.setAttribute("id", "app-root");
18
- stylesRootElement.setAttribute("id", "style-root");
19
+ appRootElement.setAttribute("id", appRootElementId);
20
+ stylesRootElement.setAttribute("id", stylesRootElementId);
19
21
  stylesRootElement.setAttribute("nonce", window.cspNonce);
20
22
  return {
21
23
  appRootElement,
@@ -1 +1 @@
1
- {"version":3,"file":"createReactRootElements.js","names":["createReactRootElements","appRootElement","document","createElement","stylesRootElement","style","setProperty","setAttribute","window","cspNonce"],"sources":["../../../src/web-component/createReactRootElements.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\nexport type ReactRootElements = {\n /**\n * The element your root React component renders into.\n * React has to render or portal somewhere, and this element can be used for that root element.\n */\n appRootElement: HTMLDivElement;\n /**\n * In React apps, your styles typically go in `document.head`, but you may want to render them somewhere else.\n *\n * Specifically when rendering in a web component, there is no `<head>`, so you have to create a spot for styles to render.\n */\n stylesRootElement: HTMLDivElement | HTMLHeadElement;\n};\n\nexport const createReactRootElements = () => {\n const appRootElement = document.createElement(\"div\");\n const stylesRootElement = document.createElement(\"div\");\n\n // This `div` may cause layout issues unless it inherits the parent's height.\n appRootElement.style.setProperty(\"height\", \"inherit\");\n\n appRootElement.setAttribute(\"id\", \"app-root\");\n stylesRootElement.setAttribute(\"id\", \"style-root\");\n stylesRootElement.setAttribute(\"nonce\", window.cspNonce);\n\n return {\n appRootElement,\n stylesRootElement,\n } satisfies ReactRootElements;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,MAAMA,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,cAAc,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACpD,MAAMC,iBAAiB,GAAGF,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGvDF,cAAc,CAACI,KAAK,CAACC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC;EAErDL,cAAc,CAACM,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC;EAC7CH,iBAAiB,CAACG,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC;EAClDH,iBAAiB,CAACG,YAAY,CAAC,OAAO,EAAEC,MAAM,CAACC,QAAQ,CAAC;EAExD,OAAO;IACLR,cAAc;IACdG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createReactRootElements.js","names":["appRootElementId","stylesRootElementId","createReactRootElements","appRootElement","document","createElement","stylesRootElement","style","setProperty","setAttribute","window","cspNonce"],"sources":["../../../src/web-component/createReactRootElements.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\nexport type ReactRootElements = {\n /**\n * The element your root React component renders into.\n * React has to render or portal somewhere, and this element can be used for that root element.\n */\n appRootElement: HTMLDivElement;\n /**\n * In React apps, your styles typically go in `document.head`, but you may want to render them somewhere else.\n *\n * Specifically when rendering in a web component, there is no `<head>`, so you have to create a spot for styles to render.\n */\n stylesRootElement: HTMLDivElement | HTMLHeadElement;\n};\n\nexport const appRootElementId = \"app-root\";\nexport const stylesRootElementId = \"style-root\";\n\nexport const createReactRootElements = () => {\n const appRootElement = document.createElement(\"div\");\n const stylesRootElement = document.createElement(\"div\");\n\n // This `div` may cause layout issues unless it inherits the parent's height.\n appRootElement.style.setProperty(\"height\", \"inherit\");\n\n appRootElement.setAttribute(\"id\", appRootElementId);\n stylesRootElement.setAttribute(\"id\", stylesRootElementId);\n stylesRootElement.setAttribute(\"nonce\", window.cspNonce);\n\n return {\n appRootElement,\n stylesRootElement,\n } satisfies ReactRootElements;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,MAAMA,gBAAgB,GAAG,UAAU;AAC1C,OAAO,MAAMC,mBAAmB,GAAG,YAAY;AAE/C,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,cAAc,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACpD,MAAMC,iBAAiB,GAAGF,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGvDF,cAAc,CAACI,KAAK,CAACC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC;EAErDL,cAAc,CAACM,YAAY,CAAC,IAAI,EAAET,gBAAgB,CAAC;EACnDM,iBAAiB,CAACG,YAAY,CAAC,IAAI,EAAER,mBAAmB,CAAC;EACzDK,iBAAiB,CAACG,YAAY,CAAC,OAAO,EAAEC,MAAM,CAACC,QAAQ,CAAC;EAExD,OAAO;IACLR,cAAc;IACdG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 03 Apr 2025 19:00:00 GMT
3
+ * Generated on Thu, 24 Apr 2025 19:05:52 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 03 Apr 2025 19:00:00 GMT
3
+ * Generated on Thu, 24 Apr 2025 19:05:52 GMT
4
4
  */
5
5
 
6
6
  export const BorderColorControl = "#8d8d8d";
package/dist/index.scss CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  * Do not edit directly
4
- * Generated on Thu, 03 Apr 2025 19:00:00 GMT
4
+ * Generated on Thu, 24 Apr 2025 19:05:52 GMT
5
5
  */
6
6
 
7
7
  $border-color-control: #8d8d8d !default;