@wordpress/block-library 9.38.0 → 9.39.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 +2 -0
- package/build/block/block.json +2 -1
- package/build/breadcrumbs/edit.cjs +15 -5
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/breadcrumbs/index.cjs +1 -0
- package/build/breadcrumbs/index.cjs.map +2 -2
- package/build/button/index.cjs +3 -0
- package/build/button/index.cjs.map +2 -2
- package/build/comment-date/block.json +1 -0
- package/build/comment-edit-link/block.json +1 -3
- package/build/comment-edit-link/deprecated.cjs +91 -0
- package/build/comment-edit-link/deprecated.cjs.map +7 -0
- package/build/comment-edit-link/edit.cjs +6 -18
- package/build/comment-edit-link/edit.cjs.map +3 -3
- package/build/comment-edit-link/index.cjs +2 -0
- package/build/comment-edit-link/index.cjs.map +3 -3
- package/build/comment-reply-link/block.json +1 -5
- package/build/comment-reply-link/deprecated.cjs +84 -0
- package/build/comment-reply-link/deprecated.cjs.map +7 -0
- package/build/comment-reply-link/edit.cjs +10 -23
- package/build/comment-reply-link/edit.cjs.map +3 -3
- package/build/comment-reply-link/index.cjs +2 -0
- package/build/comment-reply-link/index.cjs.map +3 -3
- package/build/comments-title/block.json +1 -3
- package/build/comments-title/deprecated.cjs +148 -24
- package/build/comments-title/deprecated.cjs.map +3 -3
- package/build/comments-title/edit.cjs +17 -31
- package/build/comments-title/edit.cjs.map +3 -3
- package/build/cover/edit/block-controls.cjs +10 -2
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +6 -2
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +1 -1
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/index.cjs +3 -0
- package/build/details/index.cjs.map +2 -2
- package/build/embed/util.cjs +9 -0
- package/build/embed/util.cjs.map +2 -2
- package/build/freeform/block.json +2 -1
- package/build/heading/index.cjs +3 -0
- package/build/heading/index.cjs.map +2 -2
- package/build/html/block.json +2 -1
- package/build/image/image.cjs +43 -9
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +1 -1
- package/build/image/index.cjs.map +2 -2
- package/build/index.cjs +6 -0
- package/build/index.cjs.map +2 -2
- package/build/list-item/index.cjs +12 -1
- package/build/list-item/index.cjs.map +2 -2
- package/build/missing/block.json +2 -1
- package/build/more/block.json +2 -1
- package/build/more/index.cjs +1 -1
- package/build/more/index.cjs.map +2 -2
- package/build/navigation/block.json +5 -4
- package/build/navigation/deprecated.cjs +133 -5
- package/build/navigation/deprecated.cjs.map +2 -2
- package/build/navigation/edit/deleted-overlay-warning.cjs +70 -0
- package/build/navigation/edit/deleted-overlay-warning.cjs.map +7 -0
- package/build/navigation/edit/index.cjs +143 -65
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/overlay-panel.cjs +10 -1
- package/build/navigation/edit/overlay-panel.cjs.map +3 -3
- package/build/navigation/edit/overlay-preview.cjs +120 -0
- package/build/navigation/edit/overlay-preview.cjs.map +7 -0
- package/build/navigation/edit/overlay-template-part-selector.cjs +59 -24
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +3 -3
- package/build/navigation/edit/responsive-wrapper.cjs +12 -1
- package/build/navigation/edit/responsive-wrapper.cjs.map +3 -3
- package/build/navigation/edit/use-create-overlay.cjs +19 -2
- package/build/navigation/edit/use-create-overlay.cjs.map +3 -3
- package/build/navigation/utils/get-submenu-visibility.cjs +37 -0
- package/build/navigation/utils/get-submenu-visibility.cjs.map +7 -0
- package/build/navigation-link/edit.cjs +2 -40
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/shared/index.cjs +6 -0
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/select-label-text.cjs +40 -0
- package/build/navigation-link/shared/select-label-text.cjs.map +7 -0
- package/build/navigation-link/shared/use-is-dragging-within.cjs +59 -0
- package/build/navigation-link/shared/use-is-dragging-within.cjs.map +7 -0
- package/build/navigation-submenu/block.json +1 -1
- package/build/navigation-submenu/edit.cjs +8 -47
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/navigation-submenu/index.cjs +2 -2
- package/build/navigation-submenu/index.cjs.map +2 -2
- package/build/nextpage/block.json +2 -1
- package/build/paragraph/block.json +1 -0
- package/build/paragraph/index.cjs +1 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +1 -1
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/shortcode/block.json +2 -1
- package/build/tab/add-tab-toolbar-control.cjs +31 -9
- package/build/tab/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab/block.json +18 -4
- package/build/tab/controls.cjs +4 -8
- package/build/tab/controls.cjs.map +3 -3
- package/build/tab/edit.cjs +46 -118
- package/build/tab/edit.cjs.map +3 -3
- package/build/tab/remove-tab-toolbar-control.cjs +91 -0
- package/build/tab/remove-tab-toolbar-control.cjs.map +7 -0
- package/build/tab/save.cjs +2 -2
- package/build/tab/save.cjs.map +2 -2
- package/build/tab-panels/block.json +70 -0
- package/build/tab-panels/edit.cjs +63 -0
- package/build/tab-panels/edit.cjs.map +7 -0
- package/build/tab-panels/icon.cjs +29 -0
- package/build/tab-panels/icon.cjs.map +7 -0
- package/build/tab-panels/index.cjs +58 -0
- package/build/tab-panels/index.cjs.map +7 -0
- package/build/tab-panels/save.cjs +33 -0
- package/build/tab-panels/save.cjs.map +7 -0
- package/build/tabs/block.json +61 -90
- package/build/tabs/controls.cjs +19 -221
- package/build/tabs/controls.cjs.map +3 -3
- package/build/tabs/deprecated.cjs +179 -0
- package/build/tabs/deprecated.cjs.map +7 -0
- package/build/tabs/edit.cjs +84 -62
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/index.cjs +3 -1
- package/build/tabs/index.cjs.map +3 -3
- package/build/tabs/save.cjs +6 -9
- package/build/tabs/save.cjs.map +2 -2
- package/build/tabs-menu/block.json +77 -0
- package/build/tabs-menu/edit.cjs +204 -0
- package/build/tabs-menu/edit.cjs.map +7 -0
- package/build/tabs-menu/icon.cjs +29 -0
- package/build/tabs-menu/icon.cjs.map +7 -0
- package/build/tabs-menu/index.cjs +58 -0
- package/build/tabs-menu/index.cjs.map +7 -0
- package/build/tabs-menu/save.cjs +35 -0
- package/build/tabs-menu/save.cjs.map +7 -0
- package/build/tabs-menu-item/block.json +98 -0
- package/build/tabs-menu-item/controls.cjs +247 -0
- package/build/tabs-menu-item/controls.cjs.map +7 -0
- package/build/tabs-menu-item/edit.cjs +272 -0
- package/build/tabs-menu-item/edit.cjs.map +7 -0
- package/build/tabs-menu-item/icon.cjs +29 -0
- package/build/tabs-menu-item/icon.cjs.map +7 -0
- package/build/tabs-menu-item/index.cjs +58 -0
- package/build/tabs-menu-item/index.cjs.map +7 -0
- package/build/tabs-menu-item/save.cjs +50 -0
- package/build/tabs-menu-item/save.cjs.map +7 -0
- package/build/template-part/edit/index.cjs +2 -2
- package/build/template-part/edit/index.cjs.map +2 -2
- package/build/utils/caption.cjs +4 -6
- package/build/utils/caption.cjs.map +3 -3
- package/build/verse/block.json +1 -3
- package/build/verse/deprecated.cjs +74 -5
- package/build/verse/deprecated.cjs.map +3 -3
- package/build/verse/edit.cjs +33 -48
- package/build/verse/edit.cjs.map +3 -3
- package/build/verse/save.cjs +2 -16
- package/build/verse/save.cjs.map +3 -3
- package/build/video/edit.cjs +4 -2
- package/build/video/edit.cjs.map +2 -2
- package/build-module/block/block.json +2 -1
- package/build-module/breadcrumbs/edit.mjs +15 -5
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/index.mjs +1 -0
- package/build-module/breadcrumbs/index.mjs.map +2 -2
- package/build-module/button/index.mjs +3 -0
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/comment-date/block.json +1 -0
- package/build-module/comment-edit-link/block.json +1 -3
- package/build-module/comment-edit-link/deprecated.mjs +60 -0
- package/build-module/comment-edit-link/deprecated.mjs.map +7 -0
- package/build-module/comment-edit-link/edit.mjs +7 -24
- package/build-module/comment-edit-link/edit.mjs.map +2 -2
- package/build-module/comment-edit-link/index.mjs +2 -0
- package/build-module/comment-edit-link/index.mjs.map +2 -2
- package/build-module/comment-reply-link/block.json +1 -5
- package/build-module/comment-reply-link/deprecated.mjs +53 -0
- package/build-module/comment-reply-link/deprecated.mjs.map +7 -0
- package/build-module/comment-reply-link/edit.mjs +12 -29
- package/build-module/comment-reply-link/edit.mjs.map +2 -2
- package/build-module/comment-reply-link/index.mjs +2 -0
- package/build-module/comment-reply-link/index.mjs.map +2 -2
- package/build-module/comments-title/block.json +1 -3
- package/build-module/comments-title/deprecated.mjs +148 -24
- package/build-module/comments-title/deprecated.mjs.map +2 -2
- package/build-module/comments-title/edit.mjs +17 -32
- package/build-module/comments-title/edit.mjs.map +2 -2
- package/build-module/cover/edit/block-controls.mjs +11 -3
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +6 -2
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +1 -1
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/index.mjs +3 -0
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/embed/util.mjs +8 -0
- package/build-module/embed/util.mjs.map +2 -2
- package/build-module/freeform/block.json +2 -1
- package/build-module/heading/index.mjs +3 -0
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/html/block.json +2 -1
- package/build-module/image/image.mjs +43 -9
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +1 -1
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/index.mjs +6 -0
- package/build-module/index.mjs.map +2 -2
- package/build-module/list-item/index.mjs +12 -1
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/missing/block.json +2 -1
- package/build-module/more/block.json +2 -1
- package/build-module/more/index.mjs +1 -1
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/block.json +5 -4
- package/build-module/navigation/deprecated.mjs +133 -5
- package/build-module/navigation/deprecated.mjs.map +2 -2
- package/build-module/navigation/edit/deleted-overlay-warning.mjs +49 -0
- package/build-module/navigation/edit/deleted-overlay-warning.mjs.map +7 -0
- package/build-module/navigation/edit/index.mjs +145 -65
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-panel.mjs +10 -1
- package/build-module/navigation/edit/overlay-panel.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-preview.mjs +99 -0
- package/build-module/navigation/edit/overlay-preview.mjs.map +7 -0
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +61 -26
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/responsive-wrapper.mjs +12 -1
- package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
- package/build-module/navigation/edit/use-create-overlay.mjs +21 -4
- package/build-module/navigation/edit/use-create-overlay.mjs.map +2 -2
- package/build-module/navigation/utils/get-submenu-visibility.mjs +12 -0
- package/build-module/navigation/utils/get-submenu-visibility.mjs.map +7 -0
- package/build-module/navigation-link/edit.mjs +4 -40
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +4 -0
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/select-label-text.mjs +15 -0
- package/build-module/navigation-link/shared/select-label-text.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-is-dragging-within.mjs +34 -0
- package/build-module/navigation-link/shared/use-is-dragging-within.mjs.map +7 -0
- package/build-module/navigation-submenu/block.json +1 -1
- package/build-module/navigation-submenu/edit.mjs +10 -47
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/navigation-submenu/index.mjs +2 -2
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/nextpage/block.json +2 -1
- package/build-module/paragraph/block.json +1 -0
- package/build-module/paragraph/index.mjs +1 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +1 -1
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/shortcode/block.json +2 -1
- package/build-module/tab/add-tab-toolbar-control.mjs +32 -10
- package/build-module/tab/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab/block.json +18 -4
- package/build-module/tab/controls.mjs +4 -8
- package/build-module/tab/controls.mjs.map +2 -2
- package/build-module/tab/edit.mjs +48 -128
- package/build-module/tab/edit.mjs.map +2 -2
- package/build-module/tab/remove-tab-toolbar-control.mjs +73 -0
- package/build-module/tab/remove-tab-toolbar-control.mjs.map +7 -0
- package/build-module/tab/save.mjs +2 -2
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +70 -0
- package/build-module/tab-panels/edit.mjs +36 -0
- package/build-module/tab-panels/edit.mjs.map +7 -0
- package/build-module/tab-panels/icon.mjs +8 -0
- package/build-module/tab-panels/icon.mjs.map +7 -0
- package/build-module/tab-panels/index.mjs +20 -0
- package/build-module/tab-panels/index.mjs.map +7 -0
- package/build-module/tab-panels/save.mjs +12 -0
- package/build-module/tab-panels/save.mjs.map +7 -0
- package/build-module/tabs/block.json +61 -90
- package/build-module/tabs/controls.mjs +21 -228
- package/build-module/tabs/controls.mjs.map +2 -2
- package/build-module/tabs/deprecated.mjs +158 -0
- package/build-module/tabs/deprecated.mjs.map +7 -0
- package/build-module/tabs/edit.mjs +87 -64
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +3 -1
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/save.mjs +7 -10
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/tabs-menu/block.json +77 -0
- package/build-module/tabs-menu/edit.mjs +186 -0
- package/build-module/tabs-menu/edit.mjs.map +7 -0
- package/build-module/tabs-menu/icon.mjs +8 -0
- package/build-module/tabs-menu/icon.mjs.map +7 -0
- package/build-module/tabs-menu/index.mjs +20 -0
- package/build-module/tabs-menu/index.mjs.map +7 -0
- package/build-module/tabs-menu/save.mjs +14 -0
- package/build-module/tabs-menu/save.mjs.map +7 -0
- package/build-module/tabs-menu-item/block.json +98 -0
- package/build-module/tabs-menu-item/controls.mjs +227 -0
- package/build-module/tabs-menu-item/controls.mjs.map +7 -0
- package/build-module/tabs-menu-item/edit.mjs +253 -0
- package/build-module/tabs-menu-item/edit.mjs.map +7 -0
- package/build-module/tabs-menu-item/icon.mjs +8 -0
- package/build-module/tabs-menu-item/icon.mjs.map +7 -0
- package/build-module/tabs-menu-item/index.mjs +20 -0
- package/build-module/tabs-menu-item/index.mjs.map +7 -0
- package/build-module/tabs-menu-item/save.mjs +29 -0
- package/build-module/tabs-menu-item/save.mjs.map +7 -0
- package/build-module/template-part/edit/index.mjs +2 -2
- package/build-module/template-part/edit/index.mjs.map +2 -2
- package/build-module/utils/caption.mjs +1 -3
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/verse/block.json +1 -3
- package/build-module/verse/deprecated.mjs +74 -5
- package/build-module/verse/deprecated.mjs.map +2 -2
- package/build-module/verse/edit.mjs +35 -55
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/verse/save.mjs +2 -6
- package/build-module/verse/save.mjs.map +2 -2
- package/build-module/video/edit.mjs +4 -2
- package/build-module/video/edit.mjs.map +2 -2
- package/build-style/editor-rtl.css +64 -21
- package/build-style/editor.css +64 -21
- package/build-style/gallery/style-rtl.css +1 -1
- package/build-style/gallery/style.css +1 -1
- package/build-style/media-text/style-rtl.css +2 -0
- package/build-style/media-text/style.css +2 -0
- package/build-style/navigation/editor-rtl.css +48 -0
- package/build-style/navigation/editor.css +48 -0
- package/build-style/navigation/style-rtl.css +64 -18
- package/build-style/navigation/style.css +64 -18
- package/build-style/style-rtl.css +109 -171
- package/build-style/style.css +109 -171
- package/build-style/tab/style-rtl.css +7 -1
- package/build-style/tab/style.css +7 -1
- package/build-style/tab-panels/style-rtl.css +4 -0
- package/build-style/tab-panels/style.css +4 -0
- package/build-style/tabs/style-rtl.css +1 -167
- package/build-style/tabs/style.css +1 -167
- package/build-style/tabs-menu/editor-rtl.css +4 -0
- package/build-style/tabs-menu/editor.css +4 -0
- package/build-style/tabs-menu/style-rtl.css +8 -0
- package/build-style/tabs-menu/style.css +8 -0
- package/build-style/tabs-menu-item/editor-rtl.css +16 -0
- package/build-style/tabs-menu-item/editor.css +16 -0
- package/build-style/tabs-menu-item/style-rtl.css +34 -0
- package/build-style/tabs-menu-item/style.css +34 -0
- package/build-style/verse/style-rtl.css +1 -0
- package/build-style/verse/style.css +1 -0
- package/package.json +37 -37
- package/src/block/block.json +2 -1
- package/src/breadcrumbs/edit.js +10 -2
- package/src/breadcrumbs/index.js +1 -0
- package/src/button/index.js +4 -0
- package/src/categories/index.php +5 -1
- package/src/comment-date/block.json +1 -0
- package/src/comment-edit-link/block.json +1 -3
- package/src/comment-edit-link/deprecated.js +63 -0
- package/src/comment-edit-link/edit.js +7 -31
- package/src/comment-edit-link/index.js +2 -0
- package/src/comment-reply-link/block.json +1 -5
- package/src/comment-reply-link/deprecated.js +56 -0
- package/src/comment-reply-link/edit.js +6 -35
- package/src/comment-reply-link/index.js +2 -0
- package/src/comments-title/block.json +1 -3
- package/src/comments-title/deprecated.js +153 -23
- package/src/comments-title/edit.js +9 -25
- package/src/cover/edit/block-controls.js +14 -3
- package/src/cover/edit/embed-video-url-input.js +6 -2
- package/src/cover/edit/inspector-controls.js +1 -3
- package/src/details/index.js +4 -0
- package/src/editor.scss +2 -1
- package/src/embed/test/index.js +49 -0
- package/src/embed/util.js +21 -0
- package/src/freeform/block.json +2 -1
- package/src/gallery/style.scss +1 -1
- package/src/heading/index.js +4 -0
- package/src/html/block.json +2 -1
- package/src/image/image.js +63 -11
- package/src/image/index.js +4 -1
- package/src/index.js +6 -0
- package/src/list-item/index.js +16 -0
- package/src/media-text/style.scss +2 -0
- package/src/missing/block.json +2 -1
- package/src/more/block.json +2 -1
- package/src/more/index.js +4 -1
- package/src/navigation/block.json +5 -4
- package/src/navigation/deprecated.js +144 -5
- package/src/navigation/edit/deleted-overlay-warning.js +56 -0
- package/src/navigation/edit/index.js +181 -70
- package/src/navigation/edit/overlay-panel.js +10 -0
- package/src/navigation/edit/overlay-preview.js +133 -0
- package/src/navigation/edit/overlay-template-part-selector.js +76 -26
- package/src/navigation/edit/responsive-wrapper.js +14 -1
- package/src/navigation/edit/test/overlay-template-part-selector.js +24 -16
- package/src/navigation/edit/test/responsive-wrapper.js +179 -0
- package/src/navigation/edit/test/use-create-overlay.js +129 -2
- package/src/navigation/edit/use-create-overlay.js +26 -4
- package/src/navigation/editor.scss +51 -0
- package/src/navigation/index.php +59 -11
- package/src/navigation/style.scss +140 -76
- package/src/navigation/utils/get-submenu-visibility.js +27 -0
- package/src/navigation/utils/test/get-submenu-visibility.js +47 -0
- package/src/navigation-link/edit.js +3 -67
- package/src/navigation-link/shared/index.js +2 -0
- package/src/navigation-link/shared/select-label-text.js +16 -0
- package/src/navigation-link/shared/use-is-dragging-within.js +55 -0
- package/src/navigation-submenu/block.json +1 -1
- package/src/navigation-submenu/edit.js +10 -73
- package/src/navigation-submenu/index.js +6 -3
- package/src/navigation-submenu/index.php +36 -5
- package/src/nextpage/block.json +2 -1
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/index.js +4 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-excerpt/index.php +39 -16
- package/src/shortcode/block.json +2 -1
- package/src/style.scss +3 -0
- package/src/tab/add-tab-toolbar-control.js +36 -11
- package/src/tab/block.json +18 -4
- package/src/tab/controls.js +4 -5
- package/src/tab/edit.js +75 -150
- package/src/tab/index.php +5 -63
- package/src/tab/remove-tab-toolbar-control.js +103 -0
- package/src/tab/save.js +1 -3
- package/src/tab/style.scss +8 -1
- package/src/tab-panels/block.json +70 -0
- package/src/tab-panels/edit.js +44 -0
- package/src/tab-panels/icon.js +10 -0
- package/src/tab-panels/index.js +21 -0
- package/src/tab-panels/save.js +11 -0
- package/src/tab-panels/style.scss +4 -0
- package/src/tabs/block.json +61 -90
- package/src/tabs/controls.js +7 -221
- package/src/tabs/deprecated.js +214 -0
- package/src/tabs/edit.js +108 -68
- package/src/tabs/index.js +2 -0
- package/src/tabs/index.php +86 -191
- package/src/tabs/save.js +6 -13
- package/src/tabs/style.scss +1 -187
- package/src/tabs-menu/block.json +77 -0
- package/src/tabs-menu/edit.js +251 -0
- package/src/tabs-menu/editor.scss +6 -0
- package/src/tabs-menu/icon.js +10 -0
- package/src/tabs-menu/index.js +21 -0
- package/src/tabs-menu/index.php +74 -0
- package/src/tabs-menu/save.js +18 -0
- package/src/tabs-menu/style.scss +8 -0
- package/src/tabs-menu-item/block.json +98 -0
- package/src/tabs-menu-item/controls.js +262 -0
- package/src/tabs-menu-item/edit.js +322 -0
- package/src/tabs-menu-item/editor.scss +20 -0
- package/src/tabs-menu-item/icon.js +10 -0
- package/src/tabs-menu-item/index.js +21 -0
- package/src/tabs-menu-item/index.php +82 -0
- package/src/tabs-menu-item/save.js +44 -0
- package/src/tabs-menu-item/style.scss +42 -0
- package/src/template-part/edit/index.js +2 -4
- package/src/utils/caption.js +1 -7
- package/src/verse/block.json +1 -3
- package/src/verse/deprecated.js +83 -4
- package/src/verse/edit.js +37 -56
- package/src/verse/save.js +2 -11
- package/src/verse/style.scss +1 -0
- package/src/video/edit.js +4 -2
- package/build/tab/tabs-list.cjs +0 -132
- package/build/tab/tabs-list.cjs.map +0 -7
- package/build/tabs/style-engine.cjs +0 -119
- package/build/tabs/style-engine.cjs.map +0 -7
- package/build-module/tab/tabs-list.mjs +0 -101
- package/build-module/tab/tabs-list.mjs.map +0 -7
- package/build-module/tabs/style-engine.mjs +0 -101
- package/build-module/tabs/style-engine.mjs.map +0 -7
- package/build-style/tabs/editor-rtl.css +0 -26
- package/build-style/tabs/editor.css +0 -26
- package/src/tab/tabs-list.js +0 -122
- package/src/tabs/editor.scss +0 -30
- package/src/tabs/style-engine.js +0 -164
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useBlockProps } from '@wordpress/block-editor';
|
|
6
|
+
|
|
7
|
+
export default function save( { attributes } ) {
|
|
8
|
+
// Build CSS custom properties for active/hover colors
|
|
9
|
+
const customColorStyles = {};
|
|
10
|
+
|
|
11
|
+
// Active/hover colors from custom attributes
|
|
12
|
+
if ( attributes.customActiveBackgroundColor ) {
|
|
13
|
+
customColorStyles[ '--custom-tab-active-color' ] =
|
|
14
|
+
attributes.customActiveBackgroundColor;
|
|
15
|
+
}
|
|
16
|
+
if ( attributes.customActiveTextColor ) {
|
|
17
|
+
customColorStyles[ '--custom-tab-active-text-color' ] =
|
|
18
|
+
attributes.customActiveTextColor;
|
|
19
|
+
}
|
|
20
|
+
if ( attributes.customHoverBackgroundColor ) {
|
|
21
|
+
customColorStyles[ '--custom-tab-hover-color' ] =
|
|
22
|
+
attributes.customHoverBackgroundColor;
|
|
23
|
+
}
|
|
24
|
+
if ( attributes.customHoverTextColor ) {
|
|
25
|
+
customColorStyles[ '--custom-tab-hover-text-color' ] =
|
|
26
|
+
attributes.customHoverTextColor;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// useBlockProps.save includes all core style engine classes and styles
|
|
30
|
+
// We add our custom classes and the hidden attribute for PHP template extraction
|
|
31
|
+
const blockProps = useBlockProps.save( {
|
|
32
|
+
className: 'wp-block-tabs-menu-item__template',
|
|
33
|
+
style: customColorStyles,
|
|
34
|
+
hidden: true,
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<a { ...blockProps }>
|
|
39
|
+
<span className="screen-reader-text">
|
|
40
|
+
{ __( 'Tab menu item' ) }
|
|
41
|
+
</span>
|
|
42
|
+
</a>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.wp-block-tabs-menu-item {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: block;
|
|
4
|
+
width: max-content;
|
|
5
|
+
text-decoration: none;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
flex-basis: inherit !important;
|
|
8
|
+
flex-grow: inherit !important;
|
|
9
|
+
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding-block: var(--tab-padding-block, var(--wp--preset--spacing--20, 0.5em));
|
|
12
|
+
padding-inline: var(--tab-padding-inline, var(--wp--preset--spacing--30, 1em));
|
|
13
|
+
|
|
14
|
+
// Inherit typography from parent
|
|
15
|
+
font-size: inherit;
|
|
16
|
+
font-family: inherit;
|
|
17
|
+
font-weight: inherit;
|
|
18
|
+
line-height: inherit;
|
|
19
|
+
letter-spacing: inherit;
|
|
20
|
+
text-transform: inherit;
|
|
21
|
+
text-align: inherit;
|
|
22
|
+
|
|
23
|
+
&:focus {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
outline: 2px solid var(--tab-border-color-active, #000);
|
|
29
|
+
outline-offset: 2px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background-color: var(--custom-tab-hover-color, #eaeaea) !important;
|
|
34
|
+
color: var(--custom-tab-hover-text-color, #000) !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&[aria-selected="true"],
|
|
38
|
+
&.is-active {
|
|
39
|
+
background-color: var(--custom-tab-active-color, #000) !important;
|
|
40
|
+
color: var(--custom-tab-active-text-color, #fff) !important;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -264,9 +264,7 @@ export default function TemplatePartEdit( {
|
|
|
264
264
|
} );
|
|
265
265
|
} }
|
|
266
266
|
>
|
|
267
|
-
{
|
|
268
|
-
? __( 'Edit section' )
|
|
269
|
-
: __( 'Edit' ) }
|
|
267
|
+
{ __( 'Edit section' ) }
|
|
270
268
|
</ToolbarButton>
|
|
271
269
|
</BlockControls>
|
|
272
270
|
) }
|
|
@@ -324,7 +322,7 @@ export default function TemplatePartEdit( {
|
|
|
324
322
|
} }
|
|
325
323
|
</BlockSettingsMenuControls>
|
|
326
324
|
|
|
327
|
-
<InspectorControls>
|
|
325
|
+
<InspectorControls group="settings">
|
|
328
326
|
<TemplatesList
|
|
329
327
|
area={ area }
|
|
330
328
|
clientId={ clientId }
|
package/src/utils/caption.js
CHANGED
|
@@ -12,17 +12,12 @@ import { __ } from '@wordpress/i18n';
|
|
|
12
12
|
import {
|
|
13
13
|
BlockControls,
|
|
14
14
|
__experimentalGetElementClassName,
|
|
15
|
-
|
|
15
|
+
RichText,
|
|
16
16
|
} from '@wordpress/block-editor';
|
|
17
17
|
import { ToolbarButton } from '@wordpress/components';
|
|
18
18
|
import { caption as captionIcon } from '@wordpress/icons';
|
|
19
19
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
import { unlock } from '../lock-unlock';
|
|
25
|
-
|
|
26
21
|
export function Caption( {
|
|
27
22
|
attributeKey = 'caption',
|
|
28
23
|
attributes,
|
|
@@ -43,7 +38,6 @@ export function Caption( {
|
|
|
43
38
|
} ) {
|
|
44
39
|
const caption = attributes[ attributeKey ];
|
|
45
40
|
const prevCaption = usePrevious( caption );
|
|
46
|
-
const { PrivateRichText: RichText } = unlock( blockEditorPrivateApis );
|
|
47
41
|
const isCaptionEmpty = RichText.isEmpty( caption );
|
|
48
42
|
const isPrevCaptionEmpty = RichText.isEmpty( prevCaption );
|
|
49
43
|
const [ showCaption, setShowCaption ] = useState( ! isCaptionEmpty );
|
package/src/verse/block.json
CHANGED
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
"selector": "pre",
|
|
15
15
|
"__unstablePreserveWhiteSpace": true,
|
|
16
16
|
"role": "content"
|
|
17
|
-
},
|
|
18
|
-
"textAlign": {
|
|
19
|
-
"type": "string"
|
|
20
17
|
}
|
|
21
18
|
},
|
|
22
19
|
"supports": {
|
|
@@ -46,6 +43,7 @@
|
|
|
46
43
|
"fontSize": true,
|
|
47
44
|
"__experimentalFontFamily": true,
|
|
48
45
|
"lineHeight": true,
|
|
46
|
+
"textAlign": true,
|
|
49
47
|
"__experimentalFontStyle": true,
|
|
50
48
|
"__experimentalFontWeight": true,
|
|
51
49
|
"__experimentalLetterSpacing": true,
|
package/src/verse/deprecated.js
CHANGED
|
@@ -12,6 +12,7 @@ import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import migrateFontFamily from '../utils/migrate-font-family';
|
|
15
|
+
import migrateTextAlign from '../utils/migrate-text-align';
|
|
15
16
|
|
|
16
17
|
const v1 = {
|
|
17
18
|
attributes: {
|
|
@@ -36,6 +37,7 @@ const v1 = {
|
|
|
36
37
|
/>
|
|
37
38
|
);
|
|
38
39
|
},
|
|
40
|
+
migrate: migrateTextAlign,
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
const v2 = {
|
|
@@ -79,9 +81,86 @@ const v2 = {
|
|
|
79
81
|
</pre>
|
|
80
82
|
);
|
|
81
83
|
},
|
|
82
|
-
migrate
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
migrate( attributes ) {
|
|
85
|
+
return migrateTextAlign( migrateFontFamily( attributes ) );
|
|
86
|
+
},
|
|
87
|
+
isEligible( { style, textAlign } ) {
|
|
88
|
+
return style?.typography?.fontFamily || !! textAlign;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const v3 = {
|
|
93
|
+
attributes: {
|
|
94
|
+
content: {
|
|
95
|
+
type: 'rich-text',
|
|
96
|
+
source: 'rich-text',
|
|
97
|
+
selector: 'pre',
|
|
98
|
+
__unstablePreserveWhiteSpace: true,
|
|
99
|
+
role: 'content',
|
|
100
|
+
},
|
|
101
|
+
textAlign: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
supports: {
|
|
106
|
+
anchor: true,
|
|
107
|
+
background: {
|
|
108
|
+
backgroundImage: true,
|
|
109
|
+
backgroundSize: true,
|
|
110
|
+
},
|
|
111
|
+
color: {
|
|
112
|
+
gradients: true,
|
|
113
|
+
link: true,
|
|
114
|
+
},
|
|
115
|
+
dimensions: {
|
|
116
|
+
minHeight: true,
|
|
117
|
+
},
|
|
118
|
+
typography: {
|
|
119
|
+
fontSize: true,
|
|
120
|
+
__experimentalFontFamily: true,
|
|
121
|
+
lineHeight: true,
|
|
122
|
+
__experimentalFontStyle: true,
|
|
123
|
+
__experimentalFontWeight: true,
|
|
124
|
+
__experimentalLetterSpacing: true,
|
|
125
|
+
__experimentalTextTransform: true,
|
|
126
|
+
__experimentalTextDecoration: true,
|
|
127
|
+
__experimentalWritingMode: true,
|
|
128
|
+
},
|
|
129
|
+
spacing: {
|
|
130
|
+
margin: true,
|
|
131
|
+
padding: true,
|
|
132
|
+
},
|
|
133
|
+
__experimentalBorder: {
|
|
134
|
+
radius: true,
|
|
135
|
+
width: true,
|
|
136
|
+
color: true,
|
|
137
|
+
style: true,
|
|
138
|
+
},
|
|
139
|
+
interactivity: {
|
|
140
|
+
clientNavigation: true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
save( { attributes } ) {
|
|
144
|
+
const { textAlign, content } = attributes;
|
|
145
|
+
|
|
146
|
+
const className = clsx( {
|
|
147
|
+
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
148
|
+
} );
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<pre { ...useBlockProps.save( { className } ) }>
|
|
152
|
+
<RichText.Content value={ content } />
|
|
153
|
+
</pre>
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
migrate: migrateTextAlign,
|
|
157
|
+
isEligible( attributes ) {
|
|
158
|
+
return (
|
|
159
|
+
!! attributes.textAlign ||
|
|
160
|
+
!! attributes.className?.match(
|
|
161
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
162
|
+
)
|
|
163
|
+
);
|
|
85
164
|
},
|
|
86
165
|
};
|
|
87
166
|
|
|
@@ -93,4 +172,4 @@ const v2 = {
|
|
|
93
172
|
*
|
|
94
173
|
* See block-deprecation.md
|
|
95
174
|
*/
|
|
96
|
-
export default [ v2, v1 ];
|
|
175
|
+
export default [ v3, v2, v1 ];
|
package/src/verse/edit.js
CHANGED
|
@@ -1,67 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
11
|
-
RichText,
|
|
12
|
-
BlockControls,
|
|
13
|
-
AlignmentToolbar,
|
|
14
|
-
useBlockProps,
|
|
15
|
-
} from '@wordpress/block-editor';
|
|
5
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
16
6
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} ),
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
|
|
12
|
+
|
|
13
|
+
export default function VerseEdit( props ) {
|
|
14
|
+
const {
|
|
15
|
+
attributes,
|
|
16
|
+
setAttributes,
|
|
17
|
+
mergeBlocks,
|
|
18
|
+
onRemove,
|
|
19
|
+
insertBlocksAfter,
|
|
31
20
|
style,
|
|
32
|
-
}
|
|
21
|
+
} = props;
|
|
22
|
+
const { content } = attributes;
|
|
23
|
+
useDeprecatedTextAlign( props );
|
|
24
|
+
const blockProps = useBlockProps( { style } );
|
|
33
25
|
|
|
34
26
|
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
placeholder={ __( 'Write verse…' ) }
|
|
56
|
-
onRemove={ onRemove }
|
|
57
|
-
onMerge={ mergeBlocks }
|
|
58
|
-
textAlign={ textAlign }
|
|
59
|
-
{ ...blockProps }
|
|
60
|
-
__unstablePastePlainText
|
|
61
|
-
__unstableOnSplitAtDoubleLineEnd={ () =>
|
|
62
|
-
insertBlocksAfter( createBlock( getDefaultBlockName() ) )
|
|
63
|
-
}
|
|
64
|
-
/>
|
|
65
|
-
</>
|
|
27
|
+
<RichText
|
|
28
|
+
tagName="pre"
|
|
29
|
+
identifier="content"
|
|
30
|
+
preserveWhiteSpace
|
|
31
|
+
value={ content }
|
|
32
|
+
onChange={ ( nextContent ) => {
|
|
33
|
+
setAttributes( {
|
|
34
|
+
content: nextContent,
|
|
35
|
+
} );
|
|
36
|
+
} }
|
|
37
|
+
aria-label={ __( 'Verse text' ) }
|
|
38
|
+
placeholder={ __( 'Write verse…' ) }
|
|
39
|
+
onRemove={ onRemove }
|
|
40
|
+
onMerge={ mergeBlocks }
|
|
41
|
+
{ ...blockProps }
|
|
42
|
+
__unstablePastePlainText
|
|
43
|
+
__unstableOnSplitAtDoubleLineEnd={ () =>
|
|
44
|
+
insertBlocksAfter( createBlock( getDefaultBlockName() ) )
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
66
47
|
);
|
|
67
48
|
}
|
package/src/verse/save.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
5
|
|
|
11
6
|
export default function save( { attributes } ) {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
const className = clsx( {
|
|
15
|
-
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
16
|
-
} );
|
|
7
|
+
const { content } = attributes;
|
|
17
8
|
|
|
18
9
|
return (
|
|
19
|
-
<pre { ...useBlockProps.save(
|
|
10
|
+
<pre { ...useBlockProps.save() }>
|
|
20
11
|
<RichText.Content value={ content } />
|
|
21
12
|
</pre>
|
|
22
13
|
);
|
package/src/verse/style.scss
CHANGED
package/src/video/edit.js
CHANGED
|
@@ -27,6 +27,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
27
27
|
import { useDispatch } from '@wordpress/data';
|
|
28
28
|
import { video as icon } from '@wordpress/icons';
|
|
29
29
|
import { store as noticesStore } from '@wordpress/notices';
|
|
30
|
+
import { prependHTTPS } from '@wordpress/url';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Internal dependencies
|
|
@@ -110,9 +111,10 @@ function VideoEdit( {
|
|
|
110
111
|
|
|
111
112
|
function onSelectURL( newSrc ) {
|
|
112
113
|
if ( newSrc !== src ) {
|
|
114
|
+
const url = prependHTTPS( newSrc );
|
|
113
115
|
// Check if there's an embed block that handles this URL.
|
|
114
116
|
const embedBlock = createUpgradedEmbedBlock( {
|
|
115
|
-
attributes: { url
|
|
117
|
+
attributes: { url },
|
|
116
118
|
} );
|
|
117
119
|
if ( undefined !== embedBlock && onReplace ) {
|
|
118
120
|
onReplace( embedBlock );
|
|
@@ -120,7 +122,7 @@ function VideoEdit( {
|
|
|
120
122
|
}
|
|
121
123
|
setAttributes( {
|
|
122
124
|
blob: undefined,
|
|
123
|
-
src:
|
|
125
|
+
src: url,
|
|
124
126
|
id: undefined,
|
|
125
127
|
poster: undefined,
|
|
126
128
|
} );
|
package/build/tab/tabs-list.cjs
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/block-library/src/tab/tabs-list.js
|
|
31
|
-
var tabs_list_exports = {};
|
|
32
|
-
__export(tabs_list_exports, {
|
|
33
|
-
default: () => TabsList
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(tabs_list_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_i18n = require("@wordpress/i18n");
|
|
38
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
39
|
-
var import_html_entities = require("@wordpress/html-entities");
|
|
40
|
-
var import_element = require("@wordpress/element");
|
|
41
|
-
var import_slug_from_label = __toESM(require("./slug-from-label.cjs"));
|
|
42
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
function StaticLabel({ label, index }) {
|
|
44
|
-
if (label) {
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.RawHTML, { children: (0, import_html_entities.decodeEntities)(label) }) });
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_i18n.sprintf)(
|
|
48
|
-
/* translators: %d is the tab index + 1 */
|
|
49
|
-
(0, import_i18n.__)("Tab %d"),
|
|
50
|
-
index + 1
|
|
51
|
-
) });
|
|
52
|
-
}
|
|
53
|
-
function TabsList({
|
|
54
|
-
siblingTabs,
|
|
55
|
-
currentClientId,
|
|
56
|
-
currentBlockIndex,
|
|
57
|
-
currentLabel,
|
|
58
|
-
tabItemColorProps,
|
|
59
|
-
onSelectTab,
|
|
60
|
-
onLabelChange,
|
|
61
|
-
labelRef,
|
|
62
|
-
focusRef,
|
|
63
|
-
labelElementRef
|
|
64
|
-
}) {
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { role: "tablist", className: "tabs__list", children: siblingTabs.map((tab, index) => {
|
|
66
|
-
const isCurrentTab = tab.clientId === currentClientId;
|
|
67
|
-
const isSiblingTabActive = index === currentBlockIndex;
|
|
68
|
-
const tabAttributes = tab.attributes || {};
|
|
69
|
-
const siblingLabel = tabAttributes.label || "";
|
|
70
|
-
const siblingAnchor = tabAttributes.anchor || (0, import_slug_from_label.default)(siblingLabel, index);
|
|
71
|
-
const siblingTabPanelId = siblingAnchor;
|
|
72
|
-
const siblingTabLabelId = `${siblingTabPanelId}--tab`;
|
|
73
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
-
"button",
|
|
75
|
-
{
|
|
76
|
-
"aria-controls": siblingTabPanelId,
|
|
77
|
-
"aria-selected": isSiblingTabActive,
|
|
78
|
-
id: siblingTabLabelId,
|
|
79
|
-
role: "tab",
|
|
80
|
-
className: (0, import_clsx.default)(
|
|
81
|
-
"tabs__tab-label",
|
|
82
|
-
tabItemColorProps.className
|
|
83
|
-
),
|
|
84
|
-
style: {
|
|
85
|
-
...tabItemColorProps.style
|
|
86
|
-
},
|
|
87
|
-
tabIndex: isSiblingTabActive ? 0 : -1,
|
|
88
|
-
onClick: (event) => {
|
|
89
|
-
event.preventDefault();
|
|
90
|
-
onSelectTab(tab.clientId);
|
|
91
|
-
},
|
|
92
|
-
onKeyDown: (event) => {
|
|
93
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
94
|
-
event.preventDefault();
|
|
95
|
-
onSelectTab(tab.clientId);
|
|
96
|
-
if (isCurrentTab) {
|
|
97
|
-
const { requestAnimationFrame } = window;
|
|
98
|
-
focusRef.current = requestAnimationFrame(
|
|
99
|
-
() => {
|
|
100
|
-
labelElementRef.current?.focus();
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
children: isCurrentTab ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
-
import_block_editor.RichText,
|
|
108
|
-
{
|
|
109
|
-
ref: labelRef,
|
|
110
|
-
tagName: "span",
|
|
111
|
-
withoutInteractiveFormatting: true,
|
|
112
|
-
placeholder: (0, import_i18n.sprintf)(
|
|
113
|
-
/* translators: %d is the tab index + 1 */
|
|
114
|
-
(0, import_i18n.__)("Tab %d\u2026"),
|
|
115
|
-
currentBlockIndex + 1
|
|
116
|
-
),
|
|
117
|
-
value: (0, import_html_entities.decodeEntities)(currentLabel),
|
|
118
|
-
onChange: onLabelChange
|
|
119
|
-
}
|
|
120
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
-
StaticLabel,
|
|
122
|
-
{
|
|
123
|
-
label: siblingLabel,
|
|
124
|
-
index
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
},
|
|
128
|
-
tab.clientId
|
|
129
|
-
);
|
|
130
|
-
}) });
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=tabs-list.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tab/tabs-list.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { RichText } from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { RawHTML } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport slugFromLabel from './slug-from-label';\n\nfunction StaticLabel( { label, index } ) {\n\tif ( label ) {\n\t\treturn (\n\t\t\t<span>\n\t\t\t\t<RawHTML>{ decodeEntities( label ) }</RawHTML>\n\t\t\t</span>\n\t\t);\n\t}\n\treturn (\n\t\t<span>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %d is the tab index + 1 */\n\t\t\t\t__( 'Tab %d' ),\n\t\t\t\tindex + 1\n\t\t\t) }\n\t\t</span>\n\t);\n}\n\nexport default function TabsList( {\n\tsiblingTabs,\n\tcurrentClientId,\n\tcurrentBlockIndex,\n\tcurrentLabel,\n\ttabItemColorProps,\n\tonSelectTab,\n\tonLabelChange,\n\tlabelRef,\n\tfocusRef,\n\tlabelElementRef,\n} ) {\n\treturn (\n\t\t<div role=\"tablist\" className=\"tabs__list\">\n\t\t\t{ siblingTabs.map( ( tab, index ) => {\n\t\t\t\tconst isCurrentTab = tab.clientId === currentClientId;\n\t\t\t\tconst isSiblingTabActive = index === currentBlockIndex;\n\t\t\t\tconst tabAttributes = tab.attributes || {};\n\t\t\t\tconst siblingLabel = tabAttributes.label || '';\n\t\t\t\tconst siblingAnchor =\n\t\t\t\t\ttabAttributes.anchor ||\n\t\t\t\t\tslugFromLabel( siblingLabel, index );\n\t\t\t\tconst siblingTabPanelId = siblingAnchor;\n\t\t\t\tconst siblingTabLabelId = `${ siblingTabPanelId }--tab`;\n\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={ tab.clientId }\n\t\t\t\t\t\taria-controls={ siblingTabPanelId }\n\t\t\t\t\t\taria-selected={ isSiblingTabActive }\n\t\t\t\t\t\tid={ siblingTabLabelId }\n\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'tabs__tab-label',\n\t\t\t\t\t\t\ttabItemColorProps.className\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...tabItemColorProps.style,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttabIndex={ isSiblingTabActive ? 0 : -1 }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonSelectTab( tab.clientId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t// If shift is also pressed, do not select the block.\n\t\t\t\t\t\t\tif ( event.key === 'Enter' && ! event.shiftKey ) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tonSelectTab( tab.clientId );\n\t\t\t\t\t\t\t\tif ( isCurrentTab ) {\n\t\t\t\t\t\t\t\t\tconst { requestAnimationFrame } = window;\n\t\t\t\t\t\t\t\t\tfocusRef.current = requestAnimationFrame(\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tlabelElementRef.current?.focus();\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}\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\t\t{ isCurrentTab ? (\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\tref={ labelRef }\n\t\t\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d is the tab index + 1 */\n\t\t\t\t\t\t\t\t\t__( 'Tab %d\u2026' ),\n\t\t\t\t\t\t\t\t\tcurrentBlockIndex + 1\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ decodeEntities( currentLabel ) }\n\t\t\t\t\t\t\t\tonChange={ onLabelChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<StaticLabel\n\t\t\t\t\t\t\t\tlabel={ siblingLabel }\n\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA4B;AAC5B,0BAAyB;AACzB,2BAA+B;AAC/B,qBAAwB;AAKxB,6BAA0B;AAMtB;AAJJ,SAAS,YAAa,EAAE,OAAO,MAAM,GAAI;AACxC,MAAK,OAAQ;AACZ,WACC,4CAAC,UACA,sDAAC,0BAAU,mDAAgB,KAAM,GAAG,GACrC;AAAA,EAEF;AACA,SACC,4CAAC,UACE;AAAA;AAAA,QAED,gBAAI,QAAS;AAAA,IACb,QAAQ;AAAA,EACT,GACD;AAEF;AAEe,SAAR,SAA2B;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,4CAAC,SAAI,MAAK,WAAU,WAAU,cAC3B,sBAAY,IAAK,CAAE,KAAK,UAAW;AACpC,UAAM,eAAe,IAAI,aAAa;AACtC,UAAM,qBAAqB,UAAU;AACrC,UAAM,gBAAgB,IAAI,cAAc,CAAC;AACzC,UAAM,eAAe,cAAc,SAAS;AAC5C,UAAM,gBACL,cAAc,cACd,uBAAAA,SAAe,cAAc,KAAM;AACpC,UAAM,oBAAoB;AAC1B,UAAM,oBAAoB,GAAI,iBAAkB;AAEhD,WACC;AAAA,MAAC;AAAA;AAAA,QAEA,iBAAgB;AAAA,QAChB,iBAAgB;AAAA,QAChB,IAAK;AAAA,QACL,MAAK;AAAA,QACL,eAAY,YAAAC;AAAA,UACX;AAAA,UACA,kBAAkB;AAAA,QACnB;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,kBAAkB;AAAA,QACtB;AAAA,QACA,UAAW,qBAAqB,IAAI;AAAA,QACpC,SAAU,CAAE,UAAW;AACtB,gBAAM,eAAe;AACrB,sBAAa,IAAI,QAAS;AAAA,QAC3B;AAAA,QACA,WAAY,CAAE,UAAW;AAExB,cAAK,MAAM,QAAQ,WAAW,CAAE,MAAM,UAAW;AAChD,kBAAM,eAAe;AACrB,wBAAa,IAAI,QAAS;AAC1B,gBAAK,cAAe;AACnB,oBAAM,EAAE,sBAAsB,IAAI;AAClC,uBAAS,UAAU;AAAA,gBAClB,MAAM;AACL,kCAAgB,SAAS,MAAM;AAAA,gBAChC;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QAEE,yBACD;AAAA,UAAC;AAAA;AAAA,YACA,KAAM;AAAA,YACN,SAAQ;AAAA,YACR,8BAA4B;AAAA,YAC5B,iBAAc;AAAA;AAAA,kBAEb,gBAAI,cAAU;AAAA,cACd,oBAAoB;AAAA,YACrB;AAAA,YACA,WAAQ,qCAAgB,YAAa;AAAA,YACrC,UAAW;AAAA;AAAA,QACZ,IAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ;AAAA,YACR;AAAA;AAAA,QACD;AAAA;AAAA,MAlDK,IAAI;AAAA,IAoDX;AAAA,EAEF,CAAE,GACH;AAEF;",
|
|
6
|
-
"names": ["slugFromLabel", "clsx"]
|
|
7
|
-
}
|