@flipdish/ui-library 0.69.0 → 0.70.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 (146) hide show
  1. package/README.md +2 -2
  2. package/dist/components/atoms/Buttons/Button/hooks/useLoadingLinkPress.d.ts +1 -1
  3. package/dist/components/atoms/LiveStatus/index.cjs +18 -0
  4. package/dist/components/atoms/LiveStatus/index.cjs.map +1 -0
  5. package/dist/components/atoms/LiveStatus/index.d.ts +17 -0
  6. package/dist/components/atoms/LiveStatus/index.d.ts.map +1 -0
  7. package/dist/components/atoms/LiveStatus/index.js +16 -0
  8. package/dist/components/atoms/LiveStatus/index.js.map +1 -0
  9. package/dist/components/forms/Form/index.cjs +1 -1
  10. package/dist/components/forms/Form/index.js +1 -1
  11. package/dist/components/molecules/Dropdown/index.d.ts +2 -2
  12. package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts +1 -1
  13. package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +1 -1
  14. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs +2 -0
  15. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -1
  16. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts +10 -0
  17. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -1
  18. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +2 -0
  19. package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js.map +1 -1
  20. package/dist/components/organisms/Table/Table.styles.cjs +29 -0
  21. package/dist/components/organisms/Table/Table.styles.cjs.map +1 -0
  22. package/dist/components/organisms/Table/Table.styles.d.ts +16 -0
  23. package/dist/components/organisms/Table/Table.styles.d.ts.map +1 -0
  24. package/dist/components/organisms/Table/Table.styles.js +27 -0
  25. package/dist/components/organisms/Table/Table.styles.js.map +1 -0
  26. package/dist/components/organisms/Table/components/TableCardRow.cjs +2 -1
  27. package/dist/components/organisms/Table/components/TableCardRow.cjs.map +1 -1
  28. package/dist/components/organisms/Table/components/TableCardRow.d.ts.map +1 -1
  29. package/dist/components/organisms/Table/components/TableCardRow.js +2 -1
  30. package/dist/components/organisms/Table/components/TableCardRow.js.map +1 -1
  31. package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs +2 -2
  32. package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs.map +1 -1
  33. package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts +3 -1
  34. package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts.map +1 -1
  35. package/dist/components/organisms/Table/components/TableCardsSelectAll.js +2 -2
  36. package/dist/components/organisms/Table/components/TableCardsSelectAll.js.map +1 -1
  37. package/dist/components/organisms/Table/components/TableRowCard.cjs +3 -2
  38. package/dist/components/organisms/Table/components/TableRowCard.cjs.map +1 -1
  39. package/dist/components/organisms/Table/components/TableRowCard.d.ts +1 -1
  40. package/dist/components/organisms/Table/components/TableRowCard.d.ts.map +1 -1
  41. package/dist/components/organisms/Table/components/TableRowCard.js +3 -2
  42. package/dist/components/organisms/Table/components/TableRowCard.js.map +1 -1
  43. package/dist/components/organisms/Table/components/TableSortMenu.cjs +4 -4
  44. package/dist/components/organisms/Table/components/TableSortMenu.cjs.map +1 -1
  45. package/dist/components/organisms/Table/components/TableSortMenu.d.ts +5 -5
  46. package/dist/components/organisms/Table/components/TableSortMenu.d.ts.map +1 -1
  47. package/dist/components/organisms/Table/components/TableSortMenu.js +4 -4
  48. package/dist/components/organisms/Table/components/TableSortMenu.js.map +1 -1
  49. package/dist/components/organisms/Table/hooks/useBusyCount.cjs +22 -0
  50. package/dist/components/organisms/Table/hooks/useBusyCount.cjs.map +1 -0
  51. package/dist/components/organisms/Table/hooks/useBusyCount.d.ts +12 -0
  52. package/dist/components/organisms/Table/hooks/useBusyCount.d.ts.map +1 -0
  53. package/dist/components/organisms/Table/hooks/useBusyCount.js +20 -0
  54. package/dist/components/organisms/Table/hooks/useBusyCount.js.map +1 -0
  55. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs +42 -0
  56. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
  57. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts +14 -0
  58. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
  59. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js +40 -0
  60. package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js.map +1 -0
  61. package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs +8 -11
  62. package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs.map +1 -1
  63. package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts +9 -2
  64. package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts.map +1 -1
  65. package/dist/components/organisms/Table/hooks/usePlaceholderRows.js +9 -12
  66. package/dist/components/organisms/Table/hooks/usePlaceholderRows.js.map +1 -1
  67. package/dist/components/organisms/Table/hooks/useTableSelection.cjs +12 -4
  68. package/dist/components/organisms/Table/hooks/useTableSelection.cjs.map +1 -1
  69. package/dist/components/organisms/Table/hooks/useTableSelection.d.ts +4 -2
  70. package/dist/components/organisms/Table/hooks/useTableSelection.d.ts.map +1 -1
  71. package/dist/components/organisms/Table/hooks/useTableSelection.js +12 -4
  72. package/dist/components/organisms/Table/hooks/useTableSelection.js.map +1 -1
  73. package/dist/components/organisms/Table/index.cjs +65 -24
  74. package/dist/components/organisms/Table/index.cjs.map +1 -1
  75. package/dist/components/organisms/Table/index.d.ts +17 -3
  76. package/dist/components/organisms/Table/index.d.ts.map +1 -1
  77. package/dist/components/organisms/Table/index.js +67 -26
  78. package/dist/components/organisms/Table/index.js.map +1 -1
  79. package/dist/components/organisms/Table/providers/Table.context.cjs.map +1 -1
  80. package/dist/components/organisms/Table/providers/Table.context.d.ts +11 -2
  81. package/dist/components/organisms/Table/providers/Table.context.d.ts.map +1 -1
  82. package/dist/components/organisms/Table/providers/Table.context.js.map +1 -1
  83. package/dist/components/organisms/Table/table.types.d.ts +9 -1
  84. package/dist/components/organisms/Table/table.types.d.ts.map +1 -1
  85. package/dist/components/organisms/Table/utilities/tableCard.utils.cjs.map +1 -1
  86. package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts +1 -1
  87. package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts.map +1 -1
  88. package/dist/components/organisms/Table/utilities/tableCard.utils.js.map +1 -1
  89. package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs +7 -4
  90. package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs.map +1 -1
  91. package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts +4 -2
  92. package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts.map +1 -1
  93. package/dist/components/organisms/Table/utilities/tableChildren.utils.js +7 -4
  94. package/dist/components/organisms/Table/utilities/tableChildren.utils.js.map +1 -1
  95. package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs +23 -0
  96. package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs.map +1 -0
  97. package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts +8 -0
  98. package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts.map +1 -0
  99. package/dist/components/organisms/Table/utilities/tableIterable.utils.js +21 -0
  100. package/dist/components/organisms/Table/utilities/tableIterable.utils.js.map +1 -0
  101. package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs +57 -0
  102. package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs.map +1 -0
  103. package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts +66 -0
  104. package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts.map +1 -0
  105. package/dist/components/organisms/Table/utilities/tableLoading.utils.js +52 -0
  106. package/dist/components/organisms/Table/utilities/tableLoading.utils.js.map +1 -0
  107. package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs +21 -21
  108. package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs.map +1 -1
  109. package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts +29 -19
  110. package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts.map +1 -1
  111. package/dist/components/organisms/Table/utilities/tableSelection.utils.js +20 -21
  112. package/dist/components/organisms/Table/utilities/tableSelection.utils.js.map +1 -1
  113. package/dist/components/organisms/Table/utilities/tableSort.utils.cjs +1 -1
  114. package/dist/components/organisms/Table/utilities/tableSort.utils.d.ts +1 -1
  115. package/dist/components/organisms/Table/utilities/tableSort.utils.js +1 -1
  116. package/dist/hooks/useFocusAfterRetry/index.cjs +21 -19
  117. package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
  118. package/dist/hooks/useFocusAfterRetry/index.d.ts +15 -5
  119. package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
  120. package/dist/hooks/useFocusAfterRetry/index.js +21 -19
  121. package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
  122. package/dist/hooks/useFocusHandOff/index.cjs +67 -0
  123. package/dist/hooks/useFocusHandOff/index.cjs.map +1 -0
  124. package/dist/hooks/useFocusHandOff/index.d.ts +17 -0
  125. package/dist/hooks/useFocusHandOff/index.d.ts.map +1 -0
  126. package/dist/hooks/useFocusHandOff/index.js +65 -0
  127. package/dist/hooks/useFocusHandOff/index.js.map +1 -0
  128. package/dist/native/components/atoms/LiveStatus/index.d.ts +12 -0
  129. package/dist/native/hooks/useFocusHandOff/index.d.ts +12 -0
  130. package/dist/styles.css +12 -0
  131. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.cjs +9 -0
  132. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.cjs.map +1 -0
  133. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.d.ts +8 -0
  134. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.d.ts.map +1 -0
  135. package/dist/{components/forms/Form/utilities → utilities/__internal__/focusUtils}/focusFromCode.utils.js +9 -1
  136. package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.js.map +1 -0
  137. package/package.json +7 -7
  138. package/dist/components/forms/Form/utilities/focusFromCode.utils.cjs.map +0 -1
  139. package/dist/components/forms/Form/utilities/focusFromCode.utils.d.ts.map +0 -1
  140. package/dist/components/forms/Form/utilities/focusFromCode.utils.js.map +0 -1
  141. package/dist/components/organisms/Table/components/TableFocusGuard.cjs +0 -23
  142. package/dist/components/organisms/Table/components/TableFocusGuard.cjs.map +0 -1
  143. package/dist/components/organisms/Table/components/TableFocusGuard.d.ts +0 -2
  144. package/dist/components/organisms/Table/components/TableFocusGuard.d.ts.map +0 -1
  145. package/dist/components/organisms/Table/components/TableFocusGuard.js +0 -21
  146. package/dist/components/organisms/Table/components/TableFocusGuard.js.map +0 -1
