@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.
Files changed (415) hide show
  1. package/README.md +3 -3
  2. package/dist/components/__internal__/controlFill/controlFill.context.cjs +13 -0
  3. package/dist/components/__internal__/controlFill/controlFill.context.cjs.map +1 -0
  4. package/dist/components/__internal__/controlFill/controlFill.context.d.ts +7 -0
  5. package/dist/components/__internal__/controlFill/controlFill.context.d.ts.map +1 -0
  6. package/dist/components/__internal__/controlFill/controlFill.context.js +11 -0
  7. package/dist/components/__internal__/controlFill/controlFill.context.js.map +1 -0
  8. package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs +13 -0
  9. package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs.map +1 -0
  10. package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts +8 -0
  11. package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts.map +1 -0
  12. package/dist/components/__internal__/focusHandOff/focusHandOff.context.js +11 -0
  13. package/dist/components/__internal__/focusHandOff/focusHandOff.context.js.map +1 -0
  14. package/dist/components/atoms/Buttons/Button/hooks/useLoadingLinkPress.d.ts +1 -1
  15. package/dist/components/atoms/Buttons/IconButton/IconButton.cjs +1 -1
  16. package/dist/components/atoms/Buttons/IconButton/IconButton.cjs.map +1 -1
  17. package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts.map +1 -1
  18. package/dist/components/atoms/Buttons/IconButton/IconButton.js +1 -1
  19. package/dist/components/atoms/Buttons/IconButton/IconButton.js.map +1 -1
  20. package/dist/components/atoms/LiveStatus/index.cjs +18 -0
  21. package/dist/components/atoms/LiveStatus/index.cjs.map +1 -0
  22. package/dist/components/atoms/LiveStatus/index.d.ts +17 -0
  23. package/dist/components/atoms/LiveStatus/index.d.ts.map +1 -0
  24. package/dist/components/atoms/LiveStatus/index.js +16 -0
  25. package/dist/components/atoms/LiveStatus/index.js.map +1 -0
  26. package/dist/components/forms/Form/index.cjs +1 -1
  27. package/dist/components/forms/Form/index.js +1 -1
  28. package/dist/components/molecules/Dropdown/index.d.ts +2 -2
  29. package/dist/components/molecules/EmptyState/index.cjs +9 -1
  30. package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
  31. package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
  32. package/dist/components/molecules/EmptyState/index.js +11 -3
  33. package/dist/components/molecules/EmptyState/index.js.map +1 -1
  34. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs +13 -0
  35. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs.map +1 -1
  36. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts +8 -0
  37. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts.map +1 -1
  38. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js +13 -1
  39. package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js.map +1 -1
  40. package/dist/components/molecules/Modals/Modal/Modal.cjs +6 -5
  41. package/dist/components/molecules/Modals/Modal/Modal.cjs.map +1 -1
  42. package/dist/components/molecules/Modals/Modal/Modal.d.ts.map +1 -1
  43. package/dist/components/molecules/Modals/Modal/Modal.js +6 -5
  44. package/dist/components/molecules/Modals/Modal/Modal.js.map +1 -1
  45. package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.cjs +1 -1
  46. package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts +1 -1
  47. package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts.map +1 -1
  48. package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.js +1 -1
  49. package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts +1 -1
  50. package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +1 -1
  51. package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +4 -1
  52. package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
  53. package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  54. package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +5 -2
  55. package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
  56. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs +11 -6
  57. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs.map +1 -1
  58. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts +4 -2
  59. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts.map +1 -1
  60. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js +12 -7
  61. package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js.map +1 -1
  62. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs +53 -0
  63. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs.map +1 -0
  64. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts +41 -0
  65. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts.map +1 -0
  66. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js +51 -0
  67. package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js.map +1 -0
  68. package/dist/components/organisms/FilterBar/index.cjs +19 -7
  69. package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
  70. package/dist/components/organisms/FilterBar/index.d.ts +1 -0
  71. package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
  72. package/dist/components/organisms/FilterBar/index.js +18 -7
  73. package/dist/components/organisms/FilterBar/index.js.map +1 -1
  74. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs +2 -0
  75. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -1
  76. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts +10 -0
  77. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -1
  78. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +2 -0
  79. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js.map +1 -1
  80. package/dist/components/organisms/SlideoutMenu/index.cjs +3 -1
  81. package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
  82. package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
  83. package/dist/components/organisms/SlideoutMenu/index.js +3 -1
  84. package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
  85. package/dist/components/organisms/Table/index.cjs +14 -244
  86. package/dist/components/organisms/Table/index.cjs.map +1 -1
  87. package/dist/components/organisms/Table/index.d.ts +29 -124
  88. package/dist/components/organisms/Table/index.d.ts.map +1 -1
  89. package/dist/components/organisms/Table/index.js +13 -243
  90. package/dist/components/organisms/Table/index.js.map +1 -1
  91. package/dist/components/organisms/Tables/Table/Table.cjs +305 -0
  92. package/dist/components/organisms/Tables/Table/Table.cjs.map +1 -0
  93. package/dist/components/organisms/Tables/Table/Table.d.ts +146 -0
  94. package/dist/components/organisms/Tables/Table/Table.d.ts.map +1 -0
  95. package/dist/components/organisms/Tables/Table/Table.js +301 -0
  96. package/dist/components/organisms/Tables/Table/Table.js.map +1 -0
  97. package/dist/components/organisms/Tables/Table/Table.styles.cjs +29 -0
  98. package/dist/components/organisms/Tables/Table/Table.styles.cjs.map +1 -0
  99. package/dist/components/organisms/Tables/Table/Table.styles.d.ts +16 -0
  100. package/dist/components/organisms/Tables/Table/Table.styles.d.ts.map +1 -0
  101. package/dist/components/organisms/Tables/Table/Table.styles.js +27 -0
  102. package/dist/components/organisms/Tables/Table/Table.styles.js.map +1 -0
  103. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.cjs +2 -2
  104. package/dist/components/organisms/Tables/Table/components/TableCardList.cjs.map +1 -0
  105. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.d.ts +1 -1
  106. package/dist/components/organisms/Tables/Table/components/TableCardList.d.ts.map +1 -0
  107. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.js +2 -2
  108. package/dist/components/organisms/Tables/Table/components/TableCardList.js.map +1 -0
  109. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.cjs +10 -5
  110. package/dist/components/organisms/Tables/Table/components/TableCardRow.cjs.map +1 -0
  111. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.d.ts +1 -1
  112. package/dist/components/organisms/Tables/Table/components/TableCardRow.d.ts.map +1 -0
  113. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.js +11 -6
  114. package/dist/components/organisms/Tables/Table/components/TableCardRow.js.map +1 -0
  115. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.cjs +2 -2
  116. package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.cjs.map +1 -0
  117. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.d.ts +3 -1
  118. package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.d.ts.map +1 -0
  119. package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.js +2 -2
  120. package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.js.map +1 -0
  121. package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs +17 -0
  122. package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs.map +1 -0
  123. package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts +5 -0
  124. package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts.map +1 -0
  125. package/dist/components/organisms/Tables/Table/components/TableEmptyState.js +15 -0
  126. package/dist/components/organisms/Tables/Table/components/TableEmptyState.js.map +1 -0
  127. package/dist/components/organisms/Tables/Table/components/TableFallbackCard.cjs.map +1 -0
  128. package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.d.ts +1 -1
  129. package/dist/components/organisms/Tables/Table/components/TableFallbackCard.d.ts.map +1 -0
  130. package/dist/components/organisms/Tables/Table/components/TableFallbackCard.js.map +1 -0
  131. package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.cjs +6 -5
  132. package/dist/components/organisms/Tables/Table/components/TableRowCard.cjs.map +1 -0
  133. package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.d.ts +1 -1
  134. package/dist/components/organisms/Tables/Table/components/TableRowCard.d.ts.map +1 -0
  135. package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.js +6 -5
  136. package/dist/components/organisms/Tables/Table/components/TableRowCard.js.map +1 -0
  137. package/dist/components/organisms/Tables/Table/components/TableSortIcon.cjs.map +1 -0
  138. package/dist/components/organisms/Tables/Table/components/TableSortIcon.d.ts.map +1 -0
  139. package/dist/components/organisms/Tables/Table/components/TableSortIcon.js.map +1 -0
  140. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.cjs +22 -0
  141. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.cjs.map +1 -0
  142. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts +12 -0
  143. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts.map +1 -0
  144. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.js +20 -0
  145. package/dist/components/organisms/Tables/Table/hooks/useBusyCount.js.map +1 -0
  146. package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.cjs +1 -1
  147. package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.cjs.map +1 -0
  148. package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.d.ts.map +1 -0
  149. package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.js +1 -1
  150. package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.js.map +1 -0
  151. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.cjs +42 -0
  152. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
  153. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts +14 -0
  154. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
  155. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js +40 -0
  156. package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js.map +1 -0
  157. package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.cjs +8 -11
  158. package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.cjs.map +1 -0
  159. package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.d.ts +10 -3
  160. package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.d.ts.map +1 -0
  161. package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.js +9 -12
  162. package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.js.map +1 -0
  163. package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.cjs.map +1 -0
  164. package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.d.ts +1 -1
  165. package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.d.ts.map +1 -0
  166. package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.js.map +1 -0
  167. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs +83 -0
  168. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs.map +1 -0
  169. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts +23 -0
  170. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts.map +1 -0
  171. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js +81 -0
  172. package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js.map +1 -0
  173. package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.cjs +12 -4
  174. package/dist/components/organisms/Tables/Table/hooks/useTableSelection.cjs.map +1 -0
  175. package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.d.ts +5 -3
  176. package/dist/components/organisms/Tables/Table/hooks/useTableSelection.d.ts.map +1 -0
  177. package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.js +12 -4
  178. package/dist/components/organisms/Tables/Table/hooks/useTableSelection.js.map +1 -0
  179. package/dist/components/organisms/Tables/Table/providers/Table.context.cjs.map +1 -0
  180. package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.d.ts +14 -2
  181. package/dist/components/organisms/Tables/Table/providers/Table.context.d.ts.map +1 -0
  182. package/dist/components/organisms/Tables/Table/providers/Table.context.js.map +1 -0
  183. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs +55 -0
  184. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs.map +1 -0
  185. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts +25 -0
  186. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts.map +1 -0
  187. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js +51 -0
  188. package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js.map +1 -0
  189. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.cjs +57 -0
  190. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.cjs.map +1 -0
  191. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts +66 -0
  192. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts.map +1 -0
  193. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js +52 -0
  194. package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js.map +1 -0
  195. package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.cjs +21 -21
  196. package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.cjs.map +1 -0
  197. package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.d.ts +29 -19
  198. package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.d.ts.map +1 -0
  199. package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.js +20 -21
  200. package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.js.map +1 -0
  201. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs +34 -0
  202. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs.map +1 -0
  203. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts +37 -0
  204. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts.map +1 -0
  205. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js +32 -0
  206. package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js.map +1 -0
  207. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs +32 -0
  208. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs.map +1 -0
  209. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts +21 -0
  210. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts.map +1 -0
  211. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js +30 -0
  212. package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js.map +1 -0
  213. package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.cjs +12 -5
  214. package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.cjs.map +1 -0
  215. package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts +47 -0
  216. package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts.map +1 -0
  217. package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.js +12 -5
  218. package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.js.map +1 -0
  219. package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.cjs.map +1 -0
  220. package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.d.ts.map +1 -0
  221. package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.js.map +1 -0
  222. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs +84 -0
  223. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs.map +1 -0
  224. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts +20 -0
  225. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts.map +1 -0
  226. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js +81 -0
  227. package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js.map +1 -0
  228. package/dist/components/organisms/Tables/index.cjs +14 -0
  229. package/dist/components/organisms/Tables/index.cjs.map +1 -0
  230. package/dist/components/organisms/Tables/index.d.ts +19 -0
  231. package/dist/components/organisms/Tables/index.d.ts.map +1 -0
  232. package/dist/components/organisms/Tables/index.js +4 -0
  233. package/dist/components/organisms/Tables/index.js.map +1 -0
  234. package/dist/components/organisms/{Table/table.types.d.ts → Tables/tables.types.d.ts} +12 -2
  235. package/dist/components/organisms/Tables/tables.types.d.ts.map +1 -0
  236. package/dist/components/organisms/Tables/utilities/tableCard.utils.cjs.map +1 -0
  237. package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.d.ts +2 -2
  238. package/dist/components/organisms/Tables/utilities/tableCard.utils.d.ts.map +1 -0
  239. package/dist/components/organisms/Tables/utilities/tableCard.utils.js.map +1 -0
  240. package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.cjs +7 -4
  241. package/dist/components/organisms/Tables/utilities/tableChildren.utils.cjs.map +1 -0
  242. package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.d.ts +5 -3
  243. package/dist/components/organisms/Tables/utilities/tableChildren.utils.d.ts.map +1 -0
  244. package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.js +7 -4
  245. package/dist/components/organisms/Tables/utilities/tableChildren.utils.js.map +1 -0
  246. package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs +23 -0
  247. package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs.map +1 -0
  248. package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts +8 -0
  249. package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts.map +1 -0
  250. package/dist/components/organisms/Tables/utilities/tableIterable.utils.js +21 -0
  251. package/dist/components/organisms/Tables/utilities/tableIterable.utils.js.map +1 -0
  252. package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.cjs +1 -1
  253. package/dist/components/organisms/Tables/utilities/tableSort.utils.cjs.map +1 -0
  254. package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.d.ts +1 -1
  255. package/dist/components/organisms/Tables/utilities/tableSort.utils.d.ts.map +1 -0
  256. package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.js +1 -1
  257. package/dist/components/organisms/Tables/utilities/tableSort.utils.js.map +1 -0
  258. package/dist/hooks/useFocusAfterRetry/index.cjs +21 -19
  259. package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
  260. package/dist/hooks/useFocusAfterRetry/index.d.ts +15 -5
  261. package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
  262. package/dist/hooks/useFocusAfterRetry/index.js +21 -19
  263. package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
  264. package/dist/hooks/useFocusHandOff/index.cjs +67 -0
  265. package/dist/hooks/useFocusHandOff/index.cjs.map +1 -0
  266. package/dist/hooks/useFocusHandOff/index.d.ts +17 -0
  267. package/dist/hooks/useFocusHandOff/index.d.ts.map +1 -0
  268. package/dist/hooks/useFocusHandOff/index.js +65 -0
  269. package/dist/hooks/useFocusHandOff/index.js.map +1 -0
  270. package/dist/hooks/useListQueryParams/index.cjs +238 -0
  271. package/dist/hooks/useListQueryParams/index.cjs.map +1 -0
  272. package/dist/hooks/useListQueryParams/index.d.ts +77 -0
  273. package/dist/hooks/useListQueryParams/index.d.ts.map +1 -0
  274. package/dist/hooks/useListQueryParams/index.js +236 -0
  275. package/dist/hooks/useListQueryParams/index.js.map +1 -0
  276. package/dist/hooks/useLoadState/index.cjs +69 -0
  277. package/dist/hooks/useLoadState/index.cjs.map +1 -0
  278. package/dist/hooks/useLoadState/index.d.ts +44 -0
  279. package/dist/hooks/useLoadState/index.d.ts.map +1 -0
  280. package/dist/hooks/useLoadState/index.js +67 -0
  281. package/dist/hooks/useLoadState/index.js.map +1 -0
  282. package/dist/hooks/usePagedList/index.cjs +61 -0
  283. package/dist/hooks/usePagedList/index.cjs.map +1 -0
  284. package/dist/hooks/usePagedList/index.d.ts +56 -0
  285. package/dist/hooks/usePagedList/index.d.ts.map +1 -0
  286. package/dist/hooks/usePagedList/index.js +59 -0
  287. package/dist/hooks/usePagedList/index.js.map +1 -0
  288. package/dist/native/components/atoms/LiveStatus/index.d.ts +12 -0
  289. package/dist/native/components/organisms/Tables/index.d.ts +12 -0
  290. package/dist/native/hooks/useFocusHandOff/index.d.ts +12 -0
  291. package/dist/native/hooks/useListQueryParams/index.d.ts +12 -0
  292. package/dist/native/hooks/useLoadState/index.d.ts +12 -0
  293. package/dist/native/hooks/usePagedList/index.d.ts +12 -0
  294. package/dist/native/utilities/listQueryUtils/index.d.ts +12 -0
  295. package/dist/styles.css +12 -0
  296. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.cjs +9 -0
  297. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.cjs.map +1 -0
  298. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.d.ts +8 -0
  299. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.d.ts.map +1 -0
  300. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.js +9 -1
  301. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.js.map +1 -0
  302. package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs +47 -0
  303. package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs.map +1 -0
  304. package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts +51 -0
  305. package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts.map +1 -0
  306. package/dist/utilities/__internal__/listStateUtils/listState.utils.js +43 -0
  307. package/dist/utilities/__internal__/listStateUtils/listState.utils.js.map +1 -0
  308. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs +67 -0
  309. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs.map +1 -0
  310. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts +27 -0
  311. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts.map +1 -0
  312. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js +64 -0
  313. package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js.map +1 -0
  314. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs +28 -0
  315. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs.map +1 -1
  316. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts +10 -0
  317. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts.map +1 -1
  318. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js +28 -1
  319. package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js.map +1 -1
  320. package/dist/utilities/listQueryUtils/index.cjs +59 -0
  321. package/dist/utilities/listQueryUtils/index.cjs.map +1 -0
  322. package/dist/utilities/listQueryUtils/index.d.ts +46 -0
  323. package/dist/utilities/listQueryUtils/index.d.ts.map +1 -0
  324. package/dist/utilities/listQueryUtils/index.js +55 -0
  325. package/dist/utilities/listQueryUtils/index.js.map +1 -0
  326. package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs +2 -0
  327. package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs.map +1 -1
  328. package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts +2 -0
  329. package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts.map +1 -1
  330. package/dist/utilities/localStorageUtils/localStorageUtils.constants.js +2 -0
  331. package/dist/utilities/localStorageUtils/localStorageUtils.constants.js.map +1 -1
  332. package/package.json +9 -9
  333. package/dist/components/forms/Form/utilities/focusFromCode.utils.cjs.map +0 -1
  334. package/dist/components/forms/Form/utilities/focusFromCode.utils.d.ts.map +0 -1
  335. package/dist/components/forms/Form/utilities/focusFromCode.utils.js.map +0 -1
  336. package/dist/components/organisms/Table/components/TableCardList.cjs.map +0 -1
  337. package/dist/components/organisms/Table/components/TableCardList.d.ts.map +0 -1
  338. package/dist/components/organisms/Table/components/TableCardList.js.map +0 -1
  339. package/dist/components/organisms/Table/components/TableCardRow.cjs.map +0 -1
  340. package/dist/components/organisms/Table/components/TableCardRow.d.ts.map +0 -1
  341. package/dist/components/organisms/Table/components/TableCardRow.js.map +0 -1
  342. package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs.map +0 -1
  343. package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts.map +0 -1
  344. package/dist/components/organisms/Table/components/TableCardsSelectAll.js.map +0 -1
  345. package/dist/components/organisms/Table/components/TableFallbackCard.cjs.map +0 -1
  346. package/dist/components/organisms/Table/components/TableFallbackCard.d.ts.map +0 -1
  347. package/dist/components/organisms/Table/components/TableFallbackCard.js.map +0 -1
  348. package/dist/components/organisms/Table/components/TableFocusGuard.cjs +0 -23
  349. package/dist/components/organisms/Table/components/TableFocusGuard.cjs.map +0 -1
  350. package/dist/components/organisms/Table/components/TableFocusGuard.d.ts +0 -2
  351. package/dist/components/organisms/Table/components/TableFocusGuard.d.ts.map +0 -1
  352. package/dist/components/organisms/Table/components/TableFocusGuard.js +0 -21
  353. package/dist/components/organisms/Table/components/TableFocusGuard.js.map +0 -1
  354. package/dist/components/organisms/Table/components/TableLayoutToggle.cjs +0 -27
  355. package/dist/components/organisms/Table/components/TableLayoutToggle.cjs.map +0 -1
  356. package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts +0 -17
  357. package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts.map +0 -1
  358. package/dist/components/organisms/Table/components/TableLayoutToggle.js +0 -25
  359. package/dist/components/organisms/Table/components/TableLayoutToggle.js.map +0 -1
  360. package/dist/components/organisms/Table/components/TableRowCard.cjs.map +0 -1
  361. package/dist/components/organisms/Table/components/TableRowCard.d.ts.map +0 -1
  362. package/dist/components/organisms/Table/components/TableRowCard.js.map +0 -1
  363. package/dist/components/organisms/Table/components/TableSortIcon.cjs.map +0 -1
  364. package/dist/components/organisms/Table/components/TableSortIcon.d.ts.map +0 -1
  365. package/dist/components/organisms/Table/components/TableSortIcon.js.map +0 -1
  366. package/dist/components/organisms/Table/components/TableSortMenu.cjs.map +0 -1
  367. package/dist/components/organisms/Table/components/TableSortMenu.d.ts +0 -35
  368. package/dist/components/organisms/Table/components/TableSortMenu.d.ts.map +0 -1
  369. package/dist/components/organisms/Table/components/TableSortMenu.js.map +0 -1
  370. package/dist/components/organisms/Table/hooks/useFirstSortDirection.cjs.map +0 -1
  371. package/dist/components/organisms/Table/hooks/useFirstSortDirection.d.ts.map +0 -1
  372. package/dist/components/organisms/Table/hooks/useFirstSortDirection.js.map +0 -1
  373. package/dist/components/organisms/Table/hooks/useIsAtLeastMd.cjs.map +0 -1
  374. package/dist/components/organisms/Table/hooks/useIsAtLeastMd.d.ts.map +0 -1
  375. package/dist/components/organisms/Table/hooks/useIsAtLeastMd.js.map +0 -1
  376. package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs.map +0 -1
  377. package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts.map +0 -1
  378. package/dist/components/organisms/Table/hooks/usePlaceholderRows.js.map +0 -1
  379. package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.cjs.map +0 -1
  380. package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.d.ts.map +0 -1
  381. package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.js.map +0 -1
  382. package/dist/components/organisms/Table/hooks/useTableSelection.cjs.map +0 -1
  383. package/dist/components/organisms/Table/hooks/useTableSelection.d.ts.map +0 -1
  384. package/dist/components/organisms/Table/hooks/useTableSelection.js.map +0 -1
  385. package/dist/components/organisms/Table/providers/Table.context.cjs.map +0 -1
  386. package/dist/components/organisms/Table/providers/Table.context.d.ts.map +0 -1
  387. package/dist/components/organisms/Table/providers/Table.context.js.map +0 -1
  388. package/dist/components/organisms/Table/table.types.d.ts.map +0 -1
  389. package/dist/components/organisms/Table/utilities/tableCard.utils.cjs.map +0 -1
  390. package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts.map +0 -1
  391. package/dist/components/organisms/Table/utilities/tableCard.utils.js.map +0 -1
  392. package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs.map +0 -1
  393. package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts.map +0 -1
  394. package/dist/components/organisms/Table/utilities/tableChildren.utils.js.map +0 -1
  395. package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs.map +0 -1
  396. package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts.map +0 -1
  397. package/dist/components/organisms/Table/utilities/tableSelection.utils.js.map +0 -1
  398. package/dist/components/organisms/Table/utilities/tableSort.utils.cjs.map +0 -1
  399. package/dist/components/organisms/Table/utilities/tableSort.utils.d.ts.map +0 -1
  400. package/dist/components/organisms/Table/utilities/tableSort.utils.js.map +0 -1
  401. /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.cjs +0 -0
  402. /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.js +0 -0
  403. /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.cjs +0 -0
  404. /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.d.ts +0 -0
  405. /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.js +0 -0
  406. /package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.d.ts +0 -0
  407. /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.cjs +0 -0
  408. /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.js +0 -0
  409. /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.cjs +0 -0
  410. /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.js +0 -0
  411. /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.cjs +0 -0
  412. /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.d.ts +0 -0
  413. /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.js +0 -0
  414. /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.cjs +0 -0
  415. /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.js +0 -0
