@okta/odyssey-react-mui 1.36.1 → 1.37.1
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/README.md +8 -3
- package/dist/cjs/Pagination/Pagination.cjs +2 -1
- package/dist/cjs/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/Pagination/usePagination.cjs +3 -1
- package/dist/cjs/Pagination/usePagination.cjs.map +1 -1
- package/dist/cjs/labs/DataView/TableLayoutContent.cjs +3 -3
- package/dist/cjs/labs/DataView/TableLayoutContent.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/ComposablePicker.cjs +2 -0
- package/dist/cjs/labs/OdysseyPickers/ComposablePicker.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/Picker.cjs +21 -27
- package/dist/cjs/labs/OdysseyPickers/Picker.cjs.map +1 -1
- package/dist/cjs/labs/OdysseyPickers/PickerWithOptionAdornment.cjs +11 -10
- package/dist/cjs/labs/OdysseyPickers/PickerWithOptionAdornment.cjs.map +1 -1
- package/dist/cjs/labs/PageTemplate/DocumentationLink.cjs +41 -0
- package/dist/cjs/labs/PageTemplate/DocumentationLink.cjs.map +1 -0
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs +22 -8
- package/dist/cjs/labs/PageTemplate/PageTemplate.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_cs.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_cs.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_da.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_da.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_de.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_de.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_el.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_el.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_es.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_es.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_fi.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_fi.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_fr.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_fr.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ht.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ht.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_hu.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_hu.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_id.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_id.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_it.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_it.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ja.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ja.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ko.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ko.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ms.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ms.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_nb.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_nb.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_nl_NL.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_nl_NL.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_pl.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_pl.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_pt_BR.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_pt_BR.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ro.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ro.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_ru.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_ru.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_sv.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_sv.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_th.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_th.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_tr.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_tr.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_uk.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_uk.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_vi.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_vi.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_CN.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_CN.cjs.map +1 -1
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_TW.cjs +1 -0
- package/dist/cjs/properties/ts/odyssey-react-mui_zh_TW.cjs.map +1 -1
- package/dist/cjs/test-selectors/getByQuerySelector.cjs +2 -2
- package/dist/cjs/test-selectors/getByQuerySelector.cjs.map +1 -1
- package/dist/cjs/test-selectors/testSelector.cjs.map +1 -1
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs +5 -3
- package/dist/cjs/ui-shell/NarrowUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs +14 -6
- package/dist/cjs/ui-shell/SideNav/SideNav.cjs.map +1 -1
- package/dist/cjs/ui-shell/SideNav/types.cjs.map +1 -1
- package/dist/cjs/ui-shell/UiShell.cjs +5 -2
- package/dist/cjs/ui-shell/UiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/WideUiShellContent.cjs +3 -3
- package/dist/cjs/ui-shell/WideUiShellContent.cjs.map +1 -1
- package/dist/cjs/ui-shell/renderUiShell.cjs +12 -0
- package/dist/cjs/ui-shell/renderUiShell.cjs.map +1 -1
- package/dist/cjs/ui-shell/uiShellContentTypes.cjs.map +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs +1 -1
- package/dist/cjs/web-component/odysseyWebComponentVersion.generated.cjs.map +1 -1
- package/dist/cjs/web-component/renderReactInWebComponent.cjs.map +1 -1
- package/dist/esm/Pagination/Pagination.js +2 -1
- package/dist/esm/Pagination/Pagination.js.map +1 -1
- package/dist/esm/Pagination/usePagination.js +3 -1
- package/dist/esm/Pagination/usePagination.js.map +1 -1
- package/dist/esm/labs/DataView/TableLayoutContent.js +3 -3
- package/dist/esm/labs/DataView/TableLayoutContent.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/ComposablePicker.js +2 -0
- package/dist/esm/labs/OdysseyPickers/ComposablePicker.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/Picker.js +23 -29
- package/dist/esm/labs/OdysseyPickers/Picker.js.map +1 -1
- package/dist/esm/labs/OdysseyPickers/PickerWithOptionAdornment.js +12 -11
- package/dist/esm/labs/OdysseyPickers/PickerWithOptionAdornment.js.map +1 -1
- package/dist/esm/labs/PageTemplate/DocumentationLink.js +35 -0
- package/dist/esm/labs/PageTemplate/DocumentationLink.js.map +1 -0
- package/dist/esm/labs/PageTemplate/PageTemplate.js +22 -8
- package/dist/esm/labs/PageTemplate/PageTemplate.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_cs.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_cs.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_da.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_da.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_de.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_de.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_el.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_el.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_es.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_es.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_fi.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_fi.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_fr.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_fr.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ht.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ht.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_hu.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_hu.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_id.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_id.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_it.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_it.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ja.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ja.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ko.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ko.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ms.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ms.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_nb.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_nb.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_nl_NL.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_nl_NL.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_pl.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_pl.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_pt_BR.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_pt_BR.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ro.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ro.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_ru.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_ru.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_sv.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_sv.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_th.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_th.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_tr.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_tr.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_uk.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_uk.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_vi.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_vi.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_zh_CN.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_zh_CN.js.map +1 -1
- package/dist/esm/properties/ts/odyssey-react-mui_zh_TW.js +1 -0
- package/dist/esm/properties/ts/odyssey-react-mui_zh_TW.js.map +1 -1
- package/dist/esm/test-selectors/getByQuerySelector.js +1 -1
- package/dist/esm/test-selectors/getByQuerySelector.js.map +1 -1
- package/dist/esm/test-selectors/testSelector.js.map +1 -1
- package/dist/esm/ui-shell/NarrowUiShellContent.js +5 -3
- package/dist/esm/ui-shell/NarrowUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/SideNav.js +14 -6
- package/dist/esm/ui-shell/SideNav/SideNav.js.map +1 -1
- package/dist/esm/ui-shell/SideNav/types.js.map +1 -1
- package/dist/esm/ui-shell/UiShell.js +5 -2
- package/dist/esm/ui-shell/UiShell.js.map +1 -1
- package/dist/esm/ui-shell/WideUiShellContent.js +3 -3
- package/dist/esm/ui-shell/WideUiShellContent.js.map +1 -1
- package/dist/esm/ui-shell/renderUiShell.js +12 -0
- package/dist/esm/ui-shell/renderUiShell.js.map +1 -1
- package/dist/esm/ui-shell/uiShellContentTypes.js.map +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js +1 -1
- package/dist/esm/web-component/odysseyWebComponentVersion.generated.js.map +1 -1
- package/dist/esm/web-component/renderReactInWebComponent.js.map +1 -1
- package/dist/index.cjs +231 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.mjs +229 -0
- package/dist/index.scss +549 -0
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/types/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/types/Pagination/Pagination.d.ts +1 -0
- package/dist/types/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/Pagination/usePagination.d.ts.map +1 -1
- package/dist/types/i18n.d.ts +28 -0
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/ComposablePicker.d.ts +2 -1
- package/dist/types/labs/OdysseyPickers/ComposablePicker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/Picker.d.ts +6 -7
- package/dist/types/labs/OdysseyPickers/Picker.d.ts.map +1 -1
- package/dist/types/labs/OdysseyPickers/PickerWithOptionAdornment.d.ts.map +1 -1
- package/dist/types/labs/PageTemplate/DocumentationLink.d.ts +34 -0
- package/dist/types/labs/PageTemplate/DocumentationLink.d.ts.map +1 -0
- package/dist/types/labs/PageTemplate/PageTemplate.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_cs.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_cs.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_da.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_da.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_de.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_de.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_el.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_el.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_es.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_es.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_fi.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_fi.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_fr.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_fr.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ht.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ht.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_hu.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_hu.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_id.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_id.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_it.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_it.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ja.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ja.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ko.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ko.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ms.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ms.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_nb.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_nb.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_nl_NL.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_nl_NL.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_pl.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_pl.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_pt_BR.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_pt_BR.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ro.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ro.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_ru.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_ru.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_sv.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_sv.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_th.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_th.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_tr.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_tr.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_uk.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_uk.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_vi.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_vi.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_zh_CN.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_zh_CN.d.ts.map +1 -1
- package/dist/types/properties/ts/odyssey-react-mui_zh_TW.d.ts +1 -0
- package/dist/types/properties/ts/odyssey-react-mui_zh_TW.d.ts.map +1 -1
- package/dist/types/test-selectors/getByQuerySelector.d.ts +73 -73
- package/dist/types/test-selectors/getByQuerySelector.d.ts.map +1 -1
- package/dist/types/test-selectors/testSelector.d.ts +1 -1
- package/dist/types/test-selectors/testSelector.d.ts.map +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts +1 -1
- package/dist/types/ui-shell/NarrowUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/SideNav.d.ts +1 -1
- package/dist/types/ui-shell/SideNav/SideNav.d.ts.map +1 -1
- package/dist/types/ui-shell/SideNav/types.d.ts +5 -1
- package/dist/types/ui-shell/SideNav/types.d.ts.map +1 -1
- package/dist/types/ui-shell/UiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts +1 -1
- package/dist/types/ui-shell/WideUiShellContent.d.ts.map +1 -1
- package/dist/types/ui-shell/renderUiShell.d.ts +19 -4
- package/dist/types/ui-shell/renderUiShell.d.ts.map +1 -1
- package/dist/types/ui-shell/uiShellContentTypes.d.ts +4 -0
- package/dist/types/ui-shell/uiShellContentTypes.d.ts.map +1 -1
- package/dist/types/web-component/odysseyWebComponentVersion.generated.d.ts +1 -1
- package/dist/types/web-component/renderReactInWebComponent.d.ts.map +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -44,14 +44,17 @@ Add the Odyssey `OdysseyProvider` around your whole app:
|
|
|
44
44
|
import { OdysseyProvider } from "@okta/odyssey-react-mui";
|
|
45
45
|
|
|
46
46
|
const YourAppRoot = ({ children }) => (
|
|
47
|
-
<OdysseyProvider>
|
|
47
|
+
<OdysseyProvider>
|
|
48
|
+
<CssBaseline />
|
|
49
|
+
{children}
|
|
50
|
+
</OdysseyProvider>
|
|
48
51
|
);
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|
Add Material-UI components not exported from Odyssey with Odyssey styling or add your own theme to MUI:
|
|
52
55
|
|
|
53
56
|
```sh
|
|
54
|
-
|
|
57
|
+
yarn add @mui/material
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
```jsx
|
|
@@ -60,7 +63,9 @@ import { OdysseyThemeProvider } from "@okta/odyssey-react-mui";
|
|
|
60
63
|
import { myMaterialUiTheme } from "./myMaterialUiTheme.js";
|
|
61
64
|
|
|
62
65
|
const YourAppRoot = ({ children }) => (
|
|
63
|
-
<OdysseyThemeProvider theme={myMaterialUiTheme}>
|
|
66
|
+
<OdysseyThemeProvider theme={myMaterialUiTheme}>
|
|
67
|
+
{children}
|
|
68
|
+
<OdysseyThemeProvider>
|
|
64
69
|
);
|
|
65
70
|
```
|
|
66
71
|
|
|
@@ -14,6 +14,7 @@ var _index2 = require("../icons.generated/index.cjs");
|
|
|
14
14
|
var _OdysseyDesignTokensContext = require("../OdysseyDesignTokensContext.cjs");
|
|
15
15
|
var _usePagination = require("./usePagination.cjs");
|
|
16
16
|
var _Typography = require("../Typography.cjs");
|
|
17
|
+
require("../i18n.cjs");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
/*!
|
|
@@ -118,7 +119,7 @@ const Pagination = ({
|
|
|
118
119
|
} = (0, _usePagination.usePagination)({
|
|
119
120
|
pageIndex,
|
|
120
121
|
pageSize,
|
|
121
|
-
currentRowsCount: currentRowsCount ||
|
|
122
|
+
currentRowsCount: currentRowsCount || 0,
|
|
122
123
|
totalRows
|
|
123
124
|
});
|
|
124
125
|
const handlePaginationChange = (0, _react.useCallback)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactI18next","_Box","_index","_index2","_OdysseyDesignTokensContext","_usePagination","_Typography","_jsxRuntime","e","__esModule","default","PaginationContainer","styled","display","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","alignItems","gap","Spacing4","Spacing2","PaginationInput","_InputBase2","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","useOdysseyDesignTokens","t","useTranslation","page","setPage","useState","rowsPerPage","setRowsPerPage","initialRowsPerPage","useRef","useEffect","useCallback","totalRowsLabel","usePagination","handlePaginationChange","updatedPage","updatedRowsPerPage","Math","ceil","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","useMemo","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","jsxs","children","Box","jsx","Paragraph","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","Button","startIcon","ArrowLeftIcon","size","ariaLabel","onClick","endIcon","ArrowRightIcon","label","MemoizedPagination","exports","memo","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 styled from \"@emotion/styled\";\nimport { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Box } from \"../Box.js\";\nimport { Button } from \"../Buttons/index.js\";\nimport { paginationTypeValues } from \"./constants.js\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated/index.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { usePagination } from \"./usePagination.js\";\nimport { Paragraph } from \"../Typography.js\";\n\nconst PaginationContainer = styled(\"nav\")({\n display: \"flex\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\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: DesignTokens }>(({ odysseyDesignTokens }) => ({\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 aria-label={t(\"pagination.label\")}>\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":";;;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,2BAAA,GAAAN,OAAA;AAIA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAA6C,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAD,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA1B7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,MAAMG,mBAAmB,GAAG,IAAAC,eAAM,EAAC,KAAK,CAAC,CAAC;EACxCC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAAH,eAAM,EAAC,KAAK,EAAE;EACtCI,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAwC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EACtEL,OAAO,EAAE,MAAM;EACfM,UAAU,EAAE,QAAQ;EACpBC,GAAG,EAAEF,mBAAmB,CAACG,QAAQ;EACjC,SAAS,EAAE;IACTR,OAAO,EAAE,MAAM;IACfM,UAAU,EA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B,CAACG,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Pagination.cjs","names":["_styled","_interopRequireDefault","require","_react","_reactI18next","_Box","_index","_index2","_OdysseyDesignTokensContext","_usePagination","_Typography","_jsxRuntime","e","__esModule","default","PaginationContainer","styled","display","justifyContent","PaginationSegment","shouldForwardProp","prop","odysseyDesignTokens","alignItems","gap","Spacing4","Spacing2","PaginationInput","_InputBase2","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","useOdysseyDesignTokens","t","useTranslation","page","setPage","useState","rowsPerPage","setRowsPerPage","initialRowsPerPage","useRef","useEffect","useCallback","totalRowsLabel","usePagination","handlePaginationChange","updatedPage","updatedRowsPerPage","Math","ceil","handlePageSubmit","event","key","parseInt","currentTarget","value","handleRowsPerPageSubmit","setPageFromEvent","min","target","setRowsPerPageFromEvent","max","handleLoadMore","current","handleNextButton","handlePreviousButton","loadMoreIsDisabled","useMemo","nextButtonDisabled","previousButtonDisabled","rowsPerPageInputProps","currentPageInputProps","jsxs","children","Box","jsx","Paragraph","component","color","type","onChange","onBlur","onKeyDown","disabled","inputProps","Button","startIcon","ArrowLeftIcon","size","ariaLabel","onClick","endIcon","ArrowRightIcon","label","MemoizedPagination","exports","memo","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 styled from \"@emotion/styled\";\nimport { InputBase } from \"@mui/material\";\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { Box } from \"../Box.js\";\nimport { Button } from \"../Buttons/index.js\";\nimport { paginationTypeValues } from \"./constants.js\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"../icons.generated/index.js\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { usePagination } from \"./usePagination.js\";\nimport { Paragraph } from \"../Typography.js\";\nimport \"../i18n.js\";\n\nconst PaginationContainer = styled(\"nav\")({\n display: \"flex\",\n justifyContent: \"space-between\",\n});\n\nconst PaginationSegment = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\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: DesignTokens }>(({ odysseyDesignTokens }) => ({\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 || 0,\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 aria-label={t(\"pagination.label\")}>\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":";;;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,2BAAA,GAAAN,OAAA;AAIA,IAAAO,cAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACAA,OAAA;AAAoB,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAD,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA3BpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,MAAMG,mBAAmB,GAAG,IAAAC,eAAM,EAAC,KAAK,CAAC,CAAC;EACxCC,OAAO,EAAE,MAAM;EACfC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAAH,eAAM,EAAC,KAAK,EAAE;EACtCI,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAwC,CAAC;EAAEC;AAAoB,CAAC,MAAM;EACtEL,OAAO,EAAE,MAAM;EACfM,UAAU,EAAE,QAAQ;EACpBC,GAAG,EAAEF,mBAAmB,CAACG,QA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,GAAG,IAAA2F,WAAI,EAAC3F,UAAU,CAAC;AAC3CyF,kBAAkB,CAACG,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
@@ -30,7 +30,9 @@ const usePagination = ({
|
|
|
30
30
|
return (0, _react.useMemo)(() => {
|
|
31
31
|
const firstRow = pageSize * (pageIndex - 1) + 1;
|
|
32
32
|
const lastRow = firstRow + (currentRowsCount - 1);
|
|
33
|
-
const totalRowsLabel =
|
|
33
|
+
const totalRowsLabel = currentRowsCount === 0 ? t("pagination.totalrows", {
|
|
34
|
+
totalRows: 0
|
|
35
|
+
}) : totalRows ? t("pagination.rowswithtotal", {
|
|
34
36
|
firstRow,
|
|
35
37
|
lastRow,
|
|
36
38
|
totalRows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.cjs","names":["_reactI18next","require","_react","usePagination","currentRowsCount","pageIndex","pageSize","totalRows","t","useTranslation","useMemo","firstRow","lastRow","totalRowsLabel","exports"],"sources":["../../../src/Pagination/usePagination.ts"],"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 { useTranslation } from \"react-i18next\";\nimport { useMemo } from \"react\";\n\ntype UsePaginationType = {\n currentRowsCount: number;\n pageIndex: number;\n pageSize: number;\n totalRows?: number;\n};\n\nexport const usePagination = ({\n currentRowsCount,\n pageIndex,\n pageSize,\n totalRows,\n}: UsePaginationType) => {\n const { t } = useTranslation();\n\n return useMemo(() => {\n const firstRow = pageSize * (pageIndex - 1) + 1;\n const lastRow = firstRow + (currentRowsCount - 1);\n\n const totalRowsLabel
|
|
1
|
+
{"version":3,"file":"usePagination.cjs","names":["_reactI18next","require","_react","usePagination","currentRowsCount","pageIndex","pageSize","totalRows","t","useTranslation","useMemo","firstRow","lastRow","totalRowsLabel","exports"],"sources":["../../../src/Pagination/usePagination.ts"],"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 { useTranslation } from \"react-i18next\";\nimport { useMemo } from \"react\";\n\ntype UsePaginationType = {\n currentRowsCount: number;\n pageIndex: number;\n pageSize: number;\n totalRows?: number;\n};\n\nexport const usePagination = ({\n currentRowsCount,\n pageIndex,\n pageSize,\n totalRows,\n}: UsePaginationType) => {\n const { t } = useTranslation();\n\n return useMemo(() => {\n const firstRow = pageSize * (pageIndex - 1) + 1;\n const lastRow = firstRow + (currentRowsCount - 1);\n\n const totalRowsLabel =\n currentRowsCount === 0\n ? t(\"pagination.totalrows\", { totalRows: 0 })\n : totalRows\n ? t(\"pagination.rowswithtotal\", { firstRow, lastRow, totalRows })\n : t(\"pagination.rowswithouttotal\", { firstRow, lastRow });\n\n return {\n firstRow,\n lastRow,\n totalRowsLabel,\n };\n }, [currentRowsCount, pageIndex, pageSize, totalRows, t]);\n};\n"],"mappings":";;;;;;AAYA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,MAAME,aAAa,GAAGA,CAAC;EAC5BC,gBAAgB;EAChBC,SAAS;EACTC,QAAQ;EACRC;AACiB,CAAC,KAAK;EACvB,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,4BAAc,EAAC,CAAC;EAE9B,OAAO,IAAAC,cAAO,EAAC,MAAM;IACnB,MAAMC,QAAQ,GAAGL,QAAQ,IAAID,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC;IAC/C,MAAMO,OAAO,GAAGD,QAAQ,IAAIP,gBAAgB,GAAG,CAAC,CAAC;IAEjD,MAAMS,cAAc,GAClBT,gBAAgB,KAAK,CAAC,GAClBI,CAAC,CAAC,sBAAsB,EAAE;MAAED,SAAS,EAAE;IAAE,CAAC,CAAC,GAC3CA,SAAS,GACPC,CAAC,CAAC,0BAA0B,EAAE;MAAEG,QAAQ;MAAEC,OAAO;MAAEL;IAAU,CAAC,CAAC,GAC/DC,CAAC,CAAC,6BAA6B,EAAE;MAAEG,QAAQ;MAAEC;IAAQ,CAAC,CAAC;IAE/D,OAAO;MACLD,QAAQ;MACRC,OAAO;MACPC;IACF,CAAC;EACH,CAAC,EAAE,CAACT,gBAAgB,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAACM,OAAA,CAAAX,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -153,9 +153,9 @@ const TableLayoutContent = ({
|
|
|
153
153
|
state: {
|
|
154
154
|
sorting: tableState.columnSorting,
|
|
155
155
|
columnVisibility: tableState.columnVisibility,
|
|
156
|
-
isLoading
|
|
157
|
-
rowSelection
|
|
158
|
-
columnOrder
|
|
156
|
+
isLoading,
|
|
157
|
+
rowSelection,
|
|
158
|
+
columnOrder
|
|
159
159
|
},
|
|
160
160
|
icons: {
|
|
161
161
|
ArrowDownwardIcon: _index.ArrowDownIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayoutContent.cjs","names":["_react","require","_styled","_interopRequireDefault","_materialReactTable","_reactI18next","_index","_Box","_index2","_tableConstants","_RowActions","_OdysseyDesignTokensContext","_useScrollIndication","_jsxRuntime","e","__esModule","default","TextWrapper","styled","whiteSpace","textOverflow","overflow","RowActionsContainer","display","TableLayoutContent","columns","data","draggingRow","emptyState","enableVirtualization","getRowId","hasRowReordering","hasRowSelection","isEmpty","isLoading","isNoResults","isRowReorderingDisabled","onReorderRows","pagination","rowReorderingUtilities","rowSelection","setRowSelection","setTableState","tableLayoutOptions","tableState","totalRows","isTableContainerScrolledToStart","setIsTableContainerScrolledToStart","useState","isTableContainerScrolledToEnd","setIsTableContainerScrolledToEnd","tableInnerContainerWidth","setTableInnerContainerWidth","shouldUpdateScroll","useRef","tableOuterContainerRef","tableInnerContainerRef","tableContentRef","useScrollIndication","tableInnerContainer","current","tableOuterContainer","odysseyDesignTokens","useOdysseyDesignTokens","t","useTranslation","columnIds","useMemo","map","column","accessorKey","columnOrder","filter","id","rowDensityClassName","rowDensity","defaultCell","useCallback","cell","value","getValue","hasTextWrapping","columnDef","enableWrapping","jsx","children","draggableTableBodyRowClassName","dragHandleStyles","dragHandleText","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","renderRowActions","row","currentIndex","index","pageIndex","pageSize","jsxs","rowActionButtons","rowActionMenuItems","MenuButton","ariaLabel","buttonVariant","endIcon","MoreIcon","menuAlignment","size","RowActions","rowIndex","undefined","innerWidthStyle","width","emptyStateContainer","Box","sx","useEffect","scrollTo","clientHeight","shouldDisplayRowActions","hasColumnWithGrow","some","grow","dataTable","useMaterialReactTable","state","sorting","columnSorting","columnVisibility","icons","ArrowDownwardIcon","ArrowDownIcon","DragHandleIcon","DragIndicatorIcon","SyncAltIcon","ArrowUnsortedIcon","ExpandMoreIcon","ChevronDownIcon","dataTableImmutableSettings","displayColumnDefOptions","header","muiTableBodyCellProps","align","className","muiTableHeadCellProps","visibility","Button","variant","isDisabled","muiTableProps","ref","hasColumnResizing","muiTableContainerProps","muiTableBodyProps","tabIndex","height","enableColumnResizing","defaultColumn","Cell","enableRowActions","enableRowOrdering","Boolean","enableRowDragging","muiDetailPanelProps","paddingBlock","getIsExpanded","Spacing3","muiTableBodyRowProps","table","isDetailPanel","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","border","backgroundColor","HueNeutralWhite","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","disabled","renderDetailPanel","enableRowVirtualization","currentColumn","find","sortedColumn","getIsResizing","enableSorting","hasSorting","onSortingChange","sortingUpdater","newSortVal","prevState","enableRowSelection","onRowSelectionChange","renderEmptyRowsFallback","localization","collapse","collapseAll","expand","expandAll","ScrollableTableContainer","isScrollableEnd","isScrollableStart","MRT_TableContainer","MemoizedTableLayoutContent","exports","memo","displayName"],"sources":["../../../../src/labs/DataView/TableLayoutContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n SetStateAction,\n memo,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n Dispatch,\n ReactElement,\n useEffect,\n} from \"react\";\nimport styled, { CSSObject } from \"@emotion/styled\";\nimport {\n MRT_Row,\n MRT_RowData,\n MRT_RowSelectionState,\n MRT_TableContainer,\n MRT_TableInstance,\n MRT_TableOptions,\n useMaterialReactTable,\n} from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n ChevronDownIcon,\n DragIndicatorIcon,\n MoreIcon,\n} from \"../../icons.generated/index.js\";\nimport { Box } from \"../../Box.js\";\nimport { Button, MenuButton } from \"../../Buttons/index.js\";\nimport {\n TableLayoutProps,\n TableState,\n UniversalProps,\n} from \"./componentTypes.js\";\nimport { DataTableCell } from \"./dataTypes.js\";\nimport {\n dataTableImmutableSettings,\n displayColumnDefOptions,\n ScrollableTableContainer,\n} from \"./tableConstants.js\";\nimport { RowActions } from \"./RowActions.js\";\nimport { useOdysseyDesignTokens } from \"../../OdysseyDesignTokensContext.js\";\nimport { useScrollIndication } from \"../../DataTable/useScrollIndication.js\";\n\nconst TextWrapper = styled(\"div\")({\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n});\n\nconst RowActionsContainer = styled(\"div\")({\n display: \"flex\",\n});\n\nexport type TableLayoutContentProps<TData extends MRT_RowData> = {\n columns: TableLayoutProps<TData>[\"columns\"];\n data: MRT_RowData[];\n draggingRow?: MRT_Row<TData> | null;\n emptyState: ReactNode;\n enableVirtualization?: boolean;\n getRowId: UniversalProps<TData>[\"getRowId\"];\n hasRowReordering: UniversalProps<TData>[\"hasRowReordering\"];\n hasRowSelection: UniversalProps<TData>[\"hasRowSelection\"];\n isEmpty?: boolean;\n isLoading: boolean;\n isNoResults?: boolean;\n isRowReorderingDisabled?: boolean;\n onReorderRows: UniversalProps<TData>[\"onReorderRows\"];\n pagination: {\n pageIndex: number;\n pageSize: number;\n };\n rowReorderingUtilities: {\n dragHandleStyles: CSSObject;\n dragHandleText: {\n title: string;\n \"aria-label\": string;\n };\n draggableTableBodyRowClassName: ({\n currentRowId,\n draggingRowId,\n hoveredRowId,\n }: {\n currentRowId: string;\n draggingRowId?: string;\n hoveredRowId?: string;\n }) => string | undefined;\n handleDragHandleKeyDown: ({\n table,\n row,\n event,\n }: {\n table: MRT_TableInstance<TData>;\n row: MRT_Row<TData>;\n event: React.KeyboardEvent<HTMLButtonElement>;\n }) => void;\n handleDragHandleOnDragCapture: (table: MRT_TableInstance<TData>) => void;\n handleDragHandleOnDragEnd: (table: MRT_TableInstance<TData>) => void;\n resetDraggingAndHoveredRow: (table: MRT_TableInstance<TData>) => void;\n updateRowOrder: ({\n rowId,\n newRowIndex,\n }: {\n rowId: string;\n newRowIndex: number;\n }) => void;\n };\n rowSelection: MRT_RowSelectionState;\n setRowSelection: Dispatch<SetStateAction<MRT_RowSelectionState>>;\n setTableState: Dispatch<SetStateAction<TableState>>;\n tableLayoutOptions: TableLayoutProps<TData>;\n tableState: TableState;\n totalRows: UniversalProps<TData>[\"totalRows\"];\n};\n\ntype TableLayoutContentComponent = (<TData extends MRT_RowData>(\n props: TableLayoutContentProps<TData>,\n) => JSX.Element) & {\n displayName?: string;\n};\n\nconst TableLayoutContent = <TData extends MRT_RowData>({\n columns,\n data,\n draggingRow,\n emptyState,\n enableVirtualization,\n getRowId,\n hasRowReordering,\n hasRowSelection,\n isEmpty,\n isLoading,\n isNoResults,\n isRowReorderingDisabled,\n onReorderRows,\n pagination,\n rowReorderingUtilities,\n rowSelection,\n setRowSelection,\n setTableState,\n tableLayoutOptions,\n tableState,\n totalRows,\n}: TableLayoutContentProps<TData>) => {\n const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] =\n useState(true);\n const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] =\n useState(true);\n const [tableInnerContainerWidth, setTableInnerContainerWidth] =\n useState<string>(\"100%\");\n const shouldUpdateScroll = useRef<boolean>(false);\n const tableOuterContainerRef = useRef<HTMLDivElement>(null);\n const tableInnerContainerRef = useRef<HTMLDivElement>(null);\n const tableContentRef = useRef<HTMLTableElement>(null);\n\n useScrollIndication({\n setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,\n setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,\n setTableInnerContainerWidth: setTableInnerContainerWidth,\n tableInnerContainer: tableInnerContainerRef.current,\n tableOuterContainer: tableOuterContainerRef.current,\n });\n\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const columnIds = useMemo(() => {\n return columns.map((column) => column.accessorKey) ?? [];\n }, [columns]);\n\n const columnOrder = useMemo(\n () => [\n \"mrt-row-drag\",\n \"mrt-row-select\",\n \"mrt-row-expand\",\n ...(columnIds?.filter((id): id is string => typeof id === \"string\") ||\n []),\n \"mrt-row-actions\",\n ],\n [columnIds],\n );\n\n const rowDensityClassName = useMemo(() => {\n return tableState.rowDensity === \"spacious\"\n ? \"MuiTableBody-spacious\"\n : tableState.rowDensity === \"compact\"\n ? \"MuiTableBody-compact\"\n : \"MuiTableBody-default\";\n }, [tableState]);\n\n const defaultCell = useCallback<\n ({ cell }: { cell: DataTableCell<TData, unknown> }) => ReactElement | string\n >(({ cell }) => {\n const value = cell.getValue<string>();\n const hasTextWrapping =\n cell.column.columnDef.hasTextWrapping ||\n cell.column.columnDef.enableWrapping;\n return hasTextWrapping ? value : <TextWrapper>{value}</TextWrapper>;\n }, []);\n\n const {\n draggableTableBodyRowClassName,\n dragHandleStyles,\n dragHandleText,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = rowReorderingUtilities;\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<TData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <RowActionsContainer>\n {tableLayoutOptions.rowActionButtons?.(row)}\n {(tableLayoutOptions.rowActionMenuItems || hasRowReordering) && (\n <MenuButton\n ariaLabel={t(\"table.moreactions.arialabel\")}\n buttonVariant=\"floating\"\n endIcon={<MoreIcon />}\n menuAlignment=\"right\"\n size=\"small\"\n >\n <RowActions\n isRowReorderingDisabled={isRowReorderingDisabled}\n row={\n row as unknown as MRT_Row<MRT_RowData> // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n }\n rowActionMenuItems={\n // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n tableLayoutOptions.rowActionMenuItems as unknown as (\n row: MRT_Row<MRT_RowData>,\n ) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n rowIndex={currentIndex}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n </MenuButton>\n )}\n </RowActionsContainer>\n );\n },\n [\n hasRowReordering,\n isRowReorderingDisabled,\n onReorderRows,\n pagination.pageIndex,\n pagination.pageSize,\n t,\n tableLayoutOptions,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const innerWidthStyle = useMemo(\n () => ({ width: tableInnerContainerWidth }),\n [tableInnerContainerWidth],\n );\n\n const emptyStateContainer = useCallback(\n () => <Box sx={innerWidthStyle}>{emptyState}</Box>,\n [innerWidthStyle, emptyState],\n );\n\n // Scroll to the bottom as soon as data loads after clicking the\n // loadMore pagination button\n useEffect(() => {\n if (enableVirtualization) {\n shouldUpdateScroll.current = true;\n }\n }, [enableVirtualization, pagination]);\n\n useEffect(() => {\n if (\n shouldUpdateScroll.current &&\n tableContentRef.current &&\n typeof tableInnerContainerRef.current?.scrollTo !== \"undefined\"\n ) {\n tableInnerContainerRef.current?.scrollTo(\n 0,\n tableContentRef.current.clientHeight,\n );\n shouldUpdateScroll.current = false;\n }\n }, [data]);\n\n const shouldDisplayRowActions = useMemo(\n () =>\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n [\n hasRowReordering,\n onReorderRows,\n tableLayoutOptions.rowActionButtons,\n tableLayoutOptions.rowActionMenuItems,\n ],\n );\n\n const hasColumnWithGrow = columns.some((column) => column.grow === true);\n\n const dataTable = useMaterialReactTable<TData>({\n data: (!isEmpty && !isNoResults ? data : []) as TData[],\n columns,\n getRowId,\n state: {\n sorting: tableState.columnSorting,\n columnVisibility: tableState.columnVisibility,\n isLoading: isLoading,\n rowSelection: rowSelection,\n columnOrder: columnOrder,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n ExpandMoreIcon: ChevronDownIcon,\n },\n ...dataTableImmutableSettings,\n displayColumnDefOptions: {\n ...(displayColumnDefOptions satisfies Partial<\n MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"]\n >),\n \"mrt-row-actions\": {\n header: \"\",\n grow: !hasColumnWithGrow,\n muiTableBodyCellProps: {\n align: \"right\" as const,\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\" as const,\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n children: (\n <Box sx={{ display: \"flex\", visibility: \"hidden\" }}>\n {tableLayoutOptions.rowActionButtons &&\n // @ts-expect-error TODO: This type is wrong and needs to be fixed\n tableLayoutOptions.rowActionButtons({ id: null })}\n {((hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionMenuItems) && (\n <Box>\n <Button\n endIcon={<MoreIcon />}\n size=\"small\"\n variant=\"floating\"\n ariaLabel={t(\"table.moreactions.arialabel\")}\n isDisabled\n />\n </Box>\n )}\n </Box>\n ),\n },\n },\n },\n muiTableProps: {\n ref: tableContentRef,\n className:\n !shouldDisplayRowActions && tableLayoutOptions.hasColumnResizing\n ? hasColumnWithGrow\n ? \"ods-hide-spacer-column\"\n : \"ods-hide-spacer-column ods-column-grow\"\n : \"\",\n },\n muiTableContainerProps: {\n ref: tableInnerContainerRef,\n },\n muiTableBodyProps: () => ({\n className: rowDensityClassName,\n tabIndex: 0,\n /**\n * This is a fix for an issue related to the empty state creating a\n * vertical scrollbar when virtualization is enabled. The root cause\n * is tablebody having height: 0 when virtualization is enabled and there\n * being no data\n * https://okta.slack.com/archives/C7T2H3KNJ/p1742842106148929\n */\n sx:\n isEmpty || isNoResults\n ? {\n height: \"unset\",\n }\n : undefined,\n }),\n enableColumnResizing: tableLayoutOptions.hasColumnResizing,\n defaultColumn: {\n Cell: defaultCell,\n },\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n renderRowActions: ({ row }) => renderRowActions({ row }),\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiDetailPanelProps: ({ row }) => ({\n sx: {\n paddingBlock: row.getIsExpanded()\n ? `${odysseyDesignTokens.Spacing3} !important`\n : undefined,\n },\n }),\n muiTableBodyRowProps: ({ table, row, isDetailPanel }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n sx: isDetailPanel\n ? {\n paddingBlock: \"0 !important\",\n border: 0,\n [\"&:hover\"]: {\n backgroundColor: `${odysseyDesignTokens.HueNeutralWhite} !important`,\n },\n }\n : {},\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n disabled: isRowReorderingDisabled,\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n renderDetailPanel: tableLayoutOptions.renderDetailPanel,\n enableRowVirtualization: enableVirtualization,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: tableState.columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n muiTableBodyCellProps: ({ column }) => ({\n className: column.getIsResizing() ? \"isResizing\" : \"\",\n }),\n enableSorting: tableLayoutOptions.hasSorting === true, // I don't know why this needs to be true, but it still works if undefined otherwise\n onSortingChange: (sortingUpdater) => {\n const newSortVal =\n typeof sortingUpdater === \"function\"\n ? sortingUpdater(tableState.columnSorting)\n : tableState.columnSorting;\n setTableState((prevState) => ({\n ...prevState,\n columnSorting: newSortVal,\n }));\n },\n enableRowSelection: hasRowSelection,\n onRowSelectionChange: setRowSelection,\n renderEmptyRowsFallback: emptyStateContainer,\n localization: {\n collapse: t(\"table.rowexpansion.collapse\"),\n collapseAll: t(\"table.rowexpansion.collapseall\"),\n expand: t(\"table.rowexpansion.expand\"),\n expandAll: t(\"table.rowexpansion.expandall\"),\n },\n });\n\n return (\n <ScrollableTableContainer\n isScrollableEnd={!isTableContainerScrolledToEnd}\n isScrollableStart={!isTableContainerScrolledToStart}\n odysseyDesignTokens={odysseyDesignTokens}\n ref={tableOuterContainerRef}\n >\n <MRT_TableContainer table={dataTable} />\n </ScrollableTableContainer>\n );\n};\n\nconst MemoizedTableLayoutContent = memo(\n TableLayoutContent,\n) as TableLayoutContentComponent;\nMemoizedTableLayoutContent.displayName = \"TableLayoutContent\";\n\nexport { MemoizedTableLayoutContent as TableLayoutContent };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAYA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AASA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAOA,IAAAM,IAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAOA,IAAAQ,eAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,2BAAA,GAAAV,OAAA;AACA,IAAAW,oBAAA,GAAAX,OAAA;AAA6E,IAAAY,WAAA,GAAAZ,OAAA;AAAA,SAAAE,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA1D7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkDA,MAAMG,WAAW,GAAG,IAAAC,eAAM,EAAC,KAAK,CAAC,CAAC;EAChCC,UAAU,EAAE,QAAQ;EACpBC,YAAY,E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CAAC,CAAC,8BAA8B;IAC7C;EACF,CAAC,CAAC;EAEF,OACE,IAAAnD,WAAA,CAAAuE,GAAA,EAAC3E,eAAA,CAAAsM,wBAAwB;IACvBC,eAAe,EAAE,CAAC/J,6BAA8B;IAChDgK,iBAAiB,EAAE,CAACnK,+BAAgC;IACpDgB,mBAAmB,EAAEA,mBAAoB;IACzC0F,GAAG,EAAEjG,sBAAuB;IAAA8B,QAAA,EAE5B,IAAAxE,WAAA,CAAAuE,GAAA,EAAChF,mBAAA,CAAA8M,kBAAkB;MAACxC,KAAK,EAAE7C;IAAU,CAAE;EAAC,CAChB,CAAC;AAE/B,CAAC;AAED,MAAMsF,0BAA0B,GAAAC,OAAA,CAAA5L,kBAAA,GAAG,IAAA6L,WAAI,EACrC7L,kBACF,CAAgC;AAChC2L,0BAA0B,CAACG,WAAW,GAAG,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayoutContent.cjs","names":["_react","require","_styled","_interopRequireDefault","_materialReactTable","_reactI18next","_index","_Box","_index2","_tableConstants","_RowActions","_OdysseyDesignTokensContext","_useScrollIndication","_jsxRuntime","e","__esModule","default","TextWrapper","styled","whiteSpace","textOverflow","overflow","RowActionsContainer","display","TableLayoutContent","columns","data","draggingRow","emptyState","enableVirtualization","getRowId","hasRowReordering","hasRowSelection","isEmpty","isLoading","isNoResults","isRowReorderingDisabled","onReorderRows","pagination","rowReorderingUtilities","rowSelection","setRowSelection","setTableState","tableLayoutOptions","tableState","totalRows","isTableContainerScrolledToStart","setIsTableContainerScrolledToStart","useState","isTableContainerScrolledToEnd","setIsTableContainerScrolledToEnd","tableInnerContainerWidth","setTableInnerContainerWidth","shouldUpdateScroll","useRef","tableOuterContainerRef","tableInnerContainerRef","tableContentRef","useScrollIndication","tableInnerContainer","current","tableOuterContainer","odysseyDesignTokens","useOdysseyDesignTokens","t","useTranslation","columnIds","useMemo","map","column","accessorKey","columnOrder","filter","id","rowDensityClassName","rowDensity","defaultCell","useCallback","cell","value","getValue","hasTextWrapping","columnDef","enableWrapping","jsx","children","draggableTableBodyRowClassName","dragHandleStyles","dragHandleText","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","renderRowActions","row","currentIndex","index","pageIndex","pageSize","jsxs","rowActionButtons","rowActionMenuItems","MenuButton","ariaLabel","buttonVariant","endIcon","MoreIcon","menuAlignment","size","RowActions","rowIndex","undefined","innerWidthStyle","width","emptyStateContainer","Box","sx","useEffect","scrollTo","clientHeight","shouldDisplayRowActions","hasColumnWithGrow","some","grow","dataTable","useMaterialReactTable","state","sorting","columnSorting","columnVisibility","icons","ArrowDownwardIcon","ArrowDownIcon","DragHandleIcon","DragIndicatorIcon","SyncAltIcon","ArrowUnsortedIcon","ExpandMoreIcon","ChevronDownIcon","dataTableImmutableSettings","displayColumnDefOptions","header","muiTableBodyCellProps","align","className","muiTableHeadCellProps","visibility","Button","variant","isDisabled","muiTableProps","ref","hasColumnResizing","muiTableContainerProps","muiTableBodyProps","tabIndex","height","enableColumnResizing","defaultColumn","Cell","enableRowActions","enableRowOrdering","Boolean","enableRowDragging","muiDetailPanelProps","paddingBlock","getIsExpanded","Spacing3","muiTableBodyRowProps","table","isDetailPanel","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","border","backgroundColor","HueNeutralWhite","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","disabled","renderDetailPanel","enableRowVirtualization","currentColumn","find","sortedColumn","getIsResizing","enableSorting","hasSorting","onSortingChange","sortingUpdater","newSortVal","prevState","enableRowSelection","onRowSelectionChange","renderEmptyRowsFallback","localization","collapse","collapseAll","expand","expandAll","ScrollableTableContainer","isScrollableEnd","isScrollableStart","MRT_TableContainer","MemoizedTableLayoutContent","exports","memo","displayName"],"sources":["../../../../src/labs/DataView/TableLayoutContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n SetStateAction,\n memo,\n useCallback,\n useMemo,\n useRef,\n useState,\n ReactNode,\n Dispatch,\n ReactElement,\n useEffect,\n} from \"react\";\nimport styled, { CSSObject } from \"@emotion/styled\";\nimport {\n MRT_Row,\n MRT_RowData,\n MRT_RowSelectionState,\n MRT_TableContainer,\n MRT_TableInstance,\n MRT_TableOptions,\n useMaterialReactTable,\n} from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n ChevronDownIcon,\n DragIndicatorIcon,\n MoreIcon,\n} from \"../../icons.generated/index.js\";\nimport { Box } from \"../../Box.js\";\nimport { Button, MenuButton } from \"../../Buttons/index.js\";\nimport {\n TableLayoutProps,\n TableState,\n UniversalProps,\n} from \"./componentTypes.js\";\nimport { DataTableCell } from \"./dataTypes.js\";\nimport {\n dataTableImmutableSettings,\n displayColumnDefOptions,\n ScrollableTableContainer,\n} from \"./tableConstants.js\";\nimport { RowActions } from \"./RowActions.js\";\nimport { useOdysseyDesignTokens } from \"../../OdysseyDesignTokensContext.js\";\nimport { useScrollIndication } from \"../../DataTable/useScrollIndication.js\";\n\nconst TextWrapper = styled(\"div\")({\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n});\n\nconst RowActionsContainer = styled(\"div\")({\n display: \"flex\",\n});\n\nexport type TableLayoutContentProps<TData extends MRT_RowData> = {\n columns: TableLayoutProps<TData>[\"columns\"];\n data: MRT_RowData[];\n draggingRow?: MRT_Row<TData> | null;\n emptyState: ReactNode;\n enableVirtualization?: boolean;\n getRowId: UniversalProps<TData>[\"getRowId\"];\n hasRowReordering: UniversalProps<TData>[\"hasRowReordering\"];\n hasRowSelection: UniversalProps<TData>[\"hasRowSelection\"];\n isEmpty?: boolean;\n isLoading: boolean;\n isNoResults?: boolean;\n isRowReorderingDisabled?: boolean;\n onReorderRows: UniversalProps<TData>[\"onReorderRows\"];\n pagination: {\n pageIndex: number;\n pageSize: number;\n };\n rowReorderingUtilities: {\n dragHandleStyles: CSSObject;\n dragHandleText: {\n title: string;\n \"aria-label\": string;\n };\n draggableTableBodyRowClassName: ({\n currentRowId,\n draggingRowId,\n hoveredRowId,\n }: {\n currentRowId: string;\n draggingRowId?: string;\n hoveredRowId?: string;\n }) => string | undefined;\n handleDragHandleKeyDown: ({\n table,\n row,\n event,\n }: {\n table: MRT_TableInstance<TData>;\n row: MRT_Row<TData>;\n event: React.KeyboardEvent<HTMLButtonElement>;\n }) => void;\n handleDragHandleOnDragCapture: (table: MRT_TableInstance<TData>) => void;\n handleDragHandleOnDragEnd: (table: MRT_TableInstance<TData>) => void;\n resetDraggingAndHoveredRow: (table: MRT_TableInstance<TData>) => void;\n updateRowOrder: ({\n rowId,\n newRowIndex,\n }: {\n rowId: string;\n newRowIndex: number;\n }) => void;\n };\n rowSelection: MRT_RowSelectionState;\n setRowSelection: Dispatch<SetStateAction<MRT_RowSelectionState>>;\n setTableState: Dispatch<SetStateAction<TableState>>;\n tableLayoutOptions: TableLayoutProps<TData>;\n tableState: TableState;\n totalRows: UniversalProps<TData>[\"totalRows\"];\n};\n\ntype TableLayoutContentComponent = (<TData extends MRT_RowData>(\n props: TableLayoutContentProps<TData>,\n) => JSX.Element) & {\n displayName?: string;\n};\n\nconst TableLayoutContent = <TData extends MRT_RowData>({\n columns,\n data,\n draggingRow,\n emptyState,\n enableVirtualization,\n getRowId,\n hasRowReordering,\n hasRowSelection,\n isEmpty,\n isLoading,\n isNoResults,\n isRowReorderingDisabled,\n onReorderRows,\n pagination,\n rowReorderingUtilities,\n rowSelection,\n setRowSelection,\n setTableState,\n tableLayoutOptions,\n tableState,\n totalRows,\n}: TableLayoutContentProps<TData>) => {\n const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] =\n useState(true);\n const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] =\n useState(true);\n const [tableInnerContainerWidth, setTableInnerContainerWidth] =\n useState<string>(\"100%\");\n const shouldUpdateScroll = useRef<boolean>(false);\n const tableOuterContainerRef = useRef<HTMLDivElement>(null);\n const tableInnerContainerRef = useRef<HTMLDivElement>(null);\n const tableContentRef = useRef<HTMLTableElement>(null);\n\n useScrollIndication({\n setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,\n setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,\n setTableInnerContainerWidth: setTableInnerContainerWidth,\n tableInnerContainer: tableInnerContainerRef.current,\n tableOuterContainer: tableOuterContainerRef.current,\n });\n\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const columnIds = useMemo(() => {\n return columns.map((column) => column.accessorKey) ?? [];\n }, [columns]);\n\n const columnOrder = useMemo(\n () => [\n \"mrt-row-drag\",\n \"mrt-row-select\",\n \"mrt-row-expand\",\n ...(columnIds?.filter((id): id is string => typeof id === \"string\") ||\n []),\n \"mrt-row-actions\",\n ],\n [columnIds],\n );\n\n const rowDensityClassName = useMemo(() => {\n return tableState.rowDensity === \"spacious\"\n ? \"MuiTableBody-spacious\"\n : tableState.rowDensity === \"compact\"\n ? \"MuiTableBody-compact\"\n : \"MuiTableBody-default\";\n }, [tableState]);\n\n const defaultCell = useCallback<\n ({ cell }: { cell: DataTableCell<TData, unknown> }) => ReactElement | string\n >(({ cell }) => {\n const value = cell.getValue<string>();\n const hasTextWrapping =\n cell.column.columnDef.hasTextWrapping ||\n cell.column.columnDef.enableWrapping;\n return hasTextWrapping ? value : <TextWrapper>{value}</TextWrapper>;\n }, []);\n\n const {\n draggableTableBodyRowClassName,\n dragHandleStyles,\n dragHandleText,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = rowReorderingUtilities;\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<TData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <RowActionsContainer>\n {tableLayoutOptions.rowActionButtons?.(row)}\n {(tableLayoutOptions.rowActionMenuItems || hasRowReordering) && (\n <MenuButton\n ariaLabel={t(\"table.moreactions.arialabel\")}\n buttonVariant=\"floating\"\n endIcon={<MoreIcon />}\n menuAlignment=\"right\"\n size=\"small\"\n >\n <RowActions\n isRowReorderingDisabled={isRowReorderingDisabled}\n row={\n row as unknown as MRT_Row<MRT_RowData> // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n }\n rowActionMenuItems={\n // TODO: FIX THIS! The types are wrong. `row` is incorrectly set in `RowActions` to not be TData.\n tableLayoutOptions.rowActionMenuItems as unknown as (\n row: MRT_Row<MRT_RowData>,\n ) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n rowIndex={currentIndex}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n </MenuButton>\n )}\n </RowActionsContainer>\n );\n },\n [\n hasRowReordering,\n isRowReorderingDisabled,\n onReorderRows,\n pagination.pageIndex,\n pagination.pageSize,\n t,\n tableLayoutOptions,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const innerWidthStyle = useMemo(\n () => ({ width: tableInnerContainerWidth }),\n [tableInnerContainerWidth],\n );\n\n const emptyStateContainer = useCallback(\n () => <Box sx={innerWidthStyle}>{emptyState}</Box>,\n [innerWidthStyle, emptyState],\n );\n\n // Scroll to the bottom as soon as data loads after clicking the\n // loadMore pagination button\n useEffect(() => {\n if (enableVirtualization) {\n shouldUpdateScroll.current = true;\n }\n }, [enableVirtualization, pagination]);\n\n useEffect(() => {\n if (\n shouldUpdateScroll.current &&\n tableContentRef.current &&\n typeof tableInnerContainerRef.current?.scrollTo !== \"undefined\"\n ) {\n tableInnerContainerRef.current?.scrollTo(\n 0,\n tableContentRef.current.clientHeight,\n );\n shouldUpdateScroll.current = false;\n }\n }, [data]);\n\n const shouldDisplayRowActions = useMemo(\n () =>\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n [\n hasRowReordering,\n onReorderRows,\n tableLayoutOptions.rowActionButtons,\n tableLayoutOptions.rowActionMenuItems,\n ],\n );\n\n const hasColumnWithGrow = columns.some((column) => column.grow === true);\n\n const dataTable = useMaterialReactTable<TData>({\n data: (!isEmpty && !isNoResults ? data : []) as TData[],\n columns,\n getRowId,\n state: {\n sorting: tableState.columnSorting,\n columnVisibility: tableState.columnVisibility,\n isLoading,\n rowSelection,\n columnOrder,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n ExpandMoreIcon: ChevronDownIcon,\n },\n ...dataTableImmutableSettings,\n displayColumnDefOptions: {\n ...(displayColumnDefOptions satisfies Partial<\n MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"]\n >),\n \"mrt-row-actions\": {\n header: \"\",\n grow: !hasColumnWithGrow,\n muiTableBodyCellProps: {\n align: \"right\" as const,\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\" as const,\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n children: (\n <Box sx={{ display: \"flex\", visibility: \"hidden\" }}>\n {tableLayoutOptions.rowActionButtons &&\n // @ts-expect-error TODO: This type is wrong and needs to be fixed\n tableLayoutOptions.rowActionButtons({ id: null })}\n {((hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionMenuItems) && (\n <Box>\n <Button\n endIcon={<MoreIcon />}\n size=\"small\"\n variant=\"floating\"\n ariaLabel={t(\"table.moreactions.arialabel\")}\n isDisabled\n />\n </Box>\n )}\n </Box>\n ),\n },\n },\n },\n muiTableProps: {\n ref: tableContentRef,\n className:\n !shouldDisplayRowActions && tableLayoutOptions.hasColumnResizing\n ? hasColumnWithGrow\n ? \"ods-hide-spacer-column\"\n : \"ods-hide-spacer-column ods-column-grow\"\n : \"\",\n },\n muiTableContainerProps: {\n ref: tableInnerContainerRef,\n },\n muiTableBodyProps: () => ({\n className: rowDensityClassName,\n tabIndex: 0,\n /**\n * This is a fix for an issue related to the empty state creating a\n * vertical scrollbar when virtualization is enabled. The root cause\n * is tablebody having height: 0 when virtualization is enabled and there\n * being no data\n * https://okta.slack.com/archives/C7T2H3KNJ/p1742842106148929\n */\n sx:\n isEmpty || isNoResults\n ? {\n height: \"unset\",\n }\n : undefined,\n }),\n enableColumnResizing: tableLayoutOptions.hasColumnResizing,\n defaultColumn: {\n Cell: defaultCell,\n },\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n tableLayoutOptions.rowActionButtons ||\n tableLayoutOptions.rowActionMenuItems\n ? true\n : false,\n renderRowActions: ({ row }) => renderRowActions({ row }),\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiDetailPanelProps: ({ row }) => ({\n sx: {\n paddingBlock: row.getIsExpanded()\n ? `${odysseyDesignTokens.Spacing3} !important`\n : undefined,\n },\n }),\n muiTableBodyRowProps: ({ table, row, isDetailPanel }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n sx: isDetailPanel\n ? {\n paddingBlock: \"0 !important\",\n border: 0,\n [\"&:hover\"]: {\n backgroundColor: `${odysseyDesignTokens.HueNeutralWhite} !important`,\n },\n }\n : {},\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n disabled: isRowReorderingDisabled,\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n renderDetailPanel: tableLayoutOptions.renderDetailPanel,\n enableRowVirtualization: enableVirtualization,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: tableState.columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n muiTableBodyCellProps: ({ column }) => ({\n className: column.getIsResizing() ? \"isResizing\" : \"\",\n }),\n enableSorting: tableLayoutOptions.hasSorting === true, // I don't know why this needs to be true, but it still works if undefined otherwise\n onSortingChange: (sortingUpdater) => {\n const newSortVal =\n typeof sortingUpdater === \"function\"\n ? sortingUpdater(tableState.columnSorting)\n : tableState.columnSorting;\n setTableState((prevState) => ({\n ...prevState,\n columnSorting: newSortVal,\n }));\n },\n enableRowSelection: hasRowSelection,\n onRowSelectionChange: setRowSelection,\n renderEmptyRowsFallback: emptyStateContainer,\n localization: {\n collapse: t(\"table.rowexpansion.collapse\"),\n collapseAll: t(\"table.rowexpansion.collapseall\"),\n expand: t(\"table.rowexpansion.expand\"),\n expandAll: t(\"table.rowexpansion.expandall\"),\n },\n });\n\n return (\n <ScrollableTableContainer\n isScrollableEnd={!isTableContainerScrolledToEnd}\n isScrollableStart={!isTableContainerScrolledToStart}\n odysseyDesignTokens={odysseyDesignTokens}\n ref={tableOuterContainerRef}\n >\n <MRT_TableContainer table={dataTable} />\n </ScrollableTableContainer>\n );\n};\n\nconst MemoizedTableLayoutContent = memo(\n TableLayoutContent,\n) as TableLayoutContentComponent;\nMemoizedTableLayoutContent.displayName = \"TableLayoutContent\";\n\nexport { MemoizedTableLayoutContent as TableLayoutContent };\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,G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
27
27
|
const ComposablePicker = ({
|
|
28
28
|
ariaDescribedBy,
|
|
29
29
|
defaultValue,
|
|
30
|
+
emptyOptionsText,
|
|
30
31
|
errorMessage,
|
|
31
32
|
errorMessageList,
|
|
32
33
|
getIsOptionEqualToValue,
|
|
@@ -102,6 +103,7 @@ const ComposablePicker = ({
|
|
|
102
103
|
isOptionEqualToValue: getIsOptionEqualToValue,
|
|
103
104
|
loading: isLoading,
|
|
104
105
|
multiple: hasMultipleChoices,
|
|
106
|
+
noOptionsText: emptyOptionsText,
|
|
105
107
|
onBlur: onBlur,
|
|
106
108
|
onChange: onChange,
|
|
107
109
|
onInputChange: onInputChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposablePicker.cjs","names":["_react","require","_reactI18next","_PickerVirtualizationListBox","_useAutocomplete","_jsxRuntime","_interopRequireDefault","e","__esModule","default","adornmentSizeValues","exports","ComposablePicker","ariaDescribedBy","defaultValue","errorMessage","errorMessageList","getIsOptionEqualToValue","getOptionLabel","groupOptionsBy","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onInputChange","onFocus","options","renderOption","renderTags","value","testId","translate","t","useTranslation","inputValueProp","isVirtualizedRef","renderInput","valueProps","useAutocomplete","jsx","_Autocomplete2","current","ListboxComponent","PickerVirtualizationListBox","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","groupBy","isOptionEqualToValue","loading","multiple","readOnly","MemoizedComposablePicker","memo","displayName"],"sources":["../../../../src/labs/OdysseyPickers/ComposablePicker.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n} from \"@mui/material\";\n\nimport { AutocompleteProps } from \"../../Autocomplete.js\";\nimport { PickerVirtualizationListBox } from \"./PickerVirtualizationListBox.js\";\nimport { useAutocomplete } from \"../../useAutocomplete.js\";\n\nexport const adornmentSizeValues = [\"small\", \"large\"] as const;\nexport type AdornmentSize = (typeof adornmentSizeValues)[number];\n\nexport type BasePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n groupOptionsBy?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"groupBy\"];\n};\n\nexport type BasePickerType = {\n displayName: string;\n <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: BasePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactNode;\n};\n\nexport type ComposablePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n getOptionLabel?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n\n renderOption: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderOption\"];\n\n renderTags?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderTags\"];\n};\n\nconst ComposablePicker = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n getOptionLabel,\n groupOptionsBy,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n renderOption,\n renderTags,\n value,\n testId,\n translate,\n}: ComposablePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const { t } = useTranslation();\n const { inputValueProp, isVirtualizedRef, renderInput, valueProps } =\n useAutocomplete<OptionType, HasMultipleChoices, IsCustomValueAllowed>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized,\n label,\n name: nameOverride,\n testId,\n value,\n });\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualizedRef.current && {\n ListboxComponent: PickerVirtualizationListBox,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n fullWidth={isFullWidth}\n getOptionLabel={getOptionLabel}\n groupBy={groupOptionsBy}\n id={idOverride}\n isOptionEqualToValue={getIsOptionEqualToValue}\n loading={isLoading}\n multiple={hasMultipleChoices}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={renderTags}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof ComposablePicker` because generics don't get passed through\nconst MemoizedComposablePicker = memo(\n ComposablePicker,\n) as typeof ComposablePicker;\n// @ts-expect-error displayName is expected to not be on `typeof ComposablePicker`\nMemoizedComposablePicker.displayName = \"ComposablePicker\";\n\nexport { MemoizedComposablePicker as ComposablePicker };\n"],"mappings":";;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAOA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAA2D,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AArB3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU;
|
|
1
|
+
{"version":3,"file":"ComposablePicker.cjs","names":["_react","require","_reactI18next","_PickerVirtualizationListBox","_useAutocomplete","_jsxRuntime","_interopRequireDefault","e","__esModule","default","adornmentSizeValues","exports","ComposablePicker","ariaDescribedBy","defaultValue","emptyOptionsText","errorMessage","errorMessageList","getIsOptionEqualToValue","getOptionLabel","groupOptionsBy","hasMultipleChoices","id","idOverride","inputValue","isCustomValueAllowed","isDisabled","isFullWidth","isLoading","isOptional","isReadOnly","isVirtualized","hint","HintLinkComponent","label","name","nameOverride","onBlur","onChange","onInputChange","onFocus","options","renderOption","renderTags","value","testId","translate","t","useTranslation","inputValueProp","isVirtualizedRef","renderInput","valueProps","useAutocomplete","jsx","_Autocomplete2","current","ListboxComponent","PickerVirtualizationListBox","clearText","closeText","disableCloseOnSelect","disabled","freeSolo","filterSelectedOptions","fullWidth","groupBy","isOptionEqualToValue","loading","multiple","noOptionsText","readOnly","MemoizedComposablePicker","memo","displayName"],"sources":["../../../../src/labs/OdysseyPickers/ComposablePicker.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport {\n Autocomplete as MuiAutocomplete,\n AutocompleteProps as MuiAutocompleteProps,\n} from \"@mui/material\";\n\nimport { AutocompleteProps } from \"../../Autocomplete.js\";\nimport { PickerVirtualizationListBox } from \"./PickerVirtualizationListBox.js\";\nimport { useAutocomplete } from \"../../useAutocomplete.js\";\n\nexport const adornmentSizeValues = [\"small\", \"large\"] as const;\nexport type AdornmentSize = (typeof adornmentSizeValues)[number];\n\nexport type BasePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = AutocompleteProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n adornmentSize?: AdornmentSize;\n emptyOptionsText?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"noOptionsText\"];\n groupOptionsBy?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"groupBy\"];\n};\n\nexport type BasePickerType = {\n displayName: string;\n <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n >(\n props: BasePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n >,\n ): ReactNode;\n};\n\nexport type ComposablePickerProps<\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n> = BasePickerProps<OptionType, HasMultipleChoices, IsCustomValueAllowed> & {\n getOptionLabel?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"getOptionLabel\"];\n\n renderOption: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderOption\"];\n\n renderTags?: MuiAutocompleteProps<\n OptionType,\n HasMultipleChoices,\n undefined,\n IsCustomValueAllowed\n >[\"renderTags\"];\n};\n\nconst ComposablePicker = <\n OptionType,\n HasMultipleChoices extends boolean | undefined,\n IsCustomValueAllowed extends boolean | undefined,\n>({\n ariaDescribedBy,\n defaultValue,\n emptyOptionsText,\n errorMessage,\n errorMessageList,\n getIsOptionEqualToValue,\n getOptionLabel,\n groupOptionsBy,\n hasMultipleChoices,\n id: idOverride,\n inputValue,\n isCustomValueAllowed,\n isDisabled,\n isFullWidth = false,\n isLoading,\n isOptional = false,\n isReadOnly,\n isVirtualized = false,\n hint,\n HintLinkComponent,\n label,\n name: nameOverride,\n onBlur,\n onChange,\n onInputChange,\n onFocus,\n options,\n renderOption,\n renderTags,\n value,\n testId,\n translate,\n}: ComposablePickerProps<\n OptionType,\n HasMultipleChoices,\n IsCustomValueAllowed\n>) => {\n const { t } = useTranslation();\n const { inputValueProp, isVirtualizedRef, renderInput, valueProps } =\n useAutocomplete<OptionType, HasMultipleChoices, IsCustomValueAllowed>({\n ariaDescribedBy,\n defaultValue,\n errorMessage,\n errorMessageList,\n hasMultipleChoices,\n hint,\n HintLinkComponent,\n inputValue,\n isFullWidth,\n isOptional,\n isVirtualized,\n label,\n name: nameOverride,\n testId,\n value,\n });\n\n return (\n <MuiAutocomplete\n {...valueProps}\n {...inputValueProp}\n // conditionally provide the ListboxComponent if this needs to be virtualized\n {...(isVirtualizedRef.current && {\n ListboxComponent: PickerVirtualizationListBox,\n })}\n // AutoComplete is wrapped in a div within MUI which does not get the disabled attr. So this aria-disabled gets set in the div\n aria-disabled={isDisabled}\n clearText={t(\"clear.text\")}\n closeText={t(\"close.text\")}\n disableCloseOnSelect={hasMultipleChoices}\n disabled={isDisabled}\n freeSolo={isCustomValueAllowed}\n filterSelectedOptions={true}\n fullWidth={isFullWidth}\n getOptionLabel={getOptionLabel}\n groupBy={groupOptionsBy}\n id={idOverride}\n isOptionEqualToValue={getIsOptionEqualToValue}\n loading={isLoading}\n multiple={hasMultipleChoices}\n noOptionsText={emptyOptionsText}\n onBlur={onBlur}\n onChange={onChange}\n onInputChange={onInputChange}\n onFocus={onFocus}\n options={options}\n readOnly={isReadOnly}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={renderTags}\n translate={translate}\n />\n );\n};\n\n// Need the `typeof ComposablePicker` because generics don't get passed through\nconst MemoizedComposablePicker = memo(\n ComposablePicker,\n) as typeof ComposablePicker;\n// @ts-expect-error displayName is expected to not be on `typeof ComposablePicker`\nMemoizedComposablePicker.displayName = \"ComposablePicker\";\n\nexport { MemoizedComposablePicker as ComposablePicker };\n"],"mappings":";;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAOA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAA2D,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AArB3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaO,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU;AAiE9D,MAAME,gBAAgB,GAAGA,C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AW;IACrBqC,QAAQ,EAAEtC,oBAAqB;IAC/BuC,qBAAqB,EAAE,IAAK;IAC5BC,SAAS,EAAEtC,WAAY;IACvBR,cAAc,EAAEA,cAAe;IAC/B+C,OAAO,EAAE9C,cAAe;IACxBE,EAAE,EAAEC,UAAW;IACf4C,oBAAoB,EAAEjD,uBAAwB;IAC9CkD,OAAO,EAAExC,SAAU;IACnByC,QAAQ,EAAEhD,kBAAmB;IAC7BiD,aAAa,EAAEvD,gBAAiB;IAChCsB,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnBC,aAAa,EAAEA,aAAc;IAC7BC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjB8B,QAAQ,EAAEzC,UAAW;IACrBqB,WAAW,EAAEA,WAAY;IACzBT,YAAY,EAAEA,YAAa;IAC3BC,UAAU,EAAEA,UAAW;IACvBG,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN,CAAC;AAGD,MAAM0B,wBAAwB,GAAA7D,OAAA,CAAAC,gBAAA,GAAG,IAAA6D,WAAI,EACnC7D,gBACF,CAA4B;AAE5B4D,wBAAwB,CAACE,WAAW,GAAG,kBAAkB","ignoreList":[]}
|
|
@@ -70,13 +70,12 @@ const OptionDetail = exports.OptionDetail = (0, _styled.default)("div", {
|
|
|
70
70
|
const Option = ({
|
|
71
71
|
children,
|
|
72
72
|
hasAdornment = false,
|
|
73
|
-
key,
|
|
74
73
|
muiProps
|
|
75
|
-
}) => (0,
|
|
74
|
+
}) => (0, _jsxRuntime.jsx)(StyledOption, {
|
|
76
75
|
...muiProps,
|
|
77
76
|
hasAdornment: hasAdornment,
|
|
78
|
-
|
|
79
|
-
}
|
|
77
|
+
children: children
|
|
78
|
+
});
|
|
80
79
|
exports.Option = Option;
|
|
81
80
|
const OptionMetadataComponent = ({
|
|
82
81
|
metaData,
|
|
@@ -92,7 +91,7 @@ const OptionMetadataComponent = ({
|
|
|
92
91
|
return (0, _jsxRuntime.jsxs)(OptionDetail, {
|
|
93
92
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
94
93
|
children: [icon, detailText]
|
|
95
|
-
}, `${
|
|
94
|
+
}, `${detailText}-${index}`);
|
|
96
95
|
})
|
|
97
96
|
});
|
|
98
97
|
};
|
|
@@ -113,8 +112,7 @@ const OptionLabelOnlyComponent = ({
|
|
|
113
112
|
option
|
|
114
113
|
}) => {
|
|
115
114
|
const {
|
|
116
|
-
label
|
|
117
|
-
value
|
|
115
|
+
label
|
|
118
116
|
} = option;
|
|
119
117
|
return (0, _jsxRuntime.jsx)(Option, {
|
|
120
118
|
muiProps: muiProps,
|
|
@@ -124,7 +122,7 @@ const OptionLabelOnlyComponent = ({
|
|
|
124
122
|
children: label
|
|
125
123
|
})
|
|
126
124
|
})
|
|
127
|
-
}
|
|
125
|
+
});
|
|
128
126
|
};
|
|
129
127
|
exports.OptionLabelOnlyComponent = OptionLabelOnlyComponent;
|
|
130
128
|
const OptionLabelDescription = ({
|
|
@@ -134,8 +132,7 @@ const OptionLabelDescription = ({
|
|
|
134
132
|
}) => {
|
|
135
133
|
const {
|
|
136
134
|
description,
|
|
137
|
-
label
|
|
138
|
-
value
|
|
135
|
+
label
|
|
139
136
|
} = option;
|
|
140
137
|
return (0, _jsxRuntime.jsx)(Option, {
|
|
141
138
|
muiProps: muiProps,
|
|
@@ -149,7 +146,7 @@ const OptionLabelDescription = ({
|
|
|
149
146
|
odysseyDesignTokens: odysseyDesignTokens
|
|
150
147
|
})]
|
|
151
148
|
})
|
|
152
|
-
}
|
|
149
|
+
});
|
|
153
150
|
};
|
|
154
151
|
const OptionLabelDescriptionMetadata = ({
|
|
155
152
|
muiProps,
|
|
@@ -159,8 +156,7 @@ const OptionLabelDescriptionMetadata = ({
|
|
|
159
156
|
const {
|
|
160
157
|
description,
|
|
161
158
|
label,
|
|
162
|
-
metaData
|
|
163
|
-
value
|
|
159
|
+
metaData
|
|
164
160
|
} = option;
|
|
165
161
|
return (0, _jsxRuntime.jsxs)(Option, {
|
|
166
162
|
muiProps: muiProps,
|
|
@@ -177,11 +173,12 @@ const OptionLabelDescriptionMetadata = ({
|
|
|
177
173
|
metaData: metaData,
|
|
178
174
|
odysseyDesignTokens: odysseyDesignTokens
|
|
179
175
|
})]
|
|
180
|
-
}
|
|
176
|
+
});
|
|
181
177
|
};
|
|
182
178
|
const Picker = ({
|
|
183
179
|
ariaDescribedBy,
|
|
184
180
|
defaultValue,
|
|
181
|
+
emptyOptionsText,
|
|
185
182
|
errorMessage,
|
|
186
183
|
errorMessageList,
|
|
187
184
|
getIsOptionEqualToValue,
|
|
@@ -213,29 +210,26 @@ const Picker = ({
|
|
|
213
210
|
const hasDescription = "description" in option && option.description;
|
|
214
211
|
const hasMetadata = "metaData" in option && option.metaData;
|
|
215
212
|
const isLabelOnly = !hasMetadata && !hasDescription;
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
return (0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
214
|
+
children: isLabelOnly ? (0, _jsxRuntime.jsx)(OptionLabelOnlyComponent, {
|
|
218
215
|
muiProps: muiProps,
|
|
219
216
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
220
217
|
option: option
|
|
221
|
-
})
|
|
222
|
-
}
|
|
223
|
-
if (hasMetadata) {
|
|
224
|
-
return (0, _jsxRuntime.jsx)(OptionLabelDescriptionMetadata, {
|
|
218
|
+
}) : hasMetadata ? (0, _jsxRuntime.jsx)(OptionLabelDescriptionMetadata, {
|
|
225
219
|
muiProps: muiProps,
|
|
226
220
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
227
221
|
option: option
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
});
|
|
222
|
+
}) : (0, _jsxRuntime.jsx)(OptionLabelDescription, {
|
|
223
|
+
muiProps: muiProps,
|
|
224
|
+
odysseyDesignTokens: odysseyDesignTokens,
|
|
225
|
+
option: option
|
|
226
|
+
})
|
|
227
|
+
}, option.label);
|
|
235
228
|
}, [odysseyDesignTokens]);
|
|
236
229
|
return (0, _jsxRuntime.jsx)(_ComposablePicker.ComposablePicker, {
|
|
237
230
|
ariaDescribedBy: ariaDescribedBy,
|
|
238
231
|
defaultValue: defaultValue,
|
|
232
|
+
emptyOptionsText: emptyOptionsText,
|
|
239
233
|
errorMessage: errorMessage,
|
|
240
234
|
errorMessageList: errorMessageList,
|
|
241
235
|
getIsOptionEqualToValue: getIsOptionEqualToValue,
|