UNPKG

@wordpress/components

Version:
32 lines (31 loc) • 1.2 kB
import { useMergeRefs } from "@wordpress/compose"; import { forwardRef, useRef } from "@wordpress/element"; import { useValidateTreeGridStructure } from "./use-validate-tree-grid-structure.mjs"; import { jsx } from "react/jsx-runtime"; // packages/components/src/tree-grid/row.tsx function UnforwardedTreeGridRow({ children, level, positionInSet, setSize, isExpanded, ...props }, ref) { const rowRef = useRef(null); const refs = useMergeRefs([rowRef, ref]); useValidateTreeGridStructure("TreeGridRow", rowRef); return /* @__PURE__ */ jsx("tr", { ...props, ref: refs, role: "row", "aria-level": level, "aria-posinset": positionInSet, "aria-setsize": setSize, "aria-expanded": isExpanded, children }); } /** * `TreeGridRow` is used to create a tree hierarchy. * It is not a visually styled component, but instead helps with adding * keyboard navigation and roving tab index behaviors to tree grid structures. * * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html} */ const TreeGridRow = forwardRef(UnforwardedTreeGridRow); TreeGridRow.displayName = "TreeGridRow"; export { TreeGridRow, TreeGridRow as default }; //# sourceMappingURL=row.mjs.map