@@ -0,0 +1,51 @@
1
+ // What react-aria renders for something a press acts on: a button, a link, or a link with no `href` as `role="link"`; and a native input button.
2
+ const CONTROL_SELECTOR = 'button, a[href], [role="button"], [role="link"], input[type="submit"], input[type="button"], input[type="reset"], input[type="image"]';
3
+ /**
4
+ * Finds the control a press inside a table's empty state landed on, which a hand-off waits on to leave the page.
5
+ * @param target - The event's target. React passes on an event from a modal or popover the empty state opened, but its
6
+ * target sits in a portal, outside `scope`.
7
+ * @param scope - The element around the empty state.
8
+ * @returns The nearest enabled button or link around the target, when it sits inside `scope`; `null` for a press on text,
9
+ * on a disabled control, or outside `scope`.
10
+ */
11
+ const pressedControlOf = (target, scope) => {
12
+ if (!(target instanceof Element))
13
+ return null;
14
+ const control = target.closest(CONTROL_SELECTOR);
15
+ if (!control || !scope.contains(control) || control.matches(':disabled, [aria-disabled="true"]'))
16
+ return null;
17
+ return control;
18
+ };
19
+ // A link as react-aria reads one: `Space` scrolls past it, and only `Enter` presses it; `role="button"` on an anchor makes it a button.
20
+ const LINK_SELECTOR = '[role="link"], a[href]:not([role])';
21
+ /**
22
+ * Whether a key pressed on a control presses it, so a hand-off should wait on it.
23
+ * @param control - The control the key landed on, from `pressedControlOf`.
24
+ * @param key - The event's `key`.
25
+ * @returns `true` for `Enter` on any control and `Space` on any but a link; `false` for every other key.
26
+ */
27
+ const isPressKey = (control, key) => key === 'Enter' || (key === ' ' && !control.matches(LINK_SELECTOR));
28
+ /**
29
+ * Watches for the user moving on from a pressed control that is still on the page: a pointer press, or focus, anywhere
30
+ * outside it, such as a click on blank space or a modal the control opened taking focus.
31
+ * @param control - The pressed control; a press on it again, or focus returning to it, is not moving on.
32
+ * @param onLeave - Called on each such press or focus, until the watch stops.
33
+ * @returns Stops the watch.
34
+ */
35
+ const watchForLeaving = (control, onLeave) => {
36
+ const { ownerDocument } = control;
37
+ const leaveIfOutside = (event) => {
38
+ if (!(event.target instanceof Node) || !control.contains(event.target))
39
+ onLeave();
40
+ };
41
+ // In capture, so an element that stops a press or focus event from propagating still ends the watch.
42
+ ownerDocument.addEventListener('pointerdown', leaveIfOutside, true);
43
+ ownerDocument.addEventListener('focusin', leaveIfOutside, true);
44
+ return () => {
45
+ ownerDocument.removeEventListener('pointerdown', leaveIfOutside, true);
46
+ ownerDocument.removeEventListener('focusin', leaveIfOutside, true);
47
+ };
48
+ };
49
+
50
+ export { isPressKey, pressedControlOf, watchForLeaving };
51
+ //# sourceMappingURL=tableFocusHandOff.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableFocusHandOff.utils.js","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,MAAM,gBAAgB,GACpB,uIAAuI;AAEzI;;;;;;;AAOG;MACU,gBAAgB,GAAG,CAAC,MAA0B,EAAE,KAAc,KAAoB;AAC7F,IAAA,IAAI,EAAE,MAAM,YAAY,OAAO,CAAC;AAAE,QAAA,OAAO,IAAI;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAChD,IAAA,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,mCAAmC,CAAC;AAAE,QAAA,OAAO,IAAI;AAC7G,IAAA,OAAO,OAAO;AAChB;AAEA;AACA,MAAM,aAAa,GAAG,oCAAoC;AAE1D;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,GAAW,KAAc,GAAG,KAAK,OAAO,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;AAExI;;;;;;AAMG;MACU,eAAe,GAAG,CAAC,OAAgB,EAAE,OAAmB,KAAkB;AACrF,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO;AACjC,IAAA,MAAM,cAAc,GAAG,CAAC,KAAY,KAAI;AACtC,QAAA,IAAI,EAAE,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;AAAE,YAAA,OAAO,EAAE;AACnF,IAAA,CAAC;;IAED,aAAa,CAAC,gBAAgB,CAAC,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC;IACnE,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC;AAC/D,IAAA,OAAO,MAAK;QACV,aAAa,CAAC,mBAAmB,CAAC,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC;QACtE,aAAa,CAAC,mBAAmB,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC;AACpE,IAAA,CAAC;AACH;;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var children_utils = require('../../../../../utilities/__internal__/childrenUtils/children.utils.cjs');
5
+
6
+ /**
7
+ * Names the rows a `Table` draws while `isLoading`, so each keeps its id, and with it its test id, from render to render.
8
+ * @param count - The table's `loadingRowCount`; a fraction rounds down, and a negative or non-finite count draws none.
9
+ * @returns `loading-0`, `loading-1` and so on, one per row.
10
+ */
11
+ const loadingRowIdsOf = (count) => {
12
+ const rowCount = Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
13
+ return Array.from({ length: rowCount }, (_, index) => `loading-${index}`);
14
+ };
15
+ /**
16
+ * Splits a table's `loadingRow` into the cells and the card each loading row renders, with a default for the part it leaves out.
17
+ * @param loadingRow - What the page passed: `Table.Cell`s and/or a `Table.RowCard.Skeleton`, possibly in a fragment; nothing
18
+ * for the defaults.
19
+ * @param columns - The columns `Table.Header` declares, so the default cells fill the row; none when the table found no
20
+ * `Table.Header` among its direct children.
21
+ * @param defaults - The table's own parts; see `LoadingRowDefaults`.
22
+ * @returns Its cells, or one default cell per column when it has none, and its first `Table.RowCard.Skeleton`, or the default
23
+ * card. A `Table.RowCard` among them is dropped: a loading row's card is always a skeleton, which is what keeps it a placeholder.
24
+ */
25
+ const loadingRowPartsOf = (loadingRow, columns, defaults) => {
26
+ const parts = children_utils.flattenChildren(loadingRow);
27
+ const isCardPart = (part) => React.isValidElement(part) && defaults.isCard(part);
28
+ const cells = parts.filter((part) => !isCardPart(part));
29
+ const card = parts.find((part) => isCardPart(part) && defaults.isSkeletonCard(part));
30
+ return {
31
+ cells: cells.length > 0 ? cells : columns.map((column, index) => defaults.cellOf(index, column.isRowHeader)),
32
+ card: card ?? defaults.card,
33
+ };
34
+ };
35
+ /**
36
+ * Says whether a table can draw its loading rows: in the table each needs a cell per column, and react-aria throws on a row
37
+ * with none; a card needs no cell.
38
+ * @param layout - The layout the table renders.
39
+ * @param cellCount - The cells each loading row has, from `loadingRow` or one per column the table found.
40
+ * @returns `false` only for the table layout with no cells, as when `Table.Header` is rendered by another component and
41
+ * `loadingRow` gives no cells of its own.
42
+ */
43
+ const canDrawLoadingRows = (layout, cellCount) => layout === 'cards' || cellCount > 0;
44
+ /**
45
+ * Swaps the page's rows in `Table.Body`'s props for the loading rows while the table loads, so a page can keep passing its rows.
46
+ * @param props - `Table.Body`'s props as the page wrote them.
47
+ * @param loadingRows - The rows the table draws while loading; `undefined` while it is not loading.
48
+ * @returns The props unchanged when not loading; otherwise the loading rows as `children`, with no `items`, `dependencies` or
49
+ * `renderEmptyState`, so neither the page's collection nor its empty state renders.
50
+ */
51
+ const loadingBodyPropsOf = (props, loadingRows) => loadingRows === undefined ? props : { ...props, items: undefined, dependencies: undefined, renderEmptyState: undefined, children: loadingRows };
52
+
53
+ exports.canDrawLoadingRows = canDrawLoadingRows;
54
+ exports.loadingBodyPropsOf = loadingBodyPropsOf;
55
+ exports.loadingRowIdsOf = loadingRowIdsOf;
56
+ exports.loadingRowPartsOf = loadingRowPartsOf;
57
+ //# sourceMappingURL=tableLoading.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableLoading.utils.cjs","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableLoading.utils.ts"],"sourcesContent":[null],"names":["flattenChildren","isValidElement"],"mappings":";;;;;AAIA;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAa,KAAc;AACzD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;IAC5E,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,CAAA,QAAA,EAAW,KAAK,CAAA,CAAE,CAAC;AAC3E;AAyBA;;;;;;;;;AASG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAqB,EAAE,OAAmC,EAAE,QAA4B,KAAqB;AAC7I,IAAA,MAAM,KAAK,GAAGA,8BAAe,CAAC,UAAU,CAAC;AACzC,IAAA,MAAM,UAAU,GAAG,CAAC,IAAe,KAA2BC,oBAAc,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;AAC3G,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAA2B,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1G,OAAO;AACL,QAAA,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,KAAK,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5G,QAAA,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;KAC5B;AACH;AAEA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,SAAiB,KAAc,MAAM,KAAK,OAAO,IAAI,SAAS,GAAG;AAUzH;;;;;;AAMG;AACI,MAAM,kBAAkB,GAAG,CAA6B,KAAQ,EAAE,WAAkC,KACzG,WAAW,KAAK,SAAS,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW;;;;;"}
@@ -0,0 +1,66 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { TableCardColumn, TableLayout } from '../../tables.types';
3
+ /**
4
+ * Names the rows a `Table` draws while `isLoading`, so each keeps its id, and with it its test id, from render to render.
5
+ * @param count - The table's `loadingRowCount`; a fraction rounds down, and a negative or non-finite count draws none.
6
+ * @returns `loading-0`, `loading-1` and so on, one per row.
7
+ */
8
+ export declare const loadingRowIdsOf: (count: number) => string[];
9
+ /** The table's own parts for a loading row, passed in so this file renders nothing itself. */
10
+ export interface LoadingRowDefaults {
11
+ /** Tells a `Table.RowCard` or a `Table.RowCard.Skeleton` apart from a cell. */
12
+ isCard: (element: ReactElement) => boolean;
13
+ /** Tells a `Table.RowCard.Skeleton` apart from a `Table.RowCard`. */
14
+ isSkeletonCard: (element: ReactElement) => boolean;
15
+ /**
16
+ * The cell for one column when `loadingRow` has none, keyed by the column's position; a row-header column's cell also
17
+ * names the row, as its empty `rowheader` would leave the row with no name.
18
+ */
19
+ cellOf: (column: number, isRowHeader: boolean) => ReactNode;
20
+ /** The card when `loadingRow` has no `Table.RowCard.Skeleton`. */
21
+ card: ReactElement;
22
+ }
23
+ /** The cells and the card every loading row renders. */
24
+ export interface LoadingRowParts {
25
+ /** One per column, in order; the table renders them, the cards layout ignores them. */
26
+ cells: ReactNode[];
27
+ /** A `Table.RowCard.Skeleton`, which also makes the row a placeholder in the table. */
28
+ card: ReactElement;
29
+ }
30
+ /**
31
+ * Splits a table's `loadingRow` into the cells and the card each loading row renders, with a default for the part it leaves out.
32
+ * @param loadingRow - What the page passed: `Table.Cell`s and/or a `Table.RowCard.Skeleton`, possibly in a fragment; nothing
33
+ * for the defaults.
34
+ * @param columns - The columns `Table.Header` declares, so the default cells fill the row; none when the table found no
35
+ * `Table.Header` among its direct children.
36
+ * @param defaults - The table's own parts; see `LoadingRowDefaults`.
37
+ * @returns Its cells, or one default cell per column when it has none, and its first `Table.RowCard.Skeleton`, or the default
38
+ * card. A `Table.RowCard` among them is dropped: a loading row's card is always a skeleton, which is what keeps it a placeholder.
39
+ */
40
+ export declare const loadingRowPartsOf: (loadingRow: ReactNode, columns: readonly TableCardColumn[], defaults: LoadingRowDefaults) => LoadingRowParts;
41
+ /**
42
+ * Says whether a table can draw its loading rows: in the table each needs a cell per column, and react-aria throws on a row
43
+ * with none; a card needs no cell.
44
+ * @param layout - The layout the table renders.
45
+ * @param cellCount - The cells each loading row has, from `loadingRow` or one per column the table found.
46
+ * @returns `false` only for the table layout with no cells, as when `Table.Header` is rendered by another component and
47
+ * `loadingRow` gives no cells of its own.
48
+ */
49
+ export declare const canDrawLoadingRows: (layout: TableLayout, cellCount: number) => boolean;
50
+ /** The props of `Table.Body` that the loading rows replace. */
51
+ interface LoadingBodyProps {
52
+ items?: unknown;
53
+ dependencies?: unknown;
54
+ renderEmptyState?: unknown;
55
+ children?: unknown;
56
+ }
57
+ /**
58
+ * Swaps the page's rows in `Table.Body`'s props for the loading rows while the table loads, so a page can keep passing its rows.
59
+ * @param props - `Table.Body`'s props as the page wrote them.
60
+ * @param loadingRows - The rows the table draws while loading; `undefined` while it is not loading.
61
+ * @returns The props unchanged when not loading; otherwise the loading rows as `children`, with no `items`, `dependencies` or
62
+ * `renderEmptyState`, so neither the page's collection nor its empty state renders.
63
+ */
64
+ export declare const loadingBodyPropsOf: <P extends LoadingBodyProps>(props: P, loadingRows: ReactNode | undefined) => P;
65
+ export {};
66
+ //# sourceMappingURL=tableLoading.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableLoading.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableLoading.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,MAAM,EAGrD,CAAC;AAEF,8FAA8F;AAC9F,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC;IAC3C,qEAAqE;IACrE,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC;IACnD;;;OAGG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,SAAS,CAAC;IAC5D,kEAAkE;IAClE,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,uFAAuF;IACvF,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,SAAS,EAAE,SAAS,SAAS,eAAe,EAAE,EAAE,UAAU,kBAAkB,KAAG,eAS5H,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,WAAW,EAAE,WAAW,MAAM,KAAG,OAA8C,CAAC;AAE3H,+DAA+D;AAC/D,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,gBAAgB,EAAE,OAAO,CAAC,EAAE,aAAa,SAAS,GAAG,SAAS,KAAG,CACmC,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { isValidElement } from 'react';
2
+ import { flattenChildren } from '../../../../../utilities/__internal__/childrenUtils/children.utils.js';
3
+
4
+ /**
5
+ * Names the rows a `Table` draws while `isLoading`, so each keeps its id, and with it its test id, from render to render.
6
+ * @param count - The table's `loadingRowCount`; a fraction rounds down, and a negative or non-finite count draws none.
7
+ * @returns `loading-0`, `loading-1` and so on, one per row.
8
+ */
9
+ const loadingRowIdsOf = (count) => {
10
+ const rowCount = Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
11
+ return Array.from({ length: rowCount }, (_, index) => `loading-${index}`);
12
+ };
13
+ /**
14
+ * Splits a table's `loadingRow` into the cells and the card each loading row renders, with a default for the part it leaves out.
15
+ * @param loadingRow - What the page passed: `Table.Cell`s and/or a `Table.RowCard.Skeleton`, possibly in a fragment; nothing
16
+ * for the defaults.
17
+ * @param columns - The columns `Table.Header` declares, so the default cells fill the row; none when the table found no
18
+ * `Table.Header` among its direct children.
19
+ * @param defaults - The table's own parts; see `LoadingRowDefaults`.
20
+ * @returns Its cells, or one default cell per column when it has none, and its first `Table.RowCard.Skeleton`, or the default
21
+ * card. A `Table.RowCard` among them is dropped: a loading row's card is always a skeleton, which is what keeps it a placeholder.
22
+ */
23
+ const loadingRowPartsOf = (loadingRow, columns, defaults) => {
24
+ const parts = flattenChildren(loadingRow);
25
+ const isCardPart = (part) => isValidElement(part) && defaults.isCard(part);
26
+ const cells = parts.filter((part) => !isCardPart(part));
27
+ const card = parts.find((part) => isCardPart(part) && defaults.isSkeletonCard(part));
28
+ return {
29
+ cells: cells.length > 0 ? cells : columns.map((column, index) => defaults.cellOf(index, column.isRowHeader)),
30
+ card: card ?? defaults.card,
31
+ };
32
+ };
33
+ /**
34
+ * Says whether a table can draw its loading rows: in the table each needs a cell per column, and react-aria throws on a row
35
+ * with none; a card needs no cell.
36
+ * @param layout - The layout the table renders.
37
+ * @param cellCount - The cells each loading row has, from `loadingRow` or one per column the table found.
38
+ * @returns `false` only for the table layout with no cells, as when `Table.Header` is rendered by another component and
39
+ * `loadingRow` gives no cells of its own.
40
+ */
41
+ const canDrawLoadingRows = (layout, cellCount) => layout === 'cards' || cellCount > 0;
42
+ /**
43
+ * Swaps the page's rows in `Table.Body`'s props for the loading rows while the table loads, so a page can keep passing its rows.
44
+ * @param props - `Table.Body`'s props as the page wrote them.
45
+ * @param loadingRows - The rows the table draws while loading; `undefined` while it is not loading.
46
+ * @returns The props unchanged when not loading; otherwise the loading rows as `children`, with no `items`, `dependencies` or
47
+ * `renderEmptyState`, so neither the page's collection nor its empty state renders.
48
+ */
49
+ const loadingBodyPropsOf = (props, loadingRows) => loadingRows === undefined ? props : { ...props, items: undefined, dependencies: undefined, renderEmptyState: undefined, children: loadingRows };
50
+
51
+ export { canDrawLoadingRows, loadingBodyPropsOf, loadingRowIdsOf, loadingRowPartsOf };
52
+ //# sourceMappingURL=tableLoading.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableLoading.utils.js","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableLoading.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAa,KAAc;AACzD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;IAC5E,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,CAAA,QAAA,EAAW,KAAK,CAAA,CAAE,CAAC;AAC3E;AAyBA;;;;;;;;;AASG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAqB,EAAE,OAAmC,EAAE,QAA4B,KAAqB;AAC7I,IAAA,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC;AACzC,IAAA,MAAM,UAAU,GAAG,CAAC,IAAe,KAA2B,cAAc,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;AAC3G,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAA2B,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1G,OAAO;AACL,QAAA,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,KAAK,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5G,QAAA,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;KAC5B;AACH;AAEA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,SAAiB,KAAc,MAAM,KAAK,OAAO,IAAI,SAAS,GAAG;AAUzH;;;;;;AAMG;AACI,MAAM,kBAAkB,GAAG,CAA6B,KAAQ,EAAE,WAAkC,KACzG,WAAW,KAAK,SAAS,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW;;"}
@@ -44,16 +44,33 @@ const reportSelectionChange = (selection, rowKeys, disabledKeys, listeners) => {
44
44
  listeners.onSelectedKeyChange?.(keyOfSelection(selection));
45
45
  listeners.onSelectedKeysChange?.(keysOfSelection(selection, rowKeys, disabledKeys));
46
46
  };
