@dxos/react-ui-table 0.4.10-main.b9b4602 → 0.4.10-main.c2d5db5

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 (60) hide show
  1. package/dist/lib/browser/index.mjs +283 -405
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/{ColumnMenu/ColumnMenu.d.ts → ColumnMenu.d.ts} +1 -1
  5. package/dist/types/src/components/ColumnMenu.d.ts.map +1 -0
  6. package/dist/types/src/components/{ColumnMenu/ColumnMenu.stories.d.ts → ColumnMenu.stories.d.ts} +1 -1
  7. package/dist/types/src/components/ColumnMenu.stories.d.ts.map +1 -0
  8. package/dist/types/src/components/{ColumnMenu/ColumnSettingsForm.d.ts → ColumnSettingsForm.d.ts} +4 -5
  9. package/dist/types/src/components/ColumnSettingsForm.d.ts.map +1 -0
  10. package/dist/types/src/components/hooks/useColumnSorting.d.ts.map +1 -0
  11. package/dist/types/src/components/hooks/usePinLastRow.d.ts.map +1 -0
  12. package/dist/types/src/components/index.d.ts +1 -1
  13. package/dist/types/src/components/index.d.ts.map +1 -1
  14. package/dist/types/src/components/schema/SchemaToTable.stories.d.ts.map +1 -0
  15. package/dist/types/src/{schema → components/schema}/schema.d.ts +1 -1
  16. package/dist/types/src/components/schema/schema.d.ts.map +1 -0
  17. package/dist/types/src/components/schema/schema.test.d.ts.map +1 -0
  18. package/dist/types/src/components/schema/schemaToColumns.d.ts.map +1 -0
  19. package/dist/types/src/index.d.ts +1 -2
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/{schema/types.d.ts → schema.d.ts} +1 -1
  22. package/dist/types/src/schema.d.ts.map +1 -0
  23. package/package.json +14 -14
  24. package/src/components/{ColumnMenu/ColumnMenu.stories.tsx → ColumnMenu.stories.tsx} +1 -1
  25. package/src/components/{ColumnMenu/ColumnMenu.tsx → ColumnMenu.tsx} +2 -2
  26. package/src/components/{ColumnMenu/ColumnSettingsForm.tsx → ColumnSettingsForm.tsx} +12 -14
  27. package/src/components/Table/Table.tsx +1 -1
  28. package/src/components/index.ts +1 -1
  29. package/src/{schema → components/schema}/SchemaToTable.stories.tsx +1 -1
  30. package/src/{schema → components/schema}/schema.ts +4 -1
  31. package/src/{schema → components/schema}/schemaToColumns.ts +8 -5
  32. package/src/index.ts +1 -3
  33. package/dist/types/src/components/ColumnMenu/ColumnMenu.d.ts.map +0 -1
  34. package/dist/types/src/components/ColumnMenu/ColumnMenu.stories.d.ts.map +0 -1
  35. package/dist/types/src/components/ColumnMenu/ColumnSettingsForm.d.ts.map +0 -1
  36. package/dist/types/src/components/ColumnMenu/index.d.ts +0 -3
  37. package/dist/types/src/components/ColumnMenu/index.d.ts.map +0 -1
  38. package/dist/types/src/hooks/index.d.ts +0 -3
  39. package/dist/types/src/hooks/index.d.ts.map +0 -1
  40. package/dist/types/src/hooks/useColumnSorting.d.ts.map +0 -1
  41. package/dist/types/src/hooks/usePinLastRow.d.ts.map +0 -1
  42. package/dist/types/src/schema/SchemaToTable.stories.d.ts.map +0 -1
  43. package/dist/types/src/schema/index.d.ts +0 -3
  44. package/dist/types/src/schema/index.d.ts.map +0 -1
  45. package/dist/types/src/schema/schema.d.ts.map +0 -1
  46. package/dist/types/src/schema/schema.test.d.ts.map +0 -1
  47. package/dist/types/src/schema/schemaToColumns.d.ts.map +0 -1
  48. package/dist/types/src/schema/types.d.ts.map +0 -1
  49. package/src/components/ColumnMenu/index.ts +0 -6
  50. package/src/hooks/index.ts +0 -6
  51. package/src/schema/index.ts +0 -6
  52. /package/dist/types/src/{hooks → components/hooks}/useColumnSorting.d.ts +0 -0
  53. /package/dist/types/src/{hooks → components/hooks}/usePinLastRow.d.ts +0 -0
  54. /package/dist/types/src/{schema → components/schema}/SchemaToTable.stories.d.ts +0 -0
  55. /package/dist/types/src/{schema → components/schema}/schema.test.d.ts +0 -0
  56. /package/dist/types/src/{schema → components/schema}/schemaToColumns.d.ts +0 -0
  57. /package/src/{hooks → components/hooks}/useColumnSorting.ts +0 -0
  58. /package/src/{hooks → components/hooks}/usePinLastRow.ts +0 -0
  59. /package/src/{schema → components/schema}/schema.test.ts +0 -0
  60. /package/src/{schema/types.ts → schema.ts} +0 -0
@@ -1,3 +1,16 @@
1
+ // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
2
+ import { X as X2, GearSix, CaretDown, ArrowDown, ArrowUp } from "@phosphor-icons/react";
3
+ import React2, { useRef as useRef2, useState as useState3, useCallback } from "react";
4
+ import { Button as Button2, DensityProvider, Popover, DropdownMenu } from "@dxos/react-ui";
5
+ import { getSize as getSize2, mx as mx2 } from "@dxos/react-ui-theme";
6
+
7
+ // packages/ui/react-ui-table/src/components/ColumnSettingsForm.tsx
8
+ import { Check, Trash, X } from "@phosphor-icons/react";
9
+ import React, { useRef, useState } from "react";
10
+ import { Button, Input, Select, Separator, useTranslation } from "@dxos/react-ui";
11
+ import { getSize, mx } from "@dxos/react-ui-theme";
12
+ import { safeParseInt } from "@dxos/util";
13
+
1
14
  // packages/ui/react-ui-table/src/translations.ts
2
15
  var translationKey = "table";
3
16
  var translations_default = [
@@ -21,103 +34,23 @@ var translations_default = [
21
34
  }
22
35
  ];
23
36
 
