UNPKG

@wordpress/block-editor

Version:
52 lines (50 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _components = require("@wordpress/components"); var _element = require("@wordpress/element"); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) { return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Composite.Item, { ref: ref, role: "option" // Use the Composite.Item `accessibleWhenDisabled` prop // over Button's `isFocusable`. The latter was shown to // cause an issue with tab order in the inserter list. , accessibleWhenDisabled: true, ...props, render: htmlProps => { const propsWithTabIndex = { ...htmlProps, tabIndex: isFirst ? 0 : htmlProps.tabIndex }; if (Component) { return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, { ...propsWithTabIndex, children: children }); } if (typeof children === 'function') { return children(propsWithTabIndex); } return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children: children }); } }); } var _default = exports.default = (0, _element.forwardRef)(InserterListboxItem); //# sourceMappingURL=item.js.map