@wordpress/block-library 7.7.0 → 7.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/audio/edit.js +1 -0
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +6 -1
- package/build/audio/index.js.map +1 -1
- package/build/audio/save.js +2 -1
- package/build/audio/save.js.map +1 -1
- package/build/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/column/deprecated.js.map +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +1 -1
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +1 -1
- package/build/columns/utils.js.map +1 -1
- package/build/columns/variations.js +2 -2
- package/build/columns/variations.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -3
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/index.js +1 -1
- package/build/comments/deprecated.js +65 -0
- package/build/comments/deprecated.js.map +1 -0
- package/build/comments/edit.js +10 -2
- package/build/comments/edit.js.map +1 -1
- package/build/comments/index.js +5 -2
- package/build/comments/index.js.map +1 -1
- package/build/comments-pagination/index.js +1 -1
- package/build/comments-title/deprecated.js +1 -4
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +1 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +5 -22
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +3 -1
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +38 -30
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +34 -6
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js.map +1 -1
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/deprecated.js +6 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-preview.js +1 -0
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/icons.js +21 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/index.js +6 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/save.js +1 -0
- package/build/embed/save.js.map +1 -1
- package/build/embed/transforms.js +6 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +6 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +11 -0
- package/build/embed/variations.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js.map +1 -1
- package/build/file/save.js +1 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +10 -18
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +1 -1
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +27 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +32 -22
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +7 -18
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/v1/edit.js +3 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery-image.js +1 -0
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/gallery/v1/gallery-image.native.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/gallery/v1/save.js +10 -2
- package/build/gallery/v1/save.js.map +1 -1
- package/build/group/edit.js +1 -3
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/autogenerate-anchors.js +7 -2
- package/build/heading/autogenerate-anchors.js.map +1 -1
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/edit.js.map +1 -1
- package/build/heading/heading-level-dropdown.js +2 -1
- package/build/heading/heading-level-dropdown.js.map +1 -1
- package/build/heading/index.js +9 -4
- package/build/heading/index.js.map +1 -1
- package/build/html/edit.js +11 -20
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +48 -0
- package/build/html/preview.js.map +1 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.native.js +2 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -0
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +5 -0
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +1 -0
- package/build/image/save.js.map +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +2 -1
- package/build/image/utils.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +2 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/transforms.js +33 -17
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +7 -4
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +36 -15
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/media-text/deprecated.js +5 -3
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.js +3 -3
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +3 -1
- package/build/media-text/save.js.map +1 -1
- package/build/missing/edit.native.js.map +1 -1
- package/build/more/edit.js +2 -4
- package/build/more/edit.js.map +1 -1
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/index.js +9 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +72 -38
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +4 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view.js +6 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +14 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +0 -16
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +6 -1
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/nextpage/edit.js +1 -3
- package/build/nextpage/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +2 -2
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/deprecated.js +1 -1
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +14 -6
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +1 -1
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +10 -24
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +4 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-terms/index.js +1 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/query/edit/index.js +5 -1
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/query-toolbar.js +16 -2
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/index.js.map +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js.map +1 -1
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +8 -25
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/edit/level-toolbar.js +2 -1
- package/build/site-title/edit/level-toolbar.js.map +1 -1
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +1 -0
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +6 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +2 -1
- package/build/table/save.js.map +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +4 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +4 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/index.js +1 -1
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +0 -16
- package/build/template-part/variations.js.map +1 -1
- package/build/transformationCategories.native.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -3
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +1 -0
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +43 -0
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +6 -1
- package/build/video/index.js.map +1 -1
- package/build/video/save.js +1 -0
- package/build/video/save.js.map +1 -1
- package/build/video/tracks-editor.js +9 -11
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +2 -1
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +6 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/audio/save.js +3 -2
- package/build-module/audio/save.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +2 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +2 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +2 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +2 -2
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/columns/variations.js +2 -2
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comments/deprecated.js +54 -0
- package/build-module/comments/deprecated.js.map +1 -0
- package/build-module/comments/edit.js +10 -2
- package/build-module/comments/edit.js.map +1 -1
- package/build-module/comments/index.js +4 -2
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-pagination/index.js +1 -1
- package/build-module/comments-title/deprecated.js +1 -4
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +1 -1
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +6 -21
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +3 -1
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +39 -31
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +32 -7
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/deprecated.js +6 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +2 -1
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/icons.js +19 -0
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/index.js +6 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/save.js +2 -1
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/transforms.js +6 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +6 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +12 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/save.js +2 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +11 -18
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +2 -2
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +25 -8
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +33 -23
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +6 -16
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/v1/edit.js +4 -4
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js +2 -1
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/gallery/v1/save.js +8 -3
- package/build-module/gallery/v1/save.js.map +1 -1
- package/build-module/group/edit.js +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/autogenerate-anchors.js +5 -2
- package/build-module/heading/autogenerate-anchors.js.map +1 -1
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/heading-level-dropdown.js +2 -1
- package/build-module/heading/heading-level-dropdown.js.map +1 -1
- package/build-module/heading/index.js +9 -4
- package/build-module/heading/index.js.map +1 -1
- package/build-module/html/edit.js +12 -23
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +38 -0
- package/build-module/html/preview.js.map +1 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.native.js +2 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +5 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +2 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +2 -2
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +3 -3
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/transforms.js +32 -17
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +7 -4
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +34 -15
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js.map +1 -1
- package/build-module/media-text/deprecated.js +3 -1
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.js +3 -1
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +4 -1
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/more/edit.js +2 -4
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/index.js +9 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +73 -39
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +4 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view.js +6 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +14 -8
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/hooks.js +0 -13
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +6 -1
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/nextpage/edit.js +1 -3
- package/build-module/nextpage/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +2 -2
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/deprecated.js +2 -2
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +14 -7
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +2 -2
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +10 -23
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +4 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-terms/index.js +1 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +5 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +14 -2
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +2 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js.map +1 -1
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +8 -24
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/edit/level-toolbar.js +2 -1
- package/build-module/site-title/edit/level-toolbar.js.map +1 -1
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +2 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +6 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +3 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +4 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +4 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/index.js +1 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +0 -13
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/transformationCategories.native.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -2
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +2 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +42 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +6 -1
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/save.js +2 -1
- package/build-module/video/save.js.map +1 -1
- package/build-module/video/tracks-editor.js +9 -11
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/audio/style-rtl.css +0 -3
- package/build-style/audio/style.css +0 -3
- package/build-style/button/style-rtl.css +5 -5
- package/build-style/button/style.css +5 -5
- package/build-style/comment-template/style-rtl.css +12 -0
- package/build-style/comment-template/style.css +12 -0
- package/build-style/common-rtl.css +1 -3
- package/build-style/common.css +1 -3
- package/build-style/cover/editor-rtl.css +11 -0
- package/build-style/cover/editor.css +11 -0
- package/build-style/cover/style-rtl.css +1 -2
- package/build-style/cover/style.css +1 -2
- package/build-style/editor-rtl.css +15 -40
- package/build-style/editor.css +15 -40
- package/build-style/elements-rtl.css +82 -0
- package/build-style/elements.css +82 -0
- package/build-style/embed/style-rtl.css +0 -1
- package/build-style/embed/style.css +0 -1
- package/build-style/file/style-rtl.css +11 -12
- package/build-style/file/style.css +11 -12
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/image/style-rtl.css +0 -3
- package/build-style/image/style.css +0 -3
- package/build-style/navigation/style-rtl.css +9 -1
- package/build-style/navigation/style.css +9 -1
- package/build-style/post-comments/style-rtl.css +2 -1
- package/build-style/post-comments/style.css +2 -1
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/post-featured-image/editor-rtl.css +0 -27
- package/build-style/post-featured-image/editor.css +0 -27
- package/build-style/post-template/style-rtl.css +9 -18
- package/build-style/post-template/style.css +9 -18
- package/build-style/query/editor-rtl.css +1 -1
- package/build-style/query/editor.css +1 -1
- package/build-style/search/style-rtl.css +9 -11
- package/build-style/search/style.css +9 -11
- package/build-style/search/theme-rtl.css +5 -0
- package/build-style/search/theme.css +5 -0
- package/build-style/site-logo/editor-rtl.css +0 -12
- package/build-style/site-logo/editor.css +0 -12
- package/build-style/style-rtl.css +69 -70
- package/build-style/style.css +69 -70
- package/build-style/table/style-rtl.css +0 -1
- package/build-style/table/style.css +0 -1
- package/build-style/theme-rtl.css +5 -0
- package/build-style/theme.css +5 -0
- package/build-style/video/style-rtl.css +1 -5
- package/build-style/video/style.css +1 -5
- package/package.json +30 -29
- package/src/audio/block.json +6 -1
- package/src/audio/edit.js +4 -0
- package/src/audio/index.js +1 -2
- package/src/audio/save.js +12 -2
- package/src/audio/style.scss +0 -2
- package/src/avatar/hooks.js +2 -2
- package/src/block/edit.js +4 -6
- package/src/block/edit.native.js +12 -16
- package/src/block/test/edit.native.js +5 -8
- package/src/button/deprecated.js +10 -46
- package/src/button/edit.js +6 -12
- package/src/button/edit.native.js +2 -3
- package/src/button/save.js +4 -12
- package/src/button/style.scss +10 -5
- package/src/buttons/deprecated.js +4 -6
- package/src/buttons/edit.js +3 -3
- package/src/buttons/edit.native.js +7 -11
- package/src/column/deprecated.js +2 -1
- package/src/column/edit.js +2 -3
- package/src/column/edit.native.js +2 -2
- package/src/columns/deprecated.js +4 -2
- package/src/columns/edit.js +6 -7
- package/src/columns/edit.native.js +12 -16
- package/src/columns/index.js +1 -2
- package/src/columns/utils.js +5 -3
- package/src/columns/variations.js +2 -2
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comment-template/block.json +1 -1
- package/src/comment-template/style.scss +14 -0
- package/src/comments/block.json +1 -1
- package/src/comments/deprecated.js +53 -0
- package/src/comments/edit.js +24 -4
- package/src/comments/index.js +2 -0
- package/src/comments-pagination/block.json +1 -1
- package/src/comments-title/block.json +1 -1
- package/src/comments-title/deprecated.js +0 -2
- package/src/comments-title/edit.js +1 -1
- package/src/comments-title/index.php +1 -1
- package/src/cover/block.json +1 -0
- package/src/cover/controls.native.js +2 -4
- package/src/cover/deprecated.js +10 -15
- package/src/cover/edit/block-controls.js +15 -40
- package/src/cover/edit/cover-placeholder.js +2 -0
- package/src/cover/edit/index.js +74 -55
- package/src/cover/edit/inspector-controls.js +38 -7
- package/src/cover/edit.native.js +8 -13
- package/src/cover/editor.scss +13 -0
- package/src/cover/index.php +21 -8
- package/src/cover/save.js +2 -3
- package/src/cover/test/edit.native.js +4 -7
- package/src/cover/transforms.js +2 -7
- package/src/elements.scss +6 -0
- package/src/embed/block.json +6 -1
- package/src/embed/edit.js +38 -40
- package/src/embed/edit.native.js +46 -49
- package/src/embed/embed-controls.native.js +2 -3
- package/src/embed/embed-preview.js +8 -1
- package/src/embed/icons.js +25 -0
- package/src/embed/save.js +10 -2
- package/src/embed/style.scss +0 -1
- package/src/embed/test/__snapshots__/index.native.js.snap +1 -1
- package/src/embed/test/index.native.js +24 -50
- package/src/embed/variations.js +10 -0
- package/src/file/edit.js +6 -6
- package/src/file/edit.native.js +14 -25
- package/src/file/index.js +1 -2
- package/src/file/save.js +2 -2
- package/src/file/style.scss +16 -15
- package/src/freeform/editor.scss +0 -2
- package/src/gallery/edit.js +16 -27
- package/src/gallery/gallery.js +9 -2
- package/src/gallery/gallery.native.js +2 -4
- package/src/gallery/index.js +2 -4
- package/src/gallery/index.php +5 -1
- package/src/gallery/save.js +5 -1
- package/src/gallery/shared.js +22 -9
- package/src/gallery/test/__snapshots__/index.native.js.snap +2 -2
- package/src/gallery/test/helpers.native.js +11 -198
- package/src/gallery/test/index.native.js +37 -63
- package/src/gallery/transforms.js +28 -13
- package/src/gallery/use-get-media.js +11 -28
- package/src/gallery/v1/edit.js +18 -24
- package/src/gallery/v1/gallery-image.js +10 -11
- package/src/gallery/v1/gallery-image.native.js +8 -17
- package/src/gallery/v1/gallery.js +8 -2
- package/src/gallery/v1/save.js +20 -3
- package/src/group/block.json +1 -0
- package/src/group/edit.js +1 -3
- package/src/heading/autogenerate-anchors.js +8 -5
- package/src/heading/deprecated.js +6 -21
- package/src/heading/edit.js +2 -3
- package/src/heading/heading-level-dropdown.js +1 -0
- package/src/heading/index.js +8 -2
- package/src/html/edit.js +10 -40
- package/src/html/preview.js +46 -0
- package/src/image/block.json +5 -0
- package/src/image/deprecated.js +6 -29
- package/src/image/edit.native.js +15 -26
- package/src/image/image.js +33 -38
- package/src/image/save.js +10 -2
- package/src/image/style.scss +0 -2
- package/src/image/test/edit.native.js +51 -19
- package/src/image/transforms.js +4 -3
- package/src/image/utils.js +2 -2
- package/src/index.js +1 -1
- package/src/latest-comments/edit.js +2 -6
- package/src/latest-posts/edit.js +7 -12
- package/src/latest-posts/edit.native.js +10 -15
- package/src/list/index.js +1 -2
- package/src/list/test/migrate.js +1 -2
- package/src/list/v2/edit.js +6 -9
- package/src/list/v2/transforms.js +22 -7
- package/src/list-item/hooks/use-backspace.js +2 -3
- package/src/list-item/hooks/use-enter.js +11 -9
- package/src/list-item/hooks/use-indent-list-item.js +2 -3
- package/src/list-item/hooks/use-outdent-list-item.js +50 -24
- package/src/list-item/hooks/use-space.js +2 -3
- package/src/media-text/deprecated.js +6 -3
- package/src/media-text/edit.native.js +2 -5
- package/src/media-text/media-container.js +1 -1
- package/src/media-text/media-container.native.js +6 -9
- package/src/media-text/save.js +2 -1
- package/src/missing/edit.native.js +2 -3
- package/src/missing/test/edit-integration.native.js +2 -3
- package/src/missing/test/edit.native.js +6 -9
- package/src/more/edit.js +9 -11
- package/src/navigation/block.json +9 -0
- package/src/navigation/deprecated.js +2 -5
- package/src/navigation/edit/index.js +25 -36
- package/src/navigation/edit/navigation-menu-delete-control.js +2 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +31 -30
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +2 -3
- package/src/navigation/style.scss +11 -2
- package/src/navigation/test/use-navigation-menu.js +241 -0
- package/src/navigation/use-navigation-entities.js +11 -13
- package/src/navigation/use-navigation-menu.js +95 -82
- package/src/navigation/use-template-part-area-label.js +8 -7
- package/src/navigation/view.js +6 -1
- package/src/navigation-link/edit.js +24 -20
- package/src/navigation-link/hooks.js +0 -14
- package/src/navigation-link/index.js +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
- package/src/navigation-link/test/edit.js +2 -4
- package/src/navigation-link/test/hooks.js +0 -12
- package/src/navigation-submenu/edit.js +10 -20
- package/src/navigation-submenu/view.js +6 -1
- package/src/nextpage/edit.js +1 -3
- package/src/page-list/convert-to-links-modal.js +51 -54
- package/src/page-list/edit.js +9 -11
- package/src/page-list/test/convert-to-links-modal.js +6 -12
- package/src/paragraph/deprecated.js +2 -2
- package/src/pattern/edit.js +2 -4
- package/src/post-author/edit.js +2 -3
- package/src/post-comments/index.php +1 -1
- package/src/post-comments/style.scss +7 -3
- package/src/post-comments-form/edit.js +24 -10
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +2 -2
- package/src/post-comments-form/index.php +1 -1
- package/src/post-content/edit.js +2 -3
- package/src/post-featured-image/edit.js +14 -30
- package/src/post-featured-image/editor.scss +0 -29
- package/src/post-featured-image/index.php +4 -2
- package/src/post-navigation-link/block.json +4 -0
- package/src/post-template/index.php +23 -17
- package/src/post-template/style.scss +1 -7
- package/src/post-terms/index.js +1 -1
- package/src/post-title/block.json +1 -0
- package/src/pullquote/deprecated.js +2 -1
- package/src/query/edit/index.js +10 -10
- package/src/query/edit/inspector-controls/index.js +1 -1
- package/src/query/edit/inspector-controls/parent-control.js +2 -3
- package/src/query/edit/query-toolbar.js +25 -5
- package/src/query/editor.scss +1 -1
- package/src/query/index.js +1 -1
- package/src/query-no-results/index.php +10 -8
- package/src/quote/v2/edit.js +4 -6
- package/src/quote/v2/test/migrate.js +1 -2
- package/src/search/edit.js +8 -14
- package/src/search/edit.native.js +4 -6
- package/src/search/index.php +12 -10
- package/src/search/style.scss +11 -9
- package/src/search/theme.scss +5 -0
- package/src/separator/use-deprecated-opacity.js +2 -4
- package/src/shortcode/edit.native.js +4 -3
- package/src/shortcode/test/edit.native.js +2 -5
- package/src/site-logo/edit.js +5 -28
- package/src/site-logo/editor.scss +0 -14
- package/src/site-title/edit/level-toolbar.js +1 -0
- package/src/social-link/index.php +16 -0
- package/src/social-links/deprecated.js +4 -2
- package/src/social-links/edit.native.js +3 -5
- package/src/spacer/controls.js +2 -3
- package/src/spacer/test/index.native.js +10 -21
- package/src/style.scss +1 -0
- package/src/table/block.json +6 -1
- package/src/table/deprecated.js +4 -8
- package/src/table/edit.js +2 -0
- package/src/table/save.js +6 -1
- package/src/table/state.js +2 -4
- package/src/table/style.scss +0 -1
- package/src/table-of-contents/edit.js +6 -10
- package/src/tag-cloud/edit.js +4 -7
- package/src/template-part/edit/advanced-controls.js +4 -4
- package/src/template-part/edit/index.js +6 -10
- package/src/template-part/edit/utils/hooks.js +8 -7
- package/src/template-part/index.js +1 -1
- package/src/template-part/variations.js +0 -11
- package/src/transformationCategories.native.js +3 -3
- package/src/utils/clean-empty-object.js +8 -2
- package/src/video/block.json +6 -1
- package/src/video/edit-common-settings.js +2 -8
- package/src/video/edit.js +4 -0
- package/src/video/edit.native.js +38 -16
- package/src/video/index.js +1 -2
- package/src/video/save.js +10 -2
- package/src/video/style.scss +0 -2
- package/src/video/tracks-editor.js +1 -1
- package/build/gallery/use-short-code-transform.js +0 -64
- package/build/gallery/use-short-code-transform.js.map +0 -1
- package/build/navigation-link/fallback-variations.js +0 -75
- package/build/navigation-link/fallback-variations.js.map +0 -1
- package/build/template-part/fallback-variations.js +0 -59
- package/build/template-part/fallback-variations.js.map +0 -1
- package/build-module/gallery/use-short-code-transform.js +0 -54
- package/build-module/gallery/use-short-code-transform.js.map +0 -1
- package/build-module/navigation-link/fallback-variations.js +0 -65
- package/build-module/navigation-link/fallback-variations.js.map +0 -1
- package/build-module/template-part/fallback-variations.js +0 -47
- package/build-module/template-part/fallback-variations.js.map +0 -1
- package/src/gallery/use-short-code-transform.js +0 -55
- package/src/navigation-link/fallback-variations.js +0 -65
- package/src/template-part/fallback-variations.js +0 -51
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"names":["useIsPostTypeHierarchical","postType","select","type","coreStore","getPostType","viewable","hierarchical","QueryInspectorControls","attributes","query","displayLayout","setQuery","setDisplayLayout","order","orderBy","author","authorIds","sticky","inherit","taxQuery","parents","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","value","columns","Math","max"],"mappings":";;;;;;;;;AAkBA;;AAfA;;AAKA;;AAQA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAQA,SAASA,yBAAT,CAAoCC,QAApC,EAA+C;AAC9C,SAAO,qBACJC,MAAF,IAAc;AACb,UAAMC,IAAI,GAAGD,MAAM,CAAEE,eAAF,CAAN,CAAoBC,WAApB,CAAiCJ,QAAjC,CAAb;AACA,WAAO,CAAAE,IAAI,SAAJ,IAAAA,IAAI,WAAJ,YAAAA,IAAI,CAAEG,QAAN,MAAkBH,IAAlB,aAAkBA,IAAlB,uBAAkBA,IAAI,CAAEI,YAAxB,CAAP;AACA,GAJK,EAKN,CAAEN,QAAF,CALM,CAAP;AAOA;;AAEc,SAASO,sBAAT,OAIX;AAAA,MAJ4C;AAC/CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KADmC;AAE/CC,IAAAA,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T;AAEC,IAAA,KAAK,EAAG8B,WAFT;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAHD,EAQGjB,sBAAsB,IACvB,4BAAC,sBAAD;AACC,IAAA,OAAO,EAAGL,OADX;AAEC,IAAA,QAAQ,EAAGpB,QAFZ;AAGC,IAAA,QAAQ,EAAGW;AAHZ,IATF,CAvDF,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport TaxonomyControls from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport { usePostTypes } from '../../utils';\n\nfunction useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\nexport default function QueryInspectorControls( {\n\tattributes: { query, displayLayout },\n\tsetQuery,\n\tsetDisplayLayout,\n} ) {\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t) }\n\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\tonChange={ ( value ) => setQuery( { inherit: !! value } ) }\n\t\t\t\t/>\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called \"Post types\". By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ displayLayout?.type === 'flex' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetDisplayLayout( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ showSticky && (\n\t\t\t\t\t<StickyControl\n\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\tonChange={ ( value ) => setQuery( { sticky: value } ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t\t{ ! inherit && (\n\t\t\t\t<PanelBody title={ __( 'Filters' ) }>\n\t\t\t\t\t<TaxonomyControls onChange={ setQuery } query={ query } />\n\t\t\t\t\t<AuthorControl value={ authorIds } onChange={ setQuery } />\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isPostTypeHierarchical && (\n\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"names":["useIsPostTypeHierarchical","postType","select","type","coreStore","getPostType","viewable","hierarchical","QueryInspectorControls","attributes","query","displayLayout","setQuery","setDisplayLayout","order","orderBy","author","authorIds","sticky","inherit","taxQuery","parents","showSticky","setShowSticky","postTypesTaxonomiesMap","postTypesSelectOptions","isPostTypeHierarchical","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","cancel","value","columns","Math","max"],"mappings":";;;;;;;;;AAkBA;;AAfA;;AAKA;;AAQA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAQA,SAASA,yBAAT,CAAoCC,QAApC,EAA+C;AAC9C,SAAO,qBACJC,MAAF,IAAc;AACb,UAAMC,IAAI,GAAGD,MAAM,CAAEE,eAAF,CAAN,CAAoBC,WAApB,CAAiCJ,QAAjC,CAAb;AACA,WAAO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,EAsDG,CAAE5B,OAAF,IACD,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAnB,KACC,4BAAC,yBAAD;AAAkB,IAAA,QAAQ,EAAGP,QAA7B;AAAwC,IAAA,KAAK,EAAGF;AAAhD,IADD,EAEC,4BAAC,sBAAD;AAAe,IAAA,KAAK,EAAGO,SAAvB;AAAmC,IAAA,QAAQ,EAAGL;AAA9C,IAFD,EAGC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,IAAA,KAAK,EAAG8B,WAFT;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAHD,EAQGjB,sBAAsB,IACvB,4BAAC,sBAAD;AACC,IAAA,OAAO,EAAGL,OADX;AAEC,IAAA,QAAQ,EAAGpB,QAFZ;AAGC,IAAA,QAAQ,EAAGW;AAHZ,IATF,CAvDF,CADD;AA2EA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\tToggleControl,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport TaxonomyControls from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport { usePostTypes } from '../../utils';\n\nfunction useIsPostTypeHierarchical( postType ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst type = select( coreStore ).getPostType( postType );\n\t\t\treturn type?.viewable && type?.hierarchical;\n\t\t},\n\t\t[ postType ]\n\t);\n}\n\nexport default function QueryInspectorControls( {\n\tattributes: { query, displayLayout },\n\tsetQuery,\n\tsetDisplayLayout,\n} ) {\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpostType,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Inherit query from template' ) }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'\n\t\t\t\t\t) }\n\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\tonChange={ ( value ) => setQuery( { inherit: !! value } ) }\n\t\t\t\t/>\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\tlabel={ __( 'Post type' ) }\n\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'WordPress contains different types of content and they are divided into collections called \"Post types\". By default there are a few different ones such as blog posts and pages, but plugins could add more.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ displayLayout?.type === 'flex' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetDisplayLayout( { columns: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ ! inherit && (\n\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! inherit && showSticky && (\n\t\t\t\t\t<StickyControl\n\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\tonChange={ ( value ) => setQuery( { sticky: value } ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t\t{ ! inherit && (\n\t\t\t\t<PanelBody title={ __( 'Filters' ) }>\n\t\t\t\t\t<TaxonomyControls onChange={ setQuery } query={ query } />\n\t\t\t\t\t<AuthorControl value={ authorIds } onChange={ setQuery } />\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isPostTypeHierarchical && (\n\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"names":["EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","currentParentsInfo","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","mapByName","add","Set"],"mappings":";;;;;;;AAOA;;AAJA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,EAApB;AACA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,KAAK,EAAE,KADW;AAElBC,EAAAA,OAAO,EAAE,UAFS;AAGlBC,EAAAA,OAAO,EAAE;AAHS,CAAnB;;AAMA,SAASC,aAAT,OAA0D;AAAA,MAAlC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA;AAArB,GAAkC;AACzD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,EAAV,CAA9B;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAUZ,WAAV,CAA5B;AACA,QAAM,CAAEa,WAAF,EAAeC,cAAf,IAAkC,uBAAUd,WAAV,CAAxC;AACA,QAAMe,eAAe,GAAG,0BAAaL,SAAb,EAAwB,GAAxB,CAAxB;AACA,QAAM;AAAEM,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAuC,qBAC1CC,MAAF,IAAc;AACb,QAAK,CAAET,MAAP,EAAgB;AACf,aAAO;AAAEO,QAAAA,aAAa,EAAEhB,WAAjB;AAA8BiB,QAAAA,iBAAiB,EAAE;AAAjD,OAAP;AACA;;AACD,UAAM;AAAEE,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/inspector-controls/parent-control.js"],"names":["EMPTY_ARRAY","BASE_QUERY","order","_fields","context","ParentControl","parents","postType","onChange","search","setSearch","value","setValue","suggestions","setSuggestions","debouncedSearch","searchResults","searchHasResolved","select","getEntityRecords","hasFinishedResolution","coreStore","selectorArgs","orderby","exclude","per_page","currentParents","length","include","currentParentsInfo","sanitizedValue","reduce","accumulator","id","entity","mapById","push","name","entitiesInfo","names","getIdByValue","entitiesMappedByName","onParentChange","newValue","ids","Array","from","map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AAQAnC,IAAAA,cAAc,CAAEd,WAAF,CAAd;AACAQ,IAAAA,QAAQ,CAAE;AAAEF,MAAAA,OAAO,EAAEsC;AAAX,KAAF,CAAR;AACA,GAXD;;AAYA,SACC,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,IAAA,KAAK,EAAGjC,KAFT;AAGC,IAAA,aAAa,EAAGI,eAHjB;AAIC,IAAA,WAAW,EAAGF,WAJf;AAKC,IAAA,QAAQ,EAAG6B;AALZ,IADD;AASA;;eAEcrC,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) return EMPTY_ARRAY;\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) return;\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) return EMPTY_ARRAY;\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) return id;\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) accumulator.add( id );\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ onParentChange }\n\t\t/>\n\t);\n}\n\nexport default ParentControl;\n"]}
|
|
@@ -15,6 +15,10 @@ var _i18n = require("@wordpress/i18n");
|
|
|
15
15
|
|
|
16
16
|
var _icons = require("@wordpress/icons");
|
|
17
17
|
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* WordPress dependencies
|
|
20
24
|
*/
|
|
@@ -26,8 +30,18 @@ function QueryToolbar(_ref) {
|
|
|
26
30
|
},
|
|
27
31
|
setQuery,
|
|
28
32
|
setDisplayLayout,
|
|
29
|
-
openPatternSelectionModal
|
|
33
|
+
openPatternSelectionModal,
|
|
34
|
+
name,
|
|
35
|
+
clientId
|
|
30
36
|
} = _ref;
|
|
37
|
+
const hasPatterns = (0, _data.useSelect)(select => {
|
|
38
|
+
const {
|
|
39
|
+
getBlockRootClientId,
|
|
40
|
+
__experimentalGetPatternsByBlockTypes
|
|
41
|
+
} = select(_blockEditor.store);
|
|
42
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
43
|
+
return !!__experimentalGetPatternsByBlockTypes(name, rootClientId).length;
|
|
44
|
+
}, [name, clientId]);
|
|
31
45
|
const maxPageInputId = (0, _compose.useInstanceId)(QueryToolbar, 'blocks-query-pagination-max-page-input');
|
|
32
46
|
const displayLayoutControls = [{
|
|
33
47
|
icon: _icons.list,
|
|
@@ -115,7 +129,7 @@ function QueryToolbar(_ref) {
|
|
|
115
129
|
value: query.pages,
|
|
116
130
|
isDragEnabled: false
|
|
117
131
|
})))
|
|
118
|
-
})), (0, _element.createElement)(_components.ToolbarGroup, {
|
|
132
|
+
})), hasPatterns && (0, _element.createElement)(_components.ToolbarGroup, {
|
|
119
133
|
className: "wp-block-template-part__block-control-group"
|
|
120
134
|
}, (0, _element.createElement)(_components.ToolbarButton, {
|
|
121
135
|
onClick: openPatternSelectionModal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"names":["QueryToolbar","attributes","query","displayLayout","setQuery","setDisplayLayout","openPatternSelectionModal","maxPageInputId","displayLayoutControls","icon","list","title","onClick","type","isActive","grid","columns","inherit","onToggle","settings","value","isNaN","perPage","offset","pages"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"names":["QueryToolbar","attributes","query","displayLayout","setQuery","setDisplayLayout","openPatternSelectionModal","name","clientId","hasPatterns","select","getBlockRootClientId","__experimentalGetPatternsByBlockTypes","blockEditorStore","rootClientId","length","maxPageInputId","displayLayoutControls","icon","list","title","onClick","type","isActive","grid","columns","inherit","onToggle","settings","value","isNaN","perPage","offset","pages"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;AAce,SAASA,YAAT,OAOX;AAAA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tDropdown,\n\tToolbarButton,\n\tBaseControl,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { settings, list, grid } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function QueryToolbar( {\n\tattributes: { query, displayLayout },\n\tsetQuery,\n\tsetDisplayLayout,\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst hasPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__experimentalGetPatternsByBlockTypes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn !! __experimentalGetPatternsByBlockTypes(\n\t\t\t\tname,\n\t\t\t\trootClientId\n\t\t\t).length;\n\t\t},\n\t\t[ name, clientId ]\n\t);\n\tconst maxPageInputId = useInstanceId(\n\t\tQueryToolbar,\n\t\t'blocks-query-pagination-max-page-input'\n\t);\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'list' } ),\n\t\t\tisActive: displayLayout?.type === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'flex',\n\t\t\t\t\tcolumns: displayLayout?.columns || 3,\n\t\t\t\t} ),\n\t\t\tisActive: displayLayout?.type === 'flex',\n\t\t},\n\t];\n\treturn (\n\t\t<>\n\t\t\t{ ! query.inherit && (\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tcontentClassName=\"block-library-query-toolbar__popover\"\n\t\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\t\t\tlabel={ __( 'Display settings' ) }\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Items per Page' ) }\n\t\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tisNaN( value ) ||\n\t\t\t\t\t\t\t\t\t\t\t\tvalue < 1 ||\n\t\t\t\t\t\t\t\t\t\t\t\tvalue > 100\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\t\tperPage: value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\t\t\t\tvalue={ query.perPage }\n\t\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t<BaseControl>\n\t\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tisNaN( value ) ||\n\t\t\t\t\t\t\t\t\t\t\t\tvalue < 0 ||\n\t\t\t\t\t\t\t\t\t\t\t\tvalue > 100\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetQuery( { offset: value } );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\t\t\t\tvalue={ query.offset }\n\t\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t\t<BaseControl\n\t\t\t\t\t\t\t\t\tid={ maxPageInputId }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\t\tid={ maxPageInputId }\n\t\t\t\t\t\t\t\t\t\t__unstableInputWidth=\"60px\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Max page to show' ) }\n\t\t\t\t\t\t\t\t\t\tlabelPosition=\"edge\"\n\t\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( isNaN( value ) || value < 0 ) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetQuery( { pages: value } );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\t\t\t\tvalue={ query.pages }\n\t\t\t\t\t\t\t\t\t\tisDragEnabled={ false }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t\t{ hasPatterns && (\n\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t<ToolbarButton onClick={ openPatternSelectionModal }>\n\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t</>\n\t);\n}\n"]}
|
package/build/query/index.js
CHANGED
|
@@ -100,7 +100,7 @@ const settings = {
|
|
|
100
100
|
save: _save.default,
|
|
101
101
|
variations: _variations.default,
|
|
102
102
|
deprecated: _deprecated.default
|
|
103
|
-
}; // Importing this file includes side effects and is
|
|
103
|
+
}; // Importing this file includes side effects and is added
|
|
104
104
|
// in block-library/package.json under `sideEffects`.
|
|
105
105
|
|
|
106
106
|
exports.settings = settings;
|
package/build/query/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/index.js"],"names":["name","metadata","settings","icon","edit","save","variations","deprecated","queryInspectorControls"],"mappings":";;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,WADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA,mBAJuB;AAKvBC,EAAAA,UAAU,EAAVA;AALuB,CAAjB,C,CAQP;AACA;;;AACA,sBAAW,kBAAX,EAA+B,YAA/B,EAA6CC,eAA7C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\nimport queryInspectorControls from './hooks';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\n// Importing this file includes side effects and is
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/query/index.js"],"names":["name","metadata","settings","icon","edit","save","variations","deprecated","queryInspectorControls"],"mappings":";;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,WADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA,mBAJuB;AAKvBC,EAAAA,UAAU,EAAVA;AALuB,CAAjB,C,CAQP;AACA;;;AACA,sBAAW,kBAAX,EAA+B,YAA/B,EAA6CC,eAA7C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\nimport queryInspectorControls from './hooks';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\n// Importing this file includes side effects and is added\n// in block-library/package.json under `sideEffects`.\naddFilter( 'editor.BlockEdit', 'core/query', queryInspectorControls );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/quote/v2/edit.js"],"names":["isWebPlatform","Platform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","blockEditorStore","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","isSelected","insertBlocksAfter","className","style","citation","align","isAncestorOfSelectedBlock","select","hasSelectedInnerBlock","hasSelection","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","nextAlign","children","RichText","isEmpty","undefined","display","nextCitation","textAlign"],"mappings":";;;;;;;;;AAoBA;;;;AAjBA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AAEA;;AAKA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;AAGA,MAAMA,aAAa,GAAGC,kBAASC,EAAT,KAAgB,KAAtC;AACA,MAAMC,QAAQ,GAAG,CAAE,CAAE,gBAAF,EAAoB,EAApB,CAAF,CAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,UAAF,EAAcC,QAAd,KAA4B;AACpD,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/quote/v2/edit.js"],"names":["isWebPlatform","Platform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","blockEditorStore","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","isSelected","insertBlocksAfter","className","style","citation","align","isAncestorOfSelectedBlock","select","hasSelectedInnerBlock","hasSelection","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","nextAlign","children","RichText","isEmpty","undefined","display","nextCitation","textAlign"],"mappings":";;;;;;;;;AAoBA;;;;AAjBA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AAEA;;AAKA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;AAGA,MAAMA,aAAa,GAAGC,kBAASC,EAAT,KAAgB,KAAtC;AACA,MAAMC,QAAQ,GAAG,CAAE,CAAE,gBAAF,EAAoB,EAApB,CAAF,CAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,UAAF,EAAcC,QAAd,KAA4B;AACpD,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MACL,uBAAaC,kBAAb,CADD;AAEA,0BAAW,MAAM;AAChB;AAEA,QAAK,CAAEL,UAAU,CAACM,KAAlB,EAA0B;AACzB;AACA;AACA;;AAED,UAAM,CAAEC,aAAF,EAAiBC,cAAjB,IACL,mCAAkBR,UAAlB,CADD;AAGA,6BAAY,oCAAZ,EAAkD;AACjDS,MAAAA,KAAK,EAAE,KAD0C;AAEjDC,MAAAA,OAAO,EAAE,KAFwC;AAGjDC,MAAAA,WAAW,EAAE;AAHoC,KAAlD;AAMAT,IAAAA,QAAQ,CAACU,KAAT,CAAgB,MAAM;AACrBT,MAAAA,qBAAqB,CAAEF,QAAF,EAAYM,aAAZ,CAArB;AACAH,MAAAA,kBAAkB,CAAEH,QAAF,EAAYO,cAAZ,CAAl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EACGA,gBAAgB,CAACI,QADpB,EAEG,CAAE,CAAEC,sBAASC,OAAT,CAAkBb,QAAlB,CAAF,IAAkCK,YAApC,KACD,4BAAC,qBAAD;AACC,IAAA,UAAU,EAAC,UADZ;AAEC,IAAA,OAAO,EAAG7B,aAAa,GAAG,MAAH,GAAYsC,SAFpC;AAGC,IAAA,KAAK,EAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAHT;AAIC,IAAA,KAAK,EAAGf,QAJT;AAKC,IAAA,QAAQ,EAAKgB,YAAF,IAAoB;AAC9BrB,MAAAA,aAAa,CAAE;AACdK,QAAAA,QAAQ,EAAEgB;AADI,OAAF,CAAb;AAGA,KATF;AAUC,IAAA,8BAA8B,MAV/B;AAWC,kBAAa,cAAI,gBAAJ,CAXd;AAYC,IAAA,WAAW,EACV;AACA;AACA,kBAAI,cAAJ,CAfF;AAiBC,IAAA,SAAS,EAAC,0BAjBX;AAkBC,IAAA,sBAAsB,EAAG,MACxBnB,iBAAiB,CAChB,yBAAa,kCAAb,CADgB;AAnBnB,KAuBQ,CAAErB,aAAF,GAAkB;AAAEyC,IAAAA,SAAS,EAAEhB;AAAb,GAAlB,GAAyC,EAvBjD,EAHF,CATD,CADD;AA0CA","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { citation, align } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst isAncestorOfSelectedBlock = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).hasSelectedInnerBlock( clientId )\n\t);\n\tconst hasSelection = isSelected || isAncestorOfSelectedBlock;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"]}
|
package/build/search/edit.js
CHANGED
|
@@ -201,7 +201,7 @@ function SearchEdit(_ref) {
|
|
|
201
201
|
|
|
202
202
|
const renderButton = () => {
|
|
203
203
|
// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.
|
|
204
|
-
const buttonClasses = (0, _classnames.default)('wp-block-search__button', colorProps.className, isButtonPositionInside ? undefined : borderProps.className, buttonUseIcon ? 'has-icon' : undefined, _blockEditor.
|
|
204
|
+
const buttonClasses = (0, _classnames.default)('wp-block-search__button', colorProps.className, isButtonPositionInside ? undefined : borderProps.className, buttonUseIcon ? 'has-icon' : undefined, (0, _blockEditor.__experimentalGetElementClassName)('button'));
|
|
205
205
|
const buttonStyles = { ...colorProps.style,
|
|
206
206
|
...(isButtonPositionInside ? {
|
|
207
207
|
borderRadius
|
package/build/search/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/search/edit.js"],"names":["DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","unitControlInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","buttonOutside","onClick","buttonInside","noButton","getButtonPositionIcon","buttonOnly","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","event","target","value","renderButton","buttonClasses","__experimentalElementButtonClassName","buttonStyles","search","html","controls","toggleLabel","buttonWithIcon","MIN_WIDTH","MIN_WIDTH_UNIT","newWidth","filteredWidth","parseInt","newUnit","maxWidth","map","widthValue","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps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AQC,IAAA,KAAK,EAAGwC,gBAAgB,EARzB;AASC,IAAA,QAAQ,EAAGV,gBATZ;AAUC,IAAA,MAAM,EAAGlB,iBAAiB,EAV3B;AAWC,IAAA,aAAa,EAAG,CAAEM,KAAF,EAASoC,SAAT,EAAoBC,GAApB,KAA6B;AAC5C/F,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEmE,QAAQ,CAAEqB,GAAG,CAACC,WAAN,EAAmB,EAAnB,CADD;AAEdxF,QAAAA,SAAS,EAAE;AAFG,OAAF,CAAb;AAIAP,MAAAA,eAAe,CAAE,KAAF,CAAf;AACA,KAjBF;AAkBC,IAAA,YAAY,EAAG,CAAEyD,KAAF,EAASoC,SAAT,EAAoBC,GAApB,EAAyBE,KAAzB,KAAoC;AAClDjG,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEmE,QAAQ,CAAEnE,KAAK,GAAG0F,KAAK,CAAC1F,KAAhB,EAAuB,EAAvB;AADD,OAAF,CAAb;AAGAN,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,KAvBF;AAwBC,IAAA,UAAU,EAAGC;AAxBd,KA0BG,CAAE2B,sBAAsB,IAAIC,uBAA5B,KACD,qDACGyB,eAAe,EADlB,EAEGM,YAAY,EAFf,CA3BF,EAiCG7B,aAAa,IAAI6B,YAAY,EAjChC,EAkCG9B,WAAW,IAAIwB,eAAe,EAlCjC,CAdD,CADD;AAqDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tstore as blockEditorStore,\n\t__experimentalElementButtonClassName,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tMIN_WIDTH_UNIT,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tuseEffect( () => {\n\t\tif ( ! insertedInNavigationBlock ) return;\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}, [ insertedInNavigationBlock ] );\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className\n\t\t);\n\t\tconst textFieldStyles = isButtonPositionInside\n\t\t\t? { borderRadius }\n\t\t\t: borderProps.style;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalElementButtonClassName\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={ `${ MIN_WIDTH }${ MIN_WIDTH_UNIT }` }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tstyle={ { maxWidth: 80 } }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t`${ widthValue }%` ===\n\t\t\t\t\t\t\t\t\t\t\t`${ width }${ widthUnit }`\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\ttopLeft,\n\t\t\t\t\ttopRight,\n\t\t\t\t\tbottomLeft,\n\t\t\t\t\tbottomRight,\n\t\t\t\t} = borderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName=\"wp-block-search__label\"\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside || isButtonPositionOutside ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasOnlyButton && renderButton() }\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/search/edit.js"],"names":["DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","unitControlInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","buttonOutside","onClick","buttonInside","noButton","getButtonPositionIcon","buttonOnly","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","event","target","value","renderButton","buttonClasses","buttonStyles","search","html","controls","toggleLabel","buttonWithIcon","MIN_WIDTH","MIN_WIDTH_UNIT","newWidth","filteredWidth","parseInt","newUnit","maxWidth","map","widthValue","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","direction","elt","offsetWidth","delta"],"mappings":";;;;;;;;;AAmBA;;AAhBA;;AAKA;;AAUA;;AAEA;;AAYA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AAhDA;AACA;AACA;;AAGA;AACA;AACA;;AA8BA;AACA;AACA;AAgBA;AACA;AACA,MAAMA,qBAAqB,GAAG,KAA9B;;AAEe,SAASC,UAAT,OAOX;AAAA;;AAAA,MAPgC;AACnCC,IAAAA,SADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,aAHmC;AAInCC,IAAAA,eAJmC;AAKnCC,IAAAA,UALmC;AAMnCC,IAAAA;AANmC,GAOhC;AACH,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,KANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,cARK;AAS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AAK,GAAGyF,KAAK,CAACzF,KAAhB,EAAuB,EAAvB;AADD,OAAF,CAAb;AAGAN,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,KAvBF;AAwBC,IAAA,UAAU,EAAGC;AAxBd,KA0BG,CAAE2B,sBAAsB,IAAIC,uBAA5B,KACD,qDACGyB,eAAe,EADlB,EAEGM,YAAY,EAFf,CA3BF,EAiCG7B,aAAa,IAAI6B,YAAY,EAjChC,EAkCG9B,WAAW,IAAIwB,eAAe,EAlCjC,CAdD,CADD;AAqDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tMIN_WIDTH_UNIT,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\tif ( ! insertedInNavigationBlock ) return;\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}, [ insertedInNavigationBlock ] );\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className\n\t\t);\n\t\tconst textFieldStyles = isButtonPositionInside\n\t\t\t? { borderRadius }\n\t\t\t: borderProps.style;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={ `${ MIN_WIDTH }${ MIN_WIDTH_UNIT }` }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tstyle={ { maxWidth: 80 } }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t`${ widthValue }%` ===\n\t\t\t\t\t\t\t\t\t\t\t`${ width }${ widthUnit }`\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName=\"wp-block-search__label\"\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside || isButtonPositionOutside ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasOnlyButton && renderButton() }\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/search/edit.native.js"],"names":["MIN_BUTTON_WIDTH","MARGINS","widthMargin","marginLeft","styles","paddingLeft","BUTTON_OPTIONS","value","label","SearchEdit","onFocus","isSelected","attributes","setAttributes","className","blockWidth","style","isButtonSelected","setIsButtonSelected","isLabelSelected","setIsLabelSelected","isPlaceholderSelected","setIsPlaceholderSelected","isLongButton","setIsLongButton","buttonWidth","setButtonWidth","isScreenReaderEnabled","setIsScreenReaderEnabled","textInputRef","showLabel","buttonPosition","buttonUseIcon","placeholder","buttonText","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","handleScreenReaderToggled","then","screenReaderEnabled","remove","hasTextInput","current","blur","maxButtonWidth","Math","floor","tempIsLongButton","onLayoutButton","nativeEvent","width","layout","getBlockClassNames","undefined","getSelectedButtonPositionLabel","option","blockProps","controls","position","isButtonInside","borderStyle","border","borderDark","inputStyle","plainTextInput","plainTextInputDark","baseColors","color","text","placeholderStyle","plainTextPlaceholder","plainTextPlaceholderDark","searchBarStyle","searchBarContainer","flexDirection","getAccessibilityLabelForButton","getAccessibilityLabelForPlaceholder","title","description","getAccessibilityLabelForLabel","renderTextField","searchInputContainer","newVal","buttonPlaceholderText","baseButtonStyles","blocks","richTextButtonContainerStyle","buttonContainer","buttonContainerWide","background","backgroundColor","borderWidth","richTextButtonStyle","richTextButton","placeholderColor","iconStyles","icon","fill","renderButton","search","html","richTextButtonCursor","searchBlockContainer","richTextLabel"],"mappings":";;;;;;;;;AAuBA;;;;AApBA;;AACA;;AAKA;;AAMA;;AAMA;;AACA;;AAEA;;AAKA;;;;AAEA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAG,EAAzB;AACA,MAAMC,OAAO,GACZ,uCAAOC,WAAP,4EAAoBC,UAApB,6BAAiCC,eAAOF,WAAxC,yDAAiC,qBAAoBG,WAArD,CADD;AAGA,MAAMC,cAAc,GAAG,CACtB;AAAEC,EAAAA,KAAK,EAAE,eAAT;AAA0BC,EAAAA,KAAK,EAAE,cAAI,eAAJ;AAAjC,CADsB,EAEtB;AAAED,EAAAA,KAAK,EAAE,gBAAT;AAA2BC,EAAAA,KAAK,EAAE,cAAI,gBAAJ;AAAlC,CAFsB,EAGtB;AAAED,EAAAA,KAAK,EAAE,WAAT;AAAsBC,EAAAA,KAAK,EAAE,cAAI,WAAJ;AAA7B,CAHsB,CAAvB;;AAMe,SAASC,UAAT,OAQX;AAAA;;AAAA,MARgC;AACnCC,IAAAA,OADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,UAHmC;AAInCC,IAAAA,aAJmC;AAKnCC,IAAAA,SALmC;AAMnCC,IAAAA,UANmC;AAOnCC,IAAAA;AAPmC,GAQhC;AACH,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,KAAV,CAAhD;AACA,QAAM,CAAEC,qBAAF,EAAyBC,wBAAzB,IAAsD,uBAC3D,KAD2D,CAA5D;AAGA,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,KAAV,CAA1C;AACA,QA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A6BlC;AAnB/C,IAVD,CAXF,EA6CG,CAAE,oBAAoBrC,cAApB,IACH,qBAAqBA,cADpB,KAED,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAG0C;AAAd,KACGQ,eAAe,EADlB,EAEGkB,YAAY,EAFf,CA/CF,EAqDG,kBAAkBpE,cAAlB,IAAoCoE,YAAY,EArDnD,EAsDG,gBAAgBpE,cAAhB,IAAkCkD,eAAe,EAtDpD,CADD;AA0DA","sourcesContent":["/**\n * External dependencies\n */\nimport { View, AccessibilityInfo } from 'react-native';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tPlainText,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { search } from '@wordpress/icons';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\n/**\n * Constants\n */\nconst MIN_BUTTON_WIDTH = 75;\nconst MARGINS =\n\tstyles.widthMargin?.marginLeft + styles.widthMargin?.paddingLeft;\n\nconst BUTTON_OPTIONS = [\n\t{ value: 'button-inside', label: __( 'Button inside' ) },\n\t{ value: 'button-outside', label: __( 'Button outside' ) },\n\t{ value: 'no-button', label: __( 'No button' ) },\n];\n\nexport default function SearchEdit( {\n\tonFocus,\n\tisSelected,\n\tattributes,\n\tsetAttributes,\n\tclassName,\n\tblockWidth,\n\tstyle,\n} ) {\n\tconst [ isButtonSelected, setIsButtonSelected ] = useState( false );\n\tconst [ isLabelSelected, setIsLabelSelected ] = useState( false );\n\tconst [ isPlaceholderSelected, setIsPlaceholderSelected ] = useState(\n\t\tfalse\n\t);\n\tconst [ isLongButton, setIsLongButton ] = useState( false );\n\tconst [ buttonWidth, setButtonWidth ] = useState( MIN_BUTTON_WIDTH );\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tconst textInputRef = useRef( null );\n\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tplaceholder,\n\t\tbuttonText,\n\t} = attributes;\n\n\t/*\n\t * Check if screenreader is enabled and save to state. This is important for\n\t * properly creating accessibilityLabel text.\n\t */\n\tuseEffect( () => {\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\thandleScreenReaderToggled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst handleScreenReaderToggled = ( screenReaderEnabled ) => {\n\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t};\n\n\t/*\n\t * Called when the value of isSelected changes. Blurs the PlainText component\n\t * used by the placeholder when this block loses focus.\n\t */\n\tuseEffect( () => {\n\t\tif ( hasTextInput() && isPlaceholderSelected && ! isSelected ) {\n\t\t\ttextInputRef.current.blur();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tconst maxButtonWidth = Math.floor( blockWidth / 2 - MARGINS );\n\t\tconst tempIsLongButton = buttonWidth > maxButtonWidth;\n\n\t\t// Update this value only if it has changed to avoid flickering.\n\t\tif ( isLongButton !== tempIsLongButton ) {\n\t\t\tsetIsLongButton( tempIsLongButton );\n\t\t}\n\t}, [ blockWidth, buttonWidth ] );\n\n\tconst hasTextInput = () => {\n\t\treturn textInputRef && textInputRef.current;\n\t};\n\n\tconst onLayoutButton = ( { nativeEvent } ) => {\n\t\tconst { width } = nativeEvent?.layout;\n\n\t\tif ( width ) {\n\t\t\tsetButtonWidth( width );\n\t\t}\n\t};\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\t'button-inside' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\t'button-outside' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\t'no-button' === buttonPosition\n\t\t\t\t? 'wp-block-search__no-button'\n\t\t\t\t: undefined,\n\t\t\t'button-only' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-only'\n\t\t\t\t: undefined,\n\t\t\t! buttonUseIcon && 'no-button' !== buttonPosition\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && 'no-button' !== buttonPosition\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst getSelectedButtonPositionLabel = ( option ) => {\n\t\tswitch ( option ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn __( 'Inside' );\n\t\t\tcase 'button-outside':\n\t\t\t\treturn __( 'Outside' );\n\t\t\tcase 'no-button':\n\t\t\t\treturn __( 'No button' );\n\t\t}\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t} );\n\n\tconst controls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Search settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Hide search heading' ) }\n\t\t\t\t\tchecked={ ! showLabel }\n\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\tvalue={ getSelectedButtonPositionLabel( buttonPosition ) }\n\t\t\t\t\tonChange={ ( position ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tbuttonPosition: position,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ BUTTON_OPTIONS }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t/>\n\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Use icon button' ) }\n\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst isButtonInside = buttonPosition === 'button-inside';\n\n\tconst borderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.border,\n\t\tstyles.borderDark\n\t);\n\n\tconst inputStyle = [\n\t\t! isButtonInside && borderStyle,\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.plainTextInput,\n\t\t\tstyles.plainTextInputDark\n\t\t),\n\t\tstyle?.baseColors?.color && { color: style?.baseColors?.color?.text },\n\t];\n\n\tconst placeholderStyle = {\n\t\t...usePreferredColorSchemeStyle(\n\t\t\tstyles.plainTextPlaceholder,\n\t\t\tstyles.plainTextPlaceholderDark\n\t\t),\n\t\t...( style?.baseColors?.color && {\n\t\t\tcolor: style?.baseColors?.color?.text,\n\t\t} ),\n\t};\n\n\tconst searchBarStyle = [\n\t\tstyles.searchBarContainer,\n\t\tisButtonInside && borderStyle,\n\t\tisLongButton && { flexDirection: 'column' },\n\t];\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Button\n\t */\n\tconst getAccessibilityLabelForButton = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-button';\n\t\t}\n\n\t\treturn `${ __(\n\t\t\t'Search button. Current button text is'\n\t\t) } ${ buttonText }`;\n\t};\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Input\n\t * \t\t\t\t\t placeholder field.\n\t */\n\tconst getAccessibilityLabelForPlaceholder = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-input';\n\t\t}\n\n\t\tconst title = __( 'Search input field.' );\n\t\tconst description = placeholder\n\t\t\t? `${ __( 'Current placeholder text is' ) } ${ placeholder }`\n\t\t\t: __( 'No custom placeholder set' );\n\t\treturn `${ title } ${ description }`;\n\t};\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Label field\n\t */\n\tconst getAccessibilityLabelForLabel = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-label';\n\t\t}\n\n\t\treturn `${ __( 'Search block label. Current text is' ) } ${ label }`;\n\t};\n\n\tconst renderTextField = () => {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ styles.searchInputContainer }\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\taccessibilityHint={\n\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t? __( 'Double tap to edit placeholder text' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\taccessibilityLabel={ getAccessibilityLabelForPlaceholder() }\n\t\t\t>\n\t\t\t\t<PlainText\n\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\tisSelected={ isPlaceholderSelected }\n\t\t\t\t\tclassName=\"wp-block-search__input\"\n\t\t\t\t\tstyle={ inputStyle }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tellipsizeMode=\"tail\" // Currently only works on ios.\n\t\t\t\t\tlabel={ null }\n\t\t\t\t\tvalue={ placeholder }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newVal ) =>\n\t\t\t\t\t\tsetAttributes( { placeholder: newVal } )\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ () => {\n\t\t\t\t\t\tsetIsPlaceholderSelected( true );\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ () => setIsPlaceholderSelected( false ) }\n\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t};\n\n\t// To achieve proper expanding and shrinking `RichText` on Android, there is a need to set\n\t// a `placeholder` as an empty string when `RichText` is focused,\n\t// because `AztecView` is calculating a `minWidth` based on placeholder text.\n\tconst buttonPlaceholderText =\n\t\tisButtonSelected ||\n\t\t( ! isButtonSelected && buttonText && buttonText !== '' )\n\t\t\t? ''\n\t\t\t: __( 'Add button text' );\n\n\tconst baseButtonStyles = {\n\t\t...style?.baseColors?.blocks?.[ 'core/button' ]?.color,\n\t\t...attributes?.style?.color,\n\t\t...( style?.color && { text: style.color } ),\n\t};\n\n\tconst richTextButtonContainerStyle = [\n\t\tstyles.buttonContainer,\n\t\tisLongButton && styles.buttonContainerWide,\n\t\tbaseButtonStyles?.background && {\n\t\t\tbackgroundColor: baseButtonStyles.background,\n\t\t\tborderWidth: 0,\n\t\t},\n\t\tstyle?.backgroundColor && {\n\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\tborderWidth: 0,\n\t\t},\n\t];\n\n\tconst richTextButtonStyle = {\n\t\t...styles.richTextButton,\n\t\t...( baseButtonStyles?.text && {\n\t\t\tcolor: baseButtonStyles.text,\n\t\t\tplaceholderColor: baseButtonStyles.text,\n\t\t} ),\n\t};\n\n\tconst iconStyles = {\n\t\t...styles.icon,\n\t\t...( baseButtonStyles?.text && { fill: baseButtonStyles.text } ),\n\t};\n\n\tconst renderButton = () => {\n\t\treturn (\n\t\t\t<View style={ richTextButtonContainerStyle }>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\t{ ...iconStyles }\n\t\t\t\t\t\tonLayout={ onLayoutButton }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<View\n\t\t\t\t\t\taccessible={ true }\n\t\t\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\t\t\taccessibilityHint={\n\t\t\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t\t\t? __( 'Double tap to edit button text' )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessibilityLabel={ getAccessibilityLabelForButton() }\n\t\t\t\t\t\tonLayout={ onLayoutButton }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tclassName=\"wp-block-search__button\"\n\t\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\t\tstyle={ richTextButtonStyle }\n\t\t\t\t\t\t\tplaceholder={ buttonPlaceholderText }\n\t\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tminWidth={ MIN_BUTTON_WIDTH }\n\t\t\t\t\t\t\tmaxWidth={ blockWidth - MARGINS }\n\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\tisSelected={ isButtonSelected }\n\t\t\t\t\t\t\t__unstableMobileNoFocusOnMount={ ! isSelected }\n\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\tsetIsButtonSelected( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tsetIsButtonSelected( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tselectionColor={\n\t\t\t\t\t\t\t\tstyles.richTextButtonCursor?.color\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t};\n\n\treturn (\n\t\t<View\n\t\t\t{ ...blockProps }\n\t\t\tstyle={ styles.searchBlockContainer }\n\t\t\timportantForAccessibility={\n\t\t\t\tisSelected ? 'yes' : 'no-hide-descendants'\n\t\t\t}\n\t\t\taccessibilityElementsHidden={ isSelected ? false : true }\n\t\t>\n\t\t\t{ isSelected && controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<View\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\t\taccessibilityHint={\n\t\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t\t? __( 'Double tap to edit label text' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\taccessibilityLabel={ getAccessibilityLabelForLabel() }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-search__label\"\n\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\tstyle={ styles.richTextLabel }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisSelected={ isLabelSelected }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount={ ! isSelected }\n\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\tsetIsLabelSelected( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\tsetIsLabelSelected( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tselectionColor={ styles.richTextButtonCursor?.color }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\n\t\t\t{ ( 'button-inside' === buttonPosition ||\n\t\t\t\t'button-outside' === buttonPosition ) && (\n\t\t\t\t<View style={ searchBarStyle }>\n\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t{ renderButton() }\n\t\t\t\t</View>\n\t\t\t) }\n\n\t\t\t{ 'button-only' === buttonPosition && renderButton() }\n\t\t\t{ 'no-button' === buttonPosition && renderTextField() }\n\t\t</View>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/search/edit.native.js"],"names":["MIN_BUTTON_WIDTH","MARGINS","widthMargin","marginLeft","styles","paddingLeft","BUTTON_OPTIONS","value","label","SearchEdit","onFocus","isSelected","attributes","setAttributes","className","blockWidth","style","isButtonSelected","setIsButtonSelected","isLabelSelected","setIsLabelSelected","isPlaceholderSelected","setIsPlaceholderSelected","isLongButton","setIsLongButton","buttonWidth","setButtonWidth","isScreenReaderEnabled","setIsScreenReaderEnabled","textInputRef","showLabel","buttonPosition","buttonUseIcon","placeholder","buttonText","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","handleScreenReaderToggled","then","screenReaderEnabled","remove","hasTextInput","current","blur","maxButtonWidth","Math","floor","tempIsLongButton","onLayoutButton","nativeEvent","width","layout","getBlockClassNames","undefined","getSelectedButtonPositionLabel","option","blockProps","controls","position","isButtonInside","borderStyle","border","borderDark","inputStyle","plainTextInput","plainTextInputDark","baseColors","color","text","placeholderStyle","plainTextPlaceholder","plainTextPlaceholderDark","searchBarStyle","searchBarContainer","flexDirection","getAccessibilityLabelForButton","getAccessibilityLabelForPlaceholder","title","description","getAccessibilityLabelForLabel","renderTextField","searchInputContainer","newVal","buttonPlaceholderText","baseButtonStyles","blocks","richTextButtonContainerStyle","buttonContainer","buttonContainerWide","background","backgroundColor","borderWidth","richTextButtonStyle","richTextButton","placeholderColor","iconStyles","icon","fill","renderButton","search","html","richTextButtonCursor","searchBlockContainer","richTextLabel"],"mappings":";;;;;;;;;AAuBA;;;;AApBA;;AACA;;AAKA;;AAMA;;AAMA;;AACA;;AAEA;;AAKA;;;;AAEA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAG,EAAzB;AACA,MAAMC,OAAO,GACZ,uCAAOC,WAAP,4EAAoBC,UAApB,6BAAiCC,eAAOF,WAAxC,yDAAiC,qBAAoBG,WAArD,CADD;AAGA,MAAMC,cAAc,GAAG,CACtB;AAAEC,EAAAA,KAAK,EAAE,eAAT;AAA0BC,EAAAA,KAAK,EAAE,cAAI,eAAJ;AAAjC,CADsB,EAEtB;AAAED,EAAAA,KAAK,EAAE,gBAAT;AAA2BC,EAAAA,KAAK,EAAE,cAAI,gBAAJ;AAAlC,CAFsB,EAGtB;AAAED,EAAAA,KAAK,EAAE,WAAT;AAAsBC,EAAAA,KAAK,EAAE,cAAI,WAAJ;AAA7B,CAHsB,CAAvB;;AAMe,SAASC,UAAT,OAQX;AAAA;;AAAA,MARgC;AACnCC,IAAAA,OADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,UAHmC;AAInCC,IAAAA,aAJmC;AAKnCC,IAAAA,SALmC;AAMnCC,IAAAA,UANmC;AAOnCC,IAAAA;AAPmC,GAQhC;AACH,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,KAAV,CAAhD;AACA,QAAM,CAAEC,qBAAF,EAAyBC,wBAAzB,IACL,uBAAU,KAAV,CADD;AAEA,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,K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,2DAAG,uBAA6BlC;AAnB/C,IAVD,CAXF,EA6CG,CAAE,oBAAoBrC,cAApB,IACH,qBAAqBA,cADpB,KAED,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAG0C;AAAd,KACGQ,eAAe,EADlB,EAEGkB,YAAY,EAFf,CA/CF,EAqDG,kBAAkBpE,cAAlB,IAAoCoE,YAAY,EArDnD,EAsDG,gBAAgBpE,cAAhB,IAAkCkD,eAAe,EAtDpD,CADD;AA0DA","sourcesContent":["/**\n * External dependencies\n */\nimport { View, AccessibilityInfo } from 'react-native';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tPlainText,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { search } from '@wordpress/icons';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\n/**\n * Constants\n */\nconst MIN_BUTTON_WIDTH = 75;\nconst MARGINS =\n\tstyles.widthMargin?.marginLeft + styles.widthMargin?.paddingLeft;\n\nconst BUTTON_OPTIONS = [\n\t{ value: 'button-inside', label: __( 'Button inside' ) },\n\t{ value: 'button-outside', label: __( 'Button outside' ) },\n\t{ value: 'no-button', label: __( 'No button' ) },\n];\n\nexport default function SearchEdit( {\n\tonFocus,\n\tisSelected,\n\tattributes,\n\tsetAttributes,\n\tclassName,\n\tblockWidth,\n\tstyle,\n} ) {\n\tconst [ isButtonSelected, setIsButtonSelected ] = useState( false );\n\tconst [ isLabelSelected, setIsLabelSelected ] = useState( false );\n\tconst [ isPlaceholderSelected, setIsPlaceholderSelected ] =\n\t\tuseState( false );\n\tconst [ isLongButton, setIsLongButton ] = useState( false );\n\tconst [ buttonWidth, setButtonWidth ] = useState( MIN_BUTTON_WIDTH );\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =\n\t\tuseState( false );\n\n\tconst textInputRef = useRef( null );\n\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tplaceholder,\n\t\tbuttonText,\n\t} = attributes;\n\n\t/*\n\t * Check if screenreader is enabled and save to state. This is important for\n\t * properly creating accessibilityLabel text.\n\t */\n\tuseEffect( () => {\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\thandleScreenReaderToggled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst handleScreenReaderToggled = ( screenReaderEnabled ) => {\n\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t};\n\n\t/*\n\t * Called when the value of isSelected changes. Blurs the PlainText component\n\t * used by the placeholder when this block loses focus.\n\t */\n\tuseEffect( () => {\n\t\tif ( hasTextInput() && isPlaceholderSelected && ! isSelected ) {\n\t\t\ttextInputRef.current.blur();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tconst maxButtonWidth = Math.floor( blockWidth / 2 - MARGINS );\n\t\tconst tempIsLongButton = buttonWidth > maxButtonWidth;\n\n\t\t// Update this value only if it has changed to avoid flickering.\n\t\tif ( isLongButton !== tempIsLongButton ) {\n\t\t\tsetIsLongButton( tempIsLongButton );\n\t\t}\n\t}, [ blockWidth, buttonWidth ] );\n\n\tconst hasTextInput = () => {\n\t\treturn textInputRef && textInputRef.current;\n\t};\n\n\tconst onLayoutButton = ( { nativeEvent } ) => {\n\t\tconst { width } = nativeEvent?.layout;\n\n\t\tif ( width ) {\n\t\t\tsetButtonWidth( width );\n\t\t}\n\t};\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\t'button-inside' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\t'button-outside' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\t'no-button' === buttonPosition\n\t\t\t\t? 'wp-block-search__no-button'\n\t\t\t\t: undefined,\n\t\t\t'button-only' === buttonPosition\n\t\t\t\t? 'wp-block-search__button-only'\n\t\t\t\t: undefined,\n\t\t\t! buttonUseIcon && 'no-button' !== buttonPosition\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && 'no-button' !== buttonPosition\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst getSelectedButtonPositionLabel = ( option ) => {\n\t\tswitch ( option ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn __( 'Inside' );\n\t\t\tcase 'button-outside':\n\t\t\t\treturn __( 'Outside' );\n\t\t\tcase 'no-button':\n\t\t\t\treturn __( 'No button' );\n\t\t}\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t} );\n\n\tconst controls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Search settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Hide search heading' ) }\n\t\t\t\t\tchecked={ ! showLabel }\n\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\tvalue={ getSelectedButtonPositionLabel( buttonPosition ) }\n\t\t\t\t\tonChange={ ( position ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tbuttonPosition: position,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ BUTTON_OPTIONS }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t/>\n\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Use icon button' ) }\n\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst isButtonInside = buttonPosition === 'button-inside';\n\n\tconst borderStyle = usePreferredColorSchemeStyle(\n\t\tstyles.border,\n\t\tstyles.borderDark\n\t);\n\n\tconst inputStyle = [\n\t\t! isButtonInside && borderStyle,\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.plainTextInput,\n\t\t\tstyles.plainTextInputDark\n\t\t),\n\t\tstyle?.baseColors?.color && { color: style?.baseColors?.color?.text },\n\t];\n\n\tconst placeholderStyle = {\n\t\t...usePreferredColorSchemeStyle(\n\t\t\tstyles.plainTextPlaceholder,\n\t\t\tstyles.plainTextPlaceholderDark\n\t\t),\n\t\t...( style?.baseColors?.color && {\n\t\t\tcolor: style?.baseColors?.color?.text,\n\t\t} ),\n\t};\n\n\tconst searchBarStyle = [\n\t\tstyles.searchBarContainer,\n\t\tisButtonInside && borderStyle,\n\t\tisLongButton && { flexDirection: 'column' },\n\t];\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Button\n\t */\n\tconst getAccessibilityLabelForButton = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-button';\n\t\t}\n\n\t\treturn `${ __(\n\t\t\t'Search button. Current button text is'\n\t\t) } ${ buttonText }`;\n\t};\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Input\n\t * \t\t\t\t\t placeholder field.\n\t */\n\tconst getAccessibilityLabelForPlaceholder = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-input';\n\t\t}\n\n\t\tconst title = __( 'Search input field.' );\n\t\tconst description = placeholder\n\t\t\t? `${ __( 'Current placeholder text is' ) } ${ placeholder }`\n\t\t\t: __( 'No custom placeholder set' );\n\t\treturn `${ title } ${ description }`;\n\t};\n\n\t/**\n\t * If a screenreader is enabled, create a descriptive label for this field. If\n\t * not, return a label that is used during automated UI tests.\n\t *\n\t * @return {string} The accessibilityLabel for the Search Label field\n\t */\n\tconst getAccessibilityLabelForLabel = () => {\n\t\tif ( ! isScreenReaderEnabled ) {\n\t\t\treturn 'search-block-label';\n\t\t}\n\n\t\treturn `${ __( 'Search block label. Current text is' ) } ${ label }`;\n\t};\n\n\tconst renderTextField = () => {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ styles.searchInputContainer }\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\taccessibilityHint={\n\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t? __( 'Double tap to edit placeholder text' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\taccessibilityLabel={ getAccessibilityLabelForPlaceholder() }\n\t\t\t>\n\t\t\t\t<PlainText\n\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\tisSelected={ isPlaceholderSelected }\n\t\t\t\t\tclassName=\"wp-block-search__input\"\n\t\t\t\t\tstyle={ inputStyle }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tellipsizeMode=\"tail\" // Currently only works on ios.\n\t\t\t\t\tlabel={ null }\n\t\t\t\t\tvalue={ placeholder }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newVal ) =>\n\t\t\t\t\t\tsetAttributes( { placeholder: newVal } )\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ () => {\n\t\t\t\t\t\tsetIsPlaceholderSelected( true );\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ () => setIsPlaceholderSelected( false ) }\n\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t};\n\n\t// To achieve proper expanding and shrinking `RichText` on Android, there is a need to set\n\t// a `placeholder` as an empty string when `RichText` is focused,\n\t// because `AztecView` is calculating a `minWidth` based on placeholder text.\n\tconst buttonPlaceholderText =\n\t\tisButtonSelected ||\n\t\t( ! isButtonSelected && buttonText && buttonText !== '' )\n\t\t\t? ''\n\t\t\t: __( 'Add button text' );\n\n\tconst baseButtonStyles = {\n\t\t...style?.baseColors?.blocks?.[ 'core/button' ]?.color,\n\t\t...attributes?.style?.color,\n\t\t...( style?.color && { text: style.color } ),\n\t};\n\n\tconst richTextButtonContainerStyle = [\n\t\tstyles.buttonContainer,\n\t\tisLongButton && styles.buttonContainerWide,\n\t\tbaseButtonStyles?.background && {\n\t\t\tbackgroundColor: baseButtonStyles.background,\n\t\t\tborderWidth: 0,\n\t\t},\n\t\tstyle?.backgroundColor && {\n\t\t\tbackgroundColor: style.backgroundColor,\n\t\t\tborderWidth: 0,\n\t\t},\n\t];\n\n\tconst richTextButtonStyle = {\n\t\t...styles.richTextButton,\n\t\t...( baseButtonStyles?.text && {\n\t\t\tcolor: baseButtonStyles.text,\n\t\t\tplaceholderColor: baseButtonStyles.text,\n\t\t} ),\n\t};\n\n\tconst iconStyles = {\n\t\t...styles.icon,\n\t\t...( baseButtonStyles?.text && { fill: baseButtonStyles.text } ),\n\t};\n\n\tconst renderButton = () => {\n\t\treturn (\n\t\t\t<View style={ richTextButtonContainerStyle }>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\t{ ...iconStyles }\n\t\t\t\t\t\tonLayout={ onLayoutButton }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<View\n\t\t\t\t\t\taccessible={ true }\n\t\t\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\t\t\taccessibilityHint={\n\t\t\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t\t\t? __( 'Double tap to edit button text' )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessibilityLabel={ getAccessibilityLabelForButton() }\n\t\t\t\t\t\tonLayout={ onLayoutButton }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tclassName=\"wp-block-search__button\"\n\t\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\t\tstyle={ richTextButtonStyle }\n\t\t\t\t\t\t\tplaceholder={ buttonPlaceholderText }\n\t\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tminWidth={ MIN_BUTTON_WIDTH }\n\t\t\t\t\t\t\tmaxWidth={ blockWidth - MARGINS }\n\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\tisSelected={ isButtonSelected }\n\t\t\t\t\t\t\t__unstableMobileNoFocusOnMount={ ! isSelected }\n\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\tsetIsButtonSelected( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tsetIsButtonSelected( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tselectionColor={\n\t\t\t\t\t\t\t\tstyles.richTextButtonCursor?.color\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t};\n\n\treturn (\n\t\t<View\n\t\t\t{ ...blockProps }\n\t\t\tstyle={ styles.searchBlockContainer }\n\t\t\timportantForAccessibility={\n\t\t\t\tisSelected ? 'yes' : 'no-hide-descendants'\n\t\t\t}\n\t\t\taccessibilityElementsHidden={ isSelected ? false : true }\n\t\t>\n\t\t\t{ isSelected && controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<View\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityRole=\"none\"\n\t\t\t\t\taccessibilityHint={\n\t\t\t\t\t\tisScreenReaderEnabled\n\t\t\t\t\t\t\t? __( 'Double tap to edit label text' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\taccessibilityLabel={ getAccessibilityLabelForLabel() }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-search__label\"\n\t\t\t\t\t\tidentifier=\"text\"\n\t\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\t\tstyle={ styles.richTextLabel }\n\t\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisSelected={ isLabelSelected }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount={ ! isSelected }\n\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\tsetIsLabelSelected( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\tsetIsLabelSelected( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tselectionColor={ styles.richTextButtonCursor?.color }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\n\t\t\t{ ( 'button-inside' === buttonPosition ||\n\t\t\t\t'button-outside' === buttonPosition ) && (\n\t\t\t\t<View style={ searchBarStyle }>\n\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t{ renderButton() }\n\t\t\t\t</View>\n\t\t\t) }\n\n\t\t\t{ 'button-only' === buttonPosition && renderButton() }\n\t\t\t{ 'no-button' === buttonPosition && renderTextField() }\n\t\t</View>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/separator/use-deprecated-opacity.js"],"names":["useDeprecatedOpacity","opacity","currentColor","setAttributes","deprecatedOpacityWithNoColor","setDeprecatedOpacityWithNoColor","previousColor"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,oBAAT,CACdC,OADc,EAEdC,YAFc,EAGdC,aAHc,EAIb;AACD,QAAM,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/separator/use-deprecated-opacity.js"],"names":["useDeprecatedOpacity","opacity","currentColor","setAttributes","deprecatedOpacityWithNoColor","setDeprecatedOpacityWithNoColor","previousColor"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,oBAAT,CACdC,OADc,EAEdC,YAFc,EAGdC,aAHc,EAIb;AACD,QAAM,CAAEC,4BAAF,EAAgCC,+BAAhC,IACL,uBAAU,KAAV,CADD;AAEA,QAAMC,aAAa,GAAG,0BAAaJ,YAAb,CAAtB,CAHC,CAKD;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QAAKD,OAAO,KAAK,KAAZ,IAAqB,CAAEC,YAAvB,IAAuC,CAAEI,aAA9C,EAA8D;AAC7DD,MAAAA,+BAA+B,CAAE,IAAF,CAA/B;AACA;AACD,GAJD,EAIG,CAAEH,YAAF,EAAgBI,aAAhB,EAA+BL,OAA/B,CAJH,EARC,CAcD;AACA;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QACCA,OAAO,KAAK,KAAZ,KACIG,4BAA4B,IAAIF,YAAlC,IACCI,aAAa,IAAIJ,YAAY,KAAKI,aAFrC,CADD,EAIE;AACDH,MAAAA,aAAa,CAAE;AAAEF,QAAAA,OAAO,EAAE;AAAX,OAAF,CAAb;AACAI,MAAAA,+BAA+B,CAAE,KAAF,CAA/B;AACA;AACD,GATD,EASG,CAAED,4BAAF,EAAgCF,YAAhC,EAA8CI,aAA9C,CATH;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\nexport default function useDeprecatedOpacity(\n\topacity,\n\tcurrentColor,\n\tsetAttributes\n) {\n\tconst [ deprecatedOpacityWithNoColor, setDeprecatedOpacityWithNoColor ] =\n\t\tuseState( false );\n\tconst previousColor = usePrevious( currentColor );\n\n\t// A separator with no color set will always have previousColor set to undefined,\n\t// and we need to differentiate these from those with color set that will return\n\t// previousColor as undefined on the first render.\n\tuseEffect( () => {\n\t\tif ( opacity === 'css' && ! currentColor && ! previousColor ) {\n\t\t\tsetDeprecatedOpacityWithNoColor( true );\n\t\t}\n\t}, [ currentColor, previousColor, opacity ] );\n\n\t// For deprecated blocks, that have a default 0.4 css opacity set, we\n\t// need to remove this if the current color is changed, or a color is added.\n\t// In these instances the opacity attribute is set back to the default of\n\t// alpha-channel which allows a new custom opacity to be set via the color picker.\n\tuseEffect( () => {\n\t\tif (\n\t\t\topacity === 'css' &&\n\t\t\t( ( deprecatedOpacityWithNoColor && currentColor ) ||\n\t\t\t\t( previousColor && currentColor !== previousColor ) )\n\t\t) {\n\t\t\tsetAttributes( { opacity: 'alpha-channel' } );\n\t\t\tsetDeprecatedOpacityWithNoColor( false );\n\t\t}\n\t}, [ deprecatedOpacityWithNoColor, currentColor, previousColor ] );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/shortcode/edit.native.js"],"names":["ShortcodeEdit","props","attributes","setAttributes","onFocus","onBlur","getStylesFromColorScheme","blockWidth","titleStyle","styles","blockTitle","blockTitleDark","shortcodeContainerStyle","blockShortcodeContainer","blockShortcodeContainerDark","shortcodeStyle","blockShortcode","blockShortcodeDark","placeholderStyle","placeholder","placeholderDark","maxWidth","paddingLeft","paddingRight","onChange","text","color"],"mappings":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAOA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,OAHK;AAILC,IAAAA,MAJK;AAKLC,IAAAA,wBALK;AAMLC,IAAAA;AANK,MAOFN,KAPJ;AAQA,QAAMO,UAAU,GAAGF,wBAAwB,CAC1CG,eAAOC,UADmC,EAE1CD,eAAOE,cAFmC,CAA3C;AAIA,QAAMC,uBAAuB,GAAGN,wBAAwB,CACvDG,eAAOI,uBADgD,EAEvDJ,eAAOK,2BAFgD,CAAxD;AAIA,QAAMC,cAAc,GAAGT,wBAAwB,CAC9CG,eAAOO,cADuC,EAE9CP,eAAOQ,kBAFuC,CAA/C;AAIA,QAAMC,gBAAgB,GAAGZ,wBAAwB,CAChDG,eAAOU,WADyC,EAEhDV,eAAOW,eAFyC,CAAjD;AAKA,QAAMC,QAAQ,GACbd,UAAU,GACVK,uBAAuB,CAACU,WADxB,GAEAV,uBAAuB,CAACW,YAHzB;AAKA,QAAMC,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/shortcode/edit.native.js"],"names":["ShortcodeEdit","props","attributes","setAttributes","onFocus","onBlur","getStylesFromColorScheme","blockWidth","titleStyle","styles","blockTitle","blockTitleDark","shortcodeContainerStyle","blockShortcodeContainer","blockShortcodeContainerDark","shortcodeStyle","blockShortcode","blockShortcodeDark","placeholderStyle","placeholder","placeholderDark","maxWidth","paddingLeft","paddingRight","onChange","text","color"],"mappings":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAOA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,OAHK;AAILC,IAAAA,MAJK;AAKLC,IAAAA,wBALK;AAMLC,IAAAA;AANK,MAOFN,KAPJ;AAQA,QAAMO,UAAU,GAAGF,wBAAwB,CAC1CG,eAAOC,UADmC,EAE1CD,eAAOE,cAFmC,CAA3C;AAIA,QAAMC,uBAAuB,GAAGN,wBAAwB,CACvDG,eAAOI,uBADgD,EAEvDJ,eAAOK,2BAFgD,CAAxD;AAIA,QAAMC,cAAc,GAAGT,wBAAwB,CAC9CG,eAAOO,cADuC,EAE9CP,eAAOQ,kBAFuC,CAA/C;AAIA,QAAMC,gBAAgB,GAAGZ,wBAAwB,CAChDG,eAAOU,WADyC,EAEhDV,eAAOW,eAFyC,CAAjD;AAKA,QAAMC,QAAQ,GACbd,UAAU,GACVK,uBAAuB,CAACU,WADxB,GAEAV,uBAAuB,CAACW,YAHzB;AAKA,QAAMC,QAAQ,GAAG,0BACdC,IAAF,IAAYtB,aAAa,CAAE;AAAEsB,IAAAA;AAAF,GAAF,CADT,EAEhB,CAAEtB,aAAF,CAFgB,CAAjB;AAKA,SACC,4BAAC,iBAAD,QACC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGK;AAAd,KAA6B,cAAI,WAAJ,CAA7B,CADD,EAEC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGI;AAAd,KACC,4BAAC,sBAAD;AACC,IAAA,qBAAqB,EAAG,CADzB;AAEC,IAAA,KAAK,EAAGV,UAAU,CAACuB,IAFpB;AAGC,IAAA,KAAK,EAAGV,cAHT;AAIC,IAAA,QAAQ,EAAGS,QAJZ;AAKC,IAAA,WAAW,EAAG,cAAI,kBAAJ,CALf;AAMC,IAAA,OAAO,EAAGpB,OANX;AAOC,IAAA,MAAM,EAAGC,MAPV;AAQC,IAAA,oBAAoB,EAAGa,gBAAgB,CAACQ,KARzC;AASC,IAAA,QAAQ,EAAGL,QATZ;AAUC,IAAA,qBAAqB;AAVtB,IADD,CAFD,CADD;AAmBA;;eAEc,uCAA0BrB,aAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PlainText } from '@wordpress/block-editor';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport styles from './style.scss';\n\nexport function ShortcodeEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tonFocus,\n\t\tonBlur,\n\t\tgetStylesFromColorScheme,\n\t\tblockWidth,\n\t} = props;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.blockTitle,\n\t\tstyles.blockTitleDark\n\t);\n\tconst shortcodeContainerStyle = getStylesFromColorScheme(\n\t\tstyles.blockShortcodeContainer,\n\t\tstyles.blockShortcodeContainerDark\n\t);\n\tconst shortcodeStyle = getStylesFromColorScheme(\n\t\tstyles.blockShortcode,\n\t\tstyles.blockShortcodeDark\n\t);\n\tconst placeholderStyle = getStylesFromColorScheme(\n\t\tstyles.placeholder,\n\t\tstyles.placeholderDark\n\t);\n\n\tconst maxWidth =\n\t\tblockWidth -\n\t\tshortcodeContainerStyle.paddingLeft +\n\t\tshortcodeContainerStyle.paddingRight;\n\n\tconst onChange = useCallback(\n\t\t( text ) => setAttributes( { text } ),\n\t\t[ setAttributes ]\n\t);\n\n\treturn (\n\t\t<View>\n\t\t\t<Text style={ titleStyle }>{ __( 'Shortcode' ) }</Text>\n\t\t\t<View style={ shortcodeContainerStyle }>\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\tvalue={ attributes.text }\n\t\t\t\t\tstyle={ shortcodeStyle }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tplaceholder={ __( 'Add a shortcode…' ) }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\tplaceholderTextColor={ placeholderStyle.color }\n\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\tdisableAutocorrection\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( ShortcodeEdit );\n"]}
|