@dxos/react-ui-list 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
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.
- package/dist/lib/browser/index.mjs +109 -89
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +109 -89
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Accordion/Accordion.stories.d.ts +7 -4
- package/dist/types/src/components/Accordion/Accordion.stories.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +6 -6
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +14 -5
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListItem.d.ts +4 -7
- package/dist/types/src/components/List/ListItem.d.ts.map +1 -1
- package/dist/types/src/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/src/components/List/testing.d.ts +1 -1
- package/dist/types/src/components/List/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts +3 -3
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +36 -6
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeContext.d.ts +3 -2
- package/dist/types/src/components/Tree/TreeContext.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItem.d.ts +14 -9
- package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts +4 -3
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItemToggle.d.ts +3 -3
- package/dist/types/src/components/Tree/TreeItemToggle.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing.d.ts +2 -2
- package/dist/types/src/components/Tree/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -24
- package/src/components/Accordion/Accordion.stories.tsx +5 -7
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/Accordion/AccordionItem.tsx +5 -2
- package/src/components/List/List.stories.tsx +16 -14
- package/src/components/List/List.tsx +2 -5
- package/src/components/List/ListItem.tsx +39 -27
- package/src/components/List/ListRoot.tsx +1 -1
- package/src/components/List/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +51 -48
- package/src/components/Tree/Tree.tsx +7 -2
- package/src/components/Tree/TreeContext.tsx +3 -2
- package/src/components/Tree/TreeItem.tsx +51 -45
- package/src/components/Tree/TreeItemHeading.tsx +11 -9
- package/src/components/Tree/TreeItemToggle.tsx +29 -19
- package/src/components/Tree/testing.ts +2 -2
|
@@ -38,7 +38,7 @@ var AccordionRoot = ({ classNames, items, getId = defaultGetId, children, value,
|
|
|
38
38
|
|
|
39
39
|
// src/components/Accordion/AccordionItem.tsx
|
|
40
40
|
var ACCORDION_ITEM_NAME = "AccordionItem";
|
|
41
|
-
var [AccordionItemProvider,
|
|
41
|
+
var [AccordionItemProvider, useDxAccordionItemContext] = createContext2(ACCORDION_ITEM_NAME);
|
|
42
42
|
var AccordionItem = ({ children, classNames, item }) => {
|
|
43
43
|
var _effect = _useSignals2();
|
|
44
44
|
try {
|
|
@@ -99,10 +99,10 @@ import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-d
|
|
|
99
99
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
100
100
|
import { attachClosestEdge, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
101
101
|
import { createContext as createContext4 } from "@radix-ui/react-context";
|
|
102
|
-
import React4, {
|
|
102
|
+
import React4, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
103
103
|
import { createPortal } from "react-dom";
|
|
104
104
|
import { invariant } from "@dxos/invariant";
|
|
105
|
-
import {
|
|
105
|
+
import { IconButton, ListItem as NaturalListItem, useTranslation } from "@dxos/react-ui";
|
|
106
106
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
107
107
|
|
|
108
108
|
// src/components/List/ListRoot.tsx
|
|
@@ -202,7 +202,7 @@ var ListItem = ({ children, classNames, item, ...props }) => {
|
|
|
202
202
|
const element = ref.current;
|
|
203
203
|
invariant(element, void 0, {
|
|
204
204
|
F: __dxlog_file,
|
|
205
|
-
L:
|
|
205
|
+
L: 98,
|
|
206
206
|
S: void 0,
|
|
207
207
|
A: [
|
|
208
208
|
"element",
|
|
@@ -311,67 +311,54 @@ var ListItem = ({ children, classNames, item, ...props }) => {
|
|
|
311
311
|
return /* @__PURE__ */ React4.createElement(ListItemProvider, {
|
|
312
312
|
item,
|
|
313
313
|
dragHandleRef
|
|
314
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
315
|
-
role: "none",
|
|
316
|
-
className: "relative"
|
|
317
314
|
}, /* @__PURE__ */ React4.createElement("div", {
|
|
318
315
|
ref,
|
|
319
316
|
role: "listitem",
|
|
320
|
-
className: mx3("flex
|
|
317
|
+
className: mx3("flex relative", classNames, stateStyles[state.type]),
|
|
321
318
|
...props
|
|
322
|
-
}, children
|
|
319
|
+
}, children, state.type === "is-dragging-over" && state.closestEdge && /* @__PURE__ */ React4.createElement(NaturalListItem.DropIndicator, {
|
|
323
320
|
edge: state.closestEdge
|
|
324
321
|
})));
|
|
325
322
|
} finally {
|
|
326
323
|
_effect.f();
|
|
327
324
|
}
|
|
328
325
|
};
|
|
329
|
-
var
|
|
330
|
-
var _effect = _useSignals4();
|
|
331
|
-
try {
|
|
332
|
-
return /* @__PURE__ */ React4.createElement("button", {
|
|
333
|
-
ref: forwardedRef,
|
|
334
|
-
className: mx3("flex items-center justify-center", classNames),
|
|
335
|
-
...props
|
|
336
|
-
}, /* @__PURE__ */ React4.createElement(Icon2, {
|
|
337
|
-
icon,
|
|
338
|
-
classNames: "cursor-pointer",
|
|
339
|
-
size: 4
|
|
340
|
-
}));
|
|
341
|
-
} finally {
|
|
342
|
-
_effect.f();
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph--x--regular", ...props }) => {
|
|
326
|
+
var ListItemDeleteButton = ({ autoHide = true, classNames, disabled, icon = "ph--x--regular", label, ...props }) => {
|
|
346
327
|
var _effect = _useSignals4();
|
|
347
328
|
try {
|
|
348
329
|
const { state } = useListContext("DELETE_BUTTON");
|
|
349
330
|
const isDisabled = state.type !== "idle" || disabled;
|
|
331
|
+
const { t } = useTranslation("os");
|
|
350
332
|
return /* @__PURE__ */ React4.createElement(IconButton, {
|
|
333
|
+
iconOnly: true,
|
|
334
|
+
variant: "ghost",
|
|
335
|
+
...props,
|
|
351
336
|
icon,
|
|
352
337
|
disabled: isDisabled,
|
|
338
|
+
label: label ?? t("delete label"),
|
|
353
339
|
classNames: [
|
|
354
340
|
classNames,
|
|
355
341
|
autoHide && disabled && "hidden"
|
|
356
|
-
]
|
|
357
|
-
...props
|
|
342
|
+
]
|
|
358
343
|
});
|
|
359
344
|
} finally {
|
|
360
345
|
_effect.f();
|
|
361
346
|
}
|
|
362
347
|
};
|
|
363
|
-
var ListItemButton = ({ autoHide = true, classNames, disabled, ...props }) => {
|
|
348
|
+
var ListItemButton = ({ autoHide = true, iconOnly = true, variant = "ghost", classNames, disabled, ...props }) => {
|
|
364
349
|
var _effect = _useSignals4();
|
|
365
350
|
try {
|
|
366
351
|
const { state } = useListContext("ITEM_BUTTON");
|
|
367
352
|
const isDisabled = state.type !== "idle" || disabled;
|
|
368
353
|
return /* @__PURE__ */ React4.createElement(IconButton, {
|
|
354
|
+
...props,
|
|
369
355
|
disabled: isDisabled,
|
|
356
|
+
iconOnly,
|
|
357
|
+
variant,
|
|
370
358
|
classNames: [
|
|
371
359
|
classNames,
|
|
372
360
|
autoHide && disabled && "hidden"
|
|
373
|
-
]
|
|
374
|
-
...props
|
|
361
|
+
]
|
|
375
362
|
});
|
|
376
363
|
} finally {
|
|
377
364
|
_effect.f();
|
|
@@ -381,7 +368,11 @@ var ListItemDragHandle = ({ disabled }) => {
|
|
|
381
368
|
var _effect = _useSignals4();
|
|
382
369
|
try {
|
|
383
370
|
const { dragHandleRef } = useListItemContext("DRAG_HANDLE");
|
|
371
|
+
const { t } = useTranslation("os");
|
|
384
372
|
return /* @__PURE__ */ React4.createElement(IconButton, {
|
|
373
|
+
iconOnly: true,
|
|
374
|
+
variant: "ghost",
|
|
375
|
+
label: t("drag handle label"),
|
|
385
376
|
ref: dragHandleRef,
|
|
386
377
|
icon: "ph--dots-six-vertical--regular",
|
|
387
378
|
disabled
|
|
@@ -427,8 +418,7 @@ var List = {
|
|
|
427
418
|
ItemDragHandle: ListItemDragHandle,
|
|
428
419
|
ItemDeleteButton: ListItemDeleteButton,
|
|
429
420
|
ItemButton: ListItemButton,
|
|
430
|
-
ItemTitle: ListItemTitle
|
|
431
|
-
IconButton
|
|
421
|
+
ItemTitle: ListItemTitle
|
|
432
422
|
};
|
|
433
423
|
|
|
434
424
|
// src/components/Tree/Tree.tsx
|
|
@@ -448,22 +438,29 @@ import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking"
|
|
|
448
438
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
449
439
|
import { draggable as draggable2, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
450
440
|
import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
451
|
-
import
|
|
441
|
+
import * as Schema from "effect/Schema";
|
|
452
442
|
import React7, { memo as memo3, useCallback as useCallback3, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
453
443
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
454
|
-
import {
|
|
455
|
-
import { ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls
|
|
444
|
+
import { TreeItem as NaturalTreeItem, Treegrid } from "@dxos/react-ui";
|
|
445
|
+
import { ghostFocusWithin, ghostHover, hoverableControls, hoverableFocusedKeyboardControls, hoverableFocusedWithinControls } from "@dxos/react-ui-theme";
|
|
446
|
+
|
|
447
|
+
// src/components/Tree/helpers.ts
|
|
448
|
+
var DEFAULT_INDENTATION = 8;
|
|
449
|
+
var paddingIndentation = (level, indentation = DEFAULT_INDENTATION) => ({
|
|
450
|
+
paddingInlineStart: `${(level - 1) * indentation}px`
|
|
451
|
+
});
|
|
456
452
|
|
|
457
453
|
// src/components/Tree/TreeItemHeading.tsx
|
|
458
454
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
459
|
-
import React5, { forwardRef
|
|
460
|
-
import { Button, Icon as
|
|
455
|
+
import React5, { forwardRef, memo, useCallback as useCallback2 } from "react";
|
|
456
|
+
import { Button, Icon as Icon2, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
461
457
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
462
|
-
import {
|
|
463
|
-
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */
|
|
458
|
+
import { getStyles } from "@dxos/react-ui-theme";
|
|
459
|
+
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ label, className, icon, iconHue, disabled, current, onSelect }, forwardedRef) => {
|
|
464
460
|
var _effect = _useSignals5();
|
|
465
461
|
try {
|
|
466
|
-
const { t } =
|
|
462
|
+
const { t } = useTranslation2();
|
|
463
|
+
const styles = iconHue ? getStyles(iconHue) : void 0;
|
|
467
464
|
const handleSelect = useCallback2((event) => {
|
|
468
465
|
onSelect?.(event.altKey);
|
|
469
466
|
}, [
|
|
@@ -489,17 +486,24 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ label,
|
|
|
489
486
|
"data-testid": "treeItem.heading",
|
|
490
487
|
variant: "ghost",
|
|
491
488
|
density: "fine",
|
|
492
|
-
classNames:
|
|
489
|
+
classNames: [
|
|
490
|
+
"grow gap-2 pis-0.5 hover:bg-transparent dark:hover:bg-transparent",
|
|
491
|
+
"disabled:cursor-default disabled:opacity-100",
|
|
492
|
+
className
|
|
493
|
+
],
|
|
493
494
|
disabled,
|
|
494
495
|
onClick: handleSelect,
|
|
495
496
|
onKeyDown: handleButtonKeydown,
|
|
496
497
|
...current && {
|
|
497
498
|
"aria-current": "location"
|
|
498
499
|
}
|
|
499
|
-
}, icon && /* @__PURE__ */ React5.createElement(
|
|
500
|
+
}, icon && /* @__PURE__ */ React5.createElement(Icon2, {
|
|
500
501
|
icon: icon ?? "ph--placeholder--regular",
|
|
501
502
|
size: 5,
|
|
502
|
-
classNames:
|
|
503
|
+
classNames: [
|
|
504
|
+
"mlb-1",
|
|
505
|
+
styles?.icon
|
|
506
|
+
]
|
|
503
507
|
}), /* @__PURE__ */ React5.createElement("span", {
|
|
504
508
|
className: "flex-1 is-0 truncate text-start text-sm font-normal",
|
|
505
509
|
"data-tooltip": true
|
|
@@ -511,36 +515,37 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ label,
|
|
|
511
515
|
|
|
512
516
|
// src/components/Tree/TreeItemToggle.tsx
|
|
513
517
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
514
|
-
import React6, { forwardRef as
|
|
515
|
-
import {
|
|
516
|
-
|
|
517
|
-
var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef3(({ open, isBranch, hidden, onToggle }, forwardedRef) => {
|
|
518
|
+
import React6, { forwardRef as forwardRef2, memo as memo2 } from "react";
|
|
519
|
+
import { IconButton as IconButton2 } from "@dxos/react-ui";
|
|
520
|
+
var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef2(({ open, isBranch, hidden, classNames, ...props }, forwardedRef) => {
|
|
518
521
|
var _effect = _useSignals6();
|
|
519
522
|
try {
|
|
520
|
-
return /* @__PURE__ */ React6.createElement(
|
|
523
|
+
return /* @__PURE__ */ React6.createElement(IconButton2, {
|
|
521
524
|
ref: forwardedRef,
|
|
522
525
|
"data-testid": "treeItem.toggle",
|
|
523
526
|
"aria-expanded": open,
|
|
524
527
|
variant: "ghost",
|
|
525
528
|
density: "fine",
|
|
526
|
-
classNames:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
529
|
+
classNames: [
|
|
530
|
+
"bs-full is-6 pli-0",
|
|
531
|
+
"[&_svg]:transition-[transform] [&_svg]:duration-200",
|
|
532
|
+
open && "[&_svg]:rotate-90",
|
|
533
|
+
hidden ? "hidden" : !isBranch && "invisible",
|
|
534
|
+
classNames
|
|
535
|
+
],
|
|
530
536
|
size: 3,
|
|
531
|
-
|
|
532
|
-
|
|
537
|
+
icon: "ph--caret-right--bold",
|
|
538
|
+
iconOnly: true,
|
|
539
|
+
noTooltip: true,
|
|
540
|
+
label: open ? "Click to close" : "Click to open",
|
|
541
|
+
tabIndex: -1,
|
|
542
|
+
...props
|
|
543
|
+
});
|
|
533
544
|
} finally {
|
|
534
545
|
_effect.f();
|
|
535
546
|
}
|
|
536
547
|
}));
|
|
537
548
|
|
|
538
|
-
// src/components/Tree/helpers.ts
|
|
539
|
-
var DEFAULT_INDENTATION = 8;
|
|
540
|
-
var paddingIndentation = (level, indentation = DEFAULT_INDENTATION) => ({
|
|
541
|
-
paddingInlineStart: `${(level - 1) * indentation}px`
|
|
542
|
-
});
|
|
543
|
-
|
|
544
549
|
// src/components/Tree/TreeItem.tsx
|
|
545
550
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-list/src/components/Tree/TreeItem.tsx";
|
|
546
551
|
var hoverableDescriptionIcons = "[--icons-color:inherit] hover-hover:[--icons-color:var(--description-text)] hover-hover:hover:[--icons-color:inherit] focus-within:[--icons-color:inherit]";
|
|
@@ -550,7 +555,7 @@ var TreeDataSchema = Schema.Struct({
|
|
|
550
555
|
item: Schema.Any
|
|
551
556
|
});
|
|
552
557
|
var isTreeData = (data) => Schema.is(TreeDataSchema)(data);
|
|
553
|
-
var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColumns: Columns, canDrop, onOpenChange, onSelect
|
|
558
|
+
var RawTreeItem = ({ item, path: _path, levelOffset = 2, last, draggable: _draggable, renderColumns: Columns, canDrop, canSelect, onOpenChange, onSelect }) => {
|
|
554
559
|
var _effect = _useSignals7();
|
|
555
560
|
try {
|
|
556
561
|
const rowRef = useRef2(null);
|
|
@@ -562,7 +567,7 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
562
567
|
const [menuOpen, setMenuOpen] = useState3(false);
|
|
563
568
|
const { useItems, getProps, isOpen, isCurrent } = useTree();
|
|
564
569
|
const items = useItems(item);
|
|
565
|
-
const { id, label,
|
|
570
|
+
const { id, parentOf, label, className, headingClassName, icon, iconHue, disabled, testId } = getProps(item, _path);
|
|
566
571
|
const path = useMemo(() => [
|
|
567
572
|
..._path,
|
|
568
573
|
id
|
|
@@ -575,6 +580,10 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
575
580
|
const level = path.length - levelOffset;
|
|
576
581
|
const isBranch = !!parentOf;
|
|
577
582
|
const mode = last ? "last-in-group" : open ? "expanded" : "standard";
|
|
583
|
+
const canSelectItem = canSelect?.({
|
|
584
|
+
item,
|
|
585
|
+
path
|
|
586
|
+
}) ?? true;
|
|
578
587
|
const cancelExpand = useCallback3(() => {
|
|
579
588
|
if (cancelExpandRef.current) {
|
|
580
589
|
clearTimeout(cancelExpandRef.current);
|
|
@@ -587,7 +596,7 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
587
596
|
}
|
|
588
597
|
invariant2(buttonRef.current, void 0, {
|
|
589
598
|
F: __dxlog_file2,
|
|
590
|
-
L:
|
|
599
|
+
L: 110,
|
|
591
600
|
S: void 0,
|
|
592
601
|
A: [
|
|
593
602
|
"buttonRef.current",
|
|
@@ -692,7 +701,7 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
692
701
|
useEffect3(() => () => cancelExpand(), [
|
|
693
702
|
cancelExpand
|
|
694
703
|
]);
|
|
695
|
-
const
|
|
704
|
+
const handleOpenToggle = useCallback3(() => onOpenChange?.({
|
|
696
705
|
item,
|
|
697
706
|
path,
|
|
698
707
|
open: !open
|
|
@@ -703,9 +712,13 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
703
712
|
open
|
|
704
713
|
]);
|
|
705
714
|
const handleSelect = useCallback3((option = false) => {
|
|
706
|
-
if (isBranch) {
|
|
707
|
-
|
|
708
|
-
} else {
|
|
715
|
+
if (isBranch && (option || current)) {
|
|
716
|
+
handleOpenToggle();
|
|
717
|
+
} else if (canSelectItem) {
|
|
718
|
+
canSelect?.({
|
|
719
|
+
item,
|
|
720
|
+
path
|
|
721
|
+
});
|
|
709
722
|
rowRef.current?.focus();
|
|
710
723
|
onSelect?.({
|
|
711
724
|
item,
|
|
@@ -719,25 +732,21 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
719
732
|
path,
|
|
720
733
|
current,
|
|
721
734
|
isBranch,
|
|
722
|
-
|
|
735
|
+
canSelectItem,
|
|
736
|
+
handleOpenToggle,
|
|
723
737
|
onSelect
|
|
724
738
|
]);
|
|
725
739
|
const handleKeyDown = useCallback3((event) => {
|
|
726
740
|
switch (event.key) {
|
|
727
741
|
case "ArrowRight":
|
|
728
|
-
isBranch && !open && handleOpenChange();
|
|
729
|
-
break;
|
|
730
742
|
case "ArrowLeft":
|
|
731
|
-
isBranch &&
|
|
732
|
-
break;
|
|
733
|
-
case " ":
|
|
734
|
-
handleSelect(event.altKey);
|
|
743
|
+
isBranch && handleOpenToggle();
|
|
735
744
|
break;
|
|
736
745
|
}
|
|
737
746
|
}, [
|
|
738
747
|
isBranch,
|
|
739
748
|
open,
|
|
740
|
-
|
|
749
|
+
handleOpenToggle,
|
|
741
750
|
handleSelect
|
|
742
751
|
]);
|
|
743
752
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Treegrid.Row, {
|
|
@@ -746,7 +755,16 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
746
755
|
id,
|
|
747
756
|
"aria-labelledby": `${id}__label`,
|
|
748
757
|
parentOf: parentOf?.join(Treegrid.PARENT_OF_SEPARATOR),
|
|
749
|
-
classNames:
|
|
758
|
+
classNames: [
|
|
759
|
+
"grid grid-cols-subgrid col-[tree-row] mbs-0.5 aria-[current]:bg-activeSurface",
|
|
760
|
+
hoverableControls,
|
|
761
|
+
hoverableFocusedKeyboardControls,
|
|
762
|
+
hoverableFocusedWithinControls,
|
|
763
|
+
hoverableDescriptionIcons,
|
|
764
|
+
ghostHover,
|
|
765
|
+
ghostFocusWithin,
|
|
766
|
+
className
|
|
767
|
+
],
|
|
750
768
|
"data-itemid": id,
|
|
751
769
|
"data-testid": testId,
|
|
752
770
|
// NOTE(thure): This is intentionally an empty string to for descendents to select by in the CSS
|
|
@@ -758,25 +776,25 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
758
776
|
event.preventDefault();
|
|
759
777
|
setMenuOpen(true);
|
|
760
778
|
}
|
|
761
|
-
}, /* @__PURE__ */ React7.createElement(Treegrid.Cell, {
|
|
762
|
-
indent: true,
|
|
763
|
-
classNames: "relative grid grid-cols-subgrid col-[tree-row]",
|
|
764
|
-
style: paddingIndentation(level)
|
|
765
779
|
}, /* @__PURE__ */ React7.createElement("div", {
|
|
766
780
|
role: "none",
|
|
767
|
-
className: "
|
|
781
|
+
className: "indent relative grid grid-cols-subgrid col-[tree-row]",
|
|
782
|
+
style: paddingIndentation(level)
|
|
783
|
+
}, /* @__PURE__ */ React7.createElement(Treegrid.Cell, {
|
|
784
|
+
classNames: "flex items-center"
|
|
768
785
|
}, /* @__PURE__ */ React7.createElement(TreeItemToggle, {
|
|
769
786
|
isBranch,
|
|
770
787
|
open,
|
|
771
|
-
|
|
788
|
+
onClick: handleOpenToggle
|
|
772
789
|
}), /* @__PURE__ */ React7.createElement(TreeItemHeading, {
|
|
773
|
-
ref: buttonRef,
|
|
774
|
-
label,
|
|
775
|
-
icon,
|
|
776
|
-
className: headingClassName,
|
|
777
790
|
disabled,
|
|
778
791
|
current,
|
|
779
|
-
|
|
792
|
+
label,
|
|
793
|
+
className: headingClassName,
|
|
794
|
+
icon,
|
|
795
|
+
iconHue,
|
|
796
|
+
onSelect: handleSelect,
|
|
797
|
+
ref: buttonRef
|
|
780
798
|
})), Columns && /* @__PURE__ */ React7.createElement(Columns, {
|
|
781
799
|
item,
|
|
782
800
|
path,
|
|
@@ -794,6 +812,7 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
794
812
|
draggable: _draggable,
|
|
795
813
|
renderColumns: Columns,
|
|
796
814
|
canDrop,
|
|
815
|
+
canSelect,
|
|
797
816
|
onOpenChange,
|
|
798
817
|
onSelect
|
|
799
818
|
})));
|
|
@@ -804,7 +823,7 @@ var RawTreeItem = ({ item, path: _path, last, draggable: _draggable, renderColum
|
|
|
804
823
|
var TreeItem = /* @__PURE__ */ memo3(RawTreeItem);
|
|
805
824
|
|
|
806
825
|
// src/components/Tree/Tree.tsx
|
|
807
|
-
var Tree = ({ root, path, id, useItems, getProps, isOpen, isCurrent, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] 1fr min-content [tree-row-end]", classNames, levelOffset, renderColumns, canDrop, onOpenChange, onSelect }) => {
|
|
826
|
+
var Tree = ({ root, path, id, useItems, getProps, isOpen, isCurrent, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] 1fr min-content [tree-row-end]", classNames, levelOffset, renderColumns, canDrop, canSelect, onOpenChange, onSelect }) => {
|
|
808
827
|
var _effect = _useSignals8();
|
|
809
828
|
try {
|
|
810
829
|
const context = useMemo2(() => ({
|
|
@@ -842,6 +861,7 @@ var Tree = ({ root, path, id, useItems, getProps, isOpen, isCurrent, draggable:
|
|
|
842
861
|
draggable: draggable3,
|
|
843
862
|
renderColumns,
|
|
844
863
|
canDrop,
|
|
864
|
+
canSelect,
|
|
845
865
|
onOpenChange,
|
|
846
866
|
onSelect
|
|
847
867
|
}))));
|