UNPKG

@react95/core

Version:
15 lines (14 loc) 670 B
import React, { forwardRef } from "react"; import cn from "classnames"; import { NodeRoot, Node, icons } from "./Node.mjs"; import { tree } from "./Tree.css.mjs"; import { Frame } from "../Frame/Frame.mjs"; const Tree = forwardRef( ({ data = [], root, ...rest }, ref) => { return /* @__PURE__ */ React.createElement(React.Fragment, null, root && /* @__PURE__ */ React.createElement(NodeRoot, { ...root }), /* @__PURE__ */ React.createElement(Frame, { ...rest, className: cn(tree, rest.className), as: "ul", ref }, data.map((dataNode) => /* @__PURE__ */ React.createElement(Node, { key: dataNode.id, ...dataNode })))); } ); Tree.icons = icons; export { Tree };