@flipdish/ui-library 0.70.0 → 0.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/__internal__/controlFill/controlFill.context.cjs +13 -0
- package/dist/components/__internal__/controlFill/controlFill.context.cjs.map +1 -0
- package/dist/components/__internal__/controlFill/controlFill.context.d.ts +7 -0
- package/dist/components/__internal__/controlFill/controlFill.context.d.ts.map +1 -0
- package/dist/components/__internal__/controlFill/controlFill.context.js +11 -0
- package/dist/components/__internal__/controlFill/controlFill.context.js.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs +13 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts +8 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.js +11 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.js.map +1 -0
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +9 -1
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +11 -3
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs +13 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts +8 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js +13 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.cjs +6 -5
- package/dist/components/molecules/Modals/Modal/Modal.cjs.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.js +6 -5
- package/dist/components/molecules/Modals/Modal/Modal.js.map +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.cjs +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts.map +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.js +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +4 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +5 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs +11 -6
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts +4 -2
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js +12 -7
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js.map +1 -1
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs +53 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs.map +1 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts +41 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts.map +1 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js +51 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js.map +1 -0
- package/dist/components/organisms/FilterBar/index.cjs +19 -7
- package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/index.d.ts +1 -0
- package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/index.js +18 -7
- package/dist/components/organisms/FilterBar/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs +3 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +3 -1
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +14 -285
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +29 -138
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +13 -284
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/Tables/Table/Table.cjs +305 -0
- package/dist/components/organisms/Tables/Table/Table.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.d.ts +146 -0
- package/dist/components/organisms/Tables/Table/Table.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.js +301 -0
- package/dist/components/organisms/Tables/Table/Table.js.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/Table.styles.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/Table.styles.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.cjs +2 -2
- package/dist/components/organisms/Tables/Table/components/TableCardList.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableCardList.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.js +2 -2
- package/dist/components/organisms/Tables/Table/components/TableCardList.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.cjs +8 -4
- package/dist/components/organisms/Tables/Table/components/TableCardRow.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableCardRow.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.js +9 -5
- package/dist/components/organisms/Tables/Table/components/TableCardRow.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs +17 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts +5 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.js +15 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.cjs +3 -3
- package/dist/components/organisms/Tables/Table/components/TableRowCard.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableRowCard.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.js +3 -3
- package/dist/components/organisms/Tables/Table/components/TableRowCard.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs +83 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts +23 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js +81 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.js.map +1 -0
- package/dist/components/organisms/Tables/Table/providers/Table.context.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.d.ts +4 -1
- package/dist/components/organisms/Tables/Table/providers/Table.context.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/providers/Table.context.js.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs +55 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts +25 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js +51 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.cjs +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.js +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.js.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs +34 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts +37 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js +32 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs +32 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts +21 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js +30 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.cjs +9 -2
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.cjs.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.d.ts +18 -6
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.js +9 -2
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.js.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.cjs.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.d.ts.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.js.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs +84 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts +20 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js +81 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js.map +1 -0
- package/dist/components/organisms/Tables/index.cjs +14 -0
- package/dist/components/organisms/Tables/index.cjs.map +1 -0
- package/dist/components/organisms/Tables/index.d.ts +19 -0
- package/dist/components/organisms/Tables/index.d.ts.map +1 -0
- package/dist/components/organisms/Tables/index.js +4 -0
- package/dist/components/organisms/Tables/index.js.map +1 -0
- package/dist/components/organisms/{Table/table.types.d.ts → Tables/tables.types.d.ts} +4 -2
- package/dist/components/organisms/Tables/tables.types.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableCard.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/utilities/tableCard.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableCard.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.js.map +1 -0
- package/dist/hooks/useListQueryParams/index.cjs +238 -0
- package/dist/hooks/useListQueryParams/index.cjs.map +1 -0
- package/dist/hooks/useListQueryParams/index.d.ts +77 -0
- package/dist/hooks/useListQueryParams/index.d.ts.map +1 -0
- package/dist/hooks/useListQueryParams/index.js +236 -0
- package/dist/hooks/useListQueryParams/index.js.map +1 -0
- package/dist/hooks/useLoadState/index.cjs +69 -0
- package/dist/hooks/useLoadState/index.cjs.map +1 -0
- package/dist/hooks/useLoadState/index.d.ts +44 -0
- package/dist/hooks/useLoadState/index.d.ts.map +1 -0
- package/dist/hooks/useLoadState/index.js +67 -0
- package/dist/hooks/useLoadState/index.js.map +1 -0
- package/dist/hooks/usePagedList/index.cjs +61 -0
- package/dist/hooks/usePagedList/index.cjs.map +1 -0
- package/dist/hooks/usePagedList/index.d.ts +56 -0
- package/dist/hooks/usePagedList/index.d.ts.map +1 -0
- package/dist/hooks/usePagedList/index.js +59 -0
- package/dist/hooks/usePagedList/index.js.map +1 -0
- package/dist/native/components/organisms/Tables/index.d.ts +12 -0
- package/dist/native/hooks/useListQueryParams/index.d.ts +12 -0
- package/dist/native/hooks/useLoadState/index.d.ts +12 -0
- package/dist/native/hooks/usePagedList/index.d.ts +12 -0
- package/dist/native/utilities/listQueryUtils/index.d.ts +12 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs +47 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts +51 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.js +43 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.js.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs +67 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts +27 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js +64 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js.map +1 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs +28 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts +10 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js +28 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js.map +1 -1
- package/dist/utilities/listQueryUtils/index.cjs +59 -0
- package/dist/utilities/listQueryUtils/index.cjs.map +1 -0
- package/dist/utilities/listQueryUtils/index.d.ts +46 -0
- package/dist/utilities/listQueryUtils/index.d.ts.map +1 -0
- package/dist/utilities/listQueryUtils/index.js +55 -0
- package/dist/utilities/listQueryUtils/index.js.map +1 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs.map +1 -1
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts.map +1 -1
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.js +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/organisms/Table/Table.styles.cjs.map +0 -1
- package/dist/components/organisms/Table/Table.styles.d.ts.map +0 -1
- package/dist/components/organisms/Table/Table.styles.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.js.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.js.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.cjs +0 -27
- package/dist/components/organisms/Table/components/TableLayoutToggle.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts +0 -17
- package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.js +0 -25
- package/dist/components/organisms/Table/components/TableLayoutToggle.js.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.js.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.js.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.js.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.cjs.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.d.ts.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.js.map +0 -1
- package/dist/components/organisms/Table/table.types.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.js.map +0 -1
- /package/dist/components/organisms/{Table → Tables/Table}/Table.styles.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/Table.styles.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.js +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var localStorageUtils = require('@flipdish/ui-library/utilities/localStorageUtils');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var webStorage_utils = require('../../../../utilities/__internal__/webStorageUtils/webStorage.utils.cjs');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LAYOUT = 'table';
|
|
8
|
+
const isTableLayout = (value) => value === 'table' || value === 'cards';
|
|
9
|
+
// The bare layout name, as `sidePanelStorage` keeps its id; `validate` turns anything else into nothing stored.
|
|
10
|
+
const storageOf = (layoutKey) => localStorageUtils.createLocalStorageItem(`${localStorageUtils.LOCAL_STORAGE_KEYS.tableLayout}:${layoutKey}`, {
|
|
11
|
+
serialize: String,
|
|
12
|
+
deserialize: (raw) => raw,
|
|
13
|
+
validate: isTableLayout,
|
|
14
|
+
});
|
|
15
|
+
// A choice storage would not keep, held for the page's lifetime; with storage working, storage alone is the truth.
|
|
16
|
+
const unstoredChoices = new Map();
|
|
17
|
+
const listenersByKey = new Map();
|
|
18
|
+
// One `storage` listener per key in use, so a pick in another tab reaches every component with the key at once.
|
|
19
|
+
const otherTabWatchersByKey = new Map();
|
|
20
|
+
const notify = (layoutKey) => {
|
|
21
|
+
for (const onChange of listenersByKey.get(layoutKey) ?? [])
|
|
22
|
+
onChange();
|
|
23
|
+
};
|
|
24
|
+
const storedLayoutOf = (layoutKey) => unstoredChoices.get(layoutKey) ?? storageOf(layoutKey).get() ?? DEFAULT_LAYOUT;
|
|
25
|
+
const subscribeTo = (layoutKey, onChange) => {
|
|
26
|
+
const listeners = listenersByKey.get(layoutKey) ?? new Set();
|
|
27
|
+
listeners.add(onChange);
|
|
28
|
+
listenersByKey.set(layoutKey, listeners);
|
|
29
|
+
if (!otherTabWatchersByKey.has(layoutKey)) {
|
|
30
|
+
const stopWatching = webStorage_utils.subscribeToOtherDocumentWrites('localStorage', `${localStorageUtils.LOCAL_STORAGE_KEYS.tableLayout}:${layoutKey}`, () => {
|
|
31
|
+
// The other tab wrote storage, so it holds the choice now.
|
|
32
|
+
unstoredChoices.delete(layoutKey);
|
|
33
|
+
notify(layoutKey);
|
|
34
|
+
});
|
|
35
|
+
otherTabWatchersByKey.set(layoutKey, stopWatching);
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
listeners.delete(onChange);
|
|
39
|
+
if (listeners.size > 0)
|
|
40
|
+
return;
|
|
41
|
+
listenersByKey.delete(layoutKey);
|
|
42
|
+
otherTabWatchersByKey.get(layoutKey)?.();
|
|
43
|
+
otherTabWatchersByKey.delete(layoutKey);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const subscribeToNothing = () => () => { };
|
|
47
|
+
/**
|
|
48
|
+
* Stores the layout chosen for every `Table`, `TableSortMenu` and `TableLayoutToggle` given `layoutKey`, and tells each of
|
|
49
|
+
* them, so they all switch together. Never throws.
|
|
50
|
+
* @param layoutKey - The key the components share.
|
|
51
|
+
* @param layout - The layout the user picked.
|
|
52
|
+
* @returns Nothing; the choice is in `localStorage` under `fd-table-layout:<layoutKey>`, or held for the page's lifetime
|
|
53
|
+
* where storage cannot keep it.
|
|
54
|
+
*/
|
|
55
|
+
const storeTableLayout = (layoutKey, layout) => {
|
|
56
|
+
const storage = storageOf(layoutKey);
|
|
57
|
+
storage.set(layout);
|
|
58
|
+
if (storage.get() === layout)
|
|
59
|
+
unstoredChoices.delete(layoutKey);
|
|
60
|
+
else
|
|
61
|
+
unstoredChoices.set(layoutKey, layout);
|
|
62
|
+
notify(layoutKey);
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The layout a `Table`, `TableSortMenu` or `TableLayoutToggle` shows from `md` up: its own prop when the page passes one,
|
|
66
|
+
* else the one chosen for its `layoutKey`, kept in step across every component with that key, in every tab of the page's origin.
|
|
67
|
+
* @param layoutKey - The component's `layoutKey`; without one, nothing is read from storage.
|
|
68
|
+
* @param controlledLayout - The component's own layout prop, which wins over anything stored.
|
|
69
|
+
* @returns `controlledLayout` when given; else, for a key, `'table'` on the server and while hydrating, then the stored
|
|
70
|
+
* layout, or `'table'` when none is stored or it is not a layout; else `'table'`.
|
|
71
|
+
*/
|
|
72
|
+
const useStoredTableLayout = (layoutKey, controlledLayout) => {
|
|
73
|
+
// Only a key with nothing controlling it is read, so a controlled component never re-renders for another's choice.
|
|
74
|
+
const readKey = controlledLayout === undefined ? layoutKey : undefined;
|
|
75
|
+
const subscribe = React.useCallback((onChange) => (readKey === undefined ? subscribeToNothing() : subscribeTo(readKey, onChange)), [readKey]);
|
|
76
|
+
const storedLayout = React.useSyncExternalStore(subscribe, () => (readKey === undefined ? DEFAULT_LAYOUT : storedLayoutOf(readKey)),
|
|
77
|
+
// The server cannot read storage, so it and the hydrating render agree on the default.
|
|
78
|
+
() => DEFAULT_LAYOUT);
|
|
79
|
+
return controlledLayout ?? storedLayout;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.storeTableLayout = storeTableLayout;
|
|
83
|
+
exports.useStoredTableLayout = useStoredTableLayout;
|
|
84
|
+
//# sourceMappingURL=useStoredTableLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoredTableLayout.cjs","sources":["../../../../../src/components/organisms/Tables/hooks/useStoredTableLayout.ts"],"sourcesContent":[null],"names":["createLocalStorageItem","LOCAL_STORAGE_KEYS","subscribeToOtherDocumentWrites","useCallback","useSyncExternalStore"],"mappings":";;;;;;AAOA,MAAM,cAAc,GAAgB,OAAO;AAE3C,MAAM,aAAa,GAAG,CAAC,KAAc,KAA2B,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO;AAEtG;AACA,MAAM,SAAS,GAAG,CAAC,SAAiB,KAClCA,wCAAsB,CAAc,CAAA,EAAGC,oCAAkB,CAAC,WAAW,CAAA,CAAA,EAAI,SAAS,EAAE,EAAE;AACpF,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAkB;AACxC,IAAA,QAAQ,EAAE,aAAa;AACxB,CAAA,CAAC;AAEJ;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuB;AACtD,MAAM,cAAc,GAAG,IAAI,GAAG,EAA2B;AACzD;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAsB;AAE3D,MAAM,MAAM,GAAG,CAAC,SAAiB,KAAI;IACnC,KAAK,MAAM,QAAQ,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;AAAE,QAAA,QAAQ,EAAE;AACxE,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,SAAiB,KAAkB,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,IAAI,cAAc;AAEzI,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,QAAoB,KAAI;AAC9D,IAAA,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE;A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;;AAOG;MACU,oBAAoB,GAAG,CAAC,SAA6B,EAAE,gBAAyC,KAAiB;;AAE5H,IAAA,MAAM,OAAO,GAAG,gBAAgB,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS;AACtE,IAAA,MAAM,SAAS,GAAGE,iBAAW,CAAC,CAAC,QAAoB,MAAM,OAAO,KAAK,SAAS,GAAG,kBAAkB,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IACnJ,MAAM,YAAY,GAAGC,0BAAoB,CACvC,SAAS,EACT,OAAO,OAAO,KAAK,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;;AAExE,IAAA,MAAM,cAAc,CACrB;IACD,OAAO,gBAAgB,IAAI,YAAY;AACzC;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TableLayout } from '../tables.types';
|
|
2
|
+
/**
|
|
3
|
+
* Stores the layout chosen for every `Table`, `TableSortMenu` and `TableLayoutToggle` given `layoutKey`, and tells each of
|
|
4
|
+
* them, so they all switch together. Never throws.
|
|
5
|
+
* @param layoutKey - The key the components share.
|
|
6
|
+
* @param layout - The layout the user picked.
|
|
7
|
+
* @returns Nothing; the choice is in `localStorage` under `fd-table-layout:<layoutKey>`, or held for the page's lifetime
|
|
8
|
+
* where storage cannot keep it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const storeTableLayout: (layoutKey: string, layout: TableLayout) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The layout a `Table`, `TableSortMenu` or `TableLayoutToggle` shows from `md` up: its own prop when the page passes one,
|
|
13
|
+
* else the one chosen for its `layoutKey`, kept in step across every component with that key, in every tab of the page's origin.
|
|
14
|
+
* @param layoutKey - The component's `layoutKey`; without one, nothing is read from storage.
|
|
15
|
+
* @param controlledLayout - The component's own layout prop, which wins over anything stored.
|
|
16
|
+
* @returns `controlledLayout` when given; else, for a key, `'table'` on the server and while hydrating, then the stored
|
|
17
|
+
* layout, or `'table'` when none is stored or it is not a layout; else `'table'`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useStoredTableLayout: (layoutKey: string | undefined, controlledLayout: TableLayout | undefined) => TableLayout;
|
|
20
|
+
//# sourceMappingURL=useStoredTableLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoredTableLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/hooks/useStoredTableLayout.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiDnD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,EAAE,QAAQ,WAAW,KAAG,IAMzE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,GAAG,SAAS,EAAE,kBAAkB,WAAW,GAAG,SAAS,KAAG,WAW/G,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LOCAL_STORAGE_KEYS, createLocalStorageItem } from '@flipdish/ui-library/utilities/localStorageUtils';
|
|
2
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
3
|
+
import { subscribeToOtherDocumentWrites } from '../../../../utilities/__internal__/webStorageUtils/webStorage.utils.js';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_LAYOUT = 'table';
|
|
6
|
+
const isTableLayout = (value) => value === 'table' || value === 'cards';
|
|
7
|
+
// The bare layout name, as `sidePanelStorage` keeps its id; `validate` turns anything else into nothing stored.
|
|
8
|
+
const storageOf = (layoutKey) => createLocalStorageItem(`${LOCAL_STORAGE_KEYS.tableLayout}:${layoutKey}`, {
|
|
9
|
+
serialize: String,
|
|
10
|
+
deserialize: (raw) => raw,
|
|
11
|
+
validate: isTableLayout,
|
|
12
|
+
});
|
|
13
|
+
// A choice storage would not keep, held for the page's lifetime; with storage working, storage alone is the truth.
|
|
14
|
+
const unstoredChoices = new Map();
|
|
15
|
+
const listenersByKey = new Map();
|
|
16
|
+
// One `storage` listener per key in use, so a pick in another tab reaches every component with the key at once.
|
|
17
|
+
const otherTabWatchersByKey = new Map();
|
|
18
|
+
const notify = (layoutKey) => {
|
|
19
|
+
for (const onChange of listenersByKey.get(layoutKey) ?? [])
|
|
20
|
+
onChange();
|
|
21
|
+
};
|
|
22
|
+
const storedLayoutOf = (layoutKey) => unstoredChoices.get(layoutKey) ?? storageOf(layoutKey).get() ?? DEFAULT_LAYOUT;
|
|
23
|
+
const subscribeTo = (layoutKey, onChange) => {
|
|
24
|
+
const listeners = listenersByKey.get(layoutKey) ?? new Set();
|
|
25
|
+
listeners.add(onChange);
|
|
26
|
+
listenersByKey.set(layoutKey, listeners);
|
|
27
|
+
if (!otherTabWatchersByKey.has(layoutKey)) {
|
|
28
|
+
const stopWatching = subscribeToOtherDocumentWrites('localStorage', `${LOCAL_STORAGE_KEYS.tableLayout}:${layoutKey}`, () => {
|
|
29
|
+
// The other tab wrote storage, so it holds the choice now.
|
|
30
|
+
unstoredChoices.delete(layoutKey);
|
|
31
|
+
notify(layoutKey);
|
|
32
|
+
});
|
|
33
|
+
otherTabWatchersByKey.set(layoutKey, stopWatching);
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
listeners.delete(onChange);
|
|
37
|
+
if (listeners.size > 0)
|
|
38
|
+
return;
|
|
39
|
+
listenersByKey.delete(layoutKey);
|
|
40
|
+
otherTabWatchersByKey.get(layoutKey)?.();
|
|
41
|
+
otherTabWatchersByKey.delete(layoutKey);
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const subscribeToNothing = () => () => { };
|
|
45
|
+
/**
|
|
46
|
+
* Stores the layout chosen for every `Table`, `TableSortMenu` and `TableLayoutToggle` given `layoutKey`, and tells each of
|
|
47
|
+
* them, so they all switch together. Never throws.
|
|
48
|
+
* @param layoutKey - The key the components share.
|
|
49
|
+
* @param layout - The layout the user picked.
|
|
50
|
+
* @returns Nothing; the choice is in `localStorage` under `fd-table-layout:<layoutKey>`, or held for the page's lifetime
|
|
51
|
+
* where storage cannot keep it.
|
|
52
|
+
*/
|
|
53
|
+
const storeTableLayout = (layoutKey, layout) => {
|
|
54
|
+
const storage = storageOf(layoutKey);
|
|
55
|
+
storage.set(layout);
|
|
56
|
+
if (storage.get() === layout)
|
|
57
|
+
unstoredChoices.delete(layoutKey);
|
|
58
|
+
else
|
|
59
|
+
unstoredChoices.set(layoutKey, layout);
|
|
60
|
+
notify(layoutKey);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The layout a `Table`, `TableSortMenu` or `TableLayoutToggle` shows from `md` up: its own prop when the page passes one,
|
|
64
|
+
* else the one chosen for its `layoutKey`, kept in step across every component with that key, in every tab of the page's origin.
|
|
65
|
+
* @param layoutKey - The component's `layoutKey`; without one, nothing is read from storage.
|
|
66
|
+
* @param controlledLayout - The component's own layout prop, which wins over anything stored.
|
|
67
|
+
* @returns `controlledLayout` when given; else, for a key, `'table'` on the server and while hydrating, then the stored
|
|
68
|
+
* layout, or `'table'` when none is stored or it is not a layout; else `'table'`.
|
|
69
|
+
*/
|
|
70
|
+
const useStoredTableLayout = (layoutKey, controlledLayout) => {
|
|
71
|
+
// Only a key with nothing controlling it is read, so a controlled component never re-renders for another's choice.
|
|
72
|
+
const readKey = controlledLayout === undefined ? layoutKey : undefined;
|
|
73
|
+
const subscribe = useCallback((onChange) => (readKey === undefined ? subscribeToNothing() : subscribeTo(readKey, onChange)), [readKey]);
|
|
74
|
+
const storedLayout = useSyncExternalStore(subscribe, () => (readKey === undefined ? DEFAULT_LAYOUT : storedLayoutOf(readKey)),
|
|
75
|
+
// The server cannot read storage, so it and the hydrating render agree on the default.
|
|
76
|
+
() => DEFAULT_LAYOUT);
|
|
77
|
+
return controlledLayout ?? storedLayout;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { storeTableLayout, useStoredTableLayout };
|
|
81
|
+
//# sourceMappingURL=useStoredTableLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoredTableLayout.js","sources":["../../../../../src/components/organisms/Tables/hooks/useStoredTableLayout.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA,MAAM,cAAc,GAAgB,OAAO;AAE3C,MAAM,aAAa,GAAG,CAAC,KAAc,KAA2B,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO;AAEtG;AACA,MAAM,SAAS,GAAG,CAAC,SAAiB,KAClC,sBAAsB,CAAc,CAAA,EAAG,kBAAkB,CAAC,WAAW,CAAA,CAAA,EAAI,SAAS,EAAE,EAAE;AACpF,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,CAAC,GAAG,KAAK,GAAkB;AACxC,IAAA,QAAQ,EAAE,aAAa;AACxB,CAAA,CAAC;AAEJ;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuB;AACtD,MAAM,cAAc,GAAG,IAAI,GAAG,EAA2B;AACzD;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAsB;AAE3D,MAAM,MAAM,GAAG,CAAC,SAAiB,KAAI;IACnC,KAAK,MAAM,QAAQ,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;AAAE,QAAA,QAAQ,EAAE;AACxE,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,SAAiB,KAAkB,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,IAAI,cAAc;AAEzI,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,QAAoB,KAAI;AAC9D,IAAA,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE;AAC5D,IAAA,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;AACvB,IAAA,cAAc,CAAC,GAAG,CAAC,SAAS,EAA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AAgB,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS;AACtE,IAAA,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,QAAoB,MAAM,OAAO,KAAK,SAAS,GAAG,kBAAkB,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IACnJ,MAAM,YAAY,GAAG,oBAAoB,CACvC,SAAS,EACT,OAAO,OAAO,KAAK,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;;AAExE,IAAA,MAAM,cAAc,CACrB;IACD,OAAO,gBAAgB,IAAI,YAAY;AACzC;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Table = require('./Table/Table.cjs');
|
|
4
|
+
var TableLayoutToggle = require('./TableLayoutToggle/TableLayoutToggle.cjs');
|
|
5
|
+
var TableSortMenu = require('./TableSortMenu/TableSortMenu.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.Table = Table.Table;
|
|
10
|
+
exports.TableCard = Table.TableCard;
|
|
11
|
+
exports.TableRowActionsDropdown = Table.TableRowActionsDropdown;
|
|
12
|
+
exports.TableLayoutToggle = TableLayoutToggle.TableLayoutToggle;
|
|
13
|
+
exports.TableSortMenu = TableSortMenu.TableSortMenu;
|
|
14
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records in rows and columns, or as one card per row: `Table` with `TableCard` around it and
|
|
3
|
+
* `TableRowActionsDropdown` in its last column, `TableSortMenu` to sort its cards and `TableLayoutToggle` to switch between
|
|
4
|
+
* the two.
|
|
5
|
+
*
|
|
6
|
+
* Explicit named re-exports on purpose: `export *` would publish every symbol of every member and private file (import
|
|
7
|
+
* paths are the public API here), so this list is the single source of truth for what Tables exposes. Each member's
|
|
8
|
+
* implementation, stories and docs live in its own folder (`TableSortMenu/TableSortMenu.tsx`), never as `index.tsx`: the
|
|
9
|
+
* `exports` wildcard would make that folder a public path. `TableCard` and `TableRowActionsDropdown` share `Table`'s folder,
|
|
10
|
+
* as they share its docs page.
|
|
11
|
+
*/
|
|
12
|
+
export type { TableRowCardContentProps, TableRowCardFooterProps, TableRowCardHeaderProps, TableRowCardSkeletonProps, } from './Table/Table';
|
|
13
|
+
export { Table, TableCard, TableRowActionsDropdown } from './Table/Table';
|
|
14
|
+
export type { TableLayoutToggleProps } from './TableLayoutToggle/TableLayoutToggle';
|
|
15
|
+
export { TableLayoutToggle } from './TableLayoutToggle/TableLayoutToggle';
|
|
16
|
+
export type { TableSortMenuProps } from './TableSortMenu/TableSortMenu';
|
|
17
|
+
export { TableSortMenu } from './TableSortMenu/TableSortMenu';
|
|
18
|
+
export type { TableLayout, TableRowColor } from './tables.types';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Tables/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -32,7 +32,9 @@ export interface TableRowProps<T extends object> extends AriaRowProps<T>, Omit<C
|
|
|
32
32
|
/**
|
|
33
33
|
* Tints the row and its card with a status colour; the highlight still wins. Never the only signal: pair it with a badge
|
|
34
34
|
* or text that says the same, for anyone who cannot tell the colours apart. A placeholder row, one carrying
|
|
35
|
-
* `Table.RowCard.Skeleton` or drawn by `isLoading`, ignores it.
|
|
35
|
+
* `Table.RowCard.Skeleton` or drawn by `isLoading`, ignores it. `warning` for a row that needs attention soon, such as an
|
|
36
|
+
* order running late; `error` for one that failed, such as a payment; `success` for one just done, such as an order ready;
|
|
37
|
+
* `orange` for one awaiting action, such as a request to approve.
|
|
36
38
|
*/
|
|
37
39
|
color?: TableRowColor;
|
|
38
40
|
/** Row height and cell padding; inherits from the table unless set. */
|
|
@@ -40,4 +42,4 @@ export interface TableRowProps<T extends object> extends AriaRowProps<T>, Omit<C
|
|
|
40
42
|
/** Overrides the derived `data-testid` for the row (defaults to `<root>--row-<id>`). */
|
|
41
43
|
'data-testid'?: string;
|
|
42
44
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=tables.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.types.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Tables/tables.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,IAAI,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3H,0FAA0F;AAC1F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpC,sEAAsE;AACtE,MAAM,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A,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC;AAC1B,QAAA,IAAI,WAAW,KAAK,WAAW,EAAE;AAC/B,YAAA,KAAK,CAAC,KAAK,GAAG,IAAI;YAClB;QACF;AACA,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;AACnC,QAAA,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK;AAAE,YAAA,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;YACjD,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC1E,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,KAAK;AACd;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import type { GridListItemProps, GridListLoadMoreItemProps, Key, TableLoadMoreItemProps } from 'react-aria-components';
|
|
3
|
-
import type { TableCardColumn, TableCardListProps, TableLayout } from '../
|
|
3
|
+
import type { TableCardColumn, TableCardListProps, TableLayout } from '../tables.types';
|
|
4
4
|
/**
|
|
5
5
|
* Picks the layout a table renders from the viewport, the two layout props, and whether react-aria virtualizes it.
|
|
6
6
|
* @param isAtLeastMd - Whether the viewport is `md` or wider; `false` where `matchMedia` is missing or never matches.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableCard.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/utilities/tableCard.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACvH,OAAO,KAAK,EAAE,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D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,EAAE,WAAW,MAAM,KAAG,mBAAmB,GAAG,SAIpG,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,YAAY,EAAE,YAAY,OAAO,KAAG,SAC0C,CAAC;AAEjH,iDAAiD;AACjD,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;CACV;AAED,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,qFAAqF;IACrF,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,6FAA6F;IAC7F,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9B;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,SAAS,KAAG,MAG5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,SAAS,SAAS,EAAE,KAAG,MAA4E,CAAC;AAEhJ;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EACjC,SAAS,SAAS,eAAe,EAAE,EACnC,OAAO,SAAS,CAAC,EAAE,EACnB,SAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,MAAgB,KACpC,iBAAiB,CAAC,CAAC,CAqBrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableCard.utils.js","sources":["../../../../../src/components/organisms/Tables/utilities/tableCard.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAOA;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,WAAoB,EAAE,YAAyB,EAAE,aAA0B,EAAE,aAAa,GAAG,KAAK,KAAiB;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CAAC,MAAM,CAAC,KAAK;AAAE,YAAA,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;YACjD,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC1E,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,KAAK;AACd;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableChildren.utils.cjs","sources":["../../../../../src/components/organisms/Tables/utilities/tableChildren.utils.ts"],"sourcesContent":[null],"names":["flattenChildren","isValidElement","Children","reusableIterableOf"],"mappings":";;;;;;AAQA;;;;;AAKG;AACI,MAAM,WAAW,GAAG,CAAI,QAAmB,EAAE,IAAa,KAC/DA,8BAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAA+BC,oBAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;AAYlH;;;;;;;;;AASG;AACI,MAAM,gBAAgB,GAAG,CAC9B,QAA+B,EAC/B,OAAgC,EAChC,MAA0C,KAC3B;IACf,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAEC,cAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAACC,sCAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE;AAC7I,IAAA,MAAM,IAAI,GAAGH,8BAAe,CAAC,QAAQ,CAAC;AACtC,IAAA,MAAM,WAAW,GAAG,CAAC,KAAgB,KAA4BC,oBAAc,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;IACvG,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;AACtC,IAAA,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE;AACxG;AAQA;;;;;;AAMG;MACU,eAAe,GAAG,CAAI,QAA+B,EAAE,OAAqB,KAAuB;AAC9G,IAAA,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,UAAU,GAAG,KAAK,CAAC,IAAI,CAACE,sCAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,GAAGH,8BAAe,CAAC,QAAQ,CAAC;AAClI,IAAA,OAAO,KAAK,CAAC,MAAM,EAACC,oBAAyB,EAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM;QACjE,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;AACvF,QAAA,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,IAAI;AACxC,KAAA,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
-
import type { TableCardColumn } from '../
|
|
2
|
+
import type { TableCardColumn } from '../tables.types';
|
|
3
3
|
/** Children as a row or header may take them: nodes, or a function called once per column. */
|
|
4
4
|
type CollectionChildren<T> = ReactNode | ((column: T) => ReactElement);
|
|
5
5
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableChildren.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/utilities/tableChildren.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,8FAA8F;AAC9F,KAAK,kBAAkB,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,UAAU,SAAS,EAAE,MAAM,OAAO,KAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAC6B,CAAC;AAEpH,wFAAwF;AACxF,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAC/B,SAAS,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EAChC,QAAQ,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,KACzC,WAMF,CAAC;AAQF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAAE,UAAU,QAAQ,CAAC,CAAC,CAAC,KAAG,eAAe,EAM1G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableChildren.utils.js","sources":["../../../../../src/components/organisms/Tables/utilities/tableChildren.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA;;;;;AAKG;AACI,MAAM,WAAW,GAAG,CAAI,QAAmB,EAAE,IAAa,KAC/D,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAA+B,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;AAYlH;;;;;;;;;AASG;AACI,MAAM,gBAAgB,GAAG,CAC9B,QAA+B,EAC/B,OAAgC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1 @@
|
|
|
1
|
+
{"version":3,"file":"tableIterable.utils.cjs","sources":["../../../../../src/components/organisms/Tables/utilities/tableIterable.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAqB;AAEjD;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAI,KAA8B,KAA6B;IAC/F,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;;AAEpF,IAAA,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AAC7D,IAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AACrD,IAAA,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC;AACzB,IAAA,OAAO,IAAW;AACpB;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableIterable.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/utilities/tableIterable.utils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,KAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,SAOpF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableIterable.utils.js","sources":["../../../../../src/components/organisms/Tables/utilities/tableIterable.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAqB;AAEjD;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAI,KAA8B,KAA6B;IAC/F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AE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,cAAc,GAAG,SAAS,EAAE,OAAO,cAAc,GAAG,SAAS,KAAG,OACtB,CAAC;AAE/E,gGAAgG;AAChG,MAAM,WAAW,SAAS;IACxB,8BAA8B;IAC9B,MAAM,EAAE,GAAG,CAAC;IACZ,0GAA0G;IAC1G,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,SAAS,GAAG,SAAS,EAC/B,gBAAgB,cAAc,GAAG,SAAS,EAC1C,UAAU,cAAc,KACvB,SAAS,GAAG,SAOd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,cAAc,GAAG,SAAS,EAAE,MAAM,cAAc,EAAE,iBAAiB,aAAa,KAAG,QAAQ,GAAG,OAKjI,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,cAAc,GAAG,SAAS,EAAE,QAAQ,GAAG,KAAG,cAGpF,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,cAAc,GAAG,SAAS,EAAE,WAAW,aAAa,KAAG,cAAc,GAAG,SACrE,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,GAAG,KAAG,MAAiE,CAAC;AAEhH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,GAAG,CAAA;CAAE,EAAE,SAAS,SAAS,CAAC,EAAE,EAAE,KAAK,GAAG,GAAG,SAAS,KAAG,CAAC,GAAG,SACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableSort.utils.js","sources":["../../../../../src/components/organisms/Tables/utilities/tableSort.utils.ts"],"sourcesContent":[null],"names":[],"m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B,GAAG,CAAC,OAAmC,EAAE,SAAwB,KACjG,OAAO,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS;AAEhD;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,EAAO,MAAc,OAAO,EAAE,KAAK,QAAQ,GAAG,CAAA,OAAA,EAAU,EAAE,CAAA,CAAE,GAAG,CAAA,IAAA,EAAO,EAAE,CAAA,CAAE;AAE9G;;;;;AAKG;AACI,MAAM,mBAAmB,GAAG,CAAwB,OAAqB,EAAE,GAAoB,KACpG,GAAG,KAAK,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG;;"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var renderUtils = require('@flipdish/ui-library/utilities/renderUtils');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var log_utils = require('../../utilities/__internal__/logUtils/log.utils.cjs');
|
|
6
|
+
|
|
7
|
+
const ownedParams = (params, names) => {
|
|
8
|
+
const owned = new URLSearchParams();
|
|
9
|
+
for (const name of new Set(names)) {
|
|
10
|
+
for (const value of params.getAll(name))
|
|
11
|
+
owned.append(name, value);
|
|
12
|
+
}
|
|
13
|
+
return owned;
|
|
14
|
+
};
|
|
15
|
+
// The order params are written in carries no meaning, so it never makes two queries differ.
|
|
16
|
+
const keyOf = (params) => {
|
|
17
|
+
const sorted = new URLSearchParams(params);
|
|
18
|
+
sorted.sort();
|
|
19
|
+
return sorted.toString();
|
|
20
|
+
};
|
|
21
|
+
// `next`, with every param the hook does not own as the setter's `current` has it, so another feature's change there stands.
|
|
22
|
+
const withUnownedFrom = (current, next, owned) => {
|
|
23
|
+
const unownedOf = (params) => {
|
|
24
|
+
const unowned = new URLSearchParams(params);
|
|
25
|
+
for (const name of owned)
|
|
26
|
+
unowned.delete(name);
|
|
27
|
+
return unowned;
|
|
28
|
+
};
|
|
29
|
+
const result = unownedOf(current);
|
|
30
|
+
if (keyOf(result) === keyOf(unownedOf(next)))
|
|
31
|
+
return next;
|
|
32
|
+
for (const name of new Set(owned)) {
|
|
33
|
+
for (const value of next.getAll(name))
|
|
34
|
+
result.append(name, value);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
// Only the owned names are taken out before a write, so any other name `serialize` writes is appended again on every write.
|
|
39
|
+
const warnOfUnownedParams = (written, names) => {
|
|
40
|
+
for (const name of new Set(written.keys())) {
|
|
41
|
+
if (names.includes(name))
|
|
42
|
+
continue;
|
|
43
|
+
log_utils.warnOnce(`useListQueryParams:unowned-param:${name}`, `useListQueryParams: \`serialize\` wrote \`${name}\`, which is not in \`paramNames\`, so every write adds another copy of it and \`parse\` never reads it. Add \`${name}\` to \`paramNames\`.`);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const warnOfMissingDetail = () => log_utils.warnOnce('useListQueryParams:no-detail', 'useListQueryParams: `openDetail` and `closeDetail` do nothing without the `detail` option. Pass `detail: { name, goBack }`.');
|
|
47
|
+
/**
|
|
48
|
+
* Keeps a list page's query, such as its view, search, sort and page, and the record open in its detail panel in the URL's
|
|
49
|
+
* search params, so a link, a reload or Back lands on the same list and record. Router-agnostic: pass react-router's
|
|
50
|
+
* `useSearchParams()` pair as it is, and call the hook once per URL, since writes build on each other only within one call.
|
|
51
|
+
* A list with no pager still carries `page: 1` in its query, which its `parse` always returns and its `serialize` never writes.
|
|
52
|
+
*
|
|
53
|
+
* @param options The router's search params and setter, the page's `parse` and `serialize`, the param names they own and the
|
|
54
|
+
* optional `detail` param; see `UseListQueryParamsOptions`.
|
|
55
|
+
* @returns `query`, parsed from the URL, and `update`, which writes a change to it: any change but the page alone starts
|
|
56
|
+
* again at page one, and one that writes the params the URL holds navigates nowhere. With `detail`, the open record's
|
|
57
|
+
* `detailId` and `openDetail` and `closeDetail`, which go back off their own push rather than leave an entry that reopens it.
|
|
58
|
+
* The functions are the same on every render.
|
|
59
|
+
*/
|
|
60
|
+
const useListQueryParams = (options) => {
|
|
61
|
+
const { searchParams, parse, paramNames, detail } = options;
|
|
62
|
+
const ownedKey = ownedParams(searchParams, paramNames).toString();
|
|
63
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a page passes `parse` inline, so only a new owned param reads the query again
|
|
64
|
+
const query = React.useMemo(() => parse(new URLSearchParams(ownedKey)), [ownedKey]);
|
|
65
|
+
const detailId = detail ? searchParams.get(detail.name) || null : null;
|
|
66
|
+
// The handlers read these rather than a render's values, so they keep one identity and see the writes before them.
|
|
67
|
+
const latestOptions = React.useRef(options);
|
|
68
|
+
const pending = React.useRef(null);
|
|
69
|
+
const ownEntry = React.useRef(null);
|
|
70
|
+
// The params of the last detail write, to tell one still under way from an `update`.
|
|
71
|
+
const lastDetailWrite = React.useRef(null);
|
|
72
|
+
const leftoverPushes = React.useRef(new Set());
|
|
73
|
+
const searchKey = searchParams.toString();
|
|
74
|
+
// Layout timing, so no handler reads the params of a render older than the one committed.
|
|
75
|
+
React.useLayoutEffect(() => {
|
|
76
|
+
const previous = latestOptions.current.searchParams;
|
|
77
|
+
latestOptions.current = options;
|
|
78
|
+
if (!renderUtils.isProductionBuild() && detail && paramNames.includes(detail.name)) {
|
|
79
|
+
log_utils.warnOnce('useListQueryParams:detail-in-param-names', `useListQueryParams: take \`${detail.name}\` out of \`paramNames\`: it is the detail param, so \`update\` would remove it.`);
|
|
80
|
+
}
|
|
81
|
+
const entry = pending.current;
|
|
82
|
+
// Writes that end on the URL shown leave react-router's params object as it was, so no landing would ever clear them.
|
|
83
|
+
if (entry && !entry.back && entry.from === searchParams && keyOf(entry.params) === keyOf(searchParams)) {
|
|
84
|
+
pending.current = null;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (previous === searchParams || entry?.from !== previous || !entry.back)
|
|
88
|
+
return;
|
|
89
|
+
// Disarmed by the first URL change, so it can never act on a later one.
|
|
90
|
+
pending.current = null;
|
|
91
|
+
const { target, held, leftovers } = entry.back;
|
|
92
|
+
let writes = searchKey === target ? held : [];
|
|
93
|
+
if (detail && leftovers.has(searchKey)) {
|
|
94
|
+
// Short, on a record a second push left beneath: that entry loses the record, so a close always closes.
|
|
95
|
+
const mended = new URLSearchParams(searchParams);
|
|
96
|
+
mended.delete(detail.name);
|
|
97
|
+
writes = [{ params: mended, isReplace: true }, ...held];
|
|
98
|
+
}
|
|
99
|
+
// Any other URL is a navigation the hook did not make: it stands, and what was held goes with the URL it was meant for.
|
|
100
|
+
for (const write of writes)
|
|
101
|
+
send(write.params, write.isReplace);
|
|
102
|
+
const last = writes[writes.length - 1];
|
|
103
|
+
if (last)
|
|
104
|
+
pending.current = { from: searchParams, params: last.params };
|
|
105
|
+
});
|
|
106
|
+
// Keyed by string: a render before the router has the push changes nothing, and any other URL ends the claim.
|
|
107
|
+
React.useLayoutEffect(() => {
|
|
108
|
+
const entry = ownEntry.current;
|
|
109
|
+
ownEntry.current = entry?.key === searchKey ? { ...entry, isDelivered: true } : null;
|
|
110
|
+
}, [searchKey]);
|
|
111
|
+
const { send, update, openDetail, closeDetail } = React.useMemo(() => {
|
|
112
|
+
const send = (next, isReplace) => {
|
|
113
|
+
const { setSearchParams: set, paramNames: names, detail: detailOptions } = latestOptions.current;
|
|
114
|
+
const owned = detailOptions ? [...names, detailOptions.name] : names;
|
|
115
|
+
set((current) => withUnownedFrom(current, next, owned), { replace: isReplace });
|
|
116
|
+
};
|
|
117
|
+
const pendingNow = () => (pending.current?.from === latestOptions.current.searchParams ? pending.current : null);
|
|
118
|
+
const latest = () => pendingNow()?.params ?? latestOptions.current.searchParams;
|
|
119
|
+
const write = (next, isReplace) => {
|
|
120
|
+
const { searchParams: from } = latestOptions.current;
|
|
121
|
+
let back = pendingNow()?.back;
|
|
122
|
+
if (back?.isPastHandler) {
|
|
123
|
+
// A blocker or a `goBack` that goes nowhere would otherwise hold every later write for good.
|
|
124
|
+
for (const held of back.held)
|
|
125
|
+
send(held.params, held.isReplace);
|
|
126
|
+
back = undefined;
|
|
127
|
+
}
|
|
128
|
+
pending.current = { from, params: next, back };
|
|
129
|
+
if (back)
|
|
130
|
+
back.held.push({ params: next, isReplace });
|
|
131
|
+
else
|
|
132
|
+
send(next, isReplace);
|
|
133
|
+
};
|
|
134
|
+
// Another write still under way may have landed an entry of its own, so the claim no longer holds.
|
|
135
|
+
const isOwnEntry = (params) => ownEntry.current?.key === params.toString() && (!pendingNow() || params === lastDetailWrite.current);
|
|
136
|
+
const writeDetail = (next, isReplace) => {
|
|
137
|
+
lastDetailWrite.current = next;
|
|
138
|
+
write(next, isReplace);
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
send,
|
|
142
|
+
update: (patch, updateOptions = {}) => {
|
|
143
|
+
const { parse: parseLatest, serialize, paramNames: names } = latestOptions.current;
|
|
144
|
+
const params = latest();
|
|
145
|
+
const current = parseLatest(ownedParams(params, names));
|
|
146
|
+
const changes = typeof patch === 'function' ? patch(current) : patch;
|
|
147
|
+
const before = keyOf(serialize(current));
|
|
148
|
+
const withPage = (page) => ({ ...current, ...changes, page });
|
|
149
|
+
let next = withPage(changes.page ?? current.page);
|
|
150
|
+
// Any change but the page itself starts again at page one, so a narrower result never points past its last page.
|
|
151
|
+
if (changes.page === undefined && keyOf(serialize(next)) !== before)
|
|
152
|
+
next = withPage(1);
|
|
153
|
+
const written = serialize(next);
|
|
154
|
+
if (!renderUtils.isProductionBuild())
|
|
155
|
+
warnOfUnownedParams(written, names);
|
|
156
|
+
// react-router navigates even to the params already in the URL, so a change that writes nothing new must not reach it.
|
|
157
|
+
if (keyOf(written) === before)
|
|
158
|
+
return;
|
|
159
|
+
const nextParams = new URLSearchParams(params);
|
|
160
|
+
for (const name of names)
|
|
161
|
+
nextParams.delete(name);
|
|
162
|
+
for (const [name, value] of written)
|
|
163
|
+
nextParams.append(name, value);
|
|
164
|
+
write(nextParams, updateOptions.history === 'replace');
|
|
165
|
+
},
|
|
166
|
+
openDetail: (id) => {
|
|
167
|
+
const param = latestOptions.current.detail?.name;
|
|
168
|
+
if (param === undefined) {
|
|
169
|
+
if (!renderUtils.isProductionBuild())
|
|
170
|
+
warnOfMissingDetail();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const params = latest();
|
|
174
|
+
const openId = params.get(param) || null;
|
|
175
|
+
if (!id || openId === id)
|
|
176
|
+
return;
|
|
177
|
+
const next = new URLSearchParams(params);
|
|
178
|
+
next.set(param, id);
|
|
179
|
+
const entry = ownEntry.current;
|
|
180
|
+
const isOwn = isOwnEntry(params);
|
|
181
|
+
if (openId === null) {
|
|
182
|
+
// Claimed only when nothing else is under way: going back off an entry that holds another write would undo it too.
|
|
183
|
+
ownEntry.current = pendingNow() ? null : { key: next.toString(), beneath: params.toString(), isDelivered: false };
|
|
184
|
+
leftoverPushes.current = new Set();
|
|
185
|
+
writeDetail(next, false);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (entry && isOwn && !entry.isDelivered) {
|
|
189
|
+
// A replace would rewrite the list's entry under a router still on the push; one that took it keeps both, which a close then mends.
|
|
190
|
+
ownEntry.current = { ...entry, key: next.toString(), isDelivered: false };
|
|
191
|
+
leftoverPushes.current.add(params.toString());
|
|
192
|
+
writeDetail(next, false);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// Row to row replaces, so Back skips every record looked at; on the hook's own entry the claim moves to the new URL.
|
|
196
|
+
ownEntry.current = isOwn && entry ? { ...entry, key: next.toString() } : null;
|
|
197
|
+
writeDetail(next, true);
|
|
198
|
+
},
|
|
199
|
+
closeDetail: () => {
|
|
200
|
+
const { detail: detailOptions, searchParams: from } = latestOptions.current;
|
|
201
|
+
if (!detailOptions) {
|
|
202
|
+
if (!renderUtils.isProductionBuild())
|
|
203
|
+
warnOfMissingDetail();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const params = latest();
|
|
207
|
+
if (!params.get(detailOptions.name))
|
|
208
|
+
return;
|
|
209
|
+
const next = new URLSearchParams(params);
|
|
210
|
+
next.delete(detailOptions.name);
|
|
211
|
+
const entry = ownEntry.current;
|
|
212
|
+
const isOwn = entry?.isDelivered === true && isOwnEntry(params);
|
|
213
|
+
ownEntry.current = null;
|
|
214
|
+
lastDetailWrite.current = next;
|
|
215
|
+
// Never back past an `update` still under way, which the back would undo or race; a replace keeps it.
|
|
216
|
+
if (!isOwn) {
|
|
217
|
+
write(next, true);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// The entry beneath as it was, which an empty value of the param, `?user=`, may still be on.
|
|
221
|
+
const beneath = new URLSearchParams(entry.beneath);
|
|
222
|
+
const back = { target: entry.beneath, held: [], isPastHandler: false, leftovers: leftoverPushes.current };
|
|
223
|
+
leftoverPushes.current = new Set();
|
|
224
|
+
lastDetailWrite.current = beneath;
|
|
225
|
+
pending.current = { from, params: beneath, back };
|
|
226
|
+
// A microtask runs once the handler has returned and sets only a flag, so nothing is left running after an unmount.
|
|
227
|
+
queueMicrotask(() => {
|
|
228
|
+
back.isPastHandler = true;
|
|
229
|
+
});
|
|
230
|
+
detailOptions.goBack();
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}, []);
|
|
234
|
+
return { query, update, detailId, openDetail, closeDetail };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
exports.useListQueryParams = useListQueryParams;
|
|
238
|
+
//# sourceMappingURL=index.cjs.map
|