@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
|
@@ -10,38 +10,58 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { useMemo } from "react";
|
|
13
14
|
import { createTheme, ThemeProvider as MuiThemeProvider } from "@mui/material/styles";
|
|
14
|
-
import { memo, useMemo } from "react";
|
|
15
15
|
import { deepmerge } from "@mui/utils";
|
|
16
|
+
import styled from "@emotion/styled";
|
|
16
17
|
import { createOdysseyMuiTheme } from "./theme/index.js";
|
|
17
18
|
import * as Tokens from "@okta/odyssey-design-tokens";
|
|
19
|
+
import { ContrastModeContext, useContrastMode } from "./useContrastMode.js";
|
|
18
20
|
import { OdysseyDesignTokensContext } from "./OdysseyDesignTokensContext.js";
|
|
19
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
const
|
|
22
|
+
const StyledContrastContainer = styled("div")(() => ({
|
|
23
|
+
height: "inherit"
|
|
24
|
+
}));
|
|
25
|
+
export const OdysseyThemeProvider = ({
|
|
21
26
|
children,
|
|
27
|
+
contrastMode: explicitContrastMode,
|
|
22
28
|
designTokensOverride,
|
|
23
29
|
shadowDomElement,
|
|
24
30
|
shadowRootElement,
|
|
25
31
|
themeOverride
|
|
26
32
|
}) => {
|
|
33
|
+
const {
|
|
34
|
+
contrastMode,
|
|
35
|
+
contrastContainerRef
|
|
36
|
+
} = useContrastMode({
|
|
37
|
+
contrastMode: explicitContrastMode
|
|
38
|
+
});
|
|
27
39
|
const odysseyTokens = useMemo(() => ({
|
|
28
40
|
...Tokens,
|
|
29
41
|
...designTokensOverride
|
|
30
42
|
}), [designTokensOverride]);
|
|
43
|
+
const effectiveShadowRootElement = shadowRootElement || shadowDomElement;
|
|
31
44
|
const odysseyTheme = useMemo(() => createOdysseyMuiTheme({
|
|
45
|
+
contrastMode,
|
|
32
46
|
odysseyTokens,
|
|
33
|
-
shadowRootElement:
|
|
34
|
-
|
|
35
|
-
}), [
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
shadowRootElement: effectiveShadowRootElement
|
|
48
|
+
}), [contrastMode, odysseyTokens, effectiveShadowRootElement]);
|
|
49
|
+
const customOdysseyTheme = useMemo(() => createTheme(deepmerge(odysseyTheme, themeOverride || {})), [odysseyTheme, themeOverride]);
|
|
50
|
+
const contrastModeProviderValue = useMemo(() => ({
|
|
51
|
+
contrastMode
|
|
52
|
+
}), [contrastMode]);
|
|
53
|
+
return _jsx(StyledContrastContainer, {
|
|
54
|
+
ref: contrastContainerRef,
|
|
55
|
+
children: _jsx(ContrastModeContext.Provider, {
|
|
56
|
+
value: contrastModeProviderValue,
|
|
57
|
+
children: _jsx(MuiThemeProvider, {
|
|
58
|
+
theme: customOdysseyTheme,
|
|
59
|
+
children: _jsx(OdysseyDesignTokensContext.Provider, {
|
|
60
|
+
value: odysseyTokens,
|
|
61
|
+
children: children
|
|
62
|
+
})
|
|
63
|
+
})
|
|
42
64
|
})
|
|
43
65
|
});
|
|
44
66
|
};
|
|
45
|
-
const MemoizedOdysseyThemeProvider = memo(OdysseyThemeProvider);
|
|
46
|
-
export { MemoizedOdysseyThemeProvider as OdysseyThemeProvider };
|
|
47
67
|
//# sourceMappingURL=OdysseyThemeProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OdysseyThemeProvider.js","names":["createTheme","ThemeProvider","MuiThemeProvider","
|
|
1
|
+
{"version":3,"file":"OdysseyThemeProvider.js","names":["useMemo","createTheme","ThemeProvider","MuiThemeProvider","deepmerge","styled","createOdysseyMuiTheme","Tokens","ContrastModeContext","useContrastMode","OdysseyDesignTokensContext","jsx","_jsx","StyledContrastContainer","height","OdysseyThemeProvider","children","contrastMode","explicitContrastMode","designTokensOverride","shadowDomElement","shadowRootElement","themeOverride","contrastContainerRef","odysseyTokens","effectiveShadowRootElement","odysseyTheme","customOdysseyTheme","contrastModeProviderValue","ref","Provider","value","theme"],"sources":["../src/OdysseyThemeProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 { ReactNode, useMemo } from \"react\";\nimport {\n createTheme,\n ThemeProvider as MuiThemeProvider,\n} from \"@mui/material/styles\";\nimport { ThemeOptions } from \"@mui/material\";\nimport { deepmerge } from \"@mui/utils\";\nimport styled from \"@emotion/styled\";\nimport { createOdysseyMuiTheme, DesignTokensOverride } from \"./theme\";\nimport * as Tokens from \"@okta/odyssey-design-tokens\";\n\nimport {\n ContrastMode,\n ContrastModeContext,\n useContrastMode,\n} from \"./useContrastMode\";\nimport { OdysseyDesignTokensContext } from \"./OdysseyDesignTokensContext\";\n\nexport type OdysseyThemeProviderProps = {\n children: ReactNode;\n contrastMode?: ContrastMode;\n designTokensOverride?: DesignTokensOverride;\n /** @deprecated Use shadowRootElement instead */\n shadowDomElement?: HTMLDivElement | HTMLElement;\n shadowRootElement?: HTMLDivElement | HTMLElement;\n themeOverride?: ThemeOptions;\n};\n\nconst StyledContrastContainer = styled(\"div\")(() => ({\n height: \"inherit\",\n}));\n\n/**\n * This function doesn't include the Emotion Cache or Translations. You should probably be using `OdysseyProvider`.\n *\n * Some teams have a need to wrap separately (SIW), but most teams will never need to use this explicitly.\n */\nexport const OdysseyThemeProvider = ({\n children,\n contrastMode: explicitContrastMode,\n designTokensOverride,\n shadowDomElement,\n shadowRootElement,\n themeOverride,\n}: OdysseyThemeProviderProps) => {\n const { contrastMode, contrastContainerRef } = useContrastMode({\n contrastMode: explicitContrastMode,\n });\n\n const odysseyTokens = useMemo(\n () => ({ ...Tokens, ...designTokensOverride }),\n [designTokensOverride],\n );\n\n const effectiveShadowRootElement = shadowRootElement || shadowDomElement;\n\n const odysseyTheme = useMemo(\n () =>\n createOdysseyMuiTheme({\n contrastMode,\n odysseyTokens,\n shadowRootElement: effectiveShadowRootElement,\n }),\n [contrastMode, odysseyTokens, effectiveShadowRootElement],\n );\n\n const customOdysseyTheme = useMemo(\n () => createTheme(deepmerge(odysseyTheme, themeOverride || {})),\n [odysseyTheme, themeOverride],\n );\n\n const contrastModeProviderValue = useMemo(\n () => ({\n contrastMode,\n }),\n [contrastMode],\n );\n\n return (\n <StyledContrastContainer ref={contrastContainerRef}>\n <ContrastModeContext.Provider value={contrastModeProviderValue}>\n <MuiThemeProvider theme={customOdysseyTheme}>\n <OdysseyDesignTokensContext.Provider value={odysseyTokens}>\n {children}\n </OdysseyDesignTokensContext.Provider>\n </MuiThemeProvider>\n </ContrastModeContext.Provider>\n </StyledContrastContainer>\n );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,OAAO,QAAQ,OAAO;AAC1C,SACEC,WAAW,EACXC,aAAa,IAAIC,gBAAgB,QAC5B,sBAAsB;AAE7B,SAASC,SAAS,QAAQ,YAAY;AACtC,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAC5BC,qBAAqB;AAC9B,OAAO,KAAKC,MAAM,MAAM,6BAA6B;AAAC,SAIpDC,mBAAmB,EACnBC,eAAe;AAAA,SAERC,0BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAYnC,MAAMC,uBAAuB,GAAGR,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO;EACnDS,MAAM,EAAE;AACV,CAAC,CAAC,CAAC;AAOH,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EACnCC,QAAQ;EACRC,YAAY,EAAEC,oBAAoB;EAClCC,oBAAoB;EACpBC,gBAAgB;EAChBC,iBAAiB;EACjBC;AACyB,CAAC,KAAK;EAC/B,MAAM;IAAEL,YAAY;IAAEM;EAAqB,CAAC,GAAGd,eAAe,CAAC;IAC7DQ,YAAY,EAAEC;EAChB,CAAC,CAAC;EAEF,MAAMM,aAAa,GAAGxB,OAAO,CAC3B,OAAO;IAAE,GAAGO,MAAM;IAAE,GAAGY;EAAqB,CAAC,CAAC,EAC9C,CAACA,oBAAoB,CACvB,CAAC;EAED,MAAMM,0BAA0B,GAAGJ,iBAAiB,IAAID,gBAAgB;EAExE,MAAMM,YAAY,GAAG1B,OAAO,CAC1B,MACEM,qBAAqB,CAAC;IACpBW,YAAY;IACZO,aAAa;IACbH,iBAAiB,EAAEI;EACrB,CAAC,CAAC,EACJ,CAACR,YAAY,EAAEO,aAAa,EAAEC,0BAA0B,CAC1D,CAAC;EAED,MAAME,kBAAkB,GAAG3B,OAAO,CAChC,MAAMC,WAAW,CAACG,SAAS,CAACsB,YAAY,EAAEJ,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,EAC/D,CAACI,YAAY,EAAEJ,aAAa,CAC9B,CAAC;EAED,MAAMM,yBAAyB,GAAG5B,OAAO,CACvC,OAAO;IACLiB;EACF,CAAC,CAAC,EACF,CAACA,YAAY,CACf,CAAC;EAED,OACEL,IAAA,CAACC,uBAAuB;IAACgB,GAAG,EAAEN,oBAAqB;IAAAP,QAAA,EACjDJ,IAAA,CAACJ,mBAAmB,CAACsB,QAAQ;MAACC,KAAK,EAAEH,yBAA0B;MAAAZ,QAAA,EAC7DJ,IAAA,CAACT,gBAAgB;QAAC6B,KAAK,EAAEL,kBAAmB;QAAAX,QAAA,EAC1CJ,IAAA,CAACF,0BAA0B,CAACoB,QAAQ;UAACC,KAAK,EAAEP,aAAc;UAAAR,QAAA,EACvDA;QAAQ,CAC0B;MAAC,CACtB;IAAC,CACS;EAAC,CACR,CAAC;AAE9B,CAAC"}
|
|
@@ -18,6 +18,7 @@ import styled from "@emotion/styled";
|
|
|
18
18
|
import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
|
|
19
19
|
import { Box } from "../Box.js";
|
|
20
20
|
import { usePagination } from "./usePagination.js";
|
|
21
|
+
import { useTranslation } from "react-i18next";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
const PaginationContainer = styled("div")({
|
|
@@ -61,31 +62,51 @@ const PaginationButtonContainer = styled("div")({
|
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
const Pagination = ({
|
|
64
|
-
currentPageLabel,
|
|
65
|
+
currentPageLabel: currentPageLabelProp,
|
|
66
|
+
currentRowsCount,
|
|
67
|
+
hasPageInput = true,
|
|
68
|
+
hasRowCountInput = true,
|
|
69
|
+
hasRowCountLabel = true,
|
|
65
70
|
isDisabled,
|
|
66
71
|
isMoreDisabled,
|
|
67
72
|
lastRow,
|
|
68
|
-
loadMoreLabel,
|
|
73
|
+
loadMoreLabel: loadMoreLabelProp,
|
|
69
74
|
maxPageIndex,
|
|
70
75
|
maxPageSize,
|
|
71
|
-
nextLabel,
|
|
72
|
-
onPaginationChange,
|
|
76
|
+
nextLabel: nextLabelProp,
|
|
77
|
+
onPaginationChange: onPaginationChangeProp,
|
|
73
78
|
pageIndex,
|
|
74
79
|
pageSize,
|
|
75
|
-
previousLabel,
|
|
76
|
-
rowsPerPageLabel,
|
|
80
|
+
previousLabel: previousLabelProp,
|
|
81
|
+
rowsPerPageLabel: rowsPerPageLabelProp,
|
|
77
82
|
totalRows,
|
|
78
|
-
currentRowsCount,
|
|
79
83
|
variant
|
|
80
84
|
}) => {
|
|
81
85
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
86
|
+
const {
|
|
87
|
+
t
|
|
88
|
+
} = useTranslation();
|
|
82
89
|
const [page, setPage] = useState(pageIndex);
|
|
83
90
|
const [rowsPerPage, setRowsPerPage] = useState(pageSize);
|
|
84
91
|
const initialRowsPerPage = useRef(pageSize);
|
|
92
|
+
const currentPageLabel = currentPageLabelProp ?? t("pagination.page");
|
|
93
|
+
const loadMoreLabel = loadMoreLabelProp ?? t("pagination.loadmore");
|
|
94
|
+
const nextLabel = nextLabelProp ?? t("pagination.next");
|
|
95
|
+
const previousLabel = previousLabelProp ?? t("pagination.previous");
|
|
96
|
+
const rowsPerPageLabel = rowsPerPageLabelProp ?? t("pagination.rowsperpage");
|
|
85
97
|
useEffect(() => {
|
|
86
98
|
setPage(pageIndex);
|
|
87
99
|
setRowsPerPage(pageSize);
|
|
88
100
|
}, [pageIndex, pageSize]);
|
|
101
|
+
const onPaginationChange = useCallback(({
|
|
102
|
+
pageIndex,
|
|
103
|
+
pageSize
|
|
104
|
+
}) => {
|
|
105
|
+
onPaginationChangeProp({
|
|
106
|
+
pageIndex,
|
|
107
|
+
pageSize
|
|
108
|
+
});
|
|
109
|
+
}, [onPaginationChangeProp]);
|
|
89
110
|
const {
|
|
90
111
|
totalRowsLabel
|
|
91
112
|
} = usePagination({
|
|
@@ -95,13 +116,24 @@ const Pagination = ({
|
|
|
95
116
|
totalRows
|
|
96
117
|
});
|
|
97
118
|
const handlePaginationChange = useCallback(() => {
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
let updatedPage = page;
|
|
120
|
+
let updatedRowsPerPage = rowsPerPage;
|
|
121
|
+
if (totalRows) {
|
|
122
|
+
const maxPageIndex = Math.ceil(totalRows / updatedRowsPerPage);
|
|
123
|
+
if (updatedRowsPerPage > totalRows) {
|
|
124
|
+
updatedRowsPerPage = totalRows;
|
|
125
|
+
}
|
|
126
|
+
if (updatedPage > maxPageIndex) {
|
|
127
|
+
updatedPage = maxPageIndex;
|
|
128
|
+
} else if (updatedPage < 1) {
|
|
129
|
+
updatedPage = 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
100
132
|
onPaginationChange({
|
|
101
133
|
pageIndex: updatedPage,
|
|
102
134
|
pageSize: updatedRowsPerPage
|
|
103
135
|
});
|
|
104
|
-
}, [page, rowsPerPage,
|
|
136
|
+
}, [page, rowsPerPage, onPaginationChange, totalRows]);
|
|
105
137
|
const handlePageSubmit = useCallback(event => {
|
|
106
138
|
if (event.key === "Enter") {
|
|
107
139
|
onPaginationChange({
|
|
@@ -147,7 +179,7 @@ const Pagination = ({
|
|
|
147
179
|
const loadMoreIsDisabled = useMemo(() => {
|
|
148
180
|
return isMoreDisabled || (totalRows ? rowsPerPage >= totalRows : false);
|
|
149
181
|
}, [isMoreDisabled, rowsPerPage, totalRows]);
|
|
150
|
-
const nextButtonDisabled = useMemo(() => isMoreDisabled || (totalRows ? lastRow >= totalRows : false) || isDisabled, [isMoreDisabled, totalRows, lastRow, isDisabled]);
|
|
182
|
+
const nextButtonDisabled = useMemo(() => isMoreDisabled || lastRow && (totalRows ? lastRow >= totalRows : false) || isDisabled, [isMoreDisabled, totalRows, lastRow, isDisabled]);
|
|
151
183
|
const previousButtonDisabled = useMemo(() => pageIndex <= 1 || isDisabled, [pageIndex, isDisabled]);
|
|
152
184
|
const rowsPerPageInputProps = useMemo(() => ({
|
|
153
185
|
"aria-label": rowsPerPageLabel,
|
|
@@ -160,7 +192,7 @@ const Pagination = ({
|
|
|
160
192
|
return variant === "paged" ? _jsxs(PaginationContainer, {
|
|
161
193
|
children: [_jsxs(PaginationSegment, {
|
|
162
194
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
163
|
-
children: [_jsxs(Box, {
|
|
195
|
+
children: [hasRowCountInput && _jsxs(Box, {
|
|
164
196
|
children: [_jsx(Paragraph, {
|
|
165
197
|
component: "span",
|
|
166
198
|
color: "textSecondary",
|
|
@@ -175,14 +207,14 @@ const Pagination = ({
|
|
|
175
207
|
disabled: isDisabled,
|
|
176
208
|
inputProps: rowsPerPageInputProps
|
|
177
209
|
})]
|
|
178
|
-
}), _jsx(Paragraph, {
|
|
210
|
+
}), hasRowCountLabel && _jsx(Paragraph, {
|
|
179
211
|
component: "span",
|
|
180
212
|
color: "textSecondary",
|
|
181
213
|
children: totalRowsLabel
|
|
182
214
|
})]
|
|
183
215
|
}), _jsxs(PaginationSegment, {
|
|
184
216
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
185
|
-
children: [totalRows && _jsxs(Box, {
|
|
217
|
+
children: [totalRows && hasPageInput && _jsxs(Box, {
|
|
186
218
|
children: [_jsx(Paragraph, {
|
|
187
219
|
component: "span",
|
|
188
220
|
color: "textSecondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","Paragraph","Button","ArrowLeftIcon","ArrowRightIcon","styled","useOdysseyDesignTokens","Box","usePagination","jsx","_jsx","jsxs","_jsxs","PaginationContainer","display","alignItems","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","gap","Spacing4","Spacing2","PaginationInput","_InputBase","borderColor","HueNeutral200","borderRadius","BorderRadiusTight","height","Spacing6","width","HueNeutral400","PalettePrimaryMain","PaginationButtonContainer","marginInlineStart","Pagination","currentPageLabel","isDisabled","isMoreDisabled","lastRow","loadMoreLabel","maxPageIndex","maxPageSize","nextLabel","onPaginationChange","pageIndex","pageSize","previousLabel","rowsPerPageLabel","totalRows","currentRowsCount","variant","page","setPage","rowsPerPage","setRowsPerPage","initialRowsPerPage","totalRowsLabel","handlePaginationChange","updatedPage","Math","ceil","updatedRowsPerPage","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","children","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","startIcon","size","ariaLabel","onClick","endIcon","label","MemoizedPagination","displayName"],"sources":["../../src/Pagination/Pagination.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Paragraph } from \"../Typography\";\nimport { Button } from \"../Button\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated\";\nimport styled from \"@emotion/styled\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext\";\nimport { Box } from \"../Box\";\nimport { paginationTypeValues } from \"./constants\";\nimport { usePagination } from \"./usePagination\";\n\nconst PaginationContainer = styled(\"div\")({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing4,\n \"& > div\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing2,\n },\n}));\n\nconst PaginationInput = styled(InputBase, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n borderColor: odysseyDesignTokens.HueNeutral200,\n borderRadius: odysseyDesignTokens.BorderRadiusTight,\n height: odysseyDesignTokens.Spacing6,\n width: \"4.5714285714rem\", // This is a hardcoded value, keep as string\n \"&:hover\": {\n borderColor: odysseyDesignTokens.HueNeutral400,\n },\n \"&.Mui-focused:hover\": {\n borderColor: odysseyDesignTokens.PalettePrimaryMain,\n },\n}));\n\nconst PaginationButtonContainer = styled(\"div\")({\n \"& > *\": {\n marginInlineStart: `0 !important`,\n },\n});\n\nexport type PaginationProps = {\n /**\n * The labeled rendered for the current page index\n */\n currentPageLabel: string;\n /**\n * The number of items currently visible on the page\n */\n currentRowsCount?: number;\n /**\n * If true, the pagination controls will be disabled\n */\n isDisabled?: boolean;\n /**\n * If true, the next or Show More button will be disabled\n */\n isMoreDisabled?: boolean;\n /**\n * The current page last row index\n */\n lastRow: number;\n /**\n * If the pagination is of \"loadMore\" variant, then this is the the load more label\n */\n loadMoreLabel: string;\n /**\n * The max page\n */\n maxPageIndex?: number;\n /**\n * The max rows per page\n */\n maxPageSize?: number;\n /**\n * The label for the next control\n */\n nextLabel: string;\n /**\n * Page index and page size setter\n */\n onPaginationChange: ({\n pageIndex,\n pageSize,\n }: {\n pageIndex: number;\n pageSize: number;\n }) => void;\n /**\n * The current page index\n */\n pageIndex: number;\n /**\n * The current page size\n */\n pageSize: number;\n /**\n * The label for the previous control\n */\n previousLabel: string;\n /**\n * The label that shows how many results are rendered per page\n */\n rowsPerPageLabel: string;\n /**\n * Total rows count\n */\n totalRows?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n variant?: (typeof paginationTypeValues)[number];\n};\n\nconst Pagination = ({\n currentPageLabel,\n isDisabled,\n isMoreDisabled,\n lastRow,\n loadMoreLabel,\n maxPageIndex,\n maxPageSize,\n nextLabel,\n onPaginationChange,\n pageIndex,\n pageSize,\n previousLabel,\n rowsPerPageLabel,\n totalRows,\n currentRowsCount,\n variant,\n}: PaginationProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const [page, setPage] = useState<number>(pageIndex);\n const [rowsPerPage, setRowsPerPage] = useState<number>(pageSize);\n const initialRowsPerPage = useRef<number>(pageSize);\n\n useEffect(() => {\n setPage(pageIndex);\n setRowsPerPage(pageSize);\n }, [pageIndex, pageSize]);\n\n const { totalRowsLabel } = usePagination({\n pageIndex,\n pageSize,\n currentRowsCount: currentRowsCount || pageSize,\n totalRows,\n });\n\n const handlePaginationChange = useCallback(() => {\n const updatedPage =\n totalRows && page * totalRows > lastRow\n ? Math.ceil(totalRows / rowsPerPage)\n : page;\n const updatedRowsPerPage =\n totalRows && rowsPerPage > totalRows ? totalRows : rowsPerPage;\n\n onPaginationChange({\n pageIndex: updatedPage,\n pageSize: updatedRowsPerPage,\n });\n }, [page, rowsPerPage, lastRow, onPaginationChange, totalRows]);\n\n // The following handlers use React.KeyboardEvent (rather than just KeyboardEvent) becuase React.KeyboardEvent\n // is generic, while plain KeyboardEvent is not. We need this generic so we can specify the HTMLInputElement,\n // which allows us to use currentTarget.value\n const handlePageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: parseInt(event.currentTarget.value),\n pageSize: rowsPerPage,\n });\n }\n },\n [rowsPerPage, onPaginationChange],\n );\n\n const handleRowsPerPageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: page,\n pageSize: parseInt(event.currentTarget.value),\n });\n }\n },\n [page, onPaginationChange],\n );\n\n const setPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageIndex\n ? Math.min(parseInt(event.target.value), maxPageIndex)\n : parseInt(event.target.value);\n setPage(value);\n },\n [setPage, maxPageIndex],\n );\n\n const setRowsPerPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageSize\n ? Math.min(parseInt(event.target.value), maxPageSize)\n : parseInt(event.target.value);\n\n // Ensure the value can't be less than 1\n setRowsPerPage(Math.max(1, value));\n },\n [setRowsPerPage, maxPageSize],\n );\n\n const handleLoadMore = useCallback(() => {\n onPaginationChange({\n pageIndex: 1,\n pageSize: rowsPerPage + initialRowsPerPage.current,\n });\n }, [rowsPerPage, onPaginationChange]);\n\n const handleNextButton = useCallback(() => {\n onPaginationChange({ pageIndex: page + 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const handlePreviousButton = useCallback(() => {\n onPaginationChange({ pageIndex: page - 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const loadMoreIsDisabled = useMemo(() => {\n return isMoreDisabled || (totalRows ? rowsPerPage >= totalRows : false);\n }, [isMoreDisabled, rowsPerPage, totalRows]);\n\n const nextButtonDisabled = useMemo(\n () =>\n isMoreDisabled ||\n (totalRows ? lastRow >= totalRows : false) ||\n isDisabled,\n [isMoreDisabled, totalRows, lastRow, isDisabled],\n );\n\n const previousButtonDisabled = useMemo(\n () => pageIndex <= 1 || isDisabled,\n [pageIndex, isDisabled],\n );\n\n const rowsPerPageInputProps = useMemo(\n () => ({\n \"aria-label\": rowsPerPageLabel,\n max: maxPageSize || totalRows,\n }),\n [maxPageSize, rowsPerPageLabel, totalRows],\n );\n\n const currentPageInputProps = useMemo(\n () => ({\n \"aria-label\": currentPageLabel,\n max: maxPageIndex,\n }),\n [currentPageLabel, maxPageIndex],\n );\n\n return variant === \"paged\" ? (\n <PaginationContainer>\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {rowsPerPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={rowsPerPage}\n onChange={setRowsPerPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handleRowsPerPageSubmit}\n disabled={isDisabled}\n inputProps={rowsPerPageInputProps}\n />\n </Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {totalRowsLabel}\n </Paragraph>\n </PaginationSegment>\n\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {totalRows && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {currentPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={page}\n onChange={setPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handlePageSubmit}\n disabled={isDisabled}\n inputProps={currentPageInputProps}\n />\n </Box>\n )}\n <PaginationButtonContainer>\n <Button\n startIcon={<ArrowLeftIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={previousLabel}\n onClick={handlePreviousButton}\n isDisabled={previousButtonDisabled}\n />\n <Button\n endIcon={<ArrowRightIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={nextLabel}\n onClick={handleNextButton}\n isDisabled={nextButtonDisabled}\n />\n </PaginationButtonContainer>\n </PaginationSegment>\n </PaginationContainer>\n ) : (\n <Button\n variant=\"secondary\"\n label={loadMoreLabel}\n onClick={handleLoadMore}\n isDisabled={loadMoreIsDisabled}\n />\n );\n};\n\nconst MemoizedPagination = memo(Pagination);\nMemoizedPagination.displayName = \"Pagination\";\n\nexport { MemoizedPagination as Pagination };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SACvEC,SAAS;AAAA,SACTC,MAAM;AAAA,SACNC,aAAa,EAAEC,cAAc;AACtC,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAGnCC,sBAAsB;AAAA,SAEfC,GAAG;AAAA,SAEHC,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEtB,MAAMC,mBAAmB,GAAGR,MAAM,CAAC,KAAK,CAAC,CAAC;EACxCS,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAGZ,MAAM,CAAC,KAAK,EAAE;EACtCa,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAC,CAAC;EAAEC;AAA2D,CAAC,MAAM;EACtEN,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBM,GAAG,EAAED,mBAAmB,CAACE,QAAQ;EACjC,SAAS,EAAE;IACTR,OAAO,EAAE,MAAM;IACfC,UAAU,EAAE,QAAQ;IACpBM,GAAG,EAAED,mBAAmB,CAACG;EAC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aAAa,IAAE,CAAE;UAC7BkD,OAAO,EAAC,UAAU;UAClB2C,IAAI,EAAC,OAAO;UACZC,SAAS,EAAEhD,aAAc;UACzBiD,OAAO,EAAElB,oBAAqB;UAC9BzC,UAAU,EAAE4C;QAAuB,CACpC,CAAC,EACFzE,IAAA,CAACR,MAAM;UACLiG,OAAO,EAAEzF,IAAA,CAACN,cAAc,IAAE,CAAE;UAC5BiD,OAAO,EAAC,UAAU;UAClB2C,IAAI,EAAC,OAAO;UACZC,SAAS,EAAEpD,SAAU;UACrBqD,OAAO,EAAEnB,gBAAiB;UAC1BxC,UAAU,EAAE2C;QAAmB,CAChC,CAAC;MAAA,CACuB,CAAC;IAAA,CACX,CAAC;EAAA,CACD,CAAC,GAEtBxE,IAAA,CAACR,MAAM;IACLmD,OAAO,EAAC,WAAW;IACnB+C,KAAK,EAAE1D,aAAc;IACrBwD,OAAO,EAAErB,cAAe;IACxBtC,UAAU,EAAE0C;EAAmB,CAChC,CACF;AACH,CAAC;AAED,MAAMoB,kBAAkB,GAAG1G,IAAI,CAAC0C,UAAU,CAAC;AAC3CgE,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAIhE,UAAU"}
|
|
1
|
+
{"version":3,"file":"Pagination.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","Paragraph","Button","ArrowLeftIcon","ArrowRightIcon","styled","useOdysseyDesignTokens","Box","usePagination","useTranslation","jsx","_jsx","jsxs","_jsxs","PaginationContainer","display","alignItems","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","gap","Spacing4","Spacing2","PaginationInput","_InputBase","borderColor","HueNeutral200","borderRadius","BorderRadiusTight","height","Spacing6","width","HueNeutral400","PalettePrimaryMain","PaginationButtonContainer","marginInlineStart","Pagination","currentPageLabel","currentPageLabelProp","currentRowsCount","hasPageInput","hasRowCountInput","hasRowCountLabel","isDisabled","isMoreDisabled","lastRow","loadMoreLabel","loadMoreLabelProp","maxPageIndex","maxPageSize","nextLabel","nextLabelProp","onPaginationChange","onPaginationChangeProp","pageIndex","pageSize","previousLabel","previousLabelProp","rowsPerPageLabel","rowsPerPageLabelProp","totalRows","variant","t","page","setPage","rowsPerPage","setRowsPerPage","initialRowsPerPage","totalRowsLabel","handlePaginationChange","updatedPage","updatedRowsPerPage","Math","ceil","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","children","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","startIcon","size","ariaLabel","onClick","endIcon","label","MemoizedPagination","displayName"],"sources":["../../src/Pagination/Pagination.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Paragraph } from \"../Typography\";\nimport { Button } from \"../Button\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated\";\nimport styled from \"@emotion/styled\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext\";\nimport { Box } from \"../Box\";\nimport { paginationTypeValues } from \"./constants\";\nimport { usePagination } from \"./usePagination\";\nimport { useTranslation } from \"react-i18next\";\n\nconst PaginationContainer = styled(\"div\")({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing4,\n \"& > div\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: odysseyDesignTokens.Spacing2,\n },\n}));\n\nconst PaginationInput = styled(InputBase, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n borderColor: odysseyDesignTokens.HueNeutral200,\n borderRadius: odysseyDesignTokens.BorderRadiusTight,\n height: odysseyDesignTokens.Spacing6,\n width: \"4.5714285714rem\", // This is a hardcoded value, keep as string\n \"&:hover\": {\n borderColor: odysseyDesignTokens.HueNeutral400,\n },\n \"&.Mui-focused:hover\": {\n borderColor: odysseyDesignTokens.PalettePrimaryMain,\n },\n}));\n\nconst PaginationButtonContainer = styled(\"div\")({\n \"& > *\": {\n marginInlineStart: `0 !important`,\n },\n});\n\nexport type PaginationProps = {\n /**\n * The labeled rendered for the current page index\n */\n currentPageLabel?: string;\n /**\n * The number of items currently visible on the page\n */\n currentRowsCount?: number;\n /**\n * If true, the page input will be visible and the user can directly manipulate which page\n * is visible.\n */\n hasPageInput?: boolean;\n /**\n * If true, the row count input will be visible and the user can directly manipulate how many rows\n * are visible.\n */\n hasRowCountInput?: boolean;\n /**\n * If true, the \"X - X of total X\" label will be visible\n */\n hasRowCountLabel?: boolean;\n /**\n * If true, the pagination controls will be disabled\n */\n isDisabled?: boolean;\n /**\n * If true, the next or Show More button will be disabled\n */\n isMoreDisabled?: boolean;\n /**\n * The current page last row index\n */\n lastRow?: number;\n /**\n * If the pagination is of \"loadMore\" variant, then this is the the load more label\n */\n loadMoreLabel?: string;\n /**\n * The max page\n */\n maxPageIndex?: number;\n /**\n * The max rows per page\n */\n maxPageSize?: number;\n /**\n * The label for the next control\n */\n nextLabel?: string;\n /**\n * Page index and page size setter\n */\n onPaginationChange: ({\n pageIndex,\n pageSize,\n }: {\n pageIndex: number;\n pageSize: number;\n }) => void;\n /**\n * The current page index\n */\n pageIndex: number;\n /**\n * The current page size\n */\n pageSize: number;\n /**\n * The label for the previous control\n */\n previousLabel?: string;\n /**\n * The label that shows how many results are rendered per page\n */\n rowsPerPageLabel?: string;\n /**\n * Total rows count\n */\n totalRows?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n variant?: (typeof paginationTypeValues)[number];\n};\n\nconst Pagination = ({\n currentPageLabel: currentPageLabelProp,\n currentRowsCount,\n hasPageInput = true,\n hasRowCountInput = true,\n hasRowCountLabel = true,\n isDisabled,\n isMoreDisabled,\n lastRow,\n loadMoreLabel: loadMoreLabelProp,\n maxPageIndex,\n maxPageSize,\n nextLabel: nextLabelProp,\n onPaginationChange: onPaginationChangeProp,\n pageIndex,\n pageSize,\n previousLabel: previousLabelProp,\n rowsPerPageLabel: rowsPerPageLabelProp,\n totalRows,\n variant,\n}: PaginationProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const [page, setPage] = useState<number>(pageIndex);\n const [rowsPerPage, setRowsPerPage] = useState<number>(pageSize);\n const initialRowsPerPage = useRef<number>(pageSize);\n\n const currentPageLabel = currentPageLabelProp ?? t(\"pagination.page\");\n const loadMoreLabel = loadMoreLabelProp ?? t(\"pagination.loadmore\");\n const nextLabel = nextLabelProp ?? t(\"pagination.next\");\n const previousLabel = previousLabelProp ?? t(\"pagination.previous\");\n const rowsPerPageLabel = rowsPerPageLabelProp ?? t(\"pagination.rowsperpage\");\n\n useEffect(() => {\n setPage(pageIndex);\n setRowsPerPage(pageSize);\n }, [pageIndex, pageSize]);\n\n const onPaginationChange = useCallback(\n ({ pageIndex, pageSize }: { pageIndex: number; pageSize: number }) => {\n onPaginationChangeProp({ pageIndex, pageSize });\n },\n [onPaginationChangeProp],\n );\n\n const { totalRowsLabel } = usePagination({\n pageIndex,\n pageSize,\n currentRowsCount: currentRowsCount || pageSize,\n totalRows,\n });\n\n const handlePaginationChange = useCallback(() => {\n let updatedPage = page;\n let updatedRowsPerPage = rowsPerPage;\n\n if (totalRows) {\n const maxPageIndex = Math.ceil(totalRows / updatedRowsPerPage);\n\n // Ensure rowsPerPage does not exceed totalRows\n if (updatedRowsPerPage > totalRows) {\n updatedRowsPerPage = totalRows;\n }\n\n // Ensure page is within valid range\n if (updatedPage > maxPageIndex) {\n updatedPage = maxPageIndex;\n } else if (updatedPage < 1) {\n updatedPage = 1;\n }\n }\n\n onPaginationChange({\n pageIndex: updatedPage,\n pageSize: updatedRowsPerPage,\n });\n }, [page, rowsPerPage, onPaginationChange, totalRows]);\n\n // The following handlers use React.KeyboardEvent (rather than just KeyboardEvent) becuase React.KeyboardEvent\n // is generic, while plain KeyboardEvent is not. We need this generic so we can specify the HTMLInputElement,\n // which allows us to use currentTarget.value\n const handlePageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: parseInt(event.currentTarget.value),\n pageSize: rowsPerPage,\n });\n }\n },\n [rowsPerPage, onPaginationChange],\n );\n\n const handleRowsPerPageSubmit = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (event.key === \"Enter\") {\n onPaginationChange({\n pageIndex: page,\n pageSize: parseInt(event.currentTarget.value),\n });\n }\n },\n [page, onPaginationChange],\n );\n\n const setPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageIndex\n ? Math.min(parseInt(event.target.value), maxPageIndex)\n : parseInt(event.target.value);\n setPage(value);\n },\n [setPage, maxPageIndex],\n );\n\n const setRowsPerPageFromEvent = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = maxPageSize\n ? Math.min(parseInt(event.target.value), maxPageSize)\n : parseInt(event.target.value);\n\n // Ensure the value can't be less than 1\n setRowsPerPage(Math.max(1, value));\n },\n [setRowsPerPage, maxPageSize],\n );\n\n const handleLoadMore = useCallback(() => {\n onPaginationChange({\n pageIndex: 1,\n pageSize: rowsPerPage + initialRowsPerPage.current,\n });\n }, [rowsPerPage, onPaginationChange]);\n\n const handleNextButton = useCallback(() => {\n onPaginationChange({ pageIndex: page + 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const handlePreviousButton = useCallback(() => {\n onPaginationChange({ pageIndex: page - 1, pageSize: rowsPerPage });\n }, [onPaginationChange, page, rowsPerPage]);\n\n const loadMoreIsDisabled = useMemo(() => {\n return isMoreDisabled || (totalRows ? rowsPerPage >= totalRows : false);\n }, [isMoreDisabled, rowsPerPage, totalRows]);\n\n const nextButtonDisabled = useMemo(\n () =>\n isMoreDisabled ||\n (lastRow && (totalRows ? lastRow >= totalRows : false)) ||\n isDisabled,\n [isMoreDisabled, totalRows, lastRow, isDisabled],\n );\n\n const previousButtonDisabled = useMemo(\n () => pageIndex <= 1 || isDisabled,\n [pageIndex, isDisabled],\n );\n\n const rowsPerPageInputProps = useMemo(\n () => ({\n \"aria-label\": rowsPerPageLabel,\n max: maxPageSize || totalRows,\n }),\n [maxPageSize, rowsPerPageLabel, totalRows],\n );\n\n const currentPageInputProps = useMemo(\n () => ({\n \"aria-label\": currentPageLabel,\n max: maxPageIndex,\n }),\n [currentPageLabel, maxPageIndex],\n );\n\n return variant === \"paged\" ? (\n <PaginationContainer>\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {hasRowCountInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {rowsPerPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={rowsPerPage}\n onChange={setRowsPerPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handleRowsPerPageSubmit}\n disabled={isDisabled}\n inputProps={rowsPerPageInputProps}\n />\n </Box>\n )}\n {hasRowCountLabel && (\n <Paragraph component=\"span\" color=\"textSecondary\">\n {totalRowsLabel}\n </Paragraph>\n )}\n </PaginationSegment>\n\n <PaginationSegment odysseyDesignTokens={odysseyDesignTokens}>\n {totalRows && hasPageInput && (\n <Box>\n <Paragraph component=\"span\" color=\"textSecondary\">\n {currentPageLabel}\n </Paragraph>\n <PaginationInput\n odysseyDesignTokens={odysseyDesignTokens}\n type=\"number\"\n value={page}\n onChange={setPageFromEvent}\n onBlur={handlePaginationChange}\n onKeyDown={handlePageSubmit}\n disabled={isDisabled}\n inputProps={currentPageInputProps}\n />\n </Box>\n )}\n <PaginationButtonContainer>\n <Button\n startIcon={<ArrowLeftIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={previousLabel}\n onClick={handlePreviousButton}\n isDisabled={previousButtonDisabled}\n />\n <Button\n endIcon={<ArrowRightIcon />}\n variant=\"floating\"\n size=\"small\"\n ariaLabel={nextLabel}\n onClick={handleNextButton}\n isDisabled={nextButtonDisabled}\n />\n </PaginationButtonContainer>\n </PaginationSegment>\n </PaginationContainer>\n ) : (\n <Button\n variant=\"secondary\"\n label={loadMoreLabel}\n onClick={handleLoadMore}\n isDisabled={loadMoreIsDisabled}\n />\n );\n};\n\nconst MemoizedPagination = memo(Pagination);\nMemoizedPagination.displayName = \"Pagination\";\n\nexport { MemoizedPagination as Pagination };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SACvEC,SAAS;AAAA,SACTC,MAAM;AAAA,SACNC,aAAa,EAAEC,cAAc;AACtC,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAGnCC,sBAAsB;AAAA,SAEfC,GAAG;AAAA,SAEHC,aAAa;AACtB,SAASC,cAAc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mBAAoB;UACzC+E,IAAI,EAAC,QAAQ;UACbnB,KAAK,EAAEhB,IAAK;UACZoC,QAAQ,EAAElB,gBAAiB;UAC3BmB,MAAM,EAAE/B,sBAAuB;UAC/BgC,SAAS,EAAE3B,gBAAiB;UAC5B4B,QAAQ,EAAE3D,UAAW;UACrB4D,UAAU,EAAET;QAAsB,CACnC,CAAC;MAAA,CACC,CACN,EACDnF,KAAA,CAACuB,yBAAyB;QAAA6D,QAAA,GACxBtF,IAAA,CAACT,MAAM;UACLwG,SAAS,EAAE/F,IAAA,CAACR,aAAa,IAAE,CAAE;UAC7B4D,OAAO,EAAC,UAAU;UAClB4C,IAAI,EAAC,OAAO;UACZC,SAAS,EAAElD,aAAc;UACzBmD,OAAO,EAAElB,oBAAqB;UAC9B9C,UAAU,EAAEiD;QAAuB,CACpC,CAAC,EACFnF,IAAA,CAACT,MAAM;UACL4G,OAAO,EAAEnG,IAAA,CAACP,cAAc,IAAE,CAAE;UAC5B2D,OAAO,EAAC,UAAU;UAClB4C,IAAI,EAAC,OAAO;UACZC,SAAS,EAAExD,SAAU;UACrByD,OAAO,EAAEnB,gBAAiB;UAC1B7C,UAAU,EAAEgD;QAAmB,CAChC,CAAC;MAAA,CACuB,CAAC;IAAA,CACX,CAAC;EAAA,CACD,CAAC,GAEtBlF,IAAA,CAACT,MAAM;IACL6D,OAAO,EAAC,WAAW;IACnBgD,KAAK,EAAE/D,aAAc;IACrB6D,OAAO,EAAErB,cAAe;IACxB3C,UAAU,EAAE+C;EAAmB,CAChC,CACF;AACH,CAAC;AAED,MAAMoB,kBAAkB,GAAGrH,IAAI,CAAC2C,UAAU,CAAC;AAC3C0E,kBAAkB,CAACC,WAAW,GAAG,YAAY;AAE7C,SAASD,kBAAkB,IAAI1E,UAAU"}
|
package/dist/Surface.js
CHANGED
|
@@ -14,6 +14,7 @@ import _Paper from "@mui/material/Paper";
|
|
|
14
14
|
import { memo } from "react";
|
|
15
15
|
import styled from "@emotion/styled";
|
|
16
16
|
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
|
|
17
|
+
import { OdysseyThemeProvider } from "./OdysseyThemeProvider.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const StyledContainer = styled(_Paper, {
|
|
19
20
|
shouldForwardProp: prop => prop !== "odysseyDesignTokens"
|
|
@@ -29,7 +30,9 @@ const Surface = ({
|
|
|
29
30
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
30
31
|
return _jsx(StyledContainer, {
|
|
31
32
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
32
|
-
children:
|
|
33
|
+
children: _jsx(OdysseyThemeProvider, {
|
|
34
|
+
children: children
|
|
35
|
+
})
|
|
33
36
|
});
|
|
34
37
|
};
|
|
35
38
|
const MemoizedSurface = memo(Surface);
|
package/dist/Surface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.js","names":["memo","styled","useOdysseyDesignTokens","jsx","_jsx","StyledContainer","_Paper","shouldForwardProp","prop","odysseyDesignTokens","borderRadius","Spacing4","padding","Surface","children","MemoizedSurface","displayName"],"sources":["../src/Surface.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 styled from \"@emotion/styled\";\nimport { Paper as MuiPaper } from \"@mui/material\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\n\nconst StyledContainer = styled(MuiPaper, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n borderRadius: odysseyDesignTokens.Spacing4,\n padding: odysseyDesignTokens.Spacing4,\n}));\n\nexport type SurfaceProps = {\n children: ReactNode;\n};\n\nconst Surface = ({ children }: SurfaceProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <StyledContainer odysseyDesignTokens={odysseyDesignTokens}>\n {children}
|
|
1
|
+
{"version":3,"file":"Surface.js","names":["memo","styled","useOdysseyDesignTokens","OdysseyThemeProvider","jsx","_jsx","StyledContainer","_Paper","shouldForwardProp","prop","odysseyDesignTokens","borderRadius","Spacing4","padding","Surface","children","MemoizedSurface","displayName"],"sources":["../src/Surface.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 styled from \"@emotion/styled\";\nimport { Paper as MuiPaper } from \"@mui/material\";\n\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { OdysseyThemeProvider } from \"./OdysseyThemeProvider\";\n\nconst StyledContainer = styled(MuiPaper, {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{\n odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n borderRadius: odysseyDesignTokens.Spacing4,\n padding: odysseyDesignTokens.Spacing4,\n}));\n\nexport type SurfaceProps = {\n children: ReactNode;\n};\n\nconst Surface = ({ children }: SurfaceProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <StyledContainer odysseyDesignTokens={odysseyDesignTokens}>\n <OdysseyThemeProvider>{children}</OdysseyThemeProvider>\n </StyledContainer>\n );\n};\n\nconst MemoizedSurface = memo(Surface);\nMemoizedSurface.displayName = \"Surface\";\n\nexport { MemoizedSurface as Surface };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAmB,OAAO;AACvC,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAKnCC,sBAAsB;AAAA,SAEfC,oBAAoB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE7B,MAAMC,eAAe,GAAGL,MAAM,CAAAM,MAAA,EAAW;EACvCC,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAEC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EAC/BC,YAAY,EAAED,mBAAmB,CAACE,QAAQ;EAC1CC,OAAO,EAAEH,mBAAmB,CAACE;AAC/B,CAAC,CAAC,CAAC;AAMH,MAAME,OAAO,GAAGA,CAAC;EAAEC;AAAuB,CAAC,KAAK;EAC9C,MAAML,mBAAmB,GAAGR,sBAAsB,CAAC,CAAC;EAEpD,OACEG,IAAA,CAACC,eAAe;IAACI,mBAAmB,EAAEA,mBAAoB;IAAAK,QAAA,EACxDV,IAAA,CAACF,oBAAoB;MAAAY,QAAA,EAAEA;IAAQ,CAAuB;EAAC,CACxC,CAAC;AAEtB,CAAC;AAED,MAAMC,eAAe,GAAGhB,IAAI,CAACc,OAAO,CAAC;AACrCE,eAAe,CAACC,WAAW,GAAG,SAAS;AAEvC,SAASD,eAAe,IAAIF,OAAO"}
|
package/dist/Tag.js
CHANGED
|
@@ -12,22 +12,27 @@ import _Chip from "@mui/material/Chip";
|
|
|
12
12
|
*/
|
|
13
13
|
import { memo, useCallback, useContext } from "react";
|
|
14
14
|
import styled from "@emotion/styled";
|
|
15
|
-
import {
|
|
15
|
+
import { CloseCircleFilledIcon } from "./icons.generated/index.js";
|
|
16
16
|
import { MuiPropsContext } from "./MuiPropsContext.js";
|
|
17
17
|
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { TagListContext } from "./TagListContext.js";
|
|
19
|
+
import { useContrastModeContext } from "./useContrastMode.js";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
|
|
22
|
-
const
|
|
21
|
+
const tagSizeValues = ["medium", "small"];
|
|
22
|
+
export const tagColorVariants = ["accentFour", "accentOne", "accentThree", "accentTwo", "default", "info"];
|
|
23
|
+
const getChipColors = ({
|
|
24
|
+
colorVariant,
|
|
25
|
+
contrastMode,
|
|
26
|
+
odysseyDesignTokens
|
|
27
|
+
}) => {
|
|
23
28
|
const colors = {
|
|
24
29
|
default: {
|
|
25
|
-
...(contrastMode === "
|
|
30
|
+
...(contrastMode === "highContrast" && {
|
|
26
31
|
background: odysseyDesignTokens.HueNeutral200,
|
|
27
32
|
text: odysseyDesignTokens.HueNeutral700,
|
|
28
33
|
textDisabled: odysseyDesignTokens.HueNeutral400
|
|
29
34
|
}),
|
|
30
|
-
...(contrastMode === "
|
|
35
|
+
...(contrastMode === "lowContrast" && {
|
|
31
36
|
background: odysseyDesignTokens.HueNeutral100,
|
|
32
37
|
text: odysseyDesignTokens.HueNeutral700,
|
|
33
38
|
textDisabled: odysseyDesignTokens.HueNeutral300
|
|
@@ -41,12 +46,12 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
41
46
|
iconDisabled: odysseyDesignTokens.HueNeutral300
|
|
42
47
|
},
|
|
43
48
|
info: {
|
|
44
|
-
...(contrastMode === "
|
|
49
|
+
...(contrastMode === "highContrast" && {
|
|
45
50
|
background: odysseyDesignTokens.HueBlue200,
|
|
46
51
|
text: odysseyDesignTokens.HueBlue700,
|
|
47
52
|
textDisabled: odysseyDesignTokens.HueBlue400
|
|
48
53
|
}),
|
|
49
|
-
...(contrastMode === "
|
|
54
|
+
...(contrastMode === "lowContrast" && {
|
|
50
55
|
background: odysseyDesignTokens.HueBlue100,
|
|
51
56
|
text: odysseyDesignTokens.HueBlue700,
|
|
52
57
|
textDisabled: odysseyDesignTokens.HueBlue300
|
|
@@ -60,12 +65,12 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
60
65
|
iconDisabled: odysseyDesignTokens.HueBlue300
|
|
61
66
|
},
|
|
62
67
|
accentOne: {
|
|
63
|
-
...(contrastMode === "
|
|
68
|
+
...(contrastMode === "highContrast" && {
|
|
64
69
|
background: odysseyDesignTokens.HueAccentOne200,
|
|
65
70
|
text: odysseyDesignTokens.HueAccentOne700,
|
|
66
71
|
textDisabled: odysseyDesignTokens.HueAccentOne400
|
|
67
72
|
}),
|
|
68
|
-
...(contrastMode === "
|
|
73
|
+
...(contrastMode === "lowContrast" && {
|
|
69
74
|
background: odysseyDesignTokens.HueAccentOne100,
|
|
70
75
|
text: odysseyDesignTokens.HueAccentOne700,
|
|
71
76
|
textDisabled: odysseyDesignTokens.HueAccentOne300
|
|
@@ -79,12 +84,12 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
79
84
|
iconDisabled: odysseyDesignTokens.HueAccentOne300
|
|
80
85
|
},
|
|
81
86
|
accentTwo: {
|
|
82
|
-
...(contrastMode === "
|
|
87
|
+
...(contrastMode === "highContrast" && {
|
|
83
88
|
background: odysseyDesignTokens.HueAccentTwo200,
|
|
84
89
|
text: odysseyDesignTokens.HueAccentTwo800,
|
|
85
90
|
textDisabled: odysseyDesignTokens.HueAccentTwo400
|
|
86
91
|
}),
|
|
87
|
-
...(contrastMode === "
|
|
92
|
+
...(contrastMode === "lowContrast" && {
|
|
88
93
|
background: odysseyDesignTokens.HueAccentTwo100,
|
|
89
94
|
text: odysseyDesignTokens.HueAccentTwo700,
|
|
90
95
|
textDisabled: odysseyDesignTokens.HueAccentTwo300
|
|
@@ -98,12 +103,12 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
98
103
|
iconDisabled: odysseyDesignTokens.HueAccentTwo300
|
|
99
104
|
},
|
|
100
105
|
accentThree: {
|
|
101
|
-
...(contrastMode === "
|
|
106
|
+
...(contrastMode === "highContrast" && {
|
|
102
107
|
background: odysseyDesignTokens.HueAccentThree200,
|
|
103
108
|
text: odysseyDesignTokens.HueAccentThree700,
|
|
104
109
|
textDisabled: odysseyDesignTokens.HueAccentThree400
|
|
105
110
|
}),
|
|
106
|
-
...(contrastMode === "
|
|
111
|
+
...(contrastMode === "lowContrast" && {
|
|
107
112
|
background: odysseyDesignTokens.HueAccentThree100,
|
|
108
113
|
text: odysseyDesignTokens.HueAccentThree700,
|
|
109
114
|
textDisabled: odysseyDesignTokens.HueAccentThree300
|
|
@@ -117,12 +122,12 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
117
122
|
iconDisabled: odysseyDesignTokens.HueAccentThree300
|
|
118
123
|
},
|
|
119
124
|
accentFour: {
|
|
120
|
-
...(contrastMode === "
|
|
125
|
+
...(contrastMode === "highContrast" && {
|
|
121
126
|
background: odysseyDesignTokens.HueAccentFour200,
|
|
122
127
|
text: odysseyDesignTokens.HueAccentFour700,
|
|
123
128
|
textDisabled: odysseyDesignTokens.HueAccentFour400
|
|
124
129
|
}),
|
|
125
|
-
...(contrastMode === "
|
|
130
|
+
...(contrastMode === "lowContrast" && {
|
|
126
131
|
background: odysseyDesignTokens.HueAccentFour100,
|
|
127
132
|
text: odysseyDesignTokens.HueAccentFour700,
|
|
128
133
|
textDisabled: odysseyDesignTokens.HueAccentFour300
|
|
@@ -139,14 +144,19 @@ const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
|
139
144
|
return colors[colorVariant] || colors.default;
|
|
140
145
|
};
|
|
141
146
|
const StyledTag = styled(_Chip, {
|
|
142
|
-
shouldForwardProp: prop => !["colorVariant", "contrastMode", "odysseyDesignTokens"].includes(prop)
|
|
147
|
+
shouldForwardProp: prop => !["colorVariant", "contrastMode", "odysseyDesignTokens", "size"].includes(prop)
|
|
143
148
|
})(({
|
|
144
149
|
colorVariant,
|
|
145
150
|
contrastMode,
|
|
146
151
|
odysseyDesignTokens,
|
|
147
|
-
clickable
|
|
152
|
+
clickable,
|
|
153
|
+
size
|
|
148
154
|
}) => {
|
|
149
|
-
const colors = getChipColors(
|
|
155
|
+
const colors = getChipColors({
|
|
156
|
+
colorVariant,
|
|
157
|
+
odysseyDesignTokens,
|
|
158
|
+
contrastMode
|
|
159
|
+
});
|
|
150
160
|
return {
|
|
151
161
|
backgroundColor: colors.background,
|
|
152
162
|
color: colors.text,
|
|
@@ -156,6 +166,9 @@ const StyledTag = styled(_Chip, {
|
|
|
156
166
|
...(clickable === false && {
|
|
157
167
|
borderColor: "transparent"
|
|
158
168
|
}),
|
|
169
|
+
...(size === "small" && {
|
|
170
|
+
paddingBlock: `calc(${odysseyDesignTokens.Spacing1})`
|
|
171
|
+
}),
|
|
159
172
|
"&.MuiChip-clickable:hover": {
|
|
160
173
|
backgroundColor: colors.hover
|
|
161
174
|
},
|
|
@@ -187,6 +200,7 @@ const Tag = ({
|
|
|
187
200
|
label,
|
|
188
201
|
onClick,
|
|
189
202
|
onRemove,
|
|
203
|
+
size = "medium",
|
|
190
204
|
testId,
|
|
191
205
|
translate
|
|
192
206
|
}) => {
|
|
@@ -196,24 +210,25 @@ const Tag = ({
|
|
|
196
210
|
} = useContext(TagListContext);
|
|
197
211
|
const {
|
|
198
212
|
contrastMode
|
|
199
|
-
} =
|
|
213
|
+
} = useContrastModeContext();
|
|
200
214
|
const renderTag = useCallback(muiProps => _jsx(StyledTag, {
|
|
201
215
|
...muiProps,
|
|
202
|
-
as: chipElementType,
|
|
203
216
|
"aria-disabled": isDisabled,
|
|
217
|
+
as: chipElementType,
|
|
204
218
|
clickable: Boolean(onClick),
|
|
205
|
-
"data-se": testId,
|
|
206
219
|
colorVariant: colorVariant,
|
|
207
|
-
|
|
208
|
-
|
|
220
|
+
contrastMode: contrastMode,
|
|
221
|
+
"data-se": testId,
|
|
222
|
+
deleteIcon: _jsx(CloseCircleFilledIcon, {}),
|
|
209
223
|
disabled: isDisabled,
|
|
210
224
|
icon: icon,
|
|
211
225
|
label: label,
|
|
226
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
212
227
|
onClick: onClick,
|
|
213
228
|
onDelete: onRemove,
|
|
214
|
-
|
|
229
|
+
size: size,
|
|
215
230
|
translate: translate
|
|
216
|
-
}), [chipElementType, icon, isDisabled, label, onClick, onRemove, testId, translate
|
|
231
|
+
}), [chipElementType, colorVariant, contrastMode, icon, isDisabled, label, odysseyDesignTokens, onClick, onRemove, size, testId, translate]);
|
|
217
232
|
return _jsx(MuiPropsContext.Consumer, {
|
|
218
233
|
children: renderTag
|
|
219
234
|
});
|