(
(
{
childCount,
clone,
depth,
disableSelection,
disableInteraction,
ghost,
handleProps,
indentationWidth,
collapsed,
onCollapse,
style,
value,
disabled,
wrapperRef,
...props
},
ref
) => {
return (
div]:border-t-0": !clone,
})}
{...props}
>
0,
"shadow-elevation-flyout bg-ui-bg-base w-fit rounded-lg border-none pr-6 opacity-80":
clone,
"bg-ui-bg-base-hover z-[1] opacity-50": ghost,
"bg-ui-bg-disabled": disabled,
}
)}
>
)
}
)
TreeItem.displayName = "TreeItem"
const Handle = ({
listeners,
attributes,
disabled,
}: HandleProps & { disabled?: boolean }) => {
return (
)
}
type IconProps = {
childrenCount?: number
collapsed?: boolean
clone?: boolean
}
const Icon = ({ childrenCount, collapsed, clone }: IconProps) => {
const isBranch = clone ? childrenCount && childrenCount > 1 : childrenCount
const isOpen = clone ? false : !collapsed
return (
{isBranch ? (
isOpen ? (
) : (
)
) : (
)}
)
}
type CollapseProps = {
collapsed?: boolean
onCollapse?: () => void
clone?: boolean
}
const Collapse = ({ collapsed, onCollapse, clone }: CollapseProps) => {
if (clone) {
return null
}
if (!onCollapse) {
return
}
return (
)
}
type ValueProps = {
value: ReactNode
}
const Value = ({ value }: ValueProps) => {
return (
{value}
)
}
type ChildrenCountProps = {
clone?: boolean
childrenCount?: number
}
const ChildrenCount = ({ clone, childrenCount }: ChildrenCountProps) => {
if (!clone || !childrenCount) {
return null
}
if (clone && childrenCount <= 1) {
return null
}
return (
{childrenCount}
)
}