@wordpress/block-editor
Version:
41 lines (39 loc) • 1.39 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ListViewExpander;
var _icons = require("@wordpress/icons");
var _i18n = require("@wordpress/i18n");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
function ListViewExpander({
onClick
}) {
return (
/*#__PURE__*/
// Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js
//
// The expander component is implemented as a pseudo element in the w3 example
// https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html
//
// We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree.
// For the current tree grid implementation, please do not try to make this a button.
//
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
(0, _jsxRuntime.jsx)("span", {
className: "block-editor-list-view__expander",
onClick: event => onClick(event, {
forceToggle: true
}),
"aria-hidden": "true",
"data-testid": "list-view-expander",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
icon: (0, _i18n.isRTL)() ? _icons.chevronLeftSmall : _icons.chevronRightSmall
})
})
);
}
//# sourceMappingURL=expander.js.map
;