class-wp-rest-term-search-handler.php 0000644 00000011032 14751055205 0013605 0 ustar 00 <?php
/**
* REST API: WP_REST_Term_Search_Handler class
*
* @package WordPress
* @subpackage REST_API
* @since 5.6.0
*/
/**
* Core class representing a search handler for terms in the REST API.
*
* @since 5.6.0
*
* @see WP_REST_Search_Handler
*/
class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler {
/**
* Constructor.
*
* @since 5.6.0
*/
public function __construct() {
$this->type = 'term';
$this->subtypes = array_values(
get_taxonomies(
array(
'public' => true,
'show_in_rest' => true,
),
'names'
)
);
}
/**
* Searches terms for a given search request.
*
* @since 5.6.0
*
* @param WP_REST_Request $request Full REST request.
* @return array {
* Associative array containing found IDs and total count for the matching search results.
*
* @type int[] $ids Found term IDs.
* @type string|int|WP_Error $total Numeric string containing the number of terms in that
* taxonomy, 0 if there are no results, or WP_Error if
* the requested taxonomy does not exist.
* }
*/
public function search_items( WP_REST_Request $request ) {
$taxonomies = $request[ WP_REST_Search_Controller::PROP_SUBTYPE ];
if ( in_array( WP_REST_Search_Controller::TYPE_ANY, $taxonomies, true ) ) {
$taxonomies = $this->subtypes;
}
$page = (int) $request['page'];
$per_page = (int) $request['per_page'];
$query_args = array(
'taxonomy' => $taxonomies,
'hide_empty' => false,
'offset' => ( $page - 1 ) * $per_page,
'number' => $per_page,
);
if ( ! empty( $request['search'] ) ) {
$query_args['search'] = $request['search'];
}
if ( ! empty( $request['exclude'] ) ) {
$query_args['exclude'] = $request['exclude'];
}
if ( ! empty( $request['include'] ) ) {
$query_args['include'] = $request['include'];
}
/**
* Filters the query arguments for a REST API term search request.
*
* Enables adding extra arguments or setting defaults for a term search request.
*
* @since 5.6.0
*
* @param array $query_args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
*/
$query_args = apply_filters( 'rest_term_search_query', $query_args, $request );
$query = new WP_Term_Query();
$found_terms = $query->query( $query_args );
$found_ids = wp_list_pluck( $found_terms, 'term_id' );
unset( $query_args['offset'], $query_args['number'] );
$total = wp_count_terms( $query_args );
// wp_count_terms() can return a falsey value when the term has no children.
if ( ! $total ) {
$total = 0;
}
return array(
self::RESULT_IDS => $found_ids,
self::RESULT_TOTAL => $total,
);
}
/**
* Prepares the search result for a given term ID.
*
* @since 5.6.0
*
* @param int $id Term ID.
* @param array $fields Fields to include for the term.
* @return array {
* Associative array containing fields for the term based on the `$fields` parameter.
*
* @type int $id Optional. Term ID.
* @type string $title Optional. Term name.
* @type string $url Optional. Term permalink URL.
* @type string $type Optional. Term taxonomy name.
* }
*/
public function prepare_item( $id, array $fields ) {
$term = get_term( $id );
$data = array();
if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_ID ] = (int) $id;
}
if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_TITLE ] = $term->name;
}
if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_URL ] = get_term_link( $id );
}
if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_TYPE ] = $term->taxonomy;
}
return $data;
}
/**
* Prepares links for the search result of a given ID.
*
* @since 5.6.0
*
* @param int $id Item ID.
* @return array[] Array of link arrays for the given item.
*/
public function prepare_item_links( $id ) {
$term = get_term( $id );
$links = array();
$item_route = rest_get_route_for_term( $term );
if ( $item_route ) {
$links['self'] = array(
'href' => rest_url( $item_route ),
'embeddable' => true,
);
}
$links['about'] = array(
'href' => rest_url( sprintf( 'wp/v2/taxonomies/%s', $term->taxonomy ) ),
);
return $links;
}
}
class-wp-rest-post-format-search-handler.php 0000644 00000007544 14751055205 0015126 0 ustar 00 <?php
/**
* REST API: WP_REST_Post_Format_Search_Handler class
*
* @package WordPress
* @subpackage REST_API
* @since 5.6.0
*/
/**
* Core class representing a search handler for post formats in the REST API.
*
* @since 5.6.0
*
* @see WP_REST_Search_Handler
*/
class WP_REST_Post_Format_Search_Handler extends WP_REST_Search_Handler {
/**
* Constructor.
*
* @since 5.6.0
*/
public function __construct() {
$this->type = 'post-format';
}
/**
* Searches the post formats for a given search request.
*
* @since 5.6.0
*
* @param WP_REST_Request $request Full REST request.
* @return array {
* Associative array containing found IDs and total count for the matching search results.
*
* @type string[] $ids Array containing slugs for the matching post formats.
* @type int $total Total count for the matching search results.
* }
*/
public function search_items( WP_REST_Request $request ) {
$format_strings = get_post_format_strings();
$format_slugs = array_keys( $format_strings );
$query_args = array();
if ( ! empty( $request['search'] ) ) {
$query_args['search'] = $request['search'];
}
/**
* Filters the query arguments for a REST API post format search request.
*
* Enables adding extra arguments or setting defaults for a post format search request.
*
* @since 5.6.0
*
* @param array $query_args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
*/
$query_args = apply_filters( 'rest_post_format_search_query', $query_args, $request );
$found_ids = array();
foreach ( $format_slugs as $index => $format_slug ) {
if ( ! empty( $query_args['search'] ) ) {
$format_string = get_post_format_string( $format_slug );
$format_slug_match = stripos( $format_slug, $query_args['search'] ) !== false;
$format_string_match = stripos( $format_string, $query_args['search'] ) !== false;
if ( ! $format_slug_match && ! $format_string_match ) {
continue;
}
}
$format_link = get_post_format_link( $format_slug );
if ( $format_link ) {
$found_ids[] = $format_slug;
}
}
$page = (int) $request['page'];
$per_page = (int) $request['per_page'];
return array(
self::RESULT_IDS => array_slice( $found_ids, ( $page - 1 ) * $per_page, $per_page ),
self::RESULT_TOTAL => count( $found_ids ),
);
}
/**
* Prepares the search result for a given post format.
*
* @since 5.6.0
*
* @param string $id Item ID, the post format slug.
* @param array $fields Fields to include for the item.
* @return array {
* Associative array containing fields for the post format based on the `$fields` parameter.
*
* @type string $id Optional. Post format slug.
* @type string $title Optional. Post format name.
* @type string $url Optional. Post format permalink URL.
* @type string $type Optional. String 'post-format'.
*}
*/
public function prepare_item( $id, array $fields ) {
$data = array();
if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_ID ] = $id;
}
if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_TITLE ] = get_post_format_string( $id );
}
if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_URL ] = get_post_format_link( $id );
}
if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_TYPE ] = $this->type;
}
return $data;
}
/**
* Prepares links for the search result.
*
* @since 5.6.0
*
* @param string $id Item ID, the post format slug.
* @return array Links for the given item.
*/
public function prepare_item_links( $id ) {
return array();
}
}
class-wp-rest-search-handler.php 0000644 00000004367 14751055205 0012655 0 ustar 00 <?php
/**
* REST API: WP_REST_Search_Handler class
*
* @package WordPress
* @subpackage REST_API
* @since 5.0.0
*/
/**
* Core base class representing a search handler for an object type in the REST API.
*
* @since 5.0.0
*/
#[AllowDynamicProperties]
abstract class WP_REST_Search_Handler {
/**
* Field containing the IDs in the search result.
*/
const RESULT_IDS = 'ids';
/**
* Field containing the total count in the search result.
*/
const RESULT_TOTAL = 'total';
/**
* Object type managed by this search handler.
*
* @since 5.0.0
* @var string
*/
protected $type = '';
/**
* Object subtypes managed by this search handler.
*
* @since 5.0.0
* @var string[]
*/
protected $subtypes = array();
/**
* Gets the object type managed by this search handler.
*
* @since 5.0.0
*
* @return string Object type identifier.
*/
public function get_type() {
return $this->type;
}
/**
* Gets the object subtypes managed by this search handler.
*
* @since 5.0.0
*
* @return string[] Array of object subtype identifiers.
*/
public function get_subtypes() {
return $this->subtypes;
}
/**
* Searches the object type content for a given search request.
*
* @since 5.0.0
*
* @param WP_REST_Request $request Full REST request.
* @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
* an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
* total count for the matching search results.
*/
abstract public function search_items( WP_REST_Request $request );
/**
* Prepares the search result for a given ID.
*
* @since 5.0.0
* @since 5.6.0 The `$id` parameter can accept a string.
*
* @param int|string $id Item ID.
* @param array $fields Fields to include for the item.
* @return array Associative array containing all fields for the item.
*/
abstract public function prepare_item( $id, array $fields );
/**
* Prepares links for the search result of a given ID.
*
* @since 5.0.0
* @since 5.6.0 The `$id` parameter can accept a string.
*
* @param int|string $id Item ID.
* @return array Links for the given item.
*/
abstract public function prepare_item_links( $id );
}
class-wp-rest-post-search-handler.php 0000644 00000013370 14751055205 0013632 0 ustar 00 <?php
/**
* REST API: WP_REST_Post_Search_Handler class
*
* @package WordPress
* @subpackage REST_API
* @since 5.0.0
*/
/**
* Core class representing a search handler for posts in the REST API.
*
* @since 5.0.0
*
* @see WP_REST_Search_Handler
*/
class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler {
/**
* Constructor.
*
* @since 5.0.0
*/
public function __construct() {
$this->type = 'post';
// Support all public post types except attachments.
$this->subtypes = array_diff(
array_values(
get_post_types(
array(
'public' => true,
'show_in_rest' => true,
),
'names'
)
),
array( 'attachment' )
);
}
/**
* Searches posts for a given search request.
*
* @since 5.0.0
*
* @param WP_REST_Request $request Full REST request.
* @return array {
* Associative array containing found IDs and total count for the matching search results.
*
* @type int[] $ids Array containing the matching post IDs.
* @type int $total Total count for the matching search results.
* }
*/
public function search_items( WP_REST_Request $request ) {
// Get the post types to search for the current request.
$post_types = $request[ WP_REST_Search_Controller::PROP_SUBTYPE ];
if ( in_array( WP_REST_Search_Controller::TYPE_ANY, $post_types, true ) ) {
$post_types = $this->subtypes;
}
$query_args = array(
'post_type' => $post_types,
'post_status' => 'publish',
'paged' => (int) $request['page'],
'posts_per_page' => (int) $request['per_page'],
'ignore_sticky_posts' => true,
);
if ( ! empty( $request['search'] ) ) {
$query_args['s'] = $request['search'];
}
if ( ! empty( $request['exclude'] ) ) {
$query_args['post__not_in'] = $request['exclude'];
}
if ( ! empty( $request['include'] ) ) {
$query_args['post__in'] = $request['include'];
}
/**
* Filters the query arguments for a REST API post search request.
*
* Enables adding extra arguments or setting defaults for a post search request.
*
* @since 5.1.0
*
* @param array $query_args Key value array of query var to query value.
* @param WP_REST_Request $request The request used.
*/
$query_args = apply_filters( 'rest_post_search_query', $query_args, $request );
$query = new WP_Query();
$posts = $query->query( $query_args );
// Querying the whole post object will warm the object cache, avoiding an extra query per result.
$found_ids = wp_list_pluck( $posts, 'ID' );
$total = $query->found_posts;
return array(
self::RESULT_IDS => $found_ids,
self::RESULT_TOTAL => $total,
);
}
/**
* Prepares the search result for a given post ID.
*
* @since 5.0.0
*
* @param int $id Post ID.
* @param array $fields Fields to include for the post.
* @return array {
* Associative array containing fields for the post based on the `$fields` parameter.
*
* @type int $id Optional. Post ID.
* @type string $title Optional. Post title.
* @type string $url Optional. Post permalink URL.
* @type string $type Optional. Post type.
* }
*/
public function prepare_item( $id, array $fields ) {
$post = get_post( $id );
$data = array();
if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_ID ] = (int) $post->ID;
}
if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) {
if ( post_type_supports( $post->post_type, 'title' ) ) {
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
$data[ WP_REST_Search_Controller::PROP_TITLE ] = get_the_title( $post->ID );
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
} else {
$data[ WP_REST_Search_Controller::PROP_TITLE ] = '';
}
}
if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_URL ] = get_permalink( $post->ID );
}
if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_TYPE ] = $this->type;
}
if ( in_array( WP_REST_Search_Controller::PROP_SUBTYPE, $fields, true ) ) {
$data[ WP_REST_Search_Controller::PROP_SUBTYPE ] = $post->post_type;
}
return $data;
}
/**
* Prepares links for the search result of a given ID.
*
* @since 5.0.0
*
* @param int $id Item ID.
* @return array Links for the given item.
*/
public function prepare_item_links( $id ) {
$post = get_post( $id );
$links = array();
$item_route = rest_get_route_for_post( $post );
if ( ! empty( $item_route ) ) {
$links['self'] = array(
'href' => rest_url( $item_route ),
'embeddable' => true,
);
}
$links['about'] = array(
'href' => rest_url( 'wp/v2/types/' . $post->post_type ),
);
return $links;
}
/**
* Overwrites the default protected title format.
*
* By default, WordPress will show password protected posts with a title of
* "Protected: %s". As the REST API communicates the protected status of a post
* in a machine readable format, we remove the "Protected: " prefix.
*
* @since 5.0.0
*
* @return string Protected title format.
*/
public function protected_title_format() {
return '%s';
}
/**
* Attempts to detect the route to access a single item.
*
* @since 5.0.0
* @deprecated 5.5.0 Use rest_get_route_for_post()
* @see rest_get_route_for_post()
*
* @param WP_Post $post Post object.
* @return string REST route relative to the REST base URI, or empty string if unknown.
*/
protected function detect_rest_item_route( $post ) {
_deprecated_function( __METHOD__, '5.5.0', 'rest_get_route_for_post()' );
return rest_get_route_for_post( $post );
}
}
style.css 0000644 00000005222 14751057573 0006435 0 ustar 00 .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{
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__input){
font-family:inherit;
font-size:inherit;
font-style:inherit;
font-weight:inherit;
letter-spacing:inherit;
line-height:inherit;
text-transform:inherit;
}
: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;
} editor-rtl.min.css 0000644 00000000452 14751057573 0010144 0 ustar 00 .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} theme-rtl.min.css 0000644 00000000176 14751057573 0007763 0 ustar 00 .wp-block-search .wp-block-search__label{font-weight:700}.wp-block-search__button{border:1px solid #ccc;padding:.375em .625em} theme.css 0000644 00000000215 14751057573 0006374 0 ustar 00 .wp-block-search .wp-block-search__label{
font-weight:700;
}
.wp-block-search__button{
border:1px solid #ccc;
padding:.375em .625em;
} view.js 0000644 00000007611 14751057573 0006077 0 ustar 00 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__ = {};
;// 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
*/
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: {
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
});
theme.min.css 0000644 00000000176 14751057573 0007164 0 ustar 00 .wp-block-search .wp-block-search__label{font-weight:700}.wp-block-search__button{border:1px solid #ccc;padding:.375em .625em} editor.min.css 0000644 00000000452 14751057573 0007345 0 ustar 00 .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} view.min.asset.php 0000644 00000000124 14751057573 0010142 0 ustar 00 <?php return array('dependencies' => array(), 'version' => '765a40956d200c79d99e');
style-rtl.css 0000644 00000005223 14751057573 0007235 0 ustar 00 .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{
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__input){
font-family:inherit;
font-size:inherit;
font-style:inherit;
font-weight:inherit;
letter-spacing:inherit;
line-height:inherit;
text-transform:inherit;
}
: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;
} editor.css 0000644 00000000513 14751057573 0006561 0 ustar 00 .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;
} style-rtl.min.css 0000644 00000004626 14751057573 0010025 0 ustar 00 .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{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__input){font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-transform:inherit}: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} theme-rtl.css 0000644 00000000215 14751057573 0007173 0 ustar 00 .wp-block-search .wp-block-search__label{
font-weight:700;
}
.wp-block-search__button{
border:1px solid #ccc;
padding:.375em .625em;
} view.asset.php 0000644 00000000124 14751057573 0007360 0 ustar 00 <?php return array('dependencies' => array(), 'version' => '2a0784014283afdd3c25');
style.min.css 0000644 00000004625 14751057573 0007225 0 ustar 00 .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{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__input){font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-transform:inherit}: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} editor-rtl.css 0000644 00000000513 14751057573 0007360 0 ustar 00 .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;
} view.min.js 0000644 00000002437 14751057573 0006662 0 ustar 00 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}); block.json 0000644 00000003750 14751057573 0006554 0 ustar 00 {
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "core/search",
"title": "Search",
"category": "widgets",
"description": "Help visitors find your content.",
"keywords": [ "find" ],
"textdomain": "default",
"attributes": {
"label": {
"type": "string",
"__experimentalRole": "content"
},
"showLabel": {
"type": "boolean",
"default": true
},
"placeholder": {
"type": "string",
"default": "",
"__experimentalRole": "content"
},
"width": {
"type": "number"
},
"widthUnit": {
"type": "string"
},
"buttonText": {
"type": "string",
"__experimentalRole": "content"
},
"buttonPosition": {
"type": "string",
"default": "button-outside"
},
"buttonUseIcon": {
"type": "boolean",
"default": false
},
"query": {
"type": "object",
"default": {}
},
"isSearchFieldHidden": {
"type": "boolean",
"default": false
}
},
"supports": {
"align": [ "left", "center", "right" ],
"color": {
"gradients": true,
"__experimentalSkipSerialization": true,
"__experimentalDefaultControls": {
"background": true,
"text": true
}
},
"interactivity": true,
"typography": {
"__experimentalSkipSerialization": true,
"__experimentalSelector": ".wp-block-search__label, .wp-block-search__input, .wp-block-search__button",
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true,
"__experimentalFontWeight": true,
"__experimentalFontStyle": true,
"__experimentalTextTransform": true,
"__experimentalTextDecoration": true,
"__experimentalLetterSpacing": true,
"__experimentalDefaultControls": {
"fontSize": true
}
},
"__experimentalBorder": {
"color": true,
"radius": true,
"width": true,
"__experimentalSkipSerialization": true,
"__experimentalDefaultControls": {
"color": true,
"radius": true,
"width": true
}
},
"html": false
},
"editorStyle": "wp-block-search-editor",
"style": "wp-block-search"
}