@okta/odyssey-react-mui 1.25.0 → 1.27.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 +17 -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 +14 -3
- 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/DataView.js +6 -0
- package/dist/labs/DataView/DataView.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} +36 -8
- 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 +316 -172
- 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 +150 -68
- package/dist/labs/SideNav/SideNavItemContent.js.map +1 -1
- package/dist/labs/SideNav/SideNavItemContentContext.js +20 -0
- package/dist/labs/SideNav/SideNavItemContentContext.js.map +1 -0
- package/dist/labs/SideNav/SideNavItemLinkContent.js +15 -14
- 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/SortableList/SortableItem.js +162 -0
- package/dist/labs/SideNav/SortableList/SortableItem.js.map +1 -0
- package/dist/labs/SideNav/SortableList/SortableList.js +118 -0
- package/dist/labs/SideNav/SortableList/SortableList.js.map +1 -0
- package/dist/labs/SideNav/SortableList/SortableOverlay.js +30 -0
- package/dist/labs/SideNav/SortableList/SortableOverlay.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 +14 -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/DataView.d.ts +1 -1
- package/dist/src/labs/DataView/DataView.d.ts.map +1 -1
- package/dist/src/labs/DataView/TableLayoutContent.d.ts.map +1 -1
- package/dist/src/labs/DataView/componentTypes.d.ts +4 -3
- 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} +7 -7
- 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 +38 -3
- package/dist/src/labs/SideNav/SideNavItemContent.d.ts.map +1 -1
- package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts +19 -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/SortableList/SortableItem.d.ts +26 -0
- package/dist/src/labs/SideNav/SortableList/SortableItem.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SortableList/SortableList.d.ts +36 -0
- package/dist/src/labs/SideNav/SortableList/SortableList.d.ts.map +1 -0
- package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts +17 -0
- package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts.map +1 -0
- package/dist/src/labs/SideNav/types.d.ts +79 -35
- 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 +13 -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/i18n.config.json +2 -1
- package/jest.config.cjs +1 -1
- package/jest.setup.js +0 -3
- package/package.json +7 -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 +18 -5
- 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/DataView.tsx +6 -0
- package/src/labs/DataView/TableLayoutContent.tsx +6 -2
- package/src/labs/DataView/componentTypes.ts +7 -3
- 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} +51 -16
- 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 +405 -205
- package/src/labs/SideNav/SideNavFooterContent.tsx +36 -28
- package/src/labs/SideNav/SideNavHeader.tsx +62 -45
- package/src/labs/SideNav/SideNavItemContent.tsx +202 -69
- package/src/labs/SideNav/SideNavItemContentContext.tsx +29 -0
- package/src/labs/SideNav/SideNavItemLinkContent.tsx +18 -15
- package/src/labs/SideNav/SideNavLogo.tsx +41 -0
- package/src/labs/SideNav/SideNavToggleButton.tsx +245 -0
- package/src/labs/SideNav/SortableList/SortableItem.tsx +202 -0
- package/src/labs/SideNav/SortableList/SortableList.tsx +122 -0
- package/src/labs/SideNav/SortableList/SortableOverlay.tsx +34 -0
- package/src/labs/SideNav/types.ts +85 -36
- 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 +14 -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
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { Box } from "../../Box";
|
|
20
20
|
import { Status } from "../../Status";
|
|
21
21
|
import type { SideNavItem } from "./types";
|
|
22
|
+
import { Badge } from "../../Badge";
|
|
22
23
|
|
|
23
24
|
const SideNavItemLabelContainer = styled("div", {
|
|
24
25
|
shouldForwardProp: (prop) =>
|
|
@@ -31,20 +32,12 @@ const SideNavItemLabelContainer = styled("div", {
|
|
|
31
32
|
display: "flex",
|
|
32
33
|
flexWrap: "wrap",
|
|
33
34
|
alignItems: "center",
|
|
34
|
-
fontSize: odysseyDesignTokens.
|
|
35
|
-
|
|
36
|
-
marginLeft: isIconVisible ? odysseyDesignTokens.Spacing2 : 0,
|
|
37
|
-
"& a": {
|
|
38
|
-
color: `${odysseyDesignTokens.TypographyColorHeading} !important`,
|
|
39
|
-
fontSize: odysseyDesignTokens.TypographyScale0,
|
|
40
|
-
},
|
|
41
|
-
"& a:hover": {
|
|
42
|
-
textDecoration: "none",
|
|
43
|
-
cursor: "pointer",
|
|
44
|
-
},
|
|
35
|
+
fontSize: odysseyDesignTokens.TypographySizeBody,
|
|
36
|
+
marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,
|
|
45
37
|
}));
|
|
46
38
|
|
|
47
39
|
const SideNavItemLinkContent = ({
|
|
40
|
+
count,
|
|
48
41
|
label,
|
|
49
42
|
startIcon,
|
|
50
43
|
endIcon,
|
|
@@ -52,13 +45,16 @@ const SideNavItemLinkContent = ({
|
|
|
52
45
|
statusLabel,
|
|
53
46
|
}: Pick<
|
|
54
47
|
SideNavItem,
|
|
55
|
-
"label" | "startIcon" | "endIcon" | "severity" | "statusLabel"
|
|
48
|
+
"count" | "label" | "startIcon" | "endIcon" | "severity" | "statusLabel"
|
|
56
49
|
>): ReactNode => {
|
|
57
50
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
58
51
|
|
|
59
52
|
const sideNavItemContentStyles = useMemo(
|
|
60
53
|
() => ({
|
|
61
|
-
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
display: "flex",
|
|
56
|
+
gap: odysseyDesignTokens.Spacing1,
|
|
57
|
+
marginInlineStart: odysseyDesignTokens.Spacing2,
|
|
62
58
|
}),
|
|
63
59
|
[odysseyDesignTokens],
|
|
64
60
|
);
|
|
@@ -71,9 +67,16 @@ const SideNavItemLinkContent = ({
|
|
|
71
67
|
isIconVisible={Boolean(startIcon)}
|
|
72
68
|
>
|
|
73
69
|
{label}
|
|
74
|
-
{severity && (
|
|
70
|
+
{!count && severity && (
|
|
75
71
|
<Box sx={sideNavItemContentStyles}>
|
|
76
|
-
|
|
72
|
+
{severity && (
|
|
73
|
+
<Status severity={severity} label={statusLabel || ""} />
|
|
74
|
+
)}
|
|
75
|
+
</Box>
|
|
76
|
+
)}
|
|
77
|
+
{!severity && count && (
|
|
78
|
+
<Box sx={sideNavItemContentStyles}>
|
|
79
|
+
{count && <Badge badgeContent={count} />}
|
|
77
80
|
</Box>
|
|
78
81
|
)}
|
|
79
82
|
</SideNavItemLabelContainer>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { memo, useMemo } from "react";
|
|
14
|
+
import { OktaLogo } from "./OktaLogo";
|
|
15
|
+
import { SideNavLogoProps } from "./types";
|
|
16
|
+
|
|
17
|
+
const SideNavLogo = ({
|
|
18
|
+
imageAltText,
|
|
19
|
+
href,
|
|
20
|
+
logoComponent,
|
|
21
|
+
imageUrl,
|
|
22
|
+
}: SideNavLogoProps) => {
|
|
23
|
+
const logo = useMemo(() => {
|
|
24
|
+
if (logoComponent) {
|
|
25
|
+
return logoComponent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (imageAltText && imageUrl) {
|
|
29
|
+
return <img src={imageUrl} alt={imageAltText} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return <OktaLogo />;
|
|
33
|
+
}, [imageAltText, logoComponent, imageUrl]);
|
|
34
|
+
|
|
35
|
+
return href ? <a href={href}>{logo}</a> : logo;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const MemoizedSideNavLogo = memo(SideNavLogo);
|
|
39
|
+
MemoizedSideNavLogo.displayName = "SideNavLogo";
|
|
40
|
+
|
|
41
|
+
export { MemoizedSideNavLogo as SideNavLogo };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2022-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 { Button as MuiButton } from "@mui/material";
|
|
14
|
+
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
15
|
+
import {
|
|
16
|
+
HTMLAttributes,
|
|
17
|
+
memo,
|
|
18
|
+
useCallback,
|
|
19
|
+
useImperativeHandle,
|
|
20
|
+
useMemo,
|
|
21
|
+
useRef,
|
|
22
|
+
} from "react";
|
|
23
|
+
import styled from "@emotion/styled";
|
|
24
|
+
import { useTranslation } from "react-i18next";
|
|
25
|
+
|
|
26
|
+
import { FocusHandle } from "../../inputUtils";
|
|
27
|
+
import { MuiPropsContext, MuiPropsContextType } from "../../MuiPropsContext";
|
|
28
|
+
import {
|
|
29
|
+
DesignTokens,
|
|
30
|
+
useOdysseyDesignTokens,
|
|
31
|
+
} from "../../OdysseyDesignTokensContext";
|
|
32
|
+
import { Tooltip } from "../../Tooltip";
|
|
33
|
+
|
|
34
|
+
const StyledToggleButton = styled(MuiButton, {
|
|
35
|
+
shouldForwardProp: (prop) =>
|
|
36
|
+
prop !== "odysseyDesignTokens" && prop !== "isSideNavCollapsed",
|
|
37
|
+
})(
|
|
38
|
+
({
|
|
39
|
+
isSideNavCollapsed,
|
|
40
|
+
odysseyDesignTokens,
|
|
41
|
+
}: {
|
|
42
|
+
isSideNavCollapsed: boolean;
|
|
43
|
+
odysseyDesignTokens: DesignTokens;
|
|
44
|
+
}) => ({
|
|
45
|
+
backgroundColor: "transparent",
|
|
46
|
+
position: "relative",
|
|
47
|
+
width: odysseyDesignTokens.Spacing6,
|
|
48
|
+
height: odysseyDesignTokens.Spacing6,
|
|
49
|
+
border: 0,
|
|
50
|
+
zIndex: 2,
|
|
51
|
+
|
|
52
|
+
"&:focus-visible": {
|
|
53
|
+
boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,
|
|
54
|
+
outline: "none",
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
"&:hover, &:focus": {
|
|
58
|
+
backgroundColor: "transparent",
|
|
59
|
+
|
|
60
|
+
"#lineOne": {
|
|
61
|
+
animation: `lineOne-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
|
|
62
|
+
animationFillMode: "forwards",
|
|
63
|
+
"@keyframes lineOne-animate-to-collapse": {
|
|
64
|
+
"0%": {
|
|
65
|
+
transform: "translate3d(-50%, -50%, 0)",
|
|
66
|
+
},
|
|
67
|
+
"50%": {
|
|
68
|
+
transform: "translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)",
|
|
69
|
+
},
|
|
70
|
+
"100%": {
|
|
71
|
+
transform: "translate3d(-50%, -27%, 0) rotate(-45deg) scaleY(.75)",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"#lineTwo": {
|
|
77
|
+
animation: `lineTwo-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
|
|
78
|
+
animationFillMode: "forwards",
|
|
79
|
+
"@keyframes lineTwo-animate-to-collapse": {
|
|
80
|
+
"0%": {
|
|
81
|
+
transform: "translate3d(-50%, -50%, 0)",
|
|
82
|
+
},
|
|
83
|
+
"50%": {
|
|
84
|
+
transform: "translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)",
|
|
85
|
+
},
|
|
86
|
+
"100%": {
|
|
87
|
+
transform: "translate3d(-50%, -73%, 0) rotate(-135deg) scaleY(.75)",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
...(isSideNavCollapsed && {
|
|
93
|
+
"#lineOne": {
|
|
94
|
+
animation: `lineOne-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
|
|
95
|
+
animationFillMode: "forwards",
|
|
96
|
+
"@keyframes lineOne-animate-to-expand": {
|
|
97
|
+
"0%": {
|
|
98
|
+
transform: "translate3d(-50%, -50%, 0)",
|
|
99
|
+
},
|
|
100
|
+
"50%": {
|
|
101
|
+
transform: "translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)",
|
|
102
|
+
},
|
|
103
|
+
"100%": {
|
|
104
|
+
transform:
|
|
105
|
+
"translate3d(-50%, -73%, 0) rotate(135deg) scaleY(.75)",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
"#lineTwo": {
|
|
111
|
+
animation: `lineTwo-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
|
|
112
|
+
animationFillMode: "forwards",
|
|
113
|
+
"@keyframes lineTwo-animate-to-expand": {
|
|
114
|
+
"0%": {
|
|
115
|
+
transform: "translate3d(-50%, -50%, 0)",
|
|
116
|
+
},
|
|
117
|
+
"50%": {
|
|
118
|
+
transform: "translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)",
|
|
119
|
+
},
|
|
120
|
+
"100%": {
|
|
121
|
+
transform: "translate3d(-50%, -27%, 0) rotate(45deg) scaleY(.75)",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
span: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
top: "50%",
|
|
131
|
+
left: "50%",
|
|
132
|
+
width: "2px",
|
|
133
|
+
height: odysseyDesignTokens.Spacing4,
|
|
134
|
+
backgroundColor: odysseyDesignTokens.HueNeutral600,
|
|
135
|
+
transform: "translate3d(-50%, -50%, 0)",
|
|
136
|
+
transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
export type SideNavToggleButtonProps = {
|
|
142
|
+
/**
|
|
143
|
+
* The ref forwarded to the Button
|
|
144
|
+
*/
|
|
145
|
+
buttonRef?: React.RefObject<FocusHandle>;
|
|
146
|
+
/**
|
|
147
|
+
* The `id` of the item this button controls
|
|
148
|
+
*/
|
|
149
|
+
ariaControls: string;
|
|
150
|
+
/**
|
|
151
|
+
* The ID of the Button
|
|
152
|
+
*/
|
|
153
|
+
id?: string;
|
|
154
|
+
isSideNavCollapsed: boolean;
|
|
155
|
+
tabIndex?: HTMLAttributes<HTMLElement>["tabIndex"];
|
|
156
|
+
/**
|
|
157
|
+
* The click event handler for the Button
|
|
158
|
+
*/
|
|
159
|
+
onClick?: MuiButtonProps["onClick"];
|
|
160
|
+
onKeyDown?: MuiButtonProps["onKeyDown"];
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const SideNavToggleButton = ({
|
|
164
|
+
ariaControls,
|
|
165
|
+
buttonRef,
|
|
166
|
+
id,
|
|
167
|
+
isSideNavCollapsed,
|
|
168
|
+
onClick,
|
|
169
|
+
tabIndex,
|
|
170
|
+
}: SideNavToggleButtonProps) => {
|
|
171
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
172
|
+
const { t } = useTranslation();
|
|
173
|
+
|
|
174
|
+
const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
|
|
175
|
+
|
|
176
|
+
useImperativeHandle(
|
|
177
|
+
buttonRef,
|
|
178
|
+
() => ({
|
|
179
|
+
focus: () => {
|
|
180
|
+
localButtonRef.current?.focus();
|
|
181
|
+
},
|
|
182
|
+
}),
|
|
183
|
+
[],
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
const toggleLabel = useMemo(
|
|
187
|
+
() =>
|
|
188
|
+
isSideNavCollapsed
|
|
189
|
+
? t("sidenav.toggle.expand")
|
|
190
|
+
: t("sidenav.toggle.collapse"),
|
|
191
|
+
[isSideNavCollapsed, t],
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const renderButton = useCallback(
|
|
195
|
+
(muiProps: MuiPropsContextType) => {
|
|
196
|
+
return (
|
|
197
|
+
<StyledToggleButton
|
|
198
|
+
{...muiProps}
|
|
199
|
+
aria-controls={ariaControls}
|
|
200
|
+
aria-expanded={!isSideNavCollapsed}
|
|
201
|
+
aria-label={toggleLabel}
|
|
202
|
+
data-sidenav-toggle={true}
|
|
203
|
+
id={id}
|
|
204
|
+
isSideNavCollapsed={isSideNavCollapsed}
|
|
205
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
206
|
+
onClick={onClick}
|
|
207
|
+
ref={(element) => {
|
|
208
|
+
if (element) {
|
|
209
|
+
(
|
|
210
|
+
localButtonRef as React.MutableRefObject<HTMLButtonElement>
|
|
211
|
+
).current = element;
|
|
212
|
+
//@ts-expect-error ref is not an optional prop on the props context type
|
|
213
|
+
muiProps?.ref?.(element);
|
|
214
|
+
}
|
|
215
|
+
}}
|
|
216
|
+
tabIndex={tabIndex}
|
|
217
|
+
variant="floating"
|
|
218
|
+
>
|
|
219
|
+
<span id="lineOne" />
|
|
220
|
+
<span id="lineTwo" />
|
|
221
|
+
</StyledToggleButton>
|
|
222
|
+
);
|
|
223
|
+
},
|
|
224
|
+
[
|
|
225
|
+
ariaControls,
|
|
226
|
+
id,
|
|
227
|
+
isSideNavCollapsed,
|
|
228
|
+
odysseyDesignTokens,
|
|
229
|
+
onClick,
|
|
230
|
+
tabIndex,
|
|
231
|
+
toggleLabel,
|
|
232
|
+
],
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<Tooltip ariaType="description" placement="right" text={toggleLabel}>
|
|
237
|
+
<MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>
|
|
238
|
+
</Tooltip>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const MemoizedSideNavToggleButton = memo(SideNavToggleButton);
|
|
243
|
+
MemoizedSideNavToggleButton.displayName = "SideNavToggleButton";
|
|
244
|
+
|
|
245
|
+
export { MemoizedSideNavToggleButton as SideNavToggleButton };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { createContext, useContext, useMemo } from "react";
|
|
14
|
+
import type { CSSProperties, PropsWithChildren } from "react";
|
|
15
|
+
import type {
|
|
16
|
+
DraggableSyntheticListeners,
|
|
17
|
+
UniqueIdentifier,
|
|
18
|
+
} from "@dnd-kit/core";
|
|
19
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
20
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
21
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
22
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
23
|
+
import styled from "@emotion/styled";
|
|
24
|
+
import {
|
|
25
|
+
DesignTokens,
|
|
26
|
+
useOdysseyDesignTokens,
|
|
27
|
+
} from "../../../OdysseyDesignTokensContext";
|
|
28
|
+
import { useTranslation } from "react-i18next";
|
|
29
|
+
|
|
30
|
+
type ItemProps = {
|
|
31
|
+
id: UniqueIdentifier;
|
|
32
|
+
isDisabled?: boolean;
|
|
33
|
+
isSelected?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
interface Context {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
attributes: Record<string, any>;
|
|
39
|
+
listeners: DraggableSyntheticListeners;
|
|
40
|
+
ref(node: HTMLElement | null): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const SortableItemContext = createContext<Context>({
|
|
44
|
+
attributes: {},
|
|
45
|
+
listeners: undefined,
|
|
46
|
+
ref() {},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const StyledSortableListItem = styled("li", {
|
|
50
|
+
shouldForwardProp: (prop) =>
|
|
51
|
+
prop !== "odysseyDesignTokens" && prop !== "isSelected",
|
|
52
|
+
})<{
|
|
53
|
+
odysseyDesignTokens: DesignTokens;
|
|
54
|
+
isSelected?: boolean;
|
|
55
|
+
}>(({ odysseyDesignTokens, isSelected }) => ({
|
|
56
|
+
position: "relative",
|
|
57
|
+
|
|
58
|
+
button: {
|
|
59
|
+
top: "50%",
|
|
60
|
+
left: odysseyDesignTokens.Spacing2,
|
|
61
|
+
transform: "translateY(-50%)",
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
svg: {
|
|
65
|
+
path: {
|
|
66
|
+
fill: "currentColor",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
"&:has(a:hover, button:hover, a:focus, button:focus, a:focus-visible, button:focus-visible, [role='button']:hover, [role='button']:focus, [role='button']:focus-visible)":
|
|
71
|
+
{
|
|
72
|
+
button: {
|
|
73
|
+
opacity: 1,
|
|
74
|
+
outlineWidth: 0,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
...(isSelected && {
|
|
79
|
+
svg: {
|
|
80
|
+
path: {
|
|
81
|
+
fill: odysseyDesignTokens.TypographyColorAction,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
const StyledUl = styled("ul")({
|
|
88
|
+
padding: 0,
|
|
89
|
+
listStyle: "none",
|
|
90
|
+
listStyleType: "none",
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const StyledDragHandleButton = styled("button", {
|
|
94
|
+
shouldForwardProp: (prop) =>
|
|
95
|
+
prop !== "odysseyDesignTokens" && prop !== "isDragging",
|
|
96
|
+
})<{
|
|
97
|
+
odysseyDesignTokens: DesignTokens;
|
|
98
|
+
isDragging?: boolean;
|
|
99
|
+
}>(({ odysseyDesignTokens, isDragging }) => ({
|
|
100
|
+
position: "absolute",
|
|
101
|
+
opacity: 0,
|
|
102
|
+
// paddingInlineStart: odysseyDesignTokens.Spacing4,
|
|
103
|
+
padding: odysseyDesignTokens.Spacing2,
|
|
104
|
+
// paddingBlock: 0,
|
|
105
|
+
border: "none",
|
|
106
|
+
backgroundColor: "transparent",
|
|
107
|
+
cursor: `${isDragging ? "grabbing" : "grab"}`,
|
|
108
|
+
transition: `opacity ${odysseyDesignTokens.TransitionDurationMain}`,
|
|
109
|
+
borderRadius: odysseyDesignTokens.BorderRadiusMain,
|
|
110
|
+
|
|
111
|
+
svg: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
"&:focus, &:focus-visible": {
|
|
116
|
+
outline: "none",
|
|
117
|
+
boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
type DragHandleProps = {
|
|
122
|
+
isDisabled?: boolean;
|
|
123
|
+
isDragging?: boolean;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const DragHandle = ({ isDragging }: DragHandleProps) => {
|
|
127
|
+
const { attributes, listeners, ref } = useContext(SortableItemContext);
|
|
128
|
+
const odysseyDesignTokens: DesignTokens = useOdysseyDesignTokens();
|
|
129
|
+
const { t } = useTranslation();
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<StyledDragHandleButton
|
|
133
|
+
{...attributes}
|
|
134
|
+
{...listeners}
|
|
135
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
136
|
+
isDragging={isDragging}
|
|
137
|
+
ref={ref}
|
|
138
|
+
aria-label={t("navigation.drag.handle")}
|
|
139
|
+
>
|
|
140
|
+
<svg
|
|
141
|
+
width="16"
|
|
142
|
+
height="16"
|
|
143
|
+
viewBox="0 0 16 16"
|
|
144
|
+
fill="none"
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
>
|
|
147
|
+
<path
|
|
148
|
+
fillRule="evenodd"
|
|
149
|
+
clipRule="evenodd"
|
|
150
|
+
d="M6 2.33331C6 2.8856 5.55228 3.33331 5 3.33331C4.44772 3.33331 4 2.8856 4 2.33331C4 1.78103 4.44772 1.33331 5 1.33331C5.55228 1.33331 6 1.78103 6 2.33331ZM11 3.33331C11.5523 3.33331 12 2.8856 12 2.33331C12 1.78103 11.5523 1.33331 11 1.33331C10.4477 1.33331 10 1.78103 10 2.33331C10 2.8856 10.4477 3.33331 11 3.33331ZM11 7.11109C11.5523 7.11109 12 6.66338 12 6.11109C12 5.55881 11.5523 5.11109 11 5.11109C10.4477 5.11109 10 5.55881 10 6.11109C10 6.66338 10.4477 7.11109 11 7.11109ZM12 9.88887C12 10.4412 11.5523 10.8889 11 10.8889C10.4477 10.8889 10 10.4412 10 9.88887C10 9.33659 10.4477 8.88887 11 8.88887C11.5523 8.88887 12 9.33659 12 9.88887ZM11 14.6666C11.5523 14.6666 12 14.2189 12 13.6666C12 13.1144 11.5523 12.6666 11 12.6666C10.4477 12.6666 10 13.1144 10 13.6666C10 14.2189 10.4477 14.6666 11 14.6666ZM5 7.11109C5.55228 7.11109 6 6.66338 6 6.11109C6 5.55881 5.55228 5.11109 5 5.11109C4.44772 5.11109 4 5.55881 4 6.11109C4 6.66338 4.44772 7.11109 5 7.11109ZM6 9.88888C6 10.4412 5.55228 10.8889 5 10.8889C4.44772 10.8889 4 10.4412 4 9.88888C4 9.33659 4.44772 8.88888 5 8.88888C5.55228 8.88888 6 9.33659 6 9.88888ZM5 14.6666C5.55228 14.6666 6 14.2189 6 13.6666C6 13.1144 5.55228 12.6666 5 12.6666C4.44772 12.6666 4 13.1144 4 13.6666C4 14.2189 4.44772 14.6666 5 14.6666Z"
|
|
151
|
+
fill="#3F59E4"
|
|
152
|
+
/>
|
|
153
|
+
</svg>
|
|
154
|
+
</StyledDragHandleButton>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const SortableItem = ({
|
|
159
|
+
id,
|
|
160
|
+
isDisabled,
|
|
161
|
+
isSelected,
|
|
162
|
+
children,
|
|
163
|
+
}: PropsWithChildren<ItemProps>) => {
|
|
164
|
+
const {
|
|
165
|
+
attributes,
|
|
166
|
+
isDragging,
|
|
167
|
+
listeners,
|
|
168
|
+
setNodeRef,
|
|
169
|
+
setActivatorNodeRef,
|
|
170
|
+
transform,
|
|
171
|
+
transition,
|
|
172
|
+
} = useSortable({ id });
|
|
173
|
+
const context: Context = useMemo(
|
|
174
|
+
() => ({
|
|
175
|
+
attributes,
|
|
176
|
+
listeners,
|
|
177
|
+
ref: setActivatorNodeRef,
|
|
178
|
+
}),
|
|
179
|
+
[attributes, listeners, setActivatorNodeRef],
|
|
180
|
+
);
|
|
181
|
+
const style: CSSProperties = {
|
|
182
|
+
opacity: isDragging ? 0.4 : undefined,
|
|
183
|
+
transform: CSS.Translate.toString(transform),
|
|
184
|
+
transition,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const odysseyDesignTokens: DesignTokens = useOdysseyDesignTokens();
|
|
188
|
+
return (
|
|
189
|
+
<SortableItemContext.Provider value={context}>
|
|
190
|
+
<StyledSortableListItem
|
|
191
|
+
data-sortable-container="true"
|
|
192
|
+
ref={setNodeRef}
|
|
193
|
+
style={style}
|
|
194
|
+
odysseyDesignTokens={odysseyDesignTokens}
|
|
195
|
+
isSelected={isSelected}
|
|
196
|
+
>
|
|
197
|
+
{!isDisabled && <DragHandle isDragging={isDragging} />}
|
|
198
|
+
<StyledUl>{children}</StyledUl>
|
|
199
|
+
</StyledSortableListItem>
|
|
200
|
+
</SortableItemContext.Provider>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import React, { useMemo, useState } from "react";
|
|
14
|
+
import type { ReactNode } from "react";
|
|
15
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
16
|
+
import {
|
|
17
|
+
DndContext,
|
|
18
|
+
KeyboardSensor,
|
|
19
|
+
PointerSensor,
|
|
20
|
+
useSensor,
|
|
21
|
+
useSensors,
|
|
22
|
+
} from "@dnd-kit/core";
|
|
23
|
+
import type { Active, Announcements, UniqueIdentifier } from "@dnd-kit/core";
|
|
24
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
25
|
+
import {
|
|
26
|
+
SortableContext,
|
|
27
|
+
sortableKeyboardCoordinates,
|
|
28
|
+
} from "@dnd-kit/sortable";
|
|
29
|
+
|
|
30
|
+
import { SortableItem } from "./SortableItem";
|
|
31
|
+
import { SortableOverlay } from "./SortableOverlay";
|
|
32
|
+
import { useTranslation } from "react-i18next";
|
|
33
|
+
|
|
34
|
+
export interface BaseItem {
|
|
35
|
+
id: UniqueIdentifier;
|
|
36
|
+
isDisabled: boolean | undefined;
|
|
37
|
+
isSelected: boolean | undefined;
|
|
38
|
+
navItem: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ListProps<T extends BaseItem> {
|
|
42
|
+
parentId: string;
|
|
43
|
+
items: T[];
|
|
44
|
+
onChange(parentId: string, activeIndex: number, overIndex: number): void;
|
|
45
|
+
renderItem(item: T): ReactNode;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const SortableList = <T extends BaseItem>({
|
|
49
|
+
parentId,
|
|
50
|
+
items,
|
|
51
|
+
onChange,
|
|
52
|
+
renderItem,
|
|
53
|
+
}: ListProps<T>) => {
|
|
54
|
+
const [active, setActive] = useState<Active | null>(null);
|
|
55
|
+
const activeItem = useMemo(
|
|
56
|
+
() => items.find((item) => item.id === active?.id),
|
|
57
|
+
[active, items],
|
|
58
|
+
);
|
|
59
|
+
const sensors = useSensors(
|
|
60
|
+
useSensor(PointerSensor),
|
|
61
|
+
useSensor(KeyboardSensor, {
|
|
62
|
+
coordinateGetter: sortableKeyboardCoordinates,
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const { t } = useTranslation();
|
|
67
|
+
const announcements: Announcements = useMemo(
|
|
68
|
+
() => ({
|
|
69
|
+
onDragStart: ({ active }) => {
|
|
70
|
+
return `${t("sortable.list.drag.start", { activeId: active.id })}`;
|
|
71
|
+
},
|
|
72
|
+
onDragOver: ({ active, over }) => {
|
|
73
|
+
if (over) {
|
|
74
|
+
return `${t("sortable.list.drag.moved.over", { activeId: active.id, overId: over.id })}`;
|
|
75
|
+
}
|
|
76
|
+
return `${t("sortable.list.drag.nolonger.over", { activeId: active.id })}`;
|
|
77
|
+
},
|
|
78
|
+
onDragEnd: ({ active, over }) => {
|
|
79
|
+
if (over) {
|
|
80
|
+
return `${t("sortable.list.drag.end.dropped.over", { activeId: active.id, overId: over.id })}`;
|
|
81
|
+
}
|
|
82
|
+
return `${t("sortable.list.drag.end.dropped", { activeId: active.id })}`;
|
|
83
|
+
},
|
|
84
|
+
onDragCancel: ({ active }) => {
|
|
85
|
+
return `${t("sortable.list.drag.cancel", { activeId: active.id })}`;
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
[t],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<DndContext
|
|
93
|
+
accessibility={{ announcements: announcements }}
|
|
94
|
+
sensors={sensors}
|
|
95
|
+
onDragStart={({ active }) => {
|
|
96
|
+
setActive(active);
|
|
97
|
+
}}
|
|
98
|
+
onDragEnd={({ active, over }) => {
|
|
99
|
+
if (over && active.id !== over?.id) {
|
|
100
|
+
const activeIndex = items.findIndex(({ id }) => id === active.id);
|
|
101
|
+
const overIndex = items.findIndex(({ id }) => id === over.id);
|
|
102
|
+
onChange(parentId, activeIndex, overIndex);
|
|
103
|
+
}
|
|
104
|
+
setActive(null);
|
|
105
|
+
}}
|
|
106
|
+
onDragCancel={() => {
|
|
107
|
+
setActive(null);
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<SortableContext items={items}>
|
|
111
|
+
{items.map((item) => (
|
|
112
|
+
<React.Fragment key={item.id}>{renderItem(item)}</React.Fragment>
|
|
113
|
+
))}
|
|
114
|
+
</SortableContext>
|
|
115
|
+
<SortableOverlay>
|
|
116
|
+
{activeItem ? renderItem(activeItem) : null}
|
|
117
|
+
</SortableOverlay>
|
|
118
|
+
</DndContext>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
SortableList.Item = SortableItem;
|