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