@@ -11,7 +11,7 @@ var tableCard_utils = require('../utilities/tableCard.utils.cjs');
11
11
  var tableSort_utils = require('../utilities/tableSort.utils.cjs');
12
12
 
13
13
  const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
14
- /** A "Sort by" menu of a table's sortable columns, both directions and "Clear sort", shown while the table shows cards; icon-only below `md`. */
14
+ /** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
15
15
  const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout = 'table', size = 'md', className, 'data-testid': dataTestId, }) => {
16
16
  const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
17
17
  // Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
@@ -19,7 +19,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
19
19
  const isIconOnly = !isAtLeastMd;
20
20
  const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
21
21
  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 clear and the icon marks it.
22
+ // The order differs from the one the page rests at, so there is something to reset and the icon marks it.
23
23
  const isAwayFromRest = !tableSort_utils.isSameSort(sortDescriptor, defaultSortDescriptor);
24
24
  const chooseColumn = (selection) => {
25
25
  const column = tableSort_utils.columnOfSortMenuKey(columns, firstKeyOf(selection));
@@ -31,7 +31,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
31
31
  if (direction === 'ascending' || direction === 'descending')
32
32
  onSortChange(tableSort_utils.sortOfDirectionChoice(sortDescriptor, direction));
33
33
  };
34
- const clearSort = () => onSortChange(defaultSortDescriptor);
34
+ const resetSort = () => onSortChange(defaultSortDescriptor);
35
35
  const renderColumnItem = (column) => (jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: tableSort_utils.sortMenuColumnKeyOf(column.id), label: column.label }, tableSort_utils.sortMenuColumnKeyOf(column.id)));
36
36
  // Read as the table reads it, so the two always agree, on the server and while hydrating too.
37
37
  if (tableCard_utils.tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
@@ -40,7 +40,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
40
40
  // A decorative dot while the sort differs from the resting one; the name already states what the sort is.
41
41
  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
42
  // 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: "Clear sort", onAction: clearSort })] }) })] }));
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: "Reset sort", onAction: resetSort })] }) })] }));
44
44
  };
45
45
  TableSortMenu.displayName = 'TableSortMenu';
46
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"TableSortMenu.cjs","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useIsAtLeastMd","isSameSort","columnOfSortMenuKey","sortOfColumnChoice","sortOfDirectionChoice","_jsx","Dropdown","sortMenuColumnKeyOf","tableLayoutOf","_jsxs","Button","SwitchVertical01","cx","joinTestId","_Fragment"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,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aAAa,EAAC,QAAQ,EACtB,sBAAsB,EAAA,IAAA,EACtB,YAAY,EAAE,YAAY,GAAG,CAACC,mCAAmB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,EACxE,iBAAiB,EAAE,YAAY,EAAA,QAAA,EAE9B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAA,CACb,EACnBF,cAAA,CAACC,iBAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EACtBG,eAAA,CAACH,iBAAQ,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,eAACC,iBAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,WAAW,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAE,CAAC,YAAY,EAAA,CAAI,EAC7ED,cAAA,CAACC,iBAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAID,cAAA,CAACC,iBAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EACxC,cAAc,IAAID,eAACC,iBAAQ,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;;"}
1
+ {"version":3,"file":"TableSortMenu.cjs","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useIsAtLeastMd","isSameSort","columnOfSortMenuKey","sortOfColumnChoice","sortOfDirectionChoice","_jsx","Dropdown","sortMenuColumnKeyOf","tableLayoutOf","_jsxs","Button","SwitchVertical01","cx","joinTestId","_Fragment"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;;AAErH,IAAA,MAAM,WAAW,GAAGC,6BAAc,EAAE;AACpC,IAAA,MAAM,UAAU,GAAG,CAAC,WAAW;IAC/B,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS;IAC/G,MAAM,QAAQ,GAAG,YAAY,IAAI,cAAc,GAAG,CAAA,QAAA,EAAW,YAAY,CAAC,KAAK,CAAA,EAAA,EAAK,cAAc,CAAC,SAAS,EAAE,GAAG,SAAS;;IAE1H,MAAM,cAAc,GAAG,CAACC,0BAAU,CAAC,cAAc,EAAE,qBAAqB,CAAC;AAEzE,IAAA,MAAM,YAAY,GAAG,CAAC,SAAoB,KAAI;QAC5C,MAAM,MAAM,GAAGC,mCAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;AAClE,QAAA,IAAI,MAAM;YAAE,YAAY,CAACC,kCA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Y,EAAA,CAAI,EAC7ED,cAAA,CAACC,iBAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAID,cAAA,CAACC,iBAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EAExC,cAAc,IAAID,eAACC,iBAAQ,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;;"}
@@ -9,12 +9,12 @@ export interface TableSortMenuProps {
9
9
  /** The table's current sort; unset while nothing is sorted. */
