@crewlethq/ui 0.100.2 → 0.101.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 (51) hide show
  1. package/dist/AgentHandoffPanel/index.js +1 -1
  2. package/dist/AppShell/index.js +3 -3
  3. package/dist/ArtifactCard/index.js +3 -3
  4. package/dist/ContrastBadge/index.js +2 -2
  5. package/dist/ContrastHelp/index.js +3 -3
  6. package/dist/DataGrid/DataGrid.d.ts +127 -41
  7. package/dist/DataGrid/index.d.ts +1 -1
  8. package/dist/DataGrid/index.js +4 -2
  9. package/dist/DataGrid/parts.d.ts +163 -0
  10. package/dist/{DataGrid-SAHEL4SN.css → DataGrid-ERDIPEWV.css} +205 -16
  11. package/dist/DocTabsEditor/index.js +2 -2
  12. package/dist/LogoSlot/index.js +3 -3
  13. package/dist/OrgTable/OrgTable.d.ts +5 -20
  14. package/dist/OrgTable/index.js +10 -3
  15. package/dist/{OrgTable-XYHEFI5X.css → OrgTable-5NXRECVP.css} +29 -9
  16. package/dist/PeekRail/index.js +2 -2
  17. package/dist/RailList/index.js +3 -2
  18. package/dist/RelatedRow/index.js +3 -2
  19. package/dist/SetupWizard/index.js +1 -1
  20. package/dist/SlideFilmstrip/index.js +2 -2
  21. package/dist/TableCells/TableCells.d.ts +10 -2
  22. package/dist/TableCells/index.js +3 -2
  23. package/dist/Text/index.js +2 -1
  24. package/dist/TreeGrid/TreeGrid.d.ts +143 -12
  25. package/dist/TreeGrid/index.d.ts +1 -1
  26. package/dist/TreeGrid/index.js +15 -2
  27. package/dist/{TreeGrid-H3GHMKZX.css → TreeGrid-XZCH5WCC.css} +232 -2
  28. package/dist/{chunk-G44KKOMB.js → chunk-2LLMUJFB.js} +1 -1
  29. package/dist/{chunk-BK4KUIAZ.js → chunk-AP6JSZGT.js} +12 -4
  30. package/dist/chunk-FL5DTFF3.js +557 -0
  31. package/dist/{chunk-CL3FWLDO.js → chunk-HI47TXSW.js} +1 -1
  32. package/dist/{chunk-XQWWA2LG.js → chunk-IQO6YDEM.js} +19 -51
  33. package/dist/{chunk-HTCNTCBE.js → chunk-KMMRKMBQ.js} +1 -1
  34. package/dist/chunk-LIRXQOTR.js +892 -0
  35. package/dist/{chunk-CQIODINH.js → chunk-M2DHVN6T.js} +1 -1
  36. package/dist/chunk-WSIJDWUG.js +10 -0
  37. package/dist/{chunk-O5CEG7TQ.js → chunk-XLMURU75.js} +1 -6
  38. package/dist/generated/index.js +61 -61
  39. package/dist/index.js +61 -61
  40. package/dist/styles.css +469 -30
  41. package/dist/utils/titleIfCut.d.ts +18 -0
  42. package/package.json +3 -3
  43. package/dist/chunk-CCNAGB3F.js +0 -591
  44. package/dist/chunk-CTQZK5J3.js +0 -8
  45. package/dist/chunk-ERESJG6C.js +0 -353
  46. package/dist/{chunk-HEXH3HQJ.js → chunk-A5ISYHW7.js} +2 -2
  47. package/dist/{chunk-YPXXDYTR.js → chunk-AP6SM6BL.js} +1 -1
  48. package/dist/{chunk-GCKHZMWG.js → chunk-E23AXDKL.js} +1 -1
  49. package/dist/{chunk-HBHKMFAH.js → chunk-K2GVWTHA.js} +2 -2
  50. package/dist/{chunk-EW4ULFHK.js → chunk-WTJU7MAG.js} +1 -1
  51. package/dist/{chunk-BGRYFVSK.js → chunk-XHQ2JJCB.js} +1 -1
@@ -5,10 +5,10 @@ import '../chunk-QCCWXOKK.js';
5
5
  import '../chunk-NAHA62WD.js';
6
6
  import '../chunk-P667Y6NQ.js';
7
7
  import '../chunk-E2XDYCFO.js';
