@mirror-physics/fractal-ui 0.2.0-next.67 → 0.2.0-next.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -258,8 +258,13 @@ interface SortableTableRowAction<T> {
258
258
  interface SortableTableSelection<T> {
259
259
  /** Returns whether a row is selected. Selection is controlled by the consumer. */
260
260
  isSelected: (row: T) => boolean;
261
- /** Called when an individual row or the select-all control changes selection. */
261
+ /** Called when an individual row changes selection. */
262
262
  onSelectedChange: (row: T, selected: boolean) => void;
263
+ /**
264
+ * Handles the complete selectable row set in one update when the header
265
+ * checkbox changes. Falls back to `onSelectedChange` for each row when omitted.
266
+ */
267
+ onSelectAllChange?: (rows: T[], selected: boolean) => void;
263
268
  /** Accessible name for an individual row's checkbox. */
264
269
  getRowLabel: (row: T) => string;
265
270
  /** Accessible name for the header checkbox. */
package/dist/index.d.ts CHANGED
@@ -258,8 +258,13 @@ interface SortableTableRowAction<T> {
258
258
  interface SortableTableSelection<T> {
259
259
  /** Returns whether a row is selected. Selection is controlled by the consumer. */
260
260
  isSelected: (row: T) => boolean;
261
- /** Called when an individual row or the select-all control changes selection. */
261
+ /** Called when an individual row changes selection. */
262
262
  onSelectedChange: (row: T, selected: boolean) => void;
263
+ /**
264
+ * Handles the complete selectable row set in one update when the header
265
+ * checkbox changes. Falls back to `onSelectedChange` for each row when omitted.
266
+ */
267
+ onSelectAllChange?: (rows: T[], selected: boolean) => void;
263
268
  /** Accessible name for an individual row's checkbox. */
264
269
  getRowLabel: (row: T) => string;
265
270
  /** Accessible name for the header checkbox. */
package/dist/index.js CHANGED
@@ -1463,6 +1463,10 @@ function SortableTable({
1463
1463
  disabled: selectableRows.length === 0,
1464
1464
  indeterminate: someRowsSelected,
1465
1465
  onCheckedChange: (checked) => {
1466
+ if (selection.onSelectAllChange) {
1467
+ selection.onSelectAllChange(selectableRows, checked);
1468
+ return;
1469
+ }
1466
1470
  selectableRows.forEach((row) => {
1467
1471
  if (selection.isSelected(row) !== checked) {
1468
1472
  selection.onSelectedChange(row, checked);