@aircall/ds 0.34.1 → 0.35.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.
@@ -0,0 +1,2 @@
1
+ import { a as SortingState, i as OnChangeFn, n as DataTable, r as DataTableLoadingState, t as ColumnDef } from "./data-table-C9eD8va8.js";
2
+ export { type ColumnDef, DataTable, type DataTableLoadingState, type OnChangeFn, type SortingState };
@@ -0,0 +1,2 @@
1
+ import { t as DataTable } from "./data-table-DpKxtE_u.js";
2
+ export { DataTable };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as SortingState, i as OnChangeFn, n as DataTable, r as DataTableLoadingState, t as ColumnDef } from "./data-table-C9eD8va8.js";
1
2
  import * as React from "react";
2
3
  import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
3
4
  import { ClassValue } from "clsx";
@@ -17,7 +18,6 @@ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
17
18
  import { Combobox as Combobox$1 } from "@base-ui/react";
18
19
  import { Command as Command$1 } from "cmdk";
19
20
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
20
- import { ColumnDef, ColumnDef as ColumnDef$1, OnChangeFn, OnChangeFn as OnChangeFn$1, RowData, SortingState, SortingState as SortingState$1 } from "@tanstack/react-table";
21
21
  import { ItemInstance } from "@headless-tree/core";
22
22
  import { Popover as Popover$1 } from "@base-ui/react/popover";
23
23
  import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";