8
+ import '../chunk-PIYJNCN7.js';
8
9
  import '../chunk-CMAZZY2I.js';
9
10
  import '../chunk-6KUOHUY5.js';
10
11
  import '../chunk-XSPCITPN.js';
11
- import '../chunk-PIYJNCN7.js';
12
12
  import '../chunk-2YTOOH3A.js';
13
13
  import '../chunk-56ES76ST.js';
14
14
  import '../chunk-NICEDVZM.js';
@@ -1,12 +1,12 @@
1
- export { APP_SHELL_ASIDE_WIDTH, AccountRow, AppShell, AppShellRail, AppShellRailRow, AppShellRailStatus, AppShellToggle, AppShellTopbar, readStoredWidth, useAppShell, useScreenBelow, useScreenWidth, useStoredWidth } from '../chunk-HEXH3HQJ.js';
1
+ export { APP_SHELL_ASIDE_WIDTH, AccountRow, AppShell, AppShellRail, AppShellRailRow, AppShellRailStatus, AppShellToggle, AppShellTopbar, readStoredWidth, useAppShell, useScreenBelow, useScreenWidth, useStoredWidth } from '../chunk-A5ISYHW7.js';
2
2
  import '../chunk-PCAT2EFB.js';
3
3
  import '../chunk-JLOESTT2.js';
4
- import '../chunk-JK6WLRYP.js';
5
4
  import '../chunk-YJQXESOJ.js';
5
+ import '../chunk-JK6WLRYP.js';
6
+ export { RESIZE_HANDLE_LARGE_STEP, RESIZE_HANDLE_STEP, ResizeHandle, clampSize, useAppShellAside, useAppShellPeek } from '../chunk-PIYJNCN7.js';
6
7
  import '../chunk-CMAZZY2I.js';
7
8
  import '../chunk-6KUOHUY5.js';
8
9
  import '../chunk-XSPCITPN.js';
9
- export { RESIZE_HANDLE_LARGE_STEP, RESIZE_HANDLE_STEP, ResizeHandle, clampSize, useAppShellAside, useAppShellPeek } from '../chunk-PIYJNCN7.js';
10
10
  import '../chunk-2YTOOH3A.js';
11
11
  import '../chunk-WDLAAZFZ.js';
12
12
  import '../chunk-TDFLCUBE.js';
@@ -1,4 +1,4 @@
1
- export { ArtifactCard, ArtifactCardSkeleton, ArtifactPreviewGlyph } from '../chunk-HBHKMFAH.js';
1
+ export { ArtifactCard, ArtifactCardSkeleton, ArtifactPreviewGlyph } from '../chunk-K2GVWTHA.js';
2
2
  import '../chunk-I4IUX3JF.js';
3
3
  import '../chunk-HF5L56YQ.js';
4
4
  import '../chunk-EJNJMHQG.js';
@@ -7,10 +7,10 @@ import '../chunk-U2IQNDDR.js';
7
7
  import '../chunk-AV2DXAEL.js';
8
8
  import '../chunk-YTLWOHOY.js';
9
9
  import '../chunk-XZY6S3UC.js';
10
+ import '../chunk-DOY3KC6I.js';
10
11
  import '../chunk-J5T5TDM2.js';
11
- export { ARTIFACT_KINDS, ArtifactKindGlyph } from '../chunk-RSKW25Y5.js';
12
12
  import '../chunk-M6G7XLLP.js';
13
- import '../chunk-DOY3KC6I.js';
13
+ export { ARTIFACT_KINDS, ArtifactKindGlyph } from '../chunk-RSKW25Y5.js';
14
14
  import '../chunk-56ES76ST.js';
15
15
  import '../chunk-NICEDVZM.js';
16
16
  import '../chunk-PGCLHYVP.js';
@@ -1,6 +1,6 @@
1
- export { ContrastBadge, ContrastLevelTag, contrastLevel, contrastRatio, formatContrastRatio } from '../chunk-EW4ULFHK.js';
2
- import '../chunk-7W3LYIOC.js';
1
+ export { ContrastBadge, ContrastLevelTag, contrastLevel, contrastRatio, formatContrastRatio } from '../chunk-WTJU7MAG.js';
3
2
  import '../chunk-SJ3EUCFD.js';
3
+ import '../chunk-7W3LYIOC.js';
4
4
  import '../chunk-QRE6JCHS.js';
5
5
  import '../chunk-UT6CW3C7.js';