10
10
  sortDescriptor?: SortDescriptor;
11
11
  /**
12
- * What "Clear 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 "Clear sort". Omitted,
14
- * a clear reports `undefined`.
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
15
  */
16
16
  defaultSortDescriptor?: SortDescriptor;
17
- /** Called with the sort the user picks, or `defaultSortDescriptor` from "Clear sort"; pass the handler the table's `onSortChange` gets. */
17
+ /** Called with the sort the user picks, or `defaultSortDescriptor` from "Reset sort"; pass the handler the table's `onSortChange` gets. */
18
18
  onSortChange: (descriptor: SortDescriptor | undefined) => void;
19
19
  /** The table's `mobileLayout`: the menu renders nothing below `md` while that is the table, which its headers sort. */
20
20
  mobileLayout?: TableLayout;
@@ -27,7 +27,7 @@ export interface TableSortMenuProps {
27
27
  /** Overrides the root `data-testid` (defaults to `fd-table-sort-menu`); the trigger derives `<root>--trigger` and each item `<root>--item-<key>`. */
28
28
  'data-testid'?: string;
29
29
  }
30
- /** A "Sort by" menu of a table's sortable columns, both directions and "Clear sort", shown while the table shows cards; icon-only below `md`. */
30
+ /** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
31
31
  export declare const TableSortMenu: {
32
32
  ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout, desktopLayout, size, className, "data-testid": dataTestId, }: TableSortMenuProps): import("react").JSX.Element | null;
33
33
  displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TableSortMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAa,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,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,2IAA2I;IAC3I,YAAY,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,uHAAuH;IACvH,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qJAAqJ;IACrJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,iJAAiJ;AACjJ,eAAO,MAAM,aAAa;iJAUvB,kBAAkB;;CA2FpB,CAAC"}
1
+ {"version":3,"file":"TableSortMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAa,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,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,2IAA2I;IAC3I,YAAY,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,uHAAuH;IACvH,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qJAAqJ;IACrJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,iJAAiJ;AACjJ,eAAO,MAAM,aAAa;iJAUvB,kBAAkB;;CA4FpB,CAAC"}
@@ -9,7 +9,7 @@ import { tableLayoutOf } from '../utilities/tableCard.utils.js';
9
9
  import { isSameSort, sortMenuColumnKeyOf, columnOfSortMenuKey, sortOfColumnChoice, sortOfDirectionChoice } from '../utilities/tableSort.utils.js';
10
10
 
11
11
  const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
12
- /** A "Sort by" menu of a table's sortable columns, both directions and "Clear sort", shown while the table shows cards; icon-only below `md`. */
12
+ /** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
13
13
  const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout = 'table', size = 'md', className, 'data-testid': dataTestId, }) => {
14
14
  const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
15
15
  // Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
@@ -17,7 +17,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
17
17
  const isIconOnly = !isAtLeastMd;
18
18
  const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
19
19
  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 clear and the icon marks it.
20
+ // The order differs from the one the page rests at, so there is something to reset and the icon marks it.
21
21
  const isAwayFromRest = !isSameSort(sortDescriptor, defaultSortDescriptor);
22
22
  const chooseColumn = (selection) => {
23
23
  const column = columnOfSortMenuKey(columns, firstKeyOf(selection));
@@ -29,7 +29,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
29
29
  if (direction === 'ascending' || direction === 'descending')
30
30
  onSortChange(sortOfDirectionChoice(sortDescriptor, direction));
31
31
  };
32
- const clearSort = () => onSortChange(defaultSortDescriptor);
32
+ const resetSort = () => onSortChange(defaultSortDescriptor);
33
33
  const renderColumnItem = (column) => (jsx(Dropdown.Item, { id: sortMenuColumnKeyOf(column.id), label: column.label }, sortMenuColumnKeyOf(column.id)));
34
34
  // Read as the table reads it, so the two always agree, on the server and while hydrating too.
35
35
  if (tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
@@ -38,7 +38,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
38
38
  // A decorative dot while the sort differs from the resting one; the name already states what the sort is.
39
39
  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
40
  // 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: "Clear sort", onAction: clearSort })] }) })] }));
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: "Reset sort", onAction: resetSort })] }) })] }));
42
42
  };
43
43
  TableSortMenu.displayName = 'TableSortMenu';
44
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"TableSortMenu.js","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,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,WAAW,GAAG,cAAc,EAAE;AACpC,IAAA,MAAM,UAAU,GAAG,CAAC,WAAW;IAC/B,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO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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,EACxC,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;;"}
1
+ {"version":3,"file":"TableSortMenu.js","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,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,EAAA,CACC,CAAA,EAAA,CACL;AAEpB;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ /**
6
+ * Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
7
+ * order they finish in.
8
+ *
9
+ * @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
10
+ * cleanup lets it go.
11
+ */
12
+ const useBusyCount = () => {
13
+ const [count, setCount] = React.useState(0);
14
+ const registerBusy = React.useCallback(() => {
15
+ setCount((current) => current + 1);
16
+ return () => setCount((current) => current - 1);
17
+ }, []);
18
+ return { isBusy: count > 0, registerBusy };
19
+ };
20
+
21
+ exports.useBusyCount = useBusyCount;
22
+ //# sourceMappingURL=useBusyCount.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBusyCount.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"sourcesContent":[null],"names":["useState","useCallback"],"mappings":";;;;AAIA;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,MAAK;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;AAErC,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAAC,MAAK;QACpC,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;AAClC,QAAA,OAAO,MAAM,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE;AAC5C;;"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
3
+ * order they finish in.
4
+ *
5
+ * @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
6
+ * cleanup lets it go.
7
+ */
8
+ export declare const useBusyCount: () => {
9
+ isBusy: boolean;
10
+ registerBusy: () => () => void;
11
+ };
12
+ //# sourceMappingURL=useBusyCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBusyCount.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;CASxB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ /**
4
+ * Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
5
+ * order they finish in.
6
+ *
7
+ * @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
8
+ * cleanup lets it go.
9
+ */
10
+ const useBusyCount = () => {
11
+ const [count, setCount] = useState(0);
12
+ const registerBusy = useCallback(() => {
13
+ setCount((current) => current + 1);
14
+ return () => setCount((current) => current - 1);
15
+ }, []);
16
+ return { isBusy: count > 0, registerBusy };
17
+ };
18
+
19
+ export { useBusyCount };
20
+ //# sourceMappingURL=useBusyCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBusyCount.js","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,MAAK;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;AAErC,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,MAAK;QACpC,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;AAClC,QAAA,OAAO,MAAM,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE;AAC5C;;"}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var tableIterable_utils = require('../utilities/tableIterable.utils.cjs');
5
+ var tableSelection_utils = require('../utilities/tableSelection.utils.cjs');
6
+
7
+ /**
8
+ * Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
9
+ * all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
10
+ *
11
+ * @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
12
+ * @param rows The table's selectable-row registry.
13
+ * @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
14
+ * @param disabledKeys Rows the table disables.
15
+ * @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
16
+ */
17
+ const useIsPlaceholderPage = (isLoading, rows, placeholders, disabledKeys) => {
18
+ const { subscribe: subscribeToRows } = rows;
19
+ const { subscribe: subscribeToPlaceholders } = placeholders;
20
+ const subscribe = React.useCallback((listener) => {
21
+ const stopRows = subscribeToRows(listener);
22
+ const stopPlaceholders = subscribeToPlaceholders(listener);
23
+ return () => {
24
+ stopRows();
25
+ stopPlaceholders();
26
+ };
27
+ }, [subscribeToRows, subscribeToPlaceholders]);
28
+ // Read on every snapshot, of which React takes several, so a one-shot iterator is read once and every snapshot agrees.
29
+ const reusableDisabledKeys = tableIterable_utils.reusableIterableOf(disabledKeys);
30
+ // A boolean, so the table re-renders only when the answer flips, not on every row that joins.
31
+ const getSnapshot = () => tableSelection_utils.isPlaceholderPage({
32
+ isLoading,
33
+ rowKeys: rows.rowIds.current,
34
+ placeholderKeys: placeholders.rowIds.current,
35
+ disabledKeys: reusableDisabledKeys,
36
+ });
37
+ const getServerSnapshot = () => isLoading;
38
+ return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
39
+ };
40
+
41
+ exports.useIsPlaceholderPage = useIsPlaceholderPage;
42
+ //# sourceMappingURL=useIsPlaceholderPage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsPlaceholderPage.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"sourcesContent":[null],"names":["useCallback","reusableIterableOf","isPlaceholderPage","useSyncExternalStore"],"mappings":";;;;;;AAQA;;;;;;;;;AASG;AACI,MAAM,oBAAoB,GAAG,CAClC,SAAkB,EAClB,IAA2B,EAC3B,YAAmC,EACnC,YAA8B,KAC5B;AACF,IAAA,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI;AAC3C,IAAA,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,YAAY;AAC3D,IAAA,MAAM,SAAS,GAAGA,iBAAW,CAC3B,CAAC,QAAoB,KAAI;AACvB,QAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC1C,QAAA,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;AAC1D,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,EAAE;AACV,YAAA,gBAAgB,EAAE;AACpB,QAAA,CAAC;AACH,IAAA,CAAC,EACD,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAC3C;;AAED,IAAA,MAAM,oBAAoB,GAAGC,sCAAkB,CAAC,YAAY,CAAC;;AAE7D,IAAA,MAAM,WAAW,GAAG,MAClBC,sCAAiB,CAAC;QAChB,SAAS;AACT,QAAA,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;AAC5B,QAAA,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO;AAC5C,QAAA,YAAY,EAAE,oBAAoB;AACnC,KAAA,CAAC;AACJ,IAAA,MAAM,iBAAiB,GAAG,MAAM,SAAS;IAEzC,OAAOC,0BAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACxE;;"}
@@ -0,0 +1,14 @@
1
+ import type { RowId } from '../table.types';
2
+ import type { SelectableRowRegistry } from './useSelectableRowRegistry';
3
+ /**
4
+ * Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
5
+ * all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
6
+ *
7
+ * @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
8
+ * @param rows The table's selectable-row registry.
9
+ * @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
10
+ * @param disabledKeys Rows the table disables.
11
+ * @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
12
+ */
13
+ export declare const useIsPlaceholderPage: (isLoading: boolean, rows: SelectableRowRegistry, placeholders: SelectableRowRegistry, disabledKeys?: Iterable<RowId>) => boolean;
14
+ //# sourceMappingURL=useIsPlaceholderPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsPlaceholderPage.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,OAAO,EAClB,MAAM,qBAAqB,EAC3B,cAAc,qBAAqB,EACnC,eAAe,QAAQ,CAAC,KAAK,CAAC,YA4B/B,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { useCallback, useSyncExternalStore } from 'react';
2
+ import { reusableIterableOf } from '../utilities/tableIterable.utils.js';
3
+ import { isPlaceholderPage } from '../utilities/tableSelection.utils.js';
4
+
5
+ /**
6
+ * Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
7
+ * all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
8
+ *
9
+ * @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
10
+ * @param rows The table's selectable-row registry.
11
+ * @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
12
+ * @param disabledKeys Rows the table disables.
13
+ * @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
14
+ */
15
+ const useIsPlaceholderPage = (isLoading, rows, placeholders, disabledKeys) => {
16
+ const { subscribe: subscribeToRows } = rows;
17
+ const { subscribe: subscribeToPlaceholders } = placeholders;
18
+ const subscribe = useCallback((listener) => {
19
+ const stopRows = subscribeToRows(listener);
20
+ const stopPlaceholders = subscribeToPlaceholders(listener);
21
+ return () => {
22
+ stopRows();
23
+ stopPlaceholders();
24
+ };
25
+ }, [subscribeToRows, subscribeToPlaceholders]);
26
+ // Read on every snapshot, of which React takes several, so a one-shot iterator is read once and every snapshot agrees.
27
+ const reusableDisabledKeys = reusableIterableOf(disabledKeys);
28
+ // A boolean, so the table re-renders only when the answer flips, not on every row that joins.
29
+ const getSnapshot = () => isPlaceholderPage({
30
+ isLoading,
31
+ rowKeys: rows.rowIds.current,
32
+ placeholderKeys: placeholders.rowIds.current,
33
+ disabledKeys: reusableDisabledKeys,
34
+ });
35
+ const getServerSnapshot = () => isLoading;
36
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
37
+ };
38
+
39
+ export { useIsPlaceholderPage };
40
+ //# sourceMappingURL=useIsPlaceholderPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsPlaceholderPage.js","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA;;;;;;;;;AASG;AACI,MAAM,oBAAoB,GAAG,CAClC,SAAkB,EAClB,IAA2B,EAC3B,YAAmC,EACnC,YAA8B,KAC5B;AACF,IAAA,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI;AAC3C,IAAA,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,YAAY;AAC3D,IAAA,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAAoB,KAAI;AACvB,QAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC1C,QAAA,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;AAC1D,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,EAAE;AACV,YAAA,gBAAgB,EAAE;AACpB,QAAA,CAAC;AACH,IAAA,CAAC,EACD,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAC3C;;AAED,IAAA,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,YAAY,CAAC;;AAE7D,IAAA,MAAM,WAAW,GAAG,MAClB,iBAAiB,CAAC;QAChB,SAAS;AACT,QAAA,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;AAC5B,QAAA,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO;AAC5C,QAAA,YAAY,EAAE,oBAAoB;AACnC,KAAA,CAAC;AACJ,IAAA,MAAM,iBAAiB,GAAG,MAAM,SAAS;IAEzC,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACxE;;"}
@@ -1,30 +1,27 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var useSelectableRowRegistry = require('./useSelectableRowRegistry.cjs');
4
5
 
