@okta/odyssey-react-mui 1.25.0 → 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 +11 -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 +9 -7
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +33 -13
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/Pagination/Pagination.js +46 -14
- package/dist/Pagination/Pagination.js.map +1 -1
- package/dist/Surface.js +4 -1
- package/dist/Surface.js.map +1 -1
- package/dist/Tag.js +42 -27
- package/dist/Tag.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 +3 -3
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/OdysseyThemeProvider.d.ts +10 -12
- 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/Pagination/Pagination.d.ts +21 -7
- package/dist/src/Pagination/Pagination.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/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 +2 -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 +36 -32
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/createOdysseyMuiTheme.js +3 -2
- 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 +1 -1
- 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 +13 -8
- package/src/OdysseyThemeProvider.test.tsx +209 -0
- package/src/OdysseyThemeProvider.tsx +42 -26
- package/src/Pagination/Pagination.test.tsx +305 -0
- package/src/Pagination/Pagination.tsx +86 -38
- package/src/Surface.tsx +2 -1
- package/src/Tag.tsx +64 -39
- package/src/createUniqueAlphabeticalId.test.ts +1 -1
- package/src/createUniqueId.test.ts +1 -1
- 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 +50 -33
- package/src/theme/createOdysseyMuiTheme.ts +4 -3
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"ComposablePicker.js","names":["memo","useTranslation","PickerVirtualizationListBox","useAutocomplete","jsx","_jsx","adornmentSizeValues","ComposablePicker","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","getOptionLabel","groupOptionsBy","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onInputChange","onFocus","options","renderOption","renderTags","value","testId","translate","t","inputValueProp","isVirtualizedRef","renderInput","valueProps","_Autocomplete","current","ListboxComponent","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","groupBy","isOptionEqualToValue","loading","multiple","readOnly","MemoizedComposablePicker","displayName"],"sources":["../../../src/labs/OdysseyPickers/ComposablePicker.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n} from \"@mui/material\";\n\nimport { AutocompleteProps } from \"../../Autocomplete\";\nimport { PickerVirtualizationListBox } from \"./PickerVirtualizationListBox\";\nimport { useAutocomplete } from \"../../useAutocomplete\";\n\nexport const adornmentSizeValues = [\"small\", \"large\"] as const;\nexport type AdornmentSize = (typeof adornmentSizeValues)[number];\n\nexport type BasePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n groupOptionsBy?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"groupBy\"];\n};\n\nexport type BasePickerType = {\n displayName: string;\n <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: BasePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactNode;\n};\n\nexport type ComposablePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n getOptionLabel?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n\n renderOption: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderOption\"];\n\n renderTags?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderTags\"];\n};\n\nconst ComposablePicker = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n getOptionLabel,\n groupOptionsBy,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n renderOption,\n renderTags,\n value,\n testId,\n translate,\n}: ComposablePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const { t } = useTranslation();\n const { inputValueProp, isVirtualizedRef, renderInput, valueProps } =\n useAutocomplete<OptionType, HasMultipleChoices, IsCustomValueAllowed>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized,\n label,\n name: nameOverride,\n testId,\n value,\n });\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualizedRef.current && {\n ListboxComponent: PickerVirtualizationListBox,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n fullWidth={isFullWidth}\n getOptionLabel={getOptionLabel}\n groupBy={groupOptionsBy}\n id={idOverride}\n isOptionEqualToValue={getIsOptionEqualToValue}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={renderTags}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof ComposablePicker` because generics don't get passed through\nconst MemoizedComposablePicker = memo(\n ComposablePicker,\n) as typeof ComposablePicker;\n// @ts-expect-error displayName is expected to not be on `typeof ComposablePicker`\nMemoizedComposablePicker.displayName = \"ComposablePicker\";\n\nexport { MemoizedComposablePicker as ComposablePicker };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AACvC,SAASC,cAAc,QAAQ,eAAe;AAAC,SAOtCC,2BAA2B;AAAA,SAC3BC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExB,OAAO,MAAMC,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU;AA2D9D,MAAMC,gBAAgB,GAAGA,CAIvB;EACAC,eAAe;EACfC,YAAY;EACZC,YAAY;EACZC,gBAAgB;EAChBC,uBAAuB;EACvBC,cAAc;EACdC,cAAc;EACdC,kBAAkB;EAClBC,EAAE,EAAEC,UAAU;EACdC,UAAU;E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,OAAO,EAAEpC,SAAU;IACnBqC,QAAQ,EAAE5C,kBAAmB;IAC7BgB,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBC,aAAa,EAAEA,aAAc;IAC7BC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjByB,QAAQ,EAAEpC,UAAW;IACrBoB,WAAW,EAAEA,WAAY;IACzBR,YAAY,EAAEA,YAAa;IAC3BC,UAAU,EAAEA,UAAW;IACvBG,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMqB,wBAAwB,GAAG7D,IAAI,CACnCO,gBACF,CAA4B;AAE5BsD,wBAAwB,CAACC,WAAW,GAAG,kBAAkB;AAEzD,SAASD,wBAAwB,IAAItD,gBAAgB"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023-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 { memo, useCallback } from "react";
|
|
14
|
+
import styled from "@emotion/styled";
|
|
15
|
+
import { ComposablePicker } from "./ComposablePicker.js";
|
|
16
|
+
import { useOdysseyDesignTokens } from "../../OdysseyDesignTokensContext.js";
|
|
17
|
+
import { Heading6, Paragraph } from "../../Typography.js";
|
|
18
|
+
import { createElement as _createElement } from "react";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
export const StyledOption = styled.li(({
|
|
22
|
+
hasAdornment
|
|
23
|
+
}) => ({
|
|
24
|
+
...(!hasAdornment && {
|
|
25
|
+
display: "block !important"
|
|
26
|
+
})
|
|
27
|
+
}));
|
|
28
|
+
export const OptionLabelContainer = styled("div", {
|
|
29
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
30
|
+
})(({}) => ({
|
|
31
|
+
p: {
|
|
32
|
+
margin: 0
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
export const OptionDescription = styled("p", {
|
|
36
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
37
|
+
})(({
|
|
38
|
+
odysseyDesignTokens
|
|
39
|
+
}) => ({
|
|
40
|
+
margin: `${odysseyDesignTokens.Spacing1} 0 0 !important`,
|
|
41
|
+
color: odysseyDesignTokens.TypographyColorSubordinate
|
|
42
|
+
}));
|
|
43
|
+
export const OptionDetails = styled("div", {
|
|
44
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
45
|
+
})(({
|
|
46
|
+
odysseyDesignTokens
|
|
47
|
+
}) => ({
|
|
48
|
+
display: "flex",
|
|
49
|
+
gap: odysseyDesignTokens.Spacing3,
|
|
50
|
+
marginBlockStart: odysseyDesignTokens.Spacing2
|
|
51
|
+
}));
|
|
52
|
+
export const OptionDetail = styled("div", {
|
|
53
|
+
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
54
|
+
})(({
|
|
55
|
+
odysseyDesignTokens
|
|
56
|
+
}) => ({
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
gap: odysseyDesignTokens.Spacing1,
|
|
60
|
+
svg: {
|
|
61
|
+
width: odysseyDesignTokens.Spacing4,
|
|
62
|
+
color: odysseyDesignTokens.HueNeutral400
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
export const Option = ({
|
|
66
|
+
children,
|
|
67
|
+
hasAdornment = false,
|
|
68
|
+
key,
|
|
69
|
+
muiProps
|
|
70
|
+
}) => _createElement(StyledOption, {
|
|
71
|
+
...muiProps,
|
|
72
|
+
hasAdornment: hasAdornment,
|
|
73
|
+
key: key
|
|
74
|
+
}, children);
|
|
75
|
+
export const OptionMetadataComponent = ({
|
|
76
|
+
metaData,
|
|
77
|
+
odysseyDesignTokens
|
|
78
|
+
}) => {
|
|
79
|
+
return _jsx(OptionDetails, {
|
|
80
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
81
|
+
children: metaData.map((meta, index) => {
|
|
82
|
+
const {
|
|
83
|
+
detailText,
|
|
84
|
+
icon
|
|
85
|
+
} = meta;
|
|
86
|
+
return _jsxs(OptionDetail, {
|
|
87
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
88
|
+
children: [icon, detailText]
|
|
89
|
+
}, `${index}-${detailText}`);
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
export const OptionDescriptionComponent = ({
|
|
94
|
+
description,
|
|
95
|
+
odysseyDesignTokens
|
|
96
|
+
}) => {
|
|
97
|
+
return description && _jsx(OptionDescription, {
|
|
98
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
99
|
+
children: description
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export const OptionLabelOnlyComponent = ({
|
|
103
|
+
muiProps,
|
|
104
|
+
odysseyDesignTokens,
|
|
105
|
+
option
|
|
106
|
+
}) => {
|
|
107
|
+
const {
|
|
108
|
+
label,
|
|
109
|
+
value
|
|
110
|
+
} = option;
|
|
111
|
+
return _jsx(Option, {
|
|
112
|
+
muiProps: muiProps,
|
|
113
|
+
children: _jsx(OptionLabelContainer, {
|
|
114
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
115
|
+
children: _jsx(Paragraph, {
|
|
116
|
+
children: label
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
}, value);
|
|
120
|
+
};
|
|
121
|
+
const OptionLabelDescription = ({
|
|
122
|
+
muiProps,
|
|
123
|
+
odysseyDesignTokens,
|
|
124
|
+
option
|
|
125
|
+
}) => {
|
|
126
|
+
const {
|
|
127
|
+
description,
|
|
128
|
+
label,
|
|
129
|
+
value
|
|
130
|
+
} = option;
|
|
131
|
+
return _jsx(Option, {
|
|
132
|
+
muiProps: muiProps,
|
|
133
|
+
children: _jsxs(OptionLabelContainer, {
|
|
134
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
135
|
+
children: [_jsx(Heading6, {
|
|
136
|
+
component: "p",
|
|
137
|
+
children: label
|
|
138
|
+
}), _jsx(OptionDescriptionComponent, {
|
|
139
|
+
description: description,
|
|
140
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}, value);
|
|
144
|
+
};
|
|
145
|
+
const OptionLabelDescriptionMetadata = ({
|
|
146
|
+
muiProps,
|
|
147
|
+
odysseyDesignTokens,
|
|
148
|
+
option
|
|
149
|
+
}) => {
|
|
150
|
+
const {
|
|
151
|
+
description,
|
|
152
|
+
label,
|
|
153
|
+
metaData,
|
|
154
|
+
value
|
|
155
|
+
} = option;
|
|
156
|
+
return _jsxs(Option, {
|
|
157
|
+
muiProps: muiProps,
|
|
158
|
+
children: [_jsxs(OptionLabelContainer, {
|
|
159
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
160
|
+
children: [_jsx(Heading6, {
|
|
161
|
+
component: "p",
|
|
162
|
+
children: label
|
|
163
|
+
}), _jsx(OptionDescriptionComponent, {
|
|
164
|
+
description: description,
|
|
165
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
166
|
+
})]
|
|
167
|
+
}), _jsx(OptionMetadataComponent, {
|
|
168
|
+
metaData: metaData,
|
|
169
|
+
odysseyDesignTokens: odysseyDesignTokens
|
|
170
|
+
})]
|
|
171
|
+
}, value);
|
|
172
|
+
};
|
|
173
|
+
const Picker = ({
|
|
174
|
+
ariaDescribedBy,
|
|
175
|
+
defaultValue,
|
|
176
|
+
errorMessage,
|
|
177
|
+
errorMessageList,
|
|
178
|
+
getIsOptionEqualToValue,
|
|
179
|
+
hasMultipleChoices,
|
|
180
|
+
id: idOverride,
|
|
181
|
+
inputValue,
|
|
182
|
+
isCustomValueAllowed,
|
|
183
|
+
isDisabled,
|
|
184
|
+
isFullWidth = false,
|
|
185
|
+
isLoading,
|
|
186
|
+
isOptional = false,
|
|
187
|
+
isReadOnly,
|
|
188
|
+
isVirtualized: isVirtualizedProp = false,
|
|
189
|
+
hint,
|
|
190
|
+
HintLinkComponent,
|
|
191
|
+
label,
|
|
192
|
+
name: nameOverride,
|
|
193
|
+
onBlur,
|
|
194
|
+
onChange: onChangeProp,
|
|
195
|
+
onInputChange: onInputChangeProp,
|
|
196
|
+
onFocus,
|
|
197
|
+
options,
|
|
198
|
+
value,
|
|
199
|
+
testId,
|
|
200
|
+
translate
|
|
201
|
+
}) => {
|
|
202
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
203
|
+
const customOptionRender = useCallback((muiProps, option) => {
|
|
204
|
+
const hasDescription = "description" in option && option.description;
|
|
205
|
+
const hasMetadata = "metaData" in option && option.metaData;
|
|
206
|
+
const isLabelOnly = !hasMetadata && !hasDescription;
|
|
207
|
+
if (isLabelOnly) {
|
|
208
|
+
return _jsx(OptionLabelOnlyComponent, {
|
|
209
|
+
muiProps: muiProps,
|
|
210
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
211
|
+
option: option
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (hasMetadata) {
|
|
215
|
+
return _jsx(OptionLabelDescriptionMetadata, {
|
|
216
|
+
muiProps: muiProps,
|
|
217
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
218
|
+
option: option
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return _jsx(OptionLabelDescription, {
|
|
222
|
+
muiProps: muiProps,
|
|
223
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
224
|
+
option: option
|
|
225
|
+
});
|
|
226
|
+
}, [odysseyDesignTokens]);
|
|
227
|
+
return _jsx(ComposablePicker, {
|
|
228
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
229
|
+
defaultValue: defaultValue,
|
|
230
|
+
errorMessage: errorMessage,
|
|
231
|
+
errorMessageList: errorMessageList,
|
|
232
|
+
getIsOptionEqualToValue: getIsOptionEqualToValue,
|
|
233
|
+
hasMultipleChoices: hasMultipleChoices,
|
|
234
|
+
id: idOverride,
|
|
235
|
+
inputValue: inputValue,
|
|
236
|
+
isCustomValueAllowed: isCustomValueAllowed,
|
|
237
|
+
isDisabled: isDisabled,
|
|
238
|
+
isFullWidth: isFullWidth,
|
|
239
|
+
isLoading: isLoading,
|
|
240
|
+
isOptional: isOptional,
|
|
241
|
+
isReadOnly: isReadOnly,
|
|
242
|
+
isVirtualized: isVirtualizedProp,
|
|
243
|
+
hint: hint,
|
|
244
|
+
HintLinkComponent: HintLinkComponent,
|
|
245
|
+
label: label,
|
|
246
|
+
name: nameOverride,
|
|
247
|
+
onBlur: onBlur,
|
|
248
|
+
onChange: onChangeProp,
|
|
249
|
+
onInputChange: onInputChangeProp,
|
|
250
|
+
onFocus: onFocus,
|
|
251
|
+
options: options,
|
|
252
|
+
renderOption: customOptionRender,
|
|
253
|
+
value: value,
|
|
254
|
+
testId: testId,
|
|
255
|
+
translate: translate
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
const MemoizedPicker = memo(Picker);
|
|
259
|
+
MemoizedPicker.displayName = "Picker";
|
|
260
|
+
export { MemoizedPicker as Picker };
|
|
261
|
+
//# sourceMappingURL=Picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Picker.js","names":["memo","useCallback","styled","ComposablePicker","useOdysseyDesignTokens","Heading6","Paragraph","createElement","_createElement","jsxs","_jsxs","jsx","_jsx","StyledOption","li","hasAdornment","display","OptionLabelContainer","shouldForwardProp","prop","p","margin","OptionDescription","odysseyDesignTokens","Spacing1","color","TypographyColorSubordinate","OptionDetails","gap","Spacing3","marginBlockStart","Spacing2","OptionDetail","alignItems","svg","width","Spacing4","HueNeutral400","Option","children","key","muiProps","OptionMetadataComponent","metaData","map","meta","index","detailText","icon","OptionDescriptionComponent","description","OptionLabelOnlyComponent","option","label","value","OptionLabelDescription","component","OptionLabelDescriptionMetadata","Picker","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","isVirtualizedProp","hint","HintLinkComponent","name","nameOverride","onBlur","onChange","onChangeProp","onInputChange","onInputChangeProp","onFocus","options","testId","translate","customOptionRender","hasDescription","hasMetadata","isLabelOnly","renderOption","MemoizedPicker","displayName"],"sources":["../../../src/labs/OdysseyPickers/Picker.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n HTMLAttributes,\n memo,\n PropsWithChildren,\n ReactElement,\n ReactNode,\n useCallback,\n} from \"react\";\nimport styled from \"@emotion/styled\";\n\nimport {\n ComposablePicker,\n type BasePickerProps,\n type BasePickerType,\n} from \"./ComposablePicker\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Heading6, Paragraph } from \"../../Typography\";\n\nexport const StyledOption = styled.li<{ hasAdornment?: boolean }>(\n ({ hasAdornment }) => ({\n ...(!hasAdornment && {\n display: \"block !important\",\n }),\n }),\n);\n\nexport const OptionLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({}) => ({\n p: {\n margin: 0,\n },\n}));\n\nexport const OptionDescription = styled(\"p\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n margin: `${odysseyDesignTokens.Spacing1} 0 0 !important`,\n color: odysseyDesignTokens.TypographyColorSubordinate,\n}));\n\nexport const OptionDetails = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n display: \"flex\",\n gap: odysseyDesignTokens.Spacing3,\n marginBlockStart: odysseyDesignTokens.Spacing2,\n}));\n\nexport const OptionDetail = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing1,\n\n svg: {\n width: odysseyDesignTokens.Spacing4,\n color: odysseyDesignTokens.HueNeutral400,\n },\n}));\n\nexport type BaseOptionProps = {\n muiProps: HTMLAttributes<HTMLLIElement>;\n odysseyDesignTokens: DesignTokens;\n};\n\ntype OptionComponentProps = {\n hasAdornment?: boolean;\n key: string | number;\n muiProps: BaseOptionProps[\"muiProps\"];\n};\n\nexport const Option = ({\n children,\n hasAdornment = false,\n key,\n muiProps,\n}: PropsWithChildren<OptionComponentProps>) => (\n <StyledOption {...muiProps} hasAdornment={hasAdornment} key={key}>\n {children}\n </StyledOption>\n);\n\nexport const OptionMetadataComponent = ({\n metaData,\n odysseyDesignTokens,\n}: {\n metaData: OptionMetadata[];\n odysseyDesignTokens: DesignTokens;\n}) => {\n return (\n <OptionDetails odysseyDesignTokens={odysseyDesignTokens}>\n {metaData.map((meta: OptionMetadata, index: number) => {\n const { detailText, icon } = meta;\n\n return (\n <OptionDetail\n key={`${index}-${detailText}`}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {icon}\n {detailText}\n </OptionDetail>\n );\n })}\n </OptionDetails>\n );\n};\n\nexport const OptionDescriptionComponent = ({\n description,\n odysseyDesignTokens,\n}: {\n description?: LabelDescription[\"description\"];\n odysseyDesignTokens: DesignTokens;\n}) => {\n return (\n description && (\n <OptionDescription odysseyDesignTokens={odysseyDesignTokens}>\n {description}\n </OptionDescription>\n )\n );\n};\n\nexport type OptionProps<OptionType> = {\n option: OptionType;\n};\n\nexport const OptionLabelOnlyComponent = <OptionType extends OptionLabelOnly>({\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps & OptionProps<OptionType>) => {\n const { label, value } = option;\n\n return (\n <Option muiProps={muiProps} key={value}>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Paragraph>{label}</Paragraph>\n </OptionLabelContainer>\n </Option>\n );\n};\n\nconst OptionLabelDescription = <OptionType extends LabelDescription>({\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps & OptionProps<OptionType>) => {\n const { description, label, value } = option;\n\n return (\n <Option muiProps={muiProps} key={value}>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n </Option>\n );\n};\n\nconst OptionLabelDescriptionMetadata = <\n OptionType extends LabelDescriptionMetadata,\n>({\n muiProps,\n odysseyDesignTokens,\n option,\n}: BaseOptionProps & OptionProps<OptionType>) => {\n const { description, label, metaData, value } = option;\n\n return (\n <Option key={value} muiProps={muiProps}>\n <OptionLabelContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading6 component=\"p\">{label}</Heading6>\n <OptionDescriptionComponent\n description={description}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </OptionLabelContainer>\n <OptionMetadataComponent\n metaData={metaData}\n odysseyDesignTokens={odysseyDesignTokens}\n />\n </Option>\n );\n};\n\nexport type OptionMetadata = {\n icon: ReactElement;\n detailText: string | number;\n};\n\nexport type OptionGroupType = { group?: string };\nexport type OptionValueType = { value: string | number };\nexport type OptionLabelType = { label: string };\nexport type BaseOptionType = OptionValueType &\n OptionGroupType &\n OptionLabelType;\nexport type Metadata = {\n metaData: OptionMetadata[];\n};\n\nexport type OptionLabelOnly = BaseOptionType;\nexport type LabelDescription = BaseOptionType & { description?: string };\nexport type LabelDescriptionMetadata = LabelDescription & Metadata;\n\nexport type PickerProps<\n OptionType extends LabelDescription | LabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>;\n\nexport type PickerComponentType = {\n <\n OptionType extends OptionLabelOnly,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n ): ReactElement;\n <\n OptionType extends LabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n ): ReactElement;\n <\n OptionType extends LabelDescription,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n ): ReactElement;\n <\n OptionType extends LabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: PickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>,\n ): ReactElement;\n};\n\nconst Picker: PickerComponentType = <\n OptionType extends\n | OptionLabelOnly\n | LabelDescription\n | LabelDescriptionMetadata,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized: isVirtualizedProp = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange: onChangeProp,\n onInputChange: onInputChangeProp,\n onFocus,\n options,\n value,\n testId,\n translate,\n}: PickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed>) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const customOptionRender = useCallback<\n (props: HTMLAttributes<HTMLLIElement>, option: OptionType) => ReactNode\n >(\n (muiProps, option) => {\n const hasDescription = \"description\" in option && option.description;\n const hasMetadata = \"metaData\" in option && option.metaData;\n const isLabelOnly = !hasMetadata && !hasDescription;\n\n if (isLabelOnly) {\n return (\n <OptionLabelOnlyComponent\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n }\n\n if (hasMetadata) {\n return (\n <OptionLabelDescriptionMetadata\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n }\n\n return (\n <OptionLabelDescription\n muiProps={muiProps}\n odysseyDesignTokens={odysseyDesignTokens}\n option={option}\n />\n );\n },\n [odysseyDesignTokens],\n );\n\n return (\n <ComposablePicker<OptionType, HasMultipleChoices, IsCustomValueAllowed>\n ariaDescribedBy={ariaDescribedBy}\n defaultValue={defaultValue}\n errorMessage={errorMessage}\n errorMessageList={errorMessageList}\n getIsOptionEqualToValue={getIsOptionEqualToValue}\n // getOptionLabel={// getOptionLabel}\n hasMultipleChoices={hasMultipleChoices}\n id={idOverride}\n inputValue={inputValue}\n isCustomValueAllowed={isCustomValueAllowed}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n isOptional={isOptional}\n isReadOnly={isReadOnly}\n isVirtualized={isVirtualizedProp}\n hint={hint}\n HintLinkComponent={HintLinkComponent}\n label={label}\n name={nameOverride}\n onBlur={onBlur}\n onChange={onChangeProp}\n onInputChange={onInputChangeProp}\n onFocus={onFocus}\n options={options}\n renderOption={customOptionRender}\n value={value}\n testId={testId}\n translate={translate}\n />\n );\n};\n\n// Need the `as BasePickerType` because generics don't get passed through\nconst MemoizedPicker = memo(Picker) as BasePickerType;\n\nMemoizedPicker.displayName = \"Picker\";\n\nexport { MemoizedPicker as Picker };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,IAAI,EAIJC,WAAW,QACN,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAGnCC,gBAAgB;AAAA,SAKhBC,sBAAsB;AAAA,SAGfC,QAAQ,EAAEC,SAAS;AAAA,SAAAC,aAAA,IAAAC,cAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE5B,OAAO,MAAMC,YAAY,GAAGX,MAAM,CAACY,EAAE,CACnC,CAAC;EAAEC;AAAa,CAAC,MAAM;EACrB,IAAI,CAACA,YAAY,IAAI;IACnBC,OAAO,EAAE;EACX,CAAC;AACH,CAAC,CACH,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGf,MAAM,CAAC,KAAK,EAAE;EAChDgB,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAwC,CAAC,CAAC,CAAC,MAAM;EACjDC,CAAC,EAAE;IACDC,MAAM,EAAE;EACV;AACF,CAAC,CAAC,CAAC;AAEH,OAAO,MAAMC,iBAAiB,GAAGpB,MAAM,CAAC,GAAG,EAAE;EAC3CgB,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAwC,CAAC;EAAEI;AAAoB,CAAC,MAAM;EACtEF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ACvCC,EAAE,EAAEC,UAAW;IACfC,UAAU,EAAEA,UAAW;IACvBC,oBAAoB,EAAEA,oBAAqB;IAC3CC,UAAU,EAAEA,UAAW;IACvBC,WAAW,EAAEA,WAAY;IACzBC,SAAS,EAAEA,SAAU;IACrBC,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBC,aAAa,EAAEC,iBAAkB;IACjCC,IAAI,EAAEA,IAAK;IACXC,iBAAiB,EAAEA,iBAAkB;IACrCxB,KAAK,EAAEA,KAAM;IACbyB,IAAI,EAAEC,YAAa;IACnBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEC,YAAa;IACvBC,aAAa,EAAEC,iBAAkB;IACjCC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBO,YAAY,EAAEJ,kBAAmB;IACjCnC,KAAK,EAAEA,KAAM;IACbiC,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAMM,cAAc,GAAG9F,IAAI,CAAC0D,MAAM,CAAmB;AAErDoC,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIpC,MAAM"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023-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 { Children, createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
14
|
+
import { VariableSizeList } from "react-window";
|
|
15
|
+
import styled from "@emotion/styled";
|
|
16
|
+
import { createElement as _createElement } from "react";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const ListboxContainer = styled.div({
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "100%"
|
|
21
|
+
});
|
|
22
|
+
const Row = ({
|
|
23
|
+
data,
|
|
24
|
+
index,
|
|
25
|
+
setItemSize,
|
|
26
|
+
style
|
|
27
|
+
}) => {
|
|
28
|
+
const rowRef = useRef(null);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (rowRef.current) {
|
|
31
|
+
const firstChild = rowRef.current.firstElementChild;
|
|
32
|
+
const height = firstChild ? firstChild.clientHeight : rowRef.current.clientHeight;
|
|
33
|
+
setItemSize(height);
|
|
34
|
+
}
|
|
35
|
+
}, [index, rowRef, setItemSize]);
|
|
36
|
+
const baseOption = data[index];
|
|
37
|
+
const {
|
|
38
|
+
key,
|
|
39
|
+
props
|
|
40
|
+
} = baseOption;
|
|
41
|
+
const styles = useMemo(() => ({
|
|
42
|
+
...style,
|
|
43
|
+
height: "auto"
|
|
44
|
+
}), [style]);
|
|
45
|
+
return _jsx("div", {
|
|
46
|
+
ref: rowRef,
|
|
47
|
+
children: _createElement("li", {
|
|
48
|
+
...props,
|
|
49
|
+
key: key,
|
|
50
|
+
style: styles
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const OuterListboxContext = createContext({});
|
|
55
|
+
const OuterListboxElementType = forwardRef((props, ref) => {
|
|
56
|
+
const outerProps = useContext(OuterListboxContext);
|
|
57
|
+
return _jsx("div", {
|
|
58
|
+
ref: ref,
|
|
59
|
+
...props,
|
|
60
|
+
...outerProps
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
const useResetCache = length => {
|
|
64
|
+
const resetCacheRef = useRef(null);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (resetCacheRef.current) {
|
|
67
|
+
resetCacheRef.current.resetAfterIndex(0, true);
|
|
68
|
+
}
|
|
69
|
+
}, [length]);
|
|
70
|
+
return resetCacheRef;
|
|
71
|
+
};
|
|
72
|
+
const PickerVirtualizationListBox = forwardRef((props = {}, ref) => {
|
|
73
|
+
const [listHeight, setListHeight] = useState(0);
|
|
74
|
+
const {
|
|
75
|
+
children,
|
|
76
|
+
...other
|
|
77
|
+
} = props;
|
|
78
|
+
const itemData = Children.toArray(children).flatMap(child => typeof child === "number" || typeof child === "string" ? [child] : [child].concat("children" in child ? Children.toArray(children) : []));
|
|
79
|
+
const sizeMapRef = useRef([]);
|
|
80
|
+
const getListBoxHeight = useCallback(() => {
|
|
81
|
+
const COMBINED_LISTBOX_PADDING = 16;
|
|
82
|
+
if (itemData.length > OVERSCAN_ROW_COUNT) {
|
|
83
|
+
return 9999;
|
|
84
|
+
} else {
|
|
85
|
+
const itemsHeightCalculated = sizeMapRef.current.slice(0, itemData.length - 1).map((_, index) => sizeMapRef.current[index] || 0).reduce((prevItemHeight, nextItemHeight) => prevItemHeight + nextItemHeight, 0);
|
|
86
|
+
return COMBINED_LISTBOX_PADDING + itemsHeightCalculated;
|
|
87
|
+
}
|
|
88
|
+
}, [itemData, sizeMapRef]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (sizeMapRef.current.length && itemData.length) {
|
|
91
|
+
setListHeight(getListBoxHeight());
|
|
92
|
+
}
|
|
93
|
+
}, [getListBoxHeight, itemData, sizeMapRef]);
|
|
94
|
+
const OVERSCAN_ROW_COUNT = 8;
|
|
95
|
+
const gridRef = useResetCache(itemData.length);
|
|
96
|
+
const setItemSize = useCallback(size => {
|
|
97
|
+
gridRef?.current?.resetAfterIndex(0, true);
|
|
98
|
+
sizeMapRef.current = sizeMapRef.current.concat(size);
|
|
99
|
+
}, [gridRef, sizeMapRef]);
|
|
100
|
+
const getItemSize = useCallback(index => sizeMapRef.current[index] || 45, [sizeMapRef]);
|
|
101
|
+
return _jsx(ListboxContainer, {
|
|
102
|
+
ref: ref,
|
|
103
|
+
children: _jsx(OuterListboxContext.Provider, {
|
|
104
|
+
value: other,
|
|
105
|
+
children: _jsx(VariableSizeList, {
|
|
106
|
+
innerElementType: "ul",
|
|
107
|
+
itemData: itemData,
|
|
108
|
+
itemCount: itemData.length,
|
|
109
|
+
itemSize: getItemSize,
|
|
110
|
+
height: listHeight,
|
|
111
|
+
width: "100%",
|
|
112
|
+
ref: gridRef,
|
|
113
|
+
outerElementType: OuterListboxElementType,
|
|
114
|
+
overscanCount: OVERSCAN_ROW_COUNT,
|
|
115
|
+
children: ({
|
|
116
|
+
data,
|
|
117
|
+
index,
|
|
118
|
+
style
|
|
119
|
+
}) => _jsx(Row, {
|
|
120
|
+
data: data,
|
|
121
|
+
index: index,
|
|
122
|
+
style: style,
|
|
123
|
+
setItemSize: setItemSize
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
const MemoizedPickerVirtualizationListBox = memo(PickerVirtualizationListBox);
|
|
130
|
+
MemoizedPickerVirtualizationListBox.displayName = "PickerVirtualizationListBox";
|
|
131
|
+
export { MemoizedPickerVirtualizationListBox as PickerVirtualizationListBox };
|
|
132
|
+
//# sourceMappingURL=PickerVirtualizationListBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerVirtualizationListBox.js","names":["Children","createContext","forwardRef","memo","useCallback","useContext","useEffect","useMemo","useRef","useState","VariableSizeList","styled","createElement","_createElement","jsx","_jsx","ListboxContainer","div","width","height","Row","data","index","setItemSize","style","rowRef","current","firstChild","firstElementChild","clientHeight","baseOption","key","props","styles","ref","children","OuterListboxContext","OuterListboxElementType","outerProps","useResetCache","length","resetCacheRef","resetAfterIndex","PickerVirtualizationListBox","listHeight","setListHeight","other","itemData","toArray","flatMap","child","concat","sizeMapRef","getListBoxHeight","COMBINED_LISTBOX_PADDING","OVERSCAN_ROW_COUNT","itemsHeightCalculated","slice","map","_","reduce","prevItemHeight","nextItemHeight","gridRef","size","getItemSize","Provider","value","innerElementType","itemCount","itemSize","outerElementType","overscanCount","MemoizedPickerVirtualizationListBox","displayName"],"sources":["../../../src/labs/OdysseyPickers/PickerVirtualizationListBox.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n Children,\n createContext,\n forwardRef,\n memo,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { VariableSizeList, ListChildComponentProps } from \"react-window\";\nimport styled from \"@emotion/styled\";\nimport { AutocompleteProps } from \"@mui/material\";\n\ntype SetItemSize = (size: number) => void;\n\nconst ListboxContainer = styled.div({\n width: \"100%\",\n height: \"100%\",\n});\n\nconst Row = ({\n data,\n index,\n setItemSize,\n style,\n}: ListChildComponentProps & { setItemSize: SetItemSize }) => {\n const rowRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (rowRef.current) {\n /**\n * Checking for child height to workaround a bug where the clientHeight of the row isn't updated correctly\n * @see here if you need to know more: https://github.com/bvaughn/react-window/issues/582#issuecomment-1883074908\n */\n const firstChild = rowRef.current.firstElementChild;\n const height = firstChild\n ? firstChild.clientHeight\n : rowRef.current.clientHeight;\n\n setItemSize(height);\n }\n }, [index, rowRef, setItemSize]);\n\n const baseOption = data[index];\n const { key, props } = baseOption;\n\n /**\n * react-window calculates the absolute positions of the list items, via an inline style, so\n * we need to add it to each list item that is being rendered in the viewable list window.\n * @see here if you need to know more: https://github.com/bvaughn/react-window?tab=readme-ov-file#why-is-my-list-blank-when-i-scroll\n */\n const styles = useMemo(\n () => ({\n ...style,\n height: \"auto\",\n }),\n [style],\n );\n\n return (\n <div ref={rowRef}>\n <li {...props} key={key} style={styles} />\n </div>\n );\n};\n\nconst OuterListboxContext = createContext({});\n\nconst OuterListboxElementType = forwardRef<HTMLDivElement>((props, ref) => {\n const outerProps = useContext(OuterListboxContext);\n return <div ref={ref} {...props} {...outerProps} />;\n});\n\nconst useResetCache = (length: number) => {\n const resetCacheRef = useRef<VariableSizeList>(null);\n useEffect(() => {\n if (resetCacheRef.current) {\n resetCacheRef.current.resetAfterIndex(0, true);\n }\n }, [length]);\n return resetCacheRef;\n};\n\nconst PickerVirtualizationListBox = forwardRef<\n HTMLDivElement,\n AutocompleteProps<undefined, undefined, undefined, undefined>[\"ListboxProps\"]\n>((props = {}, ref) => {\n const [listHeight, setListHeight] = useState(0);\n\n const { children, ...other } = props;\n\n const itemData = Children.toArray(children).flatMap<typeof children>(\n (child) =>\n typeof child === \"number\" || typeof child === \"string\"\n ? [child]\n : [child].concat(\"children\" in child ? Children.toArray(children) : []),\n );\n\n const sizeMapRef = useRef<number[]>([]);\n\n const getListBoxHeight = useCallback(() => {\n // 8px of padding top/bottom applied by MUI\n const COMBINED_LISTBOX_PADDING = 16;\n\n if (itemData.length > OVERSCAN_ROW_COUNT) {\n // has a max-height of 40vh set in CSS. This is only set because height needs to be a number\n return 9999;\n } else {\n const itemsHeightCalculated = sizeMapRef.current\n .slice(0, itemData.length - 1)\n .map((_, index) => sizeMapRef.current[index] || 0)\n .reduce(\n (prevItemHeight, nextItemHeight) => prevItemHeight + nextItemHeight,\n 0,\n );\n return COMBINED_LISTBOX_PADDING + itemsHeightCalculated;\n }\n }, [itemData, sizeMapRef]);\n\n useEffect(() => {\n if (sizeMapRef.current.length && itemData.length) {\n setListHeight(getListBoxHeight());\n }\n }, [getListBoxHeight, itemData, sizeMapRef]);\n\n // The number of items (rows or columns) to render outside of the visible area for performance and scrolling reasons\n const OVERSCAN_ROW_COUNT = 8;\n\n const gridRef = useResetCache(itemData.length);\n\n const setItemSize = useCallback<SetItemSize>(\n (size) => {\n gridRef?.current?.resetAfterIndex(0, true);\n sizeMapRef.current = sizeMapRef.current.concat(size);\n },\n [gridRef, sizeMapRef],\n );\n const getItemSize = useCallback(\n // using 45px as a sane default here to avoid a lot of content shift on repaint\n (index: number) => sizeMapRef.current[index] || 45,\n [sizeMapRef],\n );\n\n return (\n <ListboxContainer ref={ref}>\n <OuterListboxContext.Provider value={other}>\n <VariableSizeList\n innerElementType=\"ul\"\n itemData={itemData}\n itemCount={itemData.length}\n itemSize={getItemSize}\n height={listHeight}\n width=\"100%\"\n ref={gridRef}\n outerElementType={OuterListboxElementType}\n overscanCount={OVERSCAN_ROW_COUNT}\n >\n {({ data, index, style }) => (\n <Row\n data={data}\n index={index}\n style={style}\n setItemSize={setItemSize}\n />\n )}\n </VariableSizeList>\n </OuterListboxContext.Provider>\n </ListboxContainer>\n );\n});\n\nconst MemoizedPickerVirtualizationListBox = memo(PickerVirtualizationListBox);\n\nMemoizedPickerVirtualizationListBox.displayName = \"PickerVirtualizationListBox\";\n\nexport { MemoizedPickerVirtualizationListBox as PickerVirtualizationListBox };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,IAAI,EACJC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,gBAAgB,QAAiC,cAAc;AACxE,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAAAC,aAAA,IAAAC,cAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAKrC,MAAMC,gBAAgB,GAAGL,MAAM,CAACM,GAAG,CAAC;EAClCC,KAAK,EAAE,MAAM;EACb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