@okta/odyssey-react-mui 1.32.4 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Autocomplete.cjs +1 -1
- package/dist/cjs/Autocomplete.cjs.map +1 -1
- package/dist/cjs/Breadcrumbs.cjs +23 -7
- package/dist/cjs/Breadcrumbs.cjs.map +1 -1
- package/dist/cjs/Buttons/BaseButton.cjs +1 -1
- package/dist/cjs/Buttons/BaseButton.cjs.map +1 -1
- package/dist/cjs/DatePickers/datePickerTheme.cjs +1 -1
- package/dist/cjs/DatePickers/datePickerTheme.cjs.map +1 -1
- package/dist/cjs/OdysseyProvider.cjs +2 -2
- package/dist/cjs/OdysseyProvider.cjs.map +1 -1
- package/dist/cjs/OdysseyThemeProvider.cjs +2 -2
- package/dist/cjs/OdysseyThemeProvider.cjs.map +1 -1
- package/dist/cjs/hexToRgb.cjs.map +1 -1
- package/dist/cjs/labs/DatePickers/DateTimePicker.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/PickerWithOptionAdornment.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_cs.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_cs.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_da.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_da.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_de.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_de.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_el.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_el.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_es.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_es.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_fi.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_fi.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_fr.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_fr.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ht.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ht.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_hu.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_hu.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_id.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_id.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_it.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_it.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ja.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ja.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ko.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ko.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ms.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ms.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_nb.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_nb.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_nl_NL.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_nl_NL.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_pl.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_pl.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_pt_BR.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_pt_BR.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ro.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ro.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ru.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ru.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_sv.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_sv.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_th.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_th.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_tr.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_tr.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_uk.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_uk.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_vi.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_vi.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_CN.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_CN.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_TW.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_TW.cjs.map +1 -1
- package/dist/cjs/theme/pxToRem.cjs +21 -0
- package/dist/cjs/theme/pxToRem.cjs.map +1 -0
- package/dist/cjs/theme/theme.cjs +22 -0
- package/dist/cjs/theme/theme.cjs.map +1 -1
- package/dist/cjs/theme/useMediaQuery.cjs +34 -0
- package/dist/cjs/theme/useMediaQuery.cjs.map +1 -0
- package/dist/cjs/ui-shell/AppSwitcher/AppSwitcher.cjs +3 -3
- package/dist/cjs/ui-shell/AppSwitcher/AppSwitcher.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +353 -0
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -0
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +62 -44
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavHeader.cjs +8 -5
- package/dist/cjs/ui-shell/SideNav/SideNavHeader.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavItemContent.cjs +3 -0
- package/dist/cjs/ui-shell/SideNav/SideNavItemContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs +5 -5
- package/dist/cjs/ui-shell/SideNav/SideNavLogo.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs +2 -1
- package/dist/cjs/ui-shell/SideNav/SideNavToggleButton.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/types.cjs.map +1 -1
- package/dist/cjs/ui-shell/TopNav/HamburgerMenuIcon.cjs +37 -0
- package/dist/cjs/ui-shell/TopNav/HamburgerMenuIcon.cjs.map +1 -0
- package/dist/cjs/ui-shell/TopNav/TopNav.cjs +5 -5
- package/dist/cjs/ui-shell/TopNav/TopNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +43 -18
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShellProvider.cjs +14 -4
- package/dist/cjs/ui-shell/UiShellProvider.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +171 -0
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -0
- package/dist/cjs/ui-shell/index.cjs +37 -9
- package/dist/cjs/ui-shell/index.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +32 -20
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/uiShellContentTypes.cjs +20 -0
- package/dist/cjs/ui-shell/uiShellContentTypes.cjs.map +1 -0
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs +23 -0
- package/dist/cjs/ui-shell/uiShellSharedConstants.cjs.map +1 -0
- package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs +108 -0
- package/dist/cjs/ui-shell/useMatchAppElementToUiShellAppArea.cjs.map +1 -0
- package/dist/cjs/ui-shell/useScrollState.cjs +2 -4
- package/dist/cjs/ui-shell/useScrollState.cjs.map +1 -1
- package/dist/cjs/ui-shell/useUiShellBreakpoints.cjs +41 -0
- package/dist/cjs/ui-shell/useUiShellBreakpoints.cjs.map +1 -0
- package/dist/cjs/web-component/createReactRootElements.cjs.map +1 -1
- package/dist/cjs/web-component/renderReactInWebComponent.cjs +6 -1
- package/dist/cjs/web-component/renderReactInWebComponent.cjs.map +1 -1
- package/dist/esm/Autocomplete.js +1 -1
- package/dist/esm/Autocomplete.js.map +1 -1
- package/dist/esm/Breadcrumbs.js +23 -7
- package/dist/esm/Breadcrumbs.js.map +1 -1
- package/dist/esm/Buttons/BaseButton.js +1 -1
- package/dist/esm/Buttons/BaseButton.js.map +1 -1
- package/dist/esm/DatePickers/datePickerTheme.js +1 -1
- package/dist/esm/DatePickers/datePickerTheme.js.map +1 -1
- package/dist/esm/OdysseyProvider.js +2 -2
- package/dist/esm/OdysseyProvider.js.map +1 -1
- package/dist/esm/OdysseyThemeProvider.js +2 -2
- package/dist/esm/OdysseyThemeProvider.js.map +1 -1
- package/dist/esm/hexToRgb.js.map +1 -1
- package/dist/esm/labs/DatePickers/DateTimePicker.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/PickerWithOptionAdornment.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_cs.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_cs.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_da.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_da.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_de.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_de.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_el.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_el.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_es.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_es.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_fi.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_fi.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_fr.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_fr.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ht.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ht.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_hu.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_hu.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_id.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_id.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_it.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_it.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ja.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ja.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ko.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ko.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ms.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ms.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_nb.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_nb.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_nl_NL.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_pl.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_pl.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_pt_BR.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ro.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ro.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ru.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ru.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_sv.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_sv.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_th.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_th.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_tr.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_tr.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_uk.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_uk.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_vi.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_vi.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_zh_CN.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_zh_TW.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
- package/dist/esm/theme/pxToRem.js +14 -0
- package/dist/esm/theme/pxToRem.js.map +1 -0
- package/dist/esm/theme/theme.js +2 -0
- package/dist/esm/theme/theme.js.map +1 -1
- package/dist/esm/theme/useMediaQuery.js +27 -0
- package/dist/esm/theme/useMediaQuery.js.map +1 -0
- package/dist/esm/ui-shell/AppSwitcher/AppSwitcher.js +2 -2
- package/dist/esm/ui-shell/AppSwitcher/AppSwitcher.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +347 -0
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -0
- package/dist/esm/ui-shell/SideNav/SideNav.js +61 -43
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavHeader.js +7 -4
- package/dist/esm/ui-shell/SideNav/SideNavHeader.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavItemContent.js +3 -0
- package/dist/esm/ui-shell/SideNav/SideNavItemContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js +5 -5
- package/dist/esm/ui-shell/SideNav/SideNavLogo.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js +2 -1
- package/dist/esm/ui-shell/SideNav/SideNavToggleButton.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/types.js.map +1 -1
- package/dist/esm/ui-shell/TopNav/HamburgerMenuIcon.js +32 -0
- package/dist/esm/ui-shell/TopNav/HamburgerMenuIcon.js.map +1 -0
- package/dist/esm/ui-shell/TopNav/TopNav.js +2 -2
- package/dist/esm/ui-shell/TopNav/TopNav.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +43 -18
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/UiShellProvider.js +12 -3
- package/dist/esm/ui-shell/UiShellProvider.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +165 -0
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -0
- package/dist/esm/ui-shell/index.js +3 -1
- package/dist/esm/ui-shell/index.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +32 -20
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/uiShellContentTypes.js +14 -0
- package/dist/esm/ui-shell/uiShellContentTypes.js.map +1 -0
- package/dist/esm/ui-shell/uiShellSharedConstants.js +17 -0
- package/dist/esm/ui-shell/uiShellSharedConstants.js.map +1 -0
- package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js +99 -0
- package/dist/esm/ui-shell/useMatchAppElementToUiShellAppArea.js.map +1 -0
- package/dist/esm/ui-shell/useScrollState.js +3 -5
- package/dist/esm/ui-shell/useScrollState.js.map +1 -1
- package/dist/esm/ui-shell/useUiShellBreakpoints.js +34 -0
- package/dist/esm/ui-shell/useUiShellBreakpoints.js.map +1 -0
- package/dist/esm/web-component/createReactRootElements.js.map +1 -1
- package/dist/esm/web-component/renderReactInWebComponent.js +6 -1
- package/dist/esm/web-component/renderReactInWebComponent.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.scss +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/types/Autocomplete.d.ts +1 -1
- package/dist/types/Breadcrumbs.d.ts +4 -3
- package/dist/types/Breadcrumbs.d.ts.map +1 -1
- package/dist/types/Buttons/BaseButton.d.ts +1 -1
- package/dist/types/OdysseyProvider.d.ts +1 -1
- package/dist/types/OdysseyProvider.d.ts.map +1 -1
- package/dist/types/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/types/hexToRgb.d.ts.map +1 -1
- package/dist/types/i18n.d.ts +28 -0
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/labs/DatePickers/DateTimePicker.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/properties/ts/odyssey-react-mui_cs.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_da.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_de.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_el.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_es.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_fi.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_fr.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ht.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ht.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_hu.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_id.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_it.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ja.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ko.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ms.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_nb.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_nl_NL.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_pl.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_pt_BR.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ro.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ru.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_sv.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_th.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_tr.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_uk.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_vi.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_zh_CN.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_zh_TW.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
- package/dist/types/theme/pxToRem.d.ts +13 -0
- package/dist/types/theme/pxToRem.d.ts.map +1 -0
- package/dist/types/theme/theme.d.ts +2 -0
- package/dist/types/theme/theme.d.ts.map +1 -1
- package/dist/types/theme/useMediaQuery.d.ts +13 -0
- package/dist/types/theme/useMediaQuery.d.ts.map +1 -0
- package/dist/types/ui-shell/AppSwitcher/AppSwitcher.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts +17 -0
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -0
- package/dist/types/ui-shell/SideNav/SideNav.d.ts +1 -3
- package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavHeader.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavItemContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts +1 -1
- package/dist/types/ui-shell/SideNav/SideNavLogo.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNavToggleButton.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/types.d.ts +7 -1
- package/dist/types/ui-shell/SideNav/types.d.ts.map +1 -1
- package/dist/types/ui-shell/TopNav/HamburgerMenuIcon.d.ts +16 -0
- package/dist/types/ui-shell/TopNav/HamburgerMenuIcon.d.ts.map +1 -0
- package/dist/types/ui-shell/TopNav/TopNav.d.ts +0 -1
- package/dist/types/ui-shell/TopNav/TopNav.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts +12 -14
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShellProvider.d.ts +37 -8
- package/dist/types/ui-shell/UiShellProvider.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts +16 -0
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -0
- package/dist/types/ui-shell/index.d.ts +3 -1
- package/dist/types/ui-shell/index.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +9 -11
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/{UiShellContent.d.ts → uiShellContentTypes.d.ts} +45 -31
- package/dist/types/ui-shell/uiShellContentTypes.d.ts.map +1 -0
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts +18 -0
- package/dist/types/ui-shell/uiShellSharedConstants.d.ts.map +1 -0
- package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts +38 -0
- package/dist/types/ui-shell/useMatchAppElementToUiShellAppArea.d.ts.map +1 -0
- package/dist/types/ui-shell/useScrollState.d.ts +0 -1
- package/dist/types/ui-shell/useScrollState.d.ts.map +1 -1
- package/dist/types/ui-shell/useUiShellBreakpoints.d.ts +18 -0
- package/dist/types/ui-shell/useUiShellBreakpoints.d.ts.map +1 -0
- package/dist/types/web-component/createReactRootElements.d.ts +6 -4
- package/dist/types/web-component/createReactRootElements.d.ts.map +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts +12 -5
- package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/ui-shell/UiShellContent.cjs +0 -242
- package/dist/cjs/ui-shell/UiShellContent.cjs.map +0 -1
- package/dist/esm/ui-shell/UiShellContent.js +0 -234
- package/dist/esm/ui-shell/UiShellContent.js.map +0 -1
- package/dist/types/ui-shell/UiShellContent.d.ts.map +0 -1
|
@@ -8,8 +8,8 @@ var _reactErrorBoundary = require("react-error-boundary");
|
|
|
8
8
|
var _bufferLatest = require("./bufferLatest.cjs");
|
|
9
9
|
var _createMessageBus = require("./createMessageBus.cjs");
|
|
10
10
|
var _UiShell = require("./UiShell.cjs");
|
|
11
|
-
var _renderReactInWebComponent = require("../web-component/renderReactInWebComponent.cjs");
|
|
12
11
|
var _useHasUiShell = require("./useHasUiShell.cjs");
|
|
12
|
+
var _renderReactInWebComponent = require("../web-component/renderReactInWebComponent.cjs");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
/*!
|
|
15
15
|
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
@@ -25,6 +25,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
|
|
26
26
|
const optionalComponentSlotNames = exports.optionalComponentSlotNames = {
|
|
27
27
|
banners: "banners",
|
|
28
|
+
rightSideMenu: "right-side-menu",
|
|
28
29
|
sideNavFooter: "side-nav-footer",
|
|
29
30
|
topNavLeftSide: "top-nav-left-side",
|
|
30
31
|
topNavRightSide: "top-nav-right-side"
|
|
@@ -32,17 +33,17 @@ const optionalComponentSlotNames = exports.optionalComponentSlotNames = {
|
|
|
32
33
|
const renderUiShell = ({
|
|
33
34
|
appBackgroundColor,
|
|
34
35
|
appBackgroundContrastMode,
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
appElement: providedAppElement,
|
|
37
|
+
appElementScrollingMode,
|
|
37
38
|
hasStandardAppContentPadding,
|
|
38
39
|
initialVisibleSections,
|
|
39
40
|
onError = console.error,
|
|
41
|
+
parentElement,
|
|
40
42
|
sideNavBackgroundColor,
|
|
41
|
-
topNavBackgroundColor
|
|
42
|
-
uiShellRootElement
|
|
43
|
+
topNavBackgroundColor
|
|
43
44
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
45
|
+
const appElement = providedAppElement || document.createElement("div");
|
|
46
|
+
parentElement.setAttribute(_useHasUiShell.uiShellDataAttribute, "");
|
|
46
47
|
const {
|
|
47
48
|
publish: publishPropChanges,
|
|
48
49
|
subscribe: subscribeToPropChanges
|
|
@@ -55,26 +56,32 @@ const renderUiShell = ({
|
|
|
55
56
|
publish: publishPropChanges,
|
|
56
57
|
subscribe: subscribeToReactAppSubscribed
|
|
57
58
|
});
|
|
59
|
+
const {
|
|
60
|
+
publish: closeRightSideMenu,
|
|
61
|
+
subscribe: subscribeToCloseRightSideMenu
|
|
62
|
+
} = (0, _createMessageBus.createMessageBus)();
|
|
63
|
+
const {
|
|
64
|
+
publish: closeSideNavMenu,
|
|
65
|
+
subscribe: subscribeToCloseSideNavMenu
|
|
66
|
+
} = (0, _createMessageBus.createMessageBus)();
|
|
58
67
|
const slottedElements = Object.fromEntries(Object.entries(optionalComponentSlotNames).map(([optionalComponentKey, slotName]) => {
|
|
59
68
|
const element = document.createElement("div");
|
|
60
69
|
element.setAttribute("slot", slotName);
|
|
61
70
|
return [optionalComponentKey, element];
|
|
62
71
|
}));
|
|
63
|
-
const appContainerElement = document.createElement("div");
|
|
64
|
-
appContainerElement.appendChild(appRootElement);
|
|
65
72
|
const webComponentChildren = Object.values(slottedElements);
|
|
66
|
-
const appComponent = (0, _jsxRuntime.jsx)("slot", {});
|
|
67
73
|
const uiShellElement = (0, _renderReactInWebComponent.renderReactInWebComponent)({
|
|
68
74
|
getReactComponent: reactRootElements => (0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
69
|
-
fallback:
|
|
75
|
+
fallback: (0, _jsxRuntime.jsx)("div", {
|
|
76
|
+
"data-error": true
|
|
77
|
+
}),
|
|
70
78
|
onError: onError,
|
|
71
79
|
children: (0, _jsxRuntime.jsx)(_UiShell.UiShell, {
|
|
72
80
|
appBackgroundColor: appBackgroundColor,
|
|
73
81
|
appBackgroundContrastMode: appBackgroundContrastMode,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
appRootElement: reactRootElements.appRootElement,
|
|
82
|
+
appElement: appElement,
|
|
83
|
+
appElementScrollingMode: appElementScrollingMode,
|
|
84
|
+
closeSideNavMenu: closeSideNavMenu,
|
|
78
85
|
hasStandardAppContentPadding: hasStandardAppContentPadding,
|
|
79
86
|
initialVisibleSections: initialVisibleSections,
|
|
80
87
|
onError: onError,
|
|
@@ -83,17 +90,22 @@ const renderUiShell = ({
|
|
|
83
90
|
name: slotName
|
|
84
91
|
})])),
|
|
85
92
|
sideNavBackgroundColor: sideNavBackgroundColor,
|
|
86
|
-
|
|
93
|
+
subscribeToCloseRightSideMenu: subscribeToCloseRightSideMenu,
|
|
94
|
+
subscribeToCloseSideNavMenu: subscribeToCloseSideNavMenu,
|
|
87
95
|
subscribeToPropChanges: subscribeToPropChanges,
|
|
88
|
-
topNavBackgroundColor: topNavBackgroundColor
|
|
96
|
+
topNavBackgroundColor: topNavBackgroundColor,
|
|
97
|
+
uiShellAppElement: reactRootElements.appRootElement,
|
|
98
|
+
uiShellStylesElement: reactRootElements.stylesRootElement
|
|
89
99
|
})
|
|
90
100
|
}),
|
|
91
|
-
|
|
101
|
+
webComponentParentElement: parentElement,
|
|
92
102
|
webComponentChildren
|
|
93
103
|
});
|
|
94
|
-
|
|
104
|
+
parentElement.appendChild(appElement);
|
|
95
105
|
return {
|
|
96
|
-
|
|
106
|
+
appElement,
|
|
107
|
+
closeRightSideMenu,
|
|
108
|
+
closeSideNavMenu,
|
|
97
109
|
setComponentProps: publishAfterReactAppReadyForProps,
|
|
98
110
|
slottedElements,
|
|
99
111
|
uiShellElement
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_renderReactInWebComponent","_useHasUiShell","_jsxRuntime","optionalComponentSlotNames","exports","banners","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appContainerScrollingMode","appRootElement","explicitAppRootElement","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","sideNavBackgroundColor","topNavBackgroundColor","uiShellRootElement","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","appContainerElement","appendChild","webComponentChildren","values","appComponent","jsx","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","stylesRootElement","webComponentRootElement","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 { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\nimport { type UiShellNavComponentProps } from \"./UiShellContent.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\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 appContainerScrollingMode,\n appRootElement: explicitAppRootElement,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n uiShellRootElement,\n}: {\n /**\n * HTML element used as the root for a React app.\n */\n appRootElement?: HTMLDivElement;\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 root for UI Shell.\n */\n uiShellRootElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appContainerScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n>) => {\n const appRootElement =\n explicitAppRootElement || 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 uiShellRootElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n >;\n\n const appContainerElement = document.createElement(\"div\");\n appContainerElement.appendChild(appRootElement);\n\n const webComponentChildren = Object.values(slottedElements);\n\n const appComponent = <slot />;\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={appComponent} onError={onError}>\n <UiShell\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appComponent={appComponent}\n appContainerElement={appContainerElement}\n appContainerScrollingMode={appContainerScrollingMode}\n appRootElement={reactRootElements.appRootElement}\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.\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 stylesRootElement={reactRootElements.stylesRootElement}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n />\n </ErrorBoundary>\n ),\n webComponentRootElement: uiShellRootElement,\n webComponentChildren,\n });\n uiShellRootElement.appendChild(appContainerElement);\n\n return {\n appRootElement,\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;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AAA0D,IAAAM,WAAA,GAAAN,OAAA;AApB1D;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,cAAc,EAAE,mBAAmB;EACnCC,eAAe,EAAE;AACnB,CAAC;AAWM,MAAMC,aAAa,GAAGA,CAAC;EAC5BC,kBAAkB;EAClBC,yBAAyB;EACzBC,yBAAyB;EACzBC,cAAc,EAAEC,sBAAsB;EACtCC,4BAA4B;EAC5BC,sBAAsB;EACtBC,OAAO,GAAGC,OAAO,CAACC,KAAK;EACvBC,sBAAsB;EACtBC,qBAAqB;EACrBC;AAuBF,CAAC,KAAK;EACJ,MAAMT,cAAc,GAClBC,sBAAsB,IAAIS,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGzDF,kBAAkB,CAACG,YAAY,CAACC,mCAAoB,EAAE,EAAE,CAAC;EAEzD,MAAM;IAAEC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C,yBAAyB,EAAEA,yBAA0B;QACrDqC,YAAY,EAAEA,YAAa;QAC3BJ,mBAAmB,EAAEA,mBAAoB;QACzChC,yBAAyB,EAAEA,yBAA0B;QACrDC,cAAc,EAAEwC,iBAAiB,CAACxC,cAAe;QACjDE,4BAA4B,EAAEA,4BAA6B;QAC3DC,sBAAsB,EAAEA,sBAAuB;QAC/CC,OAAO,EAAEA,OAAQ;QACjByC,qBAAqB,EAAE1B,0BAA2B;QAElD2B,kBAAkB,EAAEtB,MAAM,CAACC,WAAW,CACpCD,MAAM,CAACE,OAAO,CAACpC,0BAA0B,CAAC,CAACqC,GAAG,CAC5C,CAAC,CAACC,oBAAoB,EAAEC,QAAQ,CAAC,KAAK,CACpCD,oBAAoB,EACpB,IAAAvC,WAAA,CAAA+C,GAAA;UAAMW,IAAI,EAAElB;QAAS,CAAE,CAAC,CAE5B,CACF,CAAE;QACFtB,sBAAsB,EAAEA,sBAAuB;QAC/CyC,iBAAiB,EAAER,iBAAiB,CAACQ,iBAAkB;QACvD/B,sBAAsB,EAAEA,sBAAuB;QAC/CT,qBAAqB,EAAEA;MAAsB,CAC9C;IAAC,CACW,CAChB;IACDyC,uBAAuB,EAAExC,kBAAkB;IAC3CwB;EACF,CAAC,CAAC;EACFxB,kBAAkB,CAACuB,WAAW,CAACD,mBAAmB,CAAC;EAEnD,OAAO;IACL/B,cAAc;IACdkD,iBAAiB,EAAE7B,iCAAiC;IACpDE,eAAe;IACfc;EACF,CAAC;AACH,CAAC;AAAC9C,OAAA,CAAAK,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderUiShell.cjs","names":["_reactErrorBoundary","require","_bufferLatest","_createMessageBus","_UiShell","_useHasUiShell","_renderReactInWebComponent","_jsxRuntime","optionalComponentSlotNames","exports","banners","rightSideMenu","sideNavFooter","topNavLeftSide","topNavRightSide","renderUiShell","appBackgroundColor","appBackgroundContrastMode","appElement","providedAppElement","appElementScrollingMode","hasStandardAppContentPadding","initialVisibleSections","onError","console","error","parentElement","sideNavBackgroundColor","topNavBackgroundColor","document","createElement","setAttribute","uiShellDataAttribute","publish","publishPropChanges","subscribe","subscribeToPropChanges","createMessageBus","publishSubscriptionCreated","subscribeToReactAppSubscribed","publishAfterReactAppReadyForProps","bufferLatest","closeRightSideMenu","subscribeToCloseRightSideMenu","closeSideNavMenu","subscribeToCloseSideNavMenu","slottedElements","Object","fromEntries","entries","map","optionalComponentKey","slotName","element","webComponentChildren","values","uiShellElement","renderReactInWebComponent","getReactComponent","reactRootElements","jsx","ErrorBoundary","fallback","children","UiShell","onSubscriptionCreated","optionalComponents","name","uiShellAppElement","appRootElement","uiShellStylesElement","stylesRootElement","webComponentParentElement","appendChild","setComponentProps"],"sources":["../../../src/ui-shell/renderUiShell.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type SetStateAction } from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nimport { bufferLatest } from \"./bufferLatest.js\";\nimport { createMessageBus } from \"./createMessageBus.js\";\nimport { UiShell, UiShellProps } from \"./UiShell.js\";\nimport { UiShellNavComponentProps } from \"./uiShellContentTypes.js\";\nimport { uiShellDataAttribute } from \"./useHasUiShell.js\";\nimport { renderReactInWebComponent } from \"../web-component/renderReactInWebComponent.js\";\n\nexport const optionalComponentSlotNames: Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n string\n> = {\n banners: \"banners\",\n rightSideMenu: \"right-side-menu\",\n sideNavFooter: \"side-nav-footer\",\n topNavLeftSide: \"top-nav-left-side\",\n topNavRightSide: \"top-nav-right-side\",\n};\n\n/**\n * This function renders UI Shell in a web component.\n * This function is agnostic to the UI framework for your app is using. Your application can be another web component, a React app, or even vanilla HTML.\n *\n * **All styles are self-contained.** Even though your application visually renders as children of the web component, its within the global `document` scope, not the web component's `ShadowRoot`. That means any global styles will not affect UI Shell but will affect your application.\n *\n * It places your app's root element in a web component <slot> and ensures it remains rendered in the event of a UI Shell error.\n * It also provides you with other elements fitted to slots in the web component. **In React, you can portal to these components.**\n */\nexport const renderUiShell = ({\n appBackgroundColor,\n appBackgroundContrastMode,\n appElement: providedAppElement,\n appElementScrollingMode,\n hasStandardAppContentPadding,\n initialVisibleSections,\n onError = console.error,\n parentElement,\n sideNavBackgroundColor,\n topNavBackgroundColor,\n}: {\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, reporting priority 0 issues, and recovering UI Shell when errors occur.\n */\n onError?: () => void;\n /**\n * HTML element used as the container for UI Shell and the App. They're siblings inside this element.\n */\n parentElement: HTMLElement;\n} & Pick<\n UiShellProps,\n | \"appBackgroundColor\"\n | \"appBackgroundContrastMode\"\n | \"appElementScrollingMode\"\n | \"hasStandardAppContentPadding\"\n | \"initialVisibleSections\"\n | \"sideNavBackgroundColor\"\n | \"topNavBackgroundColor\"\n> &\n Partial<Pick<UiShellProps, \"appElement\">>) => {\n const appElement = providedAppElement || document.createElement(\"div\");\n\n // Add this attribute so `PageTemplate` and potentially other components will know if they're in UI Shell with special padding already available.\n parentElement.setAttribute(uiShellDataAttribute, \"\");\n\n const { publish: publishPropChanges, subscribe: subscribeToPropChanges } =\n createMessageBus<SetStateAction<UiShellNavComponentProps>>();\n\n const {\n publish: publishSubscriptionCreated,\n subscribe: subscribeToReactAppSubscribed,\n } = createMessageBus();\n\n const publishAfterReactAppReadyForProps = bufferLatest({\n publish: publishPropChanges,\n subscribe: subscribeToReactAppSubscribed,\n });\n\n const {\n publish: closeRightSideMenu,\n subscribe: subscribeToCloseRightSideMenu,\n } = createMessageBus();\n\n const { publish: closeSideNavMenu, subscribe: subscribeToCloseSideNavMenu } =\n createMessageBus();\n\n const slottedElements = Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => {\n const element = document.createElement(\"div\");\n\n element.setAttribute(\"slot\", slotName);\n\n return [optionalComponentKey, element];\n },\n ),\n ) as Record<\n keyof Required<UiShellProps>[\"optionalComponents\"],\n HTMLDivElement\n >;\n\n const webComponentChildren = Object.values(slottedElements);\n\n const uiShellElement = renderReactInWebComponent({\n getReactComponent: (reactRootElements) => (\n <ErrorBoundary fallback={<div data-error />} onError={onError}>\n <UiShell\n appBackgroundColor={appBackgroundColor}\n appBackgroundContrastMode={appBackgroundContrastMode}\n appElement={appElement}\n appElementScrollingMode={appElementScrollingMode}\n closeSideNavMenu={closeSideNavMenu}\n hasStandardAppContentPadding={hasStandardAppContentPadding}\n initialVisibleSections={initialVisibleSections}\n onError={onError}\n onSubscriptionCreated={publishSubscriptionCreated}\n // `optionalComponents` doesn't need to be memoized because gets passed in once, and this isn't a React component.\n optionalComponents={Object.fromEntries(\n Object.entries(optionalComponentSlotNames).map(\n ([optionalComponentKey, slotName]) => [\n optionalComponentKey,\n <slot name={slotName} />,\n ],\n ),\n )}\n sideNavBackgroundColor={sideNavBackgroundColor}\n subscribeToCloseRightSideMenu={subscribeToCloseRightSideMenu}\n subscribeToCloseSideNavMenu={subscribeToCloseSideNavMenu}\n subscribeToPropChanges={subscribeToPropChanges}\n topNavBackgroundColor={topNavBackgroundColor}\n uiShellAppElement={reactRootElements.appRootElement}\n uiShellStylesElement={reactRootElements.stylesRootElement}\n />\n </ErrorBoundary>\n ),\n webComponentParentElement: parentElement,\n webComponentChildren,\n });\n\n parentElement.appendChild(appElement);\n\n return {\n appElement,\n closeRightSideMenu,\n closeSideNavMenu,\n setComponentProps: publishAfterReactAppReadyForProps,\n slottedElements,\n uiShellElement,\n };\n};\n"],"mappings":";;;;;;AAaA,IAAAA,mBAAA,GAAAC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AACE,OAAO,CAACzC,0BAA0B,CAAC,CAAC0C,GAAG,CAC5C,CAAC,CAACC,oBAAoB,EAAEC,QAAQ,CAAC,KAAK,CACpCD,oBAAoB,EACpB,IAAA5C,WAAA,CAAAqD,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,CAACvD,UAAU,CAAC;EAErC,OAAO;IACLA,UAAU;IACVwB,kBAAkB;IAClBE,gBAAgB;IAChB8B,iBAAiB,EAAElC,iCAAiC;IACpDM,eAAe;IACfU;EACF,CAAC;AACH,CAAC;AAAC/C,OAAA,CAAAM,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.subComponentNames = void 0;
|
|
7
|
+
/*!
|
|
8
|
+
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
9
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
10
|
+
*
|
|
11
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
14
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
*
|
|
16
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const subComponentNames = exports.subComponentNames = ["TopNav", "SideNav", "AppSwitcher"];
|
|
20
|
+
//# sourceMappingURL=uiShellContentTypes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiShellContentTypes.cjs","names":["subComponentNames","exports"],"sources":["../../../src/ui-shell/uiShellContentTypes.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactElement } from \"react\";\nimport { ErrorBoundaryProps } from \"react-error-boundary\";\n\nimport { AppSwitcherProps } from \"./AppSwitcher/AppSwitcher.js\";\nimport { SideNavProps } from \"./SideNav/types.js\";\nimport { TopNavProps } from \"./TopNav/TopNav.js\";\n\nexport const subComponentNames = [\"TopNav\", \"SideNav\", \"AppSwitcher\"] as const;\nexport type SubComponentName = (typeof subComponentNames)[number];\n\nexport type UiShellNavComponentProps = {\n /**\n * Object that gets pass directly to the app switcher component.\n */\n appSwitcherProps?: AppSwitcherProps;\n /**\n * Object that gets pass directly to the side nav component. If `undefined` and in `initialVisibleSections`, SideNav will be initially rendered. Pass `null` to hide a previously-visible SideNav.\n */\n sideNavProps?: Omit<SideNavProps, \"footerComponent\"> | null;\n /**\n * Object that gets pass directly to the top nav component. If `undefined` and in `initialVisibleSections`, TopNav will be initially rendered. Pass `null` to hide a previously-visible TopNav.\n */\n topNavProps?: Omit<\n TopNavProps,\n \"leftSideComponent\" | \"rightSideComponent\"\n > | null;\n};\n\nexport type UiShellContentProps = {\n /**\n * **WARNING:** UI Shell will modify the styling of this element.\n * HTML element where the app gets rendered. This typically called the React root element for your app.\n *\n * When passed, the app is expected to render into this element, not the Shadow DOM.\n *\n * UI Shell will position this element appropriately to match the content area inside the Shadow DOM.\n *\n * A major benefit to having this element separate from UI Shell is related to encapsulation. UI Shell has the capability of rendering inside a web component, but in doing so, the app would be subject to the styles in the web component and not the page itself.\n * The app should either be in its own web component or use the global styles, and having this separate element allows us to accomplish that goal.\n */\n appElement: HTMLDivElement;\n /**\n * Controls the scrolling behavior of the app element area.\n *\n * In the case of an app wanting to control their own scrolling, use `\"none\"`.\n *\n * Most apps will want to use `\"vertical\"` and let UI Shell manage scrolling behavior.\n */\n appElementScrollingMode: \"none\" | \"horizontal\" | \"vertical\" | \"both\";\n /**\n * Defaults to `true`.\n *\n * If `false`, the content area will have no padding provided. This is for the case where an app wants to manage this separate from UI Shell.\n */\n hasStandardAppContentPadding?: boolean;\n /**\n * Parts of UI Shell that are visible when rendered.\n *\n * For example, if `sideNavProps` is `undefined`, should there be a space left for side nav or should that space not exist?\n */\n initialVisibleSections?: SubComponentName[];\n /**\n * Notifies when a React rendering error occurs. This could be useful for logging, flagging \"p0\"s, and recovering UI Shell when errors occur.\n */\n onError?: ErrorBoundaryProps[\"onError\"];\n /**\n * Components that will render as children of various other components such as the top nav or side nav.\n */\n optionalComponents?: {\n /**\n * Spot for banners to go at the top of the page.\n */\n banners?: ReactElement;\n /**\n * In narrow view, this is the right-side menu area.\n */\n rightSideMenu?: ReactElement;\n /**\n * Footer in the side nav.\n */\n sideNavFooter?: SideNavProps[\"footerComponent\"];\n /**\n * Top nav is divided into 2 parts. This is the left-aligned half.\n */\n topNavLeftSide?: TopNavProps[\"leftSideComponent\"];\n /**\n * Top nav is divided into 2 parts. This is the right-aligned half.\n */\n topNavRightSide?: TopNavProps[\"rightSideComponent\"];\n };\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.emptySideNavItems = exports.UI_SHELL_OVERLAY_Z_INDEX = exports.UI_SHELL_BASE_Z_INDEX = exports.TOP_NAV_HEIGHT = exports.SIDE_NAV_WIDTH = exports.SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = void 0;
|
|
7
|
+
/*!
|
|
8
|
+
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
9
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
10
|
+
*
|
|
11
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
14
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
*
|
|
16
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
17
|
+
*/const SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = exports.SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = "77px";
|
|
18
|
+
const SIDE_NAV_WIDTH = exports.SIDE_NAV_WIDTH = "300px";
|
|
19
|
+
const TOP_NAV_HEIGHT = exports.TOP_NAV_HEIGHT = `${64 / 14}rem`;
|
|
20
|
+
const UI_SHELL_BASE_Z_INDEX = exports.UI_SHELL_BASE_Z_INDEX = 100;
|
|
21
|
+
const UI_SHELL_OVERLAY_Z_INDEX = exports.UI_SHELL_OVERLAY_Z_INDEX = 200;
|
|
22
|
+
const emptySideNavItems = exports.emptySideNavItems = [];
|
|
23
|
+
//# sourceMappingURL=uiShellSharedConstants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiShellSharedConstants.cjs","names":["SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION","exports","SIDE_NAV_WIDTH","TOP_NAV_HEIGHT","UI_SHELL_BASE_Z_INDEX","UI_SHELL_OVERLAY_Z_INDEX","emptySideNavItems"],"sources":["../../../src/ui-shell/uiShellSharedConstants.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { SideNavProps } from \"./SideNav/types.js\";\n\n// It's important to bring all our constant values together, so we can change them in one location and ensure the values are all correct relative to each other.\n// This also lends us the capability of swapping these out for a more robust solution in the future.\n\n/* The side nav collapse icon is placed absolutely from the top (Logo container + nav header height) to align it in the middle of the nav header text */\nexport const SIDE_NAV_VISIBILITY_TOGGLE_ICON_POSITION = \"77px\";\n\nexport const SIDE_NAV_WIDTH = \"300px\";\n\nexport const TOP_NAV_HEIGHT = `${64 / 14}rem`;\n\nexport const UI_SHELL_BASE_Z_INDEX = 100;\n\nexport const UI_SHELL_OVERLAY_Z_INDEX = 200;\n\nexport const emptySideNavItems = [] satisfies SideNavProps[\"sideNavItems\"];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAQO,MAAMA,wCAAwC,GAAAC,OAAA,CAAAD,wCAAA,GAAG,MAAM;AAEvD,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,OAAO;AAE9B,MAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK;AAEtC,MAAMC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,GAAG,GAAG;AAEjC,MAAMC,wBAAwB,GAAAJ,OAAA,CAAAI,wBAAA,GAAG,GAAG;AAEpC,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAG,EAAyC","ignoreList":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMatchAppElementToUiShellAppArea = exports.setStylesToMatchElement = exports.convertCamelCaseToKebabCase = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _OdysseyDesignTokensContext = require("../OdysseyDesignTokensContext.cjs");
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
11
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
12
|
+
*
|
|
13
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
16
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
*
|
|
18
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const convertCamelCaseToKebabCase = string => string.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
22
|
+
exports.convertCamelCaseToKebabCase = convertCamelCaseToKebabCase;
|
|
23
|
+
const setStylesToMatchElement = ({
|
|
24
|
+
additionalStyles,
|
|
25
|
+
appContainerElement,
|
|
26
|
+
appContentReferenceElement,
|
|
27
|
+
parentElement
|
|
28
|
+
}) => {
|
|
29
|
+
const appContentReferenceRectangle = appContentReferenceElement.getBoundingClientRect();
|
|
30
|
+
const parentElementRectangle = parentElement.getBoundingClientRect();
|
|
31
|
+
appContainerElement.style.setProperty("position", "absolute");
|
|
32
|
+
appContainerElement.style.setProperty("top", `${appContentReferenceRectangle.top - parentElementRectangle.top}px`);
|
|
33
|
+
appContainerElement.style.setProperty("left", `${appContentReferenceRectangle.left - parentElementRectangle.left}px`);
|
|
34
|
+
appContainerElement.style.setProperty("width", `${appContentReferenceRectangle.width}px`);
|
|
35
|
+
appContainerElement.style.setProperty("height", `${appContentReferenceRectangle.height}px`);
|
|
36
|
+
appContainerElement.style.setProperty("z-index", "1");
|
|
37
|
+
Object.entries(additionalStyles).forEach(([cssPropertyName, cssPropertyValue]) => {
|
|
38
|
+
appContainerElement.style.setProperty(convertCamelCaseToKebabCase(cssPropertyName), String(cssPropertyValue));
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.setStylesToMatchElement = setStylesToMatchElement;
|
|
42
|
+
const useMatchAppElementToUiShellAppArea = ({
|
|
43
|
+
appElement,
|
|
44
|
+
appElementScrollingMode,
|
|
45
|
+
paddingMode,
|
|
46
|
+
uiShellAppAreaRef,
|
|
47
|
+
uiShellResizableRefs
|
|
48
|
+
}) => {
|
|
49
|
+
const odysseyDesignTokens = (0, _OdysseyDesignTokensContext.useOdysseyDesignTokens)();
|
|
50
|
+
const parentContainerRef = (0, _react.useRef)(null);
|
|
51
|
+
const appContainerElementStyles = (0, _react.useMemo)(() => ({
|
|
52
|
+
...(paddingMode === "comfortable" ? {
|
|
53
|
+
paddingBlock: odysseyDesignTokens.Spacing5,
|
|
54
|
+
paddingInline: odysseyDesignTokens.Spacing8
|
|
55
|
+
} : {}),
|
|
56
|
+
...(paddingMode === "compact" ? {
|
|
57
|
+
paddingBlock: odysseyDesignTokens.Spacing5,
|
|
58
|
+
paddingInline: odysseyDesignTokens.Spacing5
|
|
59
|
+
} : {}),
|
|
60
|
+
...(appElementScrollingMode === "horizontal" || appElementScrollingMode === "both" ? {
|
|
61
|
+
overflowX: "auto"
|
|
62
|
+
} : {
|
|
63
|
+
overflowX: "hidden"
|
|
64
|
+
}),
|
|
65
|
+
...(appElementScrollingMode === "vertical" || appElementScrollingMode === "both" ? {
|
|
66
|
+
overflowY: "auto"
|
|
67
|
+
} : {
|
|
68
|
+
overflowY: "hidden"
|
|
69
|
+
})
|
|
70
|
+
}), [appElementScrollingMode, paddingMode, odysseyDesignTokens]);
|
|
71
|
+
(0, _react.useEffect)(() => {
|
|
72
|
+
if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {
|
|
73
|
+
let animationFrameId;
|
|
74
|
+
const updateStyles = () => {
|
|
75
|
+
cancelAnimationFrame(animationFrameId);
|
|
76
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
77
|
+
if (uiShellAppAreaRef.current && parentContainerRef.current) {
|
|
78
|
+
setStylesToMatchElement({
|
|
79
|
+
additionalStyles: appContainerElementStyles,
|
|
80
|
+
appContentReferenceElement: uiShellAppAreaRef.current,
|
|
81
|
+
appContainerElement: appElement,
|
|
82
|
+
parentElement: parentContainerRef.current
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const resizingElements = uiShellResizableRefs.map(resizingRef => resizingRef.current).filter(element => Boolean(element));
|
|
88
|
+
const observer = new ResizeObserver(updateStyles);
|
|
89
|
+
resizingElements.forEach(resizingElement => {
|
|
90
|
+
resizingElement.addEventListener("transitionend", updateStyles);
|
|
91
|
+
observer.observe(resizingElement);
|
|
92
|
+
});
|
|
93
|
+
updateStyles();
|
|
94
|
+
return () => {
|
|
95
|
+
observer.disconnect();
|
|
96
|
+
resizingElements.forEach(resizingElement => {
|
|
97
|
+
resizingElement.removeEventListener("transitionend", updateStyles);
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return () => {};
|
|
102
|
+
}, [appElement, appContainerElementStyles, uiShellAppAreaRef]);
|
|
103
|
+
return {
|
|
104
|
+
parentContainerRef
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
exports.useMatchAppElementToUiShellAppArea = useMatchAppElementToUiShellAppArea;
|
|
108
|
+
//# sourceMappingURL=useMatchAppElementToUiShellAppArea.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMatchAppElementToUiShellAppArea.cjs","names":["_react","require","_OdysseyDesignTokensContext","convertCamelCaseToKebabCase","string","replace","toLowerCase","exports","setStylesToMatchElement","additionalStyles","appContainerElement","appContentReferenceElement","parentElement","appContentReferenceRectangle","getBoundingClientRect","parentElementRectangle","style","setProperty","top","left","width","height","Object","entries","forEach","cssPropertyName","cssPropertyValue","String","useMatchAppElementToUiShellAppArea","appElement","appElementScrollingMode","paddingMode","uiShellAppAreaRef","uiShellResizableRefs","odysseyDesignTokens","useOdysseyDesignTokens","parentContainerRef","useRef","appContainerElementStyles","useMemo","paddingBlock","Spacing5","paddingInline","Spacing8","overflowX","overflowY","useEffect","current","animationFrameId","updateStyles","cancelAnimationFrame","requestAnimationFrame","resizingElements","map","resizingRef","filter","element","Boolean","observer","ResizeObserver","resizingElement","addEventListener","observe","disconnect","removeEventListener"],"sources":["../../../src/ui-shell/useMatchAppElementToUiShellAppArea.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, RefObject, useEffect, useMemo, useRef } from \"react\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext.js\";\nimport { UiShellContentProps } from \"./uiShellContentTypes.js\";\n\nexport const convertCamelCaseToKebabCase = (string: string) =>\n string.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n\nexport const setStylesToMatchElement = ({\n additionalStyles,\n appContainerElement,\n appContentReferenceElement,\n parentElement,\n}: {\n additionalStyles: CSSProperties;\n appContainerElement: HTMLElement;\n appContentReferenceElement: HTMLElement;\n parentElement: HTMLElement;\n}) => {\n const appContentReferenceRectangle =\n appContentReferenceElement.getBoundingClientRect();\n const parentElementRectangle = parentElement.getBoundingClientRect();\n\n appContainerElement.style.setProperty(\"position\", \"absolute\");\n appContainerElement.style.setProperty(\n \"top\",\n `${appContentReferenceRectangle.top - parentElementRectangle.top}px`,\n );\n appContainerElement.style.setProperty(\n \"left\",\n `${appContentReferenceRectangle.left - parentElementRectangle.left}px`,\n );\n appContainerElement.style.setProperty(\n \"width\",\n `${appContentReferenceRectangle.width}px`,\n );\n appContainerElement.style.setProperty(\n \"height\",\n `${appContentReferenceRectangle.height}px`,\n );\n appContainerElement.style.setProperty(\"z-index\", \"1\");\n\n (\n Object.entries(additionalStyles) as Array<\n [\n keyof typeof additionalStyles,\n (typeof additionalStyles)[keyof typeof additionalStyles],\n ]\n >\n ).forEach(([cssPropertyName, cssPropertyValue]) => {\n appContainerElement.style.setProperty(\n convertCamelCaseToKebabCase(cssPropertyName),\n String(cssPropertyValue),\n );\n });\n};\n\nexport type UseMatchAppElementToUiShellAppAreaProps = {\n /**\n * Padding around the app area. \"comfortable\" is designed for wider views whereas \"compact\" is designed for narrower views.\n */\n paddingMode: \"comfortable\" | \"compact\" | \"none\";\n /**\n * Ref for the App Container in UI Shell. This should be the one inside the Shell, **not** the element we're going to align.\n */\n uiShellAppAreaRef: RefObject<HTMLDivElement>;\n /**\n * Array of refs of items that indirectly resize the app content area such as \"side nav\" and \"top nav\".\n */\n uiShellResizableRefs: Array<RefObject<HTMLDivElement>>;\n} & Pick<UiShellContentProps, \"appElement\" | \"appElementScrollingMode\">;\n\nexport const useMatchAppElementToUiShellAppArea = ({\n appElement,\n appElementScrollingMode,\n paddingMode,\n uiShellAppAreaRef,\n uiShellResizableRefs,\n}: UseMatchAppElementToUiShellAppAreaProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const parentContainerRef = useRef<HTMLDivElement>(null);\n\n const appContainerElementStyles = useMemo<CSSProperties>(\n () => ({\n ...(paddingMode === \"comfortable\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing8,\n }\n : {}),\n ...(paddingMode === \"compact\"\n ? {\n paddingBlock: odysseyDesignTokens.Spacing5,\n paddingInline: odysseyDesignTokens.Spacing5,\n }\n : {}),\n ...(appElementScrollingMode === \"horizontal\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowX: \"auto\",\n }\n : {\n overflowX: \"hidden\",\n }),\n ...(appElementScrollingMode === \"vertical\" ||\n appElementScrollingMode === \"both\"\n ? {\n overflowY: \"auto\",\n }\n : {\n overflowY: \"hidden\",\n }),\n }),\n [appElementScrollingMode, paddingMode, odysseyDesignTokens],\n );\n\n useEffect(() => {\n // Once `appContainerRef` is rendered, we can position `appContainerElement` on top to match.\n if (uiShellAppAreaRef.current && appElement && parentContainerRef.current) {\n let animationFrameId: number;\n\n const updateStyles = () => {\n cancelAnimationFrame(animationFrameId);\n\n animationFrameId = requestAnimationFrame(() => {\n if (uiShellAppAreaRef.current && parentContainerRef.current) {\n setStylesToMatchElement({\n additionalStyles: appContainerElementStyles,\n appContentReferenceElement: uiShellAppAreaRef.current,\n appContainerElement: appElement,\n parentElement: parentContainerRef.current,\n });\n }\n });\n };\n\n // These refs might change by the time we unsubscribe, so we need to keep references to the original elements.\n const resizingElements = uiShellResizableRefs\n .map((resizingRef) => resizingRef.current)\n .filter((element): element is NonNullable<typeof element> =>\n Boolean(element),\n );\n\n // Set up a mutation observer to sync later updates\n const observer = new ResizeObserver(updateStyles);\n\n // document.addEventListener(\"ready\", updateStyles);\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.addEventListener(\"transitionend\", updateStyles);\n\n observer.observe(resizingElement);\n });\n\n // Set the initial styles\n updateStyles();\n\n return () => {\n observer.disconnect();\n\n resizingElements.forEach((resizingElement) => {\n resizingElement.removeEventListener(\"transitionend\", updateStyles);\n });\n };\n }\n return () => {};\n }, [appElement, appContainerElementStyles, uiShellAppAreaRef]);\n\n return {\n parentContainerRef,\n };\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,MAAME,2BAA2B,GAAIC,MAAc,IACxDA,MAAM,CAACC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAACC,WAAW,CAAC,CAAC;AAACC,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA;AAE3C,MAAMK,uBAAuB,GAAGA,CAAC;EACtCC,gBAAgB;EAChBC,mBAAmB;EACnBC,0BAA0B;EAC1BC;AAMF,CAAC,KAAK;EACJ,MAAMC,4BAA4B,GAChCF,0BAA0B,CAACG,qBAAqB,CAAC,CAAC;EACpD,MAAMC,sBAAsB,GAAGH,aAAa,CAACE,qBAAqB,CAAC,CAAC;EAEpEJ,mBAAmB,CAACM,KAAK,CAACC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;EAC7DP,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,KAAK,EACL,GAAGJ,4BAA4B,CAACK,GAAG,GAAGH,sBAAsB,CAACG,GAAG,IAClE,CAAC;EACDR,mBAAmB,CAACM,KAAK,CAACC,WAAW,CACnC,MAAM,EACN,GAAGJ,4BAA4B,CAACM,IAAI,GAAGJ,sBAAsB,CAACI,IAAI,IACpE,CAAC;EACDT,mBAAmB,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M;QACXS,QAAQ,CAACK,UAAU,CAAC,CAAC;QAErBX,gBAAgB,CAAC5B,OAAO,CAAEoC,eAAe,IAAK;UAC5CA,eAAe,CAACI,mBAAmB,CAAC,eAAe,EAAEf,YAAY,CAAC;QACpE,CAAC,CAAC;MACJ,CAAC;IACH;IACA,OAAO,MAAM,CAAC,CAAC;EACjB,CAAC,EAAE,CAACpB,UAAU,EAAES,yBAAyB,EAAEN,iBAAiB,CAAC,CAAC;EAE9D,OAAO;IACLI;EACF,CAAC;AACH,CAAC;AAAC7B,OAAA,CAAAqB,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
|
@@ -19,8 +19,7 @@ var _react = require("react");
|
|
|
19
19
|
|
|
20
20
|
const useScrollState = scrollableContentElement => {
|
|
21
21
|
const [isContentScrolled, setIsContentScrolled] = (0, _react.useState)(false);
|
|
22
|
-
const
|
|
23
|
-
const scrollableElement = (0, _react.useMemo)(() => scrollableContentElement ?? scrollableContentRef.current, [scrollableContentElement, scrollableContentRef.current]);
|
|
22
|
+
const scrollableElement = (0, _react.useMemo)(() => scrollableContentElement, [scrollableContentElement]);
|
|
24
23
|
(0, _react.useEffect)(() => {
|
|
25
24
|
if (scrollableElement) {
|
|
26
25
|
let requestedAnimationFrameId;
|
|
@@ -40,8 +39,7 @@ const useScrollState = scrollableContentElement => {
|
|
|
40
39
|
return () => {};
|
|
41
40
|
}, [scrollableElement]);
|
|
42
41
|
return {
|
|
43
|
-
isContentScrolled
|
|
44
|
-
scrollableContentRef
|
|
42
|
+
isContentScrolled
|
|
45
43
|
};
|
|
46
44
|
};
|
|
47
45
|
exports.useScrollState = useScrollState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollState.cjs","names":["_react","require","useScrollState","scrollableContentElement","isContentScrolled","setIsContentScrolled","useState","
|
|
1
|
+
{"version":3,"file":"useScrollState.cjs","names":["_react","require","useScrollState","scrollableContentElement","isContentScrolled","setIsContentScrolled","useState","scrollableElement","useMemo","useEffect","requestedAnimationFrameId","updateScrollState","cancelAnimationFrame","requestAnimationFrame","scrollTop","addEventListener","removeEventListener","exports"],"sources":["../../../src/ui-shell/useScrollState.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useEffect, useMemo, useState } from \"react\";\n\nexport const useScrollState = <\n ScrollableContentElement extends HTMLElement = HTMLDivElement,\n>(\n scrollableContentElement?: ScrollableContentElement,\n) => {\n const [isContentScrolled, setIsContentScrolled] = useState(false);\n\n const scrollableElement = useMemo(\n () => scrollableContentElement,\n [scrollableContentElement],\n );\n\n useEffect(() => {\n if (scrollableElement) {\n let requestedAnimationFrameId: number;\n\n const updateScrollState = () => {\n cancelAnimationFrame(requestedAnimationFrameId);\n\n requestedAnimationFrameId = requestAnimationFrame(() => {\n setIsContentScrolled(scrollableElement.scrollTop > 0);\n });\n };\n\n scrollableElement.addEventListener(\"scroll\", updateScrollState);\n\n updateScrollState();\n\n return () => {\n scrollableElement.removeEventListener(\"scroll\", updateScrollState);\n\n cancelAnimationFrame(requestedAnimationFrameId);\n };\n }\n\n return () => {};\n }, [scrollableElement]);\n\n return {\n isContentScrolled,\n };\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,cAAc,GAGzBC,wBAAmD,IAChD;EACH,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAEjE,MAAMC,iBAAiB,GAAG,IAAAC,cAAO,EAC/B,MAAML,wBAAwB,EAC9B,CAACA,wBAAwB,CAC3B,CAAC;EAED,IAAAM,gBAAS,EAAC,MAAM;IACd,IAAIF,iBAAiB,EAAE;MACrB,IAAIG,yBAAiC;MAErC,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;QAC9BC,oBAAoB,CAACF,yBAAyB,CAAC;QAE/CA,yBAAyB,GAAGG,qBAAqB,CAAC,MAAM;UACtDR,oBAAoB,CAACE,iBAAiB,CAACO,SAAS,GAAG,CAAC,CAAC;QACvD,CAAC,CAAC;MACJ,CAAC;MAEDP,iBAAiB,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,iBAAiB,CAAC;MAE/DA,iBAAiB,CAAC,CAAC;MAEnB,OAAO,MAAM;QACXJ,iBAAiB,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,iBAAiB,CAAC;QAElEC,oBAAoB,CAACF,yBAAyB,CAAC;MACjD,CAAC;IACH;IAEA,OAAO,MAAM,CAAC,CAAC;EACjB,CAAC,EAAE,CAACH,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IACLH;EACF,CAAC;AACH,CAAC;AAACa,OAAA,CAAAf,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useUiShellBreakpoints = exports.uiShellBreakpoint = void 0;
|
|
7
|
+
var _useMediaQuery = require("../theme/useMediaQuery.cjs");
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
10
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
11
|
+
*
|
|
12
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
15
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
*
|
|
17
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const uiShellBreakpoint = exports.uiShellBreakpoint = {
|
|
21
|
+
comfortable: 800,
|
|
22
|
+
compact: 600,
|
|
23
|
+
constrained: 0
|
|
24
|
+
};
|
|
25
|
+
const useUiShellBreakpoints = () => {
|
|
26
|
+
const isConstrainedView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${uiShellBreakpoint.constrained}px)`);
|
|
27
|
+
const isCompactView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${uiShellBreakpoint.compact}px)`);
|
|
28
|
+
const isComfortableView = (0, _useMediaQuery.useMediaQuery)(`(min-width: ${uiShellBreakpoint.comfortable}px)`);
|
|
29
|
+
if (isComfortableView) {
|
|
30
|
+
return "comfortable";
|
|
31
|
+
}
|
|
32
|
+
if (isCompactView) {
|
|
33
|
+
return "compact";
|
|
34
|
+
}
|
|
35
|
+
if (isConstrainedView) {
|
|
36
|
+
return "constrained";
|
|
37
|
+
}
|
|
38
|
+
return "none";
|
|
39
|
+
};
|
|
40
|
+
exports.useUiShellBreakpoints = useUiShellBreakpoints;
|
|
41
|
+
//# sourceMappingURL=useUiShellBreakpoints.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUiShellBreakpoints.cjs","names":["_useMediaQuery","require","uiShellBreakpoint","exports","comfortable","compact","constrained","useUiShellBreakpoints","isConstrainedView","useMediaQuery","isCompactView","isComfortableView"],"sources":["../../../src/ui-shell/useUiShellBreakpoints.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useMediaQuery } from \"../theme/useMediaQuery.js\";\n\nexport const uiShellBreakpoint = {\n comfortable: 800,\n compact: 600,\n constrained: 0,\n} as const;\n\nexport const useUiShellBreakpoints = ():\n | keyof typeof uiShellBreakpoint\n | \"none\" => {\n const isConstrainedView = useMediaQuery(\n `(min-width: ${uiShellBreakpoint.constrained}px)`,\n );\n\n const isCompactView = useMediaQuery(\n `(min-width: ${uiShellBreakpoint.compact}px)`,\n );\n\n const isComfortableView = useMediaQuery(\n `(min-width: ${uiShellBreakpoint.comfortable}px)`,\n );\n\n if (isComfortableView) {\n return \"comfortable\";\n }\n\n if (isCompactView) {\n return \"compact\";\n }\n\n if (isConstrainedView) {\n return \"constrained\";\n }\n\n // For the initial page load as we don't have media queries until the page loads.\n return \"none\";\n};\n"],"mappings":";;;;;;AAYA,IAAAA,cAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,WAAW,EAAE,GAAG;EAChBC,OAAO,EAAE,GAAG;EACZC,WAAW,EAAE;AACf,CAAU;AAEH,MAAMC,qBAAqB,GAAGA,CAAA,KAEvB;EACZ,MAAMC,iBAAiB,GAAG,IAAAC,4BAAa,EACrC,eAAeP,iBAAiB,CAACI,WAAW,KAC9C,CAAC;EAED,MAAMI,aAAa,GAAG,IAAAD,4BAAa,EACjC,eAAeP,iBAAiB,CAACG,OAAO,KAC1C,CAAC;EAED,MAAMM,iBAAiB,GAAG,IAAAF,4BAAa,EACrC,eAAeP,iBAAiB,CAACE,WAAW,KAC9C,CAAC;EAED,IAAIO,iBAAiB,EAAE;IACrB,OAAO,aAAa;EACtB;EAEA,IAAID,aAAa,EAAE;IACjB,OAAO,SAAS;EAClB;EAEA,IAAIF,iBAAiB,EAAE;IACrB,OAAO,aAAa;EACtB;EAGA,OAAO,MAAM;AACf,CAAC;AAACL,OAAA,CAAAI,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createReactRootElements.cjs","names":["createReactRootElements","appRootElement","document","createElement","stylesRootElement","style","setProperty","setAttribute","window","cspNonce","exports"],"sources":["../../../src/web-component/createReactRootElements.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport const createReactRootElements = () => {\n const appRootElement = document.createElement(\"div\");\n const stylesRootElement = document.createElement(\"div\");\n\n // This `div` may cause layout issues unless it inherits the parent's height.\n appRootElement.style.setProperty(\"height\", \"inherit\");\n\n appRootElement.setAttribute(\"id\", \"app-root\");\n stylesRootElement.setAttribute(\"id\", \"style-root\");\n stylesRootElement.setAttribute(\"nonce\", window.cspNonce);\n\n return {\n
|
|
1
|
+
{"version":3,"file":"createReactRootElements.cjs","names":["createReactRootElements","appRootElement","document","createElement","stylesRootElement","style","setProperty","setAttribute","window","cspNonce","exports"],"sources":["../../../src/web-component/createReactRootElements.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport type ReactRootElements = {\n /**\n * The element your root React component renders into.\n * React has to render or portal somewhere, and this element can be used for that root element.\n */\n appRootElement: HTMLDivElement;\n /**\n * In React apps, your styles typically go in `document.head`, but you may want to render them somewhere else.\n *\n * Specifically when rendering in a web component, there is no `<head>`, so you have to create a spot for styles to render.\n */\n stylesRootElement: HTMLDivElement | HTMLHeadElement;\n};\n\nexport const createReactRootElements = () => {\n const appRootElement = document.createElement(\"div\");\n const stylesRootElement = document.createElement(\"div\");\n\n // This `div` may cause layout issues unless it inherits the parent's height.\n appRootElement.style.setProperty(\"height\", \"inherit\");\n\n appRootElement.setAttribute(\"id\", \"app-root\");\n stylesRootElement.setAttribute(\"id\", \"style-root\");\n stylesRootElement.setAttribute(\"nonce\", window.cspNonce);\n\n return {\n appRootElement,\n stylesRootElement,\n } satisfies ReactRootElements;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBO,MAAMA,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,cAAc,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACpD,MAAMC,iBAAiB,GAAGF,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAGvDF,cAAc,CAACI,KAAK,CAACC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC;EAErDL,cAAc,CAACM,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC;EAC7CH,iBAAiB,CAACG,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC;EAClDH,iBAAiB,CAACG,YAAY,CAAC,OAAO,EAAEC,MAAM,CAACC,QAAQ,CAAC;EAExD,OAAO;IACLR,cAAc;IACdG;EACF,CAAC;AACH,CAAC;AAACM,OAAA,CAAAV,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -78,6 +78,7 @@ if ("customElements" in globalThis && !customElements.get(reactWebComponentEleme
|
|
|
78
78
|
const renderReactInWebComponent = ({
|
|
79
79
|
getReactComponent,
|
|
80
80
|
webComponentChildren,
|
|
81
|
+
webComponentParentElement,
|
|
81
82
|
webComponentRootElement
|
|
82
83
|
}) => {
|
|
83
84
|
const reactElement = new ReactInWebComponentElement(getReactComponent);
|
|
@@ -86,7 +87,11 @@ const renderReactInWebComponent = ({
|
|
|
86
87
|
reactElement.appendChild(webComponentChild);
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
if (webComponentParentElement) {
|
|
91
|
+
webComponentParentElement.appendChild(reactElement);
|
|
92
|
+
} else if (webComponentRootElement) {
|
|
93
|
+
webComponentRootElement.appendChild(reactElement);
|
|
94
|
+
}
|
|
90
95
|
return reactElement;
|
|
91
96
|
};
|
|
92
97
|
exports.renderReactInWebComponent = renderReactInWebComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderReactInWebComponent.cjs","names":["_createReactRootElements","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","reactWebComponentElementName","exports","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","ReactInWebComponentElement","constructor","getReactComponent","reactRootElements","createReactRootElements","styleElement","document","createElement","shadowRoot","attachShadow","mode","innerHTML","setAttribute","window","cspNonce","stylesRootElement","appendChild","appRootElement","reactRootPromise","specifier","Promise","then","s","createRoot","connectedCallback","reactRoot","render","disconnectedCallback","unmount","customElements","define","renderReactInWebComponent","webComponentChildren","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\n\nimport { createReactRootElements } from \"./createReactRootElements.js\";\n\nexport type ReactRootElements = ReturnType<typeof createReactRootElements>;\n\nexport const reactWebComponentElementName = \"odyssey-react-web-component\";\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {\n getReactComponent: GetReactComponentInWebComponent;\n reactRootElements: ReactRootElements;\n reactRootPromise: Promise<Root>;\n\n constructor(getReactComponent: GetReactComponentInWebComponent) {\n super();\n\n this.getReactComponent = getReactComponent;\n this.reactRootElements = createReactRootElements();\n\n const styleElement = document.createElement(\"style\");\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n\n styleElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n\n styleElement.setAttribute(\"nonce\", window.cspNonce);\n\n this.reactRootElements.stylesRootElement.appendChild(styleElement);\n shadowRoot.appendChild(this.reactRootElements.stylesRootElement);\n shadowRoot.appendChild(this.reactRootElements.appRootElement);\n\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n this.reactRootPromise = import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.reactRootElements.appRootElement),\n );\n }\n\n connectedCallback() {\n this.reactRootPromise.then((reactRoot) =>\n reactRoot.render(this.getReactComponent(this.reactRootElements)),\n );\n }\n\n disconnectedCallback() {\n this.reactRootPromise.then((reactRoot) => reactRoot.unmount());\n }\n}\n\nif (\n \"customElements\" in globalThis &&\n !customElements.get(reactWebComponentElementName)\n) {\n customElements.define(\n reactWebComponentElementName,\n ReactInWebComponentElement,\n );\n}\n\nexport type RenderReactInWebComponentProps = {\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n /**\n * You 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 webComponentRootElement: HTMLElement;\n};\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n getReactComponent,\n webComponentChildren,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = new ReactInWebComponentElement(getReactComponent);\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n webComponentRootElement.appendChild(reactElement);\n\n return reactElement;\n};\n"],"mappings":";;;;;;AAeA,IAAAA,wBAAA,GAAAC,OAAA;AAAuE,SAAAC,yBAAAC,CAAA,6BAAAC,OA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,4BAA4B,EAC5BK,0BACF,CAAC;AACH;AAiCO,MAAM+B,yBAAyB,GAAGA,CAAC;EACxC7B,iBAAiB;EACjB8B,oBAAoB;EACpBC;AAC8B,CAAC,KAAK;EACpC,MAAMC,YAAY,GAAG,IAAIlC,0BAA0B,CAACE,iBAAiB,CAAC;EAEtE,IAAI8B,oBAAoB,EAAE;IACxB,CAACG,KAAK,CAACC,OAAO,CAACJ,oBAAoB,CAAC,GAChCA,oBAAoB,GACpB,CAACA,oBAAoB,CAAC,EACxBK,OAAO,CAAEC,iBAAiB,IAAK;MAC/BJ,YAAY,CAAClB,WAAW,CAACsB,iBAAiB,CAAC;IAC7C,CAAC,CAAC;EACJ;EAEAL,uBAAuB,CAACjB,WAAW,CAACkB,YAAY,CAAC;EAEjD,OAAOA,YAAY;AACrB,CAAC;AAACtC,OAAA,CAAAmC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"renderReactInWebComponent.cjs","names":["_createReactRootElements","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","__transformExtension","filepath","extMapping","startsWith","idx","lastIndexOf","includes","newExt","origExt","entries","sort","b","length","endsWith","slice","reactWebComponentElementName","exports","SsrFriendlyHtmlElementClass","globalThis","HTMLElement","ReactInWebComponentElement","constructor","getReactComponent","reactRootElements","createReactRootElements","styleElement","document","createElement","shadowRoot","attachShadow","mode","innerHTML","setAttribute","window","cspNonce","stylesRootElement","appendChild","appRootElement","reactRootPromise","specifier","Promise","then","s","createRoot","connectedCallback","reactRoot","render","disconnectedCallback","unmount","customElements","define","renderReactInWebComponent","webComponentChildren","webComponentParentElement","webComponentRootElement","reactElement","Array","isArray","forEach","webComponentChild"],"sources":["../../../src/web-component/renderReactInWebComponent.ts"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { type ReactNode } from \"react\";\nimport type { Root } from \"react-dom/client\";\n\nimport {\n createReactRootElements,\n type ReactRootElements,\n} from \"./createReactRootElements.js\";\n\nexport const reactWebComponentElementName = \"odyssey-react-web-component\";\n\nexport type GetReactComponentInWebComponent = (\n reactRootElements: ReactRootElements,\n) => ReactNode;\n\nconst SsrFriendlyHtmlElementClass =\n \"HTMLElement\" in globalThis\n ? HTMLElement\n : (class {} as unknown as typeof globalThis.HTMLElement);\n\nexport class ReactInWebComponentElement extends SsrFriendlyHtmlElementClass {\n getReactComponent: GetReactComponentInWebComponent;\n reactRootElements: ReactRootElements;\n reactRootPromise: Promise<Root>;\n\n constructor(getReactComponent: GetReactComponentInWebComponent) {\n super();\n\n this.getReactComponent = getReactComponent;\n this.reactRootElements = createReactRootElements();\n\n const styleElement = document.createElement(\"style\");\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n\n styleElement.innerHTML = `\n :host {\n all: initial;\n contain: content;\n }\n `;\n\n styleElement.setAttribute(\"nonce\", window.cspNonce);\n\n this.reactRootElements.stylesRootElement.appendChild(styleElement);\n shadowRoot.appendChild(this.reactRootElements.stylesRootElement);\n shadowRoot.appendChild(this.reactRootElements.appRootElement);\n\n // If we want to support React v17 in the future, we can use a try-catch on the import to grab the old `ReactDOM.render` function if `react-dom/client` errors. --Kevin Ghadyani\n this.reactRootPromise = import(\"react-dom/client\").then(({ createRoot }) =>\n createRoot(this.reactRootElements.appRootElement),\n );\n }\n\n connectedCallback() {\n this.reactRootPromise.then((reactRoot) =>\n reactRoot.render(this.getReactComponent(this.reactRootElements)),\n );\n }\n\n disconnectedCallback() {\n this.reactRootPromise.then((reactRoot) => reactRoot.unmount());\n }\n}\n\nif (\n \"customElements\" in globalThis &&\n !customElements.get(reactWebComponentElementName)\n) {\n customElements.define(\n reactWebComponentElementName,\n ReactInWebComponentElement,\n );\n}\n\nexport type RenderReactInWebComponentProps = {\n /**\n * This is a callback function for rendering your React component or app in the Web Component.\n * It gives you access to the Shadow DOM elements if you need them for Odyssey, Emotion, or MUI.\n *\n * You will need to add `<slot>` elements if you want to pass child elements or components or React apps.\n * You can have multiple slots in your app if you add a `name` attribute to your `<slot>` elements.\n */\n getReactComponent: GetReactComponentInWebComponent;\n /**\n * One or more HTML elements that are going to render as `children` of the web component.\n * If your React component doesn't take children, this is unnecessary.\n *\n * Typically, a React app root element is passed, but it can include an array of other elements if there are multiple slots for children.\n *\n * You will need to have rendered `<slot>` elements in your React component or `children` won't show up.\n */\n webComponentChildren?: HTMLElement | HTMLElement[];\n} & (\n | {\n /**\n * The React app renders in the web component, but the web component needs to be rendered in the document.\n *\n * This is the element the web component is rendered into.\n */\n webComponentParentElement: HTMLElement;\n webComponentRootElement?: never;\n }\n | {\n webComponentParentElement?: HTMLElement;\n /**\n * @deprecated Use `webComponentParentElement` instead.\n */\n webComponentRootElement: HTMLElement;\n }\n);\n\n/**\n * Lets you render React apps or components in a Web Component.\n *\n * This is useful when global styles are causing conflicts with your React components.\n */\nexport const renderReactInWebComponent = ({\n getReactComponent,\n webComponentChildren,\n webComponentParentElement,\n webComponentRootElement,\n}: RenderReactInWebComponentProps) => {\n const reactElement = new ReactInWebComponentElement(getReactComponent);\n\n if (webComponentChildren) {\n (Array.isArray(webComponentChildren)\n ? webComponentChildren\n : [webComponentChildren]\n ).forEach((webComponentChild) => {\n reactElement.appendChild(webComponentChild);\n });\n }\n\n if (webComponentParentElement) {\n webComponentParentElement.appendChild(reactElement);\n }\n // Remove this condition when `webComponentRootElement` is no longer a prop.\n else if (webComponentRootElement) {\n webComponentRootElement.appendChild(reactElement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AgB,IAAIF,UAAU,IAC9B,CAAC+B,cAAc,CAAC7D,GAAG,CAAC2B,4BAA4B,CAAC,EACjD;EACAkC,cAAc,CAACC,MAAM,CACnBnC,4BAA4B,EAC5BK,0BACF,CAAC;AACH;AA4CO,MAAM+B,yBAAyB,GAAGA,CAAC;EACxC7B,iBAAiB;EACjB8B,oBAAoB;EACpBC,yBAAyB;EACzBC;AAC8B,CAAC,KAAK;EACpC,MAAMC,YAAY,GAAG,IAAInC,0BAA0B,CAACE,iBAAiB,CAAC;EAEtE,IAAI8B,oBAAoB,EAAE;IACxB,CAACI,KAAK,CAACC,OAAO,CAACL,oBAAoB,CAAC,GAChCA,oBAAoB,GACpB,CAACA,oBAAoB,CAAC,EACxBM,OAAO,CAAEC,iBAAiB,IAAK;MAC/BJ,YAAY,CAACnB,WAAW,CAACuB,iBAAiB,CAAC;IAC7C,CAAC,CAAC;EACJ;EAEA,IAAIN,yBAAyB,EAAE;IAC7BA,yBAAyB,CAACjB,WAAW,CAACmB,YAAY,CAAC;EACrD,CAAC,MAEI,IAAID,uBAAuB,EAAE;IAChCA,uBAAuB,CAAClB,WAAW,CAACmB,YAAY,CAAC;EACnD;EAEA,OAAOA,YAAY;AACrB,CAAC;AAACvC,OAAA,CAAAmC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/dist/esm/Autocomplete.js
CHANGED
|
@@ -120,7 +120,7 @@ const Autocomplete = ({
|
|
|
120
120
|
fullWidth: isFullWidth,
|
|
121
121
|
loading: isLoading,
|
|
122
122
|
multiple: hasMultipleChoices,
|
|
123
|
-
noOptionsText: noOptionsText,
|
|
123
|
+
noOptionsText: noOptionsText || t("autocomplete.nooptions"),
|
|
124
124
|
onBlur: onBlur,
|
|
125
125
|
onChange: onChange,
|
|
126
126
|
onInputChange: onInputChange,
|