@okta/odyssey-react-mui 1.24.1 → 1.26.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/CHANGELOG.md +21 -0
- package/dist/Autocomplete.js +30 -191
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Box.js +2 -0
- package/dist/Box.js.map +1 -1
- package/dist/Card.js +1 -0
- package/dist/Card.js.map +1 -1
- package/dist/OdysseyDesignTokensContext.js +3 -2
- package/dist/OdysseyDesignTokensContext.js.map +1 -1
- package/dist/OdysseyProvider.js +22 -40
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +33 -12
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/OdysseyTranslationProvider.types.js +1 -1
- package/dist/OdysseyTranslationProvider.types.js.map +1 -1
- package/dist/Pagination/Pagination.js +46 -14
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/Select.js +10 -2
- package/dist/Select.js.map +1 -1
- package/dist/Surface.js +4 -1
- package/dist/Surface.js.map +1 -1
- package/dist/Tag.js +97 -47
- package/dist/Tag.js.map +1 -1
- package/dist/i18n.js +2 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/index.scss +1 -1
- package/dist/labs/AppTile.js +137 -39
- package/dist/labs/AppTile.js.map +1 -1
- package/dist/labs/DataView/CardLayoutContent.js +7 -8
- package/dist/labs/DataView/CardLayoutContent.js.map +1 -1
- package/dist/labs/DataView/DataCard.js +96 -43
- package/dist/labs/DataView/DataCard.js.map +1 -1
- package/dist/labs/DataView/TableLayoutContent.js +3 -2
- package/dist/labs/DataView/TableLayoutContent.js.map +1 -1
- package/dist/labs/DataView/componentTypes.js.map +1 -1
- package/dist/labs/DataView/index.js.map +1 -1
- package/dist/labs/OdysseyPickers/ComposablePicker.js +113 -0
- package/dist/labs/OdysseyPickers/ComposablePicker.js.map +1 -0
- package/dist/labs/OdysseyPickers/Picker.js +261 -0
- package/dist/labs/OdysseyPickers/Picker.js.map +1 -0
- package/dist/labs/OdysseyPickers/PickerVirtualizationListBox.js +132 -0
- package/dist/labs/OdysseyPickers/PickerVirtualizationListBox.js.map +1 -0
- package/dist/labs/OdysseyPickers/PickerWithOptionAdornment.js +291 -0
- package/dist/labs/OdysseyPickers/PickerWithOptionAdornment.js.map +1 -0
- package/dist/{src/createShadowDomElements.d.ts → labs/OdysseyPickers/index.js} +4 -7
- package/dist/labs/OdysseyPickers/index.js.map +1 -0
- package/dist/labs/PageTemplate.js +14 -10
- package/dist/labs/PageTemplate.js.map +1 -1
- package/dist/labs/SideNav/CollapseIcon.js +11 -25
- package/dist/labs/SideNav/CollapseIcon.js.map +1 -1
- package/dist/labs/SideNav/HandleIcon.js +32 -0
- package/dist/labs/SideNav/HandleIcon.js.map +1 -0
- package/dist/labs/{NavAccordion.js → SideNav/NavAccordion.js} +35 -6
- package/dist/labs/SideNav/NavAccordion.js.map +1 -0
- package/dist/labs/SideNav/OktaAura.js +32 -0
- package/dist/labs/SideNav/OktaAura.js.map +1 -0
- package/dist/labs/SideNav/OktaLogo.js +6 -9
- package/dist/labs/SideNav/OktaLogo.js.map +1 -1
- package/dist/labs/SideNav/SideNav.js +239 -169
- package/dist/labs/SideNav/SideNav.js.map +1 -1
- package/dist/labs/SideNav/SideNavFooterContent.js +32 -18
- package/dist/labs/SideNav/SideNavFooterContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavHeader.js +48 -37
- package/dist/labs/SideNav/SideNavHeader.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemContent.js +100 -58
- package/dist/labs/SideNav/SideNavItemContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemContentContext.js +19 -0
- package/dist/labs/SideNav/SideNavItemContentContext.js.map +1 -0
- package/dist/labs/SideNav/SideNavItemLinkContent.js +14 -13
- package/dist/labs/SideNav/SideNavItemLinkContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavLogo.js +42 -0
- package/dist/labs/SideNav/SideNavLogo.js.map +1 -0
- package/dist/labs/SideNav/SideNavToggleButton.js +170 -0
- package/dist/labs/SideNav/SideNavToggleButton.js.map +1 -0
- package/dist/labs/SideNav/types.js.map +1 -1
- package/dist/labs/TopNav/TopNav.js +65 -0
- package/dist/labs/TopNav/TopNav.js.map +1 -0
- package/dist/labs/TopNav/TopNavLinksList.js +38 -0
- package/dist/labs/TopNav/TopNavLinksList.js.map +1 -0
- package/dist/labs/TopNav/TopNavListItem.js +132 -0
- package/dist/labs/TopNav/TopNavListItem.js.map +1 -0
- package/dist/labs/TopNav/UserProfile.js +65 -0
- package/dist/labs/TopNav/UserProfile.js.map +1 -0
- package/dist/labs/TopNav/index.js +14 -0
- package/dist/labs/TopNav/index.js.map +1 -0
- package/dist/labs/UiShell/UiShell.js +68 -0
- package/dist/labs/UiShell/UiShell.js.map +1 -0
- package/dist/labs/UiShell/UiShellContent.js +114 -0
- package/dist/labs/UiShell/UiShellContent.js.map +1 -0
- package/dist/labs/UiShell/bufferLatest.js +37 -0
- package/dist/labs/UiShell/bufferLatest.js.map +1 -0
- package/dist/labs/UiShell/createMessageBus.js +30 -0
- package/dist/labs/UiShell/createMessageBus.js.map +1 -0
- package/dist/labs/UiShell/createStore.js +24 -0
- package/dist/labs/UiShell/createStore.js.map +1 -0
- package/dist/labs/UiShell/index.js +15 -0
- package/dist/labs/UiShell/index.js.map +1 -0
- package/dist/labs/UiShell/renderUiShell.js +78 -0
- package/dist/labs/UiShell/renderUiShell.js.map +1 -0
- package/dist/labs/UiShell/useHasUiShell.js +22 -0
- package/dist/labs/UiShell/useHasUiShell.js.map +1 -0
- package/dist/labs/UiShell/useScrollState.js +41 -0
- package/dist/labs/UiShell/useScrollState.js.map +1 -0
- package/dist/labs/index.js +5 -3
- package/dist/labs/index.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +7 -1
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_cs.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_cs.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_da.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_da.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_de.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_de.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_el.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_el.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_es.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_es.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_fi.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_fi.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_fr.js +5 -3
- package/dist/properties/ts/odyssey-react-mui_fr.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ht.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_ht.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_hu.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_hu.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_id.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_id.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_it.js +4 -2
- package/dist/properties/ts/odyssey-react-mui_it.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ja.js +9 -7
- package/dist/properties/ts/odyssey-react-mui_ja.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ko.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_ko.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ms.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_ms.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_nb.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_nb.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_nl_NL.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_pl.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_pl.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_pt_BR.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ro.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_ro.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_ru.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_ru.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_sv.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_sv.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_th.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_th.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_tr.js +4 -2
- package/dist/properties/ts/odyssey-react-mui_tr.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_uk.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_uk.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_vi.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_vi.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_zh_CN.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui_zh_TW.js +3 -1
- package/dist/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +21 -22
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Box.d.ts +3 -1
- package/dist/src/Box.d.ts.map +1 -1
- package/dist/src/Card.d.ts.map +1 -1
- package/dist/src/OdysseyDesignTokensContext.d.ts +5 -4
- package/dist/src/OdysseyDesignTokensContext.d.ts.map +1 -1
- package/dist/src/OdysseyProvider.d.ts +1 -3
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/OdysseyThemeProvider.d.ts +10 -4
- package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.types.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.types.d.ts.map +1 -1
- package/dist/src/Pagination/Pagination.d.ts +21 -7
- package/dist/src/Pagination/Pagination.d.ts.map +1 -1
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/Surface.d.ts.map +1 -1
- package/dist/src/Tag.d.ts +5 -2
- package/dist/src/Tag.d.ts.map +1 -1
- package/dist/src/i18n.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/labs/AppTile.d.ts +3 -1
- package/dist/src/labs/AppTile.d.ts.map +1 -1
- package/dist/src/labs/DataView/CardLayoutContent.d.ts.map +1 -1
- package/dist/src/labs/DataView/DataCard.d.ts +9 -3
- package/dist/src/labs/DataView/DataCard.d.ts.map +1 -1
- package/dist/src/labs/DataView/TableLayoutContent.d.ts.map +1 -1
- package/dist/src/labs/DataView/componentTypes.d.ts +1 -1
- package/dist/src/labs/DataView/componentTypes.d.ts.map +1 -1
- package/dist/src/labs/DataView/index.d.ts +1 -0
- package/dist/src/labs/DataView/index.d.ts.map +1 -1
- package/dist/src/labs/OdysseyPickers/ComposablePicker.d.ts +33 -0
- package/dist/src/labs/OdysseyPickers/ComposablePicker.d.ts.map +1 -0
- package/dist/src/labs/OdysseyPickers/Picker.d.ts +98 -0
- package/dist/src/labs/OdysseyPickers/Picker.d.ts.map +1 -0
- package/dist/src/labs/OdysseyPickers/PickerVirtualizationListBox.d.ts +17 -0
- package/dist/src/labs/OdysseyPickers/PickerVirtualizationListBox.d.ts.map +1 -0
- package/dist/src/labs/OdysseyPickers/PickerWithOptionAdornment.d.ts +26 -0
- package/dist/src/labs/OdysseyPickers/PickerWithOptionAdornment.d.ts.map +1 -0
- package/dist/src/labs/OdysseyPickers/index.d.ts +15 -0
- package/dist/src/labs/OdysseyPickers/index.d.ts.map +1 -0
- package/dist/src/labs/PageTemplate.d.ts +1 -1
- package/dist/src/labs/PageTemplate.d.ts.map +1 -1
- package/dist/src/labs/SideNav/CollapseIcon.d.ts +1 -4
- package/dist/src/labs/SideNav/CollapseIcon.d.ts.map +1 -1
- package/dist/src/labs/SideNav/HandleIcon.d.ts +14 -0
- package/dist/src/labs/SideNav/HandleIcon.d.ts.map +1 -0
- package/dist/src/labs/{NavAccordion.d.ts → SideNav/NavAccordion.d.ts} +6 -2
- package/dist/src/labs/SideNav/NavAccordion.d.ts.map +1 -0
- package/dist/src/labs/SideNav/OktaAura.d.ts +14 -0
- package/dist/src/labs/SideNav/OktaAura.d.ts.map +1 -0
- package/dist/src/labs/SideNav/OktaLogo.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNav.d.ts +2 -1
- package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavFooterContent.d.ts +1 -1
- package/dist/src/labs/SideNav/SideNavFooterContent.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavHeader.d.ts +12 -3
- package/dist/src/labs/SideNav/SideNavHeader.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavItemContent.d.ts +2 -3
- package/dist/src/labs/SideNav/SideNavItemContent.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts +18 -0
- package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SideNavItemLinkContent.d.ts +1 -1
- package/dist/src/labs/SideNav/SideNavItemLinkContent.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavLogo.d.ts +15 -0
- package/dist/src/labs/SideNav/SideNavLogo.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SideNavToggleButton.d.ts +38 -0
- package/dist/src/labs/SideNav/SideNavToggleButton.d.ts.map +1 -0
- package/dist/src/labs/SideNav/types.d.ts +67 -33
- package/dist/src/labs/SideNav/types.d.ts.map +1 -1
- package/dist/src/labs/TopNav/TopNav.d.ts +31 -0
- package/dist/src/labs/TopNav/TopNav.d.ts.map +1 -0
- package/dist/src/labs/TopNav/TopNavLinksList.d.ts +44 -0
- package/dist/src/labs/TopNav/TopNavLinksList.d.ts.map +1 -0
- package/dist/src/labs/TopNav/TopNavListItem.d.ts +42 -0
- package/dist/src/labs/TopNav/TopNavListItem.d.ts.map +1 -0
- package/dist/src/labs/TopNav/UserProfile.d.ts +29 -0
- package/dist/src/labs/TopNav/UserProfile.d.ts.map +1 -0
- package/dist/src/labs/TopNav/index.d.ts +14 -0
- package/dist/src/labs/TopNav/index.d.ts.map +1 -0
- package/dist/src/labs/UiShell/UiShell.d.ts +33 -0
- package/dist/src/labs/UiShell/UiShell.d.ts.map +1 -0
- package/dist/src/labs/UiShell/UiShellContent.d.ts +47 -0
- package/dist/src/labs/UiShell/UiShellContent.d.ts.map +1 -0
- package/dist/src/labs/UiShell/bufferLatest.d.ts +31 -0
- package/dist/src/labs/UiShell/bufferLatest.d.ts.map +1 -0
- package/dist/src/labs/UiShell/createMessageBus.d.ts +24 -0
- package/dist/src/labs/UiShell/createMessageBus.d.ts.map +1 -0
- package/dist/src/labs/UiShell/createStore.d.ts +22 -0
- package/dist/src/labs/UiShell/createStore.d.ts.map +1 -0
- package/dist/src/labs/UiShell/index.d.ts +16 -0
- package/dist/src/labs/UiShell/index.d.ts.map +1 -0
- package/dist/src/labs/UiShell/renderUiShell.d.ts +45 -0
- package/dist/src/labs/UiShell/renderUiShell.d.ts.map +1 -0
- package/dist/src/labs/UiShell/useHasUiShell.d.ts +13 -0
- package/dist/src/labs/UiShell/useHasUiShell.d.ts.map +1 -0
- package/dist/src/labs/UiShell/useScrollState.d.ts +16 -0
- package/dist/src/labs/UiShell/useScrollState.d.ts.map +1 -0
- package/dist/src/labs/index.d.ts +6 -2
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts +6 -0
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_da.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_de.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_el.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_es.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ht.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ht.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_id.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_it.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_th.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
- package/dist/src/test-selectors/querySelector.d.ts +2 -2
- package/dist/src/theme/components.d.ts +3 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/createOdysseyMuiTheme.d.ts +3 -1
- package/dist/src/theme/createOdysseyMuiTheme.d.ts.map +1 -1
- package/dist/src/useAutocomplete.d.ts +29 -0
- package/dist/src/useAutocomplete.d.ts.map +1 -0
- package/dist/src/useContrastMode.d.ts +46 -0
- package/dist/src/useContrastMode.d.ts.map +1 -0
- package/dist/src/web-component/index.d.ts +14 -0
- package/dist/src/web-component/index.d.ts.map +1 -0
- package/dist/src/web-component/renderReactInWebComponent.d.ts +76 -0
- package/dist/src/web-component/renderReactInWebComponent.d.ts.map +1 -0
- package/dist/src/web-component/shadow-dom.d.ts +23 -0
- package/dist/src/web-component/shadow-dom.d.ts.map +1 -0
- package/dist/test-selectors/querySelector.js.map +1 -1
- package/dist/theme/components.js +41 -32
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/createOdysseyMuiTheme.js +3 -0
- package/dist/theme/createOdysseyMuiTheme.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useAutocomplete.js +105 -0
- package/dist/useAutocomplete.js.map +1 -0
- package/dist/useContrastMode.js +93 -0
- package/dist/useContrastMode.js.map +1 -0
- package/dist/web-component/index.js +14 -0
- package/dist/web-component/index.js.map +1 -0
- package/dist/web-component/renderReactInWebComponent.js +72 -0
- package/dist/web-component/renderReactInWebComponent.js.map +1 -0
- package/dist/{createShadowDomElements.js → web-component/shadow-dom.js} +10 -12
- package/dist/web-component/shadow-dom.js.map +1 -0
- package/jest.config.cjs +21 -2
- package/jest.setup.js +0 -3
- package/package.json +4 -3
- package/src/Autocomplete.tsx +40 -330
- package/src/Box.tsx +4 -2
- package/src/Card.tsx +1 -0
- package/src/OdysseyDesignTokensContext.tsx +6 -3
- package/src/OdysseyProvider.tsx +29 -56
- package/src/OdysseyThemeProvider.test.tsx +209 -0
- package/src/OdysseyThemeProvider.tsx +43 -17
- package/src/OdysseyTranslationProvider.types.ts +1 -0
- package/src/Pagination/Pagination.test.tsx +305 -0
- package/src/Pagination/Pagination.tsx +86 -38
- package/src/Select.tsx +12 -3
- package/src/Surface.tsx +2 -1
- package/src/Tag.tsx +102 -41
- package/src/createUniqueAlphabeticalId.test.ts +1 -1
- package/src/createUniqueId.test.ts +1 -1
- package/src/i18n.ts +2 -0
- package/src/index.ts +6 -7
- package/src/labs/AppTile.tsx +169 -40
- package/src/labs/DataView/CardLayoutContent.tsx +12 -14
- package/src/labs/DataView/DataCard.tsx +137 -69
- package/src/labs/DataView/DataView.test.tsx +6 -4
- package/src/labs/DataView/TableLayoutContent.tsx +6 -2
- package/src/labs/DataView/componentTypes.ts +1 -1
- package/src/labs/DataView/index.tsx +1 -0
- package/src/labs/OdysseyPickers/ComposablePicker.test.tsx +29 -0
- package/src/labs/OdysseyPickers/ComposablePicker.tsx +188 -0
- package/src/labs/OdysseyPickers/Picker.tsx +381 -0
- package/src/labs/OdysseyPickers/PickerVirtualizationListBox.tsx +191 -0
- package/src/labs/OdysseyPickers/PickerWithOptionAdornment.tsx +429 -0
- package/src/labs/OdysseyPickers/index.ts +15 -0
- package/src/labs/PageTemplate.tsx +18 -10
- package/src/labs/SideNav/CollapseIcon.tsx +14 -28
- package/src/labs/SideNav/HandleIcon.tsx +35 -0
- package/src/labs/{NavAccordion.tsx → SideNav/NavAccordion.tsx} +48 -8
- package/src/labs/SideNav/OktaAura.tsx +35 -0
- package/src/labs/SideNav/OktaLogo.tsx +5 -10
- package/src/labs/SideNav/SideNav.test.tsx +323 -0
- package/src/labs/SideNav/SideNav.tsx +291 -204
- package/src/labs/SideNav/SideNavFooterContent.tsx +36 -28
- package/src/labs/SideNav/SideNavHeader.tsx +62 -45
- package/src/labs/SideNav/SideNavItemContent.tsx +142 -62
- package/src/labs/SideNav/SideNavItemContentContext.tsx +27 -0
- package/src/labs/SideNav/SideNavItemLinkContent.tsx +17 -14
- package/src/labs/SideNav/SideNavLogo.tsx +41 -0
- package/src/labs/SideNav/SideNavToggleButton.tsx +249 -0
- package/src/labs/SideNav/types.ts +72 -33
- package/src/labs/TopNav/TopNav.tsx +95 -0
- package/src/labs/TopNav/TopNavLinksList.tsx +68 -0
- package/src/labs/TopNav/TopNavListItem.tsx +209 -0
- package/src/labs/TopNav/UserProfile.tsx +79 -0
- package/src/labs/TopNav/index.ts +14 -0
- package/src/labs/UiShell/UiShell.test.tsx +284 -0
- package/src/labs/UiShell/UiShell.tsx +109 -0
- package/src/labs/UiShell/UiShellContent.tsx +170 -0
- package/src/labs/UiShell/bufferLatest.test.ts +79 -0
- package/src/labs/UiShell/bufferLatest.ts +64 -0
- package/src/labs/UiShell/createMessageBus.test.ts +115 -0
- package/src/labs/UiShell/createMessageBus.ts +53 -0
- package/src/labs/UiShell/createStore.test.ts +103 -0
- package/src/labs/UiShell/createStore.ts +37 -0
- package/src/labs/UiShell/index.ts +17 -0
- package/src/labs/UiShell/renderUiShell.test.tsx +197 -0
- package/src/labs/UiShell/renderUiShell.tsx +132 -0
- package/src/labs/UiShell/useHasUiShell.ts +25 -0
- package/src/labs/UiShell/useScrollState.ts +56 -0
- package/src/labs/index.ts +10 -3
- package/src/properties/odyssey-react-mui.properties +7 -0
- package/src/properties/translations/odyssey-react-mui_cs.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_da.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_de.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_el.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_es.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_fi.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_fr.properties +4 -3
- package/src/properties/translations/odyssey-react-mui_ht.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_hu.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_id.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_it.properties +3 -2
- package/src/properties/translations/odyssey-react-mui_ja.properties +8 -7
- package/src/properties/translations/odyssey-react-mui_ko.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_ms.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_nb.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_nl_NL.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_pl.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_pt_BR.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_ro.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_ru.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_sv.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_th.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_tr.properties +3 -2
- package/src/properties/translations/odyssey-react-mui_uk.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_vi.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_zh_CN.properties +2 -1
- package/src/properties/translations/odyssey-react-mui_zh_TW.properties +2 -1
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_cs.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_da.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_de.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_el.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_es.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_fi.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_fr.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ht.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_hu.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_id.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_it.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ja.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ko.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ms.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_nb.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_nl_NL.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_pl.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_pt_BR.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ro.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_ru.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_sv.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_th.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_tr.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_uk.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_vi.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_zh_CN.ts +1 -1
- package/src/properties/ts/odyssey-react-mui_zh_TW.ts +1 -1
- package/src/test-selectors/querySelector.ts +1 -1
- package/src/theme/components.tsx +55 -31
- package/src/theme/createOdysseyMuiTheme.ts +4 -0
- package/src/theme/useContrastMode.test.tsx +503 -0
- package/src/useAutocomplete.tsx +183 -0
- package/src/useContrastMode.tsx +149 -0
- package/src/web-component/index.ts +14 -0
- package/src/web-component/renderReactInWebComponent.test.tsx +156 -0
- package/src/web-component/renderReactInWebComponent.ts +153 -0
- package/src/web-component/shadow-dom.test.ts +24 -0
- package/src/{createShadowDomElements.ts → web-component/shadow-dom.ts} +15 -14
- package/dist/ContrastModeProvider.js +0 -86
- package/dist/ContrastModeProvider.js.map +0 -1
- package/dist/createShadowDomElements.js.map +0 -1
- package/dist/labs/NavAccordion.js.map +0 -1
- package/dist/labs/TopNav.js +0 -281
- package/dist/labs/TopNav.js.map +0 -1
- package/dist/src/ContrastModeProvider.d.ts +0 -34
- package/dist/src/ContrastModeProvider.d.ts.map +0 -1
- package/dist/src/createShadowDomElements.d.ts.map +0 -1
- package/dist/src/labs/NavAccordion.d.ts.map +0 -1
- package/dist/src/labs/TopNav.d.ts +0 -78
- package/dist/src/labs/TopNav.d.ts.map +0 -1
- package/src/ContrastModeProvider.tsx +0 -131
- package/src/labs/TopNav.tsx +0 -396
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import styled from "@emotion/styled";
|
|
14
|
+
import { memo, type ReactElement, type ReactNode } from "react";
|
|
15
|
+
import { ErrorBoundary, ErrorBoundaryProps } from "react-error-boundary";
|
|
16
|
+
|
|
17
|
+
import { SideNav, type SideNavProps } from "../SideNav";
|
|
18
|
+
import { TopNav, type TopNavProps } from "../TopNav";
|
|
19
|
+
import {
|
|
20
|
+
useOdysseyDesignTokens,
|
|
21
|
+
type DesignTokens,
|
|
22
|
+
} from "../../OdysseyDesignTokensContext";
|
|
23
|
+
import { useScrollState } from "./useScrollState";
|
|
24
|
+
|
|
25
|
+
const StyledAppContainer = styled("div", {
|
|
26
|
+
shouldForwardProp: (prop) => prop !== "odysseyDesignTokens",
|
|
27
|
+
})<{
|
|
28
|
+
odysseyDesignTokens: DesignTokens;
|
|
29
|
+
}>(({ odysseyDesignTokens }) => ({
|
|
30
|
+
gridArea: "app-content",
|
|
31
|
+
overflowX: "hidden",
|
|
32
|
+
overflowY: "auto",
|
|
33
|
+
paddingBlock: odysseyDesignTokens.Spacing5,
|
|
34
|
+
paddingInline: odysseyDesignTokens.Spacing6,
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
const StyledBannersContainer = styled("div")(() => ({
|
|
38
|
+
gridArea: "banners",
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const StyledSideNavContainer = styled("div")(() => ({
|
|
42
|
+
gridArea: "side-nav",
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
const StyledShellContainer = styled("div", {
|
|
46
|
+
shouldForwardProp: (prop) => prop !== "odysseyDesignTokens",
|
|
47
|
+
})<{
|
|
48
|
+
odysseyDesignTokens: DesignTokens;
|
|
49
|
+
}>(({ odysseyDesignTokens }) => ({
|
|
50
|
+
backgroundColor: odysseyDesignTokens.HueNeutral50,
|
|
51
|
+
display: "grid",
|
|
52
|
+
gridGap: 0,
|
|
53
|
+
gridTemplateAreas: `
|
|
54
|
+
"banners banners"
|
|
55
|
+
"side-nav top-nav"
|
|
56
|
+
"side-nav app-content"
|
|
57
|
+
`,
|
|
58
|
+
gridTemplateColumns: "auto 1fr",
|
|
59
|
+
gridTemplateRows: "auto auto 1fr",
|
|
60
|
+
height: "100vh",
|
|
61
|
+
width: "100vw",
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
const StyledTopNavContainer = styled("div")(() => ({
|
|
65
|
+
gridArea: "top-nav",
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
export type UiShellNavComponentProps = {
|
|
69
|
+
/**
|
|
70
|
+
* Object that gets pass directly to the side nav component.
|
|
71
|
+
*/
|
|
72
|
+
sideNavProps?: Omit<SideNavProps, "footerComponent">;
|
|
73
|
+
/**
|
|
74
|
+
* Object that gets pass directly to the top nav component.
|
|
75
|
+
*/
|
|
76
|
+
topNavProps: Omit<TopNavProps, "leftSideComponent" | "rightSideComponent">;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type UiShellContentProps = {
|
|
80
|
+
/**
|
|
81
|
+
* React app component that renders as children in the correct location of the shell.
|
|
82
|
+
*/
|
|
83
|
+
appComponent: ReactNode;
|
|
84
|
+
/**
|
|
85
|
+
* Notifies when a React rendering error occurs. This could be useful for logging, flagging "p0"s, and recovering UI Shell when errors occur.
|
|
86
|
+
*/
|
|
87
|
+
onError?: ErrorBoundaryProps["onError"];
|
|
88
|
+
/**
|
|
89
|
+
* Components that will render as children of various other components such as the top nav or side nav.
|
|
90
|
+
*/
|
|
91
|
+
optionalComponents?: {
|
|
92
|
+
banners?: ReactElement;
|
|
93
|
+
sideNavFooter?: SideNavProps["footerComponent"];
|
|
94
|
+
topNavLeftSide?: TopNavProps["leftSideComponent"];
|
|
95
|
+
topNavRightSide?: TopNavProps["rightSideComponent"];
|
|
96
|
+
};
|
|
97
|
+
} & UiShellNavComponentProps;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Our new Unified Platform UI Shell.
|
|
101
|
+
*
|
|
102
|
+
* This includes the top and side navigation as well as the footer and provides a spot for your app to render into.
|
|
103
|
+
*
|
|
104
|
+
* If an error occurs, this will revert to only showing the app.
|
|
105
|
+
*/
|
|
106
|
+
const UiShellContent = ({
|
|
107
|
+
appComponent,
|
|
108
|
+
onError = console.error,
|
|
109
|
+
optionalComponents,
|
|
110
|
+
sideNavProps,
|
|
111
|
+
topNavProps,
|
|
112
|
+
}: UiShellContentProps) => {
|
|
113
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
114
|
+
const { isContentScrolled, scrollableContentRef } = useScrollState();
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<StyledShellContainer odysseyDesignTokens={odysseyDesignTokens}>
|
|
118
|
+
<StyledBannersContainer>
|
|
119
|
+
{optionalComponents?.banners}
|
|
120
|
+
</StyledBannersContainer>
|
|
121
|
+
|
|
122
|
+
<StyledSideNavContainer>
|
|
123
|
+
{sideNavProps && (
|
|
124
|
+
<ErrorBoundary fallback={null} onError={onError}>
|
|
125
|
+
<SideNav
|
|
126
|
+
{...{
|
|
127
|
+
...sideNavProps,
|
|
128
|
+
...(sideNavProps.hasCustomFooter &&
|
|
129
|
+
optionalComponents?.sideNavFooter
|
|
130
|
+
? {
|
|
131
|
+
footerComponent: optionalComponents.sideNavFooter,
|
|
132
|
+
footerItems: undefined,
|
|
133
|
+
hasCustomFooter: sideNavProps.hasCustomFooter,
|
|
134
|
+
}
|
|
135
|
+
: {
|
|
136
|
+
footerItems: sideNavProps.footerItems,
|
|
137
|
+
hasCustomFooter: false,
|
|
138
|
+
}),
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
</ErrorBoundary>
|
|
142
|
+
)}
|
|
143
|
+
</StyledSideNavContainer>
|
|
144
|
+
|
|
145
|
+
<StyledTopNavContainer>
|
|
146
|
+
<ErrorBoundary fallback={null} onError={onError}>
|
|
147
|
+
<TopNav
|
|
148
|
+
{...topNavProps}
|
|
149
|
+
isScrolled={isContentScrolled}
|
|
150
|
+
leftSideComponent={optionalComponents?.topNavLeftSide}
|
|
151
|
+
rightSideComponent={optionalComponents?.topNavRightSide}
|
|
152
|
+
/>
|
|
153
|
+
</ErrorBoundary>
|
|
154
|
+
</StyledTopNavContainer>
|
|
155
|
+
|
|
156
|
+
<StyledAppContainer
|
|
157
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
158
|
+
tabIndex={0}
|
|
159
|
+
ref={scrollableContentRef}
|
|
160
|
+
>
|
|
161
|
+
{appComponent}
|
|
162
|
+
</StyledAppContainer>
|
|
163
|
+
</StyledShellContainer>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const MemoizedUiShellContent = memo(UiShellContent);
|
|
168
|
+
MemoizedUiShellContent.displayName = "UiShellContent";
|
|
169
|
+
|
|
170
|
+
export { MemoizedUiShellContent as UiShellContent };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { bufferLatest } from "./bufferLatest";
|
|
14
|
+
import { createMessageBus } from "./createMessageBus";
|
|
15
|
+
|
|
16
|
+
describe("bufferLatest", () => {
|
|
17
|
+
test("calls subscriber after ready", async () => {
|
|
18
|
+
const { publish: publish1, subscribe: subscribe1 } = createMessageBus();
|
|
19
|
+
|
|
20
|
+
const { publish: publish2, subscribe: subscribe2 } = createMessageBus();
|
|
21
|
+
|
|
22
|
+
const subscriber = jest.fn();
|
|
23
|
+
|
|
24
|
+
subscribe1(subscriber);
|
|
25
|
+
|
|
26
|
+
const bufferedPublish1 = bufferLatest({
|
|
27
|
+
publish: publish1,
|
|
28
|
+
subscribe: subscribe2,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
publish2();
|
|
32
|
+
bufferedPublish1();
|
|
33
|
+
|
|
34
|
+
expect(subscriber).toHaveBeenCalledTimes(1);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("calls subscriber before ready", async () => {
|
|
38
|
+
const { publish: publish1, subscribe: subscribe1 } = createMessageBus();
|
|
39
|
+
|
|
40
|
+
const { publish: publish2, subscribe: subscribe2 } = createMessageBus();
|
|
41
|
+
|
|
42
|
+
const subscriber = jest.fn();
|
|
43
|
+
|
|
44
|
+
subscribe1(subscriber);
|
|
45
|
+
|
|
46
|
+
const bufferedPublish1 = bufferLatest({
|
|
47
|
+
publish: publish1,
|
|
48
|
+
subscribe: subscribe2,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
bufferedPublish1();
|
|
52
|
+
publish2();
|
|
53
|
+
|
|
54
|
+
expect(subscriber).toHaveBeenCalledTimes(1);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("keeps only the last value passed when ready", async () => {
|
|
58
|
+
const { publish: publish1, subscribe: subscribe1 } =
|
|
59
|
+
createMessageBus<string>();
|
|
60
|
+
|
|
61
|
+
const { publish: publish2, subscribe: subscribe2 } = createMessageBus();
|
|
62
|
+
|
|
63
|
+
const subscriber = jest.fn();
|
|
64
|
+
|
|
65
|
+
subscribe1(subscriber);
|
|
66
|
+
|
|
67
|
+
const bufferedPublish1 = bufferLatest({
|
|
68
|
+
publish: publish1,
|
|
69
|
+
subscribe: subscribe2,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
bufferedPublish1("a");
|
|
73
|
+
bufferedPublish1("b");
|
|
74
|
+
publish2();
|
|
75
|
+
|
|
76
|
+
expect(subscriber).toHaveBeenCalledWith("b");
|
|
77
|
+
expect(subscriber).toHaveBeenCalledTimes(1);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createStore } from "./createStore";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Buffers the values passed to a publisher, keeping only the latest value, until the subscriber emits.
|
|
17
|
+
*
|
|
18
|
+
* This is useful in restricting publishers from firing events until specific subscribers are active. Once active, the `publish` function reverts to its previous behavior.
|
|
19
|
+
*/
|
|
20
|
+
export const bufferLatest = <Value>({
|
|
21
|
+
publish,
|
|
22
|
+
subscribe,
|
|
23
|
+
}: {
|
|
24
|
+
/**
|
|
25
|
+
* A function that publishes values to a subscriber, but not the same subscriber as the one passed to this function.
|
|
26
|
+
*
|
|
27
|
+
* Only the latest value published by this publisher is kept until the subscriber emits.
|
|
28
|
+
*/
|
|
29
|
+
publish: (value: Value) => void;
|
|
30
|
+
/**
|
|
31
|
+
* A subscription that listens for emissions from a separate publisher.
|
|
32
|
+
*
|
|
33
|
+
* When that separate publisher emits, the latest value from the passed-in publish function is emitted as are all future values.
|
|
34
|
+
*/
|
|
35
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
36
|
+
}) => {
|
|
37
|
+
const store = createStore<{
|
|
38
|
+
bufferedValue?: Value;
|
|
39
|
+
isReactAppReadyForProps: boolean;
|
|
40
|
+
}>({
|
|
41
|
+
isReactAppReadyForProps: false,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const unsubscribe = subscribe(() => {
|
|
45
|
+
unsubscribe();
|
|
46
|
+
|
|
47
|
+
store.setState("isReactAppReadyForProps", true);
|
|
48
|
+
store.getState("bufferedValue");
|
|
49
|
+
if (store.hasState("bufferedValue")) {
|
|
50
|
+
// If we have a state, then the value in here is what we want. TypeScript expects this to possibly be `undefined` because the type we sent to `createStore` listed `bufferedValue` as optional. TypeScript doesn't seem to have any way of knowing we passed in the value at some point.
|
|
51
|
+
publish(store.getState("bufferedValue")!);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const publishWhenReady: typeof publish = (value) => {
|
|
56
|
+
if (store.getState("isReactAppReadyForProps")) {
|
|
57
|
+
publish(value);
|
|
58
|
+
} else {
|
|
59
|
+
store.setState("bufferedValue", value);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return publishWhenReady;
|
|
64
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createMessageBus } from "./createMessageBus";
|
|
14
|
+
|
|
15
|
+
describe("createEventBus", () => {
|
|
16
|
+
test("messages are not sent once unsubscribed", async () => {
|
|
17
|
+
const { publish, subscribe } = createMessageBus<null>();
|
|
18
|
+
|
|
19
|
+
const subscriber = jest.fn();
|
|
20
|
+
|
|
21
|
+
const unsubscribe = subscribe(subscriber);
|
|
22
|
+
|
|
23
|
+
unsubscribe();
|
|
24
|
+
publish(null);
|
|
25
|
+
|
|
26
|
+
expect(subscriber).toHaveBeenCalledTimes(0);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("messages are not sent once unsubscribed from multiple subscribers", async () => {
|
|
30
|
+
const { publish, subscribe } = createMessageBus<null>();
|
|
31
|
+
|
|
32
|
+
const subscriber1 = jest.fn();
|
|
33
|
+
const subscriber2 = jest.fn();
|
|
34
|
+
const subscriber3 = jest.fn();
|
|
35
|
+
|
|
36
|
+
const unsubscribe1 = subscribe(subscriber1);
|
|
37
|
+
const unsubscribe2 = subscribe(subscriber2);
|
|
38
|
+
const unsubscribe3 = subscribe(subscriber3);
|
|
39
|
+
|
|
40
|
+
unsubscribe1();
|
|
41
|
+
unsubscribe2();
|
|
42
|
+
unsubscribe3();
|
|
43
|
+
publish(null);
|
|
44
|
+
publish(null);
|
|
45
|
+
|
|
46
|
+
expect(subscriber1).toHaveBeenCalledTimes(0);
|
|
47
|
+
expect(subscriber2).toHaveBeenCalledTimes(0);
|
|
48
|
+
expect(subscriber3).toHaveBeenCalledTimes(0);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("when publishing message, receives message in a subscriber", async () => {
|
|
52
|
+
const message = Symbol();
|
|
53
|
+
|
|
54
|
+
const { publish, subscribe } = createMessageBus<typeof message>();
|
|
55
|
+
|
|
56
|
+
const subscriber = jest.fn();
|
|
57
|
+
|
|
58
|
+
const unsubscribe = subscribe(subscriber);
|
|
59
|
+
|
|
60
|
+
publish(message);
|
|
61
|
+
unsubscribe();
|
|
62
|
+
|
|
63
|
+
expect(subscriber).toHaveBeenCalledWith(message);
|
|
64
|
+
expect(subscriber).toHaveBeenCalledTimes(1);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("when publishing 2 messages, receives both messages in a subscriber", async () => {
|
|
68
|
+
const message1 = Symbol();
|
|
69
|
+
const message2 = Symbol();
|
|
70
|
+
|
|
71
|
+
const { publish, subscribe } = createMessageBus<
|
|
72
|
+
typeof message1 | typeof message2
|
|
73
|
+
>();
|
|
74
|
+
|
|
75
|
+
const subscriber = jest.fn();
|
|
76
|
+
|
|
77
|
+
const unsubscribe = subscribe(subscriber);
|
|
78
|
+
|
|
79
|
+
publish(message1);
|
|
80
|
+
publish(message2);
|
|
81
|
+
unsubscribe();
|
|
82
|
+
|
|
83
|
+
expect(subscriber).toHaveBeenNthCalledWith(1, message1);
|
|
84
|
+
expect(subscriber).toHaveBeenNthCalledWith(2, message2);
|
|
85
|
+
expect(subscriber).toHaveBeenCalledTimes(2);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("when subscribing twice, both subscribers receive multiple messages", async () => {
|
|
89
|
+
const message1 = Symbol();
|
|
90
|
+
const message2 = Symbol();
|
|
91
|
+
|
|
92
|
+
const { publish, subscribe } = createMessageBus<
|
|
93
|
+
typeof message1 | typeof message2
|
|
94
|
+
>();
|
|
95
|
+
|
|
96
|
+
const subscriber1 = jest.fn();
|
|
97
|
+
const subscriber2 = jest.fn();
|
|
98
|
+
|
|
99
|
+
const unsubscribe1 = subscribe(subscriber1);
|
|
100
|
+
const unsubscribe2 = subscribe(subscriber2);
|
|
101
|
+
|
|
102
|
+
publish(message1);
|
|
103
|
+
publish(message2);
|
|
104
|
+
unsubscribe1();
|
|
105
|
+
unsubscribe2();
|
|
106
|
+
|
|
107
|
+
expect(subscriber1).toHaveBeenNthCalledWith(1, message1);
|
|
108
|
+
expect(subscriber1).toHaveBeenNthCalledWith(2, message2);
|
|
109
|
+
expect(subscriber1).toHaveBeenCalledTimes(2);
|
|
110
|
+
|
|
111
|
+
expect(subscriber2).toHaveBeenNthCalledWith(1, message1);
|
|
112
|
+
expect(subscriber2).toHaveBeenNthCalledWith(2, message2);
|
|
113
|
+
expect(subscriber2).toHaveBeenCalledTimes(2);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type MessageHandler<Message> = (message: Message) => void;
|
|
14
|
+
|
|
15
|
+
export type PublishMessage<Message> = MessageHandler<Message>;
|
|
16
|
+
|
|
17
|
+
export type UnsubscribeMessageSubscription = () => void;
|
|
18
|
+
|
|
19
|
+
export type MessageSubscription<Message> = (
|
|
20
|
+
subscriber: MessageHandler<Message>,
|
|
21
|
+
) => UnsubscribeMessageSubscription;
|
|
22
|
+
|
|
23
|
+
export type MessageBus<Message> = {
|
|
24
|
+
publish: PublishMessage<Message>;
|
|
25
|
+
subscribe: MessageSubscription<Message>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a self-contained message bus that allows you to subscribe to events published by the publisher.
|
|
30
|
+
*/
|
|
31
|
+
export const createMessageBus = <Message = void>(): MessageBus<Message> => {
|
|
32
|
+
const subscribers = new Map<symbol, MessageHandler<Message>>();
|
|
33
|
+
|
|
34
|
+
const publish: PublishMessage<Message> = (message) => {
|
|
35
|
+
Array.from(subscribers.values()).forEach((subscriber) => {
|
|
36
|
+
subscriber(message);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const subscribe: MessageSubscription<Message> = (subscriber) => {
|
|
41
|
+
const subscriberId = Symbol();
|
|
42
|
+
subscribers.set(subscriberId, subscriber);
|
|
43
|
+
|
|
44
|
+
return () => {
|
|
45
|
+
subscribers.delete(subscriberId);
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
publish,
|
|
51
|
+
subscribe,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createStore } from "./createStore";
|
|
14
|
+
|
|
15
|
+
describe("createStore", () => {
|
|
16
|
+
test("starts with no initial state", async () => {
|
|
17
|
+
const store = createStore<{
|
|
18
|
+
value: null;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
expect(store.hasState("value")).toBe(false);
|
|
22
|
+
expect(store.getState("value")).toBe(undefined);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("changes state when set", async () => {
|
|
26
|
+
const store = createStore<{
|
|
27
|
+
value: null;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
store.setState("value", null);
|
|
31
|
+
|
|
32
|
+
expect(store.hasState("value")).toBe(true);
|
|
33
|
+
expect(store.getState("value")).toBe(null);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("reads initial state value", async () => {
|
|
37
|
+
const store = createStore({
|
|
38
|
+
value: null,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(store.hasState("value")).toBe(true);
|
|
42
|
+
expect(store.getState("value")).toBe(null);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("changes initial state when set", async () => {
|
|
46
|
+
const store = createStore<{
|
|
47
|
+
value: boolean;
|
|
48
|
+
}>({
|
|
49
|
+
value: false,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
store.setState("value", true);
|
|
53
|
+
|
|
54
|
+
expect(store.hasState("value")).toBe(true);
|
|
55
|
+
expect(store.getState("value")).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("changes initial state when set", async () => {
|
|
59
|
+
const store = createStore<{
|
|
60
|
+
value: boolean;
|
|
61
|
+
}>({
|
|
62
|
+
value: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
store.setState("value", true);
|
|
66
|
+
|
|
67
|
+
expect(store.hasState("value")).toBe(true);
|
|
68
|
+
expect(store.getState("value")).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("allows for multiple different states", async () => {
|
|
72
|
+
const store = createStore<{
|
|
73
|
+
value1: boolean;
|
|
74
|
+
value2: number;
|
|
75
|
+
}>({
|
|
76
|
+
value1: false,
|
|
77
|
+
value2: 0,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(store.hasState("value1")).toBe(true);
|
|
81
|
+
expect(store.hasState("value2")).toBe(true);
|
|
82
|
+
expect(store.getState("value1")).toBe(false);
|
|
83
|
+
expect(store.getState("value2")).toBe(0);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("allows setting multiple states", async () => {
|
|
87
|
+
const store = createStore<{
|
|
88
|
+
value1: boolean;
|
|
89
|
+
value2: number;
|
|
90
|
+
}>({
|
|
91
|
+
value1: false,
|
|
92
|
+
value2: 0,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
store.setState("value1", true);
|
|
96
|
+
store.setState("value2", 1);
|
|
97
|
+
|
|
98
|
+
expect(store.hasState("value1")).toBe(true);
|
|
99
|
+
expect(store.hasState("value2")).toBe(true);
|
|
100
|
+
expect(store.getState("value1")).toBe(true);
|
|
101
|
+
expect(store.getState("value2")).toBe(1);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates an internal state and gives access to those values via functions.
|
|
15
|
+
*
|
|
16
|
+
* It can be optionally given an initial state.
|
|
17
|
+
*/
|
|
18
|
+
export const createStore = <State extends object>(initialState?: State) => {
|
|
19
|
+
const state = initialState || ({} as Partial<State>);
|
|
20
|
+
|
|
21
|
+
const hasState = <Name extends keyof State>(name: Name) => name in state;
|
|
22
|
+
|
|
23
|
+
const getState = <Name extends keyof State>(name: Name) => state[name];
|
|
24
|
+
|
|
25
|
+
const setState = <Name extends keyof State>(
|
|
26
|
+
name: Name,
|
|
27
|
+
value: Required<State>[Name],
|
|
28
|
+
) => {
|
|
29
|
+
state[name] = value;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
getState,
|
|
34
|
+
hasState,
|
|
35
|
+
setState,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export * from "./renderUiShell";
|
|
14
|
+
export * from "./useHasUiShell";
|
|
15
|
+
|
|
16
|
+
export { UiShell, type UiShellProps } from "./UiShell";
|
|
17
|
+
export { type UiShellNavComponentProps } from "./UiShellContent";
|