47
+ /**
48
+ * Says whether any mounted row with an `id` can be selected.
49
+ * @param rowKeys - Every mounted selectable row's id, as the table's row registry holds them.
50
+ * @param disabledKeys - Rows the table disables, which select all leaves out.
51
+ * @returns `true` while at least one such row can be selected.
52
+ */
53
+ const hasSelectableRow = (rowKeys, disabledKeys) => keysOfSelection('all', rowKeys, disabledKeys).length > 0;
54
+ /**
55
+ * Says whether the table knows its page is placeholders, so select all would only store `'all'` for the rows that load
56
+ * next: while it `isLoading`, or with a placeholder row mounted and no selectable one. Nothing else counts, so before any
57
+ * row registers, with rows that have no `id`, or on a page the consumer disabled, select all is react-aria's as ever.
58
+ * @param page - The table's loading state and its mounted rows; see `PlaceholderPage`.
59
+ * @returns `true` only for a page of placeholders.
60
+ */
61
+ const isPlaceholderPage = ({ isLoading, rowKeys, placeholderKeys, disabledKeys }) => isLoading || (Array.from(placeholderKeys).length > 0 && !hasSelectableRow(rowKeys, disabledKeys));
47
62
  /**
48
63
  * Works out the select-all checkbox from the selection and the rows on screen, as the table's header checkbox does.
49
64
  * @param selection - The current selection; `'all'` after select all.
50
65
  * @param rowKeys - Every mounted selectable row's id.
51
66
  * @param disabledKeys - Rows the table disables, which select all leaves out.
67
+ * @param isOnPlaceholderPage - Whether `isPlaceholderPage` holds, which turns the checkbox off at once, before the rows
68
+ * that are leaving have dropped out of `rowKeys`.
52
69
  * @returns Whether the checkbox is checked, indeterminate or disabled.
53
70
  */