5
6
  /**
6
7
  * Keeps the table's row action off placeholder rows. A placeholder row is disabled, but `disabledBehavior="selection"`
7
8
  * leaves a disabled row's action on, so the card list's `onAction` checks this set as well.
8
9
  *
9
10
  * @param onRowAction The table's `onRowAction`, or `undefined` when it has none.
10
- * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it, and `onAction`, the row
11
- * action to give the card list: it skips a registered placeholder, and is `undefined` when the table has no row action.
11
+ * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it; `onAction`, the row action to
12
+ * give the card list, which skips a registered placeholder and is `undefined` when the table has no row action; and
13
+ * `registry`, the placeholders' ids with a subscription, for a part that must follow them as they join or leave.
12
14
  */
13
15
  const usePlaceholderRows = (onRowAction) => {
14
- const placeholderIds = React.useRef(new Set());
15
- const register = React.useCallback((id) => {
16
- placeholderIds.current.add(id);
17
- return () => {
18
- placeholderIds.current.delete(id);
19
- };
20
- }, []);
16
+ // The same id registry selectable rows use, so select all can subscribe to placeholders too.
17
+ const registry = useSelectableRowRegistry.useSelectableRowRegistry();
21
18
  const onAction = onRowAction
22
19
  ? (key) => {
23
- if (!placeholderIds.current.has(key))
20
+ if (!registry.rowIds.current.has(key))
24
21
  onRowAction(key);
25
22
  }
26
23
  : undefined;
27
- return { register, onAction };
24
+ return { register: registry.register, onAction, registry };
28
25
  };