24
- // packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx
25
- import { CaretDown } from "@phosphor-icons/react";
26
- import React, { useCallback, useState } from "react";
27
- import { Popover, useTranslation } from "@dxos/react-ui";
28
- import { PopoverCombobox } from "@dxos/react-ui-searchlist";
29
- import { descriptionText, getSize, mx, staticPlaceholderText } from "@dxos/react-ui-theme";
30
- var initialItems = (model, value) => value ? {
31
- [model.getId(value)]: {
32
- label: model.getText(value),
33
- data: value
34
- }
35
- } : {};
36
- var CellCombobox = ({ model, value, onValueChange }) => {
37
- const { t } = useTranslation(translationKey);
38
- const [items, setItems] = useState(initialItems(model, value));
39
- const [loading, setLoading] = useState(false);
40
- const [searchInputValue, setSearchInputValue] = useState("");
41
- const handleSearchInputValueChange = async (text) => {
42
- setSearchInputValue(text ?? "");
43
- setLoading(true);
44
- const items2 = await model.query(text);
45
- setItems(items2.reduce((acc, item) => {
46
- acc[model.getId(item)] = {
47
- label: model.getText(item),
48
- data: item
49
- };
50
- return acc;
51
- }, initialItems(model, value)));
52
- setLoading(false);
53
- };
54
- const handleValueChange = useCallback((id) => {
55
- onValueChange(items[id]?.data);
56
- }, [
57
- items,
58
- onValueChange
59
- ]);
60
- return /* @__PURE__ */ React.createElement(PopoverCombobox.Root, {
61
- placeholder: t("no selection label")
62
- }, /* @__PURE__ */ React.createElement(PopoverCombobox.Trigger, {
63
- variant: "ghost",
64
- classNames: "is-full rounded-none ring-inset"
65
- }, value ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
66
- className: mx("font-normal text-start text-base flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
67
- }, model.getText(value)), /* @__PURE__ */ React.createElement(CaretDown, {
68
- weight: "bold",
69
- className: getSize(3)
70
- })) : null), /* @__PURE__ */ React.createElement(PopoverCombobox.Content, {
71
- shouldFilter: false,
72
- classNames: "is-[--radix-popover-trigger-width]"
73
- }, /* @__PURE__ */ React.createElement(PopoverCombobox.Input, {
74
- value: searchInputValue,
75
- onValueChange: handleSearchInputValueChange
76
- }), /* @__PURE__ */ React.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React.createElement("p", {
77
- className: mx("text-center", descriptionText)
78
- }, "Start typing to search") : loading ? /* @__PURE__ */ React.createElement("p", {
79
- className: mx("text-center", descriptionText)
80
- }, "Searching\u2026") : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PopoverCombobox.Empty, {
81
- classNames: [
82
- "text-center",
83
- descriptionText
84
- ]
85
- }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React.createElement(PopoverCombobox.Item, {
86
- key: id,
87
- value: id,
88
- onSelect: handleValueChange,
89
- classNames: "truncate"
90
- }, label)))), /* @__PURE__ */ React.createElement(Popover.Arrow, null)));
91
- };
92
-
93
- // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx
94
- import { X as X2, GearSix, CaretDown as CaretDown2, ArrowDown, ArrowUp } from "@phosphor-icons/react";
95
- import React3, { useRef as useRef2, useState as useState5, useCallback as useCallback2 } from "react";
96
- import { Button as Button2, DensityProvider, Popover as Popover2, DropdownMenu } from "@dxos/react-ui";
97
- import { getSize as getSize3, mx as mx3 } from "@dxos/react-ui-theme";
98
-
99
- // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx
100
- import { Check, Trash, X } from "@phosphor-icons/react";
101
- import React2, { useRef, useState as useState2 } from "react";
102
- import { Button, Input, Select, Separator, useTranslation as useTranslation2 } from "@dxos/react-ui";
103
- import { getSize as getSize2, mx as mx2 } from "@dxos/react-ui-theme";
104
- import { safeParseInt } from "@dxos/util";
105
- var Section = ({ children, className }) => /* @__PURE__ */ React2.createElement("div", {
37
+ // packages/ui/react-ui-table/src/components/ColumnSettingsForm.tsx
38
+ var Section = ({ children, className }) => /* @__PURE__ */ React.createElement("div", {
106
39
  role: "none",
107
- className: mx2("p-2", className)
40
+ className: mx("p-2", className)
108
41
  }, children);
109
42
  var ColumnSettingsForm = ({ column, tableDef, tableDefs, onUpdate, onDelete, onClose }) => {
110
- const [prop, setProp] = useState2(column.id);
111
- const [refTable, setRefTable] = useState2(column.refTable);
112
- const [refProp, setRefProp] = useState2(column.refProp);
113
- const [type, setType] = useState2(String(column.type));
114
- const [label, setLabel] = useState2(column.label);
115
- const [digits, setDigits] = useState2(String(column.digits ?? "0"));
43
+ const [prop, setProp] = useState(column.id);
44
+ const [refTable, setRefTable] = useState(column.refTable);
45
+ const [refProp, setRefProp] = useState(column.refProp);
46
+ const [type, setType] = useState(String(column.type));
47
+ const [label, setLabel] = useState(column.label);
48
+ const [digits, setDigits] = useState(String(column.digits ?? "0"));
116
49
  const propRef = useRef(null);
117
- const { t } = useTranslation2(translationKey);
50
+ const { t } = useTranslation(translationKey);
118
51
  const handleCancel = () => {
119
52
  setProp(column.id);
120
- onClose?.();
53
+ onClose;
121
54
  };
122
55
  const handleSave = () => {
123
56
  if (!prop.length || !prop.match(/^[a-zA-Z_].+/i)) {
@@ -140,104 +73,104 @@ var ColumnSettingsForm = ({ column, tableDef, tableDefs, onUpdate, onDelete, onC
140
73
  refProp,
141
74
  digits: safeParseInt(digits)
142
75
  });
143
- onClose?.();
76
+ onClose();
144
77
  };
145
- return /* @__PURE__ */ React2.createElement("div", {
78
+ return /* @__PURE__ */ React.createElement("div", {
146
79
  className: "flex flex-col gap-1"
147
- }, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
80
+ }, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
148
81
  classNames: "mbe-1"
149
- }, t("column label label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
82
+ }, t("column label label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
150
83
  placeholder: "Column label",
151
84
  value: label ?? "",
152
85
  onChange: (event) => setLabel(event.target.value),
153
86
  autoFocus: true
154
- })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
87
+ })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
155
88
  classNames: "mbe-1 mbs-3"
156
- }, t("property key label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
89
+ }, t("property key label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
157
90
  ref: propRef,
158
91
  placeholder: "Property key",
159
92
  // TODO(burdon): Provide hooks for value normalization, ENTER, ESC, etc.
160
93
  value: prop ?? "",
161
94
  onChange: (event) => setProp(event.target.value.replace(/[^\w_]/g, ""))
162
- })), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
95
+ })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
163
96
  classNames: "mbe-1 mbs-3"
164
- }, t("column type label")), /* @__PURE__ */ React2.createElement(Select.Root, {
97
+ }, t("column type label")), /* @__PURE__ */ React.createElement(Select.Root, {
165
98
  value: type,
166
99
  onValueChange: setType
167
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
100
+ }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
168
101
  placeholder: "Type",
169
102
  classNames: "is-full"
170
- }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, [
103
+ }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, [
171
104
  "number",
172
105
  "boolean",
173
106
  "string",
174
107
  "ref"
175
- ].map((type2) => /* @__PURE__ */ React2.createElement(Select.Option, {
108
+ ].map((type2) => /* @__PURE__ */ React.createElement(Select.Option, {
176
109
  key: type2,
177
110
  value: type2
178
- }, 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, {
111
+ }, 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, {
179
112
  classNames: "mbe-1 mbs-3"
180
- }, t("digits label")), /* @__PURE__ */ React2.createElement(Input.TextInput, {
113
+ }, t("digits label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
181
114
  value: digits ?? "",
182
115
  onChange: (event) => setDigits(event.target.value)
183
- })))), type === "ref" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Section, null, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
116
+ })))), type === "ref" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Section, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
184
117
  classNames: "mbe-1 mbs-3"
