@mirror-physics/fractal-ui 0.2.0-next.62 → 0.2.0-next.64

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
@@ -255,6 +255,16 @@ interface SortableTableRowAction<T> {
255
255
  label: (row: T, index: number) => string;
256
256
  icon: (row: T, index: number) => ReactNode;
257
257
  }
258
+ interface SortableTableSelection<T> {
259
+ /** Returns whether a row is selected. Selection is controlled by the consumer. */
260
+ isSelected: (row: T) => boolean;
261
+ /** Called when an individual row or the select-all control changes selection. */
262
+ onSelectedChange: (row: T, selected: boolean) => void;
263
+ /** Accessible name for an individual row's checkbox. */
264
+ getRowLabel: (row: T) => string;
265
+ /** Accessible name for the header checkbox. */
266
+ selectAllLabel?: string;
267
+ }
258
268
  interface SortableTablePagination {
259
269
  page: number;
260
270
  pageSize: number;
@@ -282,6 +292,10 @@ interface SortableTableProps<T> {
282
292
  */
283
293
  pagination?: SortableTablePagination;
284
294
  highlightRow?: (row: T, index: number) => boolean;
295
+ /** Adds a leading checkbox column with controlled row selection. */
296
+ selection?: SortableTableSelection<T>;
297
+ /** Disabled rows remain visible but cannot be selected or activated. */
298
+ isRowDisabled?: (row: T) => boolean;
285
299
  /** Invoked when a row is selected. Enables pointer and keyboard row activation. */
286
300
  onRowClick?: (row: T, index: number) => void;
287
301
  /** Invoked when a row is double-clicked. */
@@ -289,7 +303,7 @@ interface SortableTableProps<T> {
289
303
  /** Directional affordance displayed over the right edge of an interactive row. */
290
304
  rowAction?: SortableTableRowAction<T>;
291
305
  }
292
- declare function SortableTable<T>({ columns, data, emptyMessage, header, size, embedded, className, defaultSort, defaultSortKey, defaultSortDirection, sortKey: controlledKey, sortDirection: controlledDirection, onSortChange, pagination, highlightRow, onRowClick, onRowDoubleClick, rowAction, }: SortableTableProps<T>): React.JSX.Element;
306
+ declare function SortableTable<T>({ columns, data, emptyMessage, header, size, embedded, className, defaultSort, defaultSortKey, defaultSortDirection, sortKey: controlledKey, sortDirection: controlledDirection, onSortChange, pagination, highlightRow, selection, isRowDisabled, onRowClick, onRowDoubleClick, rowAction, }: SortableTableProps<T>): React.JSX.Element;
293
307
 
294
308
  interface TabItem {
295
309
  id: string;
@@ -545,4 +559,4 @@ declare function useEscapeDismiss(priority: number, handler: () => void, enabled
545
559
 
546
560
  declare function cn(...inputs: ClassValue[]): string;
547
561
 
548
- export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
562
+ export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
package/dist/index.d.ts CHANGED
@@ -255,6 +255,16 @@ interface SortableTableRowAction<T> {
255
255
  label: (row: T, index: number) => string;
256
256
  icon: (row: T, index: number) => ReactNode;
257
257
  }
258
+ interface SortableTableSelection<T> {
259
+ /** Returns whether a row is selected. Selection is controlled by the consumer. */
260
+ isSelected: (row: T) => boolean;
261
+ /** Called when an individual row or the select-all control changes selection. */
262
+ onSelectedChange: (row: T, selected: boolean) => void;
263
+ /** Accessible name for an individual row's checkbox. */
264
+ getRowLabel: (row: T) => string;
265
+ /** Accessible name for the header checkbox. */
266
+ selectAllLabel?: string;
267
+ }
258
268
  interface SortableTablePagination {
259
269
  page: number;
260
270
  pageSize: number;
@@ -282,6 +292,10 @@ interface SortableTableProps<T> {
282
292
  */
283
293
  pagination?: SortableTablePagination;
284
294
  highlightRow?: (row: T, index: number) => boolean;
295
+ /** Adds a leading checkbox column with controlled row selection. */
296
+ selection?: SortableTableSelection<T>;
297
+ /** Disabled rows remain visible but cannot be selected or activated. */
298
+ isRowDisabled?: (row: T) => boolean;
285
299
  /** Invoked when a row is selected. Enables pointer and keyboard row activation. */
286
300
  onRowClick?: (row: T, index: number) => void;
287
301
  /** Invoked when a row is double-clicked. */
@@ -289,7 +303,7 @@ interface SortableTableProps<T> {
289
303
  /** Directional affordance displayed over the right edge of an interactive row. */
290
304
  rowAction?: SortableTableRowAction<T>;
291
305
  }
292
- declare function SortableTable<T>({ columns, data, emptyMessage, header, size, embedded, className, defaultSort, defaultSortKey, defaultSortDirection, sortKey: controlledKey, sortDirection: controlledDirection, onSortChange, pagination, highlightRow, onRowClick, onRowDoubleClick, rowAction, }: SortableTableProps<T>): React.JSX.Element;
306
+ declare function SortableTable<T>({ columns, data, emptyMessage, header, size, embedded, className, defaultSort, defaultSortKey, defaultSortDirection, sortKey: controlledKey, sortDirection: controlledDirection, onSortChange, pagination, highlightRow, selection, isRowDisabled, onRowClick, onRowDoubleClick, rowAction, }: SortableTableProps<T>): React.JSX.Element;
293
307
 
294
308
  interface TabItem {
295
309
  id: string;
@@ -545,4 +559,4 @@ declare function useEscapeDismiss(priority: number, handler: () => void, enabled
545
559
 
546
560
  declare function cn(...inputs: ClassValue[]): string;
547
561
 
548
- export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
562
+ export { Alert, AlertDescription, AlertGhost, AlertTitle, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonColor, ButtonGhost, type ButtonGhostProps, type ButtonProps, type ButtonSize, type ButtonType, Card, CardContent, CardDescription, CardFooter, CardGhost, type CardGhostProps, CardHeader, CardTitle, Checkbox, CheckboxGhost, type CheckboxProps, Chip, ChipGhost, type ChipProps, type ChipTone, CodeBlock, type CodeBlockProps, ContentSwitcher, ContentSwitcherGhost, type ContentSwitcherItem, type ContentSwitcherProps, ConversationGhost, type ConversationGhostProps, DataTable, type DataTableColumn, DataTableGhost, type DataTableGhostProps, type DataTableProps, Disclosure, DisclosureGhost, type DisclosureProps, Dropdown, DropdownGhost, type DropdownItem, type DropdownProps, FeatureCard, type FeatureCardProps, FileDropzone, FileDropzoneGhost, type FileDropzoneProps, FolderCard, type FolderCardProps, type FormFieldGhostProps, Ghost, GhostLine, type GhostLineProps, type GhostProps, Input, InputGhost, type InputProps, Label, LabelGhost, type LabelProps, LatticeLoader, type LatticeLoaderProps, Link, LinkGhost, type LinkProps, type LinkSize, type LinkTheme, Modal, ModalGhost, type ModalProps, NumberInput, type NumberInputProps, Pagination, PaginationGhost, type PaginationProps, PasswordInput, type PasswordInputProps, PromptCard, PromptCardGhost, type PromptCardProps, type PromptCardTone, PromptGrid, type PromptGridProps, SidePanel, SidePanelGhost, type SidePanelProps, Sidebar, SidebarAccountMenu, type SidebarAccountMenuProps, SidebarBrand, SidebarFooter, SidebarGhost, type SidebarGhostProps, SidebarHeader, SidebarNav, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarSection, type SortDirection, SortableTable, type SortableTableColumn, type SortableTableDefaultSort, SortableTableGhost, type SortableTablePagination, type SortableTableProps, type SortableTableRowAction, type SortableTableSelection, type SurfaceGhostProps, type TabItem, TableSearch, type TableSearchProps, type TableSearchType, Tabs, TabsGhost, type TabsProps, type TabsVariant, TextButton, TextButtonGhost, type TextButtonIconPosition, type TextButtonProps, type TextButtonSize, type TextButtonTone, Textarea, TextareaGhost, type TextareaProps, Toggle, ToggleGhost, type ToggleProps, UILoader, type UILoaderProps, type UILoaderTone, cn, useEscapeDismiss };
package/dist/index.js CHANGED
@@ -1353,6 +1353,8 @@ function SortableTable({
1353
1353
  onSortChange,
1354
1354
  pagination,
1355
1355
  highlightRow,
1356
+ selection,
1357
+ isRowDisabled,
1356
1358
  onRowClick,
1357
1359
  onRowDoubleClick,
1358
1360
  rowAction
@@ -1400,6 +1402,10 @@ function SortableTable({
1400
1402
  const startIndex = (page - 1) * pageSize;
1401
1403
  return sorted.slice(startIndex, startIndex + pageSize);
1402
1404
  }, [pagination, sorted]);
1405
+ const selectableRows = selection ? data.filter((row) => !isRowDisabled?.(row)) : [];
1406
+ const selectedRowCount = selection ? selectableRows.filter(selection.isSelected).length : 0;
1407
+ const allRowsSelected = selectableRows.length > 0 && selectedRowCount === selectableRows.length;
1408
+ const someRowsSelected = selectedRowCount > 0 && !allRowsSelected;
1403
1409
  const handleSortClick = (key) => {
1404
1410
  let nextDirection;
1405
1411
  if (!activeKey || !activeDirection) {
@@ -1425,61 +1431,89 @@ function SortableTable({
1425
1431
  return /* @__PURE__ */ jsx19("div", { className: cn("fractal-sortable-table", `fractal-sortable-table--${size}`, embedded && "fractal-sortable-table--embedded", className), children: /* @__PURE__ */ jsxs16("div", { className: "fractal-sortable-table-surface", children: [
1426
1432
  header && /* @__PURE__ */ jsx19("div", { className: "fractal-sortable-table-header", children: header }),
1427
1433
  visibleRows.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "fractal-sortable-table-empty", children: emptyMessage || "No data" }) : /* @__PURE__ */ jsxs16("table", { className: "fractal-sortable-table-table", children: [
1428
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsx19("tr", { className: "fractal-sortable-table-thead-row", children: columns.map((col) => {
1429
- const isActive = activeKey === col.key && activeDirection !== null;
1430
- if (!col.sortable) {
1434
+ /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs16("tr", { className: "fractal-sortable-table-thead-row", children: [
1435
+ selection && /* @__PURE__ */ jsx19(
1436
+ "th",
1437
+ {
1438
+ className: "fractal-sortable-table-th fractal-sortable-table-selection-cell",
1439
+ scope: "col",
1440
+ children: /* @__PURE__ */ jsx19(
1441
+ Checkbox,
1442
+ {
1443
+ "aria-label": selection.selectAllLabel ?? "Select all rows",
1444
+ checked: allRowsSelected,
1445
+ disabled: selectableRows.length === 0,
1446
+ indeterminate: someRowsSelected,
1447
+ onCheckedChange: (checked) => {
1448
+ selectableRows.forEach((row) => {
1449
+ if (selection.isSelected(row) !== checked) {
1450
+ selection.onSelectedChange(row, checked);
1451
+ }
1452
+ });
1453
+ }
1454
+ }
1455
+ )
1456
+ }
1457
+ ),
1458
+ columns.map((col) => {
1459
+ const isActive = activeKey === col.key && activeDirection !== null;
1460
+ if (!col.sortable) {
1461
+ return /* @__PURE__ */ jsx19(
1462
+ "th",
1463
+ {
1464
+ className: "fractal-sortable-table-th",
1465
+ style: { width: col.width },
1466
+ children: col.header
1467
+ },
1468
+ col.key
1469
+ );
1470
+ }
1431
1471
  return /* @__PURE__ */ jsx19(
1432
1472
  "th",
1433
1473
  {
1434
- className: "fractal-sortable-table-th",
1474
+ className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
1435
1475
  style: { width: col.width },
1436
- children: col.header
1476
+ children: /* @__PURE__ */ jsxs16(
1477
+ "button",
1478
+ {
1479
+ type: "button",
1480
+ className: cn(
1481
+ "fractal-sortable-table-sort-button",
1482
+ isActive && "fractal-sortable-table-sort-button--active"
1483
+ ),
1484
+ onClick: () => handleSortClick(col.key),
1485
+ "aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
1486
+ children: [
1487
+ /* @__PURE__ */ jsx19("span", { children: col.header }),
1488
+ /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx19(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx19(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx19(ArrowsUpDown, { size: 14 }) })
1489
+ ]
1490
+ }
1491
+ )
1437
1492
  },
1438
1493
  col.key
1439
1494
  );
1440
- }
1441
- return /* @__PURE__ */ jsx19(
1442
- "th",
1443
- {
1444
- className: "fractal-sortable-table-th fractal-sortable-table-th--sortable",
1445
- style: { width: col.width },
1446
- children: /* @__PURE__ */ jsxs16(
1447
- "button",
1448
- {
1449
- type: "button",
1450
- className: cn(
1451
- "fractal-sortable-table-sort-button",
1452
- isActive && "fractal-sortable-table-sort-button--active"
1453
- ),
1454
- onClick: () => handleSortClick(col.key),
1455
- "aria-sort": isActive ? activeDirection === "asc" ? "ascending" : "descending" : "none",
1456
- children: [
1457
- /* @__PURE__ */ jsx19("span", { children: col.header }),
1458
- /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-sort-icon", "aria-hidden": "true", children: isActive && activeDirection === "asc" ? /* @__PURE__ */ jsx19(ArrowUp, { size: 14 }) : isActive && activeDirection === "desc" ? /* @__PURE__ */ jsx19(ArrowDown, { size: 14 }) : /* @__PURE__ */ jsx19(ArrowsUpDown, { size: 14 }) })
1459
- ]
1460
- }
1461
- )
1462
- },
1463
- col.key
1464
- );
1465
- }) }) }),
1495
+ })
1496
+ ] }) }),
1466
1497
  /* @__PURE__ */ jsx19("tbody", { children: visibleRows.map((row, rowIndex) => {
1467
1498
  const highlighted = highlightRow?.(row, rowIndex) ?? false;
1468
- const interactive = Boolean(onRowClick || onRowDoubleClick);
1469
- const action = rowAction ? {
1499
+ const disabled = isRowDisabled?.(row) ?? false;
1500
+ const interactive = !disabled && Boolean(onRowClick || onRowDoubleClick);
1501
+ const action = !disabled && rowAction ? {
1470
1502
  label: rowAction.label(row, rowIndex),
1471
1503
  icon: rowAction.icon(row, rowIndex)
1472
1504
  } : null;
1473
- return /* @__PURE__ */ jsx19(
1505
+ return /* @__PURE__ */ jsxs16(
1474
1506
  "tr",
1475
1507
  {
1476
1508
  className: cn(
1477
1509
  "fractal-sortable-table-row",
1478
1510
  highlighted && "fractal-sortable-table-row--highlighted",
1479
- interactive && "fractal-sortable-table-row--interactive"
1511
+ interactive && "fractal-sortable-table-row--interactive",
1512
+ disabled && "fractal-sortable-table-row--disabled"
1480
1513
  ),
1481
- onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
1482
- onDoubleClick: onRowDoubleClick ? () => onRowDoubleClick(row, rowIndex) : void 0,
1514
+ "data-disabled": disabled || void 0,
1515
+ onClick: !disabled && onRowClick ? () => onRowClick(row, rowIndex) : void 0,
1516
+ onDoubleClick: !disabled && onRowDoubleClick ? () => onRowDoubleClick(row, rowIndex) : void 0,
1483
1517
  onKeyDown: interactive ? (event) => {
1484
1518
  if (event.key === "Enter" || event.key === " ") {
1485
1519
  event.preventDefault();
@@ -1488,23 +1522,38 @@ function SortableTable({
1488
1522
  }
1489
1523
  } : void 0,
1490
1524
  "aria-label": action?.label,
1525
+ "aria-disabled": disabled || void 0,
1491
1526
  role: interactive ? "button" : void 0,
1492
1527
  tabIndex: interactive ? 0 : void 0,
1493
- children: columns.map((col, columnIndex) => /* @__PURE__ */ jsxs16(
1494
- "td",
1495
- {
1496
- className: cn(
1497
- "fractal-sortable-table-td",
1498
- action && columnIndex === columns.length - 1 && "fractal-sortable-table-td--row-action"
1499
- ),
1500
- style: { width: col.width, textAlign: col.align ?? "left" },
1501
- children: [
1502
- col.render(row, rowIndex),
1503
- action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
1504
- ]
1505
- },
1506
- col.key
1507
- ))
1528
+ children: [
1529
+ selection && /* @__PURE__ */ jsx19("td", { className: "fractal-sortable-table-td fractal-sortable-table-selection-cell", children: /* @__PURE__ */ jsx19(
1530
+ Checkbox,
1531
+ {
1532
+ "aria-label": selection.getRowLabel(row),
1533
+ checked: !disabled && selection.isSelected(row),
1534
+ disabled,
1535
+ onClick: (event) => event.stopPropagation(),
1536
+ onCheckedChange: (checked) => {
1537
+ if (!disabled) selection.onSelectedChange(row, checked);
1538
+ }
1539
+ }
1540
+ ) }),
1541
+ columns.map((col, columnIndex) => /* @__PURE__ */ jsxs16(
1542
+ "td",
1543
+ {
1544
+ className: cn(
1545
+ "fractal-sortable-table-td",
1546
+ action && columnIndex === columns.length - 1 && "fractal-sortable-table-td--row-action"
1547
+ ),
1548
+ style: { width: col.width, textAlign: col.align ?? "left" },
1549
+ children: [
1550
+ col.render(row, rowIndex),
1551
+ action && columnIndex === columns.length - 1 && /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-row-action", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("span", { className: "fractal-sortable-table-row-action__icon", children: action.icon }) })
1552
+ ]
1553
+ },
1554
+ col.key
1555
+ ))
1556
+ ]
1508
1557
  },
1509
1558
  rowIndex
1510
1559
  );