6
6
  import '../chunk-ODEQTPFM.js';
@@ -1,8 +1,8 @@
1
- export { ContrastHelp } from '../chunk-HTCNTCBE.js';
2
- import '../chunk-EW4ULFHK.js';
3
- import '../chunk-7W3LYIOC.js';
1
+ export { ContrastHelp } from '../chunk-KMMRKMBQ.js';
2
+ import '../chunk-WTJU7MAG.js';
4
3
  import '../chunk-SJ3EUCFD.js';
5
4
  import '../chunk-LCAKSEMB.js';
5
+ import '../chunk-7W3LYIOC.js';
6
6
  import '../chunk-QRE6JCHS.js';
7
7
  import '../chunk-WDLAAZFZ.js';
8
8
  import '../chunk-TDFLCUBE.js';
@@ -1,4 +1,7 @@
1
1
  import { type MouseEvent as ReactMouseEvent, type KeyboardEvent as ReactKeyboardEvent, type ReactNode, type Ref } from 'react';
2
+ import { type ReorderLabels } from '../Reorder/index.js';
3
+ import { nextGridSort, parseGridSort, type GridAlign, type GridFootLabels } from './parts.js';
4
+ export { nextGridSort, parseGridSort };
2
5
  /**
3
6
  * What activated a row: a click, a key on the row's overlay, or the
4
7
  * application's own keymap driving the cursor (a native `KeyboardEvent`).
@@ -6,7 +9,7 @@ import { type MouseEvent as ReactMouseEvent, type KeyboardEvent as ReactKeyboard
6
9
  */
7
10
  export type DataGridActivationEvent = ReactMouseEvent | ReactKeyboardEvent | KeyboardEvent;
8
11
  /** The edge a column's head and values share. */
9
- export type DataGridAlign = 'left' | 'right' | 'center';
12
+ export type DataGridAlign = GridAlign;
10
13
  /** The track an `icon` column is drawn in: the target size and the cell's inset either side. */
11
14
  export declare const DATA_GRID_ICON_TRACK = "calc(var(--size-target-min) + var(--spacing-3) * 2)";
12
15
  /** One column of a [DataGrid]. */
@@ -14,8 +17,14 @@ export interface DataGridColumn<T> {
14
17
  key: string;
15
18
  header: ReactNode;
16
19
  cell: (row: T) => ReactNode;
17
- /** The value sorted on. Omit to make the column unsortable. */
20
+ /** The value the grid sorts the rows by, on the client. */
18
21
  sortValue?: ((row: T) => string | number | null | undefined) | undefined;
22
+ /**
23
+ * Whether the head is a sort button. Defaults to whether `sortValue` is set.
24
+ * A `serverSorted` grid sets it with no `sortValue`: its source orders the
25
+ * rows, and the head only asks it to (`onSortChange`).
26
+ */
27
+ sortable?: boolean | undefined;
19
28
  /**
20
29
  * Which edge the column's values and its head share: `left` (the default)
21
30
  * for words, `right` for figures, times and dates (their digits are
@@ -49,6 +58,19 @@ export interface DataGridColumn<T> {
49
58
  action?: boolean | undefined;
50
59
  /** Shrink to content (up to a fifth of the grid) and never wrap. */
51
60
  shrink?: boolean | undefined;
61
+ /**
62
+ * What a value does that is wider than its column: `truncate` cuts it on
63
+ * one line with an ellipsis, its whole words on hover; `wrap` breaks it over
64
+ * as many lines as it takes, for prose (a change described in a sentence).
65
+ * Left out, the cell lays out whatever `cell` draws as it is.
66
+ */
67
+ overflow?: 'truncate' | 'wrap' | undefined;
68
+ /**
69
+ * The cell's hover text, where the value drawn is not the whole story (an
70
+ * exact time under a relative one). Given, it is the title whether or not
71
+ * the value is cut.
72
+ */
73
+ title?: ((row: T) => string | undefined) | undefined;
52
74
  /**
53
75
  * On a grid drawn with `phoneRows="compact"`, a cell of the row's FIRST line
54
76
  * (what the row is: a key, a title), where every other cell is a fact about
@@ -157,17 +179,70 @@ export interface DataGridSelection<T> {
157
179
  /** A row that cannot be picked (the reader may not act on it): its box is drawn and disabled. */
158
180
  isSelectable?: ((row: T) => boolean) | undefined;
159
181
  }
