UNPKG

@wordpress/components

Version:
61 lines (60 loc) • 2.59 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); // \0rolldown/runtime.js var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); let _wordpress_element = require("@wordpress/element"); let __item_tsx = require("./item.cjs"); __item_tsx = __toESM(__item_tsx); let __use_validate_tree_grid_structure_ts = require("./use-validate-tree-grid-structure.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/components/src/tree-grid/cell.tsx function UnforwardedTreeGridCell({ children, withoutGridItem = false, ...props }, ref) { const cellRef = (0, _wordpress_element.useRef)(null); (0, __use_validate_tree_grid_structure_ts.useValidateTreeGridStructure)("TreeGridCell", cellRef); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { ref: cellRef, ...props, role: "gridcell", children: withoutGridItem ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: typeof children === "function" ? children({ ...props, ref }) : children }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__item_tsx.default, { ref, children }) }); } /** * `TreeGridCell` 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 TreeGridCell = (0, _wordpress_element.forwardRef)(UnforwardedTreeGridCell); TreeGridCell.displayName = "TreeGridCell"; exports.TreeGridCell = TreeGridCell; exports.default = TreeGridCell; //# sourceMappingURL=cell.cjs.map