@dxos/react-ui-list 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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,4 +1,5 @@
1
1
  // packages/ui/react-ui-list/src/components/Accordion/AccordionItem.tsx
2
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
2
3
  import * as AccordionPrimitive2 from "@radix-ui/react-accordion";
3
4
  import { createContext as createContext2 } from "@radix-ui/react-context";
4
5
  import React2 from "react";
@@ -6,6 +7,7 @@ import { Icon } from "@dxos/react-ui";
6
7
  import { mx as mx2 } from "@dxos/react-ui-theme";
7
8
 
8
9
  // packages/ui/react-ui-list/src/components/Accordion/AccordionRoot.tsx
10
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
9
11
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
10
12
  import { createContext } from "@radix-ui/react-context";
11
13
  import React from "react";
@@ -14,50 +16,70 @@ var ACCORDION_NAME = "Accordion";
14
16
  var [AccordionProvider, useAccordionContext] = createContext(ACCORDION_NAME);
15
17
  var defaultGetId = (item) => item?.id;
16
18
  var AccordionRoot = ({ classNames, items, getId = defaultGetId, children, value, defaultValue, onValueChange }) => {
17
- return /* @__PURE__ */ React.createElement(AccordionProvider, {
18
- getId
19
- }, /* @__PURE__ */ React.createElement(AccordionPrimitive.Root, {
20
- type: "multiple",
21
- value,
22
- defaultValue,
23
- onValueChange,
24
- className: mx(classNames)
25
- }, children?.({
26
- items: items ?? []
27
- })));
19
+ var _effect = _useSignals();
20
+ try {
21
+ return /* @__PURE__ */ React.createElement(AccordionProvider, {
22
+ getId
23
+ }, /* @__PURE__ */ React.createElement(AccordionPrimitive.Root, {
24
+ type: "multiple",
25
+ value,
26
+ defaultValue,
27
+ onValueChange,
28
+ className: mx(classNames)
29
+ }, children?.({
30
+ items: items ?? []
31
+ })));
32
+ } finally {
33
+ _effect.f();
34
+ }
28
35
  };
29
36
 
30
37
  // packages/ui/react-ui-list/src/components/Accordion/AccordionItem.tsx
31
38
  var ACCORDION_ITEM_NAME = "AccordionItem";
32
39
  var [AccordionItemProvider, useAccordionItemContext] = createContext2(ACCORDION_ITEM_NAME);
33
40
  var AccordionItem = ({ children, classNames, item }) => {
34
- const { getId } = useAccordionContext(ACCORDION_ITEM_NAME);
35
- return /* @__PURE__ */ React2.createElement(AccordionItemProvider, {
36
- item
37
- }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Item, {
38
- value: getId(item),
39
- className: mx2("overflow-hidden", classNames)
40
- }, children));
41
+ var _effect = _useSignals2();
42
+ try {
43
+ const { getId } = useAccordionContext(ACCORDION_ITEM_NAME);
44
+ return /* @__PURE__ */ React2.createElement(AccordionItemProvider, {
45
+ item
46
+ }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Item, {
47
+ value: getId(item),
48
+ className: mx2("overflow-hidden", classNames)
49
+ }, children));
50
+ } finally {
51
+ _effect.f();
52
+ }
41
53
  };
42
54
  var AccordionItemHeader = ({ classNames, children, ...props }) => {
43
- return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Header, {
44
- ...props,
45
- className: mx2(classNames)
46
- }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Trigger, {
47
- className: "group flex items-center p-2 dx-focus-ring-inset is-full text-start"
48
- }, children, /* @__PURE__ */ React2.createElement(Icon, {
49
- icon: "ph--caret-right--regular",
50
- size: 4,
51
- classNames: "transition-transform duration-200 group-data-[state=open]:rotate-90"
52
- })));
55
+ var _effect = _useSignals2();
56
+ try {
57
+ return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Header, {
58
+ ...props,
59
+ className: mx2(classNames)
60
+ }, /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Trigger, {
61
+ className: "group flex items-center p-2 dx-focus-ring-inset is-full text-start"
62
+ }, children, /* @__PURE__ */ React2.createElement(Icon, {
63
+ icon: "ph--caret-right--regular",
64
+ size: 4,
65
+ classNames: "transition-transform duration-200 group-data-[state=open]:rotate-90"
66
+ })));
67
+ } finally {
68
+ _effect.f();
69
+ }
53
70
  };
54
71
  var AccordionItemBody = ({ children, classNames }) => {
55
- return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Content, {
56
- className: "overflow-hidden data-[state=closed]:animate-slideUp data-[state=open]:animate-slideDown"
57
- }, /* @__PURE__ */ React2.createElement("div", {
58
- role: "none",
59
- className: mx2("p-2", classNames)
60
- }, children));
72
+ var _effect = _useSignals2();
73
+ try {
74
+ return /* @__PURE__ */ React2.createElement(AccordionPrimitive2.Content, {
75
+ className: "overflow-hidden data-[state=closed]:animate-slideUp data-[state=open]:animate-slideDown"
76
+ }, /* @__PURE__ */ React2.createElement("div", {
77
+ role: "none",
78
+ className: mx2("p-2", classNames)
79
+ }, children));
80
+ } finally {
81
+ _effect.f();
82
+ }
61
83
  };
62
84
 
63
85
  // packages/ui/react-ui-list/src/components/Accordion/Accordion.tsx
@@ -69,6 +91,7 @@ var Accordion = {
69
91
  };
70
92
 
71
93
  // packages/ui/react-ui-list/src/components/List/ListItem.tsx
94
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
72
95
  import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
73
96
  import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
74
97
  import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
@@ -81,6 +104,7 @@ import { Icon as Icon2, ListItem as NaturalListItem } from "@dxos/react-ui";
81
104
  import { mx as mx3 } from "@dxos/react-ui-theme";
82
105
 
83
106
  // packages/ui/react-ui-list/src/components/List/ListRoot.tsx
107
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
84
108
  import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
