"use client"; /* * Documentation: * Accordion — https://app.subframe.com/f023064a5ca0/library?component=Accordion_d2e81e20-863a-4027-826a-991d8910efd9 * Tree View — https://app.subframe.com/f023064a5ca0/library?component=Tree+View_4ed46422-ecc3-41e8-8787-e55ee10cdc75 */ import React from "react"; import { FeatherFile } from "@subframe/core"; import { FeatherFolder } from "@subframe/core"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; import { Accordion } from "../Accordion"; export interface FolderProps extends React.ComponentProps { children?: React.ReactNode; label?: React.ReactNode; icon?: React.ReactNode; className?: string; } const Folder = React.forwardRef< React.ElementRef, FolderProps >(function Folder( { children, label, icon = , className, ...otherProps }: FolderProps, ref ) { return ( {icon ? ( {icon} ) : null} {label ? ( {label} ) : null} } ref={ref} {...otherProps} > {children ? (
{children}
) : null}
); }); export interface ItemProps extends React.HTMLAttributes { selected?: boolean; label?: React.ReactNode; icon?: React.ReactNode; className?: string; } const Item = React.forwardRef(function Item( { selected = false, label, icon = , className, ...otherProps }: ItemProps, ref ) { return (
{icon ? ( {icon} ) : null} {label ? ( {label} ) : null}
); }); export interface TreeViewRootProps extends React.HTMLAttributes { children?: React.ReactNode; className?: string; } const TreeViewRoot = React.forwardRef( function TreeViewRoot( { children, className, ...otherProps }: TreeViewRootProps, ref ) { return children ? (
{children}
) : null; } ); export const TreeView = Object.assign(TreeViewRoot, { Folder, Item, });