@wordpress/block-editor
Version:
68 lines (67 loc) • 2.14 kB
JavaScript
// packages/block-editor/src/components/tabbed-sidebar/index.js
import {
Button,
privateApis as componentsPrivateApis
} from "@wordpress/components";
import { forwardRef } from "@wordpress/element";
import { closeSmall } from "@wordpress/icons";
import { unlock } from "../../lock-unlock.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
var { Tabs } = unlock(componentsPrivateApis);
function TabbedSidebar({ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel }, ref) {
return /* @__PURE__ */ jsx("div", { className: "block-editor-tabbed-sidebar", children: /* @__PURE__ */ jsxs(
Tabs,
{
selectOnMove: false,
defaultTabId,
onSelect,
selectedTabId: selectedTab,
children: [
/* @__PURE__ */ jsxs("div", { className: "block-editor-tabbed-sidebar__tablist-and-close-button", children: [
/* @__PURE__ */ jsx(
Button,
{
className: "block-editor-tabbed-sidebar__close-button",
icon: closeSmall,
label: closeButtonLabel,
onClick: () => onClose(),
size: "compact"
}
),
/* @__PURE__ */ jsx(
Tabs.TabList,
{
className: "block-editor-tabbed-sidebar__tablist",
ref,
children: tabs.map((tab) => /* @__PURE__ */ jsx(
Tabs.Tab,
{
tabId: tab.name,
className: "block-editor-tabbed-sidebar__tab",
children: tab.title
},
tab.name
))
}
)
] }),
tabs.map((tab) => /* @__PURE__ */ jsx(
Tabs.TabPanel,
{
tabId: tab.name,
focusable: false,
className: "block-editor-tabbed-sidebar__tabpanel",
ref: tab.panelRef,
children: tab.panel
},
tab.name
))
]
}
) });
}
var tabbed_sidebar_default = forwardRef(TabbedSidebar);
export {
tabbed_sidebar_default as default
};
//# sourceMappingURL=index.mjs.map