85
109
  import { extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
86
110
  import { getReorderDestinationIndex } from "@atlaskit/pragmatic-drag-and-drop-hitbox/util/get-reorder-destination-index";
@@ -90,63 +114,68 @@ var LIST_NAME = "List";
90
114
  var [ListProvider, useListContext] = createContext3(LIST_NAME);
91
115
  var defaultGetId2 = (item) => item?.id;
92
116
  var ListRoot = ({ children, items, isItem, getId = defaultGetId2, onMove, ...props }) => {
93
- const isEqual = useCallback((a, b) => {
94
- const idA = getId?.(a);
95
- const idB = getId?.(b);
96
- if (idA !== void 0 && idB !== void 0) {
97
- return idA === idB;
98
- } else {
99
- return a === b;
100
- }
101
- }, [
102
- getId
103
- ]);
104
- const [state, setState] = useState(idle);
105
- useEffect(() => {
106
- if (!items) {
107
- return;
108
- }
109
- return monitorForElements({
110
- canMonitor: ({ source }) => isItem(source.data),
111
- onDrop: ({ location, source }) => {
112
- const target = location.current.dropTargets[0];
113
- if (!target) {
114
- return;
115
- }
116
- const sourceData = source.data;
117
- const targetData = target.data;
118
- if (!isItem(sourceData) || !isItem(targetData)) {
119
- return;
120
- }
121
- const sourceIdx = items.findIndex((item) => isEqual(item, sourceData));
122
- const targetIdx = items.findIndex((item) => isEqual(item, targetData));
123
- if (targetIdx < 0 || sourceIdx < 0) {
124
- return;
125
- }
126
- const closestEdgeOfTarget = extractClosestEdge(targetData);
127
- const destinationIndex = getReorderDestinationIndex({
128
- closestEdgeOfTarget,
129
- startIndex: sourceIdx,
130
- indexOfTarget: targetIdx,
131
- axis: "vertical"
132
- });
133
- onMove?.(sourceIdx, destinationIndex);
117
+ var _effect = _useSignals3();
118
+ try {
119
+ const isEqual = useCallback((a, b) => {
120
+ const idA = getId?.(a);
121
+ const idB = getId?.(b);
122
+ if (idA !== void 0 && idB !== void 0) {
123
+ return idA === idB;
124
+ } else {
125
+ return a === b;
134
126
  }
135
- });
136
- }, [
137
- items,
138
- isEqual,
139
- onMove
140
- ]);
141
- return /* @__PURE__ */ React3.createElement(ListProvider, {
142
- state,
143
- setState,
144
- isItem,
145
- ...props
146
- }, children?.({
147
- state,
148
- items: items ?? []
149
- }));
127
+ }, [
128
+ getId
129
+ ]);
130
+ const [state, setState] = useState(idle);
131
+ useEffect(() => {
132
+ if (!items) {
133
+ return;
134
+ }
135
+ return monitorForElements({
136
+ canMonitor: ({ source }) => isItem?.(source.data) ?? false,
137
+ onDrop: ({ location, source }) => {
138
+ const target = location.current.dropTargets[0];
139
+ if (!target) {
140
+ return;
141
+ }
142
+ const sourceData = source.data;
143
+ const targetData = target.data;
144
+ if (!isItem?.(sourceData) || !isItem?.(targetData)) {
145
+ return;
146
+ }
147
+ const sourceIdx = items.findIndex((item) => isEqual(item, sourceData));
148
+ const targetIdx = items.findIndex((item) => isEqual(item, targetData));
149
+ if (targetIdx < 0 || sourceIdx < 0) {
150
+ return;
151
+ }
152
+ const closestEdgeOfTarget = extractClosestEdge(targetData);
153
+ const destinationIndex = getReorderDestinationIndex({
154
+ closestEdgeOfTarget,
155
+ startIndex: sourceIdx,
156
+ indexOfTarget: targetIdx,
157
+ axis: "vertical"
158
+ });
159
+ onMove?.(sourceIdx, destinationIndex);
160
+ }
161
+ });
162
+ }, [
163
+ items,
164
+ isEqual,
165
+ onMove
166
+ ]);
167
+ return /* @__PURE__ */ React3.createElement(ListProvider, {
168
+ state,
169
+ setState,
170
+ isItem,
171
+ ...props
172
+ }, children?.({
173
+ state,
174
+ items: items ?? []
175
+ }));
176
+ } finally {
177
+ _effect.f();
178
+ }
150
179
  };
151
180
 
152
181
  // packages/ui/react-ui-list/src/components/List/ListItem.tsx
@@ -161,176 +190,201 @@ var defaultContext = {};
161
190
  var LIST_ITEM_NAME = "ListItem";
162
191
  var [ListItemProvider, useListItemContext] = createContext4(LIST_ITEM_NAME, defaultContext);
163
192
  var ListItem = ({ children, classNames, item, ...props }) => {
164
- const { isItem, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);
165
- const ref = useRef(null);
166
- const dragHandleRef = useRef(null);
167
- const [state, setState] = useState2(idle);
168
- useEffect2(() => {
169
- const element = ref.current;
170
- invariant(element, void 0, {
171
- F: __dxlog_file,
172
- L: 91,
173
- S: void 0,
174
- A: [
175
- "element",
176
- ""
177
- ]
178
- });
179
- return combine(
180
- //
181
- // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#draggable
182
- //
183
- draggable({
184
- element,
185
- dragHandle: dragHandleRef.current,
186
- getInitialData: () => item,
187
- onGenerateDragPreview: dragPreview ? ({ nativeSetDragImage, source }) => {
188
- const rect = source.element.getBoundingClientRect();
189
- setCustomNativeDragPreview({
190
- nativeSetDragImage,
191
- getOffset: ({ container }) => {
192
- const { height } = container.getBoundingClientRect();
193
- return {
194
- x: 20,
195
- y: height / 2
196
- };
197
- },
198
- render: ({ container }) => {
199
- container.style.width = rect.width + "px";
200
- setState({
201
- type: "preview",
202
- container
203
- });
204
- setRootState({
205
- type: "preview",
206
- container,
207
- item
208
- });
209
- return () => {
210
- };
211
- }
212
- });
213
- } : void 0,
214
- onDragStart: () => {
215
- setState({
216
- type: "is-dragging"
217
- });
218
- setRootState({
219
- type: "is-dragging",
220
- item
221
- });
222
- },
223
- onDrop: () => {
224
- setState(idle);
225
- setRootState(idle);
226
- }
227
- }),
228
- //
229
- // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#drop-target-for-elements
230
- //
231
- dropTargetForElements({
232
- element,
233
- canDrop: ({ source }) => {
234
- return source.element !== element && isItem(source.data);
235
- },
236
- getData: ({ input }) => {
237
- return attachClosestEdge(item, {
238
- element,
239
- input,
240
- allowedEdges: [
241
- "top",
242
- "bottom"
243
- ]
244
- });
245
- },
246
- getIsSticky: () => true,
247
- onDragEnter: ({ self }) => {
248
- const closestEdge = extractClosestEdge2(self.data);
249
- setState({
250
- type: "is-dragging-over",
251
- closestEdge
252
- });
253
- },
254
- onDrag: ({ self }) => {
255
- const closestEdge = extractClosestEdge2(self.data);
256
- setState((current) => {
257
- if (current.type === "is-dragging-over" && current.closestEdge === closestEdge) {
258
- return current;
259
- }
260
- return {
193
+ var _effect = _useSignals4();
194
+ try {
195
+ const { isItem, dragPreview, setState: setRootState } = useListContext(LIST_ITEM_NAME);
196
+ const ref = useRef(null);
197
+ const dragHandleRef = useRef(null);
198
+ const [state, setState] = useState2(idle);
199
+ useEffect2(() => {
200
+ const element = ref.current;
201
+ invariant(element, void 0, {
202
+ F: __dxlog_file,
203
+ L: 91,
204
+ S: void 0,
205
+ A: [
206
+ "element",
207
+ ""
208
+ ]
209
+ });
210
+ return combine(
211
+ //
212
+ // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#draggable
213
+ //
214
+ draggable({
215
+ element,
216
+ dragHandle: dragHandleRef.current,
217
+ getInitialData: () => item,
218
+ onGenerateDragPreview: dragPreview ? ({ nativeSetDragImage, source }) => {
219
+ const rect = source.element.getBoundingClientRect();
220
+ setCustomNativeDragPreview({
221
+ nativeSetDragImage,
222
+ getOffset: ({ container }) => {
223
+ const { height } = container.getBoundingClientRect();
224
+ return {
225
+ x: 20,
226
+ y: height / 2
227
+ };
228
+ },
229
+ render: ({ container }) => {
230
+ container.style.width = rect.width + "px";
231
+ setState({
232
+ type: "preview",
233
+ container
234
+ });
235
+ setRootState({
236
+ type: "preview",
237
+ container,
238
+ item
239
+ });
240
+ return () => {
241
+ };
242
+ }
243
+ });
244
+ } : void 0,
245
+ onDragStart: () => {
246
+ setState({
247
+ type: "is-dragging"
248
+ });
249
+ setRootState({
250
+ type: "is-dragging",
251
+ item
252
+ });
253
+ },
254
+ onDrop: () => {
255
+ setState(idle);
256
+ setRootState(idle);
257
+ }
258
+ }),
259
+ //
260
+ // https://atlassian.design/components/pragmatic-drag-and-drop/core-package/adapters/element/about#drop-target-for-elements
261
+ //
262
+ dropTargetForElements({
263
+ element,
264
+ canDrop: ({ source }) => {
265
+ return (source.element !== element && isItem?.(source.data)) ?? false;
266
+ },
267
+ getData: ({ input }) => {
268
+ return attachClosestEdge(item, {
269
+ element,
270
+ input,
271
+ allowedEdges: [
272
+ "top",
273
+ "bottom"
274
+ ]
275
+ });
276
+ },
277
+ getIsSticky: () => true,
278
+ onDragEnter: ({ self }) => {
279
+ const closestEdge = extractClosestEdge2(self.data);
280
+ setState({
261
281
  type: "is-dragging-over",
262
282
  closestEdge
263
- };
264
- });
265
- },
266
- onDragLeave: () => {
267
- setState(idle);
268
- },
269
- onDrop: () => {
270
- setState(idle);
271
- }
272
- })
273
- );
274
- }, [
275
- item
276
- ]);
277
- return /* @__PURE__ */ React4.createElement(ListItemProvider, {
278
- item,
279
- dragHandleRef
280
- }, /* @__PURE__ */ React4.createElement("div", {
281
- role: "none",
282
- className: "relative"
283
- }, /* @__PURE__ */ React4.createElement("div", {
284
- ref,
285
- role: "listitem",
286
- className: mx3("flex overflow-hidden", classNames, stateStyles[state.type]),
287
- ...props
288
- }, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React4.createElement(NaturalListItem.DropIndicator, {
289
- edge: state.closestEdge
290
- })));
283
+ });
284
+ },
285
+ onDrag: ({ self }) => {
286
+ const closestEdge = extractClosestEdge2(self.data);
287
+ setState((current) => {
288
+ if (current.type === "is-dragging-over" && current.closestEdge === closestEdge) {
289
+ return current;
290
+ }
291
+ return {
292
+ type: "is-dragging-over",
293
+ closestEdge
294
+ };
295
+ });
296
+ },
297
+ onDragLeave: () => {
298
+ setState(idle);
299
+ },
300
+ onDrop: () => {
301
+ setState(idle);
302
+ }
303
+ })
304
+ );
305
+ }, [
306
+ item
307
+ ]);
308
+ return /* @__PURE__ */ React4.createElement(ListItemProvider, {
309
+ item,
310
+ dragHandleRef
311
+ }, /* @__PURE__ */ React4.createElement("div", {
312
+ role: "none",
313
+ className: "relative"
314
+ }, /* @__PURE__ */ React4.createElement("div", {
315
+ ref,
316
+ role: "listitem",
317
+ className: mx3("flex overflow-hidden", classNames, stateStyles[state.type]),
318
+ ...props
319
+ }, children), state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React4.createElement(NaturalListItem.DropIndicator, {
320
+ edge: state.closestEdge
321
+ })));
322
+ } finally {
323
+ _effect.f();
324
+ }
291
325
  };
292
326
  var IconButton = /* @__PURE__ */ forwardRef(({ classNames, icon, ...props }, forwardedRef) => {
293
- return /* @__PURE__ */ React4.createElement("button", {
294
- ref: forwardedRef,
295
- className: mx3("flex items-center justify-center", classNames),
296
- ...props
297
- }, /* @__PURE__ */ React4.createElement(Icon2, {
298
- icon,
299
- classNames: "cursor-pointer",
300
- size: 4
301
- }));
327
+ var _effect = _useSignals4();
328
+ try {
329
+ return /* @__PURE__ */ React4.createElement("button", {
330
+ ref: forwardedRef,
331
+ className: mx3("flex items-center justify-center", classNames),
332
+ ...props
333
+ }, /* @__PURE__ */ React4.createElement(Icon2, {
334
+ icon,
335
+ classNames: "cursor-pointer",
336
+ size: 4
337
+ }));
338
+ } finally {
339
+ _effect.f();
340
+ }
302
341
  });
303
342
  var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph--x--regular", ...props }) => {
304
- const { state } = useListContext("DELETE_BUTTON");
305
- const isDisabled = state.type !== "idle" || disabled;
306
- return /* @__PURE__ */ React4.createElement(IconButton, {
307
- icon,
308
- disabled: isDisabled,
309
- classNames: [
310
- classNames,
311
- autoHide && disabled && "hidden"
312
- ],
313
- ...props
314
- });
343
+ var _effect = _useSignals4();
344
+ try {
345
+ const { state } = useListContext("DELETE_BUTTON");
346
+ const isDisabled = state.type !== "idle" || disabled;
347
+ return /* @__PURE__ */ React4.createElement(IconButton, {
348
+ icon,
349
+ disabled: isDisabled,
350
+ classNames: [
351
+ classNames,
352
+ autoHide && disabled && "hidden"
353
+ ],
354
+ ...props
355
+ });
356
+ } finally {
357
+ _effect.f();
358
+ }
315
359
  };
316
360
  var ListItemButton = ({ autoHide = true, classNames, disabled, ...props }) => {
317
- const { state } = useListContext("ITEM_BUTTON");
318
- const isDisabled = state.type !== "idle" || disabled;
319
- return /* @__PURE__ */ React4.createElement(IconButton, {
320
- disabled: isDisabled,
321
- classNames: [
322
- classNames,
323
- autoHide && disabled && "hidden"
324
- ],
325
- ...props
326
- });
361
+ var _effect = _useSignals4();
362
+ try {
363
+ const { state } = useListContext("ITEM_BUTTON");
364
+ const isDisabled = state.type !== "idle" || disabled;
365
+ return /* @__PURE__ */ React4.createElement(IconButton, {
366
+ disabled: isDisabled,
367
+ classNames: [
368
+ classNames,
369
+ autoHide && disabled && "hidden"
370
+ ],
371
+ ...props
372
+ });
373
+ } finally {
374
+ _effect.f();
375
+ }
327
376
  };
328
377
  var ListItemDragHandle = () => {
329
- const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
330
- return /* @__PURE__ */ React4.createElement(IconButton, {
331
- ref: dragHandleRef,
332
- icon: "ph--dots-six-vertical--regular"
333
- });
378
+ var _effect = _useSignals4();
379
+ try {
380
+ const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
381
+ return /* @__PURE__ */ React4.createElement(IconButton, {
382
+ ref: dragHandleRef,
383
+ icon: "ph--dots-six-vertical--regular"
384
+ });
385
+ } finally {
386
+ _effect.f();
387
+ }
334
388
  };
335
389
  var ListItemDragPreview = ({ children }) => {
336
390
  const { state } = useListContext("DRAG_PREVIEW");
@@ -338,13 +392,27 @@ var ListItemDragPreview = ({ children }) => {
338
392
  item: state.item
339
393
  }), state.container) : null;
340
394
  };
