@dxos/react-ui-table 0.4.8-main.fff1521 → 0.4.8-next.06fa7e4

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.
@@ -1,10 +1,40 @@
1
1
  // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
2
- import { Check, CaretDown, Trash, X } from "@phosphor-icons/react";
3
- import React, { useRef, useState } from "react";
4
- import { Button, DensityProvider, Input, Popover, Select, Separator, useTranslation } from "@dxos/react-ui";
5
- import { getSize, mx } from "@dxos/react-ui-theme";
2
+ import { Check, Trash, X, GearSix } from "@phosphor-icons/react";
3
+ import React2, { useRef, useState } from "react";
4
+ import { Button as Button2, DensityProvider, Input, Popover, Select, Separator, useTranslation } from "@dxos/react-ui";
5
+ import { getSize as getSize2, mx } from "@dxos/react-ui-theme";
6
6
  import { safeParseInt } from "@dxos/util";
7
7
 
8
+ // packages/ui/react-ui-table/src/components/SortButton.tsx
9
+ import { CaretUpDown, SortAscending, SortDescending } from "@phosphor-icons/react";
10
+ import React from "react";
11
+ import { Button } from "@dxos/react-ui";
12
+ import { getSize } from "@dxos/react-ui-theme";
13
+ var SortButton = ({ sortDirection, onClick }) => {
14
+ let icon;
15
+ const size = getSize(4);
16
+ switch (sortDirection) {
17
+ case "asc":
18
+ icon = /* @__PURE__ */ React.createElement(SortAscending, {
19
+ className: size
20
+ });
21
+ break;
22
+ case "desc":
23
+ icon = /* @__PURE__ */ React.createElement(SortDescending, {
24
+ className: size
25
+ });
26
+ break;
27
+ default:
28
+ icon = /* @__PURE__ */ React.createElement(CaretUpDown, {
29
+ className: size
30
+ });
31
+ }
32
+ return /* @__PURE__ */ React.createElement(Button, {
33
+ variant: "ghost",
34
+ onClick
35
+ }, icon);
36
+ };
37
+
8
38
  // packages/ui/react-ui-table/src/translations.ts
9
39
  var translationKey = "table";
10
40
  var translations_default = [
@@ -31,19 +61,26 @@ var translations_default = [
31
61
  // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
32
62
  var ColumnMenu = ({ column, ...props }) => {
33
63
  const title = column.label?.length ? column.label : column.id;
34
- return /* @__PURE__ */ React.createElement("div", {
64
+ const header = props.context.header;
65
+ const canSort = header.column.getCanSort();
66
+ const sortDirection = header.column.getIsSorted();
67
+ const toggleSort = header.column.getToggleSortingHandler();
68
+ return /* @__PURE__ */ React2.createElement("div", {
35
69
  className: "flex items-center gap-2"
36
- }, /* @__PURE__ */ React.createElement("div", {
70
+ }, /* @__PURE__ */ React2.createElement("div", {
37
71
  className: "flex-1 min-is-0 truncate",
38
72
  title
39
- }, title), /* @__PURE__ */ React.createElement("div", {
40
- className: "flex shrink-0"
41
- }, /* @__PURE__ */ React.createElement(ColumnPanel, {
73
+ }, title), /* @__PURE__ */ React2.createElement("div", {
74
+ className: "flex gap-0"
75
+ }, canSort && toggleSort && /* @__PURE__ */ React2.createElement(SortButton, {
76
+ sortDirection,
77
+ onClick: toggleSort
78
+ }), /* @__PURE__ */ React2.createElement(ColumnPanel, {
42
79
  ...props,
43
80
  column
44
81
  })));
45
82
  };
46
- var Section = ({ children, className }) => /* @__PURE__ */ React.createElement("div", {
83
+ var Section = ({ children, className }) => /* @__PURE__ */ React2.createElement("div", {
47
84
  role: "none",
48
85
  className: mx("p-2", className)
49
86
  }, children);
@@ -84,124 +121,122 @@ var ColumnPanel = ({ context, tableDefs, tableDef, column, onUpdate, onDelete })
84
121
  });
85
122
  setOpen(false);
86
123
  };
87
- return /* @__PURE__ */ React.createElement(Popover.Root, {
124
+ return /* @__PURE__ */ React2.createElement(Popover.Root, {
88
125
  open,
89
126
  onOpenChange: (nextOpen) => setOpen(nextOpen)
90
- }, /* @__PURE__ */ React.createElement(Popover.Trigger, {
127
+ }, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
91
128
  asChild: true
92
- }, /* @__PURE__ */ React.createElement(Button, {
93
- variant: "ghost",
94
- classNames: "p-1"
95
- }, /* @__PURE__ */ React.createElement(CaretDown, {
96
- className: getSize(4)
97
- }))), /* @__PURE__ */ React.createElement(Popover.Portal, null, /* @__PURE__ */ React.createElement(Popover.Content, null, /* @__PURE__ */ React.createElement(Popover.Viewport, {
129
+ }, /* @__PURE__ */ React2.createElement(Button2, {
130
+ variant: "ghost"
131
+ }, /* @__PURE__ */ React2.createElement(GearSix, {
132
+ className: mx(getSize2(4), "rotate-90")
133
+ }))), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, null, /* @__PURE__ */ React2.createElement(Popover.Viewport, {
98
134
  classNames: "w-60"
99
- }, /* @__PURE__ */ React.createElement(DensityProvider, {
135
+ }, /* @__PURE__ */ React2.createElement(DensityProvider, {
100
136
  density: "fine"
101
- }, /* @__PURE__ */ React.createElement("div", {
137
+ }, /* @__PURE__ */ React2.createElement("div", {
102
138
  className: "flex flex-col gap-1"
103
- }, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
139
+ }, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
104
140
  classNames: "mbe-1"
105
- }, t("column label label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
141
+ }, t("column label label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
106
142
  placeholder: "Column label",
107
143
  value: label ?? "",
108
144
  onChange: (event) => setLabel(event.target.value),
109
145
  autoFocus: true
110
- })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
146
+ })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
111
147
  classNames: "mbe-1 mbs-3"
112
- }, t("property key label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
148
+ }, t("property key label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
113
149
  ref: propRef,
114
150
  placeholder: "Property key",
115
151
  // TODO(burdon): Provide hooks for value normalization, ENTER, ESC, etc.
116
152
  value: prop ?? "",
117
153
  onChange: (event) => setProp(event.target.value.replace(/[^\w_]/g, ""))
118
- })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
154
+ })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
119
155
  classNames: "mbe-1 mbs-3"
120
- }, t("column type label")), /* @__PURE__ */ React.createElement(Select.Root, {
156
+ }, t("column type label")), /* @__PURE__ */ React2.createElement(Select.Root, {
121
157
  value: type,
122
158
  onValueChange: setType
123
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
159
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
124
160
  placeholder: "Type",
125
161
  classNames: "is-full"
126
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, [
162
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, [
127
163
  "number",
128
164
  "boolean",
129
165
  "string",
130
166
  "ref"
131
- ].map((type2) => /* @__PURE__ */ React.createElement(Select.Option, {
167
+ ].map((type2) => /* @__PURE__ */ React2.createElement(Select.Option, {
132
168
  key: type2,
133
169
  value: type2
134
- }, t(`${type2} column type label`))))))))), type === "number" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
170
+ }, t(`${type2} column type label`))))))))), type === "number" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
135
171
  classNames: "mbe-1 mbs-3"
