UNPKG

@wordpress/block-editor

Version:
30 lines (29 loc) 1.19 kB
// packages/block-editor/src/components/list-view/expander.js import { chevronRightSmall, chevronLeftSmall, Icon } from "@wordpress/icons"; import { isRTL } from "@wordpress/i18n"; import { jsx } from "react/jsx-runtime"; function ListViewExpander({ onClick }) { return ( // 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. /* @__PURE__ */ jsx( "span", { className: "block-editor-list-view__expander", onClick: (event) => onClick(event, { forceToggle: true }), "aria-hidden": "true", "data-testid": "list-view-expander", children: /* @__PURE__ */ jsx(Icon, { icon: isRTL() ? chevronLeftSmall : chevronRightSmall }) } ) ); } export { ListViewExpander as default }; //# sourceMappingURL=expander.js.map