341
- var ListItemWrapper = ({ classNames, children }) => /* @__PURE__ */ React4.createElement("div", {
342
- className: mx3("flex is-full gap-2", classNames)
343
- }, children);
344
- var ListItemTitle = ({ classNames, children, ...props }) => /* @__PURE__ */ React4.createElement("div", {
345
- className: mx3("flex grow items-center truncate", classNames),
346
- ...props
347
- }, children);
395
+ var ListItemWrapper = ({ classNames, children }) => {
396
+ var _effect = _useSignals4();
397
+ try {
398
+ return /* @__PURE__ */ React4.createElement("div", {
399
+ className: mx3("flex is-full gap-2", classNames)
400
+ }, children);
401
+ } finally {
402
+ _effect.f();
403
+ }
404
+ };
405
+ var ListItemTitle = ({ classNames, children, ...props }) => {
406
+ var _effect = _useSignals4();
407
+ try {
408
+ return /* @__PURE__ */ React4.createElement("div", {
409
+ className: mx3("flex grow items-center truncate", classNames),
410
+ ...props
411
+ }, children);
412
+ } finally {
413
+ _effect.f();
414
+ }
415
+ };
348
416
 
349
417
  // packages/ui/react-ui-list/src/components/List/List.tsx
350
418
  var List = {
@@ -360,6 +428,7 @@ var List = {
360
428
  };
361
429
 
362
430
  // packages/ui/react-ui-list/src/components/Tree/Tree.tsx
431
+ import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
363
432
  import React8, { useMemo as useMemo2 } from "react";
364
433
  import { Treegrid as Treegrid2 } from "@dxos/react-ui";
365
434
 
@@ -371,6 +440,7 @@ var useTree = () => useContext(TreeContext) ?? raise(new Error("TreeContext not
371
440
  var TreeProvider = TreeContext.Provider;
372
441
 
373
442
  // packages/ui/react-ui-list/src/components/Tree/TreeItem.tsx
443
+ import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
374
444
  import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
375
445
  import { draggable as draggable2, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
376
446
  import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
@@ -381,72 +451,84 @@ import { Treegrid, TreeItem as NaturalTreeItem } from "@dxos/react-ui";
381
451
  import { ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, mx as mx6 } from "@dxos/react-ui-theme";
382
452
 
383
453
  // packages/ui/react-ui-list/src/components/Tree/TreeItemHeading.tsx
454
+ import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
384
455
  import React5, { forwardRef as forwardRef2, memo, useCallback as useCallback2 } from "react";
385
456
  import { Button, Icon as Icon3, toLocalizedString, useTranslation } from "@dxos/react-ui";
386
457
  import { TextTooltip } from "@dxos/react-ui-text-tooltip";
387
458
  import { mx as mx4 } from "@dxos/react-ui-theme";
388
459
  var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ label, icon, className, disabled, current, onSelect }, forwardedRef) => {
389
- const { t } = useTranslation();
390
- const handleSelect = useCallback2((event) => {
391
- onSelect?.(event.altKey);
392
- }, [
393
- onSelect
394
- ]);
395
- const handleButtonKeydown = useCallback2((event) => {
396
- if (event.key === " " || event.key === "Enter") {
397
- event.preventDefault();
398
- event.stopPropagation();
460
+ var _effect = _useSignals5();
461
+ try {
462
+ const { t } = useTranslation();
463
+ const handleSelect = useCallback2((event) => {
399
464
  onSelect?.(event.altKey);
400
- }
401
- }, [
402
- onSelect
403
- ]);
404
- return /* @__PURE__ */ React5.createElement(TextTooltip, {
405
- text: toLocalizedString(label, t),
406
- side: "bottom",
407
- truncateQuery: "span[data-tooltip]",
408
- onlyWhenTruncating: true,
409
- asChild: true,
410
- ref: forwardedRef
411
- }, /* @__PURE__ */ React5.createElement(Button, {
412
- "data-testid": "treeItem.heading",
413
- variant: "ghost",
414
- density: "fine",
415
- classNames: mx4("grow gap-2 pis-0.5 hover:bg-transparent dark:hover:bg-transparent", "disabled:cursor-default disabled:opacity-100", className),
416
- disabled,
417
- onClick: handleSelect,
418
- onKeyDown: handleButtonKeydown,
419
- ...current && {
420
- "aria-current": "location"
421
- }
422
- }, icon && /* @__PURE__ */ React5.createElement(Icon3, {
423
- icon: icon ?? "ph--placeholder--regular",
424
- size: 5,
425
- classNames: "mlb-1"
426
- }), /* @__PURE__ */ React5.createElement("span", {
427
- className: "flex-1 is-0 truncate text-start text-sm font-normal",
428
- "data-tooltip": true
429
- }, toLocalizedString(label, t))));
465
+ }, [
466
+ onSelect
467
+ ]);
468
+ const handleButtonKeydown = useCallback2((event) => {
469
+ if (event.key === " " || event.key === "Enter") {
470
+ event.preventDefault();
471
+ event.stopPropagation();
472
+ onSelect?.(event.altKey);
473
+ }
474
+ }, [
475
+ onSelect
476
+ ]);
477
+ return /* @__PURE__ */ React5.createElement(TextTooltip, {
478
+ text: toLocalizedString(label, t),
479
+ side: "bottom",
480
+ truncateQuery: "span[data-tooltip]",
481
+ onlyWhenTruncating: true,
482
+ asChild: true,
483
+ ref: forwardedRef
484
+ }, /* @__PURE__ */ React5.createElement(Button, {
485
+ "data-testid": "treeItem.heading",
486
+ variant: "ghost",
487
+ density: "fine",
488
+ classNames: mx4("grow gap-2 pis-0.5 hover:bg-transparent dark:hover:bg-transparent", "disabled:cursor-default disabled:opacity-100", className),
489
+ disabled,
490
+ onClick: handleSelect,
491
+ onKeyDown: handleButtonKeydown,
492
+ ...current && {
493
+ "aria-current": "location"
494
+ }
495
+ }, icon && /* @__PURE__ */ React5.createElement(Icon3, {
496
+ icon: icon ?? "ph--placeholder--regular",
497
+ size: 5,
498
+ classNames: "mlb-1"
499
+ }), /* @__PURE__ */ React5.createElement("span", {
500
+ className: "flex-1 is-0 truncate text-start text-sm font-normal",
501
+ "data-tooltip": true
502
+ }, toLocalizedString(label, t))));
503
+ } finally {
504
+ _effect.f();
505
+ }
430
506
  }));