182
+ /**
183
+ * Rows that open in place: a chevron before the first column, and the row's
184
+ * detail on a full-width row under it while it is open. Controlled, so the
185
+ * host keeps which rows are open (across a refetch, in its address).
186
+ */
187
+ export interface DataGridExpansion<T> {
188
+ isExpanded: (row: T) => boolean;
189
+ onToggle: (row: T) => void;
190
+ /** What the open row shows, under it, across every column. */
191
+ render: (row: T) => ReactNode;
192
+ /** The chevron's name, which says what a press does: "Show Ada's access", "Hide Ada's access". */
193
+ label: (row: T, open: boolean) => string;
194
+ /** A row with nothing to open draws no chevron. Every row can open by default. */
195
+ canExpand?: ((row: T) => boolean) | undefined;
196
+ }
197
+ /** The edge mark a row carries for a state its cells state in words. */
198
+ export type DataGridRowTone = 'info' | 'warning' | 'danger';
199
+ /**
200
+ * Rows a reader puts in order by hand: a handle before the first column,
201
+ * dragged or moved with the arrow keys, every move said aloud. The order is
202
+ * the point of such a list, so a reorderable grid draws its rows in the order
203
+ * given and sorts nothing.
204
+ */
205
+ export interface DataGridReorder<T> {
206
+ /** A finished move: `key` now stands before `beforeKey`, or last where that is null. */
207
+ onMove: (key: string, beforeKey: string | null) => void;
208
+ /** What a reader calls the row, for its handle ("Move ENG-12") and the move said aloud. */
209
+ rowName: (row: T) => string;
210
+ /** A row that holds its place: its handle is drawn and disabled. */
211
+ canMove?: ((row: T) => boolean) | undefined;
212
+ /** The row whose move is being saved: quieter, busy, and not movable until it lands. */
213
+ pendingKey?: string | null | undefined;
214
+ labels?: Partial<ReorderLabels> | undefined;
215
+ }
216
+ /**
217
+ * A row that is not a record: a total, the whole company above its seats. It
218
+ * stands on the grid's tracks, so its figures line up under their heads, and
219
+ * it is never sorted, picked or linked.
220
+ */
221
+ export interface DataGridSummaryRow {
222
+ key: string;
223
+ /** The row's name, drawn in the first column unless `cells` fills that one. */
224
+ label?: ReactNode;
225
+ /** A value per column key; a column with none is empty on this row. */
226
+ cells: Partial<Record<string, ReactNode>>;
227
+ /** Above the rows, or under them (the default, where a total goes). */
228
+ position?: 'top' | 'bottom' | undefined;
229
+ }
160
230
  /** The words a grid says, for an application that says them otherwise. */