136
- }, t("digits label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
172
+ }, t("digits label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
137
173
  value: digits ?? "",
138
174
  onChange: (event) => setDigits(event.target.value)
139
- })))), type === "ref" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
175
+ })))), type === "ref" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
140
176
  classNames: "mbe-1 mbs-3"
141
- }, "Table"), /* @__PURE__ */ React.createElement(Select.Root, {
177
+ }, "Table"), /* @__PURE__ */ React2.createElement(Select.Root, {
142
178
  value: refTable,
143
179
  onValueChange: setRefTable
144
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
180
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
145
181
  placeholder: "Table",
146
182
  classNames: "is-full"
147
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, tableDefs.filter((t2) => t2.id !== tableDef.id).map(({ id, name }) => /* @__PURE__ */ React.createElement(Select.Option, {
183
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, tableDefs.filter((t2) => t2.id !== tableDef.id).map(({ id, name }) => /* @__PURE__ */ React2.createElement(Select.Option, {
148
184
  key: id,
149
185
  value: id
150
- }, name ?? id))))))), refTable && /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
186
+ }, name ?? id))))))), refTable && /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
151
187
  classNames: "mbe-1 mbs-3"
152
- }, "Table property"), /* @__PURE__ */ React.createElement(Select.Root, {
188
+ }, "Table property"), /* @__PURE__ */ React2.createElement(Select.Root, {
153
189
  value: refProp,
154
190
  onValueChange: setRefProp
155
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
191
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
156
192
  placeholder: "Property",
157
193
  classNames: "is-full"
158
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, tableDefs.find((tableDef2) => tableDef2.id === refTable)?.columns.map(({ id, label: label2 }) => /* @__PURE__ */ React.createElement(Select.Option, {
194
+ }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, tableDefs.find((tableDef2) => tableDef2.id === refTable)?.columns.map(({ id, label: label2 }) => /* @__PURE__ */ React2.createElement(Select.Option, {
159
195
  key: id,
160
196
  value: id
161
- }, label2 ?? id))))))))), /* @__PURE__ */ React.createElement(Separator, {
197
+ }, label2 ?? id))))))))), /* @__PURE__ */ React2.createElement(Separator, {
162
198
  classNames: "mli-2"
163
- }), /* @__PURE__ */ React.createElement(Section, {
199
+ }), /* @__PURE__ */ React2.createElement(Section, {
164
200
  className: "space-b-1.5"
165
- }, /* @__PURE__ */ React.createElement(Button, {
201
+ }, /* @__PURE__ */ React2.createElement(Button2, {
166
202
  variant: "primary",
167
203
  classNames: "is-full flex gap-2",
168
204
  onClick: handleSave
169
- }, /* @__PURE__ */ React.createElement("span", null, t("save label")), /* @__PURE__ */ React.createElement("div", {
205
+ }, /* @__PURE__ */ React2.createElement("span", null, t("save label")), /* @__PURE__ */ React2.createElement("div", {
170
206
  className: "grow"
171
- }), /* @__PURE__ */ React.createElement(Check, {
172
- className: getSize(5)
173
- })), /* @__PURE__ */ React.createElement(Button, {
207
+ }), /* @__PURE__ */ React2.createElement(Check, {
208
+ className: getSize2(5)
209
+ })), /* @__PURE__ */ React2.createElement(Button2, {
174
210
  classNames: "is-full flex gap-2",
175
211
  onClick: handleCancel
176
- }, /* @__PURE__ */ React.createElement("span", null, t("cancel label", {
212
+ }, /* @__PURE__ */ React2.createElement("span", null, t("cancel label", {
177
213
  ns: "os"
178
- })), /* @__PURE__ */ React.createElement("div", {
214
+ })), /* @__PURE__ */ React2.createElement("div", {
179
215
  className: "grow"
180
- }), /* @__PURE__ */ React.createElement(X, {
181
- className: getSize(5)
182
- })), /* @__PURE__ */ React.createElement(Button, {
216
+ }), /* @__PURE__ */ React2.createElement(X, {
217
+ className: getSize2(5)
218
+ })), /* @__PURE__ */ React2.createElement(Button2, {
183
219
  classNames: "is-full flex gap-2",
184
220
  onClick: () => onDelete?.(column.id)
185
- }, /* @__PURE__ */ React.createElement("span", null, t("delete label")), /* @__PURE__ */ React.createElement("div", {
221
+ }, /* @__PURE__ */ React2.createElement("span", null, t("delete label")), /* @__PURE__ */ React2.createElement("div", {
186
222
  className: "grow"
187
- }), /* @__PURE__ */ React.createElement(Trash, {
188
- className: getSize(5)
189
- })))))), /* @__PURE__ */ React.createElement(Popover.Arrow, null))));
223
+ }), /* @__PURE__ */ React2.createElement(Trash, {
224
+ className: getSize2(5)
225
+ })))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
190
226
  };
