@flipdish/ui-library 0.69.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 +3 -3
- 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/Button/hooks/useLoadingLinkPress.d.ts +1 -1
- 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/atoms/LiveStatus/index.cjs +18 -0
- package/dist/components/atoms/LiveStatus/index.cjs.map +1 -0
- package/dist/components/atoms/LiveStatus/index.d.ts +17 -0
- package/dist/components/atoms/LiveStatus/index.d.ts.map +1 -0
- package/dist/components/atoms/LiveStatus/index.js +16 -0
- package/dist/components/atoms/LiveStatus/index.js.map +1 -0
- package/dist/components/forms/Form/index.cjs +1 -1
- package/dist/components/forms/Form/index.js +1 -1
- package/dist/components/molecules/Dropdown/index.d.ts +2 -2
- 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/molecules/Tags/TagGroup/TagGroup.d.ts +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +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/hooks/useSlideoutState.cjs +2 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts +10 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +2 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.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 -244
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +29 -124
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +13 -243
- 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 +29 -0
- package/dist/components/organisms/Tables/Table/Table.styles.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.d.ts +16 -0
- package/dist/components/organisms/Tables/Table/Table.styles.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.js +27 -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 +10 -5
- 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 +11 -6
- package/dist/components/organisms/Tables/Table/components/TableCardRow.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.cjs +2 -2
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.d.ts +3 -1
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.js +2 -2
- 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 +6 -5
- package/dist/components/organisms/Tables/Table/components/TableRowCard.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableRowCard.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.js +6 -5
- 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 +22 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts +12 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.js +20 -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/Tables/Table/hooks/useIsPlaceholderPage.cjs +42 -0
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts +14 -0
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js +40 -0
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.cjs +8 -11
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.d.ts +10 -3
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.js +9 -12
- 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 +12 -4
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.d.ts +5 -3
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.js +12 -4
- 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 +14 -2
- 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/Tables/Table/utilities/tableLoading.utils.cjs +57 -0
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts +66 -0
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js +52 -0
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.cjs +21 -21
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.d.ts +29 -19
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.js +20 -21
- 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 +12 -5
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.cjs.map +1 -0
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts +47 -0
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.js +12 -5
- 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} +12 -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 +2 -2
- 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/{Table → Tables}/utilities/tableChildren.utils.cjs +7 -4
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.d.ts +5 -3
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.js +7 -4
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs +23 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts +8 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.js +21 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.js.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.cjs +1 -1
- package/dist/components/organisms/Tables/utilities/tableSort.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/utilities/tableSort.utils.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.js +1 -1
- package/dist/components/organisms/Tables/utilities/tableSort.utils.js.map +1 -0
- package/dist/hooks/useFocusAfterRetry/index.cjs +21 -19
- package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.d.ts +15 -5
- package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.js +21 -19
- package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
- package/dist/hooks/useFocusHandOff/index.cjs +67 -0
- package/dist/hooks/useFocusHandOff/index.cjs.map +1 -0
- package/dist/hooks/useFocusHandOff/index.d.ts +17 -0
- package/dist/hooks/useFocusHandOff/index.d.ts.map +1 -0
- package/dist/hooks/useFocusHandOff/index.js +65 -0
- package/dist/hooks/useFocusHandOff/index.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/atoms/LiveStatus/index.d.ts +12 -0
- package/dist/native/components/organisms/Tables/index.d.ts +12 -0
- package/dist/native/hooks/useFocusHandOff/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/styles.css +12 -0
- package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.cjs +9 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.cjs.map +1 -0
- package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.d.ts +8 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.d.ts.map +1 -0
- package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.js +9 -1
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.js.map +1 -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 +9 -9
- package/dist/components/forms/Form/utilities/focusFromCode.utils.cjs.map +0 -1
- package/dist/components/forms/Form/utilities/focusFromCode.utils.d.ts.map +0 -1
- package/dist/components/forms/Form/utilities/focusFromCode.utils.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/TableFocusGuard.cjs +0 -23
- package/dist/components/organisms/Table/components/TableFocusGuard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableFocusGuard.d.ts +0 -2
- package/dist/components/organisms/Table/components/TableFocusGuard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableFocusGuard.js +0 -21
- package/dist/components/organisms/Table/components/TableFocusGuard.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 +0 -35
- 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/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/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/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}/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/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/useFirstSortDirection.d.ts +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}/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
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
var useStoredTableLayout = require('../../hooks/useStoredTableLayout.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What a `TableLayoutToggle` shows and does with a pick: `value` from the page, else the layout stored for `layoutKey`, with
|
|
10
|
+
* a development warning when a `value` comes with no `onChange`, so a pick can never show.
|
|
11
|
+
*
|
|
12
|
+
* @param source The toggle's `value`, `onChange` and `layoutKey`; see `TableLayoutToggleSource`.
|
|
13
|
+
* @returns `layout`, the option to check, and `choose`, which takes a pick: it stores it for `layoutKey`, then calls `onChange`.
|
|
14
|
+
*/
|
|
15
|
+
const useTableLayoutToggle = ({ value, onChange, layoutKey }) => {
|
|
16
|
+
const layout = useStoredTableLayout.useStoredTableLayout(layoutKey, value);
|
|
17
|
+
const isReadOnly = value !== undefined && onChange === undefined;
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!isReadOnly || renderUtils.isProductionBuild())
|
|
20
|
+
return;
|
|
21
|
+
log_utils.warnOnce('TableLayoutToggle:value-without-onChange', 'TableLayoutToggle: it has `value` but no `onChange`, so a pick never shows on it. Pass `onChange`, or leave `value` unset to show the layout stored for its `layoutKey`.');
|
|
22
|
+
}, [isReadOnly]);
|
|
23
|
+
const choose = (next) => {
|
|
24
|
+
if (layoutKey !== undefined)
|
|
25
|
+
useStoredTableLayout.storeTableLayout(layoutKey, next);
|
|
26
|
+
onChange?.(next);
|
|
27
|
+
};
|
|
28
|
+
return { layout, choose };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.useTableLayoutToggle = useTableLayoutToggle;
|
|
32
|
+
//# sourceMappingURL=useTableLayoutToggle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableLayoutToggle.cjs","sources":["../../../../../../src/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.ts"],"sourcesContent":[null],"names":["useStoredTableLayout","useEffect","isProductionBuild","warnOnce","storeTableLayout"],"mappings":";;;;;;;AAiBA;;;;;;AAMG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAA2B,KAAI;IAC9F,MAAM,MAAM,GAAGA,yCAAoB,CAAC,SAAS,EAAE,KAAK,CAAC;IACrD,MAAM,UAAU,GAAG,KAAK,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS;IAEhEC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,UAAU,IAAIC,6BAAiB,EAAE;YAAE;AACxC,QAAAC,kBAAQ,CACN,0CAA0C,EAC1C,0KAA0K,CAC3K;AACH,IAAA,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhB,IAAA,MAAM,MAAM,GAAG,CAAC,IAAiB,KAAI;QACnC,IAAI,SAAS,KAAK,SAAS;AAAE,YAAAC,qCAAgB,CAAC,SAAS,EAAE,IAAI,CAAC;AAC9D,QAAA,QAAQ,GAAG,IAAI,CAAC;AAClB,IAAA,CAAC;AAED,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3B;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TableLayout } from '../../tables.types';
|
|
2
|
+
export interface TableLayoutToggleSource {
|
|
3
|
+
/** The toggle's `value`, which wins over the stored layout. */
|
|
4
|
+
value?: TableLayout;
|
|
5
|
+
/** The toggle's `onChange`. */
|
|
6
|
+
onChange?: (value: TableLayout) => void;
|
|
7
|
+
/** The toggle's `layoutKey`, under which each pick is stored. */
|
|
8
|
+
layoutKey?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What a `TableLayoutToggle` shows and does with a pick: `value` from the page, else the layout stored for `layoutKey`, with
|
|
12
|
+
* a development warning when a `value` comes with no `onChange`, so a pick can never show.
|
|
13
|
+
*
|
|
14
|
+
* @param source The toggle's `value`, `onChange` and `layoutKey`; see `TableLayoutToggleSource`.
|
|
15
|
+
* @returns `layout`, the option to check, and `choose`, which takes a pick: it stores it for `layoutKey`, then calls `onChange`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useTableLayoutToggle: ({ value, onChange, layoutKey }: TableLayoutToggleSource) => {
|
|
18
|
+
layout: TableLayout;
|
|
19
|
+
choose: (next: TableLayout) => void;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useTableLayoutToggle.d.ts.map
|
package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableLayoutToggle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,gCAAgC,uBAAuB;;mBAYpE,WAAW;CAMlC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isProductionBuild } from '@flipdish/ui-library/utilities/renderUtils';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { warnOnce } from '../../../../../utilities/__internal__/logUtils/log.utils.js';
|
|
4
|
+
import { useStoredTableLayout, storeTableLayout } from '../../hooks/useStoredTableLayout.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a `TableLayoutToggle` shows and does with a pick: `value` from the page, else the layout stored for `layoutKey`, with
|
|
8
|
+
* a development warning when a `value` comes with no `onChange`, so a pick can never show.
|
|
9
|
+
*
|
|
10
|
+
* @param source The toggle's `value`, `onChange` and `layoutKey`; see `TableLayoutToggleSource`.
|
|
11
|
+
* @returns `layout`, the option to check, and `choose`, which takes a pick: it stores it for `layoutKey`, then calls `onChange`.
|
|
12
|
+
*/
|
|
13
|
+
const useTableLayoutToggle = ({ value, onChange, layoutKey }) => {
|
|
14
|
+
const layout = useStoredTableLayout(layoutKey, value);
|
|
15
|
+
const isReadOnly = value !== undefined && onChange === undefined;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!isReadOnly || isProductionBuild())
|
|
18
|
+
return;
|
|
19
|
+
warnOnce('TableLayoutToggle:value-without-onChange', 'TableLayoutToggle: it has `value` but no `onChange`, so a pick never shows on it. Pass `onChange`, or leave `value` unset to show the layout stored for its `layoutKey`.');
|
|
20
|
+
}, [isReadOnly]);
|
|
21
|
+
const choose = (next) => {
|
|
22
|
+
if (layoutKey !== undefined)
|
|
23
|
+
storeTableLayout(layoutKey, next);
|
|
24
|
+
onChange?.(next);
|
|
25
|
+
};
|
|
26
|
+
return { layout, choose };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useTableLayoutToggle };
|
|
30
|
+
//# sourceMappingURL=useTableLayoutToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableLayoutToggle.js","sources":["../../../../../../src/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAiBA;;;;;;AAMG;AACI,MAAM,oBAAoB,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAA2B,KAAI;IAC9F,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC;IACrD,MAAM,UAAU,GAAG,KAAK,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS;IAEhE,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,UAAU,IAAI,iBAAiB,EAAE;YAAE;AACxC,QAAA,QAAQ,CACN,0CAA0C,EAC1C,0KAA0K,CAC3K;AACH,IAAA,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhB,IAAA,MAAM,MAAM,GAAG,CAAC,IAAiB,KAAI;QACnC,IAAI,SAAS,KAAK,SAAS;AAAE,YAAA,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC;AAC9D,QAAA,QAAQ,GAAG,IAAI,CAAC;AAClB,IAAA,CAAC;AAED,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3B;;"}
|
package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.cjs
RENAMED
|
@@ -7,19 +7,26 @@ var Dropdown = require('@flipdish/ui-library/components/molecules/Dropdown');
|
|
|
7
7
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
8
8
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
9
9
|
var useIsAtLeastMd = require('../hooks/useIsAtLeastMd.cjs');
|
|
10
|
+
var useStoredTableLayout = require('../hooks/useStoredTableLayout.cjs');
|
|
10
11
|
var tableCard_utils = require('../utilities/tableCard.utils.cjs');
|
|
11
12
|
var tableSort_utils = require('../utilities/tableSort.utils.cjs');
|
|
12
13
|
|
|
13
14
|
const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
|
|
14
|
-
/**
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only
|
|
17
|
+
* below `md`. Put it beside `TableLayoutToggle` with the table's sort props and layouts, as cards have no column headers to press.
|
|
18
|
+
*
|
|
19
|
+
* @summary sort a table's cards by column and direction
|
|
20
|
+
*/
|
|
21
|
+
const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout: desktopLayoutProp, layoutKey, size = 'md', className, 'data-testid': dataTestId, }) => {
|
|
16
22
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
|
|
17
23
|
// Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
|
|
18
24
|
const isAtLeastMd = useIsAtLeastMd.useIsAtLeastMd();
|
|
25
|
+
const desktopLayout = useStoredTableLayout.useStoredTableLayout(layoutKey, desktopLayoutProp);
|
|
19
26
|
const isIconOnly = !isAtLeastMd;
|
|
20
27
|
const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
|
|
21
28
|
const sortName = sortedColumn && sortDescriptor ? `Sort by ${sortedColumn.label}, ${sortDescriptor.direction}` : undefined;
|
|
22
|
-
// The order differs from the one the page rests at, so there is something to
|
|
29
|
+
// The order differs from the one the page rests at, so there is something to reset and the icon marks it.
|
|
23
30
|
const isAwayFromRest = !tableSort_utils.isSameSort(sortDescriptor, defaultSortDescriptor);
|
|
24
31
|
const chooseColumn = (selection) => {
|
|
25
32
|
const column = tableSort_utils.columnOfSortMenuKey(columns, firstKeyOf(selection));
|
|
@@ -31,7 +38,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
31
38
|
if (direction === 'ascending' || direction === 'descending')
|
|
32
39
|
onSortChange(tableSort_utils.sortOfDirectionChoice(sortDescriptor, direction));
|
|
33
40
|
};
|
|
34
|
-
const
|
|
41
|
+
const resetSort = () => onSortChange(defaultSortDescriptor);
|
|
35
42
|
const renderColumnItem = (column) => (jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: tableSort_utils.sortMenuColumnKeyOf(column.id), label: column.label }, tableSort_utils.sortMenuColumnKeyOf(column.id)));
|
|
36
43
|
// Read as the table reads it, so the two always agree, on the server and while hydrating too.
|
|
37
44
|
if (tableCard_utils.tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
|
|
@@ -40,7 +47,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
40
47
|
// A decorative dot while the sort differs from the resting one; the name already states what the sort is.
|
|
41
48
|
isAwayFromRest && "after:absolute after:top-1 after:right-1 after:size-2 after:rounded-full after:bg-brand-solid after:content-['']", className), "aria-label": sortName ?? 'Sort by', "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger') })) : (jsxRuntime.jsxs(Buttons.Button, { color: "secondary", size: size, iconLeading: uiIcons.SwitchVertical01,
|
|
42
49
|
// The label truncates, so the trigger never grows wider than the space it is given.
|
|
43
|
-
className: cx.cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { children: jsxRuntime.jsxs(Dropdown.Dropdown.Menu, { "aria-label": "Sort by", children: [jsxRuntime.jsx(Dropdown.Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [tableSort_utils.sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), jsxRuntime.jsxs(Dropdown.Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "clear", label: "
|
|
50
|
+
className: cx.cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { children: jsxRuntime.jsxs(Dropdown.Dropdown.Menu, { "aria-label": "Sort by", children: [jsxRuntime.jsx(Dropdown.Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [tableSort_utils.sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), jsxRuntime.jsxs(Dropdown.Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "clear", label: "Reset sort", onAction: resetSort })] }) })] }));
|
|
44
51
|
};
|
|
45
52
|
TableSortMenu.displayName = 'TableSortMenu';
|
|
46
53
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSortMenu.cjs","sources":["../../../../../src/components/organisms/Tables/TableSortMenu/TableSortMenu.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useIsAtLeastMd","useStoredTableLayout","isSameSort","columnOfSortMenuKey","sortOfColumnChoice","sortOfDirectionChoice","_jsx","Dropdown","sortMenuColumnKeyOf","tableLayoutOf","_jsxs","Button","SwitchVertical01","cx","joinTestId","_Fragment"],"mappings":";;;;;;;;;;;;;AA8CA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;;;;;AAKG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EACT,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAGA,6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e;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Key, SortDescriptor } from 'react-aria-components';
|
|
2
|
+
import type { TableLayout } from '../tables.types';
|
|
3
|
+
export interface TableSortMenuProps {
|
|
4
|
+
/** The columns a user can sort by, in menu order: each `id` is its `Table.Head`'s `id`, and `label` names it in the menu. */
|
|
5
|
+
columns: readonly {
|
|
6
|
+
id: Key;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** The table's current sort; unset while nothing is sorted. */
|
|
10
|
+
sortDescriptor?: SortDescriptor;
|
|
11
|
+
/**
|
|
12
|
+
* What "Reset sort" reports, the table's own `defaultSortDescriptor`: the page's resting sort, which the page starts its
|
|
13
|
+
* `sortDescriptor` from. While the sort matches it the icon-only trigger has no dot and the menu no "Reset sort". Omitted,
|
|
14
|
+
* a reset reports `undefined`.
|
|
15
|
+
*/
|
|
16
|
+
defaultSortDescriptor?: SortDescriptor;
|
|
17
|
+
/** Called with the sort picked: a first column ascending, another keeping the direction, or "Reset sort"'s `defaultSortDescriptor`; pass the table's handler. */
|
|
18
|
+
onSortChange: (descriptor: SortDescriptor | undefined) => void;
|
|
19
|
+
/** The table's `mobileLayout`: the menu renders nothing below `md` while that is the table, which its headers sort. */
|
|
20
|
+
mobileLayout?: TableLayout;
|
|
21
|
+
/**
|
|
22
|
+
* The table's `desktopLayout`: the menu renders nothing from `md` up while that is the table. Unset, the layout chosen for
|
|
23
|
+
* `layoutKey`, or the table, so with neither the menu shows below `md` only: pass one for cards from `md`.
|
|
24
|
+
*
|
|
25
|
+
* @default 'table'
|
|
26
|
+
*/
|
|
27
|
+
desktopLayout?: TableLayout;
|
|
28
|
+
/** The table's `layoutKey`, so the menu shows while the layout chosen for that key is cards; `desktopLayout` wins. */
|
|
29
|
+
layoutKey?: string;
|
|
30
|
+
/** The trigger's size, as a `Button`'s. */
|
|
31
|
+
size?: 'sm' | 'md';
|
|
32
|
+
/** Classes for the trigger in both its forms, such as `w-full` to fill a row; from `md` its label truncates to fit. */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Overrides the root `data-testid` (defaults to `fd-table-sort-menu`); the trigger derives `<root>--trigger` and each item `<root>--item-<key>`. */
|
|
35
|
+
'data-testid'?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only
|
|
39
|
+
* below `md`. Put it beside `TableLayoutToggle` with the table's sort props and layouts, as cards have no column headers to press.
|
|
40
|
+
*
|
|
41
|
+
* @summary sort a table's cards by column and direction
|
|
42
|
+
*/
|
|
43
|
+
export declare const TableSortMenu: {
|
|
44
|
+
({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout, desktopLayout: desktopLayoutProp, layoutKey, size, className, "data-testid": dataTestId, }: TableSortMenuProps): import("react").JSX.Element | null;
|
|
45
|
+
displayName: string;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=TableSortMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSortMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/TableSortMenu/TableSortMenu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAa,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,kBAAkB;IACjC,6HAA6H;IAC7H,OAAO,EAAE,SAAS;QAAE,EAAE,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,iKAAiK;IACjK,YAAY,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,sHAAsH;IACtH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,uHAAuH;IACvH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qJAAqJ;IACrJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID;;;;;GAKG;AACH,eAAO,MAAM,aAAa;+KAWvB,kBAAkB;;CA6FpB,CAAC"}
|
package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.js
RENAMED
|
@@ -5,19 +5,26 @@ import { Dropdown } from '@flipdish/ui-library/components/molecules/Dropdown';
|
|
|
5
5
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
6
6
|
import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
7
7
|
import { useIsAtLeastMd } from '../hooks/useIsAtLeastMd.js';
|
|
8
|
+
import { useStoredTableLayout } from '../hooks/useStoredTableLayout.js';
|
|
8
9
|
import { tableLayoutOf } from '../utilities/tableCard.utils.js';
|
|
9
10
|
import { isSameSort, sortMenuColumnKeyOf, columnOfSortMenuKey, sortOfColumnChoice, sortOfDirectionChoice } from '../utilities/tableSort.utils.js';
|
|
10
11
|
|
|
11
12
|
const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
|
|
12
|
-
/**
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only
|
|
15
|
+
* below `md`. Put it beside `TableLayoutToggle` with the table's sort props and layouts, as cards have no column headers to press.
|
|
16
|
+
*
|
|
17
|
+
* @summary sort a table's cards by column and direction
|
|
18
|
+
*/
|
|
19
|
+
const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout: desktopLayoutProp, layoutKey, size = 'md', className, 'data-testid': dataTestId, }) => {
|
|
14
20
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
|
|
15
21
|
// Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
|
|
16
22
|
const isAtLeastMd = useIsAtLeastMd();
|
|
23
|
+
const desktopLayout = useStoredTableLayout(layoutKey, desktopLayoutProp);
|
|
17
24
|
const isIconOnly = !isAtLeastMd;
|
|
18
25
|
const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
|
|
19
26
|
const sortName = sortedColumn && sortDescriptor ? `Sort by ${sortedColumn.label}, ${sortDescriptor.direction}` : undefined;
|
|
20
|
-
// The order differs from the one the page rests at, so there is something to
|
|
27
|
+
// The order differs from the one the page rests at, so there is something to reset and the icon marks it.
|
|
21
28
|
const isAwayFromRest = !isSameSort(sortDescriptor, defaultSortDescriptor);
|
|
22
29
|
const chooseColumn = (selection) => {
|
|
23
30
|
const column = columnOfSortMenuKey(columns, firstKeyOf(selection));
|
|
@@ -29,7 +36,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
29
36
|
if (direction === 'ascending' || direction === 'descending')
|
|
30
37
|
onSortChange(sortOfDirectionChoice(sortDescriptor, direction));
|
|
31
38
|
};
|
|
32
|
-
const
|
|
39
|
+
const resetSort = () => onSortChange(defaultSortDescriptor);
|
|
33
40
|
const renderColumnItem = (column) => (jsx(Dropdown.Item, { id: sortMenuColumnKeyOf(column.id), label: column.label }, sortMenuColumnKeyOf(column.id)));
|
|
34
41
|
// Read as the table reads it, so the two always agree, on the server and while hydrating too.
|
|
35
42
|
if (tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
|
|
@@ -38,7 +45,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
38
45
|
// A decorative dot while the sort differs from the resting one; the name already states what the sort is.
|
|
39
46
|
isAwayFromRest && "after:absolute after:top-1 after:right-1 after:size-2 after:rounded-full after:bg-brand-solid after:content-['']", className), "aria-label": sortName ?? 'Sort by', "data-testid": joinTestId(rootTestId, 'trigger') })) : (jsxs(Button, { color: "secondary", size: size, iconLeading: SwitchVertical01,
|
|
40
47
|
// The label truncates, so the trigger never grows wider than the space it is given.
|
|
41
|
-
className: cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxs(Fragment, { children: [' ', jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsx(Dropdown.Popover, { children: jsxs(Dropdown.Menu, { "aria-label": "Sort by", children: [jsx(Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsx(Dropdown.Separator, {}), jsxs(Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsx(Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsx(Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsx(Dropdown.Separator, {}), isAwayFromRest && jsx(Dropdown.Item, { id: "clear", label: "
|
|
48
|
+
className: cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxs(Fragment, { children: [' ', jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsx(Dropdown.Popover, { children: jsxs(Dropdown.Menu, { "aria-label": "Sort by", children: [jsx(Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsx(Dropdown.Separator, {}), jsxs(Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsx(Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsx(Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsx(Dropdown.Separator, {}), isAwayFromRest && jsx(Dropdown.Item, { id: "clear", label: "Reset sort", onAction: resetSort })] }) })] }));
|
|
42
49
|
};
|
|
43
50
|
TableSortMenu.displayName = 'TableSortMenu';
|
|
44
51
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSortMenu.js","sources":["../../../../../src/components/organisms/Tables/TableSortMenu/TableSortMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;AA8CA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;;;;;AAKG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EACT,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;;AAErH,IAAA,MAAM,WA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sBAAsB,EAAA,IAAA,EACtB,YAAY,EAAE,YAAY,GAAG,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,EACxE,iBAAiB,EAAE,YAAY,EAAA,QAAA,EAE9B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAA,CACb,EACnBA,GAAA,CAAC,QAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EACtBC,IAAA,CAAC,QAAQ,CAAC,OAAO,EAAA,EAAA,YAAA,EACJ,WAAW,EACtB,aAAa,EAAC,QAAQ,EACtB,sBAAsB,EAAA,IAAA,EACtB,YAAY,EAAE,YAAY,IAAI,cAAc,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE,EAC9E,iBAAiB,EAAE,eAAe,EAAA,QAAA,EAAA,CAGlCD,IAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,WAAW,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAE,CAAC,YAAY,EAAA,CAAI,EAC7EA,GAAA,CAAC,QAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAIA,GAAA,CAAC,QAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EAExC,cAAc,IAAIA,IAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,OAAO,EAAC,KAAK,EAAC,YAAY,EAAC,QAAQ,EAAE,SAAS,GAAI,CAAA,EAAA,CACzE,EAAA,CACC,CAAA,EAAA,CACL;AAEpB;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsAtLeastMd.cjs","sources":["../../../../../src/components/organisms/Tables/hooks/useIsAtLeastMd.ts"],"sourcesContent":[null],"names":["useSyncExternalStore","useBreakpoints"],"mappings":";;;;;AAKA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AAEzC;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,kBAAkB,GAAGA,0BAAoB,CAC7C,kBAAkB,EAClB,MAAM,IAAI,EACV,MAAM,KAAK,CACZ;AACD,IAAA,MAAM,WAAW,GAAGC,6BAAc,CAAC,IAAI,CAAC;IACxC,OAAO,kBAAkB,IAAI,WAAW;AAC1C;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsAtLeastMd.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/hooks/useIsAtLeastMd.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,eAQ1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsAtLeastMd.js","sources":["../../../../../src/components/organisms/Tables/hooks/useIsAtLeastMd.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAKA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AAEzC;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,MAAK;AACjC,IAAA,MAAM,kBAAkB,GAAG,oBAAoB,CAC7C,kBAAkB,EAClB,MAAM,IAAI,EACV,MAAM,KAAK,CACZ;AACD,IAAA,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC;IACxC,OAAO,kBAAkB,IAAI,WAAW;AAC1C;;"}
|
|
@@ -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,cAA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OG;MACU,gBAAgB,GAAG,CAAC,SAAiB,EAAE,MAAmB,KAAU;AAC/E,IAAA,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC;AACpC,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACnB,IAAA,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,MAAM;AAAE,QAAA,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC;;AAC1D,QAAA,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3C,MAAM,CAAC,SAAS,CAAC;AACnB;AAEA;;;;;;;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,cA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,SAAS,CAAC;AACpC,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACnB,IAAA,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,MAAM;AAAE,QAAA,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC;;AAC1D,QAAA,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3C,MAAM,CAAC,SAAS,CAAC;AACnB;AAEA;;;;;;;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,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":";;"}
|
|
@@ -4,6 +4,8 @@ import type { RowProps as AriaRowProps, TableBodyProps as AriaTableBodyProps, Gr
|
|
|
4
4
|
export type RowId = string | number;
|
|
5
5
|
/** Which layout a `Table` renders: the table, or one card per row. */
|
|
6
6
|
export type TableLayout = 'table' | 'cards';
|
|
7
|
+
/** The tint a `Table.Row` can take, in the table and on its card: names `Badge` has too, so the badge on a tinted row can say the same. */
|
|
8
|
+
export type TableRowColor = 'warning' | 'error' | 'success' | 'orange';
|
|
7
9
|
/** What a card needs to know about one column, read from its `Table.Head`. */
|
|
8
10
|
export interface TableCardColumn {
|
|
9
11
|
/** The column's visible label; a column without one renders at the card header's trailing end. */
|
|
@@ -22,14 +24,22 @@ export interface TableBodyProps<T> extends AriaTableBodyProps<T> {
|
|
|
22
24
|
/** Overrides the body's `data-testid`; in the cards layout it replaces the card list's derived `<root>--list`. */
|
|
23
25
|
'data-testid'?: string;
|
|
24
26
|
}
|
|
25
|
-
export interface TableRowProps<T extends object> extends AriaRowProps<T>, Omit<ComponentPropsWithoutRef<'tr'>, 'children' | 'className' | 'onClick' | 'slot' | 'style' | 'id'> {
|
|
27
|
+
export interface TableRowProps<T extends object> extends AriaRowProps<T>, Omit<ComponentPropsWithoutRef<'tr'>, 'children' | 'className' | 'color' | 'onClick' | 'slot' | 'style' | 'id'> {
|
|
26
28
|
/** Draws the selected row with the brand tint and left bar; off, a selected row looks like any other. */
|
|
27
29
|
highlightSelectedRow?: boolean;
|
|
28
30
|
/** Draws the row as if selected without selecting it, for the row whose detail is open beside the table. */
|
|
29
31
|
isHighlighted?: boolean;
|
|
32
|
+
/**
|
|
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
|
+
* 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. `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.
|
|
38
|
+
*/
|
|
39
|
+
color?: TableRowColor;
|
|
30
40
|
/** Row height and cell padding; inherits from the table unless set. */
|
|
31
41
|
size?: 'sm' | 'md';
|
|
32
42
|
/** Overrides the derived `data-testid` for the row (defaults to `<root>--row-<id>`). */
|
|
33
43
|
'data-testid'?: string;
|
|
34
44
|
}
|
|
35
|
-
//# 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,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,CAA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