185
- }, "Table"), /* @__PURE__ */ React2.createElement(Select.Root, {
118
+ }, "Table"), /* @__PURE__ */ React.createElement(Select.Root, {
186
119
  value: refTable,
187
120
  onValueChange: setRefTable
188
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
121
+ }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
189
122
  placeholder: "Table",
190
123
  classNames: "is-full"
191
- }), /* @__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, {
124
+ }), /* @__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, {
192
125
  key: id,
193
126
  value: id
194
- }, name ?? id))))))), refTable && /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.Label, {
127
+ }, name ?? id))))))), refTable && /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, {
195
128
  classNames: "mbe-1 mbs-3"
196
- }, "Table property"), /* @__PURE__ */ React2.createElement(Select.Root, {
129
+ }, "Table property"), /* @__PURE__ */ React.createElement(Select.Root, {
197
130
  value: refProp,
198
131
  onValueChange: setRefProp
199
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
132
+ }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
200
133
  placeholder: "Property",
201
134
  classNames: "is-full"
202
- }), /* @__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, {
135
+ }), /* @__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, {
203
136
  key: id,
204
137
  value: id
205
- }, label2 ?? id))))))))), /* @__PURE__ */ React2.createElement(Separator, {
138
+ }, label2 ?? id))))))))), /* @__PURE__ */ React.createElement(Separator, {
206
139
  classNames: "mli-2"
207
- }), /* @__PURE__ */ React2.createElement(Section, {
140
+ }), /* @__PURE__ */ React.createElement(Section, {
208
141
  className: "space-b-1.5"
209
- }, /* @__PURE__ */ React2.createElement(Button, {
142
+ }, /* @__PURE__ */ React.createElement(Button, {
210
143
  variant: "primary",
211
144
  classNames: "is-full flex gap-2",
212
145
  onClick: handleSave
213
- }, /* @__PURE__ */ React2.createElement("span", null, t("save label")), /* @__PURE__ */ React2.createElement("div", {
146
+ }, /* @__PURE__ */ React.createElement("span", null, t("save label")), /* @__PURE__ */ React.createElement("div", {
214
147
  className: "grow"
215
- }), /* @__PURE__ */ React2.createElement(Check, {
216
- className: getSize2(5)
217
- })), /* @__PURE__ */ React2.createElement(Button, {
148
+ }), /* @__PURE__ */ React.createElement(Check, {
149
+ className: getSize(5)
150
+ })), /* @__PURE__ */ React.createElement(Button, {
218
151
  classNames: "is-full flex gap-2",
219
152
  onClick: handleCancel
220
- }, /* @__PURE__ */ React2.createElement("span", null, t("cancel label", {
153
+ }, /* @__PURE__ */ React.createElement("span", null, t("cancel label", {
221
154
  ns: "os"
222
- })), /* @__PURE__ */ React2.createElement("div", {
155
+ })), /* @__PURE__ */ React.createElement("div", {
223
156
  className: "grow"
224
- }), /* @__PURE__ */ React2.createElement(X, {
225
- className: getSize2(5)
226
- })), /* @__PURE__ */ React2.createElement(Button, {
157
+ }), /* @__PURE__ */ React.createElement(X, {
158
+ className: getSize(5)
159
+ })), /* @__PURE__ */ React.createElement(Button, {
227
160
  classNames: "is-full flex gap-2",
228
161
  onClick: () => onDelete?.(column.id)
229
- }, /* @__PURE__ */ React2.createElement("span", null, t("delete label")), /* @__PURE__ */ React2.createElement("div", {
162
+ }, /* @__PURE__ */ React.createElement("span", null, t("delete label")), /* @__PURE__ */ React.createElement("div", {
230
163
  className: "grow"
231
- }), /* @__PURE__ */ React2.createElement(Trash, {
232
- className: getSize2(5)
164
+ }), /* @__PURE__ */ React.createElement(Trash, {
165
+ className: getSize(5)
233
166
  }))));
234
167
  };
235
168
 
