diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
commit | 30883c26bdceb9eaf32c8d4a1b0c1bce223b5226 (patch) | |
tree | 39a02e2aeb21ab5b7923c6f5757d66d55b708912 /wp-includes/blocks/search | |
parent | Adding upstream version 6.4.3+dfsg1. (diff) | |
download | wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.tar.xz wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.zip |
Adding upstream version 6.5+dfsg1.upstream/6.5+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/blocks/search')
-rw-r--r-- | wp-includes/blocks/search/block.json | 5 | ||||
-rw-r--r-- | wp-includes/blocks/search/editor-rtl.css | 1 | ||||
-rw-r--r-- | wp-includes/blocks/search/editor-rtl.min.css | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/editor.css | 1 | ||||
-rw-r--r-- | wp-includes/blocks/search/editor.min.css | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/style-rtl.css | 54 | ||||
-rw-r--r-- | wp-includes/blocks/search/style-rtl.min.css | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/style.css | 54 | ||||
-rw-r--r-- | wp-includes/blocks/search/style.min.css | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/view.asset.php | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/view.js | 187 | ||||
-rw-r--r-- | wp-includes/blocks/search/view.min.asset.php | 2 | ||||
-rw-r--r-- | wp-includes/blocks/search/view.min.js | 2 |
13 files changed, 166 insertions, 150 deletions
diff --git a/wp-includes/blocks/search/block.json b/wp-includes/blocks/search/block.json index 5669a90..8d5e208 100644 --- a/wp-includes/blocks/search/block.json +++ b/wp-includes/blocks/search/block.json @@ -43,10 +43,6 @@ "type": "object", "default": {} }, - "buttonBehavior": { - "type": "string", - "default": "expand-searchfield" - }, "isSearchFieldHidden": { "type": "boolean", "default": false @@ -91,7 +87,6 @@ }, "html": false }, - "viewScript": "file:./view.min.js", "editorStyle": "wp-block-search-editor", "style": "wp-block-search" } diff --git a/wp-includes/blocks/search/editor-rtl.css b/wp-includes/blocks/search/editor-rtl.css index 05eeacf..26babe4 100644 --- a/wp-includes/blocks/search/editor-rtl.css +++ b/wp-includes/blocks/search/editor-rtl.css @@ -8,6 +8,7 @@ display:flex; height:auto; justify-content:center; + text-align:center; } .wp-block-search__components-button-group{ margin-top:10px; diff --git a/wp-includes/blocks/search/editor-rtl.min.css b/wp-includes/blocks/search/editor-rtl.min.css index b9c22f4..f24037c 100644 --- a/wp-includes/blocks/search/editor-rtl.min.css +++ b/wp-includes/blocks/search/editor-rtl.min.css @@ -1 +1 @@ -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center}.wp-block-search__components-button-group{margin-top:10px}
\ No newline at end of file +.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center;text-align:center}.wp-block-search__components-button-group{margin-top:10px}
\ No newline at end of file diff --git a/wp-includes/blocks/search/editor.css b/wp-includes/blocks/search/editor.css index 05eeacf..26babe4 100644 --- a/wp-includes/blocks/search/editor.css +++ b/wp-includes/blocks/search/editor.css @@ -8,6 +8,7 @@ display:flex; height:auto; justify-content:center; + text-align:center; } .wp-block-search__components-button-group{ margin-top:10px; diff --git a/wp-includes/blocks/search/editor.min.css b/wp-includes/blocks/search/editor.min.css index b9c22f4..f24037c 100644 --- a/wp-includes/blocks/search/editor.min.css +++ b/wp-includes/blocks/search/editor.min.css @@ -1 +1 @@ -.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center}.wp-block-search__components-button-group{margin-top:10px}
\ No newline at end of file +.wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search .wp-block-search__button{align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center;text-align:center}.wp-block-search__components-button-group{margin-top:10px}
\ No newline at end of file diff --git a/wp-includes/blocks/search/style-rtl.css b/wp-includes/blocks/search/style-rtl.css index ff60086..755681c 100644 --- a/wp-includes/blocks/search/style-rtl.css +++ b/wp-includes/blocks/search/style-rtl.css @@ -6,9 +6,11 @@ line-height:0; } .wp-block-search__button svg{ - fill:currentColor; + height:1.25em; min-height:24px; min-width:24px; + width:1.25em; + fill:currentColor; vertical-align:text-bottom; } @@ -43,8 +45,33 @@ .wp-block-search.wp-block-search__button-only .wp-block-search__button{ flex-shrink:0; margin-right:0; + max-width:100%; +} +.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{ max-width:calc(100% - 100px); } +.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ + min-width:0 !important; + transition-property:width; +} +.wp-block-search.wp-block-search__button-only .wp-block-search__input{ + flex-basis:100%; + transition-duration:.3s; +} +.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ + overflow:hidden; +} +.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{ + border-left-width:0 !important; + border-right-width:0 !important; + flex-basis:0; + flex-grow:0; + margin:0; + min-width:0 !important; + padding-left:0 !important; + padding-right:0 !important; + width:0 !important; +} :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){ border:1px solid #949494; @@ -67,29 +94,6 @@ margin:auto; } -.wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{ - min-width:0 !important; - transition-property:width; -} -.wp-block-search__button-behavior-expand .wp-block-search__input{ - flex-basis:100%; - transition-duration:.3s; -} -.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden,.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ - overflow:hidden; -} -.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__input{ - border-left-width:0 !important; - border-right-width:0 !important; - flex-basis:0; - flex-grow:0; - margin:0; - min-width:0 !important; - padding-left:0 !important; - padding-right:0 !important; - width:0 !important; -} - -.wp-block[data-align=right] .wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{ +.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ float:left; }
\ No newline at end of file diff --git a/wp-includes/blocks/search/style-rtl.min.css b/wp-includes/blocks/search/style-rtl.min.css index 73dea5a..19f9266 100644 --- a/wp-includes/blocks/search/style-rtl.min.css +++ b/wp-includes/blocks/search/style-rtl.min.css @@ -1 +1 @@ -.wp-block-search__button{margin-right:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{fill:currentColor;min-height:24px;min-width:24px;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{-webkit-appearance:initial;appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-right:0;max-width:calc(100% - 100px)}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search__button-behavior-expand .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden,.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}.wp-block[data-align=right] .wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{float:left}
\ No newline at end of file +.wp-block-search__button{margin-right:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{height:1.25em;min-height:24px;min-width:24px;width:1.25em;fill:currentColor;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{-webkit-appearance:initial;appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-right:0;max-width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{max-width:calc(100% - 100px)}.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search.wp-block-search__button-only .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{float:left}
\ No newline at end of file diff --git a/wp-includes/blocks/search/style.css b/wp-includes/blocks/search/style.css index 91fe4f7..536a2d1 100644 --- a/wp-includes/blocks/search/style.css +++ b/wp-includes/blocks/search/style.css @@ -6,9 +6,11 @@ line-height:0; } .wp-block-search__button svg{ - fill:currentColor; + height:1.25em; min-height:24px; min-width:24px; + width:1.25em; + fill:currentColor; vertical-align:text-bottom; } @@ -43,8 +45,33 @@ .wp-block-search.wp-block-search__button-only .wp-block-search__button{ flex-shrink:0; margin-left:0; + max-width:100%; +} +.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{ max-width:calc(100% - 100px); } +.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ + min-width:0 !important; + transition-property:width; +} +.wp-block-search.wp-block-search__button-only .wp-block-search__input{ + flex-basis:100%; + transition-duration:.3s; +} +.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ + overflow:hidden; +} +.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{ + border-left-width:0 !important; + border-right-width:0 !important; + flex-basis:0; + flex-grow:0; + margin:0; + min-width:0 !important; + padding-left:0 !important; + padding-right:0 !important; + width:0 !important; +} :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){ border:1px solid #949494; @@ -67,29 +94,6 @@ margin:auto; } -.wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{ - min-width:0 !important; - transition-property:width; -} -.wp-block-search__button-behavior-expand .wp-block-search__input{ - flex-basis:100%; - transition-duration:.3s; -} -.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden,.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ - overflow:hidden; -} -.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__input{ - border-left-width:0 !important; - border-right-width:0 !important; - flex-basis:0; - flex-grow:0; - margin:0; - min-width:0 !important; - padding-left:0 !important; - padding-right:0 !important; - width:0 !important; -} - -.wp-block[data-align=right] .wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{ +.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ float:right; }
\ No newline at end of file diff --git a/wp-includes/blocks/search/style.min.css b/wp-includes/blocks/search/style.min.css index c744f37..82d39a5 100644 --- a/wp-includes/blocks/search/style.min.css +++ b/wp-includes/blocks/search/style.min.css @@ -1 +1 @@ -.wp-block-search__button{margin-left:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{fill:currentColor;min-height:24px;min-width:24px;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{-webkit-appearance:initial;appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-left:0;max-width:calc(100% - 100px)}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search__button-behavior-expand .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden,.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search__button-behavior-expand.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}.wp-block[data-align=right] .wp-block-search__button-behavior-expand .wp-block-search__inside-wrapper{float:right}
\ No newline at end of file +.wp-block-search__button{margin-left:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{height:1.25em;min-height:24px;min-width:24px;width:1.25em;fill:currentColor;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{-webkit-appearance:initial;appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-left:0;max-width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{max-width:calc(100% - 100px)}.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search.wp-block-search__button-only .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{float:right}
\ No newline at end of file diff --git a/wp-includes/blocks/search/view.asset.php b/wp-includes/blocks/search/view.asset.php index 9ecb989..e9b5021 100644 --- a/wp-includes/blocks/search/view.asset.php +++ b/wp-includes/blocks/search/view.asset.php @@ -1 +1 @@ -<?php return array('dependencies' => array(), 'version' => 'bbd4958a430d8ba14c4c'); +<?php return array('dependencies' => array(), 'version' => '2a0784014283afdd3c25'); diff --git a/wp-includes/blocks/search/view.js b/wp-includes/blocks/search/view.js index 9d18abf..2234847 100644 --- a/wp-includes/blocks/search/view.js +++ b/wp-includes/blocks/search/view.js @@ -1,101 +1,112 @@ -"use strict"; -(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[222],{ +import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; -/***/ 534: -/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { - -/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(754); +;// CONCATENATED MODULE: external "@wordpress/interactivity" +var x = (y) => { + var x = {}; __webpack_require__.d(x, y); return x +} +var y = (x) => (() => (x)) +const interactivity_namespaceObject = x({ ["getContext"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext), ["getElement"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement), ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) }); +;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/view.js /** * WordPress dependencies */ -(0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .store */ .h)({ - selectors: { - core: { - search: { - ariaLabel: ({ - context - }) => { - const { - ariaLabelCollapsed, - ariaLabelExpanded - } = context.core.search; - return context.core.search.isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed; - }, - ariaControls: ({ - context - }) => { - return context.core.search.isSearchInputVisible ? null : context.core.search.inputId; - }, - type: ({ - context - }) => { - return context.core.search.isSearchInputVisible ? 'submit' : 'button'; - }, - tabindex: ({ - context - }) => { - return context.core.search.isSearchInputVisible ? '0' : '-1'; - } - } +const { + actions +} = (0,interactivity_namespaceObject.store)('core/search', { + state: { + get ariaLabel() { + const { + isSearchInputVisible, + ariaLabelCollapsed, + ariaLabelExpanded + } = (0,interactivity_namespaceObject.getContext)(); + return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed; + }, + get ariaControls() { + const { + isSearchInputVisible, + inputId + } = (0,interactivity_namespaceObject.getContext)(); + return isSearchInputVisible ? null : inputId; + }, + get type() { + const { + isSearchInputVisible + } = (0,interactivity_namespaceObject.getContext)(); + return isSearchInputVisible ? 'submit' : 'button'; + }, + get tabindex() { + const { + isSearchInputVisible + } = (0,interactivity_namespaceObject.getContext)(); + return isSearchInputVisible ? '0' : '-1'; } }, actions: { - core: { - search: { - openSearchInput: ({ - context, - event, - ref - }) => { - if (!context.core.search.isSearchInputVisible) { - event.preventDefault(); - context.core.search.isSearchInputVisible = true; - ref.parentElement.querySelector('input').focus(); - } - }, - closeSearchInput: ({ - context - }) => { - context.core.search.isSearchInputVisible = false; - }, - handleSearchKeydown: store => { - const { - actions, - event, - ref - } = store; - // If Escape close the menu. - if (event?.key === 'Escape') { - actions.core.search.closeSearchInput(store); - ref.querySelector('button').focus(); - } - }, - handleSearchFocusout: store => { - const { - actions, - event, - ref - } = store; - // If focus is outside search form, and in the document, close menu - // event.target === The element losing focus - // event.relatedTarget === The element receiving focus (if any) - // When focusout is outside the document, - // `window.document.activeElement` doesn't change. - if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) { - actions.core.search.closeSearchInput(store); - } - } + openSearchInput(event) { + const ctx = (0,interactivity_namespaceObject.getContext)(); + const { + ref + } = (0,interactivity_namespaceObject.getElement)(); + if (!ctx.isSearchInputVisible) { + event.preventDefault(); + ctx.isSearchInputVisible = true; + ref.parentElement.querySelector('input').focus(); + } + }, + closeSearchInput() { + const ctx = (0,interactivity_namespaceObject.getContext)(); + ctx.isSearchInputVisible = false; + }, + handleSearchKeydown(event) { + const { + ref + } = (0,interactivity_namespaceObject.getElement)(); + // If Escape close the menu. + if (event?.key === 'Escape') { + actions.closeSearchInput(); + ref.querySelector('button').focus(); + } + }, + handleSearchFocusout(event) { + const { + ref + } = (0,interactivity_namespaceObject.getElement)(); + // If focus is outside search form, and in the document, close menu + // event.target === The element losing focus + // event.relatedTarget === The element receiving focus (if any) + // When focusout is outside the document, + // `window.document.activeElement` doesn't change. + if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) { + actions.closeSearchInput(); } } } +}, { + lock: true }); -/***/ }) - -}, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } -/******/ var __webpack_exports__ = (__webpack_exec__(534)); -/******/ } -]);
\ No newline at end of file diff --git a/wp-includes/blocks/search/view.min.asset.php b/wp-includes/blocks/search/view.min.asset.php index dc204c9..f9f2fdd 100644 --- a/wp-includes/blocks/search/view.min.asset.php +++ b/wp-includes/blocks/search/view.min.asset.php @@ -1 +1 @@ -<?php return array('dependencies' => array(), 'version' => 'ff76b5016de2df424c55'); +<?php return array('dependencies' => array(), 'version' => '765a40956d200c79d99e'); diff --git a/wp-includes/blocks/search/view.min.js b/wp-includes/blocks/search/view.min.js index f38519d..3f154f9 100644 --- a/wp-includes/blocks/search/view.min.js +++ b/wp-includes/blocks/search/view.min.js @@ -1 +1 @@ -"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[222],{534:function(e,t,c){(0,c(754).h)({selectors:{core:{search:{ariaLabel:({context:e})=>{const{ariaLabelCollapsed:t,ariaLabelExpanded:c}=e.core.search;return e.core.search.isSearchInputVisible?c:t},ariaControls:({context:e})=>e.core.search.isSearchInputVisible?null:e.core.search.inputId,type:({context:e})=>e.core.search.isSearchInputVisible?"submit":"button",tabindex:({context:e})=>e.core.search.isSearchInputVisible?"0":"-1"}}},actions:{core:{search:{openSearchInput:({context:e,event:t,ref:c})=>{e.core.search.isSearchInputVisible||(t.preventDefault(),e.core.search.isSearchInputVisible=!0,c.parentElement.querySelector("input").focus())},closeSearchInput:({context:e})=>{e.core.search.isSearchInputVisible=!1},handleSearchKeydown:e=>{const{actions:t,event:c,ref:r}=e;"Escape"===c?.key&&(t.core.search.closeSearchInput(e),r.querySelector("button").focus())},handleSearchFocusout:e=>{const{actions:t,event:c,ref:r}=e;r.contains(c.relatedTarget)||c.target===window.document.activeElement||t.core.search.closeSearchInput(e)}}}}})}},function(e){var t;t=534,e(e.s=t)}]);
\ No newline at end of file +import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store}),{actions:r}=(0,n.store)("core/search",{state:{get ariaLabel(){const{isSearchInputVisible:e,ariaLabelCollapsed:t,ariaLabelExpanded:r}=(0,n.getContext)();return e?r:t},get ariaControls(){const{isSearchInputVisible:e,inputId:t}=(0,n.getContext)();return e?null:t},get type(){const{isSearchInputVisible:e}=(0,n.getContext)();return e?"submit":"button"},get tabindex(){const{isSearchInputVisible:e}=(0,n.getContext)();return e?"0":"-1"}},actions:{openSearchInput(e){const t=(0,n.getContext)(),{ref:r}=(0,n.getElement)();t.isSearchInputVisible||(e.preventDefault(),t.isSearchInputVisible=!0,r.parentElement.querySelector("input").focus())},closeSearchInput(){(0,n.getContext)().isSearchInputVisible=!1},handleSearchKeydown(e){const{ref:t}=(0,n.getElement)();"Escape"===e?.key&&(r.closeSearchInput(),t.querySelector("button").focus())},handleSearchFocusout(e){const{ref:t}=(0,n.getElement)();t.contains(e.relatedTarget)||e.target===window.document.activeElement||r.closeSearchInput()}}},{lock:!0});
\ No newline at end of file |