29
26
  /**
30
27
  * Joins one placeholder row to the table's placeholder set while it carries `Table.RowCard.Skeleton`, in either layout.
@@ -1 +1 @@
1
- {"version":3,"file":"usePlaceholderRows.cjs","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":["useRef","useCallback","useEffect"],"mappings":";;;;AAKA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAA+C,KAAI;IACpF,MAAM,cAAc,GAAGA,YAAM,CAAC,IAAI,GAAG,EAAS,CAAC;AAE/C,IAAA,MAAM,QAAQ,GAAGC,iBAAW,CAAC,CAAC,EAAS,KAAI;AACzC,QAAA,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9B,QAAA,OAAO,MAAK;AACV,YAAA,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;AACnC,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;IAEN,MAAM,QAAQ,GAAG;AACf,UAAE,CAAC,GAAU,KAAI;YACb,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,WAAW,CAAC,GAAG,CAAC;QACxD;UACA,SAAS;AAEb,IAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAC/B;AAEA;;;;;;;AAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAiD,EAAE,EAAqB,EAAE,aAAsB,KAAI;AAC5I,IAAAC,eAAS,CAAC,OAAO,aAAa,IAAI,EAAE,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AAClH;;;"}
1
+ {"version":3,"file":"usePlaceholderRows.cjs","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":["useSelectableRowRegistry","useEffect"],"mappings":";;;;;AAMA;;;;;;;;AAQG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAA+C,KAAI;;AAEpF,IAAA,MAAM,QAAQ,GAAGA,iDAAwB,EAAE;IAE3C,MAAM,QAAQ,GAAG;AACf,UAAE,CAAC,GAAU,KAAI;YACb,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,WAAW,CAAC,GAAG,CAAC;QACzD;UACA,SAAS;IAEb,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAC5D;AAEA;;;;;;;AAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAiD,EAAE,EAAqB,EAAE,aAAsB,KAAI;AAC5I,IAAAC,eAAS,CAAC,OAAO,aAAa,IAAI,EAAE,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AAClH;;;"}
@@ -4,12 +4,19 @@ import type { RowId } from '../table.types';
4
4
  * leaves a disabled row's action on, so the card list's `onAction` checks this set as well.
5
5
  *
6
6
  * @param onRowAction The table's `onRowAction`, or `undefined` when it has none.
7
- * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it, and `onAction`, the row
8
- * action to give the card list: it skips a registered placeholder, and is `undefined` when the table has no row action.
7
+ * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it; `onAction`, the row action to
8
+ * give the card list, which skips a registered placeholder and is `undefined` when the table has no row action; and
9
+ * `registry`, the placeholders' ids with a subscription, for a part that must follow them as they join or leave.
9
10
  */
