UNPKG

@react95/core

Version:
17 lines (16 loc) 652 B
import React, { forwardRef } from "react"; 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: tree, as: "ul", ref }, data.map((dataNode) => /* @__PURE__ */ React.createElement(Node, { key: dataNode.id, ...dataNode })))); } ); Tree.defaultProps = { data: [] }; Tree.icons = icons; export { Tree };