431
507
 
432
508
  // packages/ui/react-ui-list/src/components/Tree/TreeItemToggle.tsx
509
+ import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
433
510
  import React6, { forwardRef as forwardRef3, memo as memo2 } from "react";
434
511
  import { Button as Button2, Icon as Icon4 } from "@dxos/react-ui";
435
512
  import { mx as mx5 } from "@dxos/react-ui-theme";
436
513
  var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef3(({ open, isBranch, hidden, onToggle }, forwardedRef) => {
437
- return /* @__PURE__ */ React6.createElement(Button2, {
438
- ref: forwardedRef,
439
- "data-testid": "treeItem.toggle",
440
- "aria-expanded": open,
441
- variant: "ghost",
442
- density: "fine",
443
- classNames: mx5("is-6 pli-0 dx-focus-ring-inset", hidden ? "hidden" : !isBranch && "invisible"),
444
- onClick: onToggle
445
- }, /* @__PURE__ */ React6.createElement(Icon4, {
446
- icon: "ph--caret-right--bold",
447
- size: 3,
448
- classNames: mx5("transition duration-200", open && "rotate-90")
449
- }));
514
+ var _effect = _useSignals6();
515
+ try {
516
+ return /* @__PURE__ */ React6.createElement(Button2, {
517
+ ref: forwardedRef,
518
+ "data-testid": "treeItem.toggle",
519
+ "aria-expanded": open,
520
+ variant: "ghost",
521
+ density: "fine",
522
+ classNames: mx5("is-6 pli-0 dx-focus-ring-inset", hidden ? "hidden" : !isBranch && "invisible"),
523
+ onClick: onToggle
524
+ }, /* @__PURE__ */ React6.createElement(Icon4, {
525
+ icon: "ph--caret-right--bold",
526
+ size: 3,
527
+ classNames: mx5("transition duration-200", open && "rotate-90")
528
+ }));
529
+ } finally {
530
+ _effect.f();
531
+ }
450
532
  }));