10
11
  export declare const usePlaceholderRows: (onRowAction: ((key: RowId) => void) | undefined) => {
11
12
  register: (id: RowId) => () => void;
12
13
  onAction: ((key: RowId) => void) | undefined;
14
+ registry: {
15
+ register: (id: RowId) => () => void;
16
+ rowIds: import("react").RefObject<Set<RowId>>;
17
+ subscribe: (listener: () => void) => () => void;
18
+ getVersion: () => number;
19
+ };
13
20
  };
14
21
  /**
15
22
  * Joins one placeholder row to the table's placeholder set while it carries `Table.RowCard.Skeleton`, in either layout.
@@ -1 +1 @@
1
- {"version":3,"file":"usePlaceholderRows.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,aAAa,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS;mBAG9C,KAAK;qBAQ7B,KAAK;CAMhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,CAAC,CAAC,EAAE,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,EAAE,IAAI,KAAK,GAAG,SAAS,EAAE,eAAe,OAAO,SAEzI,CAAC"}
1
+ {"version":3,"file":"usePlaceholderRows.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,aAAa,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS;;qBAKtE,KAAK;;;;;;;CAMhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,CAAC,CAAC,EAAE,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,EAAE,IAAI,KAAK,GAAG,SAAS,EAAE,eAAe,OAAO,SAEzI,CAAC"}
@@ -1,28 +1,25 @@
1
- import { useEffect, useRef, useCallback } from 'react';
1
+ import { useEffect } from 'react';
2
+ import { useSelectableRowRegistry } from './useSelectableRowRegistry.js';
2
3
 
3
4
  /**
4
5
  * Keeps the table's row action off placeholder rows. A placeholder row is disabled, but `disabledBehavior="selection"`
5
6
  * leaves a disabled row's action on, so the card list's `onAction` checks this set as well.
6
7
  *
7
8
  * @param onRowAction The table's `onRowAction`, or `undefined` when it has none.
8
- * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it, and `onAction`, the row
9
- * action to give the card list: it skips a registered placeholder, and is `undefined` when the table has no row action.
9
+ * @returns `register`, which a placeholder row calls with its id and whose cleanup drops it; `onAction`, the row action to
10
+ * give the card list, which skips a registered placeholder and is `undefined` when the table has no row action; and
11
+ * `registry`, the placeholders' ids with a subscription, for a part that must follow them as they join or leave.
10
12
  */
11
13
  const usePlaceholderRows = (onRowAction) => {
12
- const placeholderIds = useRef(new Set());
13
- const register = useCallback((id) => {
14
- placeholderIds.current.add(id);
15
- return () => {
16
- placeholderIds.current.delete(id);
17
- };
18
- }, []);
14
+ // The same id registry selectable rows use, so select all can subscribe to placeholders too.
15
+ const registry = useSelectableRowRegistry();
19
16
  const onAction = onRowAction
20
17
  ? (key) => {
21
- if (!placeholderIds.current.has(key))
18
+ if (!registry.rowIds.current.has(key))
22
19
  onRowAction(key);
23
20
  }
24
21
  : undefined;
25
- return { register, onAction };
22
+ return { register: registry.register, onAction, registry };
26
23
  };