191
227
 
192
228
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
193
229
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
194
- import { getCoreRowModel, useReactTable, getGroupedRowModel } from "@tanstack/react-table";
230
+ import { getCoreRowModel, getSortedRowModel, useReactTable, getGroupedRowModel, getExpandedRowModel } from "@tanstack/react-table";
195
231
  import { useVirtualizer } from "@tanstack/react-virtual";
196
- import React6, { Fragment, useCallback, useEffect, useState as useState2 } from "react";
197
- import { debounce } from "@dxos/async";
232
+ import React7, { Fragment, useCallback, useEffect, useState as useState2 } from "react";
198
233
  import { log } from "@dxos/log";
199
- import { useDefaultValue } from "@dxos/react-ui";
234
+ import { useDefaultValue, useOnTransition } from "@dxos/react-ui";
200
235
 
201
236
  // packages/ui/react-ui-table/src/components/Table/TableBody.tsx
202
237
  import { useArrowNavigationGroup } from "@fluentui/react-tabster";
203
238
  import { flexRender } from "@tanstack/react-table";
204
- import React3 from "react";
239
+ import React4 from "react";
205
240
 
206
241
  // packages/ui/react-ui-table/src/components/Table/TableContext.tsx
207
242
  import { createContext } from "@radix-ui/react-context";
@@ -234,7 +269,7 @@ var tfootTh = ({ border }, ...etc) => mx2(textPadding, modalSurface, border && g
234
269
 
235
270
  // packages/ui/react-ui-table/src/components/Cell/Cell.tsx
236
271
  import { useFocusableGroup } from "@fluentui/react-tabster";
237
- import React2 from "react";
272
+ import React3 from "react";
238
273
  var CELL_NAME = "Cell";
239
274
  var FocusableCell = ({ cell, children }) => {
240
275
  const tableContext = useTableContext(CELL_NAME);
@@ -242,7 +277,7 @@ var FocusableCell = ({ cell, children }) => {
242
277
  tabBehavior: "limited"
243
278
  });
244
279
  const className = tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames);
245
- return /* @__PURE__ */ React2.createElement("td", {
280
+ return /* @__PURE__ */ React3.createElement("td", {
246
281
  tabIndex: 0,
247
282
  ...domAttributes,
248
283
  className
@@ -250,14 +285,14 @@ var FocusableCell = ({ cell, children }) => {
250
285
  };
251
286
  var StaticCell = ({ cell, children }) => {
252
287
  const tableContext = useTableContext(CELL_NAME);
253
- return /* @__PURE__ */ React2.createElement("td", {
288
+ return /* @__PURE__ */ React3.createElement("td", {
254
289
  className: tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames)
255
290
  }, children);
256
291
  };
257
292
  var Cell = ({ cell, children }) => {
258
293
  const { isGrid } = useTableContext(CELL_NAME);
259
294
  const Root = isGrid ? FocusableCell : StaticCell;
260
- return /* @__PURE__ */ React2.createElement(Root, {
295
+ return /* @__PURE__ */ React3.createElement(Root, {
261
296
  cell
262
297
  }, children);
263
298
  };
@@ -272,10 +307,10 @@ var TableBody = ({ rows }) => {
272
307
  axis: "grid"
273
308
  });
274
309
  const canBeCurrent = !isGrid && !!onDatumClick;
275
- return /* @__PURE__ */ React3.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
310
+ return /* @__PURE__ */ React4.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
276
311
  const isCurrent = currentDatum === row.original;
277
312
  const isSelected = rowSelection?.[row.id];
278
- return /* @__PURE__ */ React3.createElement("tr", {
313
+ return /* @__PURE__ */ React4.createElement("tr", {
279
314
  key: keyAccessor ? keyAccessor(row.original) : row.id,
280
315
  className: tbodyTr({
281
316
  canBeCurrent
@@ -297,82 +332,83 @@ var TableBody = ({ rows }) => {
297
332
  }
298
333
  }
299
334
  }
300
- }, debug && /* @__PURE__ */ React3.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
301
- return /* @__PURE__ */ React3.createElement(Cell, {
335
+ }, debug && /* @__PURE__ */ React4.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
336
+ return /* @__PURE__ */ React4.createElement(Cell, {
302
337
  key: cell.id,
303
338
  cell
304
339
  }, flexRender(cell.column.columnDef.cell, {
305
340
  className: "pli-2",
306
341
  ...cell.getContext()
307
342
  }));
308
- }), expand && /* @__PURE__ */ React3.createElement("td", null));
343
+ }), expand && /* @__PURE__ */ React4.createElement("td", null));
309
344
  }));
310
345
  };
311
346
  TableBody.displayName = TABLE_BODY_NAME;
312
347
 
313
348
  // packages/ui/react-ui-table/src/components/Table/TableFooter.tsx
314
349
  import { flexRender as flexRender2 } from "@tanstack/react-table";
315
- import React4 from "react";
350
+ import React5 from "react";
316
351
  var TABLE_FOOT_NAME = "TableFooter";