@@ -2352,171 +2352,6 @@ declare namespace DataCombobox {
2352
2352
  */
2353
2353
  type DataComboboxLoadingState = ComboboxLoadingState;
2354
2354
  //#endregion
2355
- //#region src/components/data-table.d.ts
2356
- declare module '@tanstack/react-table' {
2357
- interface ColumnMeta<TData extends RowData, TValue> {
2358
- /**
2359
- * Stick this column to the left or right edge while the table scrolls
2360
- * horizontally. Implies fixed column widths (`table-layout: fixed`); set an
2361
- * explicit `size` on pinned columns. When any column is pinned and selection
2362
- * is enabled, the built-in selection column is also auto-pinned to the left.
2363
- */
2364
- pin?: 'left' | 'right';
2365
- }
2366
- }
2367
- /** Async states a `DataTable` can be in (mirrors React Spectrum's `loadingState`). */
2368
- type DataTableLoadingState = 'idle' | 'loading' | 'sorting' | 'filtering' | 'loadingMore';
2369
- interface DataTableProps<TData> {
2370
- /**
2371
- * Column definitions for the table. Define a column's `footer` to render a
2372
- * summary row — the table auto-shows a `<tfoot>` when any column has one, with
2373
- * footer cells aligned under their columns.
2374
- *
2375
- * Pin a column while scrolling horizontally with `meta: { pin: 'left' | 'right' }`.
2376
- * Pinned columns imply fixed widths — set an explicit `size` on each.
2377
- */
2378
- columns: ColumnDef$1<TData, unknown>[];
2379
- /** Data array to render. With server-side sorting/pagination, this is the already-prepared page. */
2380
- data: TData[];
2381
- /** Stable row id resolver. Required for selection to persist across data changes. */
2382
- getRowId?: (row: TData, index: number) => string;
2383
- /**
2384
- * The table's async state (mirrors React Spectrum's single `loadingState`):
2385
- * - `'loading'` — initial load with no data yet; the body shows skeleton rows.
2386
- * - `'sorting'` / `'filtering'` — re-querying an already-loaded table; the
2387
- * current rows stay in place under a dimmed overlay with a spinner.
2388
- * - `'loadingMore'` — fetching the next page for infinite scroll; a spinner
2389
- * row renders at the bottom.
2390
- * Omit (or `'idle'`) when not loading.
2391
- */
2392
- loadingState?: DataTableLoadingState;
2393
- /** Number of skeleton rows when `loadingState` is `'loading'`. */
2394
- skeletonCount?: number;
2395
- /**
2396
- * Rendered when there are no rows and not loading. Provide an `<Empty>`
2397
- * component (icon, copy, actions) — render different content based on context
2398
- * (no data vs. no search results). Nothing is shown when omitted.
2399
- */
2400
- emptyState?: React.ReactNode;
2401
- /** Controlled sorting state. Pass alongside `onSortingChange` to enable sortable headers. */
2402
- sorting?: SortingState$1;
2403
- /** Called when the user toggles a sortable header. */
2404
- onSortingChange?: OnChangeFn$1<SortingState$1>;
2405
- /**
2406
- * Enables interactive column resizing. Each resizable header gets a drag
2407
- * handle on its right edge; column widths come from each column's `size`
2408
- * (and are bounded by `minSize`/`maxSize`). Set `enableResizing: false` on a
2409
- * column def to pin it (e.g. an actions column).
2410
- */
2411
- enableColumnResizing?: boolean;
2412
- /**
2413
- * The type of selection allowed (mirrors React Spectrum's `selectionMode`):
2414
- * - `'none'` — selection off; no checkbox column (default).
2415
- * - `'single'` — one row at a time; a checkbox column is prepended with no
2416
- * select-all header, and selecting a row clears any other.
2417
- * - `'multiple'` — many rows; the checkbox column gets a select-all header.
2418
- *
2419
- * Selection keys are the values returned by `getRowId` (its index when
2420
- * `getRowId` is omitted), matching React Spectrum's key-based model.
2421
- */
2422
- selectionMode?: 'none' | 'single' | 'multiple';
2423
- /**
2424
- * Controlled set of selected row ids. Pass alongside `onSelectionChange`. For
2425
- * uncontrolled selection, use `defaultSelectedKeys` instead (or neither).
2426
- */
2427
- selectedKeys?: Set<string>;
2428
- /**
2429
- * Initial selected row ids for uncontrolled selection (mirrors React
2430
- * Spectrum's `defaultSelectedKeys`). Ignored when `selectedKeys` is provided.
2431
- */
2432
- defaultSelectedKeys?: Set<string>;
2433
- /** Called with the new set of selected row ids whenever selection changes. */
2434
- onSelectionChange?: (keys: Set<string>) => void;
2435
- /** Row ids that cannot be selected (mirrors React Spectrum's `disabledKeys`). */
2436
- disabledKeys?: Set<string>;
2437
- /**
2438
- * How `disabledKeys` rows behave (mirrors React Spectrum's `disabledBehavior`):
2439
- * - `'all'` — fully disabled: no checkbox, the row is dimmed and does not
2440
- * respond to clicks/`onRowClick` (default).
2441
- * - `'selection'` — disabled for selection only: no checkbox, but the row is
2442
- * not dimmed and still fires `onRowClick`.
2443
- */
2444
- disabledBehavior?: 'selection' | 'all';
2445
- /** Bar rendered floating at the bottom while there is at least one selected row. */
2446
- actionBar?: React.ReactNode;
2447
- /** Called when the user scrolls near the bottom; use to fetch the next page. */
2448
- onFetchMore?: () => void;
2449
- /** Whether more pages are available. */
2450
- hasMore?: boolean;
2451
- /**
2452
- * Called when a data row is activated by click. With row selection enabled,
2453
- * this fires only while nothing is selected — once there is a selection, a row
2454
- * click toggles that row instead (the "click anywhere to select" pattern, as in
2455
- * React Spectrum). Clicks on the selection checkbox never fire this.
2456
- */
2457
- onRowClick?: (row: TData) => void;
2458
- /**
2459
- * Fills the parent's height and scrolls the table body internally, keeping
2460
- * the header pinned (sticky). The parent must provide a bounded height — e.g.
2461
- * a flex column (`flex flex-col` + `min-h-0`). Common for full-page lists.
2462
- *
2463
- * Required when using `virtualizeRows` — the virtualizer tracks `scrollTop` on
2464
- * this container; without it the page scrolls and virtualization has no effect.
2465
- */
2466
- fillHeight?: boolean;
2467
- /**
2468
- * Enables row virtualization via `@tanstack/react-virtual` — only visible rows
2469
- * are rendered, keeping DOM size constant for large datasets (1 000+ rows).
2470
- * Works independently of `onFetchMore`: use it for infinite-scroll tables that
2471
- * accumulate many pages, or for any static dataset with 1 000+ rows.
2472
- *
2473
- * Requires `fillHeight={true}` — the container must scroll internally so the
2474
- * virtualizer can track scroll position. Without it, `scrollTop` stays 0 and
2475
- * virtualization has no effect.
2476
- *
2477
- * Implies `fixedLayout` (`table-layout: fixed`): the virtualizer needs stable
2478
- * column widths, so every column takes its `size` instead of sizing to
2479
- * content. Columns with no `size` fall back to TanStack's 150px default — so
2480
- * a content-sized table (e.g. a narrow icon column) will visibly snap to
2481
- * 150px when you enable this. Set an explicit `size` on each column def to
2482
- * preserve the intended widths.
2483
- */
2484
- virtualizeRows?: boolean;
2485
- /**
2486
- * Uses a fixed table layout (`table-layout: fixed`): column widths come from
2487
- * each column's `size` (defaulting to 150) instead of the widest cell, so the
2488
- * layout stays stable as different-length content loads. Long cell content
2489
- * should be truncated by the cell (e.g. a `truncate` wrapper).
2490
- *
2491
- * This is width-pinning WITHOUT interactivity — unlike `enableColumnResizing`
2492
- * it adds no drag handles, and unlike `virtualizeRows` it needs no
2493
- * `fillHeight`. Use it for content-stable lists where columns shouldn't
2494
- * reflow. (`enableColumnResizing`, `virtualizeRows`, and column pinning via
2495
- * `meta.pin` imply this too.)
2496
- */
2497
- fixedLayout?: boolean;
2498
- className?: string;
2499
- }
2500
- /**
2501
- * Data grid built on TanStack Table. Renders a `<div>` wrapper around a DS
2502
- * `<Table>` (`<table>`), driven by `columns` + `data`, with opt-in sorting,
2503
- * row selection, column resizing, column pinning (`meta.pin`), virtualization,
2504
- * infinite scroll, a floating action bar, and loading/empty states.
2505
- *
2506
- * @example
2507
- * ```tsx
2508
- * <DataTable
2509
- * columns={columns}
2510
- * data={rows}
2511
- * getRowId={row => row.id}
2512
- * />
2513
- * ```
2514
- */
2515
- declare function DataTable<TData>(componentProps: DataTable.Props<TData>): React.JSX.Element;
2516
- declare namespace DataTable {
2517
- type Props<TData> = DataTableProps<TData>;
2518
- }
2519
- //#endregion
2520
2355
  //#region src/components/data-tree.d.ts
2521
2356
  type SelectionMode = 'none' | 'single' | 'multiple';
2522
2357
  interface DataTreeProps<T> {