236
- // packages/ui/react-ui-table/src/hooks/useColumnSorting.ts
237
- import { useState as useState3 } from "react";
169
+ // packages/ui/react-ui-table/src/components/hooks/useColumnSorting.ts
170
+ import { useState as useState2 } from "react";
238
171
  var useColumnSorting = (column) => {
239
- const [sortDirection, setSortDirection] = useState3(column.getIsSorted());
240
- const [firstSort, setFirstSort] = useState3();
172
+ const [sortDirection, setSortDirection] = useState2(column.getIsSorted());
173
+ const [firstSort, setFirstSort] = useState2();
241
174
  const canSort = column.getCanSort();
242
175
  const updateColumnSort = (direction) => {
243
176
  setSortDirection(direction);
@@ -279,58 +212,22 @@ var useColumnSorting = (column) => {
279
212
  };
280
213
  };
281
214
 
282
- // packages/ui/react-ui-table/src/hooks/usePinLastRow.ts
283
- import { useEffect, useState as useState4 } from "react";
284
- var usePinLastRow = (pinLastRow, table, data, getScrollElement) => {
285
- const [pinnedRowKey, setPinnedRowKey] = useState4();
286
- useEffect(() => {
287
- if (!pinLastRow) {
288
- return;
289
- }
290
- const rows = table.getRowModel().rows;
291
- const rowToPin = rows[rows.length - 1];
292
- const rowId = rowToPin.id;
293
- if (rowId === pinnedRowKey) {
294
- return;
295
- }
296
- table.resetRowPinning();
297
- rowToPin.pin("bottom");
298
- const scrollElement = getScrollElement?.();
299
- const isFirstRender = pinnedRowKey === void 0;
300
- if (scrollElement && !isFirstRender) {
301
- requestAnimationFrame(() => {
302
- scrollElement.scrollTo({
303
- top: scrollElement.scrollHeight
304
- });
305
- });
306
- }
307
- setPinnedRowKey(rowId);
308
- }, [
309
- pinLastRow,
310
- table,
311
- getScrollElement,
312
- pinnedRowKey,
313
- setPinnedRowKey,
314
- data
315
- ]);
316
- };
317
-
318
- // packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx
215
+ // packages/ui/react-ui-table/src/components/ColumnMenu.tsx
319
216
  var ColumnMenu = ({ column, ...props }) => {
320
217
  const title = column.label?.length ? column.label : column.id;
321
218
  const header = props.context.header;
322
219
  const { canSort, sortDirection, onSelectSort, onToggleSort, onClearSort } = useColumnSorting(header.column);
323
220
  const columnSettingsAnchorRef = useRef2(null);
324
- const [isColumnSettingsOpen, setIsColumnSettingsOpen] = useState5(false);
221
+ const [isColumnSettingsOpen, setIsColumnSettingsOpen] = useState3(false);
325
222
  const shouldPreventFocusOnClose = useRef2(false);
326
- const onOpenColumnSettings = useCallback2(() => {
223
+ const onOpenColumnSettings = useCallback(() => {
327
224
  shouldPreventFocusOnClose.current = true;
328
225
  setIsColumnSettingsOpen(true);
329
226
  }, [
330
227
  shouldPreventFocusOnClose,
331
228
  setIsColumnSettingsOpen
332
229
  ]);
333
- const onDropdownCloseAutoFocus = useCallback2((event) => {
230
+ const onDropdownCloseAutoFocus = useCallback((event) => {
334
231
  if (shouldPreventFocusOnClose.current) {
335
232
  event.preventDefault();
336
233
  shouldPreventFocusOnClose.current = false;
@@ -338,85 +235,85 @@ var ColumnMenu = ({ column, ...props }) => {
338
235
  }, [
339
236
  shouldPreventFocusOnClose
340
237
  ]);
341
- return /* @__PURE__ */ React3.createElement("div", {
238
+ return /* @__PURE__ */ React2.createElement("div", {
342
239
  className: "flex items-center justify-center justify-between"
343
- }, /* @__PURE__ */ React3.createElement("div", {
240
+ }, /* @__PURE__ */ React2.createElement("div", {
344
241
  className: "flex items-center gap-1 truncate",
345
242
  title
346
- }, /* @__PURE__ */ React3.createElement(SortIndicator, {
243
+ }, /* @__PURE__ */ React2.createElement(SortIndicator, {
347
244
  direction: sortDirection,
348
245
  onClick: onToggleSort
349
- }), /* @__PURE__ */ React3.createElement("div", {
246
+ }), /* @__PURE__ */ React2.createElement("div", {
350
247
  className: "truncate"
351
- }, title)), /* @__PURE__ */ React3.createElement(DropdownMenu.Root, {
248
+ }, title)), /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
352
249
  modal: false
353
- }, /* @__PURE__ */ React3.createElement(Popover2.Root, {
250
+ }, /* @__PURE__ */ React2.createElement(Popover.Root, {
354
251
  open: isColumnSettingsOpen,
355
252
  onOpenChange: setIsColumnSettingsOpen,
356
253
  modal: false
357
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Trigger, {
254
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
358
255
  ref: columnSettingsAnchorRef,
359
256
  asChild: true
360
- }, /* @__PURE__ */ React3.createElement(Popover2.Anchor, {
257
+ }, /* @__PURE__ */ React2.createElement(Popover.Anchor, {
361
258
  asChild: true
362
- }, /* @__PURE__ */ React3.createElement(Button2, {
259
+ }, /* @__PURE__ */ React2.createElement(Button2, {
363
260
  variant: "ghost"
364
- }, /* @__PURE__ */ React3.createElement(CaretDown2, {
365
- className: getSize3(4)
366
- })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Content, {
261
+ }, /* @__PURE__ */ React2.createElement(CaretDown, {
262
+ className: getSize2(4)
263
+ })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
367
264
  onCloseAutoFocus: onDropdownCloseAutoFocus,
368
265
  sideOffset: 4,
369
266
  collisionPadding: 8
370
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Viewport, null, canSort && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
267
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, canSort && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
371
268
  onClick: () => onSelectSort("asc")
372
- }, /* @__PURE__ */ React3.createElement("span", {
269
+ }, /* @__PURE__ */ React2.createElement("span", {
373
270
  className: "grow"
374
- }, "Sort ascending"), /* @__PURE__ */ React3.createElement("span", {
271
+ }, "Sort ascending"), /* @__PURE__ */ React2.createElement("span", {
375
272
  className: "opacity-50"
376
- }, /* @__PURE__ */ React3.createElement(ArrowUp, {
377
- className: getSize3(4)
378
- }))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
273
+ }, /* @__PURE__ */ React2.createElement(ArrowUp, {
274
+ className: getSize2(4)
275
+ }))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
379
276
  onClick: () => onSelectSort("desc")
380
- }, /* @__PURE__ */ React3.createElement("span", {
277
+ }, /* @__PURE__ */ React2.createElement("span", {
381
278
  className: "grow"
382
- }, "Sort descending"), /* @__PURE__ */ React3.createElement("span", {
279
+ }, "Sort descending"), /* @__PURE__ */ React2.createElement("span", {
383
280
  className: "opacity-50"
384
- }, /* @__PURE__ */ React3.createElement(ArrowDown, {
385
- className: getSize3(4)
386
- }))), sortDirection !== false && /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
281
+ }, /* @__PURE__ */ React2.createElement(ArrowDown, {
282
+ className: getSize2(4)
283
+ }))), sortDirection !== false && /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
387
284
  onClick: onClearSort
388
- }, /* @__PURE__ */ React3.createElement("span", {
285
+ }, /* @__PURE__ */ React2.createElement("span", {
389
286
  className: "grow"
390
- }, "Clear sort"), /* @__PURE__ */ React3.createElement("span", {
287
+ }, "Clear sort"), /* @__PURE__ */ React2.createElement("span", {
391
288
  className: "opacity-50"
392
- }, /* @__PURE__ */ React3.createElement(X2, {
393
- className: getSize3(4)
394
- })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Item, {
289
+ }, /* @__PURE__ */ React2.createElement(X2, {
290
+ className: getSize2(4)
291
+ })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
395
292
  onClick: onOpenColumnSettings
396
- }, /* @__PURE__ */ React3.createElement("span", {
293
+ }, /* @__PURE__ */ React2.createElement("span", {
397
294
  className: "grow"
398
- }, "Column settings"), /* @__PURE__ */ React3.createElement("span", {
295
+ }, "Column settings"), /* @__PURE__ */ React2.createElement("span", {
399
296
  className: "opacity-50"
400
- }, /* @__PURE__ */ React3.createElement(GearSix, {
401
- className: mx3(getSize3(4), "rotate-90")
402
- })))), /* @__PURE__ */ React3.createElement(DropdownMenu.Arrow, null)), /* @__PURE__ */ React3.createElement(ColumnSettingsPanel, {
297
+ }, /* @__PURE__ */ React2.createElement(GearSix, {
298
+ className: mx2(getSize2(4), "rotate-90")
299
+ })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)), /* @__PURE__ */ React2.createElement(ColumnSettingsPanel, {
403
300
  ...props,
404
301
  column,
405
302
  onClose: () => setIsColumnSettingsOpen(false)
406
303
  }))));
407
304
  };
408
- var ColumnSettingsPanel = ({ tableDefs, tableDef, column, onUpdate, onDelete, onClose }) => /* @__PURE__ */ React3.createElement(Popover2.Portal, null, /* @__PURE__ */ React3.createElement(Popover2.Content, null, /* @__PURE__ */ React3.createElement(Popover2.Viewport, {
305
+ var ColumnSettingsPanel = ({ tableDefs, tableDef, column, onUpdate, onDelete, onClose }) => /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, null, /* @__PURE__ */ React2.createElement(Popover.Viewport, {
409
306
  classNames: "w-60"
410
- }, /* @__PURE__ */ React3.createElement(DensityProvider, {
307
+ }, /* @__PURE__ */ React2.createElement(DensityProvider, {
411
308
  density: "fine"
412
- }, /* @__PURE__ */ React3.createElement(ColumnSettingsForm, {
309
+ }, /* @__PURE__ */ React2.createElement(ColumnSettingsForm, {
413
310
  column,
414
311
  tableDefs,
415
312
  tableDef,
416
313
  onUpdate,
417
314
  onDelete,
418
315
  onClose
419
- }))), /* @__PURE__ */ React3.createElement(Popover2.Arrow, null)));
316
+ }))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)));
420
317
  var SortIndicator = ({ direction, onClick }) => {
421
318
  if (direction === false) {
422
319
  return null;
@@ -424,17 +321,17 @@ var SortIndicator = ({ direction, onClick }) => {
424
321
  let icon;
425
322
  switch (direction) {
426
323
  case "asc":
427
- icon = /* @__PURE__ */ React3.createElement(ArrowUp, {
428
- className: getSize3(3)
324
+ icon = /* @__PURE__ */ React2.createElement(ArrowUp, {
325
+ className: getSize2(3)
429
326
  });
430
327
  break;
431
328
  case "desc":
432
- icon = /* @__PURE__ */ React3.createElement(ArrowDown, {
433
- className: getSize3(3)
329
+ icon = /* @__PURE__ */ React2.createElement(ArrowDown, {
330
+ className: getSize2(3)
434
331
  });
435
332
  break;
436
333
  }
437
- return /* @__PURE__ */ React3.createElement("div", {
334
+ return /* @__PURE__ */ React2.createElement("div", {
438
335
  onClick,
439
336
  className: "flex items-center cursor-pointer"
440
337
  }, icon);
@@ -444,20 +341,20 @@ var SortIndicator = ({ direction, onClick }) => {
444
341
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
445
342
  import { getCoreRowModel, getSortedRowModel, useReactTable, getGroupedRowModel, getExpandedRowModel } from "@tanstack/react-table";
446
343
  import { useVirtualizer } from "@tanstack/react-virtual";
447
- import React9, { Fragment, useCallback as useCallback3, useEffect as useEffect2, useState as useState6 } from "react";
344
+ import React8, { Fragment, useCallback as useCallback2, useEffect as useEffect2, useState as useState5 } from "react";
448
345
  import { log } from "@dxos/log";
449
346
  import { useDefaultValue, useOnTransition } from "@dxos/react-ui";
450
347
 
451
348
  // packages/ui/react-ui-table/src/components/Table/TableBody.tsx
452
349
  import { useArrowNavigationGroup } from "@fluentui/react-tabster";
453
350
  import { flexRender } from "@tanstack/react-table";
454
- import React6 from "react";
351
+ import React5 from "react";
455
352
 
456
353
  // packages/ui/react-ui-table/src/components/Table/TableContext.tsx
457
- import React4, { useContext, createContext } from "react";
354
+ import React3, { useContext, createContext } from "react";
458
355
  var TableContext = /* @__PURE__ */ createContext({});
459
356
  var TableProvider = ({ children, ...value }) => {
460
- return /* @__PURE__ */ React4.createElement(TableContext.Provider, {
357
+ return /* @__PURE__ */ React3.createElement(TableContext.Provider, {
461
358
  value
462
359
  }, children);
463
360
  };
@@ -467,32 +364,32 @@ var useTableContext = () => {
467
364
  };
468
365
 
469
366
  // packages/ui/react-ui-table/src/theme.ts
470
- import { modalSurface, focusRing, ghostSelected, ghostSelectedCurrent, groupBorder, mx as mx4 } from "@dxos/react-ui-theme";
367
+ import { modalSurface, focusRing, ghostSelected, ghostSelectedCurrent, groupBorder, mx as mx3 } from "@dxos/react-ui-theme";
471
368
  var currentRow = "!bg-neutral-75 !dark:bg-neutral-850";
472
369
  var selectedRow = "!bg-primary-100 dark:!bg-primary-700";
473
370
  var flushPadding = "pli-0 plb-0";
474
371
  var textPadding = "pli-2 plb-0.5";
475
372
  var headPadding = "pli-2 plb-1";
476
373
  var gridCellFocusRing = "focus-within:z-[11] focus-within:outline outline-2 outline-primary-500 dark:outline-primary-400";
477
- var tableRoot = ({ fullWidth }, ...etc) => mx4("table-fixed", fullWidth && "is-full", ...etc);
478
- var groupTh = (_props, ...etc) => mx4("text-start font-medium", flushPadding, ...etc);
479
- var theadRoot = ({ header, stickyHeader }, ...etc) => mx4(header ? stickyHeader && "sticky block-start-[--sticky-top] z-[1]" : "collapse", header && "base-surface", "drop-shadow-sm", ...etc);
480
- var theadTr = (_props, ...etc) => mx4("group", ...etc);
481
- var theadTh = ({ border }, ...etc) => mx4("relative", "text-start font-medium select-none truncate", headPadding, border && groupBorder, border && "border border-t-0 border-b-0 border-neutral-200", ...etc);
374
+ var tableRoot = ({ fullWidth }, ...etc) => mx3("table-fixed", fullWidth && "is-full", ...etc);
375
+ var groupTh = (_props, ...etc) => mx3("text-start font-medium", flushPadding, ...etc);
376
+ var theadRoot = ({ header, stickyHeader }, ...etc) => mx3(header ? stickyHeader && "sticky block-start-[--sticky-top] z-[1]" : "collapse", header && "base-surface", "drop-shadow-sm", ...etc);
377
+ var theadTr = (_props, ...etc) => mx3("group", ...etc);
378
+ var theadTh = ({ border }, ...etc) => mx3("relative", "text-start font-medium select-none truncate", headPadding, border && groupBorder, border && "border border-t-0 border-b-0 border-neutral-200", ...etc);
482
379
  var theadResizeRoot = ({ isResizing }) => {
483
- return mx4("absolute h-full w-[4px] top-0 right-0", "cursor-col-resize", "user-select-none", "touch-action-none", !isResizing && "group-hover:bg-neutral-100 dark:group-hover:bg-neutral-800", "pointer-coarse:bg-neutral-100 dark:pointer-coarse:bg-neutral-800", isResizing && "bg-primary-500 dark:bg-primary-400");
380
+ return mx3("absolute h-full w-[4px] top-0 right-0", "cursor-col-resize", "user-select-none", "touch-action-none", !isResizing && "group-hover:bg-neutral-100 dark:group-hover:bg-neutral-800", "pointer-coarse:bg-neutral-100 dark:pointer-coarse:bg-neutral-800", isResizing && "bg-primary-500 dark:bg-primary-400");
484
381
  };
485
- var tbodyRoot = (_props, ...etc) => mx4(...etc);
486
- var tbodyTr = ({ canBeCurrent, isPinned }, ...etc) => mx4("group", canBeCurrent ? ghostSelectedCurrent : ghostSelected, canBeCurrent && focusRing, canBeCurrent && "cursor-pointer rounded", isPinned && "sticky z-1 bottom-[-1px] base-surface", ...etc);
487
- var tdRoot = ({ border, isGrid }, ...etc) => mx4("relative", flushPadding, border && "border", border && groupBorder, isGrid && gridCellFocusRing, ...etc);
488
- var tdContent = (_props, ...etc) => mx4(...etc);
489
- var tfootRoot = (_props, ...etc) => mx4("sticky block-end-0 z-10", modalSurface, ...etc);
490
- var tfootTr = (_props, ...etc) => mx4(...etc);
491
- var tfootTh = ({ border }, ...etc) => mx4(textPadding, modalSurface, border && groupBorder, ...etc);
382
+ var tbodyRoot = (_props, ...etc) => mx3(...etc);
383
+ var tbodyTr = ({ canBeCurrent, isPinned }, ...etc) => mx3("group", canBeCurrent ? ghostSelectedCurrent : ghostSelected, canBeCurrent && focusRing, canBeCurrent && "cursor-pointer rounded", isPinned && "sticky z-1 bottom-[-1px] base-surface", ...etc);
384
+ var tdRoot = ({ border, isGrid }, ...etc) => mx3("relative", flushPadding, border && "border", border && groupBorder, isGrid && gridCellFocusRing, ...etc);
385
+ var tdContent = (_props, ...etc) => mx3(...etc);
386
+ var tfootRoot = (_props, ...etc) => mx3("sticky block-end-0 z-10", modalSurface, ...etc);
387
+ var tfootTr = (_props, ...etc) => mx3(...etc);
388
+ var tfootTh = ({ border }, ...etc) => mx3(textPadding, modalSurface, border && groupBorder, ...etc);
492
389
 
493
390
  // packages/ui/react-ui-table/src/components/Cell/Cell.tsx
494
391
  import { useFocusableGroup } from "@fluentui/react-tabster";
495
- import React5 from "react";
392
+ import React4 from "react";
496
393
  var CELL_NAME = "Cell";
497
394
  var FocusableCell = ({ cell, children }) => {
498
395
  const tableContext = useTableContext();
@@ -500,7 +397,7 @@ var FocusableCell = ({ cell, children }) => {
500
397
  tabBehavior: "limited"
501
398
  });
502
399
  const className = tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames);
503
- return /* @__PURE__ */ React5.createElement("td", {
400
+ return /* @__PURE__ */ React4.createElement("td", {
504
401
  tabIndex: 0,
505
402
  ...domAttributes,
506
403
  className
@@ -508,14 +405,14 @@ var FocusableCell = ({ cell, children }) => {
508
405
  };
509
406
  var StaticCell = ({ cell, children }) => {
510
407
  const tableContext = useTableContext();
511
- return /* @__PURE__ */ React5.createElement("td", {
408
+ return /* @__PURE__ */ React4.createElement("td", {
512
409
  className: tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames)
513
410
  }, children);
514
411
  };
515
412
  var Cell = ({ cell, children }) => {
516
413
  const { isGrid } = useTableContext();
517
414
  const Root = isGrid ? FocusableCell : StaticCell;
518
- return /* @__PURE__ */ React5.createElement(Root, {
415
+ return /* @__PURE__ */ React4.createElement(Root, {
519
416
  cell
520
417
  }, children);
521
418
  };
@@ -530,7 +427,7 @@ var TableBody = ({ rows }) => {
530
427
  axis: "grid"
531
428
  });
532
429
  const canBeCurrent = !isGrid && !!onDatumClick;
533
- return /* @__PURE__ */ React6.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
430
+ return /* @__PURE__ */ React5.createElement("tbody", isGrid && domAttributes, rows.map((row) => {
534
431
  const isCurrent = currentDatum === row.original;
535
432
  const isSelected = rowSelection?.[row.id];
536
433
  const isPinned = row.getIsPinned();
@@ -538,7 +435,7 @@ var TableBody = ({ rows }) => {
538
435
  canBeCurrent,
539
436
  isPinned: isPinned !== false
540
437
  });
541
- return /* @__PURE__ */ React6.createElement("tr", {
438
+ return /* @__PURE__ */ React5.createElement("tr", {
542
439
  key: keyAccessor ? keyAccessor(row.original) : row.id,
543
440
  className: classNames,
544
441
  ...isCurrent && {
@@ -558,57 +455,57 @@ var TableBody = ({ rows }) => {
558
455
  }
559
456
  }
560
457
  }
561
- }, debug && /* @__PURE__ */ React6.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
562
- return /* @__PURE__ */ React6.createElement(Cell, {
458
+ }, debug && /* @__PURE__ */ React5.createElement("td", null, row.id), row.getVisibleCells().map((cell) => {
459
+ return /* @__PURE__ */ React5.createElement(Cell, {
563
460
  key: cell.id,
564
461
  cell
565
462
  }, flexRender(cell.column.columnDef.cell, {
566
463
  className: "pli-2",
567
464
  ...cell.getContext()
568
465
  }));
569
- }), expand && /* @__PURE__ */ React6.createElement("td", null));
466
+ }), expand && /* @__PURE__ */ React5.createElement("td", null));
570
467
  }));
571
468
  };
572
469
  TableBody.displayName = TABLE_BODY_NAME;
573
470
 
574
471
  // packages/ui/react-ui-table/src/components/Table/TableFooter.tsx
575
472
  import { flexRender as flexRender2 } from "@tanstack/react-table";
576
- import React7 from "react";
473
+ import React6 from "react";
577
474
  var TABLE_FOOT_NAME = "TableFooter";
578
475
  var TableFooter = (props) => {
579
476
  const tableContext = useTableContext();
580
477
  const { table, expand, debug } = tableContext;
581
478
  const footers = table.getFooterGroups();
582
- return /* @__PURE__ */ React7.createElement("tfoot", {
479
+ return /* @__PURE__ */ React6.createElement("tfoot", {
583
480
  className: tfootRoot(props)
584
- }, footers.map((footerGroup) => /* @__PURE__ */ React7.createElement("tr", {
481
+ }, footers.map((footerGroup) => /* @__PURE__ */ React6.createElement("tr", {
585
482
  key: footerGroup.id,
586
483
  className: tfootTr(tableContext)
587
- }, debug && /* @__PURE__ */ React7.createElement("th", null), footerGroup.headers.map((footer) => {
588
- return /* @__PURE__ */ React7.createElement("th", {
484
+ }, debug && /* @__PURE__ */ React6.createElement("th", null), footerGroup.headers.map((footer) => {
485
+ return /* @__PURE__ */ React6.createElement("th", {
589
486
  key: footer.id,
590
487
  className: tfootTh(tableContext, footer.column.columnDef.meta?.footer?.classNames)
591
488
  }, footer.isPlaceholder ? null : flexRender2(footer.column.columnDef.footer, footer.getContext()));
592
- }), expand && /* @__PURE__ */ React7.createElement("th", null))));
489
+ }), expand && /* @__PURE__ */ React6.createElement("th", null))));
593
490
  };
594
491
  TableFooter.displayName = TABLE_FOOT_NAME;
595
492
 
596
493
  // packages/ui/react-ui-table/src/components/Table/TableHead.tsx
597
494
  import { flexRender as flexRender3 } from "@tanstack/react-table";
598
- import React8 from "react";
495
+ import React7 from "react";
599
496
  var TABLE_HEAD_NAME = "TableHeader";
600
497
  var TableHead = (_props) => {
601
498
  const tableContext = useTableContext();
602
499
  const headerGroups = tableContext.table.getHeaderGroups();
603
- return /* @__PURE__ */ React8.createElement("thead", {
500
+ return /* @__PURE__ */ React7.createElement("thead", {
604
501
  className: theadRoot(tableContext)
605
502
  }, headerGroups.map((headerGroup) => {
606
503
  return (
607
504
  // Group element to hover resize handles.
608
- /* @__PURE__ */ React8.createElement("tr", {
505
+ /* @__PURE__ */ React7.createElement("tr", {
609
506
  key: headerGroup.id,
610
507
  className: theadTr(tableContext)
611
- }, tableContext.debug && /* @__PURE__ */ React8.createElement("th", {
508
+ }, tableContext.debug && /* @__PURE__ */ React7.createElement("th", {
612
509
  className: "font-mono",
613
510
  style: {
614
511
  width: 32
@@ -617,13 +514,13 @@ var TableHead = (_props) => {
617
514
  const isResizing = header.column.getIsResizing();
618
515
  const onResize = header.getResizeHandler();
619
516
  const resizable = header.column.columnDef.meta?.resizable;
620
- return /* @__PURE__ */ React8.createElement("th", {
517
+ return /* @__PURE__ */ React7.createElement("th", {
621
518
  key: header.id,
622
519
  style: {
623
520
  width: header.getSize()
624
521
  },
625
522
  className: theadTh(tableContext, header.column.columnDef.meta?.header?.classNames)
626
- }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), resizable && /* @__PURE__ */ React8.createElement("div", {
523
+ }, !header || header.isPlaceholder ? null : flexRender3(header.column.columnDef.header, header.getContext()), resizable && /* @__PURE__ */ React7.createElement("div", {
627
524
  className: theadResizeRoot({
628
525
  isResizing
629
526
  }),
@@ -631,12 +528,48 @@ var TableHead = (_props) => {
631
528
  onMouseDown: onResize,
632
529
  onTouchStart: onResize
633
530
  }));
634
- }), tableContext.expand && /* @__PURE__ */ React8.createElement("th", null))
531
+ }), tableContext.expand && /* @__PURE__ */ React7.createElement("th", null))
635
532
  );
636
533
  }));
637
534
  };
638
535
  TableHead.displayName = TABLE_HEAD_NAME;
639
536
 
537
+ // packages/ui/react-ui-table/src/components/hooks/usePinLastRow.ts
538
+ import { useEffect, useState as useState4 } from "react";
539
+ var usePinLastRow = (pinLastRow, table, data, getScrollElement) => {
540
+ const [pinnedRowKey, setPinnedRowKey] = useState4();
541
+ useEffect(() => {
542
+ if (!pinLastRow) {
543
+ return;
544
+ }
545
+ const rows = table.getRowModel().rows;
546
+ const rowToPin = rows[rows.length - 1];
547
+ const rowId = rowToPin.id;
548
+ if (rowId === pinnedRowKey) {
549
+ return;
550
+ }
551
+ table.resetRowPinning();
552
+ rowToPin.pin("bottom");
553
+ const scrollElement = getScrollElement?.();
554
+ const isFirstRender = pinnedRowKey === void 0;
555
+ if (scrollElement && !isFirstRender) {
556
+ requestAnimationFrame(() => {
557
+ scrollElement.scrollTo({
558
+ top: scrollElement.scrollHeight
559
+ });
560
+ });
561
+ }
562
+ setPinnedRowKey(rowId);
563
+ }, [
564
+ pinLastRow,
565
+ table,
566
+ getScrollElement,
567
+ pinnedRowKey,
568
+ setPinnedRowKey,
569
+ data
570
+ ]);
571
+ };
572
+
640
573
  // packages/ui/react-ui-table/src/components/Table/Table.tsx
641
574
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
642
575
  var Table = (props) => {
@@ -644,8 +577,8 @@ var Table = (props) => {
644
577
  const columns = useDefaultValue(props.columns, []);
645
578
  const data = useDefaultValue(props.data, []);
646
579
  const TableProvider2 = TableProvider;
647
- const [columnsInitialised, setColumnsInitialised] = useState6(false);
648
- const [columnSizing, setColumnSizing] = useState6({});
580
+ const [columnsInitialised, setColumnsInitialised] = useState5(false);
581
+ const [columnSizing, setColumnSizing] = useState5({});
649
582
  useEffect2(() => {
650
583
  if (columnsInitialised) {
651
584
  return;
@@ -659,8 +592,8 @@ var Table = (props) => {
659
592
  columns,
660
593
  setColumnSizing
661
594
  ]);
662
- const [columnSizingInfo, setColumnSizingInfo] = useState6({});
663
- const notifyColumnResize = useCallback3(() => onColumnResize?.(columnSizing), [
595
+ const [columnSizingInfo, setColumnSizingInfo] = useState5({});
596
+ const notifyColumnResize = useCallback2(() => onColumnResize?.(columnSizing), [
664
597
  onColumnResize,
665
598
  columnSizing
666
599
  ]);
@@ -670,7 +603,7 @@ var Table = (props) => {
670
603
  onChange: props.onRowSelectionChange,
671
604
  defaultProp: props.defaultRowSelection
672
605
  });
673
- const handleRowSelectionChange = useCallback3((updaterOrValue) => {
606
+ const handleRowSelectionChange = useCallback2((updaterOrValue) => {
674
607
  const nextRowSelection = typeof updaterOrValue === "function" ? updaterOrValue(rowSelection) : updaterOrValue;
675
608
  if (rowsSelectable === "multi") {
676
609
  setRowSelection(nextRowSelection);
@@ -687,7 +620,7 @@ var Table = (props) => {
687
620
  setRowSelection,
688
621
  rowSelection
689
622
  ]);
690
- const [grouping, handleGroupingChange] = useState6(props.grouping ?? []);
623
+ const [grouping, handleGroupingChange] = useState5(props.grouping ?? []);
691
624
  useEffect2(() => handleGroupingChange(props.grouping ?? []), [
692
625
  handleGroupingChange,
693
626
  props.grouping
@@ -747,13 +680,13 @@ var Table = (props) => {
747
680
  C: (f, a) => f(...a)
748
681
  });
749
682
  }
750
- return /* @__PURE__ */ React9.createElement(TableProvider2, {
683
+ return /* @__PURE__ */ React8.createElement(TableProvider2, {
751
684
  ...props,
752
685
  table,
753
686
  header,
754
687
  expand,
755
688
  isGrid: role === "grid" || role === "treegrid"
756
- }, /* @__PURE__ */ React9.createElement(TableImpl, {
689
+ }, /* @__PURE__ */ React8.createElement(TableImpl, {
757
690
  debug: false,
758
691
  getScrollElement,
759
692
  ...props
@@ -769,13 +702,13 @@ var TableImpl = (props) => {
769
702
  ...bottomRows
770
703
  ];
771
704
  if (debug) {
772
- return /* @__PURE__ */ React9.createElement("pre", {
705
+ return /* @__PURE__ */ React8.createElement("pre", {
773
706
  className: "font-mono text-xs text-neutral-500 m-1 p-2 ring"
774
- }, /* @__PURE__ */ React9.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
707
+ }, /* @__PURE__ */ React8.createElement("code", null, JSON.stringify(table.getState(), void 0, 2)));
775
708
  }
776
709
  const virtualisable = getScrollElement !== void 0;
777
710
  const isResizingColumn = table.getState().columnSizingInfo.isResizingColumn;
778
- return /* @__PURE__ */ React9.createElement("table", {
711
+ return /* @__PURE__ */ React8.createElement("table", {
779
712
  role,
780
713
  className: tableRoot(props, classNames),
781
714
  ...!fullWidth && {
@@ -783,13 +716,13 @@ var TableImpl = (props) => {
783
716
  width: table.getTotalSize()
784
717
  }
785
718
  }
786
- }, /* @__PURE__ */ React9.createElement(TableHead, null), grouping?.length !== 0 ? virtualisable ? isResizingColumn ? /* @__PURE__ */ React9.createElement(MemoizedVirtualisedTableContent, {
719
+ }, /* @__PURE__ */ React8.createElement(TableHead, null), grouping?.length !== 0 ? virtualisable ? isResizingColumn ? /* @__PURE__ */ React8.createElement(MemoizedVirtualisedTableContent, {
787
720
  getScrollElement
788
- }) : /* @__PURE__ */ React9.createElement(VirtualizedTableContent, {
721
+ }) : /* @__PURE__ */ React8.createElement(VirtualizedTableContent, {
789
722
  getScrollElement
790
- }) : /* @__PURE__ */ React9.createElement(TableBody, {
723
+ }) : /* @__PURE__ */ React8.createElement(TableBody, {
791
724
  rows
792
- }) : /* @__PURE__ */ React9.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React9.createElement(TableFooter, null));
725
+ }) : /* @__PURE__ */ React8.createElement(GroupedTableContent, null), footer && /* @__PURE__ */ React8.createElement(TableFooter, null));
793
726
  };
794
727
  var VirtualizedTableContent = ({ getScrollElement }) => {
795
728
  const { table } = useTableContext();
@@ -809,44 +742,113 @@ var VirtualizedTableContent = ({ getScrollElement }) => {
809
742
  ...virtualRows.map((virtualRow) => centerRows[virtualRow.index]),
810
743
  ...pinnedRows
811
744
  ];
812
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React9.createElement("tbody", {
745
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, paddingTop > 0 && /* @__PURE__ */ React8.createElement("tbody", {
813
746
  role: "none"
814
- }, /* @__PURE__ */ React9.createElement("tr", {
747
+ }, /* @__PURE__ */ React8.createElement("tr", {
815
748
  role: "none"
816
- }, /* @__PURE__ */ React9.createElement("td", {
749
+ }, /* @__PURE__ */ React8.createElement("td", {
817
750
  style: {
818
751
  height: `${paddingTop}px`
819
752
  },
820
753
  role: "none"
821
- }))), /* @__PURE__ */ React9.createElement(TableBody, {
754
+ }))), /* @__PURE__ */ React8.createElement(TableBody, {
822
755
  rows: rowsToRender
823
- }), paddingBottom > 0 && /* @__PURE__ */ React9.createElement("tbody", {
756
+ }), paddingBottom > 0 && /* @__PURE__ */ React8.createElement("tbody", {
824
757
  role: "none"
825
- }, /* @__PURE__ */ React9.createElement("tr", {
758
+ }, /* @__PURE__ */ React8.createElement("tr", {
826
759
  role: "none"
827
- }, /* @__PURE__ */ React9.createElement("td", {
760
+ }, /* @__PURE__ */ React8.createElement("td", {
828
761
  style: {
829
762
  height: `${paddingBottom}px`
830
763
  },
831
764
  role: "none"
832
765
  }))));
833
766
  };
834
- var MemoizedVirtualisedTableContent = /* @__PURE__ */ React9.memo(VirtualizedTableContent);
767
+ var MemoizedVirtualisedTableContent = /* @__PURE__ */ React8.memo(VirtualizedTableContent);
835
768
  var GroupedTableContent = () => {
836
769
  const { table: { getGroupedRowModel: getGroupedRowModel2, getHeaderGroups, getState }, debug } = useTableContext();
837
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
838
- return /* @__PURE__ */ React9.createElement(Fragment, {
770
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, getGroupedRowModel2().rows.map((row, i) => {
771
+ return /* @__PURE__ */ React8.createElement(Fragment, {
839
772
  key: i
840
- }, /* @__PURE__ */ React9.createElement("thead", null, /* @__PURE__ */ React9.createElement("tr", null, debug && /* @__PURE__ */ React9.createElement("th", null), /* @__PURE__ */ React9.createElement("th", {
773
+ }, /* @__PURE__ */ React8.createElement("thead", null, /* @__PURE__ */ React8.createElement("tr", null, debug && /* @__PURE__ */ React8.createElement("th", null), /* @__PURE__ */ React8.createElement("th", {
841
774
  // TODO(burdon): Calculate row span.
842
775
  colSpan: getHeaderGroups()[0].headers.length,
843
776
  className: groupTh({})
844
- }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React9.createElement(TableBody, {
777
+ }, getState().grouping[0], "[", String(row.getGroupingValue(getState().grouping[0])), "]"))), /* @__PURE__ */ React8.createElement(TableBody, {
845
778
  rows: row.subRows
846
779
  }));
847
780
  }));
848
781
  };
849
782
 
783
+ // packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx
784
+ import { CaretDown as CaretDown2 } from "@phosphor-icons/react";
785
+ import React9, { useCallback as useCallback3, useState as useState6 } from "react";
786
+ import { Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
787
+ import { PopoverCombobox } from "@dxos/react-ui-searchlist";
788
+ import { descriptionText, getSize as getSize3, mx as mx4, staticPlaceholderText } from "@dxos/react-ui-theme";
789
+ var initialItems = (model, value) => value ? {
790
+ [model.getId(value)]: {
791
+ label: model.getText(value),
792
+ data: value
793
+ }
794
+ } : {};
795
+ var CellCombobox = ({ model, value, onValueChange }) => {
796
+ const { t } = useTranslation2(translationKey);
797
+ const [items, setItems] = useState6(initialItems(model, value));
798
+ const [loading, setLoading] = useState6(false);
799
+ const [searchInputValue, setSearchInputValue] = useState6("");
800
+ const handleSearchInputValueChange = async (text) => {
801
+ setSearchInputValue(text ?? "");
802
+ setLoading(true);
803
+ const items2 = await model.query(text);
804
+ setItems(items2.reduce((acc, item) => {
805
+ acc[model.getId(item)] = {
806
+ label: model.getText(item),
807
+ data: item
808
+ };
809
+ return acc;
810
+ }, initialItems(model, value)));
811
+ setLoading(false);
812
+ };
813
+ const handleValueChange = useCallback3((id) => {
814
+ onValueChange(items[id]?.data);
815
+ }, [
816
+ items,
817
+ onValueChange
818
+ ]);
819
+ return /* @__PURE__ */ React9.createElement(PopoverCombobox.Root, {
820
+ placeholder: t("no selection label")
821
+ }, /* @__PURE__ */ React9.createElement(PopoverCombobox.Trigger, {
822
+ variant: "ghost",
823
+ classNames: "is-full rounded-none ring-inset"
824
+ }, value ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement("span", {
825
+ className: mx4("font-normal text-start text-base flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
826
+ }, model.getText(value)), /* @__PURE__ */ React9.createElement(CaretDown2, {
827
+ weight: "bold",
828
+ className: getSize3(3)
829
+ })) : null), /* @__PURE__ */ React9.createElement(PopoverCombobox.Content, {
830
+ shouldFilter: false,
831
+ classNames: "is-[--radix-popover-trigger-width]"
832
+ }, /* @__PURE__ */ React9.createElement(PopoverCombobox.Input, {
833
+ value: searchInputValue,
834
+ onValueChange: handleSearchInputValueChange
835
+ }), /* @__PURE__ */ React9.createElement(PopoverCombobox.List, null, searchInputValue.length < 1 ? /* @__PURE__ */ React9.createElement("p", {
836
+ className: mx4("text-center", descriptionText)
837
+ }, "Start typing to search") : loading ? /* @__PURE__ */ React9.createElement("p", {
838
+ className: mx4("text-center", descriptionText)
839
+ }, "Searching\u2026") : /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(PopoverCombobox.Empty, {
840
+ classNames: [
841
+ "text-center",
842
+ descriptionText
843
+ ]
844
+ }, "No results"), Object.entries(items).map(([id, { label }]) => /* @__PURE__ */ React9.createElement(PopoverCombobox.Item, {
845
+ key: id,
846
+ value: id,
847
+ onSelect: handleValueChange,
848
+ classNames: "truncate"
849
+ }, label)))), /* @__PURE__ */ React9.createElement(Popover2.Arrow, null)));
850
+ };
851
+
850
852
  // packages/ui/react-ui-table/src/helpers.tsx
851
853
  import { useFocusFinders } from "@fluentui/react-tabster";
852
854
  import { Check as Check2, ClipboardText, X as X3 } from "@phosphor-icons/react";
@@ -1275,131 +1277,10 @@ var ColumnBuilder = class {
1275
1277
  };
1276
1278
  }
1277
1279
  };
1278
-
1279
- // packages/ui/react-ui-table/src/schema/schema.ts
1280
- import { AST } from "@effect/schema";
1281
- var isOptionalUnion = (prop) => AST.isUnion(prop.type) && prop.isOptional;
1282
- var unwrapOptionProperty = (prop) => {
1283
- if (!isOptionalUnion(prop)) {
1284
- throw new Error("Not an optional property");
1285
- }
1286
- if (!AST.isUnion(prop.type)) {
1287
- throw new Error("Not a union type");
1288
- }
1289
- const [type, _undefinedCase] = prop.type.types;
1290
- return type;
1291
- };
1292
- var typeToColumn = (type) => {
1293
- if (AST.isStringKeyword(type)) {
1294
- return "string";
1295
- } else if (AST.isNumberKeyword(type)) {
1296
- return "number";
1297
- } else if (AST.isBooleanKeyword(type)) {
1298
- return "boolean";
1299
- }
1300
- if (AST.isRefinement(type)) {
1301
- return typeToColumn(type.from);
1302
- }
1303
- if (AST.isTransform(type)) {
1304
- const identifier = AST.getIdentifierAnnotation(type);
1305
- if (identifier._tag === "Some") {
1306
- if (identifier.value === "DateFromString") {
1307
- return "date";
1308
- }
1309
- }
1310
- }
1311
- return "display";
1312
- };
1313
- var propertyToColumn = (property) => {
1314
- let type = property.type;
1315
- if (property.isOptional) {
1316
- type = unwrapOptionProperty(property);
1317
- }
1318
- return typeToColumn(type);
1319
- };
1320
- var isStruct = (node) => AST.isTypeLiteral(node);
1321
- var classifySchemaProperties = (schema) => {
1322
- const recurse = (node, path, acc) => {
1323
- const properties = AST.getPropertySignatures(node);
1324
- properties.forEach((prop) => {
1325
- const propName = prop.name.toString();
1326
- if (prop.isOptional) {
1327
- const unwrappedAst = unwrapOptionProperty(prop);
1328
- if (isStruct(unwrappedAst)) {
1329
- return recurse(unwrappedAst, [
1330
- ...path,
1331
- propName
1332
- ], acc);
1333
- }
1334
- }
1335
- if (isStruct(prop.type)) {
1336
- recurse(prop.type, [
1337
- ...path,
1338
- propName
1339
- ], acc);
1340
- } else {
1341
- acc.push([
1342
- path.concat(propName).join("."),
1343
- propertyToColumn(prop)
1344
- ]);
1345
- }
1346
- });
1347
- return acc;
1348
- };
1349
- return recurse(schema.ast, [], []);
1350
- };
1351
-
1352
- // packages/ui/react-ui-table/src/schema/schemaToColumns.ts
1353
- var schemaToColumnDefs = (schema) => {
1354
- const { helper, builder } = createColumnBuilder();
1355
- const classified = classifySchemaProperties(schema);
1356
- return classified.map(([name, type]) => {
1357
- const propertyKey = name.toString();
1358
- let column;
1359
- switch (type) {
1360
- case "string": {
1361
- column = builder.string({
1362
- label: propertyKey
1363
- });
1364
- break;
1365
- }
1366
- case "number": {
1367
- column = builder.number({
1368
- label: propertyKey
1369
- });
1370
- break;
1371
- }
1372
- case "boolean": {
1373
- column = builder.switch({
1374
- label: propertyKey
1375
- });
1376
- break;
1377
- }
1378
- case "date": {
1379
- column = builder.date({
1380
- label: propertyKey
1381
- });
1382
- break;
1383
- }
1384
- case "display": {
1385
- column = builder.display({
1386
- label: propertyKey,
1387
- id: propertyKey
1388
- });
1389
- break;
1390
- }
1391
- default: {
1392
- throw new Error(`Unhandled column type: ${type}`);
1393
- }
1394
- }
1395
- return helper.accessor(propertyKey, column);
1396
- });
1397
- };
1398
1280
  export {
1399
1281
  CellCombobox,
1400
1282
  ColumnBuilder,
1401
1283
  ColumnMenu,
1402
- ColumnSettingsForm,
1403
1284
  ColumnSettingsPanel,
1404
1285
  MemoizedVirtualisedTableContent,
1405
1286
  SortIndicator,
@@ -1410,7 +1291,6 @@ export {
1410
1291
  gridCellFocusRing,
1411
1292
  groupTh,
1412
1293
  headPadding,
1413
- schemaToColumnDefs,
1414
1294
  selectedRow,
1415
1295
  tableRoot,
1416
1296
  tbodyRoot,
@@ -1425,8 +1305,6 @@ export {
1425
1305
  theadRoot,
1426
1306
  theadTh,
1427
1307
  theadTr,
1428
- translations_default as translations,
1429
- useColumnSorting,
1430
- usePinLastRow
1308
+ translations_default as translations
1431
1309
  };
1432
1310
  //# sourceMappingURL=index.mjs.map