161
- export interface DataGridLabels {
162
- /** "Hidden to fit: Due and Updated". */
163
- hiddenToFit: (names: string) => string;
164
- loadMore: string;
165
- showEveryColumn: string;
166
- /** Joins the last two names of a list: "Due and Updated". */
167
- and: string;
231
+ export interface DataGridLabels extends GridFootLabels {
168
232
  /** The head's box, over every row the grid draws. */
169
233
  selectAll: string;
234
+ /** The position column's head (`ordinal`). */
235
+ ordinal: string;
170
236
  }
237
+ /**
238
+ * The key a single move took, and the key it now stands before: read off the
239
+ * order before and after it, as an engine stores a manual rank ("move X
240
+ * before Y"). Null where the two orders are the same.
241
+ */
242
+ export declare function movedKey(before: readonly string[], after: readonly string[]): {
243
+ key: string;
244
+ before: string | null;
245
+ } | null;
171
246
  /**
172
247
  * What an application drives a grid's cursor with. The grid binds no keys of
173
248
  * its own: an application with a keymap decides which of several grids on a
@@ -206,7 +281,43 @@ export interface DataGridProps<T> {
206
281
  * its own mark.
207
282
  */
208
283
  selection?: DataGridSelection<T> | undefined;
284
+ /** A failed row: the `danger` edge of [rowTone], kept for the grids that only say this. */
209
285
  isFailed?: ((row: T) => boolean) | undefined;
286
+ /**
287
+ * The edge mark a row carries: `danger` for a row that failed or is
288
+ * refused, `warning` for one that needs the reader, `info` for one worth a
289
+ * look. A SECOND SIGNAL ONLY: the row's own cells say the state in words.
290
+ * Wins over `isFailed` where both are given.
291
+ */
292
+ rowTone?: ((row: T) => DataGridRowTone | undefined) | undefined;
293
+ /** Rows that open in place, with their detail under them: see [DataGridExpansion]. */
294
+ expansion?: DataGridExpansion<T> | undefined;
295
+ /**
296
+ * A full-width line under a row that says what the row cannot say in its
297
+ * cells (what a seat may not reach, why it is held), always shown. Null
298
+ * draws no line. The row's link is described by it.
299
+ */
300
+ rowAccessory?: ((row: T) => ReactNode) | undefined;
301
+ /** Rows put in order by hand: see [DataGridReorder]. Rows only, never bands. */
302
+ reorder?: DataGridReorder<T> | undefined;
303
+ /** A leading `#` column: each row's position in the order drawn. It never sorts. */
304
+ ordinal?: boolean | undefined;
305
+ /** Rows that are not records (totals, the whole above its parts): see [DataGridSummaryRow]. */
306
+ summaryRows?: readonly DataGridSummaryRow[] | undefined;
307
+ /**
308
+ * `compact` draws the head and every row a step shorter, for a grid in a
309
+ * drawer or a side panel read beside something else.
310
+ */
311
+ density?: 'default' | 'compact' | undefined;
312
+ /**
313
+ * The rows are on their way. With none yet, the head stays and the body
314
+ * draws `loadingRows` placeholder rows (never the empty state), so the
315
+ * grid's shape does not jump when they land; with rows, they stay. The
316
+ * table says it is busy either way.
317
+ */
318
+ loading?: boolean | undefined;
319
+ /** How many placeholder rows a loading grid with no rows draws. Three by default. */
320
+ loadingRows?: number | undefined;
210
321
  /**
211
322
  * The sort as `key` or `-key` (descending), empty for the rows' own order.
212
323
  * Controlled, so an application keeps it where it keeps state (an address).
@@ -262,25 +373,6 @@ export interface DataGridProps<T> {
262
373
  'aria-labelledby'?: string | undefined;
263
374
  className?: string | undefined;
264
375
  }
265
- /** `-updated` as `{key: "updated", desc: true}`. */
266
- export declare function parseGridSort(raw: string): {
267
- key: string;
268
- desc: boolean;
269
- } | null;
270
- /**
271
- * The sort a press on a column's head asks for: ascending, then descending,
272
- * then back to the default. PURE, so the cycle is held without a render.
273
- *
274
- * Against the EFFECTIVE sort (the reader's, else the default), because a head
275
- * that reads "descending" must take its next press as one more step from
276
- * descending, whoever chose it. Two rules keep every press a visible change:
277
- *
278
- * - a column already at its DEFAULT descending turns ascending, where the
279
- * cycle's "back to the default" would have changed nothing;
280
- * - a step that lands on the default is written as `''`, so the address holds
281
- * only what the reader chose and the default can change under it.
282
- */
283
- export declare function nextGridSort(column: string, sort: string, defaultSort?: string): string;
284
376
  /** What the fit has decided for one set of columns, at one width. */
285
377
  export interface GridFit {
286
378
  /** The column set it was decided for. */
@@ -327,18 +419,8 @@ export declare function fitGridColumns({ fit, width, overflows, stack, visible,
327
419
  }[];
328
420
  }): GridFit | null;
329
421
  /**
330
- * Whether a content-sized column has been SQUEEZED: drawn narrower than its
331
- * cap AND cutting a value short, or its HEAD. The quieter way a grid fails to
332
- * fit: rather than overrun, it shrinks a status pill to a letter, or every
333
- * head of a row of counts to its first letter over values that still fit,
334
- * while the columns that could have gone stay. Read over the head and the
335
- * first screen of rows. `leading` is how many of the grid's own columns (the
336
- * selection column) are drawn before the caller's.
337
- *
338
- * `'values'` where a value is cut short (the grid cannot be read: drop, then
339
- * stack), `'heads'` where only a head is (drop a column if one may go, but a
340
- * grid whose every value reads is not turned into cards for a head), and
341
- * null where nothing is.
422
+ * Whether a content-sized column has been squeezed: see [squeezedCells]. Read
423
+ * off the grid's head and the first screen of its rows.
342
424
  */
343
425
  export declare function squeezed<T>(wrap: HTMLElement, visible: readonly DataGridColumn<T>[], leading?: number): 'values' | 'heads' | null;
344
426
  /**
@@ -365,8 +447,12 @@ export declare function squeezed<T>(wrap: HTMLElement, visible: readonly DataGri
365
447
  * on. Stretched over the row it keeps a real href, and the cells' own links
366
448
  * and buttons sit above it.
367
449
  *
450
+ * THE GRID'S OWN COLUMNS COME FIRST, in one order: the selection box, the
451
+ * reorder handle, the position, the chevron that opens a row. None of them is
452
+ * in a column set or ever gives way.
453
+ *
368
454
  * The grid makes no scrollport of its own (`overflow: clip`), which is what
369
455
  * lets its head stick against the page's scroller; an application whose
370
456
  * scroller carries a sticky bar sets `--crewlet-data-grid-sticky-top`.
371
457
  */
372
- export declare function DataGrid<T>({ rows, bands, columns, rowKey, onRowActivate, rowHref, isSelected, selection, isFailed, sort: sortRaw, defaultSort, onSortChange, serverSorted, cols: colsRaw, onColsChange, empty, footer, onLoadMore, loadedNote, phoneRows, flush, handleRef, onPointerDown, labels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, className, }: DataGridProps<T>): import("react").JSX.Element;
458
+ export declare function DataGrid<T>({ rows, bands, columns, rowKey, onRowActivate, rowHref, isSelected, selection, isFailed, rowTone, expansion, rowAccessory, reorder, ordinal, summaryRows, density, loading, loadingRows, sort: sortRaw, defaultSort, onSortChange, serverSorted, cols: colsRaw, onColsChange, empty, footer, onLoadMore, loadedNote, phoneRows, flush, handleRef, onPointerDown, labels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, className, }: DataGridProps<T>): import("react").JSX.Element;
@@ -2,4 +2,4 @@ import './DataGrid.css';
2
2
  export { ChooserList, ColumnChooser, DATA_GRID_ICON_TRACK, DataGrid, columnChoicesOf, fitGridColumns, nextGridSort, parseGridSort, } from './DataGrid.js';
3
3
  export { countDataGridRows, useAnyDataGridDriving, useDataGridDriving } from './driving.js';
4
4
  export type { DataGridDriving } from './driving.js';
5
- export type { ColumnChoice, ChooserItem, ChooserListProps, ColumnChooserProps, DataGridActivationEvent, DataGridAlign, DataGridBand, DataGridColumn, DataGridHandle, DataGridLabels, DataGridProps, GridFit, } from './DataGrid.js';
5
+ export type { ColumnChoice, ChooserItem, ChooserListProps, ColumnChooserProps, DataGridActivationEvent, DataGridAlign, DataGridBand, DataGridColumn, DataGridExpansion, DataGridHandle, DataGridLabels, DataGridProps, DataGridReorder, DataGridRowTone, DataGridSummaryRow, GridFit, } from './DataGrid.js';
@@ -1,6 +1,8 @@
1
- export { ChooserList, ColumnChooser, DATA_GRID_ICON_TRACK, DataGrid, columnChoicesOf, countDataGridRows, fitGridColumns, nextGridSort, parseGridSort, useAnyDataGridDriving, useDataGridDriving } from '../chunk-CCNAGB3F.js';
2
- import '../chunk-CTQZK5J3.js';
1
+ export { ChooserList, ColumnChooser, DATA_GRID_ICON_TRACK, DataGrid, columnChoicesOf, countDataGridRows, fitGridColumns, nextGridSort, parseGridSort, useAnyDataGridDriving, useDataGridDriving } from '../chunk-LIRXQOTR.js';
2
+ import '../chunk-WSIJDWUG.js';
3
+ import '../chunk-BVML4UVB.js';
3
4
  import '../chunk-YJQXESOJ.js';
5
+ import '../chunk-I4IUX3JF.js';
4
6
  import '../chunk-M6G7XLLP.js';
5
7
  import '../chunk-PPUR46MK.js';
6
8
  import '../chunk-6KUOHUY5.js';
@@ -0,0 +1,163 @@
1
+ /**
2
+ * The parts DataGrid and TreeGrid draw alike: a column's head, the foot under
3
+ * the rows, the comparator, and the measurement the give-way fit reads.
4
+ *
5
+ * ONE COPY, BECAUSE TWO DRIFT. TreeGrid drew a head of its own (a word, no
6
+ * button, no order said) and no foot, so a tree table could not look or
7
+ * behave like the list beside it. Both grids now draw these parts from here,
8
+ * with DataGrid's class names, so a change to a head or a foot reaches both.
9
+ * Not exported from the package: a grid is the public shape, not its parts.
10
+ */
11
+ import type { ReactNode } from 'react';
12
+ /** The edge a column's head and values share. */
13
+ export type GridAlign = 'left' | 'right' | 'center';
14
+ /** The track an `icon` column is drawn in: the target size and the cell's inset either side. */
15
+ export declare const GRID_ICON_TRACK = "calc(var(--size-target-min) + var(--spacing-3) * 2)";
16
+ /** What a head is drawn from: the part of a column both grids share. */
17
+ export interface GridHeadColumn {
18
+ key: string;
19
+ header: ReactNode;
20
+ align?: GridAlign | undefined;
21
+ icon?: boolean | undefined;
22
+ label?: string | undefined;
23
+ action?: boolean | undefined;
24
+ shrink?: boolean | undefined;
25
+ }
26
+ /** The edge a column is drawn on: `center` for an icon column unless it says otherwise. */
27
+ export declare function alignOf(column: Pick<GridHeadColumn, 'align' | 'icon'>): GridAlign;
28
+ /** A head that is a word, or nothing. */
29
+ export declare function headerWord(column: Pick<GridHeadColumn, 'header'>): string;
30
+ /** What a reader calls the column: its head's word, else its `label`, else its key. */
31
+ export declare function columnName(column: Pick<GridHeadColumn, 'header' | 'label' | 'key'>): string;
32
+ /** `-updated` as `{key: "updated", desc: true}`. */
33
+ export declare function parseGridSort(raw: string): {
34
+ key: string;
35
+ desc: boolean;
36
+ } | null;
37
+ /**
38
+ * The sort a press on a column's head asks for: ascending, then descending,
39
+ * then back to the default. PURE, so the cycle is held without a render.
40
+ *
41
+ * Against the EFFECTIVE sort (the reader's, else the default), because a head
42
+ * that reads "descending" must take its next press as one more step from
43
+ * descending, whoever chose it. Two rules keep every press a visible change:
44
+ *
45
+ * - a column already at its DEFAULT descending turns ascending, where the
46
+ * cycle's "back to the default" would have changed nothing;
47
+ * - a step that lands on the default is written as `''`, so the address holds
48
+ * only what the reader chose and the default can change under it.
49
+ */
50
+ export declare function nextGridSort(column: string, sort: string, defaultSort?: string): string;
51
+ /**
52
+ * `items` in a new array, ordered by `get`. An absent value sorts last in both
53
+ * directions, since it is not a value. Never sorts the caller's array in place.
54
+ */
55
+ export declare function sortByValue<T>(items: readonly T[], get: (item: T) => string | number | null | undefined, desc: boolean): T[];
56
+ /** The words the head and the foot say, for an application that says them otherwise. */
57
+ export interface GridFootLabels {
58
+ /** "Hidden to fit: Due and Updated". */
59
+ hiddenToFit: (names: string) => string;
60
+ loadMore: string;
61
+ showEveryColumn: string;
62
+ /** Joins the last two names of a list: "Due and Updated". */
63
+ and: string;
64
+ }
65
+ export declare const GRID_FOOT_LABELS: GridFootLabels;
66
+ /** "Due and Updated": the columns a fit dropped, by the names a reader knows them by. */
67
+ export declare function droppedNames(columns: readonly Pick<GridHeadColumn, 'header' | 'label' | 'key'>[], dropped: readonly string[], and: string): string;
68
+ export interface GridHeadCellProps {
69
+ column: GridHeadColumn;
70
+ /** The sort in force, the reader's or the default. */
71
+ sort: {
72
+ key: string;
73
+ desc: boolean;
74
+ } | null;
75
+ /** Whether a press on this head changes the sort. */
76
+ sortable: boolean;
77
+ onSort: () => void;
78
+ /** The head's word is READ BUT NOT SEEN: a column of controls that name themselves. */
79
+ hidden?: boolean | undefined;
80
+ /** `aria-colindex`, for a grid that counts its columns (a treegrid). */
81
+ colIndex?: number | undefined;
82
+ }
83
+ /**
84
+ * One column head: the micro label, its edge, and where it sorts a button
85
+ * filling the head with the order's mark.
86
+ *
87
+ * A COLUMN THAT CANNOT BE SORTED IS NOT A BUTTON. The order in force is said
88
+ * on its head too (`aria-sort`): a grid sorted by its default, with nothing to
89
+ * press. A glyph head is still a named column: its `label`, said and shown on
90
+ * hover.
91
+ */
92
+ export declare function GridHeadCell({ column, sort, sortable, onSort, hidden, colIndex }: GridHeadCellProps): import("react").JSX.Element;
93
+ export interface GridFootProps {
94
+ footer?: ReactNode;
95
+ /** The names a fit dropped, joined; empty when it dropped none. */
96
+ dropped: string;
97
+ loadedNote?: string | undefined;
98
+ onLoadMore?: (() => void) | undefined;
99
+ /** The way back from a column set; set only while one is in force. */
100
+ onReset?: (() => void) | undefined;
101
+ labels: GridFootLabels;
102
+ /**
103
+ * How many columns the table has, where the foot is the TABLE'S OWN ROWS (a
104
+ * `rowgroup`, as a `tfoot`). Left out, the foot is a caption under a grid
105
+ * whose rows are a hierarchy (a treegrid), outside it.
106
+ */
107
+ columns?: number | undefined;
108
+ }
109
+ /**
110
+ * The foot: the caller's words, what the width dropped, what is loaded, and
111
+ * the way to more; then the way back from a column set.
112
+ *
113
+ * TABLE CONTENT OR NONE. A table may own rows and row groups and nothing
114
+ * else, and the foot sat in one as a bare box, so a list a caller put in it
115
+ * was content the table did not allow. In a table it is now a row group of
116
+ * rows of one cell across every column; under a treegrid it is outside it.
117
+ */
118
+ export declare function GridFoot({ footer, dropped, loadedNote, onLoadMore, onReset, labels, columns }: GridFootProps): import("react").JSX.Element | null;
119
+ /**
120
+ * The hover text of what lies under the pointer BENEATH a row's link: the
121
+ * title a cell's value carries, or a cut value's whole words. Null where
122
+ * there is none.
123
+ *
124
+ * WHY THE LINK ASKS. The row's link is stretched over the row and above its
125
+ * text, so the pointer is over the link wherever it is on a value: a cut
126
+ * value's words, and every title a cell carries, never reached the pointer
127
+ * in a row that links. The link takes the title of what it covers, read at
128
+ * the point the pointer is, so a linked row reads on hover as a plain one.
129
+ * A title the caller gave wins over a measured one.
130
+ */
131
+ export declare function titleBeneath(link: HTMLElement, x: number, y: number): string | null;
132
+ /** `onMouseMove` and `onMouseLeave` for a row's link: see [titleBeneath]. */
133
+ export declare const rowLinkTitle: {
134
+ onMouseMove: (event: {
135
+ currentTarget: HTMLElement;
136
+ clientX: number;
137
+ clientY: number;
138
+ }) => void;
139
+ onMouseLeave: (event: {
140
+ currentTarget: HTMLElement;
141
+ }) => void;
142
+ };
143
+ /** Whether the tracks run past the box's inner edge, read off the head's last cell. */
144
+ export declare function overrunning(box: HTMLElement, head: Element | null | undefined): boolean;
145
+ /**
146
+ * Whether a content-sized column has been SQUEEZED: drawn narrower than its
147
+ * cap AND cutting a value short, or its HEAD. The quieter way a grid fails to
148
+ * fit: rather than overrun, it shrinks a status pill to a letter, or every
149
+ * head of a row of counts to its first letter over values that still fit,
150
+ * while the columns that could have gone stay. Read over the head and the
151
+ * first screen of rows. `leading` is how many of the grid's own columns (a
152
+ * selection box, a handle) are drawn before the caller's.
153
+ *
154
+ * `'values'` where a value is cut short (the grid cannot be read: drop, then
155
+ * stack), `'heads'` where only a head is (drop a column if one may go, but a
156
+ * grid whose every value reads is not turned into cards for a head), and
157
+ * null where nothing is.
158
+ */
159
+ export declare function squeezedCells(width: number, heads: readonly Element[], rows: readonly Element[], cellsOf: (row: Element) => readonly Element[], visible: readonly {
160
+ shrink?: boolean | undefined;
161
+ width?: string | undefined;
162
+ icon?: boolean | undefined;
163
+ }[], leading?: number): 'values' | 'heads' | null;