317
352
  var TableFooter = (props) => {
318
353
  const tableContext = useTableContext(TABLE_FOOT_NAME);
319
354
  const { table, expand, debug } = tableContext;
320
355
  const footers = table.getFooterGroups();
321
- return /* @__PURE__ */ React4.createElement("tfoot", {
356
+ return /* @__PURE__ */ React5.createElement("tfoot", {
322
357
  className: tfootRoot(props)
323
- }, footers.map((footerGroup) => /* @__PURE__ */ React4.createElement("tr", {
358
+ }, footers.map((footerGroup) => /* @__PURE__ */ React5.createElement("tr", {
324
359
  key: footerGroup.id,
325
360
  className: tfootTr(tableContext)
326
- }, debug && /* @__PURE__ */ React4.createElement("th", null), footerGroup.headers.map((footer) => {
327
- return /* @__PURE__ */ React4.createElement("th", {
361
+ }, debug && /* @__PURE__ */ React5.createElement("th", null), footerGroup.headers.map((footer) => {
362
+ return /* @__PURE__ */ React5.createElement("th", {
328
363
  key: footer.id,
329
364
  className: tfootTh(tableContext, footer.column.columnDef.meta?.footer?.classNames)
330
365
  }, footer.isPlaceholder ? null : flexRender2(footer.column.columnDef.footer, footer.getContext()));
331
- }), expand && /* @__PURE__ */ React4.createElement("th", null))));
366
+ }), expand && /* @__PURE__ */ React5.createElement("th", null))));
332
367
  };
333
368
  TableFooter.displayName = TABLE_FOOT_NAME;
334
369
 
335
370
  // packages/ui/react-ui-table/src/components/Table/TableHead.tsx
336
371
  import { flexRender as flexRender3 } from "@tanstack/react-table";
337
- import React5 from "react";
372
+ import React6 from "react";
338
373
  import { mx as mx3 } from "@dxos/react-ui-theme";
339
374
  var TABLE_HEAD_NAME = "TableHeader";
340
375
  var TableHead = (_props) => {
341
376
  const tableContext = useTableContext(TABLE_HEAD_NAME);
342
377
  const headerGroups = tableContext.table.getHeaderGroups();
343
378
  const state = tableContext.table.getState();
344
- return /* @__PURE__ */ React5.createElement("thead", {
379
+ return /* @__PURE__ */ React6.createElement("thead", {
345
380
  className: theadRoot(tableContext)
346
381
  }, headerGroups.map((headerGroup) => {
347
382
  return (
348
383
  // Group element to hover resize handles.
349
- /* @__PURE__ */ React5.createElement("tr", {
384
+ /* @__PURE__ */ React6.createElement("tr", {
350
385
  key: headerGroup.id,
351
386
  className: theadTr(tableContext)
352
- }, tableContext.debug && /* @__PURE__ */ React5.createElement("th", {
387
+ }, tableContext.debug && /* @__PURE__ */ React6.createElement("th", {
353
388
  className: "font-mono",
354
389
  style: {
355
390
  width: 32
356
391
  }
357
392
  }, "#"), headerGroup.headers.map((header) => {
358
393
  const isResizing = header.column.getIsResizing();
359
- return /* @__PURE__ */ React5.createElement("th", {
394
+ const resizeHandler = header.getResizeHandler();
395
+ return /* @__PURE__ */ React6.createElement("th", {
360
396
  key: header.id,
361
397
  style: {
362
398
  width: header.getSize()
363
399
  },
364
400
  className: theadTh(tableContext, header.column.columnDef.meta?.header?.classNames)
365
- }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), header.column.columnDef.meta?.resizable && /* @__PURE__ */ React5.createElement("div", {
401
+ }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), header.column.columnDef.meta?.resizable && /* @__PURE__ */ React6.createElement("div", {
366
402
  className: theadResizeRoot(tableContext, isResizing && "hidden"),
367
403
  style: {
368
404
  transform: `translateX(${isResizing ? state.columnSizingInfo.deltaOffset : 0}px)`
369
405
  },
370
- onMouseDown: header.getResizeHandler(),
371
- onTouchStart: header.getResizeHandler()
372
- }, /* @__PURE__ */ React5.createElement("div", {
406
+ onMouseDown: resizeHandler,
407
+ onTouchStart: resizeHandler
408
+ }, /* @__PURE__ */ React6.createElement("div", {
373
409
  className: mx3(theadResizeThumb(tableContext))
374
410
  })));
375
- }), tableContext.expand && /* @__PURE__ */ React5.createElement("th", null))
411
+ }), tableContext.expand && /* @__PURE__ */ React6.createElement("th", null))
376
412
  );
377
413
  }));
378
414
  };
@@ -381,21 +417,31 @@ TableHead.displayName = TABLE_HEAD_NAME;
381
417
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
382
418
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
383
419
  var Table = (props) => {
384
- const { role, onColumnResize, columnVisibility, header = true, rowsSelectable, debug, onDataSelectionChange, getScrollElement } = props;
420
+ const { role, onColumnResize, columnVisibility, header = true, rowsSelectable, debug, onDataSelectionChange, getScrollElement, pinLastRow } = props;
385
421
  const columns = useDefaultValue(props.columns, []);
386
422
  const data = useDefaultValue(props.data, []);
387
423
  const TableProvider2 = TableProvider;
424
+ const [columnsInitialised, setColumnsInitialised] = useState2(false);
388
425
  const [columnSizing, setColumnSizing] = useState2({});
389
426
  useEffect(() => {
427
+ if (columnsInitialised) {
428
+ return;
429
+ }
390
430
  setColumnSizing(columns.filter((column) => !!column.size && column.prop !== void 0).reduce((state, column) => {
391
431
  state[column.prop] = column.size;
392
432
  return state;
393
433
  }, {}));
434
+ setColumnsInitialised(true);
394
435
  }, [
395
436
  columns,
396
437
  setColumnSizing
397
438
  ]);
398
439
  const [columnSizingInfo, setColumnSizingInfo] = useState2({});
440
+ const notifyColumnResize = useCallback(() => onColumnResize?.(columnSizing), [
441
+ onColumnResize,
442
+ columnSizing
443
+ ]);
444
+ useOnTransition(columnSizingInfo.isResizingColumn, (v) => typeof v === "string", false, notifyColumnResize);
399
445
  const [rowSelection = {}, setRowSelection] = useControllableState({
400
446
  prop: props.rowSelection,
401
447
  onChange: props.onRowSelectionChange,
@@ -448,16 +494,19 @@ var Table = (props) => {
448
494
  onColumnSizingInfoChange: setColumnSizingInfo,
449
495
  // Rows
450
496
  getCoreRowModel: getCoreRowModel(),
497
+ getSortedRowModel: getSortedRowModel(),
498
+ getExpandedRowModel: getExpandedRowModel(),
451
499
  // Grouping
452
500
  getGroupedRowModel: grouping.length > 1 ? getGroupedRowModel() : void 0,
453
501
  onGroupingChange: handleGroupingChange,
454
502
  enableMultiRowSelection: rowsSelectable === "multi" ? true : void 0,
455
503
  enableRowSelection: rowsSelectable === true ? true : void 0,
456
504
  onRowSelectionChange: handleRowSelectionChange,
505
+ enableSorting: true,
506
+ enableColumnPinning: true,
457
507
  // Debug
458
508
  debugTable: debug
459
509
  });
460
- const onColumnResizeDebounced = onColumnResize && debounce(onColumnResize, 1e3);
461
510
  useEffect(() => {
462
511
  onDataSelectionChange?.(Object.keys(rowSelection).map((id) => table.getRowModel().rowsById[id].original));
463
512
  }, [
@@ -466,31 +515,33 @@ var Table = (props) => {
466
515
  table
467
516
  ]);
468
517
  useEffect(() => {
469
- const shouldTriggerResize = columnSizingInfo.columnSizingStart?.length === 0;
470
- if (shouldTriggerResize) {
471
- onColumnResizeDebounced?.(table.getState().columnSizing);
518
+ if (!pinLastRow) {
519
+ return;
472
520
  }
521
+ table.resetRowPinning();
522
+ const rows = table.getRowModel().rows;
523
+ rows[rows.length - 1].pin("bottom");
473
524
  }, [
474
- columnSizingInfo,
475
- onColumnResizeDebounced,
476
- table
525
+ pinLastRow,
526
+ table,
527
+ data
477
528
  ]);
478
529
  const expand = false;
479
530
  if (!getScrollElement) {
480
531
  log.warn("Table: getScrollElement is not set. This is required for virtualized tables.", void 0, {
481
532
  F: __dxlog_file,
482
- L: 148,
533
+ L: 168,
483
534
  S: void 0,
484
535
  C: (f, a) => f(...a)
485
536
  });
486
537
  }
487
- return /* @__PURE__ */ React6.createElement(TableProvider2, {
538
+ return /* @__PURE__ */ React7.createElement(TableProvider2, {
488
539
  ...props,
489
540
  table,
490
541
  header,
491
542
  expand,
492
543
  isGrid: role === "grid" || role === "treegrid"
493
- }, /* @__PURE__ */ React6.createElement(TableImpl, {
544
+ }, /* @__PURE__ */ React7.createElement(TableImpl, {
494
545
  debug: false,
495
546
  getScrollElement,
496
547
  ...props
@@ -499,14 +550,19 @@ var Table = (props) => {
499
550
  var TableImpl = (props) => {
500
551
  const { debug, classNames, getScrollElement, role, footer, grouping, fullWidth } = props;
501
552
  const { table } = useTableContext("TableImpl");
502
- const { rows } = table.getRowModel();
553
+ const centerRows = table.getCenterRows();
554
+ const bottomRows = table.getBottomRows();
555
+ const rows = [
556
+ ...centerRows,
557
+ ...bottomRows
558
+ ];
503
559
  if (debug) {
504
- return /* @__PURE__ */ React6.createElement("pre", {
560
+ return /* @__PURE__ */ React7.createElement("pre", {
505
561
  className: "font-mono text-xs text-neutral-500 m-1 p-2 ring"
506
- }, /* @__PURE__ */ React6.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
562
+ }, /* @__PURE__ */ React7.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
507
563
  }
508
564
  const isResizingColumn = table.getState().columnSizingInfo.isResizingColumn;
509
- return /* @__PURE__ */ React6.createElement("table", {
565
+ return /* @__PURE__ */ React7.createElement("table", {
510
566
  role,
511
567
  className: tableRoot(props, classNames),
512
568
  ...!fullWidth && {
@@ -514,17 +570,22 @@ var TableImpl = (props) => {
514
570
  width: table.getTotalSize()
515
571
  }
516
572
  }
517
- }, /* @__PURE__ */ React6.createElement(TableHead, null), grouping?.length !== 0 ? getScrollElement ? isResizingColumn ? /* @__PURE__ */ React6.createElement(MemoizedVirtualisedTableContent, {
573
+ }, /* @__PURE__ */ React7.createElement(TableHead, null), grouping?.length !== 0 ? getScrollElement ? isResizingColumn ? /* @__PURE__ */ React7.createElement(MemoizedVirtualisedTableContent, {
518
574
  getScrollElement
519
- }) : /* @__PURE__ */ React6.createElement(VirtualizedTableContent, {
575
+ }) : /* @__PURE__ */ React7.createElement(VirtualizedTableContent, {
520
576
  getScrollElement
521
- }) : /* @__PURE__ */ React6.createElement(TableBody, {
577
+ }) : /* @__PURE__ */ React7.createElement(TableBody, {
522
578
  rows
523
- }) : /* @__PURE__ */ React6.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React6.createElement(TableFooter, null));
579
+ }) : /* @__PURE__ */ React7.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React7.createElement(TableFooter, null));
524
580
  };
525
581
  var VirtualizedTableContent = ({ getScrollElement }) => {
526
- const { table: { getRowModel } } = useTableContext("VirtualizedTableContent");
527
- const rows = getRowModel().rows;
582
+ const { table } = useTableContext("VirtualizedTableContent");
583
+ const centerRows = table.getCenterRows();
584
+ const pinnedRows = table.getBottomRows();
585
+ const rows = [
586
+ ...centerRows,
587
+ ...pinnedRows
588
+ ];
528
589
  const { getTotalSize, getVirtualItems } = useVirtualizer({
529
590
  getScrollElement,
530
591
  count: rows.length,
@@ -535,50 +596,50 @@ var VirtualizedTableContent = ({ getScrollElement }) => {
535
596
  const totalSize = getTotalSize();
536
597
  const paddingTop = virtualRows.length > 0 ? virtualRows?.[0]?.start || 0 : 0;
537
598
  const paddingBottom = virtualRows.length > 0 ? totalSize - (virtualRows?.[virtualRows.length - 1]?.end || 0) : 0;
538
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React6.createElement("tbody", {
599
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React7.createElement("tbody", {
539
600
  role: "none"
540
- }, /* @__PURE__ */ React6.createElement("tr", {
601
+ }, /* @__PURE__ */ React7.createElement("tr", {
541
602
  role: "none"
542
- }, /* @__PURE__ */ React6.createElement("td", {
603
+ }, /* @__PURE__ */ React7.createElement("td", {
543
604
  style: {
544
605
  height: `${paddingTop}px`
545
606
  },
546
607
  role: "none"
547
- }))), /* @__PURE__ */ React6.createElement(TableBody, {
608
+ }))), /* @__PURE__ */ React7.createElement(TableBody, {
548
609
  rows: virtualRows.map((virtualRow) => rows[virtualRow.index])
549
- }), paddingBottom > 0 && /* @__PURE__ */ React6.createElement("tbody", {
610
+ }), paddingBottom > 0 && /* @__PURE__ */ React7.createElement("tbody", {
550
611
  role: "none"
551
- }, /* @__PURE__ */ React6.createElement("tr", {
612
+ }, /* @__PURE__ */ React7.createElement("tr", {
552
613
  role: "none"
553
- }, /* @__PURE__ */ React6.createElement("td", {
614
+ }, /* @__PURE__ */ React7.createElement("td", {
554
615
  style: {
555
616
  height: `${paddingBottom}px`
556
617
  },
557
618
  role: "none"
558
619
  }))));
559
620
  };
560
- var MemoizedVirtualisedTableContent = /* @__PURE__ */ React6.memo(VirtualizedTableContent);
621
+ var MemoizedVirtualisedTableContent = /* @__PURE__ */ React7.memo(VirtualizedTableContent);
561
622
  var GroupedTableContent = () => {
562
623
  const { table: { getGroupedRowModel: getGroupedRowModel2, getHeaderGroups, getState }, debug } = useTableContext("GroupedTableContent");
563
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
564
- return /* @__PURE__ */ React6.createElement(Fragment, {
624
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
625
+ return /* @__PURE__ */ React7.createElement(Fragment, {
565
626
  key: i
566
- }, /* @__PURE__ */ React6.createElement("thead", null, /* @__PURE__ */ React6.createElement("tr", null, debug && /* @__PURE__ */ React6.createElement("th", null), /* @__PURE__ */ React6.createElement("th", {
627
+ }, /* @__PURE__ */ React7.createElement("thead", null, /* @__PURE__ */ React7.createElement("tr", null, debug && /* @__PURE__ */ React7.createElement("th", null), /* @__PURE__ */ React7.createElement("th", {
567
628
  // TODO(burdon): Calculate row span.
568
629
  colSpan: getHeaderGroups()[0].headers.length,
569
630
  className: groupTh({})
570
- }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React6.createElement(TableBody, {
631
+ }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React7.createElement(TableBody, {
571
632
  rows: row.subRows
572
633
  }));
573
634
  }));
574
635
  };
575
636
 
576
637
  // packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx
577
- import { CaretDown as CaretDown2 } from "@phosphor-icons/react";
578
- import React7, { useCallback as useCallback2, useState as useState3 } from "react";
638
+ import { CaretDown } from "@phosphor-icons/react";
639
+ import React8, { useCallback as useCallback2, useState as useState3 } from "react";
579
640
  import { Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
580
641
  import { PopoverCombobox } from "@dxos/react-ui-searchlist";
581
- import { descriptionText, getSize as getSize2, mx as mx4, staticPlaceholderText } from "@dxos/react-ui-theme";
642
+ import { descriptionText, getSize as getSize3, mx as mx4, staticPlaceholderText } from "@dxos/react-ui-theme";
582
643
  var initialItems = (model, value) => value ? {
583
644
  [model.getId(value)]: {
584
645
  label: model.getText(value),
@@ -609,37 +670,37 @@ var CellCombobox = ({ model, value, onValueChange }) => {
609
670
  items,
610
671
  onValueChange
611
672
  ]);
612
- return /* @__PURE__ */ React7.createElement(PopoverCombobox.Root, {
673
+ return /* @__PURE__ */ React8.createElement(PopoverCombobox.Root, {
613
674
  placeholder: t("no selection label")
614
- }, /* @__PURE__ */ React7.createElement(PopoverCombobox.Trigger, {
675
+ }, /* @__PURE__ */ React8.createElement(PopoverCombobox.Trigger, {
615
676
  variant: "ghost",
616
677
  classNames: "is-full rounded-none ring-inset"
617
- }, value ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("span", {
678
+ }, value ? /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("span", {
618
679
  className: mx4("font-normal text-start text-base flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
619
- }, model.getText(value)), /* @__PURE__ */ React7.createElement(CaretDown2, {
680
+ }, model.getText(value)), /* @__PURE__ */ React8.createElement(CaretDown, {
620
681
  weight: "bold",
621
- className: getSize2(3)
622
- })) : null), /* @__PURE__ */ React7.createElement(PopoverCombobox.Content, {
682
+ className: getSize3(3)
683
+ })) : null), /* @__PURE__ */ React8.createElement(PopoverCombobox.Content, {
623
684
  shouldFilter: false,
624
685
  classNames: "is-[--radix-popover-trigger-width]"
625
- }, /* @__PURE__ */ React7.createElement(PopoverCombobox.Input, {
686
+ }, /* @__PURE__ */ React8.createElement(PopoverCombobox.Input, {
626
687
  value: searchInputValue,
627
688
  onValueChange: handleSearchInputValueChange
628
- }), /* @__PURE__ */ React7.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React7.createElement("p", {
689
+ }), /* @__PURE__ */ React8.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React8.createElement("p", {
629
690
  className: mx4("text-center", descriptionText)
630
- }, "Start typing to search") : loading ? /* @__PURE__ */ React7.createElement("p", {
691
+ }, "Start typing to search") : loading ? /* @__PURE__ */ React8.createElement("p", {
631
692
  className: mx4("text-center", descriptionText)
632
- }, "Searching\u2026") : /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(PopoverCombobox.Empty, {
693
+ }, "Searching\u2026") : /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(PopoverCombobox.Empty, {
633
694
  classNames: [
634
695
  "text-center",
635
696
  descriptionText
636
697
  ]
637
- }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React7.createElement(PopoverCombobox.Item, {
698
+ }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React8.createElement(PopoverCombobox.Item, {
638
699
  key: id,
639
700
  value: id,
640
701
  onSelect: handleValueChange,
641
702
  classNames: "truncate"
642
- }, label)))), /* @__PURE__ */ React7.createElement(Popover2.Arrow, null)));
703
+ }, label)))), /* @__PURE__ */ React8.createElement(Popover2.Arrow, null)));
643
704
  };
644
705
 
645
706
  // packages/ui/react-ui-table/src/helpers.tsx
@@ -648,10 +709,10 @@ import { Check as Check2, ClipboardText, X as X2 } from "@phosphor-icons/react";
648
709
  import { createColumnHelper } from "@tanstack/react-table";
649
710
  import { format } from "date-fns/format";
650
711
  import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
651
- import React8, { useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
712
+ import React9, { useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
652
713
  import { log as log2 } from "@dxos/log";
653
714
  import { Input as Input2, Tooltip } from "@dxos/react-ui";
654
- import { getSize as getSize3, mx as mx5 } from "@dxos/react-ui-theme";
715
+ import { getSize as getSize4, mx as mx5 } from "@dxos/react-ui-theme";
655
716
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/helpers.tsx";
656
717
  var createColumnBuilder = () => ({
657
718
  helper: createColumnHelper(),
@@ -659,7 +720,7 @@ var createColumnBuilder = () => ({
659
720
  });
660
721
  var ComboboxBuilderCell = (cellContext) => {
661
722
  const { model, onUpdate } = cellContext.column.columnDef.meta;
662
- return model ? /* @__PURE__ */ React8.createElement(CellCombobox, {
723
+ return model ? /* @__PURE__ */ React9.createElement(CellCombobox, {
663
724
  model,
664
725
  value: cellContext.getValue(),
665
726
  onValueChange: (value) => onUpdate?.(cellContext.row.original, cellContext.column.id, value)
@@ -683,10 +744,13 @@ var StringBuilderCell = (cellContext) => {
683
744
  }
684
745
  };
685
746
  const handleCancel = () => setValue(initialValue);
686
- const rows = cellContext.table.getRowModel().flatRows;
747
+ let placeholder = false;
687
748
  const columns = cellContext.table.getVisibleFlatColumns();
688
- const placeholder = cellContext.row.index === rows.length - 1 && columns[0].id === cellContext.column.id;
689
- return /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.TextInput, {
749
+ if (columns[0].id === cellContext.column.id) {
750
+ const rowCount = cellContext.table.getRowModel().rows.length;
751
+ placeholder = cellContext.row.index === rowCount - 1 && columns[0].id === cellContext.column.id;
752
+ }
753
+ return /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.TextInput, {
690
754
  ref,
691
755
  variant: "subdued",
692
756
  placeholder: placeholder ? "Add row..." : void 0,
@@ -733,7 +797,7 @@ var NumberBuilderCell = (cellContext) => {
733
797
  setText(displayNumber(value, digits));
734
798
  ref.current && findPrevFocusable(ref.current)?.focus();
735
799
  };
736
- return /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.TextInput, {
800
+ return /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.TextInput, {
737
801
  ref,
738
802
  variant: "subdued",
739
803
  value: text,
@@ -756,10 +820,10 @@ var RowSelectorBuilderCell = (cellContext) => {
756
820
  const { cell } = cellContext.column.columnDef.meta;
757
821
  const { row } = cellContext;
758
822
  const checked = row.getCanSelect() ? row.getIsSelected() : row.getCanSelectSubRows() && (row.getIsSomeSelected() ? "indeterminate" : row.getIsAllSubRowsSelected());
759
- return /* @__PURE__ */ React8.createElement("div", {
823
+ return /* @__PURE__ */ React9.createElement("div", {
760
824
  className: "flex justify-center w-full h-full",
761
825
  role: "presentation"
762
- }, /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Checkbox, {
826
+ }, /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.Checkbox, {
763
827
  size: 4,
764
828
  classNames: [
765
829
  cell?.classNames
@@ -776,7 +840,7 @@ var RowSelectorBuilderCell = (cellContext) => {
776
840
  var SwitchBuilderCell = (cellContext) => {
777
841
  const { onUpdate } = cellContext.column.columnDef.meta;
778
842
  const value = cellContext.getValue();
779
- return /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Switch, {
843
+ return /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.Switch, {
780
844
  classNames: "block mli-auto",
781
845
  onClick: (event) => event.stopPropagation(),
782
846
  disabled: !onUpdate,
@@ -798,7 +862,7 @@ var ColumnBuilder = class {
798
862
  },
799
863
  cell: model && onUpdate ? ComboboxBuilderCell : (cellContext) => {
800
864
  const cellValue = cellContext.getValue();
801
- return /* @__PURE__ */ React8.createElement("div", {
865
+ return /* @__PURE__ */ React9.createElement("div", {
802
866
  className: mx5("truncate", classNames)
803
867
  }, cellValue ? model?.getText(cellValue) : "");
804
868
  },
@@ -829,7 +893,7 @@ var ColumnBuilder = class {
829
893
  if (typeof value === "object" && value?.__typename === "dxos.Text.v0") {
830
894
  value = value.content;
831
895
  }
832
- return /* @__PURE__ */ React8.createElement("div", {
896
+ return /* @__PURE__ */ React9.createElement("div", {
833
897
  className: mx5("truncate", textPadding, classNames)
834
898
  }, value);
835
899
  },
@@ -884,7 +948,7 @@ var ColumnBuilder = class {
884
948
  const str = value ? formatSpec ? format(value, formatSpec) : relative ? formatDistanceToNow(value, {
885
949
  addSuffix: true
886
950
  }) : value.toISOString() : void 0;
887
- return /* @__PURE__ */ React8.createElement("div", {
951
+ return /* @__PURE__ */ React9.createElement("div", {
888
952
  className: mx5(textPadding, classNames)
889
953
  }, str);
890
954
  } catch (err) {
@@ -892,7 +956,7 @@ var ColumnBuilder = class {
892
956
  value
893
957
  }, {
894
958
  F: __dxlog_file2,
895
- L: 370,
959
+ L: 374,
896
960
  S: this,
897
961
  C: (f, a) => f(...a)
898
962
  });
@@ -926,9 +990,9 @@ var ColumnBuilder = class {
926
990
  if (!tooltip) {
927
991
  return element;
928
992
  }
929
- return /* @__PURE__ */ React8.createElement(Tooltip.Provider, null, /* @__PURE__ */ React8.createElement(Tooltip.Root, null, /* @__PURE__ */ React8.createElement(Tooltip.Trigger, null, element), /* @__PURE__ */ React8.createElement(Tooltip.Portal, null, /* @__PURE__ */ React8.createElement(Tooltip.Content, {
993
+ return /* @__PURE__ */ React9.createElement(Tooltip.Provider, null, /* @__PURE__ */ React9.createElement(Tooltip.Root, null, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, null, element), /* @__PURE__ */ React9.createElement(Tooltip.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip.Content, {
930
994
  side: "right"
931
- }, /* @__PURE__ */ React8.createElement(Tooltip.Arrow, null), /* @__PURE__ */ React8.createElement(ClipboardText, {
995
+ }, /* @__PURE__ */ React9.createElement(Tooltip.Arrow, null), /* @__PURE__ */ React9.createElement(ClipboardText, {
932
996
  onClick: (ev) => {
933
997
  ev.stopPropagation();
934
998
  void navigator.clipboard.writeText(value.toHex());
@@ -966,10 +1030,10 @@ var ColumnBuilder = class {
966
1030
  header: ({ table }) => {
967
1031
  const { rowsSelectable } = useTableContext("HELPER_SELECT_ROW_HEADER_CELL");
968
1032
  const checked = table.getIsSomeRowsSelected() ? "indeterminate" : table.getIsAllRowsSelected();
969
- return rowsSelectable === "multi" ? /* @__PURE__ */ React8.createElement("div", {
1033
+ return rowsSelectable === "multi" ? /* @__PURE__ */ React9.createElement("div", {
970
1034
  className: "flex justify-center w-full h-full",
971
1035
  role: "presentation"
972
- }, /* @__PURE__ */ React8.createElement(Input2.Root, null, /* @__PURE__ */ React8.createElement(Input2.Checkbox, {
1036
+ }, /* @__PURE__ */ React9.createElement(Input2.Root, null, /* @__PURE__ */ React9.createElement(Input2.Checkbox, {
973
1037
  size: 4,
974
1038
  classNames: [
975
1039
  "mli-auto",
@@ -990,6 +1054,8 @@ var ColumnBuilder = class {
990
1054
  size: 50,
991
1055
  minSize: 50,
992
1056
  header: (column) => label ?? column.header.id,
1057
+ // TODO(Zan): Implement sort algorithm
1058
+ enableSorting: true,
993
1059
  cell: SwitchBuilderCell,
994
1060
  ...props,
995
1061
  meta: {
@@ -1013,18 +1079,20 @@ var ColumnBuilder = class {
1013
1079
  const IconOff = off?.Icon ?? X2;
1014
1080
  return {
1015
1081
  size: size ?? 32,
1016
- header: (column) => /* @__PURE__ */ React8.createElement("div", {
1082
+ // TODO(Zan): Implement sort algorithm
1083
+ enableSorting: false,
1084
+ header: (column) => /* @__PURE__ */ React9.createElement("div", {
1017
1085
  className: "justify-center"
1018
1086
  }, label ?? column.header.id),
1019
1087
  cell: (cell) => {
1020
1088
  const value = cell.getValue();
1021
1089
  if (value) {
1022
- return /* @__PURE__ */ React8.createElement(IconOn, {
1023
- className: mx5("block mli-auto", getSize3(6), on?.className ?? "text-green-700")
1090
+ return /* @__PURE__ */ React9.createElement(IconOn, {
1091
+ className: mx5("block mli-auto", getSize4(6), on?.className ?? "text-green-700")
1024
1092
  });
1025
1093
  } else if (value === false) {
1026
- return /* @__PURE__ */ React8.createElement(IconOff, {
1027
- className: mx5("block mli-auto", getSize3(6), off?.className ?? "text-red-700")
1094
+ return /* @__PURE__ */ React9.createElement(IconOff, {
1095
+ className: mx5("block mli-auto", getSize4(6), off?.className ?? "text-red-700")
1028
1096
  });
1029
1097
  } else {
1030
1098
  return null;