27
24
  /**
28
25
  * Joins one placeholder row to the table's placeholder set while it carries `Table.RowCard.Skeleton`, in either layout.
@@ -1 +1 @@
1
- {"version":3,"file":"usePlaceholderRows.js","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;;;;;;;AAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAA+C,KAAI;IACpF,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,GAAG,EAAS,CAAC;AAE/C,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,EAAS,KAAI;AACzC,QAAA,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9B,QAAA,OAAO,MAAK;AACV,YAAA,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;AACnC,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;IAEN,MAAM,QAAQ,GAAG;AACf,UAAE,CAAC,GAAU,KAAI;YACb,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,WAAW,CAAC,GAAG,CAAC;QACxD;UACA,SAAS;AAEb,IAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAC/B;AAEA;;;;;;;AAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAiD,EAAE,EAAqB,EAAE,aAAsB,KAAI;AAC5I,IAAA,SAAS,CAAC,OAAO,aAAa,IAAI,EAAE,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AAClH;;"}
1
+ {"version":3,"file":"usePlaceholderRows.js","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAMA;;;;;;;;AAQG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAA+C,KAAI;;AAEpF,IAAA,MAAM,QAAQ,GAAG,wBAAwB,EAAE;IAE3C,MAAM,QAAQ,GAAG;AACf,UAAE,CAAC,GAAU,KAAI;YACb,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,WAAW,CAAC,GAAG,CAAC;QACzD;UACA,SAAS;IAEb,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAC5D;AAEA;;;;;;;AAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAiD,EAAE,EAAqB,EAAE,aAAsB,KAAI;AAC5I,IAAA,SAAS,CAAC,OAAO,aAAa,IAAI,EAAE,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AAClH;;"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var tableIterable_utils = require('../utilities/tableIterable.utils.cjs');
4
5
  var tableSelection_utils = require('../utilities/tableSelection.utils.cjs');
5
6
 
6
7
  // React 18's StrictMode runs a state initialiser twice and keeps the second run, so a one-shot iterator is read once per identity.
@@ -20,9 +21,9 @@ const defaultSelectionOf = (keys) => {
20
21
  *
21
22
  * @param options The controlled values, the default, the listeners and the row registry; see `UseTableSelectionOptions`.
22
23
  * @returns `selectedKeys`, to pass to whichever layout renders, and `onSelectionChange`, which keeps an uncontrolled
23
- * change and reports it.
24
+ * change and reports it, and ignores a select all while the page is placeholders, as while the table loads.
24
25
  */
25
- const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, ...listeners }) => {
26
+ const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, isPlaceholderPage = false, ...listeners }) => {
26
27
  // Copied once, so a one-shot iterable still holds its rows for the next render and for the other layout.
27
28
  const [ownSelection, setOwnSelection] = React.useState(() => {
28
29
  if (defaultSelectedKeys === undefined)
@@ -30,15 +31,22 @@ const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, dis
30
31
  return defaultSelectedKeys === 'all' ? 'all' : defaultSelectionOf(defaultSelectedKeys);
31
32
  });
32
33
  const isControlled = selectedKey !== undefined || selectedKeys !== undefined;
34
+ // Read on every change, and by react-aria too, so a one-shot iterator is read once.
35
+ const reusableDisabledKeys = tableIterable_utils.reusableIterableOf(disabledKeys);
33
36
  const currentSelection = () => {
34
37
  if (selectedKey !== undefined)
35
38
  return tableSelection_utils.selectionOfKey(selectedKey);
36
- return selectedKeys ?? ownSelection;
39
+ if (selectedKeys === 'all')
40
+ return 'all';
41
+ // React-aria reads it, and so does the cards' select all, so a one-shot iterator is read once.
42
+ return tableIterable_utils.reusableIterableOf(selectedKeys) ?? ownSelection;
37
43
  };
38
44
  const onSelectionChange = (selection) => {
45
+ if (selection === 'all' && isPlaceholderPage)
46
+ return;
39
47
  if (!isControlled)
40
48
  setOwnSelection(selection);
41
- tableSelection_utils.reportSelectionChange(selection, rowIds.current ?? [], disabledKeys, listeners);
49
+ tableSelection_utils.reportSelectionChange(selection, rowIds.current ?? [], reusableDisabledKeys, listeners);
42
50
  };
43
51
  return { selectedKeys: currentSelection(), onSelectionChange };
44
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSelection.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useTableSelection.ts"],"sourcesContent":[null],"names":["useState","selectionOfKey","reportSelectionChange"],"mappings":";;;;;AASA;AACA,MAAM,eAAe,GAAG,IAAI,OAAO,EAAsB;AAEzD,MAAM,kBAAkB,GAAG,CAAC,IAAqB,KAAgB;;IAE/D,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;AACtF,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC;AACpC,IAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC;AAC3D,IAAA,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC;AACnC,IAAA,OAAO,QAAQ;AACjB,CAAC;AAeD;;;;;;;AAOG;MACU,iBAAiB,GAAG,CAAC,EAChC,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,MAAM,EACN,GAAG,SAAS,EACa,KAAI;;IAE7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAe,MAAK;QAClE,IAAI,mBAAmB,KAAK,SAAS;AAAE,YAAA,OAAO,EAAE;AAChD,QAAA,OAAO,mBAAmB,KAAK,KAAK,GAAG,KAAK,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;AACxF,IAAA,CAAC,CAAC;IACF,MAAM,YAAY,GAAG,WAAW,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS;IAE5E,MAAM,gBAAgB,GAAG,MAAmB;QAC1C,IAAI,WAAW,KAAK,SAAS;AAAE,YAAA,OAAOC,mCAAc,CAAC,WAAW,CAAC;QACjE,OAAO,YAAY,IAAI,YAAY;AACrC,IAAA,CAAC;AAED,IAAA,MAAM,iBAAiB,GAAG,CAAC,SAA6B,KAAI;AAC1D,QAAA,IAAI,CAAC,YAAY;YAAE,eAAe,CAAC,SAAS,CAAC;AAC7C,QAAAC,0CAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC;AACjF,IAAA,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,iBAAiB,EAAE;AAChE;;"}
1
+ {"version":3,"file":"useTableSelection.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useTableSelection.ts"],"sourcesContent":[null],"names":["useState","reusableIterableOf","selectionOfKey","reportSelectionChange"],"mappings":";;;;;;AAUA;AACA,MAAM,eA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,YAAY,CAAC,IAAI,YAAY;AACzD,IAAA,CAAC;AAED,IAAA,MAAM,iBAAiB,GAAG,CAAC,SAA6B,KAAI;AAC1D,QAAA,IAAI,SAAS,KAAK,KAAK,IAAI,iBAAiB;YAAE;AAC9C,QAAA,IAAI,CAAC,YAAY;YAAE,eAAe,CAAC,SAAS,CAAC;AAC7C,QAAAE,0CAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,oBAAoB,EAAE,SAAS,CAAC;AACzF,IAAA,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,iBAAiB,EAAE;AAChE;;"}
@@ -14,6 +14,8 @@ export interface UseTableSelectionOptions extends SelectionChangeListeners {
14
14
  disabledKeys?: Iterable<RowId>;
15
15
  /** The mounted selectable rows, which "select all" is reported as. */
16
16
  rowIds: RefObject<Set<RowId>>;
17
+ /** Whether the page is placeholders, from `useIsPlaceholderPage`: a select all then would store `'all'` for the rows that load next. */
18
+ isPlaceholderPage?: boolean;
17
19
  }