451
533
 
452
534
  // packages/ui/react-ui-list/src/components/Tree/helpers.ts
@@ -465,290 +547,300 @@ var TreeDataSchema = Schema.Struct({
465
547
  });
466
548
  var isTreeData = (data) => Schema.is(TreeDataSchema)(data);
467
549
  var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColumns: Columns, canDrop, onOpenChange, onSelect, levelOffset = 2 }) => {
468
- const rowRef = useRef2(null);
469
- const buttonRef = useRef2(null);
470
- const openRef = useRef2(false);
471
- const cancelExpandRef = useRef2(null);
472
- const [_state, setState] = useState3("idle");
473
- const [instruction, setInstruction] = useState3(null);
474
- const [menuOpen, setMenuOpen] = useState3(false);
475
- const { useItems, getProps, isOpen, isCurrent } = useTree();
476
- const items = useItems(item);
477
- const { id, label, parentOf, icon, disabled, className, headingClassName, testId } = getProps(item, _path);
478
- const path = useMemo(() => [
479
- ..._path,
480
- id
481
- ], [
482
- _path,
483
- id
484
- ]);
485
- const open = isOpen(path, item);
486
- const current = isCurrent(path, item);
487
- const level = path.length - levelOffset;
488
- const isBranch = !!parentOf;
489
- const mode = last ? "last-in-group" : open ? "expanded" : "standard";
490
- const cancelExpand = useCallback3(() => {
491
- if (cancelExpandRef.current) {
492
- clearTimeout(cancelExpandRef.current);
493
- cancelExpandRef.current = null;
494
- }
495
- }, []);
496
- useEffect3(() => {
497
- if (!_draggable) {
498
- return;
499
- }
500
- invariant2(buttonRef.current, void 0, {
501
- F: __dxlog_file2,
502
- L: 106,
503
- S: void 0,
504
- A: [
505
- "buttonRef.current",
506
- ""
507
- ]
508
- });
509
- const data = {
510
- id,
511
- path,
512
- item
513
- };
514
- return combine2(
515
- draggable2({
516
- element: buttonRef.current,
517
- getInitialData: () => data,
518
- onDragStart: () => {
519
- setState("dragging");
520
- if (open) {
521
- openRef.current = true;
522
- onOpenChange?.({
523
- item,
524
- path,
525
- open: false
526
- });
550
+ var _effect = _useSignals7();
551
+ try {
552
+ const rowRef = useRef2(null);
553
+ const buttonRef = useRef2(null);
554
+ const openRef = useRef2(false);
555
+ const cancelExpandRef = useRef2(null);
556
+ const [_state, setState] = useState3("idle");
557
+ const [instruction, setInstruction] = useState3(null);
558
+ const [menuOpen, setMenuOpen] = useState3(false);
559
+ const { useItems, getProps, isOpen, isCurrent } = useTree();
560
+ const items = useItems(item);
561
+ const { id, label, parentOf, icon, disabled, className, headingClassName, testId } = getProps(item, _path);
562
+ const path = useMemo(() => [
563
+ ..._path,
564
+ id
565
+ ], [
566
+ _path,
567
+ id
568
+ ]);
569
+ const open = isOpen(path, item);
570
+ const current = isCurrent(path, item);
571
+ const level = path.length - levelOffset;
572
+ const isBranch = !!parentOf;
573
+ const mode = last ? "last-in-group" : open ? "expanded" : "standard";
574
+ const cancelExpand = useCallback3(() => {
575
+ if (cancelExpandRef.current) {
576
+ clearTimeout(cancelExpandRef.current);
577
+ cancelExpandRef.current = null;
578
+ }
579
+ }, []);
580
+ useEffect3(() => {
581
+ if (!_draggable) {
582
+ return;
583
+ }
584
+ invariant2(buttonRef.current, void 0, {
585
+ F: __dxlog_file2,
586
+ L: 106,
587
+ S: void 0,
588
+ A: [
589
+ "buttonRef.current",
590
+ ""
591
+ ]
592
+ });
593
+ const data = {
594
+ id,
595
+ path,
596
+ item
597
+ };
598
+ return combine2(
599
+ draggable2({
600
+ element: buttonRef.current,
601
+ getInitialData: () => data,
602
+ onDragStart: () => {
603
+ setState("dragging");
604
+ if (open) {
605
+ openRef.current = true;
606
+ onOpenChange?.({
607
+ item,
608
+ path,
609
+ open: false
610
+ });
611
+ }
612
+ },
613
+ onDrop: () => {
614
+ setState("idle");
615
+ if (openRef.current) {
616
+ onOpenChange?.({
617
+ item,
618
+ path,
619
+ open: true
620
+ });
621
+ }
527
622
  }
528
- },
529
- onDrop: () => {
530
- setState("idle");
531
- if (openRef.current) {
532
- onOpenChange?.({
533
- item,
534
- path,
535
- open: true
623
+ }),
624
+ // https://github.com/atlassian/pragmatic-drag-and-drop/blob/main/packages/hitbox/constellation/index/about.mdx
625
+ dropTargetForElements2({
626
+ element: buttonRef.current,
627
+ getData: ({ input, element }) => {
628
+ return attachInstruction(data, {
629
+ input,
630
+ element,
631
+ indentPerLevel: DEFAULT_INDENTATION,
632
+ currentLevel: level,
633
+ mode,
634
+ block: isBranch ? [] : [
635
+ "make-child"
636
+ ]
536
637
  });
537
- }
538
- }
539
- }),
540
- // https://github.com/atlassian/pragmatic-drag-and-drop/blob/main/packages/hitbox/constellation/index/about.mdx
541
- dropTargetForElements2({
542
- element: buttonRef.current,
543
- getData: ({ input, element }) => {
544
- return attachInstruction(data, {
545
- input,
546
- element,
547
- indentPerLevel: DEFAULT_INDENTATION,
548
- currentLevel: level,
549
- mode,
550
- block: isBranch ? [] : [
551
- "make-child"
552
- ]
553
- });
554
- },
555
- canDrop: ({ source }) => {
556
- const _canDrop = canDrop ?? (() => true);
557
- return source.element !== buttonRef.current && _canDrop(source.data, data);
558
- },
559
- getIsSticky: () => true,
560
- onDrag: ({ self, source }) => {
561
- const instruction2 = extractInstruction(self.data);
562
- if (source.data.id !== id) {
563
- if (instruction2?.type === "make-child" && isBranch && !open && !cancelExpandRef.current) {
564
- cancelExpandRef.current = setTimeout(() => {
565
- onOpenChange?.({
566
- item,
567
- path,
568
- open: true
569
- });
570
- }, 500);
638
+ },
639
+ canDrop: ({ source }) => {
640
+ const _canDrop = canDrop ?? (() => true);
641
+ return source.element !== buttonRef.current && _canDrop(source.data, data);
642
+ },
643
+ getIsSticky: () => true,
644
+ onDrag: ({ self, source }) => {
645
+ const instruction2 = extractInstruction(self.data);
646
+ if (source.data.id !== id) {
647
+ if (instruction2?.type === "make-child" && isBranch && !open && !cancelExpandRef.current) {
648
+ cancelExpandRef.current = setTimeout(() => {
649
+ onOpenChange?.({
650
+ item,
651
+ path,
652
+ open: true
653
+ });
654
+ }, 500);
655
+ }
656
+ if (instruction2?.type !== "make-child") {
657
+ cancelExpand();
658
+ }
659
+ setInstruction(instruction2);
660
+ } else if (instruction2?.type === "reparent") {
661
+ setInstruction(instruction2);
662
+ } else {
663
+ setInstruction(null);
571
664
  }
572
- if (instruction2?.type !== "make-child") {
573
- cancelExpand();
574
- }
575
- setInstruction(instruction2);
576
- } else if (instruction2?.type === "reparent") {
577
- setInstruction(instruction2);
578
- } else {
665
+ },
666
+ onDragLeave: () => {
667
+ cancelExpand();
668
+ setInstruction(null);
669
+ },
670
+ onDrop: () => {
671
+ cancelExpand();
579
672
  setInstruction(null);
580
673
  }
581
- },
582
- onDragLeave: () => {
583
- cancelExpand();
584
- setInstruction(null);
585
- },
586
- onDrop: () => {
587
- cancelExpand();
588
- setInstruction(null);
589
- }
590
- })
591
- );
592
- }, [
593
- _draggable,
594
- item,
595
- id,
596
- mode,
597
- path,
598
- open,
599
- canDrop
600
- ]);
601
- useEffect3(() => () => cancelExpand(), [
602
- cancelExpand
603
- ]);
604
- const handleOpenChange = useCallback3(() => onOpenChange?.({
605
- item,
606
- path,
607
- open: !open
608
- }), [
609
- onOpenChange,
610
- item,
611
- path,
612
- open
613
- ]);
614
- const handleSelect = useCallback3((option = false) => {
615
- if (isBranch) {
616
- handleOpenChange();
617
- } else {
618
- rowRef.current?.focus();
619
- onSelect?.({
620
- item,
621
- path,
622
- current: !current,
623
- option
624
- });
625
- }
626
- }, [
627
- item,
628
- path,
629
- current,
630
- isBranch,
631
- handleOpenChange,
632
- onSelect
633
- ]);
634
- const handleKeyDown = useCallback3((event) => {
635
- switch (event.key) {
636
- case "ArrowRight":
637
- isBranch && !open && handleOpenChange();
638
- break;
639
- case "ArrowLeft":
640
- isBranch && open && handleOpenChange();
641
- break;
642
- case " ":
643
- handleSelect(event.altKey);
644
- break;
645
- }
646
- }, [
647
- isBranch,
648
- open,
649
- handleOpenChange,
650
- handleSelect
651
- ]);
652
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Treegrid.Row, {
653
- ref: rowRef,
654
- key: id,
655
- id,
656
- "aria-labelledby": `${id}__label`,
657
- parentOf: parentOf?.join(Treegrid.PARENT_OF_SEPARATOR),
658
- classNames: mx6("grid grid-cols-subgrid col-[tree-row] mbs-0.5 aria-[current]:bg-groupSurface", hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, hoverableDescriptionIcons, ghostHover, className),
659
- "data-itemid": id,
660
- "data-testid": testId,
661
- // NOTE(thure): This is intentionally an empty string to for descendents to select by in the CSS
662
- // without alerting the user (except for in the correct link element). See also:
663
- // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current#description
664
- "aria-current": current ? "" : void 0,
665
- onKeyDown: handleKeyDown,
666
- onContextMenu: (event) => {
667
- event.preventDefault();
668
- setMenuOpen(true);
669
- }
670
- }, /* @__PURE__ */ React7.createElement(Treegrid.Cell, {
671
- indent: true,
672
- classNames: "relative grid grid-cols-subgrid col-[tree-row]",
673
- style: paddingIndentation(level)
674
- }, /* @__PURE__ */ React7.createElement("div", {
675
- role: "none",
676
- className: "flex items-center"
677
- }, /* @__PURE__ */ React7.createElement(TreeItemToggle, {
678
- isBranch,
679
- open,
680
- onToggle: handleOpenChange
681
- }), /* @__PURE__ */ React7.createElement(TreeItemHeading, {
682
- ref: buttonRef,
683
- label,
684
- icon,
685
- className: headingClassName,
686
- disabled,
687
- current,
688
- onSelect: handleSelect
689
- })), Columns && /* @__PURE__ */ React7.createElement(Columns, {
690
- item,
691
- path,
692
- open,
693
- menuOpen,
694
- setMenuOpen
695
- }), instruction && /* @__PURE__ */ React7.createElement(NaturalTreeItem.DropIndicator, {
696
- instruction,
697
- gap: 2
698
- }))), open && items.map((item2, index) => /* @__PURE__ */ React7.createElement(TreeItem, {
699
- key: item2.id,
700
- item: item2,
701
- path,
702
- last: index === items.length - 1,
703
- draggable: _draggable,
704
- renderColumns: Columns,
705
- canDrop,
706
- onOpenChange,
707
- onSelect
708
- })));
674
+ })
675
+ );
676
+ }, [
677
+ _draggable,
678
+ item,
679
+ id,
680
+ mode,
681
+ path,
682
+ open,
683
+ canDrop
684
+ ]);
685
+ useEffect3(() => () => cancelExpand(), [
686
+ cancelExpand
687
+ ]);
688
+ const handleOpenChange = useCallback3(() => onOpenChange?.({
689
+ item,
690
+ path,
691
+ open: !open
692
+ }), [
693
+ onOpenChange,
694
+ item,
695
+ path,
696
+ open
697
+ ]);
698
+ const handleSelect = useCallback3((option = false) => {
699
+ if (isBranch) {
700
+ handleOpenChange();
701
+ } else {
702
+ rowRef.current?.focus();
703
+ onSelect?.({
704
+ item,
705
+ path,
706
+ current: !current,
707
+ option
708
+ });
709
+ }
710
+ }, [
711
+ item,
712
+ path,
713
+ current,
714
+ isBranch,
715
+ handleOpenChange,
716
+ onSelect
717
+ ]);
718
+ const handleKeyDown = useCallback3((event) => {
719
+ switch (event.key) {
720
+ case "ArrowRight":
721
+ isBranch && !open && handleOpenChange();
722
+ break;
723
+ case "ArrowLeft":
724
+ isBranch && open && handleOpenChange();
725
+ break;
726
+ case " ":
727
+ handleSelect(event.altKey);
728
+ break;
729
+ }
730
+ }, [
731
+ isBranch,
732
+ open,
733
+ handleOpenChange,
734
+ handleSelect
735
+ ]);
736
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Treegrid.Row, {
737
+ ref: rowRef,
738
+ key: id,
739
+ id,
740
+ "aria-labelledby": `${id}__label`,
741
+ parentOf: parentOf?.join(Treegrid.PARENT_OF_SEPARATOR),
742
+ classNames: mx6("grid grid-cols-subgrid col-[tree-row] mbs-0.5 aria-[current]:bg-activeSurface", hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls, hoverableDescriptionIcons, ghostHover, className),
743
+ "data-itemid": id,
744
+ "data-testid": testId,
745
+ // NOTE(thure): This is intentionally an empty string to for descendents to select by in the CSS
746
+ // without alerting the user (except for in the correct link element). See also:
747
+ // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current#description
748
+ "aria-current": current ? "" : void 0,
749
+ onKeyDown: handleKeyDown,
750
+ onContextMenu: (event) => {
751
+ event.preventDefault();
752
+ setMenuOpen(true);
753
+ }
754
+ }, /* @__PURE__ */ React7.createElement(Treegrid.Cell, {
755
+ indent: true,
756
+ classNames: "relative grid grid-cols-subgrid col-[tree-row]",
757
+ style: paddingIndentation(level)
758
+ }, /* @__PURE__ */ React7.createElement("div", {
759
+ role: "none",
760
+ className: "flex items-center"
761
+ }, /* @__PURE__ */ React7.createElement(TreeItemToggle, {
762
+ isBranch,
763
+ open,
764
+ onToggle: handleOpenChange
765
+ }), /* @__PURE__ */ React7.createElement(TreeItemHeading, {
766
+ ref: buttonRef,
767
+ label,
768
+ icon,
769
+ className: headingClassName,
770
+ disabled,
771
+ current,
772
+ onSelect: handleSelect
773
+ })), Columns && /* @__PURE__ */ React7.createElement(Columns, {
774
+ item,
775
+ path,
776
+ open,
777
+ menuOpen,
778
+ setMenuOpen
779
+ }), instruction && /* @__PURE__ */ React7.createElement(NaturalTreeItem.DropIndicator, {
780
+ instruction,
781
+ gap: 2
782
+ }))), open && items.map((item2, index) => /* @__PURE__ */ React7.createElement(TreeItem, {
783
+ key: item2.id,
784
+ item: item2,
785
+ path,
786
+ last: index === items.length - 1,
787
+ draggable: _draggable,
788
+ renderColumns: Columns,
789
+ canDrop,
790
+ onOpenChange,
791
+ onSelect
792
+ })));
793
+ } finally {
794
+ _effect.f();
795
+ }
709
796
  };
710
797
  var TreeItem = /* @__PURE__ */ memo3(RawTreeItem);
711
798
 
712
799
  // packages/ui/react-ui-list/src/components/Tree/Tree.tsx
713
800
  var Tree = ({ root, path, id, useItems, getProps, isOpen, isCurrent, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] 1fr min-content [tree-row-end]", classNames, renderColumns, canDrop, onOpenChange, onSelect, levelOffset }) => {
714
- const context = useMemo2(() => ({
715
- useItems,
716
- getProps,
717
- isOpen,
718
- isCurrent
719
- }), [
720
- useItems,
721
- getProps,
722
- isOpen,
723
- isCurrent
724
- ]);
725
- const items = useItems(root);
726
- const treePath = useMemo2(() => path ? [
727
- ...path,
728
- id
729
- ] : [
730
- id
731
- ], [
732
- id,
733
- path
734
- ]);
735
- return /* @__PURE__ */ React8.createElement(Treegrid2.Root, {
736
- gridTemplateColumns,
737
- classNames
738
- }, /* @__PURE__ */ React8.createElement(TreeProvider, {
739
- value: context
740
- }, items.map((item, index) => /* @__PURE__ */ React8.createElement(TreeItem, {
741
- key: item.id,
742
- item,
743
- last: index === items.length - 1,
744
- path: treePath,
745
- levelOffset,
746
- draggable: draggable3,
747
- renderColumns,
748
- canDrop,
749
- onOpenChange,
750
- onSelect
751
- }))));
801
+ var _effect = _useSignals8();
802
+ try {
803
+ const context = useMemo2(() => ({
804
+ useItems,
805
+ getProps,
806
+ isOpen,
807
+ isCurrent
808
+ }), [
809
+ useItems,
810
+ getProps,
811
+ isOpen,
812
+ isCurrent
813
+ ]);
814
+ const items = useItems(root);
815
+ const treePath = useMemo2(() => path ? [
816
+ ...path,
817
+ id
818
+ ] : [
819
+ id
820
+ ], [
821
+ id,
822
+ path
823
+ ]);
824
+ return /* @__PURE__ */ React8.createElement(Treegrid2.Root, {
825
+ gridTemplateColumns,
826
+ classNames
827
+ }, /* @__PURE__ */ React8.createElement(TreeProvider, {
828
+ value: context
829
+ }, items.map((item, index) => /* @__PURE__ */ React8.createElement(TreeItem, {
830
+ key: item.id,
831
+ item,
832
+ last: index === items.length - 1,
833
+ path: treePath,
834
+ levelOffset,
835
+ draggable: draggable3,
836
+ renderColumns,
837
+ canDrop,
838
+ onOpenChange,
839
+ onSelect
840
+ }))));
841
+ } finally {
842
+ _effect.f();
843
+ }
752
844
  };
753
845
 
754
846
  // packages/ui/react-ui-list/src/util/path.ts