UNPKG

@wordpress/block-library

Version:
55 lines (54 loc) • 2.64 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_block_editor = require("@wordpress/block-editor"); let _wordpress_components = require("@wordpress/components"); let _wordpress_i18n = require("@wordpress/i18n"); let ___utils_hooks_js = require("../utils/hooks.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/block-library/src/loginout/edit.jsx function LoginOutEdit({ attributes, setAttributes }) { const { displayLoginAsForm, redirectToCurrent } = attributes; const dropdownMenuProps = (0, ___utils_hooks_js.useToolsPanelDropdownMenuProps)(); return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalToolsPanel, { label: (0, _wordpress_i18n.__)("Settings"), resetAll: () => { setAttributes({ displayLoginAsForm: false, redirectToCurrent: true }); }, dropdownMenuProps, children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalToolsPanelItem, { label: (0, _wordpress_i18n.__)("Display login as form"), isShownByDefault: true, hasValue: () => displayLoginAsForm, onDeselect: () => setAttributes({ displayLoginAsForm: false }), children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ToggleControl, { label: (0, _wordpress_i18n.__)("Display login as form"), checked: displayLoginAsForm, onChange: () => setAttributes({ displayLoginAsForm: !displayLoginAsForm }) }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalToolsPanelItem, { label: (0, _wordpress_i18n.__)("Redirect to current URL"), isShownByDefault: true, hasValue: () => !redirectToCurrent, onDeselect: () => setAttributes({ redirectToCurrent: true }), children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ToggleControl, { label: (0, _wordpress_i18n.__)("Redirect to current URL"), checked: redirectToCurrent, onChange: () => setAttributes({ redirectToCurrent: !redirectToCurrent }) }) })] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...(0, _wordpress_block_editor.useBlockProps)({ className: "logged-in" }), children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", { href: "#login-pseudo-link", children: (0, _wordpress_i18n.__)("Log out") }) })] }); } exports.default = LoginOutEdit; //# sourceMappingURL=edit.cjs.map