18
20
  /**
19
21
  * Holds a table's selection above its layout switch, so a selection the consumer does not control survives the table
@@ -21,9 +23,9 @@ export interface UseTableSelectionOptions extends SelectionChangeListeners {
21
23
  *
22
24
  * @param options The controlled values, the default, the listeners and the row registry; see `UseTableSelectionOptions`.
23
25
  * @returns `selectedKeys`, to pass to whichever layout renders, and `onSelectionChange`, which keeps an uncontrolled
24
- * change and reports it.
26
+ * change and reports it, and ignores a select all while the page is placeholders, as while the table loads.
25
27
  */
26
- export declare const useTableSelection: ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, ...listeners }: UseTableSelectionOptions) => {
28
+ export declare const useTableSelection: ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, isPlaceholderPage, ...listeners }: UseTableSelectionOptions) => {
27
29
  selectedKeys: RowSelection;
28
30
  onSelectionChange: (selection: "all" | Set<RowId>) => void;
29
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableSelection.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useTableSelection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAyB,KAAK,wBAAwB,EAAkB,MAAM,mCAAmC,CAAC;AAEzH,kDAAkD;AAClD,KAAK,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAc5C,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACxE,0GAA0G;IAC1G,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC3B,yDAAyD;IACzD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,+DAA+D;IAC/D,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,sEAAsE;IACtE,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,wFAO/B,wBAAwB;;mCAaa,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;CAMzD,CAAC"}
1
+ {"version":3,"file":"useTableSelection.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useTableSelection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAyB,KAAK,wBAAwB,EAAkB,MAAM,mCAAmC,CAAC;AAEzH,kDAAkD;AAClD,KAAK,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAc5C,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACxE,0GAA0G;IAC1G,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC3B,yDAAyD;IACzD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,+DAA+D;IAC/D,YAAY,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,sEAAsE;IACtE,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,wIAAwI;IACxI,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,2GAQ/B,wBAAwB;;mCAiBa,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;CAOzD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { useState } from 'react';
2
+ import { reusableIterableOf } from '../utilities/tableIterable.utils.js';
2
3
  import { reportSelectionChange, selectionOfKey } from '../utilities/tableSelection.utils.js';
3
4
 
4
5
  // React 18's StrictMode runs a state initialiser twice and keeps the second run, so a one-shot iterator is read once per identity.
@@ -18,9 +19,9 @@ const defaultSelectionOf = (keys) => {
18
19
  *
19
20
  * @param options The controlled values, the default, the listeners and the row registry; see `UseTableSelectionOptions`.
20
21
  * @returns `selectedKeys`, to pass to whichever layout renders, and `onSelectionChange`, which keeps an uncontrolled
21
- * change and reports it.
22
+ * change and reports it, and ignores a select all while the page is placeholders, as while the table loads.
22
23
  */
23
- const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, ...listeners }) => {
24
+ const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, rowIds, isPlaceholderPage = false, ...listeners }) => {
24
25
  // Copied once, so a one-shot iterable still holds its rows for the next render and for the other layout.
25
26
  const [ownSelection, setOwnSelection] = useState(() => {
26
27
  if (defaultSelectedKeys === undefined)
@@ -28,15 +29,22 @@ const useTableSelection = ({ selectedKey, selectedKeys, defaultSelectedKeys, dis
28
29
  return defaultSelectedKeys === 'all' ? 'all' : defaultSelectionOf(defaultSelectedKeys);
29
30
  });
30
31
  const isControlled = selectedKey !== undefined || selectedKeys !== undefined;
32
+ // Read on every change, and by react-aria too, so a one-shot iterator is read once.
33
+ const reusableDisabledKeys = reusableIterableOf(disabledKeys);
31
34
  const currentSelection = () => {
32
35
  if (selectedKey !== undefined)
33
36
  return selectionOfKey(selectedKey);
34
- return selectedKeys ?? ownSelection;
37
+ if (selectedKeys === 'all')
38
+ return 'all';
39
+ // React-aria reads it, and so does the cards' select all, so a one-shot iterator is read once.
40
+ return reusableIterableOf(selectedKeys) ?? ownSelection;
35
41
  };
36
42
  const onSelectionChange = (selection) => {
43
+ if (selection === 'all' && isPlaceholderPage)
44
+ return;
37
45
  if (!isControlled)
38
46
  setOwnSelection(selection);
39
- reportSelectionChange(selection, rowIds.current ?? [], disabledKeys, listeners);
47
+ reportSelectionChange(selection, rowIds.current ?? [], reusableDisabledKeys, listeners);
40
48
  };
41
49
  return { selectedKeys: currentSelection(), onSelectionChange };
42
50
  };