54
- const selectAllStateOf = (selection, rowKeys, disabledKeys) => {
71
+ const selectAllStateOf = (selection, rowKeys, disabledKeys, isOnPlaceholderPage = false) => {
55
72
  const selectable = keysOfSelection('all', rowKeys, disabledKeys);
56
- if (selectable.length === 0)
73
+ if (isOnPlaceholderPage || selectable.length === 0)
57
74
  return { isSelected: false, isIndeterminate: false, isDisabled: true };
58
75
  if (selection === 'all')
59
76
  return { isSelected: true, isIndeterminate: false, isDisabled: false };
@@ -77,26 +94,9 @@ const selectAllToggleOf = (isSelected, disallowEmptySelection = false) => {
77
94
  return 'all';
78
95
  return disallowEmptySelection ? undefined : new Set();
79
96
  };
80
- /**
81
- * Says whether a table must drop its focused key before react-stately looks for a row to move focus to. That search can
82
- * loop for ever only when it meets disabled rows, or finds no body row at all, so the key goes in either case. The cost:
83
- * in a table with a disabled row, such as a placeholder, removing the focused row drops focus instead of moving it to a
84
- * neighbour.
85
- * @param focusedKey - The key the table's selection state holds as focused; `null` when nothing is.
86
- * @param hasKey - Whether the table's new collection still holds a key.
87
- * @param rows - The new collection's rows; only its body rows count.
88
- * @param isDisabled - Whether the table's selection manager counts a row as disabled, as placeholder rows are.
89
- * @returns `true` when the focused key is gone and a body row left is disabled, or none is left; `false` otherwise, so
90
- * react-aria still moves focus to a neighbouring row in a table with no disabled row.
91
- */
92
- const isFocusRecoveryAtRisk = (focusedKey, hasKey, rows, isDisabled) => {
93
- if (focusedKey == null || hasKey(focusedKey))
94
- return false;
95
- const bodyRows = rows.filter((row) => row.type === 'item');
96
- return bodyRows.length === 0 || bodyRows.some((row) => isDisabled(row.key));
97
- };
98
97
 
99
- exports.isFocusRecoveryAtRisk = isFocusRecoveryAtRisk;
98
+ exports.hasSelectableRow = hasSelectableRow;
99
+ exports.isPlaceholderPage = isPlaceholderPage;
100
100
  exports.keyOfSelection = keyOfSelection;
101
101
  exports.keysOfSelection = keysOfSelection;
102
102
  exports.reportSelectionChange = reportSelectionChange;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableSelection.utils.cjs","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableSelection.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAe,KAAgB,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;AAE/F;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,SAAoB,KAAgB;IACjE,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,IAAI;AACpC,IAAA,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;IACzB,OAAO,KAAK,IAAI,IAAI;AACtB;AAEA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAE,OAAsB,EAAE,YAAA,GAA8B,EAAE,KAAW;IACvH,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,CAAC,GAAG,SAAS,CAAC;AAC9C,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC;IACtC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD;AAWA;;;;;;;;AAQG;AACI,MAAM,qBAAqB,GAAG,CACnC,SAAoB,EACpB,OAAsB,EACtB,YAAuC,EACvC,SAAmC,KAC3B;AACR,IAAA,SAAS,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACxC,SAAS,CAAC,mBAAmB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAC1D,IAAA,SAA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IAAI,aAAa,GAAG,UAAU,CAAC,MAAM;AACvE,QAAA,UAAU,EAAE,KAAK;KAClB;AACH;AAEA;;;;;AAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAmB,EAAE,sBAAsB,GAAG,KAAK,KAA2B;AAC9G,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,KAAK;IAC7B,OAAO,sBAAsB,GAAG,SAAS,GAAG,IAAI,GAAG,EAAE;AACvD;;;;;;;;;"}
@@ -37,6 +37,32 @@ export interface SelectionChangeListeners {
37
37
  * @returns Nothing. Each provided listener is called.
38
38
  */
39
39
  export declare const reportSelectionChange: (selection: Selection, rowKeys: Iterable<Key>, disabledKeys: Iterable<Key> | undefined, listeners: SelectionChangeListeners) => void;
40
+ /**
41
+ * Says whether any mounted row with an `id` can be selected.
42
+ * @param rowKeys - Every mounted selectable row's id, as the table's row registry holds them.
43
+ * @param disabledKeys - Rows the table disables, which select all leaves out.
44
+ * @returns `true` while at least one such row can be selected.
45
+ */
46
+ export declare const hasSelectableRow: (rowKeys: Iterable<Key>, disabledKeys?: Iterable<Key>) => boolean;
47
+ /** What decides whether a table's page is placeholders, which select all has nothing to cover on. */
48
+ export interface PlaceholderPage {
49
+ /** The table's `isLoading`, known from its props on the first render, before any row registers. */
50
+ isLoading: boolean;
51
+ /** Every mounted selectable row's id. */
52
+ rowKeys: Iterable<Key>;
53
+ /** Every mounted placeholder row's id: a row with an `id` carrying `Table.RowCard.Skeleton`, as each loading row does. */
54
+ placeholderKeys: Iterable<Key>;
55
+ /** Rows the table disables. */
56
+ disabledKeys?: Iterable<Key>;
57
+ }
58
+ /**
59
+ * Says whether the table knows its page is placeholders, so select all would only store `'all'` for the rows that load
60
+ * next: while it `isLoading`, or with a placeholder row mounted and no selectable one. Nothing else counts, so before any
61
+ * row registers, with rows that have no `id`, or on a page the consumer disabled, select all is react-aria's as ever.
62
+ * @param page - The table's loading state and its mounted rows; see `PlaceholderPage`.
63
+ * @returns `true` only for a page of placeholders.
64
+ */
65
+ export declare const isPlaceholderPage: ({ isLoading, rowKeys, placeholderKeys, disabledKeys }: PlaceholderPage) => boolean;
40
66
  /** What the card list's select-all checkbox shows. */
41
67
  export interface SelectAllState {
42
68
  /** Every selectable row is selected. */
@@ -51,9 +77,11 @@ export interface SelectAllState {
51
77
  * @param selection - The current selection; `'all'` after select all.
52
78
  * @param rowKeys - Every mounted selectable row's id.
53
79
  * @param disabledKeys - Rows the table disables, which select all leaves out.
80
+ * @param isOnPlaceholderPage - Whether `isPlaceholderPage` holds, which turns the checkbox off at once, before the rows
81
+ * that are leaving have dropped out of `rowKeys`.
54
82
  * @returns Whether the checkbox is checked, indeterminate or disabled.
55
83
  */
56
- export declare const selectAllStateOf: (selection: "all" | Iterable<Key>, rowKeys: Iterable<Key>, disabledKeys?: Iterable<Key>) => SelectAllState;
84
+ export declare const selectAllStateOf: (selection: "all" | Iterable<Key>, rowKeys: Iterable<Key>, disabledKeys?: Iterable<Key>, isOnPlaceholderPage?: boolean) => SelectAllState;
57
85
  /**
58
86
  * Picks the selection a press on the select-all checkbox reports, the values react-aria's header checkbox reports.
59
87
  * @param isSelected - Whether every selectable row is selected now.
@@ -61,22 +89,4 @@ export declare const selectAllStateOf: (selection: "all" | Iterable<Key>, rowKey
61
89
  * @returns `'all'`, an empty selection, or `undefined` when clearing is not allowed.
62
90
  */
63
91
  export declare const selectAllToggleOf: (isSelected: boolean, disallowEmptySelection?: boolean) => Selection | undefined;
64
- /** One of a table's rows as react-stately's focus recovery walks them: a body row, a header row or a loader. */
65
- export interface FocusRecoveryRow {
66
- key: Key;
67
- type: string;
68
- }
69
- /**
70
- * Says whether a table must drop its focused key before react-stately looks for a row to move focus to. That search can
71
- * loop for ever only when it meets disabled rows, or finds no body row at all, so the key goes in either case. The cost:
72
- * in a table with a disabled row, such as a placeholder, removing the focused row drops focus instead of moving it to a
73
- * neighbour.
74
- * @param focusedKey - The key the table's selection state holds as focused; `null` when nothing is.
75
- * @param hasKey - Whether the table's new collection still holds a key.
76
- * @param rows - The new collection's rows; only its body rows count.
77
- * @param isDisabled - Whether the table's selection manager counts a row as disabled, as placeholder rows are.
78
- * @returns `true` when the focused key is gone and a body row left is disabled, or none is left; `false` otherwise, so
79
- * react-aria still moves focus to a neighbouring row in a table with no disabled row.
80
- */
81
- export declare const isFocusRecoveryAtRisk: (focusedKey: Key | null, hasKey: (key: Key) => boolean, rows: readonly FocusRecoveryRow[], isDisabled: (key: Key) => boolean) => boolean;
82
92
  //# sourceMappingURL=tableSelection.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableSelection.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableSelection.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,GAAG,GAAG,IAAI,KAAG,SAA+C,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,KAAG,GAAG,GAAG,IAI3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,SAAS,EAAE,SAAS,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAc,QAAQ,CAAC,GAAG,CAAM,KAAG,GAAG,EAInH,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACnD,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,qGAAqG;IACrG,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,SAAS,EAC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listeners.onSelectedKeysChange?.(keysOfSelection(selection, rowKeys, disabledKeys));
44
44
  };
45
+ /**
46
+ * Says whether any mounted row with an `id` can be selected.
47
+ * @param rowKeys - Every mounted selectable row's id, as the table's row registry holds them.
48
+ * @param disabledKeys - Rows the table disables, which select all leaves out.
49
+ * @returns `true` while at least one such row can be selected.
50
+ */
51
+ const hasSelectableRow = (rowKeys, disabledKeys) => keysOfSelection('all', rowKeys, disabledKeys).length > 0;
52
+ /**
53
+ * Says whether the table knows its page is placeholders, so select all would only store `'all'` for the rows that load
54
+ * next: while it `isLoading`, or with a placeholder row mounted and no selectable one. Nothing else counts, so before any
55
+ * row registers, with rows that have no `id`, or on a page the consumer disabled, select all is react-aria's as ever.
56
+ * @param page - The table's loading state and its mounted rows; see `PlaceholderPage`.
57
+ * @returns `true` only for a page of placeholders.
58
+ */
59
+ const isPlaceholderPage = ({ isLoading, rowKeys, placeholderKeys, disabledKeys }) => isLoading || (Array.from(placeholderKeys).length > 0 && !hasSelectableRow(rowKeys, disabledKeys));
45
60
  /**
46
61
  * Works out the select-all checkbox from the selection and the rows on screen, as the table's header checkbox does.
47
62
  * @param selection - The current selection; `'all'` after select all.
48
63
  * @param rowKeys - Every mounted selectable row's id.
49
64
  * @param disabledKeys - Rows the table disables, which select all leaves out.
65
+ * @param isOnPlaceholderPage - Whether `isPlaceholderPage` holds, which turns the checkbox off at once, before the rows
66
+ * that are leaving have dropped out of `rowKeys`.
50
67
  * @returns Whether the checkbox is checked, indeterminate or disabled.
51
68
  */
52
- const selectAllStateOf = (selection, rowKeys, disabledKeys) => {
69
+ const selectAllStateOf = (selection, rowKeys, disabledKeys, isOnPlaceholderPage = false) => {
53
70
  const selectable = keysOfSelection('all', rowKeys, disabledKeys);
54
- if (selectable.length === 0)
71
+ if (isOnPlaceholderPage || selectable.length === 0)
55
72
  return { isSelected: false, isIndeterminate: false, isDisabled: true };
56
73
  if (selection === 'all')
57
74
  return { isSelected: true, isIndeterminate: false, isDisabled: false };
@@ -75,24 +92,6 @@ const selectAllToggleOf = (isSelected, disallowEmptySelection = false) => {
75
92
  return 'all';
76
93
  return disallowEmptySelection ? undefined : new Set();
77
94
  };
78
- /**
79
- * Says whether a table must drop its focused key before react-stately looks for a row to move focus to. That search can
80
- * loop for ever only when it meets disabled rows, or finds no body row at all, so the key goes in either case. The cost:
81
- * in a table with a disabled row, such as a placeholder, removing the focused row drops focus instead of moving it to a
82
- * neighbour.
83
- * @param focusedKey - The key the table's selection state holds as focused; `null` when nothing is.
84
- * @param hasKey - Whether the table's new collection still holds a key.
85
- * @param rows - The new collection's rows; only its body rows count.
86
- * @param isDisabled - Whether the table's selection manager counts a row as disabled, as placeholder rows are.
87
- * @returns `true` when the focused key is gone and a body row left is disabled, or none is left; `false` otherwise, so
88
- * react-aria still moves focus to a neighbouring row in a table with no disabled row.
89
- */
90
- const isFocusRecoveryAtRisk = (focusedKey, hasKey, rows, isDisabled) => {
91
- if (focusedKey == null || hasKey(focusedKey))
92
- return false;
93
- const bodyRows = rows.filter((row) => row.type === 'item');
94
- return bodyRows.length === 0 || bodyRows.some((row) => isDisabled(row.key));
95
- };
96
95
 
97
- export { isFocusRecoveryAtRisk, keyOfSelection, keysOfSelection, reportSelectionChange, selectAllStateOf, selectAllToggleOf, selectionOfKey };
96
+ export { hasSelectableRow, isPlaceholderPage, keyOfSelection, keysOfSelection, reportSelectionChange, selectAllStateOf, selectAllToggleOf, selectionOfKey };
98
97
  //# sourceMappingURL=tableSelection.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableSelection.utils.js","sources":["../../../../../../src/components/organisms/Tables/Table/utilities/tableSelection.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAe,KAAgB,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;AAE/F;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,SAAoB,KA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AAG,CAC9B,SAAgC,EAChC,OAAsB,EACtB,YAA4B,EAC5B,mBAAmB,GAAG,KAAK,KACT;IAClB,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC;AAChE,IAAA,IAAI,mBAAmB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE;IAC1H,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;AAE/F,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC;IACnC,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM;IAC1E,OAAO;AACL,QAAA,UAAU,EAAE,aAAa,KAAK,UAAU,CAAC,MAAM;;QAE/C,eAAe,EAAE,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,aAAa,GAAG,UAAU,CAAC,MAAM;AACvE,QAAA,UAAU,EAAE,KAAK;KAClB;AACH;AAEA;;;;;AAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAmB,EAAE,sBAAsB,GAAG,KAAK,KAA2B;AAC9G,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,KAAK;IAC7B,OAAO,sBAAsB,GAAG,SAAS,GAAG,IAAI,GAAG,EAAE;AACvD;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var uiIcons = require('@flipdish/ui-icons');
5
+ var ButtonGroup = require('@flipdish/ui-library/components/molecules/ButtonGroup');
6
+ var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
7
+ var useIsAtLeastMd = require('../hooks/useIsAtLeastMd.cjs');
8
+ var useTableLayoutToggle = require('./hooks/useTableLayoutToggle.cjs');
9
+
10
+ const isTableLayout = (key) => key === 'table' || key === 'cards';
11
+ /**
12
+ * Two icon buttons, Table view and Card view, that switch a `Table`'s `desktopLayout`; renders nothing below `md`, where
13
+ * `mobileLayout` decides. Give it and the table one `layoutKey` to remember the choice, or pass `value` and `onChange`.
14
+ *
15
+ * @summary switch a table between rows and cards from md up
16
+ */
17
+ const TableLayoutToggle = ({ value, onChange, layoutKey, className, 'data-testid': dataTestId }) => {
18
+ // Nothing on the server and while hydrating, as the table's own layout waits for the viewport there too.
19
+ const isAtLeastMd = useIsAtLeastMd.useIsAtLeastMd();
20
+ const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'table-layout-toggle', rootName: 'table-layout-toggle' });
21
+ const { layout, choose } = useTableLayoutToggle.useTableLayoutToggle({ value, onChange, layoutKey });
22
+ const chooseLayout = (keys) => {
23
+ const [chosen] = keys;
24
+ if (isTableLayout(chosen))
25
+ choose(chosen);
26
+ };
27
+ if (!isAtLeastMd)
28
+ return null;
29
+ return (jsxRuntime.jsxs(ButtonGroup.ButtonGroup, { "aria-label": "Table layout", size: "sm", selectedKeys: [layout], onSelectionChange: chooseLayout, disallowEmptySelection: true, className: className, "data-testid": rootTestId, children: [jsxRuntime.jsx(ButtonGroup.ButtonGroupItem, { id: "table", "aria-label": "Table view", iconLeading: uiIcons.Table }), jsxRuntime.jsx(ButtonGroup.ButtonGroupItem, { id: "cards", "aria-label": "Card view", iconLeading: uiIcons.Grid01 })] }));
30
+ };
31
+ TableLayoutToggle.displayName = 'TableLayoutToggle';
32
+
33
+ exports.TableLayoutToggle = TableLayoutToggle;
34
+ //# sourceMappingURL=TableLayoutToggle.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLayoutToggle.cjs","sources":["../../../../../src/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.tsx"],"sourcesContent":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EF,cAAA,CAACC,2BAAe,EAAA,EAAC,EAAE,EAAC,OAAO,EAAA,YAAA,EAAY,WAAW,EAAC,WAAW,EAAEE,cAAM,EAAA,CAAI,CAAA,EAAA,CAC9D;AAElB;AACA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
@@ -0,0 +1,37 @@
1
+ import type { TableLayout } from '../tables.types';
2
+ interface TableLayoutToggleBaseProps {
3
+ /** Classes for the group of two buttons. */
4
+ className?: string;
5
+ /** Overrides the root `data-testid` (defaults to `fd-table-layout-toggle`); the options derive `<root>--item-table` and `<root>--item-cards`. */
6
+ 'data-testid'?: string;
7
+ }
8
+ interface StoredTableLayoutToggleProps extends TableLayoutToggleBaseProps {
9
+ /** Shows and stores the layout for every `Table` and `TableSortMenu` with the same key, remembered across visits; `value` wins. */
10
+ layoutKey: string;
11
+ /** The layout it shows, from the page; pass the same value to the table's `desktopLayout`. Unset, the one stored for `layoutKey` shows. */
12
+ value?: undefined;
13
+ /** Called with the layout the user picks, after it is stored for `layoutKey`. */
14
+ onChange?: (value: TableLayout) => void;
15
+ }
16
+ interface ControlledTableLayoutToggleProps extends TableLayoutToggleBaseProps {
17
+ /** Shows and stores the layout for every `Table` and `TableSortMenu` with the same key, remembered across visits; `value` wins. */
18
+ layoutKey?: string;
19
+ /** The layout it shows, from the page; pass the same value to the table's `desktopLayout`. Unset, the one stored for `layoutKey` shows. */
20
+ value: TableLayout;
21
+ /** Called with the layout the user picks, after it is stored for `layoutKey`. */
22
+ onChange: (value: TableLayout) => void;
23
+ }
24
+ /** A `layoutKey` the table and sort menu share, or `value` with `onChange` from the page; `value` never comes alone, as a pick would never show. */
25
+ export type TableLayoutToggleProps = StoredTableLayoutToggleProps | ControlledTableLayoutToggleProps;
26
+ /**
27
+ * Two icon buttons, Table view and Card view, that switch a `Table`'s `desktopLayout`; renders nothing below `md`, where
28
+ * `mobileLayout` decides. Give it and the table one `layoutKey` to remember the choice, or pass `value` and `onChange`.
29
+ *
30
+ * @summary switch a table between rows and cards from md up
31
+ */
32
+ export declare const TableLayoutToggle: {
33
+ ({ value, onChange, layoutKey, className, "data-testid": dataTestId }: TableLayoutToggleProps): import("react").JSX.Element | null;
34
+ displayName: string;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=TableLayoutToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLayoutToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,UAAU,0BAA0B;IAClC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iJAAiJ;IACjJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,4BAA6B,SAAQ,0BAA0B;IACvE,mIAAmI;IACnI,SAAS,EAAE,MAAM,CAAC;IAClB,2IAA2I;IAC3I,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACzC;AAED,UAAU,gCAAiC,SAAQ,0BAA0B;IAC3E,mIAAmI;IACnI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2IAA2I;IAC3I,KAAK,EAAE,WAAW,CAAC;IACnB,iFAAiF;IACjF,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC;AAED,oJAAoJ;AACpJ,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG,gCAAgC,CAAC;AAIrG;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;2EAA0E,sBAAsB;;CA2B7H,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Table, Grid01 } from '@flipdish/ui-icons';
3
+ import { ButtonGroup, ButtonGroupItem } from '@flipdish/ui-library/components/molecules/ButtonGroup';
4
+ import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
5
+ import { useIsAtLeastMd } from '../hooks/useIsAtLeastMd.js';
6
+ import { useTableLayoutToggle } from './hooks/useTableLayoutToggle.js';
7
+
8
+ const isTableLayout = (key) => key === 'table' || key === 'cards';
9
+ /**
10
+ * Two icon buttons, Table view and Card view, that switch a `Table`'s `desktopLayout`; renders nothing below `md`, where
11
+ * `mobileLayout` decides. Give it and the table one `layoutKey` to remember the choice, or pass `value` and `onChange`.
12
+ *
13
+ * @summary switch a table between rows and cards from md up
14
+ */
15
+ const TableLayoutToggle = ({ value, onChange, layoutKey, className, 'data-testid': dataTestId }) => {
16
+ // Nothing on the server and while hydrating, as the table's own layout waits for the viewport there too.
17
+ const isAtLeastMd = useIsAtLeastMd();
18
+ const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'table-layout-toggle', rootName: 'table-layout-toggle' });
19
+ const { layout, choose } = useTableLayoutToggle({ value, onChange, layoutKey });
20
+ const chooseLayout = (keys) => {
21
+ const [chosen] = keys;
22
+ if (isTableLayout(chosen))
23
+ choose(chosen);
24
+ };
25
+ if (!isAtLeastMd)
26
+ return null;
27
+ return (jsxs(ButtonGroup, { "aria-label": "Table layout", size: "sm", selectedKeys: [layout], onSelectionChange: chooseLayout, disallowEmptySelection: true, className: className, "data-testid": rootTestId, children: [jsx(ButtonGroupItem, { id: "table", "aria-label": "Table view", iconLeading: Table }), jsx(ButtonGroupItem, { id: "cards", "aria-label": "Card view", iconLeading: Grid01 })] }));
28
+ };
29
+ TableLayoutToggle.displayName = 'TableLayoutToggle';
30
+
31
+ export { TableLayoutToggle };
32
+ //# sourceMappingURL=TableLayoutToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableLayoutToggle.js","sources":["../../../../../src/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","TableIcon"],"mappings":";;;;;;;AAsCA,MA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