@okta/odyssey-react-mui 1.36.1 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/cjs/Pagination/Pagination.cjs +1 -1
- package/dist/cjs/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/Pagination/usePagination.cjs +3 -1
- package/dist/cjs/Pagination/usePagination.cjs.map +1 -1
- package/dist/cjs/labs/DataView/TableLayoutContent.cjs +3 -3
- package/dist/cjs/labs/DataView/TableLayoutContent.cjs.map +1 -1
- package/dist/cjs/labs/PageTemplate/DocumentationLink.cjs +41 -0
- package/dist/cjs/labs/PageTemplate/DocumentationLink.cjs.map +1 -0
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs +22 -8
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +2 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +6 -2
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +0 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +12 -0
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs.map +1 -1
- package/dist/cjs/web-component/renderReactInWebComponent.cjs.map +1 -1
- package/dist/esm/Pagination/Pagination.js +1 -1
- package/dist/esm/Pagination/Pagination.js.map +1 -1
- package/dist/esm/Pagination/usePagination.js +3 -1
- package/dist/esm/Pagination/usePagination.js.map +1 -1
- package/dist/esm/labs/DataView/TableLayoutContent.js +3 -3
- package/dist/esm/labs/DataView/TableLayoutContent.js.map +1 -1
- package/dist/esm/labs/PageTemplate/DocumentationLink.js +35 -0
- package/dist/esm/labs/PageTemplate/DocumentationLink.js.map +1 -0
- package/dist/esm/labs/PageTemplate/PageTemplate.js +22 -8
- package/dist/esm/labs/PageTemplate/PageTemplate.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +2 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNav.js +6 -2
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +0 -1
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +12 -0
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js.map +1 -1
- package/dist/esm/web-component/renderReactInWebComponent.js.map +1 -1
- package/dist/index.cjs +231 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.mjs +229 -0
- package/dist/index.scss +549 -0
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/types/Pagination/usePagination.d.ts.map +1 -1
- package/dist/types/i18n.d.ts +1 -0
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/labs/PageTemplate/DocumentationLink.d.ts +34 -0
- package/dist/types/labs/PageTemplate/DocumentationLink.d.ts.map +1 -0
- package/dist/types/labs/PageTemplate/PageTemplate.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +19 -4
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WideUiShellContent.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactErrorBoundary","_index","_InnerAppContainer","_OdysseyDesignTokensContext","_index2","_index3","_useScrollState","_useMatchAppElementToUiShellAppArea","_UiShellProvider","_uiShellSharedConstants","_jsxRuntime","e","__esModule","default","appSwitcherDefaultAppIcons","StyledAppContainer","styled","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","useOdysseyDesignTokens","uiShellContext","useUiShellContext","isContentScrolled","useScrollState","sideNavContainerRef","useRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","useMatchAppElementToUiShellAppArea","paddingMode","uiShellResizableRefs","jsxs","ref","children","jsx","banners","includes","ErrorBoundary","fallback","AppSwitcher","appIcons","isLoading","selectedAppName","undefined","SideNav","sideNavItems","emptySideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","TopNav","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","tabIndex","InnerAppContainer","MemoizedWideUiShellContent","exports","memo","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport { 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":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,2BAAA,GAAAL,OAAA;AAIA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,mCAAA,GAAAT,OAAA;AAKA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AAAgE,IAAAY,WAAA,GAAAZ,OAAA;AAAA,SAAAD,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAhChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,MAAMG,0BAA0B,GAAG,EAAqC;AAExE,MAAMC,kBAAkB,GAAG,I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kB;MAAAO,QAAA,EAEvB,IAAAvD,WAAA,CAAAwD,GAAA,EAAChE,kBAAA,CAAAuF,iBAAiB;QAACpC,iBAAiB,EAAEA;MAAkB,CAAE;IAAC,CACzC,CAAC;EAAA,CACD,CAAC;AAE3B,CAAC;AAED,MAAMqC,0BAA0B,GAAAC,OAAA,CAAArD,kBAAA,GAAG,IAAAsD,WAAI,EAACtD,kBAAkB,CAAC;AAC3DoD,0BAA0B,CAACG,WAAW,GAAG,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"WideUiShellContent.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactErrorBoundary","_index","_InnerAppContainer","_OdysseyDesignTokensContext","_index2","_index3","_useScrollState","_useMatchAppElementToUiShellAppArea","_UiShellProvider","_uiShellSharedConstants","_jsxRuntime","e","__esModule","default","appSwitcherDefaultAppIcons","StyledAppContainer","styled","shouldForwardProp","prop","appBackgroundColor","backgroundColor","gridArea","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","useOdysseyDesignTokens","uiShellContext","useUiShellContext","isContentScrolled","useScrollState","sideNavContainerRef","useRef","topNavContainerRef","uiShellAppAreaRef","parentContainerRef","useMatchAppElementToUiShellAppArea","paddingMode","uiShellResizableRefs","jsxs","ref","children","jsx","banners","includes","ErrorBoundary","fallback","AppSwitcher","appIcons","isLoading","selectedAppName","undefined","SideNav","sideNavItems","emptySideNavItems","hasCustomFooter","sideNavFooter","footerComponent","footerItems","TopNav","leftSideComponent","topNavLeftSide","rightSideComponent","topNavRightSide","tabIndex","InnerAppContainer","MemoizedWideUiShellContent","exports","memo","displayName"],"sources":["../../../src/ui-shell/WideUiShellContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, useRef } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { AppSwitcher } from \"./AppSwitcher/index.js\";\nimport { 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 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":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,2BAAA,GAAAL,OAAA;AAIA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,mCAAA,GAAAT,OAAA;AAKA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AAAgE,IAAAY,WAAA,GAAAZ,OAAA;AAAA,SAAAD,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAhChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,MAAMG,0BAA0B,GAAG,EAAqC;AAExE,MAAMC,kBAAkB,GAAG,IAAAC,eAAM,EAAC,KAAK,EAAE;EACvCC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,oBAAoB,IAAIA,IAAI,KAAK;AAC9C,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAmB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qC,0BAA0B,GAAAC,OAAA,CAAArD,kBAAA,GAAG,IAAAsD,WAAI,EAACtD,kBAAkB,CAAC;AAC3DoD,0BAA0B,CAACG,WAAW,GAAG,oBAAoB","ignoreList":[]}
|
|
@@ -39,6 +39,7 @@ const renderUiShell = ({
|
|
|
39
39
|
hasStandardAppContentPadding,
|
|
40
40
|
initialVisibleSections,
|
|
41
41
|
onError = console.error,
|
|
42
|
+
onRender,
|
|
42
43
|
parentElement,
|
|
43
44
|
sideNavBackgroundColor,
|
|
44
45
|
topNavBackgroundColor
|
|
@@ -103,6 +104,17 @@ const renderUiShell = ({
|
|
|
103
104
|
webComponentParentElement: parentElement,
|
|
104
105
|
webComponentChildren
|
|
105
106
|
});
|
|
107
|
+
const unsubscribeFromUnifiedUiShellRendered = subscribeToReactAppSubscribed(() => {
|
|
108
|
+
unsubscribeFromUnifiedUiShellRendered();
|
|
109
|
+
onRender?.({
|
|
110
|
+
appElement,
|
|
111
|
+
closeRightSideMenu,
|
|
112
|
+
closeSideNavMenu,
|
|
113
|
+
setComponentProps: publishAfterReactAppReadyForProps,
|
|
114
|
+
slottedElements,
|
|
115
|
+
uiShellElement
|
|
116
|
+
});
|
|
117
|
+
});
|
|
106
118
|
parentElement.appendChild(appElement);
|
|
107
119
|
return {
|
|
108
120
|
appElement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","appendChild","setComponentProps"],"sources":["../../../src/ui-shell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest.js\";\nimport { createMessageBus } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n breakpointConfig,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n parentElement,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n}: {\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * HTML element used as the container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"breakpointConfig\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n parentElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const {\n publish: closeRightSideMenu,\n subscribe: subscribeToCloseRightSideMenu,\n } = createMessageBus();\n\n const { publish: closeSideNavMenu, subscribe: subscribeToCloseSideNavMenu } =\n createMessageBus();\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n >;\n\n const webComponentChildren = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n breakpointConfig={breakpointConfig}\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n closeSideNavMenu={closeSideNavMenu}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentParentElement: parentElement,\n webComponentChildren,\n });\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,Q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C2C,GAAG,CAC5C,CAAC,CAACC,oBAAoB,EAAEC,QAAQ,CAAC,KAAK,CACpCD,oBAAoB,EACpB,IAAA7C,WAAA,CAAAsD,GAAA;UAAMO,IAAI,EAAEf;QAAS,CAAE,CAAC,CAE5B,CACF,CAAE;QACFzB,sBAAsB,EAAEA,sBAAuB;QAC/CgB,6BAA6B,EAAEA,6BAA8B;QAC7DE,2BAA2B,EAAEA,2BAA4B;QACzDT,sBAAsB,EAAEA,sBAAuB;QAC/CR,qBAAqB,EAAEA,qBAAsB;QAC7CwC,iBAAiB,EAAET,iBAAiB,CAACU,cAAe;QACpDC,oBAAoB,EAAEX,iBAAiB,CAACY;MAAkB,CAC3D;IAAC,CACW,CAChB;IACDC,yBAAyB,EAAE9C,aAAa;IACxC4B;EACF,CAAC,CAAC;EAEF5B,aAAa,CAAC+C,WAAW,CAACxD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVyB,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAChD,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","breakpointConfig","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","onRender","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","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,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AAA0F,IAAAM,WAAA,GAAAN,OAAA;AApB1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAMO,0BAGZ,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EACFE,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,iBAAiB;EAChCC,aAAa,EAAE,iBAAiB;EAChCC,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AA0BM,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;EACbC,sBAAsB;EACtBC;AAyBwC,CAAC,KAAK;EAC9C,MAAMZ,UAAU,GAAGC,kBAAkB,IAAIY,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGtEJ,aAAa,CAACK,YAAY,CAACC,mCAAoB,EAAE,EAAE,CAAC;EAEp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C3D,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACV0B,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAACjD,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -15,5 +15,5 @@ exports.default = void 0;
|
|
|
15
15
|
*
|
|
16
16
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default = exports.default = "1-
|
|
18
|
+
var _default = exports.default = "1-37-0";
|
|
19
19
|
//# sourceMappingURL=odysseyWebComponentVersion.generated.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odysseyWebComponentVersion.generated.cjs","names":["_default","exports","default"],"sources":["../../../src/web-component/odysseyWebComponentVersion.generated.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\n/**\n * DO NOT UPDATE THIS FILE MANUALLY\n * This file is managed by scripts/updateWebComponentVersion.ts and any changes made will be overwritten\n * This script only needs to be run during release, and shouldn't be used during local development.\n */\nexport default \"1-
|
|
1
|
+
{"version":3,"file":"odysseyWebComponentVersion.generated.cjs","names":["_default","exports","default"],"sources":["../../../src/web-component/odysseyWebComponentVersion.generated.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\n/**\n * DO NOT UPDATE THIS FILE MANUALLY\n * This file is managed by scripts/updateWebComponentVersion.ts and any changes made will be overwritten\n * This script only needs to be run during release, and shouldn't be used during local development.\n */\nexport default \"1-37-0\";\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAiBe,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderReactInWebComponent.cjs","names":["_odysseyWebComponentVersionGenerated","_interopRequireDefault","require","_createReactRootElements","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","_interopRequireWildcard","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","webComponentDataAttributeName","exports","versionedWebComponentName","version","toLowerCase","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","WebComponentClass","getReactComponent","reactRootElements","elementName","localName","reactRootPromise","Promise","resolve","constructor","createReactRootElements","appRootElement","stylesRootElement","shadowRoot","attachShadow","mode","appendChild","styleHostElement","document","createElement","setAttribute","window","cspNonce","innerHTML","setGetReactComponent","then","reactRoot","render","connectedCallback","Error","specifier","s","createRoot","disconnectedCallback","unmount","getReactWebComponent","webComponentName","customElements","define","element","renderReactInWebComponent","webComponentChildren","webComponentParentElement","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\nimport version from \"./odysseyWebComponentVersion.generated.js\";\n\nimport {\n createReactRootElements,\n type ReactRootElements,\n} from \"./createReactRootElements.js\";\n\ninterface GetReactWebComponentOptions {\n webComponentName?: string;\n getReactComponent: (reactRootElements: ReactRootElements) => ReactNode;\n}\n\n// Used by selenium when selecting for odyssey web components regardless of their name.\nexport const webComponentDataAttributeName = \"data-odyssey-react-web-component\";\n// Unique name to avoid multiple versions of odyssey overwriting each other's implementations\nexport const versionedWebComponentName =\n `odyssey-react-web-component-${version}`.toLowerCase();\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class WebComponentClass extends SsrFriendlyHtmlElementClass {\n #getReactComponent: GetReactComponentInWebComponent | null = null;\n readonly #reactRootElements: ReactRootElements;\n public readonly elementName: string = this.localName;\n // public for testing\n public reactRootPromise: Promise<Root | null> = Promise.resolve(null);\n\n constructor() {\n super();\n\n this.#reactRootElements = createReactRootElements();\n const { appRootElement, stylesRootElement } = this.#reactRootElements;\n\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n shadowRoot.appendChild(stylesRootElement);\n shadowRoot.appendChild(appRootElement);\n\n const styleHostElement = document.createElement(\"style\");\n styleHostElement.setAttribute(\"nonce\", window.cspNonce);\n styleHostElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n stylesRootElement.appendChild(styleHostElement);\n }\n\n /**\n * Provides the function used to initialize react content that is specific to this instance\n * of the web component, which is used later in the connectedCallback.\n *\n * Always set immediately after creation via document.createElement\n */\n setGetReactComponent(getReactComponent: GetReactComponentInWebComponent) {\n this.reactRootPromise = this.reactRootPromise.then((reactRoot) => {\n this.#getReactComponent = getReactComponent;\n if (reactRoot) {\n // connectedCallback has already been fired. Need to mount this content to the existing root\n reactRoot.render(this.#getReactComponent(this.#reactRootElements));\n } else {\n // Nothing to do. Content will be mounted when connectedCallback is called\n }\n\n return reactRoot;\n });\n }\n\n connectedCallback() {\n this.reactRootPromise = this.reactRootPromise\n .then((reactRoot) => {\n if (reactRoot) {\n // Shouldn't ever happen. connected and disconnected should never be called out of order\n throw new Error(\n `connectedCallback fired when reactRoot is already mounted.`,\n );\n }\n\n // Ensure react root is available before mounting\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n return import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.#reactRootElements.appRootElement),\n );\n })\n .then((reactRoot) => {\n if (!this.#getReactComponent) {\n // getReactComponent hasn't been set yet. Content will be mounted once it's set.\n } else {\n reactRoot.render(this.#getReactComponent(this.#reactRootElements));\n }\n return reactRoot;\n });\n }\n\n disconnectedCallback() {\n this.reactRootPromise = this.reactRootPromise.then((reactRoot) => {\n if (!reactRoot) {\n // Shouldn't ever happen\n throw new Error(\n `disconnectedCallback fired when reactRoot is already unmounted.`,\n );\n }\n\n reactRoot.unmount();\n // Set root to null. We don't want to attempt to render to a root that's already been unmounted.\n return null;\n });\n }\n}\n\n/**\n * Returns a constructed web component which manages it's own shadow dom and react dom roots\n * A custom name can be specified, otherwise a default is provided\n */\nexport const getReactWebComponent = ({\n webComponentName = versionedWebComponentName,\n getReactComponent,\n}: GetReactWebComponentOptions) => {\n // This name hasn't been defined yet. Add a definition for it before constructing one.\n if (!customElements.get(webComponentName)) {\n customElements.define(webComponentName, WebComponentClass);\n }\n\n const element = document.createElement(webComponentName) as InstanceType<\n typeof WebComponentClass\n >;\n // Set selenium attribute so this can be selected\n element.setAttribute(webComponentDataAttributeName, \"\");\n // function used for creating react content\n element.setGetReactComponent(getReactComponent);\n return element;\n};\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nexport type RenderReactInWebComponentProps = {\n /**\n * Optional name given to this web component.\n * Defaults to a 'odyssey-react-wc-' plus the current odyssey version\n */\n webComponentName?: string;\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n} & (\n | {\n /**\n * The React app renders in the web component, but the web component needs to be rendered in the document.\n *\n * This is the element the web component is rendered into.\n */\n webComponentParentElement: HTMLElement;\n webComponentRootElement?: never;\n }\n | {\n webComponentParentElement?: HTMLElement;\n /**\n * @deprecated Use `webComponentParentElement` instead.\n */\n webComponentRootElement: HTMLElement;\n }\n);\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n webComponentName,\n getReactComponent,\n webComponentChildren,\n webComponentParentElement,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = getReactWebComponent({\n getReactComponent,\n webComponentName,\n });\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n if (webComponentParentElement) {\n webComponentParentElement.appendChild(reactElement);\n }\n // Remove this condition when `webComponentRootElement` is no longer a prop.\n else if (webComponentRootElement) {\n webComponentRootElement.appendChild(reactElement);\n }\n\n return reactElement;\n};\n"],"mappings":";;;;;;AAcA,IAAAA,oCAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;AAGsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAO,wBAAAP,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAE,GAAA,CAAAR,CAAA,UAAAM,CAAA,CAAAG,GAAA,CAAAT,CAAA,OAAAU,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAhB,CAAA,oBAAAgB,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAgB,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,CAAA,EAAAgB,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CA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odysseyWebComponentVersionGenerated","_interopRequireDefault","require","_createReactRootElements","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","_interopRequireWildcard","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","webComponentDataAttributeName","exports","versionedWebComponentName","version","toLowerCase","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","WebComponentClass","getReactComponent","reactRootElements","elementName","localName","reactRootPromise","Promise","resolve","constructor","createReactRootElements","appRootElement","stylesRootElement","shadowRoot","attachShadow","mode","appendChild","styleHostElement","document","createElement","setAttribute","window","cspNonce","innerHTML","setGetReactComponent","then","reactRoot","render","connectedCallback","Error","specifier","s","createRoot","disconnectedCallback","unmount","getReactWebComponent","webComponentName","customElements","define","element","renderReactInWebComponent","webComponentChildren","webComponentParentElement","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\nimport version from \"./odysseyWebComponentVersion.generated.js\";\n\nimport {\n createReactRootElements,\n type ReactRootElements,\n} from \"./createReactRootElements.js\";\n\ninterface GetReactWebComponentOptions {\n webComponentName?: string;\n getReactComponent: (reactRootElements: ReactRootElements) => ReactNode;\n}\n\n// Used by selenium when selecting for odyssey web components regardless of their name.\nexport const webComponentDataAttributeName = \"data-odyssey-react-web-component\";\n\n// Unique name to avoid multiple versions of odyssey overwriting each other's implementations\nexport const versionedWebComponentName =\n `odyssey-react-web-component-${version}`.toLowerCase();\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class WebComponentClass extends SsrFriendlyHtmlElementClass {\n #getReactComponent: GetReactComponentInWebComponent | null = null;\n readonly #reactRootElements: ReactRootElements;\n public readonly elementName: string = this.localName;\n // public for testing\n public reactRootPromise: Promise<Root | null> = Promise.resolve(null);\n\n constructor() {\n super();\n\n this.#reactRootElements = createReactRootElements();\n const { appRootElement, stylesRootElement } = this.#reactRootElements;\n\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n shadowRoot.appendChild(stylesRootElement);\n shadowRoot.appendChild(appRootElement);\n\n const styleHostElement = document.createElement(\"style\");\n styleHostElement.setAttribute(\"nonce\", window.cspNonce);\n styleHostElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n stylesRootElement.appendChild(styleHostElement);\n }\n\n /**\n * Provides the function used to initialize react content that is specific to this instance\n * of the web component, which is used later in the connectedCallback.\n *\n * Always set immediately after creation via document.createElement\n */\n setGetReactComponent(getReactComponent: GetReactComponentInWebComponent) {\n this.reactRootPromise = this.reactRootPromise.then((reactRoot) => {\n this.#getReactComponent = getReactComponent;\n if (reactRoot) {\n // connectedCallback has already been fired. Need to mount this content to the existing root\n reactRoot.render(this.#getReactComponent(this.#reactRootElements));\n } else {\n // Nothing to do. Content will be mounted when connectedCallback is called\n }\n\n return reactRoot;\n });\n }\n\n connectedCallback() {\n this.reactRootPromise = this.reactRootPromise\n .then((reactRoot) => {\n if (reactRoot) {\n // Shouldn't ever happen. connected and disconnected should never be called out of order\n throw new Error(\n `connectedCallback fired when reactRoot is already mounted.`,\n );\n }\n\n // Ensure react root is available before mounting\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n return import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.#reactRootElements.appRootElement),\n );\n })\n .then((reactRoot) => {\n if (!this.#getReactComponent) {\n // getReactComponent hasn't been set yet. Content will be mounted once it's set.\n } else {\n reactRoot.render(this.#getReactComponent(this.#reactRootElements));\n }\n return reactRoot;\n });\n }\n\n disconnectedCallback() {\n this.reactRootPromise = this.reactRootPromise.then((reactRoot) => {\n if (!reactRoot) {\n // Shouldn't ever happen\n throw new Error(\n `disconnectedCallback fired when reactRoot is already unmounted.`,\n );\n }\n\n reactRoot.unmount();\n // Set root to null. We don't want to attempt to render to a root that's already been unmounted.\n return null;\n });\n }\n}\n\n/**\n * Returns a constructed web component which manages it's own shadow dom and react dom roots\n * A custom name can be specified, otherwise a default is provided\n */\nexport const getReactWebComponent = ({\n webComponentName = versionedWebComponentName,\n getReactComponent,\n}: GetReactWebComponentOptions) => {\n // This name hasn't been defined yet. Add a definition for it before constructing one.\n if (!customElements.get(webComponentName)) {\n customElements.define(webComponentName, WebComponentClass);\n }\n\n const element = document.createElement(webComponentName) as InstanceType<\n typeof WebComponentClass\n >;\n // Set selenium attribute so this can be selected\n element.setAttribute(webComponentDataAttributeName, \"\");\n // function used for creating react content\n element.setGetReactComponent(getReactComponent);\n return element;\n};\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nexport type RenderReactInWebComponentProps = {\n /**\n * Optional name given to this web component.\n * Defaults to a 'odyssey-react-wc-' plus the current odyssey version\n */\n webComponentName?: string;\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n} & (\n | {\n /**\n * The React app renders in the web component, but the web component needs to be rendered in the document.\n *\n * This is the element the web component is rendered into.\n */\n webComponentParentElement: HTMLElement;\n webComponentRootElement?: never;\n }\n | {\n webComponentParentElement?: HTMLElement;\n /**\n * @deprecated Use `webComponentParentElement` instead.\n */\n webComponentRootElement: HTMLElement;\n }\n);\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n webComponentName,\n getReactComponent,\n webComponentChildren,\n webComponentParentElement,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = getReactWebComponent({\n getReactComponent,\n webComponentName,\n });\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n if (webComponentParentElement) {\n webComponentParentElement.appendChild(reactElement);\n }\n // Remove this condition when `webComponentRootElement` is no longer a prop.\n else if (webComponentRootElement) {\n webComponentRootElement.appendChild(reactElement);\n }\n\n return reactElement;\n};\n"],"mappings":";;;;;;AAcA,IAAAA,oCAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;AAGsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAO,wB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GA,CAAC;EACxCJ,gBAAgB;EAChBlC,iBAAiB;EACjBuC,oBAAoB;EACpBC,yBAAyB;EACzBC;AAC8B,CAAC,KAAK;EACpC,MAAMC,YAAY,GAAGT,oBAAoB,CAAC;IACxCjC,iBAAiB;IACjBkC;EACF,CAAC,CAAC;EAEF,IAAIK,oBAAoB,EAAE;IACxB,CAACI,KAAK,CAACC,OAAO,CAACL,oBAAoB,CAAC,GAChCA,oBAAoB,GACpB,CAACA,oBAAoB,CAAC,EACxBM,OAAO,CAAEC,iBAAiB,IAAK;MAC/BJ,YAAY,CAAC5B,WAAW,CAACgC,iBAAiB,CAAC;IAC7C,CAAC,CAAC;EACJ;EAEA,IAAIN,yBAAyB,EAAE;IAC7BA,yBAAyB,CAAC1B,WAAW,CAAC4B,YAAY,CAAC;EACrD,CAAC,MAEI,IAAID,uBAAuB,EAAE;IAChCA,uBAAuB,CAAC3B,WAAW,CAAC4B,YAAY,CAAC;EACnD;EAEA,OAAOA,YAAY;AACrB,CAAC;AAAClD,OAAA,CAAA8C,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","names":["styled","memo","useCallback","useEffect","useMemo","useRef","useState","useTranslation","Box","Button","ArrowLeftIcon","ArrowRightIcon","useOdysseyDesignTokens","usePagination","Paragraph","jsx","_jsx","jsxs","_jsxs","PaginationContainer","display","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","alignItems","gap","Spacing4","Spacing2","PaginationInput","_InputBase","borderColor","HueNeutral200","borderRadius","BorderRadiusTight","height","Spacing6","width","HueNeutral400","PalettePrimaryMain","PaginationButtonContainer","marginInlineStart","Pagination","currentPageLabel","currentPageLabelProp","currentRowsCount","hasPageInput","hasRowCountInput","hasRowCountLabel","isDisabled","isMoreDisabled","lastRow","loadMoreLabel","loadMoreLabelProp","maxPageIndex","maxPageSize","nextLabel","nextLabelProp","onPaginationChange","onPaginationChangeProp","pageIndex","pageSize","previousLabel","previousLabelProp","rowsPerPageLabel","rowsPerPageLabelProp","totalRows","variant","t","page","setPage","rowsPerPage","setRowsPerPage","initialRowsPerPage","totalRowsLabel","handlePaginationChange","updatedPage","updatedRowsPerPage","Math","ceil","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","children","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","startIcon","size","ariaLabel","onClick","endIcon","label","MemoizedPagination","displayName"],"sources":["../../../src/Pagination/Pagination.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-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 { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Box } from \"../Box.js\";\nimport { Button } from \"../Buttons/index.js\";\nimport { paginationTypeValues } from \"./constants.js\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated/index.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { usePagination } from \"./usePagination.js\";\nimport { Paragraph } from \"../Typography.js\";\n\nconst PaginationContainer = styled(\"nav\")({\n display: \"flex\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing4,\n \"& > div\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing2,\n },\n}));\n\nconst PaginationInput = styled(InputBase, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n borderColor: odysseyDesignTokens.HueNeutral200,\n borderRadius: odysseyDesignTokens.BorderRadiusTight,\n height: odysseyDesignTokens.Spacing6,\n width: \"4.5714285714rem\", // This is a hardcoded value, keep as string\n \"&:hover\": {\n borderColor: odysseyDesignTokens.HueNeutral400,\n },\n \"&.Mui-focused:hover\": {\n borderColor: odysseyDesignTokens.PalettePrimaryMain,\n },\n}));\n\nconst PaginationButtonContainer = styled(\"div\")({\n \"& > *\": {\n marginInlineStart: `0 !important`,\n },\n});\n\nexport type PaginationProps = {\n /**\n * The labeled rendered for the current page index\n */\n currentPageLabel?: string;\n /**\n * The number of items currently visible on the page\n */\n currentRowsCount?: number;\n /**\n * If true, the page input will be visible and the user can directly manipulate which page\n * is visible.\n */\n hasPageInput?: boolean;\n /**\n * If true, the row count input will be visible and the user can directly manipulate how many rows\n * are visible.\n */\n hasRowCountInput?: boolean;\n /**\n * If true, the \"X - X of total X\" label will be visible\n */\n hasRowCountLabel?: boolean;\n /**\n * If true, the pagination controls will be disabled\n */\n isDisabled?: boolean;\n /**\n * If true, the next or Show More button will be disabled\n */\n isMoreDisabled?: boolean;\n /**\n * The current page last row index\n */\n lastRow?: number;\n /**\n * If the pagination is of \"loadMore\" variant, then this is the the load more label\n */\n loadMoreLabel?: string;\n /**\n * The max page\n */\n maxPageIndex?: number;\n /**\n * The max rows per page\n */\n maxPageSize?: number;\n /**\n * The label for the next control\n */\n nextLabel?: string;\n /**\n * Page index and page size setter\n */\n onPaginationChange: ({\n pageIndex,\n pageSize,\n }: {\n pageIndex: number;\n pageSize: number;\n }) => void;\n /**\n * The current page index\n */\n pageIndex: number;\n /**\n * The current page size\n */\n pageSize: number;\n /**\n * The label for the previous control\n */\n previousLabel?: string;\n /**\n * The label that shows how many results are rendered per page\n */\n rowsPerPageLabel?: string;\n /**\n * Total rows count\n */\n totalRows?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n variant?: (typeof paginationTypeValues)[number];\n};\n\nconst Pagination = ({\n currentPageLabel: currentPageLabelProp,\n currentRowsCount,\n hasPageInput = true,\n hasRowCountInput = true,\n hasRowCountLabel = true,\n isDisabled,\n isMoreDisabled,\n lastRow,\n loadMoreLabel: loadMoreLabelProp,\n maxPageIndex,\n maxPageSize,\n nextLabel: nextLabelProp,\n onPaginationChange: onPaginationChangeProp,\n pageIndex,\n pageSize,\n previousLabel: previousLabelProp,\n rowsPerPageLabel: rowsPerPageLabelProp,\n totalRows,\n variant,\n}: PaginationProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const [page, setPage] = useState<number>(pageIndex);\n const [rowsPerPage, setRowsPerPage] = useState<number>(pageSize);\n const initialRowsPerPage = useRef<number>(pageSize);\n\n const currentPageLabel = currentPageLabelProp ?? t(\"pagination.page\");\n const loadMoreLabel = loadMoreLabelProp ?? t(\"pagination.loadmore\");\n const nextLabel = nextLabelProp ?? t(\"pagination.next\");\n const previousLabel = previousLabelProp ?? t(\"pagination.previous\");\n const rowsPerPageLabel = rowsPerPageLabelProp ?? t(\"pagination.rowsperpage\");\n\n useEffect(() => {\n setPage(pageIndex);\n setRowsPerPage(pageSize);\n }, [pageIndex, pageSize]);\n\n const onPaginationChange = useCallback(\n ({ pageIndex, pageSize }: { pageIndex: number; pageSize: number }) => {\n onPaginationChangeProp({ pageIndex, pageSize });\n },\n [onPaginationChangeProp],\n );\n\n const { totalRowsLabel } = usePagination({\n pageIndex,\n pageSize,\n currentRowsCount: currentRowsCount || pageSize,\n totalRows,\n });\n\n const handlePaginationChange = useCallback(() => {\n let updatedPage = page;\n let updatedRowsPerPage = rowsPerPage;\n\n if (totalRows) {\n const maxPageIndex = Math.ceil(totalRows / updatedRowsPerPage);\n\n // Ensure rowsPerPage does not exceed totalRows\n if (updatedRowsPerPage > totalRows) {\n updatedRowsPerPage = totalRows;\n }\n\n // Ensure page is within valid range\n if (updatedPage > maxPageIndex) {\n updatedPage = maxPageIndex;\n } else if (updatedPage < 1) {\n updatedPage = 1;\n }\n }\n\n onPaginationChange({\n pageIndex: updatedPage,\n pageSize: updatedRowsPerPage,\n });\n }, [page, rowsPerPage, onPaginationChange, totalRows]);\n\n // The following handlers use React.KeyboardEvent (rather than just KeyboardEvent) becuase React.KeyboardEvent\n // is generic, while plain KeyboardEvent is not. We need this generic so we can specify the HTMLInputElement,\n // which allows us to use currentTarget.value\n const handlePageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: parseInt(event.currentTarget.value),\n pageSize: rowsPerPage,\n });\n }\n },\n [rowsPerPage, onPaginationChange],\n );\n\n const handleRowsPerPageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: page,\n pageSize: parseInt(event.currentTarget.value),\n });\n }\n },\n [page, onPaginationChange],\n );\n\n const setPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageIndex\n ? Math.min(parseInt(event.target.value), maxPageIndex)\n : parseInt(event.target.value);\n setPage(value);\n },\n [setPage, maxPageIndex],\n );\n\n const setRowsPerPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageSize\n ? Math.min(parseInt(event.target.value), maxPageSize)\n : parseInt(event.target.value);\n\n // Ensure the value can't be less than 1\n setRowsPerPage(Math.max(1, value));\n },\n [setRowsPerPage, maxPageSize],\n );\n\n const handleLoadMore = useCallback(() => {\n onPaginationChange({\n pageIndex: 1,\n pageSize: rowsPerPage + initialRowsPerPage.current,\n });\n }, [rowsPerPage, onPaginationChange]);\n\n const handleNextButton = useCallback(() => {\n onPaginationChange({ pageIndex: page + 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const handlePreviousButton = useCallback(() => {\n onPaginationChange({ pageIndex: page - 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const loadMoreIsDisabled = useMemo(() => {\n return isMoreDisabled || (totalRows ? rowsPerPage >= totalRows : false);\n }, [isMoreDisabled, rowsPerPage, totalRows]);\n\n const nextButtonDisabled = useMemo(\n () =>\n isMoreDisabled ||\n (lastRow && (totalRows ? lastRow >= totalRows : false)) ||\n isDisabled,\n [isMoreDisabled, totalRows, lastRow, isDisabled],\n );\n\n const previousButtonDisabled = useMemo(\n () => pageIndex <= 1 || isDisabled,\n [pageIndex, isDisabled],\n );\n\n const rowsPerPageInputProps = useMemo(\n () => ({\n \"aria-label\": rowsPerPageLabel,\n max: maxPageSize || totalRows,\n }),\n [maxPageSize, rowsPerPageLabel, totalRows],\n );\n\n const currentPageInputProps = useMemo(\n () => ({\n \"aria-label\": currentPageLabel,\n max: maxPageIndex,\n }),\n [currentPageLabel, maxPageIndex],\n );\n\n return variant === \"paged\" ? (\n <PaginationContainer aria-label={t(\"pagination.label\")}>\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {hasRowCountInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {rowsPerPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={rowsPerPage}\n onChange={setRowsPerPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handleRowsPerPageSubmit}\n disabled={isDisabled}\n inputProps={rowsPerPageInputProps}\n />\n </Box>\n )}\n {hasRowCountLabel && (\n <Paragraph component=\"span\" color=\"textSecondary\">\n {totalRowsLabel}\n </Paragraph>\n )}\n </PaginationSegment>\n\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {totalRows && hasPageInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {currentPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={page}\n onChange={setPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handlePageSubmit}\n disabled={isDisabled}\n inputProps={currentPageInputProps}\n />\n </Box>\n )}\n <PaginationButtonContainer>\n <Button\n startIcon={<ArrowLeftIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={previousLabel}\n onClick={handlePreviousButton}\n isDisabled={previousButtonDisabled}\n />\n <Button\n endIcon={<ArrowRightIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={nextLabel}\n onClick={handleNextButton}\n isDisabled={nextButtonDisabled}\n />\n </PaginationButtonContainer>\n </PaginationSegment>\n </PaginationContainer>\n ) : (\n <Button\n variant=\"secondary\"\n label={loadMoreLabel}\n onClick={handleLoadMore}\n isDisabled={loadMoreIsDisabled}\n />\n );\n};\n\nconst MemoizedPagination = memo(Pagination);\nMemoizedPagination.displayName = \"Pagination\";\n\nexport { MemoizedPagination as Pagination };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAASC,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SAASC,cAAc,QAAQ,eAAe;AAE9C,SAASC,GAAG,QAAQ,WAAW;AAC/B,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,SAASC,aAAa,EAAEC,cAAc,QAAQ,6BAA6B;AAC3E,SAE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agination.js","names":["styled","memo","useCallback","useEffect","useMemo","useRef","useState","useTranslation","Box","Button","ArrowLeftIcon","ArrowRightIcon","useOdysseyDesignTokens","usePagination","Paragraph","jsx","_jsx","jsxs","_jsxs","PaginationContainer","display","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","alignItems","gap","Spacing4","Spacing2","PaginationInput","_InputBase","borderColor","HueNeutral200","borderRadius","BorderRadiusTight","height","Spacing6","width","HueNeutral400","PalettePrimaryMain","PaginationButtonContainer","marginInlineStart","Pagination","currentPageLabel","currentPageLabelProp","currentRowsCount","hasPageInput","hasRowCountInput","hasRowCountLabel","isDisabled","isMoreDisabled","lastRow","loadMoreLabel","loadMoreLabelProp","maxPageIndex","maxPageSize","nextLabel","nextLabelProp","onPaginationChange","onPaginationChangeProp","pageIndex","pageSize","previousLabel","previousLabelProp","rowsPerPageLabel","rowsPerPageLabelProp","totalRows","variant","t","page","setPage","rowsPerPage","setRowsPerPage","initialRowsPerPage","totalRowsLabel","handlePaginationChange","updatedPage","updatedRowsPerPage","Math","ceil","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","children","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","startIcon","size","ariaLabel","onClick","endIcon","label","MemoizedPagination","displayName"],"sources":["../../../src/Pagination/Pagination.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-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 { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Box } from \"../Box.js\";\nimport { Button } from \"../Buttons/index.js\";\nimport { paginationTypeValues } from \"./constants.js\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated/index.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { usePagination } from \"./usePagination.js\";\nimport { Paragraph } from \"../Typography.js\";\n\nconst PaginationContainer = styled(\"nav\")({\n display: \"flex\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing4,\n \"& > div\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing2,\n },\n}));\n\nconst PaginationInput = styled(InputBase, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n borderColor: odysseyDesignTokens.HueNeutral200,\n borderRadius: odysseyDesignTokens.BorderRadiusTight,\n height: odysseyDesignTokens.Spacing6,\n width: \"4.5714285714rem\", // This is a hardcoded value, keep as string\n \"&:hover\": {\n borderColor: odysseyDesignTokens.HueNeutral400,\n },\n \"&.Mui-focused:hover\": {\n borderColor: odysseyDesignTokens.PalettePrimaryMain,\n },\n}));\n\nconst PaginationButtonContainer = styled(\"div\")({\n \"& > *\": {\n marginInlineStart: `0 !important`,\n },\n});\n\nexport type PaginationProps = {\n /**\n * The labeled rendered for the current page index\n */\n currentPageLabel?: string;\n /**\n * The number of items currently visible on the page\n */\n currentRowsCount?: number;\n /**\n * If true, the page input will be visible and the user can directly manipulate which page\n * is visible.\n */\n hasPageInput?: boolean;\n /**\n * If true, the row count input will be visible and the user can directly manipulate how many rows\n * are visible.\n */\n hasRowCountInput?: boolean;\n /**\n * If true, the \"X - X of total X\" label will be visible\n */\n hasRowCountLabel?: boolean;\n /**\n * If true, the pagination controls will be disabled\n */\n isDisabled?: boolean;\n /**\n * If true, the next or Show More button will be disabled\n */\n isMoreDisabled?: boolean;\n /**\n * The current page last row index\n */\n lastRow?: number;\n /**\n * If the pagination is of \"loadMore\" variant, then this is the the load more label\n */\n loadMoreLabel?: string;\n /**\n * The max page\n */\n maxPageIndex?: number;\n /**\n * The max rows per page\n */\n maxPageSize?: number;\n /**\n * The label for the next control\n */\n nextLabel?: string;\n /**\n * Page index and page size setter\n */\n onPaginationChange: ({\n pageIndex,\n pageSize,\n }: {\n pageIndex: number;\n pageSize: number;\n }) => void;\n /**\n * The current page index\n */\n pageIndex: number;\n /**\n * The current page size\n */\n pageSize: number;\n /**\n * The label for the previous control\n */\n previousLabel?: string;\n /**\n * The label that shows how many results are rendered per page\n */\n rowsPerPageLabel?: string;\n /**\n * Total rows count\n */\n totalRows?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n variant?: (typeof paginationTypeValues)[number];\n};\n\nconst Pagination = ({\n currentPageLabel: currentPageLabelProp,\n currentRowsCount,\n hasPageInput = true,\n hasRowCountInput = true,\n hasRowCountLabel = true,\n isDisabled,\n isMoreDisabled,\n lastRow,\n loadMoreLabel: loadMoreLabelProp,\n maxPageIndex,\n maxPageSize,\n nextLabel: nextLabelProp,\n onPaginationChange: onPaginationChangeProp,\n pageIndex,\n pageSize,\n previousLabel: previousLabelProp,\n rowsPerPageLabel: rowsPerPageLabelProp,\n totalRows,\n variant,\n}: PaginationProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const [page, setPage] = useState<number>(pageIndex);\n const [rowsPerPage, setRowsPerPage] = useState<number>(pageSize);\n const initialRowsPerPage = useRef<number>(pageSize);\n\n const currentPageLabel = currentPageLabelProp ?? t(\"pagination.page\");\n const loadMoreLabel = loadMoreLabelProp ?? t(\"pagination.loadmore\");\n const nextLabel = nextLabelProp ?? t(\"pagination.next\");\n const previousLabel = previousLabelProp ?? t(\"pagination.previous\");\n const rowsPerPageLabel = rowsPerPageLabelProp ?? t(\"pagination.rowsperpage\");\n\n useEffect(() => {\n setPage(pageIndex);\n setRowsPerPage(pageSize);\n }, [pageIndex, pageSize]);\n\n const onPaginationChange = useCallback(\n ({ pageIndex, pageSize }: { pageIndex: number; pageSize: number }) => {\n onPaginationChangeProp({ pageIndex, pageSize });\n },\n [onPaginationChangeProp],\n );\n\n const { totalRowsLabel } = usePagination({\n pageIndex,\n pageSize,\n currentRowsCount: currentRowsCount || 0,\n totalRows,\n });\n\n const handlePaginationChange = useCallback(() => {\n let updatedPage = page;\n let updatedRowsPerPage = rowsPerPage;\n\n if (totalRows) {\n const maxPageIndex = Math.ceil(totalRows / updatedRowsPerPage);\n\n // Ensure rowsPerPage does not exceed totalRows\n if (updatedRowsPerPage > totalRows) {\n updatedRowsPerPage = totalRows;\n }\n\n // Ensure page is within valid range\n if (updatedPage > maxPageIndex) {\n updatedPage = maxPageIndex;\n } else if (updatedPage < 1) {\n updatedPage = 1;\n }\n }\n\n onPaginationChange({\n pageIndex: updatedPage,\n pageSize: updatedRowsPerPage,\n });\n }, [page, rowsPerPage, onPaginationChange, totalRows]);\n\n // The following handlers use React.KeyboardEvent (rather than just KeyboardEvent) becuase React.KeyboardEvent\n // is generic, while plain KeyboardEvent is not. We need this generic so we can specify the HTMLInputElement,\n // which allows us to use currentTarget.value\n const handlePageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: parseInt(event.currentTarget.value),\n pageSize: rowsPerPage,\n });\n }\n },\n [rowsPerPage, onPaginationChange],\n );\n\n const handleRowsPerPageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: page,\n pageSize: parseInt(event.currentTarget.value),\n });\n }\n },\n [page, onPaginationChange],\n );\n\n const setPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageIndex\n ? Math.min(parseInt(event.target.value), maxPageIndex)\n : parseInt(event.target.value);\n setPage(value);\n },\n [setPage, maxPageIndex],\n );\n\n const setRowsPerPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageSize\n ? Math.min(parseInt(event.target.value), maxPageSize)\n : parseInt(event.target.value);\n\n // Ensure the value can't be less than 1\n setRowsPerPage(Math.max(1, value));\n },\n [setRowsPerPage, maxPageSize],\n );\n\n const handleLoadMore = useCallback(() => {\n onPaginationChange({\n pageIndex: 1,\n pageSize: rowsPerPage + initialRowsPerPage.current,\n });\n }, [rowsPerPage, onPaginationChange]);\n\n const handleNextButton = useCallback(() => {\n onPaginationChange({ pageIndex: page + 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const handlePreviousButton = useCallback(() => {\n onPaginationChange({ pageIndex: page - 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const loadMoreIsDisabled = useMemo(() => {\n return isMoreDisabled || (totalRows ? rowsPerPage >= totalRows : false);\n }, [isMoreDisabled, rowsPerPage, totalRows]);\n\n const nextButtonDisabled = useMemo(\n () =>\n isMoreDisabled ||\n (lastRow && (totalRows ? lastRow >= totalRows : false)) ||\n isDisabled,\n [isMoreDisabled, totalRows, lastRow, isDisabled],\n );\n\n const previousButtonDisabled = useMemo(\n () => pageIndex <= 1 || isDisabled,\n [pageIndex, isDisabled],\n );\n\n const rowsPerPageInputProps = useMemo(\n () => ({\n \"aria-label\": rowsPerPageLabel,\n max: maxPageSize || totalRows,\n }),\n [maxPageSize, rowsPerPageLabel, totalRows],\n );\n\n const currentPageInputProps = useMemo(\n () => ({\n \"aria-label\": currentPageLabel,\n max: maxPageIndex,\n }),\n [currentPageLabel, maxPageIndex],\n );\n\n return variant === \"paged\" ? (\n <PaginationContainer aria-label={t(\"pagination.label\")}>\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {hasRowCountInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {rowsPerPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={rowsPerPage}\n onChange={setRowsPerPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handleRowsPerPageSubmit}\n disabled={isDisabled}\n inputProps={rowsPerPageInputProps}\n />\n </Box>\n )}\n {hasRowCountLabel && (\n <Paragraph component=\"span\" color=\"textSecondary\">\n {totalRowsLabel}\n </Paragraph>\n )}\n </PaginationSegment>\n\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {totalRows && hasPageInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {currentPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={page}\n onChange={setPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handlePageSubmit}\n disabled={isDisabled}\n inputProps={currentPageInputProps}\n />\n </Box>\n )}\n <PaginationButtonContainer>\n <Button\n startIcon={<ArrowLeftIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={previousLabel}\n onClick={handlePreviousButton}\n isDisabled={previousButtonDisabled}\n />\n <Button\n endIcon={<ArrowRightIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={nextLabel}\n onClick={handleNextButton}\n isDisabled={nextButtonDisabled}\n />\n </PaginationButtonContainer>\n </PaginationSegment>\n </PaginationContainer>\n ) : (\n <Button\n variant=\"secondary\"\n label={loadMoreLabel}\n onClick={handleLoadMore}\n isDisabled={loadMoreIsDisabled}\n />\n );\n};\n\nconst MemoizedPagination = memo(Pagination);\nMemoizedPagination.displayName = \"Pagination\";\n\nexport { MemoizedPagination as Pagination };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AAEpC,SAASC,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SAASC,cAAc,QAAQ,eAAe;AAE9C,SAASC,GAAG,QAAQ,WAAW;AAC/B,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,SAASC,aAAa,EAAEC,cAAc,QAAQ,6BAA6B;AAC3E,SAEEC,sBAAsB,QACjB,kCAAkC;AACzC,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,mBAAmB,GAAGnB,MAAM,CAAC,KAAK,CAAC,CAAC;EACxCoB,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAGtB,MAAM,CAAC,KAAK,EAAE;EACtCuB,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAwC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EACtEL,OAAO,EAAE,MAAM;EACfM,UAAU,EAAE,QAAQ;EACpBC,GAAG,EAAEF,mBAAmB,CAACG,QAAQ;EACjC,SAAS,EAAE;IACTR,OAAO,EAAE,MAAM;IACfM,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAEF,mBAAmB,CAACI;EAC3B;AACF,CAAC,CAAC,CAAC;AAEH,MAAMC,eAAe,GAAG9B,MAAM,CAAA+B,UAAA,EAAY;EACxCR,iBAA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I,EAAC,OAAO;UACZC,SAAS,EAAExD,SAAU;UACrByD,OAAO,EAAEnB,gBAAiB;UAC1B7C,UAAU,EAAEgD;QAAmB,CAChC,CAAC;MAAA,CACuB,CAAC;IAAA,CACX,CAAC;EAAA,CACD,CAAC,GAEtBlF,IAAA,CAACP,MAAM;IACL2D,OAAO,EAAC,WAAW;IACnBgD,KAAK,EAAE/D,aAAc;IACrB6D,OAAO,EAAErB,cAAe;IACxB3C,UAAU,EAAE+C;EAAmB,CAChC,CACF;AACH,CAAC;AAED,MAAMoB,kBAAkB,GAAGpH,IAAI,CAAC0C,UAAU,CAAC;AAC3C0E,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAI1E,UAAU","ignoreList":[]}
|
|
@@ -24,7 +24,9 @@ export const usePagination = ({
|
|
|
24
24
|
return useMemo(() => {
|
|
25
25
|
const firstRow = pageSize * (pageIndex - 1) + 1;
|
|
26
26
|
const lastRow = firstRow + (currentRowsCount - 1);
|
|
27
|
-
const totalRowsLabel =
|
|
27
|
+
const totalRowsLabel = currentRowsCount === 0 ? t("pagination.totalrows", {
|
|
28
|
+
totalRows: 0
|
|
29
|
+
}) : totalRows ? t("pagination.rowswithtotal", {
|
|
28
30
|
firstRow,
|
|
29
31
|
lastRow,
|
|
30
32
|
totalRows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.js","names":["useTranslation","useMemo","usePagination","currentRowsCount","pageIndex","pageSize","totalRows","t","firstRow","lastRow","totalRowsLabel"],"sources":["../../../src/Pagination/usePagination.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport { useMemo } from \"react\";\n\ntype UsePaginationType = {\n currentRowsCount: number;\n pageIndex: number;\n pageSize: number;\n totalRows?: number;\n};\n\nexport const usePagination = ({\n currentRowsCount,\n pageIndex,\n pageSize,\n totalRows,\n}: UsePaginationType) => {\n const { t } = useTranslation();\n\n return useMemo(() => {\n const firstRow = pageSize * (pageIndex - 1) + 1;\n const lastRow = firstRow + (currentRowsCount - 1);\n\n const totalRowsLabel
|
|
1
|
+
{"version":3,"file":"usePagination.js","names":["useTranslation","useMemo","usePagination","currentRowsCount","pageIndex","pageSize","totalRows","t","firstRow","lastRow","totalRowsLabel"],"sources":["../../../src/Pagination/usePagination.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport { useMemo } from \"react\";\n\ntype UsePaginationType = {\n currentRowsCount: number;\n pageIndex: number;\n pageSize: number;\n totalRows?: number;\n};\n\nexport const usePagination = ({\n currentRowsCount,\n pageIndex,\n pageSize,\n totalRows,\n}: UsePaginationType) => {\n const { t } = useTranslation();\n\n return useMemo(() => {\n const firstRow = pageSize * (pageIndex - 1) + 1;\n const lastRow = firstRow + (currentRowsCount - 1);\n\n const totalRowsLabel =\n currentRowsCount === 0\n ? t(\"pagination.totalrows\", { totalRows: 0 })\n : totalRows\n ? t(\"pagination.rowswithtotal\", { firstRow, lastRow, totalRows })\n : t(\"pagination.rowswithouttotal\", { firstRow, lastRow });\n\n return {\n firstRow,\n lastRow,\n totalRowsLabel,\n };\n }, [currentRowsCount, pageIndex, pageSize, totalRows, t]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,OAAO,QAAQ,OAAO;AAS/B,OAAO,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,gBAAgB;EAChBC,SAAS;EACTC,QAAQ;EACRC;AACiB,CAAC,KAAK;EACvB,MAAM;IAAEC;EAAE,CAAC,GAAGP,cAAc,CAAC,CAAC;EAE9B,OAAOC,OAAO,CAAC,MAAM;IACnB,MAAMO,QAAQ,GAAGH,QAAQ,IAAID,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC;IAC/C,MAAMK,OAAO,GAAGD,QAAQ,IAAIL,gBAAgB,GAAG,CAAC,CAAC;IAEjD,MAAMO,cAAc,GAClBP,gBAAgB,KAAK,CAAC,GAClBI,CAAC,CAAC,sBAAsB,EAAE;MAAED,SAAS,EAAE;IAAE,CAAC,CAAC,GAC3CA,SAAS,GACPC,CAAC,CAAC,0BAA0B,EAAE;MAAEC,QAAQ;MAAEC,OAAO;MAAEH;IAAU,CAAC,CAAC,GAC/DC,CAAC,CAAC,6BAA6B,EAAE;MAAEC,QAAQ;MAAEC;IAAQ,CAAC,CAAC;IAE/D,OAAO;MACLD,QAAQ;MACRC,OAAO;MACPC;IACF,CAAC;EACH,CAAC,EAAE,CAACP,gBAAgB,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,CAAC,CAAC,CAAC;AAC3D,CAAC","ignoreList":[]}
|
|
@@ -146,9 +146,9 @@ const TableLayoutContent = ({
|
|
|
146
146
|
state: {
|
|
147
147
|
sorting: tableState.columnSorting,
|
|
148
148
|
columnVisibility: tableState.columnVisibility,
|
|
149
|
-
isLoading
|
|
150
|
-
rowSelection
|
|
151
|
-
columnOrder
|
|
149
|
+
isLoading,
|
|
150
|
+
rowSelection,
|
|
151
|
+
columnOrder
|
|
152
152
|
},
|
|
153
153
|
icons: {
|
|
154
154
|
ArrowDownwardIcon: ArrowDownIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayoutContent.js","names":["memo","useCallback","useMemo","useRef","useState","useEffect","styled","MRT_TableContainer","useMaterialReactTable","useTranslation","ArrowDownIcon","ArrowUnsortedIcon","ChevronDownIcon","DragIndicatorIcon","MoreIcon","Box","Button","MenuButton","dataTableImmutableSettings","displayColumnDefOptions","ScrollableTableContainer","RowActions","useOdysseyDesignTokens","useScrollIndication","jsx","_jsx","jsxs","_jsxs","TextWrapper","whiteSpace","textOverflow","overflow","RowActionsContainer","display","TableLayoutContent","columns","data","draggingRow","emptyState","enableVirtualization","getRowId","hasRowReordering","hasRowSelection","isEmpty","isLoading","isNoResults","isRowReorderingDisabled","onReorderRows","pagination","rowReorderingUtilities","rowSelection","setRowSelection","setTableState","tableLayoutOptions","tableState","totalRows","isTableContainerScrolledToStart","setIsTableContainerScrolledToStart","isTableContainerScrolledToEnd","setIsTableContainerScrolledToEnd","tableInnerContainerWidth","setTableInnerContainerWidth","shouldUpdateScroll","tableOuterContainerRef","tableInnerContainerRef","tableContentRef","tableInnerContainer","current","tableOuterContainer","odysseyDesignTokens","t","columnIds","map","column","accessorKey","columnOrder","filter","id","rowDensityClassName","rowDensity","defaultCell","cell","value","getValue","hasTextWrapping","columnDef","enableWrapping","children","draggableTableBodyRowClassName","dragHandleStyles","dragHandleText","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","renderRowActions","row","currentIndex","index","pageIndex","pageSize","rowActionButtons","rowActionMenuItems","ariaLabel","buttonVariant","endIcon","menuAlignment","size","rowIndex","undefined","innerWidthStyle","width","emptyStateContainer","sx","scrollTo","clientHeight","shouldDisplayRowActions","hasColumnWithGrow","some","grow","dataTable","state","sorting","columnSorting","columnVisibility","icons","ArrowDownwardIcon","DragHandleIcon","SyncAltIcon","ExpandMoreIcon","header","muiTableBodyCellProps","align","className","muiTableHeadCellProps","visibility","variant","isDisabled","muiTableProps","ref","hasColumnResizing","muiTableContainerProps","muiTableBodyProps","tabIndex","height","enableColumnResizing","defaultColumn","Cell","enableRowActions","enableRowOrdering","Boolean","enableRowDragging","muiDetailPanelProps","paddingBlock","getIsExpanded","Spacing3","muiTableBodyRowProps","table","isDetailPanel","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","border","backgroundColor","HueNeutralWhite","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","disabled","renderDetailPanel","enableRowVirtualization","currentColumn","find","sortedColumn","getIsResizing","enableSorting","hasSorting","onSortingChange","sortingUpdater","newSortVal","prevState","enableRowSelection","onRowSelectionChange","renderEmptyRowsFallback","localization","collapse","collapseAll","expand","expandAll","isScrollableEnd","isScrollableStart","MemoizedTableLayoutContent","displayName"],"sources":["../../../../src/labs/DataView/TableLayoutContent.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 {\n SetStateAction,\n memo,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n Dispatch,\n ReactElement,\n useEffect,\n} from \"react\";\nimport styled, { CSSObject } from \"@emotion/styled\";\nimport {\n MRT_Row,\n MRT_RowData,\n MRT_RowSelectionState,\n MRT_TableContainer,\n MRT_TableInstance,\n MRT_TableOptions,\n useMaterialReactTable,\n} from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n ChevronDownIcon,\n DragIndicatorIcon,\n MoreIcon,\n} from \"../../icons.generated/index.js\";\nimport { Box } from \"../../Box.js\";\nimport { Button, MenuButton } from \"../../Buttons/index.js\";\nimport {\n TableLayoutProps,\n TableState,\n UniversalProps,\n} from \"./componentTypes.js\";\nimport { DataTableCell } from \"./dataTypes.js\";\nimport {\n dataTableImmutableSettings,\n displayColumnDefOptions,\n ScrollableTableContainer,\n} from \"./tableConstants.js\";\nimport { RowActions } from \"./RowActions.js\";\nimport { useOdysseyDesignTokens } from \"../../OdysseyDesignTokensContext.js\";\nimport { useScrollIndication } from \"../../DataTable/useScrollIndication.js\";\n\nconst TextWrapper = styled(\"div\")({\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n});\n\nconst RowActionsContainer = styled(\"div\")({\n display: \"flex\",\n});\n\nexport type TableLayoutContentProps<TData extends MRT_RowData> = {\n columns: TableLayoutProps<TData>[\"columns\"];\n data: MRT_RowData[];\n draggingRow?: MRT_Row<TData> | null;\n emptyState: ReactNode;\n enableVirtualization?: boolean;\n getRowId: UniversalProps<TData>[\"getRowId\"];\n hasRowReordering: UniversalProps<TData>[\"hasRowReordering\"];\n hasRowSelection: UniversalProps<TData>[\"hasRowSelection\"];\n isEmpty?: boolean;\n isLoading: boolean;\n isNoResults?: boolean;\n isRowReorderingDisabled?: boolean;\n onReorderRows: UniversalProps<TData>[\"onReorderRows\"];\n pagination: {\n pageIndex: number;\n pageSize: number;\n };\n rowReorderingUtilities: {\n dragHandleStyles: CSSObject;\n dragHandleText: {\n title: string;\n \"aria-label\": string;\n };\n draggableTableBodyRowClassName: ({\n currentRowId,\n draggingRowId,\n hoveredRowId,\n }: {\n currentRowId: string;\n draggingRowId?: string;\n hoveredRowId?: string;\n }) => string | undefined;\n handleDragHandleKeyDown: ({\n table,\n row,\n event,\n }: {\n table: MRT_TableInstance<TData>;\n row: MRT_Row<TData>;\n event: React.KeyboardEvent<HTMLButtonElement>;\n }) => void;\n handleDragHandleOnDragCapture: (table: MRT_TableInstance<TData>) => void;\n handleDragHandleOnDragEnd: (table: MRT_TableInstance<TData>) => void;\n resetDraggingAndHoveredRow: (table: MRT_TableInstance<TData>) => void;\n updateRowOrder: ({\n rowId,\n newRowIndex,\n }: {\n rowId: string;\n newRowIndex: number;\n }) => void;\n };\n rowSelection: MRT_RowSelectionState;\n setRowSelection: Dispatch<SetStateAction<MRT_RowSelectionState>>;\n setTableState: Dispatch<SetStateAction<TableState>>;\n tableLayoutOptions: TableLayoutProps<TData>;\n tableState: TableState;\n totalRows: UniversalProps<TData>[\"totalRows\"];\n};\n\ntype TableLayoutContentComponent = (<TData extends MRT_RowData>(\n props: TableLayoutContentProps<TData>,\n) => JSX.Element) & {\n displayName?: string;\n};\n\nconst TableLayoutContent = <TData extends MRT_RowData>({\n columns,\n data,\n draggingRow,\n emptyState,\n enableVirtualization,\n getRowId,\n hasRowReordering,\n hasRowSelection,\n isEmpty,\n isLoading,\n isNoResults,\n isRowReorderingDisabled,\n onReorderRows,\n pagination,\n rowReorderingUtilities,\n rowSelection,\n setRowSelection,\n setTableState,\n tableLayoutOptions,\n tableState,\n totalRows,\n}: TableLayoutContentProps<TData>) => {\n const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] =\n useState(true);\n const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] =\n useState(true);\n const [tableInnerContainerWidth, setTableInnerContainerWidth] =\n useState<string>(\"100%\");\n const shouldUpdateScroll = useRef<boolean>(false);\n const tableOuterContainerRef = useRef<HTMLDivElement>(null);\n const tableInnerContainerRef = useRef<HTMLDivElement>(null);\n const tableContentRef = useRef<HTMLTableElement>(null);\n\n useScrollIndication({\n setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,\n setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,\n setTableInnerContainerWidth: setTableInnerContainerWidth,\n tableInnerContainer: tableInnerContainerRef.current,\n tableOuterContainer: tableOuterContainerRef.current,\n });\n\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const columnIds = useMemo(() => {\n return columns.map((column) => column.accessorKey) ?? [];\n }, [columns]);\n\n const columnOrder = useMemo(\n () => [\n \"mrt-row-drag\",\n \"mrt-row-select\",\n \"mrt-row-expand\",\n ...(columnIds?.filter((id): id is string => typeof id === \"string\") ||\n []),\n \"mrt-row-actions\",\n ],\n [columnIds],\n );\n\n const rowDensityClassName = useMemo(() => {\n return tableState.rowDensity === \"spacious\"\n ? \"MuiTableBody-spacious\"\n : tableState.rowDensity === \"compact\"\n ? \"MuiTableBody-compact\"\n : \"MuiTableBody-default\";\n }, [tableState]);\n\n const defaultCell = useCallback<\n ({ cell }: { cell: DataTableCell<TData, unknown> }) => ReactElement | string\n >(({ cell }) => {\n const value = cell.getValue<string>();\n const hasTextWrapping =\n cell.column.columnDef.hasTextWrapping ||\n cell.column.columnDef.enableWrapping;\n return hasTextWrapping ? value : <TextWrapper>{value}</TextWrapper>;\n }, []);\n\n const {\n draggableTableBodyRowClassName,\n dragHandleStyles,\n dragHandleText,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = rowReorderingUtilities;\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<TData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <RowActionsContainer>\n {tableLayoutOptions.rowActionButtons?.(row)}\n {(tableLayoutOptions.rowActionMenuItems || hasRowReordering) && (\n <MenuButton\n ariaLabel={t(\"table.moreactions.arialabel\")}\n buttonVariant=\"floating\"\n endIcon={<MoreIcon />}\n menuAlignment=\"right\"\n size=\"small\"\n >\n <RowActions\n isRowReorderingDisabled={isRowReorderingDisabled}\n row={\n row as unknown as MRT_Row<MRT_RowData> // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n }\n rowActionMenuItems={\n // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n tableLayoutOptions.rowActionMenuItems as unknown as (\n row: MRT_Row<MRT_RowData>,\n ) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n rowIndex={currentIndex}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n </MenuButton>\n )}\n </RowActionsContainer>\n );\n },\n [\n hasRowReordering,\n isRowReorderingDisabled,\n onReorderRows,\n pagination.pageIndex,\n pagination.pageSize,\n t,\n tableLayoutOptions,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const innerWidthStyle = useMemo(\n () => ({ width: tableInnerContainerWidth }),\n [tableInnerContainerWidth],\n );\n\n const emptyStateContainer = useCallback(\n () => <Box sx={innerWidthStyle}>{emptyState}</Box>,\n [innerWidthStyle, emptyState],\n );\n\n // Scroll to the bottom as soon as data loads after clicking the\n // loadMore pagination button\n useEffect(() => {\n if (enableVirtualization) {\n shouldUpdateScroll.current = true;\n }\n }, [enableVirtualization, pagination]);\n\n useEffect(() => {\n if (\n shouldUpdateScroll.current &&\n tableContentRef.current &&\n typeof tableInnerContainerRef.current?.scrollTo !== \"undefined\"\n ) {\n tableInnerContainerRef.current?.scrollTo(\n 0,\n tableContentRef.current.clientHeight,\n );\n shouldUpdateScroll.current = false;\n }\n }, [data]);\n\n const shouldDisplayRowActions = useMemo(\n () =>\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n [\n hasRowReordering,\n onReorderRows,\n tableLayoutOptions.rowActionButtons,\n tableLayoutOptions.rowActionMenuItems,\n ],\n );\n\n const hasColumnWithGrow = columns.some((column) => column.grow === true);\n\n const dataTable = useMaterialReactTable<TData>({\n data: (!isEmpty && !isNoResults ? data : []) as TData[],\n columns,\n getRowId,\n state: {\n sorting: tableState.columnSorting,\n columnVisibility: tableState.columnVisibility,\n isLoading: isLoading,\n rowSelection: rowSelection,\n columnOrder: columnOrder,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n ExpandMoreIcon: ChevronDownIcon,\n },\n ...dataTableImmutableSettings,\n displayColumnDefOptions: {\n ...(displayColumnDefOptions satisfies Partial<\n MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"]\n >),\n \"mrt-row-actions\": {\n header: \"\",\n grow: !hasColumnWithGrow,\n muiTableBodyCellProps: {\n align: \"right\" as const,\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\" as const,\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n children: (\n <Box sx={{ display: \"flex\", visibility: \"hidden\" }}>\n {tableLayoutOptions.rowActionButtons &&\n // @ts-expect-error TODO: This type is wrong and needs to be fixed\n tableLayoutOptions.rowActionButtons({ id: null })}\n {((hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionMenuItems) && (\n <Box>\n <Button\n endIcon={<MoreIcon />}\n size=\"small\"\n variant=\"floating\"\n ariaLabel={t(\"table.moreactions.arialabel\")}\n isDisabled\n />\n </Box>\n )}\n </Box>\n ),\n },\n },\n },\n muiTableProps: {\n ref: tableContentRef,\n className:\n !shouldDisplayRowActions && tableLayoutOptions.hasColumnResizing\n ? hasColumnWithGrow\n ? \"ods-hide-spacer-column\"\n : \"ods-hide-spacer-column ods-column-grow\"\n : \"\",\n },\n muiTableContainerProps: {\n ref: tableInnerContainerRef,\n },\n muiTableBodyProps: () => ({\n className: rowDensityClassName,\n tabIndex: 0,\n /**\n * This is a fix for an issue related to the empty state creating a\n * vertical scrollbar when virtualization is enabled. The root cause\n * is tablebody having height: 0 when virtualization is enabled and there\n * being no data\n * https://okta.slack.com/archives/C7T2H3KNJ/p1742842106148929\n */\n sx:\n isEmpty || isNoResults\n ? {\n height: \"unset\",\n }\n : undefined,\n }),\n enableColumnResizing: tableLayoutOptions.hasColumnResizing,\n defaultColumn: {\n Cell: defaultCell,\n },\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n renderRowActions: ({ row }) => renderRowActions({ row }),\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiDetailPanelProps: ({ row }) => ({\n sx: {\n paddingBlock: row.getIsExpanded()\n ? `${odysseyDesignTokens.Spacing3} !important`\n : undefined,\n },\n }),\n muiTableBodyRowProps: ({ table, row, isDetailPanel }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n sx: isDetailPanel\n ? {\n paddingBlock: \"0 !important\",\n border: 0,\n [\"&:hover\"]: {\n backgroundColor: `${odysseyDesignTokens.HueNeutralWhite} !important`,\n },\n }\n : {},\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n disabled: isRowReorderingDisabled,\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n renderDetailPanel: tableLayoutOptions.renderDetailPanel,\n enableRowVirtualization: enableVirtualization,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: tableState.columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n muiTableBodyCellProps: ({ column }) => ({\n className: column.getIsResizing() ? \"isResizing\" : \"\",\n }),\n enableSorting: tableLayoutOptions.hasSorting === true, // I don't know why this needs to be true, but it still works if undefined otherwise\n onSortingChange: (sortingUpdater) => {\n const newSortVal =\n typeof sortingUpdater === \"function\"\n ? sortingUpdater(tableState.columnSorting)\n : tableState.columnSorting;\n setTableState((prevState) => ({\n ...prevState,\n columnSorting: newSortVal,\n }));\n },\n enableRowSelection: hasRowSelection,\n onRowSelectionChange: setRowSelection,\n renderEmptyRowsFallback: emptyStateContainer,\n localization: {\n collapse: t(\"table.rowexpansion.collapse\"),\n collapseAll: t(\"table.rowexpansion.collapseall\"),\n expand: t(\"table.rowexpansion.expand\"),\n expandAll: t(\"table.rowexpansion.expandall\"),\n },\n });\n\n return (\n <ScrollableTableContainer\n isScrollableEnd={!isTableContainerScrolledToEnd}\n isScrollableStart={!isTableContainerScrolledToStart}\n odysseyDesignTokens={odysseyDesignTokens}\n ref={tableOuterContainerRef}\n >\n <MRT_TableContainer table={dataTable} />\n </ScrollableTableContainer>\n );\n};\n\nconst MemoizedTableLayoutContent = memo(\n TableLayoutContent,\n) as TableLayoutContentComponent;\nMemoizedTableLayoutContent.displayName = \"TableLayoutContent\";\n\nexport { MemoizedTableLayoutContent as TableLayoutContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,IAAI,EACJC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,QAAQ,EAIRC,SAAS,QACJ,OAAO;AACd,OAAOC,MAAM,MAAqB,iBAAiB;AACnD,SAIEC,kBAAkB,EAGlBC,qBAAqB,QAChB,sBAAsB;AAC7B,SAASC,cAAc,QAAQ,eAAe;AAE9C,SACEC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,iBAAiB,EACjBC,QAAQ,QACH,gCAAgC;AACvC,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,MAAM,EAAEC,UAAU,QAAQ,wBAAwB;AAO3D,SACEC,0BAA0B,EAC1BC,uBAAuB,EACvBC,wBAAwB,QACnB,qBAAqB;AAC5B,SAASC,UA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,QAAA,EAE5B9D,IAAA,CAAClB,kBAAkB;MAACuJ,KAAK,EAAErC;IAAU,CAAE;EAAC,CAChB,CAAC;AAE/B,CAAC;AAED,MAAM4E,0BAA0B,GAAGrM,IAAI,CACrCkC,kBACF,CAAgC;AAChCmK,0BAA0B,CAACC,WAAW,GAAG,oBAAoB;AAE7D,SAASD,0BAA0B,IAAInK,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayoutContent.js","names":["memo","useCallback","useMemo","useRef","useState","useEffect","styled","MRT_TableContainer","useMaterialReactTable","useTranslation","ArrowDownIcon","ArrowUnsortedIcon","ChevronDownIcon","DragIndicatorIcon","MoreIcon","Box","Button","MenuButton","dataTableImmutableSettings","displayColumnDefOptions","ScrollableTableContainer","RowActions","useOdysseyDesignTokens","useScrollIndication","jsx","_jsx","jsxs","_jsxs","TextWrapper","whiteSpace","textOverflow","overflow","RowActionsContainer","display","TableLayoutContent","columns","data","draggingRow","emptyState","enableVirtualization","getRowId","hasRowReordering","hasRowSelection","isEmpty","isLoading","isNoResults","isRowReorderingDisabled","onReorderRows","pagination","rowReorderingUtilities","rowSelection","setRowSelection","setTableState","tableLayoutOptions","tableState","totalRows","isTableContainerScrolledToStart","setIsTableContainerScrolledToStart","isTableContainerScrolledToEnd","setIsTableContainerScrolledToEnd","tableInnerContainerWidth","setTableInnerContainerWidth","shouldUpdateScroll","tableOuterContainerRef","tableInnerContainerRef","tableContentRef","tableInnerContainer","current","tableOuterContainer","odysseyDesignTokens","t","columnIds","map","column","accessorKey","columnOrder","filter","id","rowDensityClassName","rowDensity","defaultCell","cell","value","getValue","hasTextWrapping","columnDef","enableWrapping","children","draggableTableBodyRowClassName","dragHandleStyles","dragHandleText","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","renderRowActions","row","currentIndex","index","pageIndex","pageSize","rowActionButtons","rowActionMenuItems","ariaLabel","buttonVariant","endIcon","menuAlignment","size","rowIndex","undefined","innerWidthStyle","width","emptyStateContainer","sx","scrollTo","clientHeight","shouldDisplayRowActions","hasColumnWithGrow","some","grow","dataTable","state","sorting","columnSorting","columnVisibility","icons","ArrowDownwardIcon","DragHandleIcon","SyncAltIcon","ExpandMoreIcon","header","muiTableBodyCellProps","align","className","muiTableHeadCellProps","visibility","variant","isDisabled","muiTableProps","ref","hasColumnResizing","muiTableContainerProps","muiTableBodyProps","tabIndex","height","enableColumnResizing","defaultColumn","Cell","enableRowActions","enableRowOrdering","Boolean","enableRowDragging","muiDetailPanelProps","paddingBlock","getIsExpanded","Spacing3","muiTableBodyRowProps","table","isDetailPanel","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","border","backgroundColor","HueNeutralWhite","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","disabled","renderDetailPanel","enableRowVirtualization","currentColumn","find","sortedColumn","getIsResizing","enableSorting","hasSorting","onSortingChange","sortingUpdater","newSortVal","prevState","enableRowSelection","onRowSelectionChange","renderEmptyRowsFallback","localization","collapse","collapseAll","expand","expandAll","isScrollableEnd","isScrollableStart","MemoizedTableLayoutContent","displayName"],"sources":["../../../../src/labs/DataView/TableLayoutContent.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 {\n SetStateAction,\n memo,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n Dispatch,\n ReactElement,\n useEffect,\n} from \"react\";\nimport styled, { CSSObject } from \"@emotion/styled\";\nimport {\n MRT_Row,\n MRT_RowData,\n MRT_RowSelectionState,\n MRT_TableContainer,\n MRT_TableInstance,\n MRT_TableOptions,\n useMaterialReactTable,\n} from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n ChevronDownIcon,\n DragIndicatorIcon,\n MoreIcon,\n} from \"../../icons.generated/index.js\";\nimport { Box } from \"../../Box.js\";\nimport { Button, MenuButton } from \"../../Buttons/index.js\";\nimport {\n TableLayoutProps,\n TableState,\n UniversalProps,\n} from \"./componentTypes.js\";\nimport { DataTableCell } from \"./dataTypes.js\";\nimport {\n dataTableImmutableSettings,\n displayColumnDefOptions,\n ScrollableTableContainer,\n} from \"./tableConstants.js\";\nimport { RowActions } from \"./RowActions.js\";\nimport { useOdysseyDesignTokens } from \"../../OdysseyDesignTokensContext.js\";\nimport { useScrollIndication } from \"../../DataTable/useScrollIndication.js\";\n\nconst TextWrapper = styled(\"div\")({\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n});\n\nconst RowActionsContainer = styled(\"div\")({\n display: \"flex\",\n});\n\nexport type TableLayoutContentProps<TData extends MRT_RowData> = {\n columns: TableLayoutProps<TData>[\"columns\"];\n data: MRT_RowData[];\n draggingRow?: MRT_Row<TData> | null;\n emptyState: ReactNode;\n enableVirtualization?: boolean;\n getRowId: UniversalProps<TData>[\"getRowId\"];\n hasRowReordering: UniversalProps<TData>[\"hasRowReordering\"];\n hasRowSelection: UniversalProps<TData>[\"hasRowSelection\"];\n isEmpty?: boolean;\n isLoading: boolean;\n isNoResults?: boolean;\n isRowReorderingDisabled?: boolean;\n onReorderRows: UniversalProps<TData>[\"onReorderRows\"];\n pagination: {\n pageIndex: number;\n pageSize: number;\n };\n rowReorderingUtilities: {\n dragHandleStyles: CSSObject;\n dragHandleText: {\n title: string;\n \"aria-label\": string;\n };\n draggableTableBodyRowClassName: ({\n currentRowId,\n draggingRowId,\n hoveredRowId,\n }: {\n currentRowId: string;\n draggingRowId?: string;\n hoveredRowId?: string;\n }) => string | undefined;\n handleDragHandleKeyDown: ({\n table,\n row,\n event,\n }: {\n table: MRT_TableInstance<TData>;\n row: MRT_Row<TData>;\n event: React.KeyboardEvent<HTMLButtonElement>;\n }) => void;\n handleDragHandleOnDragCapture: (table: MRT_TableInstance<TData>) => void;\n handleDragHandleOnDragEnd: (table: MRT_TableInstance<TData>) => void;\n resetDraggingAndHoveredRow: (table: MRT_TableInstance<TData>) => void;\n updateRowOrder: ({\n rowId,\n newRowIndex,\n }: {\n rowId: string;\n newRowIndex: number;\n }) => void;\n };\n rowSelection: MRT_RowSelectionState;\n setRowSelection: Dispatch<SetStateAction<MRT_RowSelectionState>>;\n setTableState: Dispatch<SetStateAction<TableState>>;\n tableLayoutOptions: TableLayoutProps<TData>;\n tableState: TableState;\n totalRows: UniversalProps<TData>[\"totalRows\"];\n};\n\ntype TableLayoutContentComponent = (<TData extends MRT_RowData>(\n props: TableLayoutContentProps<TData>,\n) => JSX.Element) & {\n displayName?: string;\n};\n\nconst TableLayoutContent = <TData extends MRT_RowData>({\n columns,\n data,\n draggingRow,\n emptyState,\n enableVirtualization,\n getRowId,\n hasRowReordering,\n hasRowSelection,\n isEmpty,\n isLoading,\n isNoResults,\n isRowReorderingDisabled,\n onReorderRows,\n pagination,\n rowReorderingUtilities,\n rowSelection,\n setRowSelection,\n setTableState,\n tableLayoutOptions,\n tableState,\n totalRows,\n}: TableLayoutContentProps<TData>) => {\n const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] =\n useState(true);\n const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] =\n useState(true);\n const [tableInnerContainerWidth, setTableInnerContainerWidth] =\n useState<string>(\"100%\");\n const shouldUpdateScroll = useRef<boolean>(false);\n const tableOuterContainerRef = useRef<HTMLDivElement>(null);\n const tableInnerContainerRef = useRef<HTMLDivElement>(null);\n const tableContentRef = useRef<HTMLTableElement>(null);\n\n useScrollIndication({\n setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,\n setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,\n setTableInnerContainerWidth: setTableInnerContainerWidth,\n tableInnerContainer: tableInnerContainerRef.current,\n tableOuterContainer: tableOuterContainerRef.current,\n });\n\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const columnIds = useMemo(() => {\n return columns.map((column) => column.accessorKey) ?? [];\n }, [columns]);\n\n const columnOrder = useMemo(\n () => [\n \"mrt-row-drag\",\n \"mrt-row-select\",\n \"mrt-row-expand\",\n ...(columnIds?.filter((id): id is string => typeof id === \"string\") ||\n []),\n \"mrt-row-actions\",\n ],\n [columnIds],\n );\n\n const rowDensityClassName = useMemo(() => {\n return tableState.rowDensity === \"spacious\"\n ? \"MuiTableBody-spacious\"\n : tableState.rowDensity === \"compact\"\n ? \"MuiTableBody-compact\"\n : \"MuiTableBody-default\";\n }, [tableState]);\n\n const defaultCell = useCallback<\n ({ cell }: { cell: DataTableCell<TData, unknown> }) => ReactElement | string\n >(({ cell }) => {\n const value = cell.getValue<string>();\n const hasTextWrapping =\n cell.column.columnDef.hasTextWrapping ||\n cell.column.columnDef.enableWrapping;\n return hasTextWrapping ? value : <TextWrapper>{value}</TextWrapper>;\n }, []);\n\n const {\n draggableTableBodyRowClassName,\n dragHandleStyles,\n dragHandleText,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = rowReorderingUtilities;\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<TData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <RowActionsContainer>\n {tableLayoutOptions.rowActionButtons?.(row)}\n {(tableLayoutOptions.rowActionMenuItems || hasRowReordering) && (\n <MenuButton\n ariaLabel={t(\"table.moreactions.arialabel\")}\n buttonVariant=\"floating\"\n endIcon={<MoreIcon />}\n menuAlignment=\"right\"\n size=\"small\"\n >\n <RowActions\n isRowReorderingDisabled={isRowReorderingDisabled}\n row={\n row as unknown as MRT_Row<MRT_RowData> // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n }\n rowActionMenuItems={\n // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n tableLayoutOptions.rowActionMenuItems as unknown as (\n row: MRT_Row<MRT_RowData>,\n ) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n rowIndex={currentIndex}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n </MenuButton>\n )}\n </RowActionsContainer>\n );\n },\n [\n hasRowReordering,\n isRowReorderingDisabled,\n onReorderRows,\n pagination.pageIndex,\n pagination.pageSize,\n t,\n tableLayoutOptions,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const innerWidthStyle = useMemo(\n () => ({ width: tableInnerContainerWidth }),\n [tableInnerContainerWidth],\n );\n\n const emptyStateContainer = useCallback(\n () => <Box sx={innerWidthStyle}>{emptyState}</Box>,\n [innerWidthStyle, emptyState],\n );\n\n // Scroll to the bottom as soon as data loads after clicking the\n // loadMore pagination button\n useEffect(() => {\n if (enableVirtualization) {\n shouldUpdateScroll.current = true;\n }\n }, [enableVirtualization, pagination]);\n\n useEffect(() => {\n if (\n shouldUpdateScroll.current &&\n tableContentRef.current &&\n typeof tableInnerContainerRef.current?.scrollTo !== \"undefined\"\n ) {\n tableInnerContainerRef.current?.scrollTo(\n 0,\n tableContentRef.current.clientHeight,\n );\n shouldUpdateScroll.current = false;\n }\n }, [data]);\n\n const shouldDisplayRowActions = useMemo(\n () =>\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n [\n hasRowReordering,\n onReorderRows,\n tableLayoutOptions.rowActionButtons,\n tableLayoutOptions.rowActionMenuItems,\n ],\n );\n\n const hasColumnWithGrow = columns.some((column) => column.grow === true);\n\n const dataTable = useMaterialReactTable<TData>({\n data: (!isEmpty && !isNoResults ? data : []) as TData[],\n columns,\n getRowId,\n state: {\n sorting: tableState.columnSorting,\n columnVisibility: tableState.columnVisibility,\n isLoading,\n rowSelection,\n columnOrder,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n ExpandMoreIcon: ChevronDownIcon,\n },\n ...dataTableImmutableSettings,\n displayColumnDefOptions: {\n ...(displayColumnDefOptions satisfies Partial<\n MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"]\n >),\n \"mrt-row-actions\": {\n header: \"\",\n grow: !hasColumnWithGrow,\n muiTableBodyCellProps: {\n align: \"right\" as const,\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\" as const,\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n children: (\n <Box sx={{ display: \"flex\", visibility: \"hidden\" }}>\n {tableLayoutOptions.rowActionButtons &&\n // @ts-expect-error TODO: This type is wrong and needs to be fixed\n tableLayoutOptions.rowActionButtons({ id: null })}\n {((hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionMenuItems) && (\n <Box>\n <Button\n endIcon={<MoreIcon />}\n size=\"small\"\n variant=\"floating\"\n ariaLabel={t(\"table.moreactions.arialabel\")}\n isDisabled\n />\n </Box>\n )}\n </Box>\n ),\n },\n },\n },\n muiTableProps: {\n ref: tableContentRef,\n className:\n !shouldDisplayRowActions && tableLayoutOptions.hasColumnResizing\n ? hasColumnWithGrow\n ? \"ods-hide-spacer-column\"\n : \"ods-hide-spacer-column ods-column-grow\"\n : \"\",\n },\n muiTableContainerProps: {\n ref: tableInnerContainerRef,\n },\n muiTableBodyProps: () => ({\n className: rowDensityClassName,\n tabIndex: 0,\n /**\n * This is a fix for an issue related to the empty state creating a\n * vertical scrollbar when virtualization is enabled. The root cause\n * is tablebody having height: 0 when virtualization is enabled and there\n * being no data\n * https://okta.slack.com/archives/C7T2H3KNJ/p1742842106148929\n */\n sx:\n isEmpty || isNoResults\n ? {\n height: \"unset\",\n }\n : undefined,\n }),\n enableColumnResizing: tableLayoutOptions.hasColumnResizing,\n defaultColumn: {\n Cell: defaultCell,\n },\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n renderRowActions: ({ row }) => renderRowActions({ row }),\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiDetailPanelProps: ({ row }) => ({\n sx: {\n paddingBlock: row.getIsExpanded()\n ? `${odysseyDesignTokens.Spacing3} !important`\n : undefined,\n },\n }),\n muiTableBodyRowProps: ({ table, row, isDetailPanel }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n sx: isDetailPanel\n ? {\n paddingBlock: \"0 !important\",\n border: 0,\n [\"&:hover\"]: {\n backgroundColor: `${odysseyDesignTokens.HueNeutralWhite} !important`,\n },\n }\n : {},\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n disabled: isRowReorderingDisabled,\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n renderDetailPanel: tableLayoutOptions.renderDetailPanel,\n enableRowVirtualization: enableVirtualization,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: tableState.columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n muiTableBodyCellProps: ({ column }) => ({\n className: column.getIsResizing() ? \"isResizing\" : \"\",\n }),\n enableSorting: tableLayoutOptions.hasSorting === true, // I don't know why this needs to be true, but it still works if undefined otherwise\n onSortingChange: (sortingUpdater) => {\n const newSortVal =\n typeof sortingUpdater === \"function\"\n ? sortingUpdater(tableState.columnSorting)\n : tableState.columnSorting;\n setTableState((prevState) => ({\n ...prevState,\n columnSorting: newSortVal,\n }));\n },\n enableRowSelection: hasRowSelection,\n onRowSelectionChange: setRowSelection,\n renderEmptyRowsFallback: emptyStateContainer,\n localization: {\n collapse: t(\"table.rowexpansion.collapse\"),\n collapseAll: t(\"table.rowexpansion.collapseall\"),\n expand: t(\"table.rowexpansion.expand\"),\n expandAll: t(\"table.rowexpansion.expandall\"),\n },\n });\n\n return (\n <ScrollableTableContainer\n isScrollableEnd={!isTableContainerScrolledToEnd}\n isScrollableStart={!isTableContainerScrolledToStart}\n odysseyDesignTokens={odysseyDesignTokens}\n ref={tableOuterContainerRef}\n >\n <MRT_TableContainer table={dataTable} />\n </ScrollableTableContainer>\n );\n};\n\nconst MemoizedTableLayoutContent = memo(\n TableLayoutContent,\n) as TableLayoutContentComponent;\nMemoizedTableLayoutContent.displayName = \"TableLayoutContent\";\n\nexport { MemoizedTableLayoutContent as TableLayoutContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,IAAI,EACJC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,QAAQ,EAIRC,SAAS,QACJ,OAAO;AACd,OAAOC,MAAM,MAAqB,iBAAiB;AACnD,SAIEC,kBAAkB,EAGlBC,qBAAqB,QAChB,sBAAsB;AAC7B,SAASC,cAAc,QAAQ,eAAe;AAE9C,SACEC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,iBAAiB,EACjBC,QAAQ,QACH,gCAAgC;AACvC,SAASC,GAAG,QAAQ,cAAc;AAClC,SAASC,MAAM,EAAEC,UAAU,QAAQ,wBAAwB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