PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 All 234 releases
← All changes | js/build/blocks.js +905 -493 3.8.5 → trunk View file →
@@ -1,40 +1,7 @@
1 1 /******/ (() => { // webpackBootstrap
2 2 /******/ var __webpack_modules__ = ({
3 3
4 -/***/ 20
5 -(__unused_webpack_module, exports, __webpack_require__) {
6 -
7 -"use strict";
8 -/**
9 - * @license React
10 - * react-jsx-runtime.production.min.js
11 - *
12 - * Copyright (c) Facebook, Inc. and its affiliates.
13 - *
14 - * This source code is licensed under the MIT license found in the
15 - * LICENSE file in the root directory of this source tree.
16 - */
17 -var f=__webpack_require__(677),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
18 -function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
19 -
20 -
21 -/***/ },
22 -
23 -/***/ 848
24 -(module, __unused_webpack_exports, __webpack_require__) {
25 -
26 -"use strict";
27 -
28 -
29 -if (true) {
30 - module.exports = __webpack_require__(20);
31 -} else // removed by dead control flow
32 -{}
33 -
34 -
35 -/***/ },
36 -
37 4 /***/ 677
38 5 (module) {
39 6
40 7 module.exports = (function() { return this["React"]; }());
@@ -40,15 +7,8 @@
40 7 module.exports = (function() { return this["React"]; }());
41 8
42 9 /***/ },
43 10
44 -/***/ 419
45 -(module) {
46 -
47 -module.exports = (function() { return this["lodash"]; }());
48 -
49 -/***/ },
50 -
51 11 /***/ 631
52 12 (module) {
53 13
54 14 module.exports = (function() { return this["wp"]["apiFetch"]; }());
@@ -110,8 +70,15 @@
110 70 module.exports = (function() { return this["wp"]["i18n"]; }());
111 71
112 72 /***/ },
113 73
74 +/***/ 672
75 +(module) {
76 +
77 +module.exports = (function() { return this["wp"]["notices"]; }());
78 +
79 +/***/ },
80 +
114 81 /***/ 933
115 82 (module) {
116 83
117 84 module.exports = (function() { return this["wp"]["primitives"]; }());
@@ -120,19 +87,19 @@
120 87
121 88 /******/ });
122 89 /************************************************************************/
123 90 /******/ // The module cache
124 -/******/ var __webpack_module_cache__ = {};
91 +/******/ const __webpack_module_cache__ = {};
125 92 /******/
126 93 /******/ // The require function
127 94 /******/ function __webpack_require__(moduleId) {
128 95 /******/ // Check if module is in cache
129 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
96 +/******/ const cachedModule = __webpack_module_cache__[moduleId];
130 97 /******/ if (cachedModule !== undefined) {
131 98 /******/ return cachedModule.exports;
132 99 /******/ }
133 100 /******/ // Create a new module (and put it into the cache)
134 -/******/ var module = __webpack_module_cache__[moduleId] = {
101 +/******/ const module = __webpack_module_cache__[moduleId] = {
135 102 /******/ // no module.id needed
136 103 /******/ // no module.loaded needed
137 104 /******/ exports: {}
138 105 /******/ };
@@ -145,48 +112,92 @@
145 112 /******/ }
146 113 /******/
147 114 /************************************************************************/
148 115 /******/ /* webpack/runtime/compat get default export */
149 -/******/ (() => {
150 -/******/ // getDefaultExport function for compatibility with non-harmony modules
151 -/******/ __webpack_require__.n = (module) => {
152 -/******/ var getter = module && module.__esModule ?
153 -/******/ () => (module['default']) :
154 -/******/ () => (module);
155 -/******/ __webpack_require__.d(getter, { a: getter });
156 -/******/ return getter;
116 +/******/ // getDefaultExport function for compatibility with non-harmony modules
117 +/******/ __webpack_require__.n = (module) => {
118 +/******/ const getter = module && module.__esModule ?
119 +/******/ () => (module['default']) :
120 +/******/ () => (module);
121 +/******/ __webpack_require__.d(getter, { a: getter });
122 +/******/ return getter;
123 +/******/ };
124 +/******/
125 +/******/ /* webpack/runtime/concatenation wrap */
126 +/******/ // wrap a concatenated module body as a lazy, memoized accessor; mod is
127 +/******/ // set before the body runs so re-entrant calls (require cycles) observe
128 +/******/ // the partial exports like Node.js
129 +/******/ __webpack_require__.cw = (body) => {
130 +/******/ var mod;
131 +/******/ return () => {
132 +/******/ if (body) {
133 +/******/ var fn = body;
134 +/******/ body = 0;
135 +/******/ mod = { exports: {} };
136 +/******/ fn.call(mod.exports, mod, mod.exports);
137 +/******/ }
138 +/******/ return mod.exports;
157 139 /******/ };
158 -/******/ })();
140 +/******/ };
159 141 /******/
160 142 /******/ /* webpack/runtime/define property getters */
161 -/******/ (() => {
162 -/******/ // define getter functions for harmony exports
163 -/******/ __webpack_require__.d = (exports, definition) => {
164 -/******/ for(var key in definition) {
165 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
166 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
167 -/******/ }
143 +/******/ // define getter/value functions for harmony exports
144 +/******/ __webpack_require__.d = (exports, definition) => {
145 +/******/ for(var key in definition) {
146 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
147 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
168 148 /******/ }
169 -/******/ };
170 -/******/ })();
149 +/******/ }
150 +/******/ };
171 151 /******/
172 152 /******/ /* webpack/runtime/hasOwnProperty shorthand */
173 -/******/ (() => {
174 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
175 -/******/ })();
153 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));
176 154 /******/
177 155 /************************************************************************/
178 -var __webpack_exports__ = {};
156 +let __webpack_exports__ = {};
179 157 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
180 158 (() => {
181 159 "use strict";
182 160
161 +// MODULE: ./node_modules/react/cjs/react-jsx-runtime.production.min.js
162 +var react_jsx_runtime_production_min_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module, exports) {
163 +/**
164 + * @license React
165 + * react-jsx-runtime.production.min.js
166 + *
167 + * Copyright (c) Facebook, Inc. and its affiliates.
168 + *
169 + * This source code is licensed under the MIT license found in the
170 + * LICENSE file in the root directory of this source tree.
171 + */
172 +var f=(external_React_namespaceFn()),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
173 +function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
174 +
175 +});
176 +
177 +// MODULE: ./node_modules/react/jsx-runtime.js
178 +var jsx_runtime_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module, exports) {
179 +
180 +
181 +if (true) {
182 + module.exports = (react_jsx_runtime_production_min_namespaceFn());
183 +} else // removed by dead control flow
184 +{}
185 +
186 +});
187 +
188 +// EXTERNAL MODULE: external "React"
189 +var external_React_namespaceFn = () => {
190 + return __webpack_require__(677);
191 +};
192 +
183 193 // EXTERNAL MODULE: external {"this":["wp","blocks"]}
184 194 var external_this_wp_blocks_ = __webpack_require__(545);
185 195 // EXTERNAL MODULE: external {"this":["wp","primitives"]}
186 196 var external_this_wp_primitives_ = __webpack_require__(933);
187 -// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
188 -var jsx_runtime = __webpack_require__(848);
197 +;// ./node_modules/react/jsx-runtime.js
198 +jsx_runtime_namespaceFn();
199 +
189 200 ;// ./node_modules/@wpsyntex/polylang-react-library/build/icons/translation.js
190 201 /**
191 202 * Translation icon - translation Dashicon.
192 203 */
@@ -196,337 +207,404 @@
196 207 */
197 208
198 209
199 210 const isPrimitivesComponents = 'undefined' !== typeof wp.primitives;
200 -const translation = isPrimitivesComponents ? /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.SVG, {
211 +const translation = isPrimitivesComponents ? /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.SVG, {
201 212 width: "20",
202 213 height: "20",
203 214 xmlns: "http://www.w3.org/2000/svg",
204 215 viewBox: "0 0 20 20",
205 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.Path, {
216 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.Path, {
206 217 d: "M11 7H9.49c-.63 0-1.25.3-1.59.7L7 5H4.13l-2.39 7h1.69l.74-2H7v4H2c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h7c1.1 0 2 .9 2 2v2zM6.51 9H4.49l1-2.93zM10 8h7c1.1 0 2 .9 2 2v7c0 1.1-.9 2-2 2h-7c-1.1 0-2-.9-2-2v-7c0-1.1.9-2 2-2zm7.25 5v-1.08h-3.17V9.75h-1.16v2.17H9.75V13h1.28c.11.85.56 1.85 1.28 2.62-.87.36-1.89.62-2.31.62-.01.02.22.97.2 1.46.84 0 2.21-.5 3.28-1.15 1.09.65 2.48 1.15 3.34 1.15-.02-.49.2-1.44.2-1.46-.43 0-1.49-.27-2.38-.63.7-.77 1.14-1.77 1.25-2.61h1.36zm-3.81 1.93c-.5-.46-.85-1.13-1.01-1.93h2.09c-.17.8-.51 1.47-1 1.93l-.04.03s-.03-.02-.04-.03z"
207 218 })
208 219 }) : 'translation';
209 220 /* harmony default export */ const icons_translation = (translation);
210 -// EXTERNAL MODULE: external {"this":["wp","i18n"]}
211 -var external_this_wp_i18n_ = __webpack_require__(75);
221 +;// ./js/src/blocks/language-switcher/deprecated.js
222 +/**
223 + * Deprecated language switcher block.
224 + */
225 +
226 +const V2Attributes = {
227 + layout: 'vertical',
228 + show_labels: 'names',
229 + show_flags: false,
230 + force_home: false,
231 + hide_current: false,
232 + hide_if_no_translation: false,
233 + flag_aspect_ratio: '3:2',
234 + flag_border_radius: 0,
235 + flag_width: '18px',
236 + flag_label_spacing: '0.3em',
237 + className: ''
238 +};
239 +const v1 = {
240 + attributes: {
241 + dropdown: {
242 + type: 'boolean',
243 + default: false
244 + },
245 + show_names: {
246 + type: 'boolean',
247 + default: true
248 + },
249 + show_flags: {
250 + type: 'boolean',
251 + default: false
252 + },
253 + force_home: {
254 + type: 'boolean',
255 + default: false
256 + },
257 + hide_current: {
258 + type: 'boolean',
259 + default: false
260 + },
261 + hide_if_no_translation: {
262 + type: 'boolean',
263 + default: false
264 + },
265 + className: {
266 + type: 'string',
267 + default: ''
268 + }
269 + },
270 + isEligible: attributes => 'dropdown' in attributes || 'show_names' in attributes,
271 + migrate(attributes) {
272 + const {
273 + dropdown,
274 + show_names,
275 + show_flags,
276 + force_home,
277 + hide_current,
278 + hide_if_no_translation,
279 + className
280 + } = attributes;
281 + return {
282 + ...V2Attributes,
283 + layout: dropdown ? 'select' : 'vertical',
284 + show_labels: show_names ? 'names' : '',
285 + show_flags: show_names ? show_flags : true,
286 + force_home,
287 + hide_current,
288 + hide_if_no_translation,
289 + className: className || ''
290 + };
291 + }
292 +};
293 +/* harmony default export */ const deprecated = ([v1]);
212 294 // EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
213 295 var external_this_wp_blockEditor_ = __webpack_require__(89);
214 296 // EXTERNAL MODULE: external {"this":["wp","components"]}
215 297 var external_this_wp_components_ = __webpack_require__(959);
216 -// EXTERNAL MODULE: external "lodash"
217 -var external_lodash_ = __webpack_require__(419);
218 -;// ./js/src/blocks/language-switcher-edit.js
298 +// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
299 +var external_this_wp_apiFetch_ = __webpack_require__(631);
300 +var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
301 +// EXTERNAL MODULE: external {"this":["wp","element"]}
302 +var external_this_wp_element_ = __webpack_require__(601);
303 +;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-languages-list.js
219 304 /**
220 - * Language switcher block edit.
305 + * WordPress dependencies
221 306 */
222 307
308 +
309 +
223 310 /**
224 - * External dependencies
311 + * Custom hook to get the languages list.
312 + *
313 + * @return {Array|null} The languages list, `null` if not loaded yet.
225 314 */
315 +const useLanguagesList = () => {
316 + const [languages, setLanguages] = (0,external_this_wp_element_.useState)(null);
317 + (0,external_this_wp_element_.useEffect)(() => {
318 + external_this_wp_apiFetch_default()({
319 + path: '/pll/v1/languages',
320 + method: 'GET'
321 + }).then(response => setLanguages(response));
322 + }, []);
323 + return languages;
324 +};
325 +;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-curated-languages.js
326 +/**
327 + * WordPress dependencies
328 + */
226 329
227 330
228 331 /**
332 + * Hook to curate the languages.
333 + * Returns an array of languages ensuring that the current language is always the first one.
334 + *
335 + * @param {Object[]} languages The languages.
336 + * @param {Object} currentLanguage The current language.
337 + * @param {boolean} reduceToOneItem Whether to reduce the languages to one item.
338 + * @return {Object[]} The curated languages.
339 + */
340 +const useCuratedLanguages = (languages, currentLanguage, reduceToOneItem) => {
341 + const curatedLanguages = (0,external_this_wp_element_.useMemo)(() => {
342 + if (!currentLanguage) {
343 + return [];
344 + }
345 + if (reduceToOneItem) {
346 + return [currentLanguage];
347 + }
348 + return [currentLanguage, ...languages.filter(language => {
349 + return language.slug !== currentLanguage.slug;
350 + })];
351 + }, [languages, currentLanguage, reduceToOneItem]);
352 + return curatedLanguages;
353 +};
354 +;// ./node_modules/@wpsyntex/polylang-react-library/build/icons/submenu.js
355 +/**
356 + * Submenu icon
357 + */
358 +
359 +/**
229 360 * WordPress dependencies
230 361 */
231 362
232 363
233 -const i18nAttributeStrings = pll_block_editor_blocks_settings;
234 -function createLanguageSwitcherEdit(props) {
235 - const createToggleAttribute = function (propName) {
236 - return () => {
237 - const value = props.attributes[propName];
238 - const {
239 - setAttributes
240 - } = props;
241 - let updatedAttributes = {
242 - [propName]: !value
243 - };
244 - let forcedAttributeName;
245 - let forcedAttributeUnchecked;
364 +const submenu_isPrimitivesComponents = 'undefined' !== typeof wp.primitives;
365 +const SubmenuIcon = () => submenu_isPrimitivesComponents ? /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.SVG, {
366 + xmlns: "http://www.w3.org/2000/svg",
367 + width: "12",
368 + height: "12",
369 + viewBox: "0 0 12 12",
370 + fill: "none",
371 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.Path, {
372 + d: "M1.50002 4L6.00002 8L10.5 4",
373 + strokeWidth: "1.5"
374 + })
375 +}) : 'submenu';
376 +/* harmony default export */ const submenu = (SubmenuIcon);
377 +;// ./js/src/blocks/components/switcher-link-element.js
246 378
247 - // Both show_names and show_flags attributes can't be unchecked together.
248 - switch (propName) {
249 - case 'show_names':
250 - forcedAttributeName = 'show_flags';
251 - forcedAttributeUnchecked = !props.attributes[forcedAttributeName];
252 - break;
253 - case 'show_flags':
254 - forcedAttributeName = 'show_names';
255 - forcedAttributeUnchecked = !props.attributes[forcedAttributeName];
256 - break;
257 - }
258 - if ('show_names' === propName || 'show_flags' === propName) {
259 - if (value && forcedAttributeUnchecked) {
260 - updatedAttributes = (0,external_lodash_.assign)(updatedAttributes, {
261 - [forcedAttributeName]: forcedAttributeUnchecked
262 - });
263 - }
264 - }
265 - setAttributes(updatedAttributes);
266 - };
267 - };
268 - const toggleDropdown = createToggleAttribute('dropdown');
269 - const toggleShowNames = createToggleAttribute('show_names');
270 - const toggleShowFlags = createToggleAttribute('show_flags');
271 - const toggleForceHome = createToggleAttribute('force_home');
272 - const toggleHideCurrent = createToggleAttribute('hide_current');
273 - const toggleHideIfNoTranslation = createToggleAttribute('hide_if_no_translation');
274 - const {
275 - dropdown,
276 - show_names,
277 - show_flags,
278 - force_home,
279 - hide_current,
280 - hide_if_no_translation
281 - } = props.attributes;
282 - function ToggleControlDropdown() {
283 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
284 - label: i18nAttributeStrings.dropdown,
285 - checked: dropdown,
286 - onChange: toggleDropdown
287 - });
379 +/**
380 + * Switcher link element component.
381 + *
382 + * @param {Object} props Component props.
383 + * @param {ReactElement} props.flag Flag to display.
384 + * @param {string} props.label Label to display.
385 + * @param {string} props.labelSpacing CSS length for the space between flag and label.
386 + * @return {ReactElement} The Switcher element component.
387 + */
388 +const SwitcherLinkElement = ({
389 + flag,
390 + label,
391 + labelSpacing
392 +}) => {
393 + const hasLabel = '' !== label;
394 + const labelStyle = hasLabel && labelSpacing ? {
395 + '--pll-flag-label-spacing': labelSpacing
396 + } : undefined;
397 + return (
398 + /*#__PURE__*/
399 + // eslint-disable-next-line jsx-a11y/anchor-is-valid
400 + (0,react_jsx_runtime_production_min_namespaceFn().jsxs)("a", {
401 + href: '#',
402 + children: [flag, hasLabel && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
403 + className: "pll-switcher-label",
404 + style: labelStyle,
405 + children: label
406 + })]
407 + })
408 + );
409 +};
410 +;// ./js/src/blocks/components/switcher-utils.js
411 +/**
412 + * Returns the switcher wrapper class names.
413 + *
414 + * @param {string} layout The switcher layout.
415 + * @param {boolean} showFlags Whether flags are displayed.
416 + * @param {string} flagAspectRatio The flag aspect ratio.
417 + * @param {string} [alignment] The items alignment. Omitted when unset.
418 + * @return {string} The switcher class names.
419 + */
420 +const getSwitcherClassName = (layout, showFlags, flagAspectRatio, alignment) => {
421 + const classes = ['pll-switcher', `pll-layout-${layout}`];
422 + if (alignment) {
423 + classes.push(`pll-alignment-${alignment}`);
288 424 }
289 - function ToggleControlShowNames() {
290 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
291 - label: i18nAttributeStrings.show_names,
292 - checked: show_names // eslint-disable-line camelcase
293 - ,
294 - onChange: toggleShowNames
295 - });
425 + if (showFlags) {
426 + classes.push(`pll-aspect-ratio-${flagAspectRatio.replace(':', '')}`);
296 427 }
297 - function ToggleControlShowFlags() {
298 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
299 - label: i18nAttributeStrings.show_flags,
300 - checked: show_flags // eslint-disable-line camelcase
301 - ,
302 - onChange: toggleShowFlags
303 - });
304 - }
305 - function ToggleControlForceHome() {
306 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
307 - label: i18nAttributeStrings.force_home,
308 - checked: force_home // eslint-disable-line camelcase
309 - ,
310 - onChange: toggleForceHome
311 - });
312 - }
313 - function ToggleControlHideCurrent() {
314 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
315 - label: i18nAttributeStrings.hide_current,
316 - checked: hide_current // eslint-disable-line camelcase
317 - ,
318 - onChange: toggleHideCurrent
319 - });
320 - }
321 - function ToggleControlHideIfNoTranslations() {
322 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
323 - label: i18nAttributeStrings.hide_if_no_translation,
324 - checked: hide_if_no_translation // eslint-disable-line camelcase
325 - ,
326 - onChange: toggleHideIfNoTranslation
327 - });
328 - }
329 - return {
330 - ToggleControlDropdown,
331 - ToggleControlShowNames,
332 - ToggleControlShowFlags,
333 - ToggleControlForceHome,
334 - ToggleControlHideCurrent,
335 - ToggleControlHideIfNoTranslations
336 - };
337 -}
338 -// EXTERNAL MODULE: external {"this":["wp","element"]}
339 -var external_this_wp_element_ = __webpack_require__(601);
340 -;// ./js/src/blocks/languages-context.js
428 + return classes.join(' ');
429 +};
430 +
341 431 /**
342 - * WordPress dependencies.
432 + * Gets the label for a language.
433 + *
434 + * @param {Object} language The language object.
435 + * @param {string} showLabels Whether to show the names. Can be 'names', 'codes' or ''.
436 + * @return {string} The label for the language.
343 437 */
438 +const getLabel = (language, showLabels) => {
439 + let label = '';
440 + if (showLabels === 'names') {
441 + label = language.name;
442 + } else if (showLabels === 'codes') {
443 + label = language.slug.toUpperCase();
444 + }
445 + return label;
446 +};
344 447
345 -
346 448 /**
347 - * Context for the languages.
449 + * Returns the CSS length for the space between flag and label.
348 450 *
349 - * @type {React.Context<null>}
451 + * @param {string} showLabels Whether to show labels. Can be 'names', 'codes' or ''.
452 + * @param {string} flagLabelSpacing CSS length for the space between flag and label.
453 + * @return {string|undefined} The label spacing, or undefined when labels are hidden.
350 454 */
351 -const LanguagesContext = (0,external_this_wp_element_.createContext)(null);
352 -;// ./js/src/blocks/hooks/use-memoized-switcher-label.js
455 +const getLabelSpacing = (showLabels, flagLabelSpacing) => {
456 + if ('' === showLabels) {
457 + return undefined;
458 + }
459 + return flagLabelSpacing;
460 +};
461 +;// ./js/src/blocks/hooks/use-memoized-flag.js
353 462 /**
354 463 * WordPress dependencies
355 464 */
356 -// '@wordpress/element' is provided by WordPress core.
357 -// eslint-disable-next-line import/no-extraneous-dependencies
358 465
359 466
360 467 /**
361 - * Hook to memoize the switcher label.
468 + * Strips fixed dimensions from flag HTML markup.
362 469 *
363 - * @param {Object} language The language object.
364 - * @param {boolean} showFlags Whether to show the flags.
365 - * @param {boolean} showNames Whether to show the names.
366 - * @return {Object} The memoized switcher label containing the text and the flag.
470 + * @param {string} html The flag HTML markup.
471 + * @return {string} The flag HTML without fixed dimensions.
367 472 */
368 -const useMemoizedSwitcherLabel = (language, showFlags, showNames) => {
369 - const {
370 - text,
371 - flag
372 - } = (0,external_this_wp_element_.useMemo)(() => {
373 - let memoizedText = '';
374 - if (showNames) {
375 - if (showFlags) {
376 - memoizedText = ` ${language.name}`;
377 - } else {
378 - memoizedText = language.name;
379 - }
380 - }
381 - const memoizedFlag = showFlags ? language.flag : '';
382 - return {
383 - text: memoizedText,
384 - flag: memoizedFlag
385 - };
386 - }, [language, showFlags, showNames]);
387 - return {
388 - text,
389 - flag
390 - };
473 +
474 +const stripFlagDimensions = html => {
475 + return html.replace(/\s(?:width|height)=["'][^"']*["']/gi, '').replace(/\sstyle=["'][^"']*["']/gi, '');
391 476 };
392 -;// ./js/src/blocks/language-switcher/components/switcher-list-element.js
393 -/**
394 - * Internal dependencies
395 - */
396 477
397 -
398 478 /**
399 - * Switcher list element component.
479 + * Returns a memoized flag element for a language.
400 480 *
401 - * @param {Object} props Component props.
402 - * @param {Object} props.language Language object.
403 - * @param {boolean} props.showFlags Whether to show the flags.
404 - * @param {boolean} props.showNames Whether to show the names.
405 - * @return {ReactElement} The Switcher element component.
481 + * @param {Object} language The language object.
482 + * @param {boolean} showFlags Whether to show the flags.
483 + * @param {number} flagBorderRadius The border radius of the flags.
484 + * @param {string} flagWidth The width of the flags as a CSS length.
485 + * @return {ReactElement|null} The flag for the language.
406 486 */
407 -
408 -const SwitcherListElement = ({
409 - language,
410 - showFlags,
411 - showNames
412 -}) => {
413 - const {
414 - text,
415 - flag
416 - } = useMemoizedSwitcherLabel(language, showFlags, showNames);
417 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
418 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
487 +const useMemoizedFlag = (language, showFlags, flagBorderRadius, flagWidth) => {
488 + return (0,external_this_wp_element_.useMemo)(() => {
489 + if (!showFlags || !language?.flag) {
490 + return null;
491 + }
492 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
493 + className: "pll-switcher-flag",
494 + style: {
495 + '--pll-flag-border-radius': flagBorderRadius,
496 + '--pll-flag-width': flagWidth
497 + },
419 498 dangerouslySetInnerHTML: {
420 - __html: flag
499 + __html: stripFlagDimensions(language.flag)
421 500 }
422 - }), " ", text, " "]
423 - });
501 + });
502 + }, [language?.flag, showFlags, flagBorderRadius, flagWidth]);
424 503 };
425 -;// ./js/src/blocks/language-switcher/components/switcher-ui.js
504 +;// ./js/src/blocks/components/switcher-language-link.js
426 505 /**
427 506 * Internal dependencies
428 507 */
429 508
430 509
510 +
511 +
431 512 /**
432 - * Switcher UI component.
513 + * Renders a language link for the switcher preview.
433 514 *
434 - * @param {Object} props The component props.
435 - * @param {Array} props.languages The languages to display.
436 - * @param {boolean} props.showFlags Whether to show the flags.
437 - * @param {boolean} props.showNames Whether to show the names.
438 - * @param {boolean} props.isDropdown Whether to show the dropdown.
439 - * @return {ReactElement} The Switcher UI component.
515 + * @param {Object} props Component props.
516 + * @param {Object} props.language The language object.
517 + * @param {string} props.showLabels Whether to show labels. Can be 'names', 'codes' or ''.
518 + * @param {boolean} props.showFlags Whether to show the flags.
519 + * @param {number} props.flagBorderRadius The border radius of the flags.
520 + * @param {string} props.flagWidth The width of the flags as a CSS length.
521 + * @param {string|undefined} props.labelSpacing CSS length for the space between flag and label.
522 + * @return {ReactElement} The language link element.
440 523 */
441 524
442 -const SwitcherUI = ({
443 - languages,
525 +const SwitcherLanguageLink = ({
526 + language,
527 + showLabels,
444 528 showFlags,
445 - showNames,
446 - isDropdown
529 + flagBorderRadius,
530 + flagWidth,
531 + labelSpacing
447 532 }) => {
448 - if (isDropdown) {
449 - return /*#__PURE__*/(0,jsx_runtime.jsx)("select", {
450 - children: languages.map(language => {
451 - return /*#__PURE__*/(0,jsx_runtime.jsx)("option", {
452 - value: language.slug,
453 - children: language.name
454 - }, language.slug);
455 - })
456 - });
457 - }
458 - return /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
459 - children: languages.map(language => {
460 - return /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherListElement, {
461 - language: language,
462 - showFlags: showFlags,
463 - showNames: showNames
464 - }, language.slug);
465 - })
533 + const flag = useMemoizedFlag(language, showFlags, flagBorderRadius, flagWidth);
534 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherLinkElement, {
535 + label: getLabel(language, showLabels),
536 + flag: flag,
537 + labelSpacing: labelSpacing
466 538 });
467 539 };
468 540 // EXTERNAL MODULE: external {"this":["wp","data"]}
469 541 var external_this_wp_data_ = __webpack_require__(987);
470 -// EXTERNAL MODULE: external {"this":["wp","editor"]}
471 -var external_this_wp_editor_ = __webpack_require__(2);
472 -;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-current-language.js
542 +;// ./js/src/blocks/hooks/use-current-language-with-editor-context.js
473 543 /**
474 544 * WordPress dependencies
475 545 */
476 546
477 -// This package is not found in `@wordpress/scripts` like others (peer dependency).
478 -// eslint-disable-next-line import/no-unresolved
479 547
480 -
481 548 /**
482 - * Custom hook to get the current language from the editor.
549 + * Finds a language by slug.
483 550 *
484 - * @param {Array} languages The languages list.
485 - * @return {Object|null} The current language, `null` if not found.
551 + * @param {Array} languages The languages list.
552 + * @param {string} slug The language slug.
553 + * @return {Object|null} The language, `null` if not found.
486 554 */
487 -const useCurrentLanguage = languages => {
488 - const currentPost = (0,external_this_wp_data_.useSelect)(select => select(external_this_wp_editor_.store).getCurrentPost());
489 - if (!languages || !currentPost) {
555 +const findLanguageBySlug = (languages, slug) => {
556 + if (!languages || !slug) {
490 557 return null;
491 558 }
492 - const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug; // eslint-disable-line no-undef
493 -
494 559 const currentLanguage = languages.find(language => {
495 - return language.slug === currentLanguageSlug;
560 + return language.slug === slug;
496 561 });
497 562 return currentLanguage ? currentLanguage : null;
498 563 };
499 -;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-curated-languages.js
564 +
500 565 /**
501 - * WordPress dependencies
566 + * Resolves the current language in block editor contexts.
567 + *
568 + * The widgets editor does not load `@wordpress/editor`, so the `core/editor`
569 + * store may be unavailable. In that context, fall back to the current language
570 + * slug injected by PHP (default language when none is set).
571 + *
572 + * @param {Array} languages The languages list.
573 + * @return {Object|null} The current language, `null` if not found.
502 574 */
575 +const useCurrentLanguageWithEditorContext = languages => {
576 + return (0,external_this_wp_data_.useSelect)(select => {
577 + if (!languages) {
578 + return null;
579 + }
580 + const editorStore = select('core/editor');
581 + if (!editorStore) {
582 + return findLanguageBySlug(languages, pllEditorCurrentLanguageSlug // eslint-disable-line no-undef
583 + );
584 + }
585 + const currentPost = editorStore.getCurrentPost();
586 + if (!currentPost) {
587 + return null;
588 + }
589 + const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug; // eslint-disable-line no-undef
503 590
591 + return findLanguageBySlug(languages, currentLanguageSlug);
592 + }, [languages]);
593 +};
594 +;// ./js/src/blocks/languages-context.js
595 +/**
596 + * WordPress dependencies.
597 + */
504 598
599 +
505 600 /**
506 - * Hook to curate the languages.
507 - * Returns an array of languages ensuring that the current language is always the first one.
601 + * Context for the languages.
508 602 *
509 - * @param {Object[]} languages The languages.
510 - * @param {Object} currentLanguage The current language.
511 - * @param {boolean} reduceToOneItem Whether to reduce the languages to one item.
512 - * @return {Object[]} The curated languages.
603 + * @type {React.Context<null>}
513 604 */
514 -const useCuratedLanguages = (languages, currentLanguage, reduceToOneItem) => {
515 - const curatedLanguages = (0,external_this_wp_element_.useMemo)(() => {
516 - if (!currentLanguage) {
517 - return [];
518 - }
519 - if (reduceToOneItem) {
520 - return [currentLanguage];
521 - }
522 - return [currentLanguage, ...languages.filter(language => {
523 - return language.slug !== currentLanguage.slug;
524 - })];
525 - }, [languages, currentLanguage, reduceToOneItem]);
526 - return curatedLanguages;
527 -};
528 -;// ./js/src/blocks/language-switcher/components/switcher-container.js
605 +const LanguagesContext = (0,external_this_wp_element_.createContext)(null);
606 +;// ./js/src/blocks/language-switcher/rendered-switcher.js
529 607 /**
530 608 * WordPress dependencies
531 609 */
532 610
@@ -531,8 +609,13 @@
531 609 */
532 610
533 611
534 612 /**
613 + * External dependencies
614 + */
615 +
616 +
617 +/**
535 618 * Internal dependencies
536 619 */
537 620
538 621
@@ -537,40 +620,94 @@
537 620
538 621
539 622
540 623
624 +
541 625 /**
542 - * Switcher container component.
626 + * Rendered switcher component.
543 627 *
544 628 * @param {Object} props The component props.
545 629 * @param {Object} props.attributes The block attributes.
546 - * @return {ReactElement} The Switcher component.
630 + * @return {ReactElement} The rendered switcher.
547 631 */
548 632
549 -const SwitcherContainer = ({
633 +const RenderedSwitcher = ({
550 634 attributes
551 635 }) => {
552 636 const {
553 - dropdown,
637 + layout,
638 + show_labels,
554 639 show_flags,
555 - show_names
640 + flag_aspect_ratio,
641 + flag_border_radius,
642 + flag_width,
643 + flag_label_spacing,
644 + style
556 645 } = attributes;
557 646 const {
558 647 languages
559 648 } = (0,external_this_wp_element_.useContext)(LanguagesContext);
560 - const currentLanguage = useCurrentLanguage(languages);
561 - const curatedLanguages = useCuratedLanguages(languages, currentLanguage, dropdown);
562 - return /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherUI, {
563 - languages: curatedLanguages,
649 + const currentLanguage = useCurrentLanguageWithEditorContext(languages);
650 + const curatedLanguages = useCuratedLanguages(languages, currentLanguage, false);
651 + const alignment = style?.typography?.textAlign;
652 + const switcherClassName = getSwitcherClassName(layout, show_flags, flag_aspect_ratio, alignment);
653 + const labelSpacing = getLabelSpacing(show_labels, flag_label_spacing);
654 + const linkProps = {
655 + showLabels: show_labels,
564 656 showFlags: show_flags,
565 - showNames: show_names,
566 - isDropdown: dropdown
657 + flagBorderRadius: flag_border_radius,
658 + flagWidth: flag_width,
659 + labelSpacing
660 + };
661 + if (layout === 'dropdown') {
662 + const currentLanguageItem = curatedLanguages[0];
663 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("nav", {
664 + className: switcherClassName,
665 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div", {
666 + className: "pll-switcher-inner",
667 + children: [currentLanguageItem && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherLanguageLink, {
668 + language: currentLanguageItem,
669 + ...linkProps
670 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("button", {
671 + className: "pll-submenu-toggle",
672 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(submenu, {})
673 + })]
674 + })
675 + });
676 + }
677 + if (layout === 'select') {
678 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div", {
679 + className: switcherClassName,
680 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("select", {
681 + className: "pll-switcher-select",
682 + children: curatedLanguages.map(language => {
683 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("option", {
684 + value: language.slug,
685 + children: getLabel(language, show_labels)
686 + }, language.slug);
687 + })
688 + })
689 + });
690 + }
691 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("nav", {
692 + className: switcherClassName,
693 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("ul", {
694 + children: curatedLanguages.map(language => {
695 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("li", {
696 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherLanguageLink, {
697 + language: language,
698 + ...linkProps
699 + })
700 + }, language.slug);
701 + })
702 + })
567 703 });
568 704 };
569 -// EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
570 -var external_this_wp_apiFetch_ = __webpack_require__(631);
571 -var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
572 -;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-languages-list.js
705 +// EXTERNAL MODULE: external {"this":["wp","i18n"]}
706 +var external_this_wp_i18n_ = __webpack_require__(75);
707 +// EXTERNAL MODULE: external {"this":["wp","notices"]}
708 +var external_this_wp_notices_ = __webpack_require__(672);
709 +;// ./js/src/blocks/components/switcher-controls.js
573 710 /**
574 711 * WordPress dependencies
575 712 */
576 713
@@ -575,22 +712,283 @@
575 712 */
576 713
577 714
578 715
716 +
717 +
718 +
719 +const CSS_LENGTH_UNITS = [{
720 + value: 'px',
721 + label: 'px'
722 +}, {
723 + value: 'em',
724 + label: 'em'
725 +}, {
726 + value: 'rem',
727 + label: 'rem'
728 +}, {
729 + value: 'vh',
730 + label: 'vh'
731 +}, {
732 + value: 'vw',
733 + label: 'vw'
734 +}];
735 +const LABEL_SPACING_DEFAULT_VALUE = '0.3em';
736 +const ALL_LAYOUT_OPTIONS = [{
737 + label: (0,external_this_wp_i18n_._x)('Horizontal', 'layout', 'polylang'),
738 + value: 'horizontal'
739 +}, {
740 + label: (0,external_this_wp_i18n_._x)('Vertical', 'layout', 'polylang'),
741 + value: 'vertical'
742 +}, {
743 + label: (0,external_this_wp_i18n_.__)('Dropdown', 'polylang'),
744 + value: 'dropdown'
745 +}, {
746 + label: (0,external_this_wp_i18n_.__)('Selector', 'polylang'),
747 + value: 'select'
748 +}];
749 +const ALL_LAYOUT_TOOLBAR_CONTROLS = [{
750 + title: (0,external_this_wp_i18n_._x)('Horizontal', 'layout', 'polylang'),
751 + layout: 'horizontal'
752 +}, {
753 + title: (0,external_this_wp_i18n_._x)('Vertical', 'layout', 'polylang'),
754 + layout: 'vertical'
755 +}, {
756 + title: (0,external_this_wp_i18n_.__)('Dropdown', 'polylang'),
757 + layout: 'dropdown'
758 +}];
759 +
579 760 /**
580 - * Custom hook to get the languages list.
761 + * Switcher controls component for toolbar and inspector controls.
581 762 *
582 - * @return {Array|null} The languages list, `null` if not loaded yet.
763 + * @param {Object} props The component props.
764 + * @param {Object} props.attributes The block attributes.
765 + * @param {Function} props.setAttributes The function to set the block attributes.
766 + * @param {Array<string>} props.layoutOptions Optional layout values to expose.
767 + * @return {React.ReactNode} The switcher controls component.
583 768 */
584 -const useLanguagesList = () => {
585 - const [languages, setLanguages] = (0,external_this_wp_element_.useState)(null);
586 - (0,external_this_wp_element_.useEffect)(() => {
587 - external_this_wp_apiFetch_default()({
588 - path: '/pll/v1/languages',
589 - method: 'GET'
590 - }).then(response => setLanguages(response));
591 - }, []);
592 - return languages;
769 +const SwitcherControls = ({
770 + attributes,
771 + setAttributes,
772 + layoutOptions = ['horizontal', 'vertical', 'dropdown', 'select']
773 +}) => {
774 + const {
775 + layout,
776 + show_labels,
777 + show_flags,
778 + force_home,
779 + hide_current,
780 + flag_aspect_ratio,
781 + flag_border_radius,
782 + flag_width,
783 + flag_label_spacing,
784 + hide_if_no_translation
785 + } = attributes;
786 + const {
787 + createWarningNotice
788 + } = (0,external_this_wp_data_.useDispatch)(external_this_wp_notices_.store);
789 + const layoutSelectOptions = ALL_LAYOUT_OPTIONS.filter(option => layoutOptions.includes(option.value));
790 + const layoutToolbarControls = ALL_LAYOUT_TOOLBAR_CONTROLS.filter(control => layoutOptions.includes(control.layout)).map(control => ({
791 + title: control.title,
792 + onClick: () => setAttributes({
793 + layout: control.layout
794 + })
795 + }));
796 + const labelOptions = [{
797 + label: (0,external_this_wp_i18n_.__)('Language names', 'polylang'),
798 + value: 'names'
799 + }, {
800 + label: (0,external_this_wp_i18n_.__)('Language codes', 'polylang'),
801 + value: 'codes'
802 + }];
803 + if (show_flags) {
804 + labelOptions.push({
805 + label: (0,external_this_wp_i18n_._x)('None', 'Labels', 'polylang'),
806 + value: ''
807 + });
808 + }
809 + const toolbarLabelControls = [{
810 + title: (0,external_this_wp_i18n_.__)('Language names', 'polylang'),
811 + onClick: () => setAttributes({
812 + show_labels: 'names'
813 + })
814 + }, {
815 + title: (0,external_this_wp_i18n_.__)('Language codes', 'polylang'),
816 + onClick: () => setAttributes({
817 + show_labels: 'codes'
818 + })
819 + }];
820 + if (show_flags) {
821 + toolbarLabelControls.push({
822 + title: (0,external_this_wp_i18n_._x)('None', 'Labels', 'polylang'),
823 + onClick: () => {
824 + if (!show_flags) {
825 + createWarningNotice((0,external_this_wp_i18n_.__)('Labels cannot be hidden if flags are not shown.', 'polylang'));
826 + return;
827 + }
828 + setAttributes({
829 + show_labels: '',
830 + flag_label_spacing: LABEL_SPACING_DEFAULT_VALUE
831 + });
832 + }
833 + });
834 + }
835 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)((react_jsx_runtime_production_min_namespaceFn().Fragment), {
836 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_blockEditor_.InspectorControls, {
837 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.PanelBody, {
838 + title: (0,external_this_wp_i18n_.__)('Display', 'polylang'),
839 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.SelectControl, {
840 + label: (0,external_this_wp_i18n_.__)('Layout', 'polylang'),
841 + value: layout,
842 + options: layoutSelectOptions,
843 + onChange: value => {
844 + setAttributes({
845 + layout: value
846 + });
847 + if ('select' === value) {
848 + setAttributes({
849 + show_flags: false
850 + });
851 + if ('' === show_labels) {
852 + setAttributes({
853 + show_labels: 'names'
854 + });
855 + }
856 + }
857 + },
858 + __next40pxDefaultSize: true
859 + }), 'select' !== layout && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.SelectControl, {
860 + label: (0,external_this_wp_i18n_.__)('Labels', 'polylang'),
861 + value: show_labels,
862 + options: labelOptions,
863 + onChange: value => {
864 + if ('' === value) {
865 + if (!show_flags) {
866 + createWarningNotice((0,external_this_wp_i18n_.__)('Labels cannot be hidden if flags are not shown.', 'polylang'));
867 + return;
868 + }
869 + setAttributes({
870 + show_labels: value,
871 + flag_label_spacing: LABEL_SPACING_DEFAULT_VALUE
872 + });
873 + return;
874 + }
875 + setAttributes({
876 + show_labels: value
877 + });
878 + },
879 + __next40pxDefaultSize: true
880 + })]
881 + }), 'select' !== layout && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.PanelBody, {
882 + title: (0,external_this_wp_i18n_.__)('Flags Settings', 'polylang'),
883 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
884 + label: (0,external_this_wp_i18n_.__)('Display flags', 'polylang'),
885 + checked: show_flags,
886 + onChange: value => {
887 + if ('' === show_labels && !value) {
888 + createWarningNotice((0,external_this_wp_i18n_.__)('Flags cannot be hidden if labels are not displayed.', 'polylang'));
889 + return;
890 + }
891 + setAttributes({
892 + show_flags: value
893 + });
894 + }
895 + }), show_flags && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)((react_jsx_runtime_production_min_namespaceFn().Fragment), {
896 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.RadioControl, {
897 + label: (0,external_this_wp_i18n_.__)('Aspect', 'polylang'),
898 + selected: flag_aspect_ratio,
899 + options: [{
900 + label: (0,external_this_wp_i18n_.__)('Landscape (3:2)', 'polylang'),
901 + value: '3:2'
902 + }, {
903 + label: (0,external_this_wp_i18n_.__)('Square (1:1)', 'polylang'),
904 + value: '1:1'
905 + }],
906 + onChange: value => setAttributes({
907 + flag_aspect_ratio: value
908 + })
909 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.RangeControl, {
910 + label: (0,external_this_wp_i18n_.__)('Border radius', 'polylang'),
911 + initialPosition: 0,
912 + value: flag_border_radius,
913 + min: 0,
914 + max: 100,
915 + step: 1,
916 + allowReset: true,
917 + resetFallbackValue: 0,
918 + onChange: value => setAttributes({
919 + flag_border_radius: value
920 + }),
921 + __next40pxDefaultSize: true
922 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.__experimentalUnitControl, {
923 + __next40pxDefaultSize: true,
924 + label: (0,external_this_wp_i18n_.__)('Size', 'polylang'),
925 + value: flag_width,
926 + units: CSS_LENGTH_UNITS,
927 + onChange: value => setAttributes({
928 + flag_width: value
929 + })
930 + }), '' !== show_labels && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.__experimentalUnitControl, {
931 + __next40pxDefaultSize: true,
932 + label: (0,external_this_wp_i18n_.__)('Label spacing', 'polylang'),
933 + value: flag_label_spacing,
934 + units: CSS_LENGTH_UNITS,
935 + onChange: value => setAttributes({
936 + flag_label_spacing: value
937 + })
938 + })]
939 + })]
940 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.PanelBody, {
941 + title: (0,external_this_wp_i18n_.__)('Behavior', 'polylang'),
942 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
943 + label: (0,external_this_wp_i18n_.__)('Force link to front page', 'polylang'),
944 + checked: force_home,
945 + onChange: value => setAttributes({
946 + force_home: value
947 + })
948 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
949 + label: (0,external_this_wp_i18n_.__)('Hide the current language', 'polylang'),
950 + checked: hide_current,
951 + onChange: value => setAttributes({
952 + hide_current: value
953 + })
954 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
955 + label: (0,external_this_wp_i18n_.__)('Hide languages with no translation', 'polylang'),
956 + checked: hide_if_no_translation,
957 + onChange: value => setAttributes({
958 + hide_if_no_translation: value
959 + })
960 + })]
961 + })]
962 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_blockEditor_.BlockControls, {
963 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.ToolbarGroup, {
964 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToolbarDropdownMenu, {
965 + label: (0,external_this_wp_i18n_.__)('Layout', 'polylang'),
966 + controls: layoutToolbarControls
967 + }), 'select' !== layout && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToolbarButton, {
968 + icon: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
969 + className: "dashicons dashicons-flag"
970 + }),
971 + label: show_flags ? (0,external_this_wp_i18n_.__)('Hide flags', 'polylang') : (0,external_this_wp_i18n_.__)('Display flags', 'polylang'),
972 + onClick: () => {
973 + if (show_flags && '' === show_labels) {
974 + createWarningNotice((0,external_this_wp_i18n_.__)('Flags cannot be hidden if labels are not displayed.', 'polylang'));
975 + return;
976 + }
977 + setAttributes({
978 + show_flags: !show_flags
979 + });
980 + }
981 + }), 'select' !== layout && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToolbarDropdownMenu, {
982 + icon: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
983 + className: "dashicons dashicons-editor-textcolor"
984 + }),
985 + label: (0,external_this_wp_i18n_.__)('Labels', 'polylang'),
986 + controls: toolbarLabelControls
987 + })]
988 + })
989 + })]
990 + });
593 991 };
594 992 ;// ./js/src/blocks/language-switcher/edit.js
595 993 /**
596 994 * Edit callback for language switcher block.
@@ -601,9 +999,8 @@
601 999 */
602 1000
603 1001
604 1002
605 -
606 1003 /**
607 1004 * Internal dependencies
608 1005 */
609 1006
@@ -613,39 +1010,31 @@
613 1010
614 1011 /**
615 1012 * Edit callback for language switcher block.
616 1013 *
617 - * @param {Object} props Block properties.
1014 + * @param {Object} props Block properties.
1015 + * @param {Object} props.attributes Block attributes.
1016 + * @param {Function} props.setAttributes Function to set block attributes.
618 1017 * @return {ReactElement} The block content and controls.
619 1018 */
620 1019
621 -const Edit = props => {
622 - const {
623 - dropdown
624 - } = props.attributes;
1020 +const Edit = ({
1021 + attributes,
1022 + setAttributes
1023 +}) => {
625 1024 const languages = useLanguagesList();
626 - const {
627 - ToggleControlDropdown,
628 - ToggleControlShowNames,
629 - ToggleControlShowFlags,
630 - ToggleControlForceHome,
631 - ToggleControlHideCurrent,
632 - ToggleControlHideIfNoTranslations
633 - } = createLanguageSwitcherEdit(props);
634 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
1025 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div", {
635 1026 ...(0,external_this_wp_blockEditor_.useBlockProps)(),
636 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_blockEditor_.InspectorControls, {
637 - children: /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_components_.PanelBody, {
638 - title: (0,external_this_wp_i18n_.__)('Language switcher settings', 'polylang'),
639 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlDropdown, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowNames, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideIfNoTranslations, {})]
640 - })
641 - }), /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.Disabled, {
642 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(LanguagesContext.Provider, {
1027 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherControls, {
1028 + attributes: attributes,
1029 + setAttributes: setAttributes
1030 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.Disabled, {
1031 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(LanguagesContext.Provider, {
643 1032 value: {
644 1033 languages
645 1034 },
646 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherContainer, {
647 - attributes: props.attributes
1035 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(RenderedSwitcher, {
1036 + attributes: attributes
648 1037 })
649 1038 })
650 1039 })]
651 1040 });
@@ -667,124 +1056,119 @@
667 1056 */
668 1057
669 1058
670 1059
1060 +
671 1061 (0,external_this_wp_blocks_.registerBlockType)(block_namespaceObject.UU, {
672 1062 icon: icons_translation,
673 - edit: Edit
1063 + edit: Edit,
1064 + deprecated: deprecated
674 1065 });
675 1066 // EXTERNAL MODULE: external {"this":["wp","hooks"]}
676 1067 var external_this_wp_hooks_ = __webpack_require__(873);
677 -;// ./js/src/blocks/navigation-language-switcher/components/switcher-link-element.js
1068 +;// ./js/src/blocks/navigation-language-switcher/deprecated.js
678 1069 /**
679 - * Internal dependencies
1070 + * Deprecated navigation language switcher block.
680 1071 */
681 1072
682 -
683 -/**
684 - * Switcher link element component.
685 - *
686 - * @param {Object} props Component props.
687 - * @param {Object} props.language Language object.
688 - * @param {boolean} props.isTopLevel Whether the language is the top level language.
689 - * @param {boolean} props.showFlags Whether to show the flags.
690 - * @param {boolean} props.showNames Whether to show the names.
691 - * @return {ReactElement} The Switcher element component.
692 - */
693 -
694 -const SwitcherLinkElement = ({
695 - language,
696 - isTopLevel,
697 - showFlags,
698 - showNames
699 -}) => {
700 - const {
701 - text,
702 - flag
703 - } = useMemoizedSwitcherLabel(language, showFlags, showNames);
704 - const prefix = isTopLevel ? '' : ' ';
705 - return (
706 - /*#__PURE__*/
707 - // eslint-disable-next-line jsx-a11y/anchor-is-valid
708 - (0,jsx_runtime.jsxs)("a", {
709 - href: '#',
710 - children: [prefix, /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
711 - dangerouslySetInnerHTML: {
712 - __html: flag
713 - }
714 - }), " ", text, " "]
715 - })
716 - );
1073 +const deprecated_V2Attributes = {
1074 + layout: 'horizontal',
1075 + show_labels: 'names',
1076 + show_flags: false,
1077 + force_home: false,
1078 + hide_current: false,
1079 + hide_if_no_translation: false,
1080 + flag_aspect_ratio: '3:2',
1081 + flag_border_radius: 0,
1082 + flag_width: '18px',
1083 + flag_label_spacing: '0.3em',
1084 + className: ''
717 1085 };
718 -;// ./node_modules/@wpsyntex/polylang-react-library/build/icons/submenu.js
1086 +const deprecated_v1 = {
1087 + attributes: {
1088 + dropdown: {
1089 + type: 'boolean',
1090 + default: false
1091 + },
1092 + show_names: {
1093 + type: 'boolean',
1094 + default: true
1095 + },
1096 + show_flags: {
1097 + type: 'boolean',
1098 + default: false
1099 + },
1100 + force_home: {
1101 + type: 'boolean',
1102 + default: false
1103 + },
1104 + hide_current: {
1105 + type: 'boolean',
1106 + default: false
1107 + },
1108 + hide_if_no_translation: {
1109 + type: 'boolean',
1110 + default: false
1111 + },
1112 + className: {
1113 + type: 'string',
1114 + default: ''
1115 + }
1116 + },
1117 + isEligible: attributes => 'dropdown' in attributes || 'show_names' in attributes,
1118 + migrate(attributes) {
1119 + const {
1120 + dropdown,
1121 + show_names,
1122 + show_flags,
1123 + force_home,
1124 + hide_current,
1125 + hide_if_no_translation,
1126 + className
1127 + } = attributes;
1128 + return {
1129 + ...deprecated_V2Attributes,
1130 + layout: dropdown ? 'dropdown' : 'horizontal',
1131 + show_labels: show_names ? 'names' : '',
1132 + show_flags: show_names ? show_flags : true,
1133 + force_home,
1134 + hide_current,
1135 + hide_if_no_translation,
1136 + className: className || ''
1137 + };
1138 + }
1139 +};
1140 +/* harmony default export */ const navigation_language_switcher_deprecated = ([deprecated_v1]);
1141 +// EXTERNAL MODULE: external {"this":["wp","editor"]}
1142 +var external_this_wp_editor_ = __webpack_require__(2);
1143 +;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-current-language.js
719 1144 /**
720 - * Submenu icon
721 - */
722 -
723 -/**
724 1145 * WordPress dependencies
725 1146 */
726 1147
1148 +// This package is not found in `@wordpress/scripts` like others (peer dependency).
1149 +// eslint-disable-next-line import/no-unresolved
727 1150
728 -const submenu_isPrimitivesComponents = 'undefined' !== typeof wp.primitives;
729 -const SubmenuIcon = () => submenu_isPrimitivesComponents ? /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.SVG, {
730 - xmlns: "http://www.w3.org/2000/svg",
731 - width: "12",
732 - height: "12",
733 - viewBox: "0 0 12 12",
734 - fill: "none",
735 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.Path, {
736 - d: "M1.50002 4L6.00002 8L10.5 4",
737 - strokeWidth: "1.5"
738 - })
739 -}) : 'submenu';
740 -/* harmony default export */ const submenu = (SubmenuIcon);
741 -;// ./js/src/blocks/navigation-language-switcher/components/switcher-ui.js
742 -/**
743 - * WordPress dependencies
744 - */
745 1151
746 -
747 1152 /**
748 - * Internal dependencies
749 - */
750 -
751 -
752 -
753 -/**
754 - * Switcher UI component.
1153 + * Custom hook to get the current language from the editor.
755 1154 *
756 - * @param {Object} props The component props.
757 - * @param {Array} props.languages The languages to display.
758 - * @param {boolean} props.showFlags Whether to show the flags.
759 - * @param {boolean} props.showNames Whether to show the names.
760 - * @param {boolean} props.withSubmenuIcon Whether to show the submenu icon.
761 - * @return {ReactElement} The Switcher UI component.
1155 + * @param {Array} languages The languages list.
1156 + * @return {Object|null} The current language, `null` if not found.
762 1157 */
1158 +const useCurrentLanguage = languages => {
1159 + const currentPost = (0,external_this_wp_data_.useSelect)(select => select(external_this_wp_editor_.store).getCurrentPost());
1160 + if (!languages || !currentPost) {
1161 + return null;
1162 + }
1163 + const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug; // eslint-disable-line no-undef
763 1164
764 -const switcher_ui_SwitcherUI = ({
765 - languages,
766 - showFlags,
767 - showNames,
768 - withSubmenuIcon
769 -}) => {
770 - return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
771 - children: languages && languages.map(language => {
772 - return /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_element_.Fragment, {
773 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherLinkElement, {
774 - language: language,
775 - isTopLevel: languages.indexOf(language) === 0,
776 - showFlags: showFlags,
777 - showNames: showNames
778 - }), withSubmenuIcon && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
779 - className: "wp-block-navigation__submenu-icon",
780 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(submenu, {})
781 - })]
782 - }, language.slug);
783 - })
1165 + const currentLanguage = languages.find(language => {
1166 + return language.slug === currentLanguageSlug;
784 1167 });
1168 + return currentLanguage ? currentLanguage : null;
785 1169 };
786 -;// ./js/src/blocks/navigation-language-switcher/components/navigation-switcher-container.js
1170 +;// ./js/src/blocks/navigation-language-switcher/rendered-switcher.js
787 1171 /**
788 1172 * WordPress dependencies
789 1173 */
790 1174
@@ -789,8 +1173,13 @@
789 1173 */
790 1174
791 1175
792 1176 /**
1177 + * External dependencies
1178 + */
1179 +
1180 +
1181 +/**
793 1182 * Internal dependencies
794 1183 */
795 1184
796 1185
@@ -796,24 +1185,27 @@
796 1185
797 1186
798 1187
799 1188 /**
800 - * Switcher container component.
1189 + * Rendered switcher component.
801 1190 *
802 1191 * @param {Object} props The component props.
803 1192 * @param {Object} props.attributes The block attributes.
804 1193 * @param {Object} props.context The block context.
805 - * @return {ReactElement} The Switcher component.
1194 + * @return {ReactElement} The rendered switcher.
806 1195 */
807 1196
808 -const NavigationSwitcherContainer = ({
1197 +const rendered_switcher_RenderedSwitcher = ({
809 1198 attributes,
810 1199 context
811 1200 }) => {
812 1201 const {
813 - dropdown,
1202 + layout,
1203 + show_labels,
814 1204 show_flags,
815 - show_names
1205 + flag_border_radius,
1206 + flag_width,
1207 + flag_label_spacing
816 1208 } = attributes;
817 1209 const {
818 1210 showSubmenuIcon,
819 1211 openSubmenusOnClick
@@ -821,14 +1213,31 @@
821 1213 const {
822 1214 languages
823 1215 } = (0,external_this_wp_element_.useContext)(LanguagesContext);
824 1216 const currentLanguage = useCurrentLanguage(languages);
825 - const curatedLanguages = useCuratedLanguages(languages, currentLanguage, dropdown);
826 - return /*#__PURE__*/(0,jsx_runtime.jsx)(switcher_ui_SwitcherUI, {
827 - languages: curatedLanguages,
828 - showFlags: Boolean(show_flags),
829 - showNames: Boolean(show_names),
830 - withSubmenuIcon: Boolean((showSubmenuIcon || openSubmenusOnClick) && dropdown)
1217 + const isDropdown = layout === 'dropdown';
1218 + const languagesToRender = useCuratedLanguages(languages, currentLanguage, isDropdown);
1219 + const labelSpacing = getLabelSpacing(show_labels, flag_label_spacing);
1220 + const withSubmenuIcon = isDropdown && (showSubmenuIcon || openSubmenusOnClick);
1221 + const linkProps = {
1222 + showLabels: show_labels,
1223 + showFlags: show_flags,
1224 + flagBorderRadius: flag_border_radius,
1225 + flagWidth: flag_width,
1226 + labelSpacing
1227 + };
1228 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)((react_jsx_runtime_production_min_namespaceFn().Fragment), {
1229 + children: languagesToRender.map(language => {
1230 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_element_.Fragment, {
1231 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherLanguageLink, {
1232 + language: language,
1233 + ...linkProps
1234 + }), withSubmenuIcon && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
1235 + className: "wp-block-navigation__submenu-icon",
1236 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(submenu, {})
1237 + })]
1238 + }, language.slug);
1239 + })
831 1240 });
832 1241 };
833 1242 ;// ./js/src/blocks/navigation-language-switcher/edit.js
834 1243 /**
@@ -840,9 +1249,8 @@
840 1249 */
841 1250
842 1251
843 1252
844 -
845 1253 /**
846 1254 * Internal dependencies
847 1255 */
848 1256
@@ -852,40 +1260,42 @@
852 1260
853 1261 /**
854 1262 * Edit callback for navigation language switcher block.
855 1263 *
856 - * @param {Object} props Block properties.
1264 + * @param {Object} props Block properties.
1265 + * @param {Object} props.attributes Block attributes.
1266 + * @param {Object} props.context Block context.
1267 + * @param {Function} props.setAttributes Function to set block attributes.
857 1268 * @return {ReactElement} The block content and controls.
858 1269 */
859 1270
860 -const edit_Edit = props => {
861 - const {
862 - dropdown
863 - } = props.attributes;
1271 +const edit_Edit = ({
1272 + attributes,
1273 + context,
1274 + setAttributes
1275 +}) => {
864 1276 const languages = useLanguagesList();
865 1277 const {
866 - ToggleControlDropdown,
867 - ToggleControlShowNames,
868 - ToggleControlShowFlags,
869 - ToggleControlForceHome,
870 - ToggleControlHideCurrent,
871 - ToggleControlHideIfNoTranslations
872 - } = createLanguageSwitcherEdit(props);
873 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
874 - ...(0,external_this_wp_blockEditor_.useBlockProps)(),
875 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_blockEditor_.InspectorControls, {
876 - children: /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_components_.PanelBody, {
877 - title: (0,external_this_wp_i18n_.__)('Language switcher settings', 'polylang'),
878 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlDropdown, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowNames, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideIfNoTranslations, {})]
879 - })
880 - }), /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.Disabled, {
881 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(LanguagesContext.Provider, {
1278 + show_flags,
1279 + flag_aspect_ratio
1280 + } = attributes;
1281 + const aspectRatioClass = show_flags && flag_aspect_ratio ? `pll-aspect-ratio-${flag_aspect_ratio.replace(':', '')}` : '';
1282 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div", {
1283 + ...(0,external_this_wp_blockEditor_.useBlockProps)({
1284 + className: aspectRatioClass || undefined
1285 + }),
1286 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherControls, {
1287 + attributes: attributes,
1288 + setAttributes: setAttributes,
1289 + layoutOptions: ['horizontal', 'dropdown']
1290 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.Disabled, {
1291 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(LanguagesContext.Provider, {
882 1292 value: {
883 1293 languages
884 1294 },
885 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(NavigationSwitcherContainer, {
886 - attributes: props.attributes,
887 - context: props.context
1295 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(rendered_switcher_RenderedSwitcher, {
1296 + attributes: attributes,
1297 + context: context
888 1298 })
889 1299 })
890 1300 })]
891 1301 });
@@ -979,8 +1389,9 @@
979 1389
980 1390
981 1391
982 1392
1393 +
983 1394 (0,external_this_wp_blocks_.registerBlockType)(Navigation_block_namespaceObject.UU, {
984 1395 icon: icons_translation,
985 1396 transforms: {
986 1397 from: [{
@@ -988,9 +1399,10 @@
988 1399 blocks: ['core/navigation-link'],
989 1400 transform: () => (0,external_this_wp_blocks_.createBlock)(Navigation_block_namespaceObject.UU)
990 1401 }]
991 1402 },
992 - edit: edit_Edit
1403 + edit: edit_Edit,
1404 + deprecated: navigation_language_switcher_deprecated
993 1405 });
994 1406
995 1407 /**
996 1408 * Hooks to the classic menu conversion to core/navigation block to be able to convert