@aircall/ds 0.45.0 → 0.46.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.
@@ -204,6 +204,12 @@ interface DataTableProps<TData> {
204
204
  */
205
205
  fixedLayout?: boolean;
206
206
  className?: string;
207
+ /**
208
+ * Test id applied to the root; the loading skeleton cells get
209
+ * `${dataTest}-loading-cell`.
210
+ * @default 'data-table'
211
+ */
212
+ 'data-test'?: string;
207
213
  }
208
214
  /**
209
215
  * Data grid built on TanStack Table. Renders a `<div>` wrapper around a DS
@@ -1341,7 +1341,7 @@ function assertEveryColumnSized(table, columnSizing) {
1341
1341
  */
1342
1342
  function DataTable(componentProps) {
1343
1343
  var _columnPinning$left$l, _columnPinning$left, _columnPinning$right$, _columnPinning$right, _resolvedColumnPinnin, _resolvedColumnPinnin2, _resolvedColumnPinnin3, _resolvedColumnPinnin4, _componentProps$virtu;
1344
- const { columns, data, getRowId, loadingState = "idle", skeletonCount = DEFAULT_SKELETON_COUNT, emptyState, sorting, onSortingChange, columnVisibility, columnPinning, selectionMode = "none", selectedKeys, defaultSelectedKeys, onSelectionChange, disabledKeys, disabledBehavior = "all", actionBar, onFetchMore, hasMore = false, enableColumnResizing = false, fillHeight = false, onRowClick, className } = componentProps;
1344
+ const { columns, data, getRowId, loadingState = "idle", skeletonCount = DEFAULT_SKELETON_COUNT, emptyState, sorting, onSortingChange, columnVisibility, columnPinning, selectionMode = "none", selectedKeys, defaultSelectedKeys, onSelectionChange, disabledKeys, disabledBehavior = "all", actionBar, onFetchMore, hasMore = false, enableColumnResizing = false, fillHeight = false, onRowClick, className, "data-test": dataTest = "data-table" } = componentProps;
1345
1345
  const sortingEnabled = !!onSortingChange;
1346
1346
  const selectionEnabled = selectionMode !== "none";
1347
1347
  const multiSelect = selectionMode === "multiple";
@@ -1509,6 +1509,7 @@ function DataTable(componentProps) {
1509
1509
  const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => fillHeight ? node.closest("[data-slot=\"table-container\"]") : null, data.length);
1510
1510
  const leafColumnCount = Math.max(table.getVisibleLeafColumns().length, 1);
1511
1511
  return /* @__PURE__ */ jsxs("div", {
1512
+ "data-test": dataTest,
1512
1513
  className: cn("relative w-full", fillHeight && "flex min-h-0 flex-1 flex-col", className),
1513
1514
  "aria-busy": isInitialLoading || isRefreshing || void 0,
1514
1515
  children: [
@@ -1538,6 +1539,7 @@ function DataTable(componentProps) {
1538
1539
  /* @__PURE__ */ jsx(TableBody, { children: isInitialLoading ? /* @__PURE__ */ jsx(SkeletonRows, {
1539
1540
  columns: table.getVisibleLeafColumns(),
1540
1541
  count: skeletonCount,
1542
+ dataTest,
1541
1543
  getCellPinProps
1542
1544
  }) : rows.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
1543
1545
  virtualItems ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1746,13 +1748,13 @@ function getPinnedCellProps(column, options) {
1746
1748
  className: cn(variant === "footer" ? "bg-[color-mix(in_oklch,var(--muted)_50%,var(--background))]" : variant === "body" ? cn("bg-background", "group-hover/row:bg-[color-mix(in_oklch,var(--accent)_30%,var(--background))]", "group-data-[state=selected]/row:bg-[color-mix(in_oklch,var(--accent)_50%,var(--background))]", "group-data-[state=selected]/row:group-hover/row:bg-[color-mix(in_oklch,var(--accent)_50%,var(--background))]") : "bg-background")
1747
1749
  };
1748
1750
  }
1749
- function SkeletonRows({ columns, count, getCellPinProps }) {
1751
+ function SkeletonRows({ columns, count, dataTest, getCellPinProps }) {
1750
1752
  return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx(TableRow, {
1751
1753
  className: "group/row",
1752
1754
  children: columns.map((col) => {
1753
1755
  const pinProps = getCellPinProps(col, "body");
1754
1756
  return /* @__PURE__ */ jsx(TableCell, {
1755
- "data-test": "loading-cell",
1757
+ "data-test": `${dataTest}-loading-cell`,
1756
1758
  style: pinProps.style,
1757
1759
  className: pinProps.className,
1758
1760
  children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full max-w-full" })
@@ -1,2 +1,2 @@
1
- import { a as OnChangeFn, i as DataTableLoadingState, n as ColumnPinningState, o as SortingState, r as DataTable, s as VisibilityState, t as ColumnDef } from "./data-table-AHgs5bxe.js";
1
+ import { a as OnChangeFn, i as DataTableLoadingState, n as ColumnPinningState, o as SortingState, r as DataTable, s as VisibilityState, t as ColumnDef } from "./data-table-BgeS8KWP.js";
2
2
  export { type ColumnDef, type ColumnPinningState, DataTable, type DataTableLoadingState, type OnChangeFn, type SortingState, type VisibilityState };
@@ -1,2 +1,2 @@
1
- import { t as DataTable } from "./data-table-sGfJhRvB.js";
1
+ import { t as DataTable } from "./data-table-Bwq4VuWA.js";
2
2
  export { DataTable };