@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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/tabs/style-engine.js
|
|
21
|
-
var style_engine_exports = {};
|
|
22
|
-
__export(style_engine_exports, {
|
|
23
|
-
default: () => StyleEngine
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(style_engine_exports);
|
|
26
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
27
|
-
function getGapStyles({ attributes }) {
|
|
28
|
-
const { style, orientation } = attributes || {};
|
|
29
|
-
const { spacing } = style || {};
|
|
30
|
-
const { blockGap } = spacing || {};
|
|
31
|
-
const fallbackValue = `var( --wp--style--tabs-gap-default, var( --wp--style--block-gap, 0.5em ) )`;
|
|
32
|
-
let listGapValue = fallbackValue;
|
|
33
|
-
let gapValue = fallbackValue;
|
|
34
|
-
if (!!blockGap) {
|
|
35
|
-
listGapValue = typeof blockGap === "string" ? (0, import_block_editor.__experimentalGetGapCSSValue)(blockGap) : (0, import_block_editor.__experimentalGetGapCSSValue)(blockGap?.left) || fallbackValue;
|
|
36
|
-
gapValue = typeof blockGap === "string" ? (0, import_block_editor.__experimentalGetGapCSSValue)(blockGap) : (0, import_block_editor.__experimentalGetGapCSSValue)(blockGap?.top) || fallbackValue;
|
|
37
|
-
}
|
|
38
|
-
if (orientation === "vertical") {
|
|
39
|
-
const _listGapValue = listGapValue;
|
|
40
|
-
const _gapValue = gapValue;
|
|
41
|
-
listGapValue = _gapValue;
|
|
42
|
-
gapValue = _listGapValue;
|
|
43
|
-
}
|
|
44
|
-
const gapMap = {
|
|
45
|
-
"--wp--style--unstable-tabs-list-gap": listGapValue === "0" ? "0px" : listGapValue,
|
|
46
|
-
"--wp--style--unstable-tabs-gap": gapValue
|
|
47
|
-
};
|
|
48
|
-
return gapMap;
|
|
49
|
-
}
|
|
50
|
-
function getColorStyles({ attributes }) {
|
|
51
|
-
const {
|
|
52
|
-
customTabInactiveColor,
|
|
53
|
-
customTabHoverColor,
|
|
54
|
-
customTabActiveColor,
|
|
55
|
-
customTabTextColor,
|
|
56
|
-
customTabActiveTextColor,
|
|
57
|
-
customTabHoverTextColor
|
|
58
|
-
} = attributes || {};
|
|
59
|
-
function getColorValue(color) {
|
|
60
|
-
if (!color) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
if (typeof color === "object" && color.slug) {
|
|
64
|
-
return `var(--wp--preset--color--${color.slug})`;
|
|
65
|
-
}
|
|
66
|
-
return color;
|
|
67
|
-
}
|
|
68
|
-
const colorVarMap = {
|
|
69
|
-
"--custom-tab-inactive-color": getColorValue(customTabInactiveColor),
|
|
70
|
-
"--custom-tab-active-color": getColorValue(customTabActiveColor),
|
|
71
|
-
"--custom-tab-hover-color": getColorValue(customTabHoverColor),
|
|
72
|
-
"--custom-tab-text-color": getColorValue(customTabTextColor),
|
|
73
|
-
"--custom-tab-active-text-color": getColorValue(
|
|
74
|
-
customTabActiveTextColor
|
|
75
|
-
),
|
|
76
|
-
"--custom-tab-hover-text-color": getColorValue(
|
|
77
|
-
customTabHoverTextColor
|
|
78
|
-
)
|
|
79
|
-
};
|
|
80
|
-
return colorVarMap;
|
|
81
|
-
}
|
|
82
|
-
function getBorderStyles({ attributes }) {
|
|
83
|
-
const { radius } = attributes?.style?.border || {};
|
|
84
|
-
if (!radius) {
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
let radiusValue = radius;
|
|
88
|
-
if (typeof radius === "object") {
|
|
89
|
-
const {
|
|
90
|
-
topLeft = "0",
|
|
91
|
-
topRight = "0",
|
|
92
|
-
bottomRight = "0",
|
|
93
|
-
bottomLeft = "0"
|
|
94
|
-
} = radius;
|
|
95
|
-
radiusValue = `${topLeft} ${topRight} ${bottomRight} ${bottomLeft}`;
|
|
96
|
-
}
|
|
97
|
-
const borderMap = {
|
|
98
|
-
"--tab-border-radius": radiusValue
|
|
99
|
-
};
|
|
100
|
-
return borderMap;
|
|
101
|
-
}
|
|
102
|
-
function StyleEngine({ attributes, clientId }) {
|
|
103
|
-
const gapVarMap = getGapStyles({ attributes });
|
|
104
|
-
const colorVarMap = getColorStyles({ attributes });
|
|
105
|
-
const borderVarMap = getBorderStyles({ attributes });
|
|
106
|
-
const styleVarMap = {
|
|
107
|
-
...gapVarMap,
|
|
108
|
-
...colorVarMap,
|
|
109
|
-
...borderVarMap
|
|
110
|
-
};
|
|
111
|
-
const declarations = Object.entries(styleVarMap).filter(([, value]) => !!value).map(([name, value]) => ` ${name}: ${value};`).join("\n");
|
|
112
|
-
(0, import_block_editor.useStyleOverride)({
|
|
113
|
-
css: clientId ? `#block-${clientId} {
|
|
114
|
-
${declarations}
|
|
115
|
-
}` : ""
|
|
116
|
-
});
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=style-engine.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tabs/style-engine.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalGetGapCSSValue as getGapCSSValue,\n\tuseStyleOverride,\n} from '@wordpress/block-editor';\n\n/**\n * Gets the gap styles for the tab block.\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for gap styles\n */\nfunction getGapStyles( { attributes } ) {\n\tconst { style, orientation } = attributes || {};\n\tconst { spacing } = style || {};\n\tconst { blockGap } = spacing || {};\n\t//--wp--style--tabs-list-gap-default should be used by themes that want to set a default\n\t// gap on the tabs list.\n\tconst fallbackValue = `var( --wp--style--tabs-gap-default, var( --wp--style--block-gap, 0.5em ) )`;\n\tlet listGapValue = fallbackValue;\n\tlet gapValue = fallbackValue;\n\n\t// Check for a value.\n\tif ( !! blockGap ) {\n\t\tlistGapValue =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.left ) || fallbackValue;\n\t\tgapValue =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.top ) || fallbackValue;\n\t}\n\n\tif ( orientation === 'vertical' ) {\n\t\tconst _listGapValue = listGapValue;\n\t\tconst _gapValue = gapValue;\n\t\tlistGapValue = _gapValue;\n\t\tgapValue = _listGapValue;\n\t}\n\n\t// The unstable tabs list gap calculation requires a real value (such as `0px`) and not `0`.\n\tconst gapMap = {\n\t\t'--wp--style--unstable-tabs-list-gap':\n\t\t\tlistGapValue === '0' ? '0px' : listGapValue,\n\t\t'--wp--style--unstable-tabs-gap': gapValue,\n\t};\n\n\treturn gapMap;\n}\n\n/**\n * Gets the color styles for the tab block.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for color styles\n */\nfunction getColorStyles( { attributes } ) {\n\tconst {\n\t\tcustomTabInactiveColor,\n\t\tcustomTabHoverColor,\n\t\tcustomTabActiveColor,\n\t\tcustomTabTextColor,\n\t\tcustomTabActiveTextColor,\n\t\tcustomTabHoverTextColor,\n\t} = attributes || {};\n\n\t// Helper to normalize color objects (preset { slug } vs direct value).\n\tfunction getColorValue( color ) {\n\t\tif ( ! color ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( typeof color === 'object' && color.slug ) {\n\t\t\treturn `var(--wp--preset--color--${ color.slug })`;\n\t\t}\n\t\treturn color;\n\t}\n\n\tconst colorVarMap = {\n\t\t'--custom-tab-inactive-color': getColorValue( customTabInactiveColor ),\n\t\t'--custom-tab-active-color': getColorValue( customTabActiveColor ),\n\t\t'--custom-tab-hover-color': getColorValue( customTabHoverColor ),\n\t\t'--custom-tab-text-color': getColorValue( customTabTextColor ),\n\t\t'--custom-tab-active-text-color': getColorValue(\n\t\t\tcustomTabActiveTextColor\n\t\t),\n\t\t'--custom-tab-hover-text-color': getColorValue(\n\t\t\tcustomTabHoverTextColor\n\t\t),\n\t};\n\n\treturn colorVarMap;\n}\n\n/**\n * Gets the border styles for the tab block.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for border styles\n */\nfunction getBorderStyles( { attributes } ) {\n\tconst { radius } = attributes?.style?.border || {};\n\n\tif ( ! radius ) {\n\t\treturn {};\n\t}\n\n\tlet radiusValue = radius;\n\n\tif ( typeof radius === 'object' ) {\n\t\tconst {\n\t\t\ttopLeft = '0',\n\t\t\ttopRight = '0',\n\t\t\tbottomRight = '0',\n\t\t\tbottomLeft = '0',\n\t\t} = radius;\n\t\tradiusValue = `${ topLeft } ${ topRight } ${ bottomRight } ${ bottomLeft }`;\n\t}\n\n\tconst borderMap = {\n\t\t'--tab-border-radius': radiusValue,\n\t};\n\n\treturn borderMap;\n}\n\n/**\n * Injects color CSS custom properties for the tabs block, mirroring the pattern\n * used by gap-styles (scoped to `#block-{ clientId }`). This replaces the prior\n * inline-style object return value approach so that these values participate in\n * style engine cascade like other dynamic style overrides.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @param {string} props.clientId Block client ID\n * @return {null} No UI output\n */\nexport default function StyleEngine( { attributes, clientId } ) {\n\tconst gapVarMap = getGapStyles( { attributes } );\n\tconst colorVarMap = getColorStyles( { attributes } );\n\tconst borderVarMap = getBorderStyles( { attributes } );\n\n\tconst styleVarMap = {\n\t\t...gapVarMap,\n\t\t...colorVarMap,\n\t\t...borderVarMap,\n\t};\n\n\t// Build scoped CSS only for defined values to avoid unnecessary empty declarations.\n\tconst declarations = Object.entries( styleVarMap )\n\t\t.filter( ( [ , value ] ) => !! value )\n\t\t.map( ( [ name, value ] ) => `\\t${ name }: ${ value };` )\n\t\t.join( '\\n' );\n\n\tuseStyleOverride( {\n\t\tcss: clientId ? `#block-${ clientId } {\\n${ declarations }\\n}` : '',\n\t} );\n\n\treturn null;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAGO;AAQP,SAAS,aAAc,EAAE,WAAW,GAAI;AACvC,QAAM,EAAE,OAAO,YAAY,IAAI,cAAc,CAAC;AAC9C,QAAM,EAAE,QAAQ,IAAI,SAAS,CAAC;AAC9B,QAAM,EAAE,SAAS,IAAI,WAAW,CAAC;AAGjC,QAAM,gBAAgB;AACtB,MAAI,eAAe;AACnB,MAAI,WAAW;AAGf,MAAK,CAAC,CAAE,UAAW;AAClB,mBACC,OAAO,aAAa,eACjB,oBAAAA,8BAAgB,QAAS,QACzB,oBAAAA,8BAAgB,UAAU,IAAK,KAAK;AACxC,eACC,OAAO,aAAa,eACjB,oBAAAA,8BAAgB,QAAS,QACzB,oBAAAA,8BAAgB,UAAU,GAAI,KAAK;AAAA,EACxC;AAEA,MAAK,gBAAgB,YAAa;AACjC,UAAM,gBAAgB;AACtB,UAAM,YAAY;AAClB,mBAAe;AACf,eAAW;AAAA,EACZ;AAGA,QAAM,SAAS;AAAA,IACd,uCACC,iBAAiB,MAAM,QAAQ;AAAA,IAChC,kCAAkC;AAAA,EACnC;AAEA,SAAO;AACR;AASA,SAAS,eAAgB,EAAE,WAAW,GAAI;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,cAAc,CAAC;AAGnB,WAAS,cAAe,OAAQ;AAC/B,QAAK,CAAE,OAAQ;AACd,aAAO;AAAA,IACR;AACA,QAAK,OAAO,UAAU,YAAY,MAAM,MAAO;AAC9C,aAAO,4BAA6B,MAAM,IAAK;AAAA,IAChD;AACA,WAAO;AAAA,EACR;AAEA,QAAM,cAAc;AAAA,IACnB,+BAA+B,cAAe,sBAAuB;AAAA,IACrE,6BAA6B,cAAe,oBAAqB;AAAA,IACjE,4BAA4B,cAAe,mBAAoB;AAAA,IAC/D,2BAA2B,cAAe,kBAAmB;AAAA,IAC7D,kCAAkC;AAAA,MACjC;AAAA,IACD;AAAA,IACA,iCAAiC;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AASA,SAAS,gBAAiB,EAAE,WAAW,GAAI;AAC1C,QAAM,EAAE,OAAO,IAAI,YAAY,OAAO,UAAU,CAAC;AAEjD,MAAK,CAAE,QAAS;AACf,WAAO,CAAC;AAAA,EACT;AAEA,MAAI,cAAc;AAElB,MAAK,OAAO,WAAW,UAAW;AACjC,UAAM;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,MACX,cAAc;AAAA,MACd,aAAa;AAAA,IACd,IAAI;AACJ,kBAAc,GAAI,OAAQ,IAAK,QAAS,IAAK,WAAY,IAAK,UAAW;AAAA,EAC1E;AAEA,QAAM,YAAY;AAAA,IACjB,uBAAuB;AAAA,EACxB;AAEA,SAAO;AACR;AAae,SAAR,YAA8B,EAAE,YAAY,SAAS,GAAI;AAC/D,QAAM,YAAY,aAAc,EAAE,WAAW,CAAE;AAC/C,QAAM,cAAc,eAAgB,EAAE,WAAW,CAAE;AACnD,QAAM,eAAe,gBAAiB,EAAE,WAAW,CAAE;AAErD,QAAM,cAAc;AAAA,IACnB,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AAGA,QAAM,eAAe,OAAO,QAAS,WAAY,EAC/C,OAAQ,CAAE,CAAE,EAAE,KAAM,MAAO,CAAC,CAAE,KAAM,EACpC,IAAK,CAAE,CAAE,MAAM,KAAM,MAAO,IAAM,IAAK,KAAM,KAAM,GAAI,EACvD,KAAM,IAAK;AAEb,4CAAkB;AAAA,IACjB,KAAK,WAAW,UAAW,QAAS;AAAA,EAAQ,YAAa;AAAA,KAAQ;AAAA,EAClE,CAAE;AAEF,SAAO;AACR;",
|
|
6
|
-
"names": ["getGapCSSValue"]
|
|
7
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/tab/tabs-list.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { __, sprintf } from "@wordpress/i18n";
|
|
4
|
-
import { RichText } from "@wordpress/block-editor";
|
|
5
|
-
import { decodeEntities } from "@wordpress/html-entities";
|
|
6
|
-
import { RawHTML } from "@wordpress/element";
|
|
7
|
-
import slugFromLabel from "./slug-from-label.mjs";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
function StaticLabel({ label, index }) {
|
|
10
|
-
if (label) {
|
|
11
|
-
return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(RawHTML, { children: decodeEntities(label) }) });
|
|
12
|
-
}
|
|
13
|
-
return /* @__PURE__ */ jsx("span", { children: sprintf(
|
|
14
|
-
/* translators: %d is the tab index + 1 */
|
|
15
|
-
__("Tab %d"),
|
|
16
|
-
index + 1
|
|
17
|
-
) });
|
|
18
|
-
}
|
|
19
|
-
function TabsList({
|
|
20
|
-
siblingTabs,
|
|
21
|
-
currentClientId,
|
|
22
|
-
currentBlockIndex,
|
|
23
|
-
currentLabel,
|
|
24
|
-
tabItemColorProps,
|
|
25
|
-
onSelectTab,
|
|
26
|
-
onLabelChange,
|
|
27
|
-
labelRef,
|
|
28
|
-
focusRef,
|
|
29
|
-
labelElementRef
|
|
30
|
-
}) {
|
|
31
|
-
return /* @__PURE__ */ jsx("div", { role: "tablist", className: "tabs__list", children: siblingTabs.map((tab, index) => {
|
|
32
|
-
const isCurrentTab = tab.clientId === currentClientId;
|
|
33
|
-
const isSiblingTabActive = index === currentBlockIndex;
|
|
34
|
-
const tabAttributes = tab.attributes || {};
|
|
35
|
-
const siblingLabel = tabAttributes.label || "";
|
|
36
|
-
const siblingAnchor = tabAttributes.anchor || slugFromLabel(siblingLabel, index);
|
|
37
|
-
const siblingTabPanelId = siblingAnchor;
|
|
38
|
-
const siblingTabLabelId = `${siblingTabPanelId}--tab`;
|
|
39
|
-
return /* @__PURE__ */ jsx(
|
|
40
|
-
"button",
|
|
41
|
-
{
|
|
42
|
-
"aria-controls": siblingTabPanelId,
|
|
43
|
-
"aria-selected": isSiblingTabActive,
|
|
44
|
-
id: siblingTabLabelId,
|
|
45
|
-
role: "tab",
|
|
46
|
-
className: clsx(
|
|
47
|
-
"tabs__tab-label",
|
|
48
|
-
tabItemColorProps.className
|
|
49
|
-
),
|
|
50
|
-
style: {
|
|
51
|
-
...tabItemColorProps.style
|
|
52
|
-
},
|
|
53
|
-
tabIndex: isSiblingTabActive ? 0 : -1,
|
|
54
|
-
onClick: (event) => {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
onSelectTab(tab.clientId);
|
|
57
|
-
},
|
|
58
|
-
onKeyDown: (event) => {
|
|
59
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
onSelectTab(tab.clientId);
|
|
62
|
-
if (isCurrentTab) {
|
|
63
|
-
const { requestAnimationFrame } = window;
|
|
64
|
-
focusRef.current = requestAnimationFrame(
|
|
65
|
-
() => {
|
|
66
|
-
labelElementRef.current?.focus();
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
children: isCurrentTab ? /* @__PURE__ */ jsx(
|
|
73
|
-
RichText,
|
|
74
|
-
{
|
|
75
|
-
ref: labelRef,
|
|
76
|
-
tagName: "span",
|
|
77
|
-
withoutInteractiveFormatting: true,
|
|
78
|
-
placeholder: sprintf(
|
|
79
|
-
/* translators: %d is the tab index + 1 */
|
|
80
|
-
__("Tab %d\u2026"),
|
|
81
|
-
currentBlockIndex + 1
|
|
82
|
-
),
|
|
83
|
-
value: decodeEntities(currentLabel),
|
|
84
|
-
onChange: onLabelChange
|
|
85
|
-
}
|
|
86
|
-
) : /* @__PURE__ */ jsx(
|
|
87
|
-
StaticLabel,
|
|
88
|
-
{
|
|
89
|
-
label: siblingLabel,
|
|
90
|
-
index
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
},
|
|
94
|
-
tab.clientId
|
|
95
|
-
);
|
|
96
|
-
}) });
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
TabsList as default
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=tabs-list.mjs.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": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAKxB,OAAO,mBAAmB;AAMtB;AAJJ,SAAS,YAAa,EAAE,OAAO,MAAM,GAAI;AACxC,MAAK,OAAQ;AACZ,WACC,oBAAC,UACA,8BAAC,WAAU,yBAAgB,KAAM,GAAG,GACrC;AAAA,EAEF;AACA,SACC,oBAAC,UACE;AAAA;AAAA,IAED,GAAI,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,oBAAC,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,UACd,cAAe,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,WAAY;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,aAAc;AAAA;AAAA,cAEb,GAAI,cAAU;AAAA,cACd,oBAAoB;AAAA,YACrB;AAAA,YACA,OAAQ,eAAgB,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": []
|
|
7
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/tabs/style-engine.js
|
|
2
|
-
import {
|
|
3
|
-
__experimentalGetGapCSSValue as getGapCSSValue,
|
|
4
|
-
useStyleOverride
|
|
5
|
-
} from "@wordpress/block-editor";
|
|
6
|
-
function getGapStyles({ attributes }) {
|
|
7
|
-
const { style, orientation } = attributes || {};
|
|
8
|
-
const { spacing } = style || {};
|
|
9
|
-
const { blockGap } = spacing || {};
|
|
10
|
-
const fallbackValue = `var( --wp--style--tabs-gap-default, var( --wp--style--block-gap, 0.5em ) )`;
|
|
11
|
-
let listGapValue = fallbackValue;
|
|
12
|
-
let gapValue = fallbackValue;
|
|
13
|
-
if (!!blockGap) {
|
|
14
|
-
listGapValue = typeof blockGap === "string" ? getGapCSSValue(blockGap) : getGapCSSValue(blockGap?.left) || fallbackValue;
|
|
15
|
-
gapValue = typeof blockGap === "string" ? getGapCSSValue(blockGap) : getGapCSSValue(blockGap?.top) || fallbackValue;
|
|
16
|
-
}
|
|
17
|
-
if (orientation === "vertical") {
|
|
18
|
-
const _listGapValue = listGapValue;
|
|
19
|
-
const _gapValue = gapValue;
|
|
20
|
-
listGapValue = _gapValue;
|
|
21
|
-
gapValue = _listGapValue;
|
|
22
|
-
}
|
|
23
|
-
const gapMap = {
|
|
24
|
-
"--wp--style--unstable-tabs-list-gap": listGapValue === "0" ? "0px" : listGapValue,
|
|
25
|
-
"--wp--style--unstable-tabs-gap": gapValue
|
|
26
|
-
};
|
|
27
|
-
return gapMap;
|
|
28
|
-
}
|
|
29
|
-
function getColorStyles({ attributes }) {
|
|
30
|
-
const {
|
|
31
|
-
customTabInactiveColor,
|
|
32
|
-
customTabHoverColor,
|
|
33
|
-
customTabActiveColor,
|
|
34
|
-
customTabTextColor,
|
|
35
|
-
customTabActiveTextColor,
|
|
36
|
-
customTabHoverTextColor
|
|
37
|
-
} = attributes || {};
|
|
38
|
-
function getColorValue(color) {
|
|
39
|
-
if (!color) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
if (typeof color === "object" && color.slug) {
|
|
43
|
-
return `var(--wp--preset--color--${color.slug})`;
|
|
44
|
-
}
|
|
45
|
-
return color;
|
|
46
|
-
}
|
|
47
|
-
const colorVarMap = {
|
|
48
|
-
"--custom-tab-inactive-color": getColorValue(customTabInactiveColor),
|
|
49
|
-
"--custom-tab-active-color": getColorValue(customTabActiveColor),
|
|
50
|
-
"--custom-tab-hover-color": getColorValue(customTabHoverColor),
|
|
51
|
-
"--custom-tab-text-color": getColorValue(customTabTextColor),
|
|
52
|
-
"--custom-tab-active-text-color": getColorValue(
|
|
53
|
-
customTabActiveTextColor
|
|
54
|
-
),
|
|
55
|
-
"--custom-tab-hover-text-color": getColorValue(
|
|
56
|
-
customTabHoverTextColor
|
|
57
|
-
)
|
|
58
|
-
};
|
|
59
|
-
return colorVarMap;
|
|
60
|
-
}
|
|
61
|
-
function getBorderStyles({ attributes }) {
|
|
62
|
-
const { radius } = attributes?.style?.border || {};
|
|
63
|
-
if (!radius) {
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
let radiusValue = radius;
|
|
67
|
-
if (typeof radius === "object") {
|
|
68
|
-
const {
|
|
69
|
-
topLeft = "0",
|
|
70
|
-
topRight = "0",
|
|
71
|
-
bottomRight = "0",
|
|
72
|
-
bottomLeft = "0"
|
|
73
|
-
} = radius;
|
|
74
|
-
radiusValue = `${topLeft} ${topRight} ${bottomRight} ${bottomLeft}`;
|
|
75
|
-
}
|
|
76
|
-
const borderMap = {
|
|
77
|
-
"--tab-border-radius": radiusValue
|
|
78
|
-
};
|
|
79
|
-
return borderMap;
|
|
80
|
-
}
|
|
81
|
-
function StyleEngine({ attributes, clientId }) {
|
|
82
|
-
const gapVarMap = getGapStyles({ attributes });
|
|
83
|
-
const colorVarMap = getColorStyles({ attributes });
|
|
84
|
-
const borderVarMap = getBorderStyles({ attributes });
|
|
85
|
-
const styleVarMap = {
|
|
86
|
-
...gapVarMap,
|
|
87
|
-
...colorVarMap,
|
|
88
|
-
...borderVarMap
|
|
89
|
-
};
|
|
90
|
-
const declarations = Object.entries(styleVarMap).filter(([, value]) => !!value).map(([name, value]) => ` ${name}: ${value};`).join("\n");
|
|
91
|
-
useStyleOverride({
|
|
92
|
-
css: clientId ? `#block-${clientId} {
|
|
93
|
-
${declarations}
|
|
94
|
-
}` : ""
|
|
95
|
-
});
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
StyleEngine as default
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=style-engine.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tabs/style-engine.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalGetGapCSSValue as getGapCSSValue,\n\tuseStyleOverride,\n} from '@wordpress/block-editor';\n\n/**\n * Gets the gap styles for the tab block.\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for gap styles\n */\nfunction getGapStyles( { attributes } ) {\n\tconst { style, orientation } = attributes || {};\n\tconst { spacing } = style || {};\n\tconst { blockGap } = spacing || {};\n\t//--wp--style--tabs-list-gap-default should be used by themes that want to set a default\n\t// gap on the tabs list.\n\tconst fallbackValue = `var( --wp--style--tabs-gap-default, var( --wp--style--block-gap, 0.5em ) )`;\n\tlet listGapValue = fallbackValue;\n\tlet gapValue = fallbackValue;\n\n\t// Check for a value.\n\tif ( !! blockGap ) {\n\t\tlistGapValue =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.left ) || fallbackValue;\n\t\tgapValue =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.top ) || fallbackValue;\n\t}\n\n\tif ( orientation === 'vertical' ) {\n\t\tconst _listGapValue = listGapValue;\n\t\tconst _gapValue = gapValue;\n\t\tlistGapValue = _gapValue;\n\t\tgapValue = _listGapValue;\n\t}\n\n\t// The unstable tabs list gap calculation requires a real value (such as `0px`) and not `0`.\n\tconst gapMap = {\n\t\t'--wp--style--unstable-tabs-list-gap':\n\t\t\tlistGapValue === '0' ? '0px' : listGapValue,\n\t\t'--wp--style--unstable-tabs-gap': gapValue,\n\t};\n\n\treturn gapMap;\n}\n\n/**\n * Gets the color styles for the tab block.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for color styles\n */\nfunction getColorStyles( { attributes } ) {\n\tconst {\n\t\tcustomTabInactiveColor,\n\t\tcustomTabHoverColor,\n\t\tcustomTabActiveColor,\n\t\tcustomTabTextColor,\n\t\tcustomTabActiveTextColor,\n\t\tcustomTabHoverTextColor,\n\t} = attributes || {};\n\n\t// Helper to normalize color objects (preset { slug } vs direct value).\n\tfunction getColorValue( color ) {\n\t\tif ( ! color ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( typeof color === 'object' && color.slug ) {\n\t\t\treturn `var(--wp--preset--color--${ color.slug })`;\n\t\t}\n\t\treturn color;\n\t}\n\n\tconst colorVarMap = {\n\t\t'--custom-tab-inactive-color': getColorValue( customTabInactiveColor ),\n\t\t'--custom-tab-active-color': getColorValue( customTabActiveColor ),\n\t\t'--custom-tab-hover-color': getColorValue( customTabHoverColor ),\n\t\t'--custom-tab-text-color': getColorValue( customTabTextColor ),\n\t\t'--custom-tab-active-text-color': getColorValue(\n\t\t\tcustomTabActiveTextColor\n\t\t),\n\t\t'--custom-tab-hover-text-color': getColorValue(\n\t\t\tcustomTabHoverTextColor\n\t\t),\n\t};\n\n\treturn colorVarMap;\n}\n\n/**\n * Gets the border styles for the tab block.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @return {Object} CSS custom properties for border styles\n */\nfunction getBorderStyles( { attributes } ) {\n\tconst { radius } = attributes?.style?.border || {};\n\n\tif ( ! radius ) {\n\t\treturn {};\n\t}\n\n\tlet radiusValue = radius;\n\n\tif ( typeof radius === 'object' ) {\n\t\tconst {\n\t\t\ttopLeft = '0',\n\t\t\ttopRight = '0',\n\t\t\tbottomRight = '0',\n\t\t\tbottomLeft = '0',\n\t\t} = radius;\n\t\tradiusValue = `${ topLeft } ${ topRight } ${ bottomRight } ${ bottomLeft }`;\n\t}\n\n\tconst borderMap = {\n\t\t'--tab-border-radius': radiusValue,\n\t};\n\n\treturn borderMap;\n}\n\n/**\n * Injects color CSS custom properties for the tabs block, mirroring the pattern\n * used by gap-styles (scoped to `#block-{ clientId }`). This replaces the prior\n * inline-style object return value approach so that these values participate in\n * style engine cascade like other dynamic style overrides.\n *\n * @param {Object} props\n * @param {Object} props.attributes Block attributes\n * @param {string} props.clientId Block client ID\n * @return {null} No UI output\n */\nexport default function StyleEngine( { attributes, clientId } ) {\n\tconst gapVarMap = getGapStyles( { attributes } );\n\tconst colorVarMap = getColorStyles( { attributes } );\n\tconst borderVarMap = getBorderStyles( { attributes } );\n\n\tconst styleVarMap = {\n\t\t...gapVarMap,\n\t\t...colorVarMap,\n\t\t...borderVarMap,\n\t};\n\n\t// Build scoped CSS only for defined values to avoid unnecessary empty declarations.\n\tconst declarations = Object.entries( styleVarMap )\n\t\t.filter( ( [ , value ] ) => !! value )\n\t\t.map( ( [ name, value ] ) => `\\t${ name }: ${ value };` )\n\t\t.join( '\\n' );\n\n\tuseStyleOverride( {\n\t\tcss: clientId ? `#block-${ clientId } {\\n${ declarations }\\n}` : '',\n\t} );\n\n\treturn null;\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,gCAAgC;AAAA,EAChC;AAAA,OACM;AAQP,SAAS,aAAc,EAAE,WAAW,GAAI;AACvC,QAAM,EAAE,OAAO,YAAY,IAAI,cAAc,CAAC;AAC9C,QAAM,EAAE,QAAQ,IAAI,SAAS,CAAC;AAC9B,QAAM,EAAE,SAAS,IAAI,WAAW,CAAC;AAGjC,QAAM,gBAAgB;AACtB,MAAI,eAAe;AACnB,MAAI,WAAW;AAGf,MAAK,CAAC,CAAE,UAAW;AAClB,mBACC,OAAO,aAAa,WACjB,eAAgB,QAAS,IACzB,eAAgB,UAAU,IAAK,KAAK;AACxC,eACC,OAAO,aAAa,WACjB,eAAgB,QAAS,IACzB,eAAgB,UAAU,GAAI,KAAK;AAAA,EACxC;AAEA,MAAK,gBAAgB,YAAa;AACjC,UAAM,gBAAgB;AACtB,UAAM,YAAY;AAClB,mBAAe;AACf,eAAW;AAAA,EACZ;AAGA,QAAM,SAAS;AAAA,IACd,uCACC,iBAAiB,MAAM,QAAQ;AAAA,IAChC,kCAAkC;AAAA,EACnC;AAEA,SAAO;AACR;AASA,SAAS,eAAgB,EAAE,WAAW,GAAI;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,cAAc,CAAC;AAGnB,WAAS,cAAe,OAAQ;AAC/B,QAAK,CAAE,OAAQ;AACd,aAAO;AAAA,IACR;AACA,QAAK,OAAO,UAAU,YAAY,MAAM,MAAO;AAC9C,aAAO,4BAA6B,MAAM,IAAK;AAAA,IAChD;AACA,WAAO;AAAA,EACR;AAEA,QAAM,cAAc;AAAA,IACnB,+BAA+B,cAAe,sBAAuB;AAAA,IACrE,6BAA6B,cAAe,oBAAqB;AAAA,IACjE,4BAA4B,cAAe,mBAAoB;AAAA,IAC/D,2BAA2B,cAAe,kBAAmB;AAAA,IAC7D,kCAAkC;AAAA,MACjC;AAAA,IACD;AAAA,IACA,iCAAiC;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AASA,SAAS,gBAAiB,EAAE,WAAW,GAAI;AAC1C,QAAM,EAAE,OAAO,IAAI,YAAY,OAAO,UAAU,CAAC;AAEjD,MAAK,CAAE,QAAS;AACf,WAAO,CAAC;AAAA,EACT;AAEA,MAAI,cAAc;AAElB,MAAK,OAAO,WAAW,UAAW;AACjC,UAAM;AAAA,MACL,UAAU;AAAA,MACV,WAAW;AAAA,MACX,cAAc;AAAA,MACd,aAAa;AAAA,IACd,IAAI;AACJ,kBAAc,GAAI,OAAQ,IAAK,QAAS,IAAK,WAAY,IAAK,UAAW;AAAA,EAC1E;AAEA,QAAM,YAAY;AAAA,IACjB,uBAAuB;AAAA,EACxB;AAEA,SAAO;AACR;AAae,SAAR,YAA8B,EAAE,YAAY,SAAS,GAAI;AAC/D,QAAM,YAAY,aAAc,EAAE,WAAW,CAAE;AAC/C,QAAM,cAAc,eAAgB,EAAE,WAAW,CAAE;AACnD,QAAM,eAAe,gBAAiB,EAAE,WAAW,CAAE;AAErD,QAAM,cAAc;AAAA,IACnB,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AAGA,QAAM,eAAe,OAAO,QAAS,WAAY,EAC/C,OAAQ,CAAE,CAAE,EAAE,KAAM,MAAO,CAAC,CAAE,KAAM,EACpC,IAAK,CAAE,CAAE,MAAM,KAAM,MAAO,IAAM,IAAK,KAAM,KAAM,GAAI,EACvD,KAAM,IAAK;AAEb,mBAAkB;AAAA,IACjB,KAAK,WAAW,UAAW,QAAS;AAAA,EAAQ,YAAa;AAAA,KAAQ;AAAA,EAClE,CAAE;AAEF,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.wp-block-tabs.wp-block .wp-block-tabs__tab-item__inserter {
|
|
2
|
-
height: 100%;
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
}
|
|
6
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
gap: var(--wp--style--unstable-tabs-gap);
|
|
10
|
-
}
|
|
11
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section {
|
|
12
|
-
flex-grow: 1;
|
|
13
|
-
}
|
|
14
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section > .wp-block:first-child {
|
|
15
|
-
margin-top: 0;
|
|
16
|
-
}
|
|
17
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section > .wp-block:last-child {
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
}
|
|
20
|
-
.wp-block-tabs.wp-block.is-vertical > .wp-block-tab.wp-block {
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
}
|
|
23
|
-
.wp-block-tabs.wp-block.is-vertical .wp-block-tabs__tab-item__inserter {
|
|
24
|
-
align-items: flex-start;
|
|
25
|
-
margin-left: -1px;
|
|
26
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.wp-block-tabs.wp-block .wp-block-tabs__tab-item__inserter {
|
|
2
|
-
height: 100%;
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
}
|
|
6
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
gap: var(--wp--style--unstable-tabs-gap);
|
|
10
|
-
}
|
|
11
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section {
|
|
12
|
-
flex-grow: 1;
|
|
13
|
-
}
|
|
14
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section > .wp-block:first-child {
|
|
15
|
-
margin-top: 0;
|
|
16
|
-
}
|
|
17
|
-
.wp-block-tabs.wp-block .wp-block-tab.wp-block > section > .wp-block:last-child {
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
}
|
|
20
|
-
.wp-block-tabs.wp-block.is-vertical > .wp-block-tab.wp-block {
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
}
|
|
23
|
-
.wp-block-tabs.wp-block.is-vertical .wp-block-tabs__tab-item__inserter {
|
|
24
|
-
align-items: flex-start;
|
|
25
|
-
margin-right: -1px;
|
|
26
|
-
}
|
package/src/tab/tabs-list.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
-
import { RichText } from '@wordpress/block-editor';
|
|
11
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
-
import { RawHTML } from '@wordpress/element';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import slugFromLabel from './slug-from-label';
|
|
18
|
-
|
|
19
|
-
function StaticLabel( { label, index } ) {
|
|
20
|
-
if ( label ) {
|
|
21
|
-
return (
|
|
22
|
-
<span>
|
|
23
|
-
<RawHTML>{ decodeEntities( label ) }</RawHTML>
|
|
24
|
-
</span>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
return (
|
|
28
|
-
<span>
|
|
29
|
-
{ sprintf(
|
|
30
|
-
/* translators: %d is the tab index + 1 */
|
|
31
|
-
__( 'Tab %d' ),
|
|
32
|
-
index + 1
|
|
33
|
-
) }
|
|
34
|
-
</span>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default function TabsList( {
|
|
39
|
-
siblingTabs,
|
|
40
|
-
currentClientId,
|
|
41
|
-
currentBlockIndex,
|
|
42
|
-
currentLabel,
|
|
43
|
-
tabItemColorProps,
|
|
44
|
-
onSelectTab,
|
|
45
|
-
onLabelChange,
|
|
46
|
-
labelRef,
|
|
47
|
-
focusRef,
|
|
48
|
-
labelElementRef,
|
|
49
|
-
} ) {
|
|
50
|
-
return (
|
|
51
|
-
<div role="tablist" className="tabs__list">
|
|
52
|
-
{ siblingTabs.map( ( tab, index ) => {
|
|
53
|
-
const isCurrentTab = tab.clientId === currentClientId;
|
|
54
|
-
const isSiblingTabActive = index === currentBlockIndex;
|
|
55
|
-
const tabAttributes = tab.attributes || {};
|
|
56
|
-
const siblingLabel = tabAttributes.label || '';
|
|
57
|
-
const siblingAnchor =
|
|
58
|
-
tabAttributes.anchor ||
|
|
59
|
-
slugFromLabel( siblingLabel, index );
|
|
60
|
-
const siblingTabPanelId = siblingAnchor;
|
|
61
|
-
const siblingTabLabelId = `${ siblingTabPanelId }--tab`;
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<button
|
|
65
|
-
key={ tab.clientId }
|
|
66
|
-
aria-controls={ siblingTabPanelId }
|
|
67
|
-
aria-selected={ isSiblingTabActive }
|
|
68
|
-
id={ siblingTabLabelId }
|
|
69
|
-
role="tab"
|
|
70
|
-
className={ clsx(
|
|
71
|
-
'tabs__tab-label',
|
|
72
|
-
tabItemColorProps.className
|
|
73
|
-
) }
|
|
74
|
-
style={ {
|
|
75
|
-
...tabItemColorProps.style,
|
|
76
|
-
} }
|
|
77
|
-
tabIndex={ isSiblingTabActive ? 0 : -1 }
|
|
78
|
-
onClick={ ( event ) => {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
onSelectTab( tab.clientId );
|
|
81
|
-
} }
|
|
82
|
-
onKeyDown={ ( event ) => {
|
|
83
|
-
// If shift is also pressed, do not select the block.
|
|
84
|
-
if ( event.key === 'Enter' && ! event.shiftKey ) {
|
|
85
|
-
event.preventDefault();
|
|
86
|
-
onSelectTab( tab.clientId );
|
|
87
|
-
if ( isCurrentTab ) {
|
|
88
|
-
const { requestAnimationFrame } = window;
|
|
89
|
-
focusRef.current = requestAnimationFrame(
|
|
90
|
-
() => {
|
|
91
|
-
labelElementRef.current?.focus();
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
} }
|
|
97
|
-
>
|
|
98
|
-
{ isCurrentTab ? (
|
|
99
|
-
<RichText
|
|
100
|
-
ref={ labelRef }
|
|
101
|
-
tagName="span"
|
|
102
|
-
withoutInteractiveFormatting
|
|
103
|
-
placeholder={ sprintf(
|
|
104
|
-
/* translators: %d is the tab index + 1 */
|
|
105
|
-
__( 'Tab %d…' ),
|
|
106
|
-
currentBlockIndex + 1
|
|
107
|
-
) }
|
|
108
|
-
value={ decodeEntities( currentLabel ) }
|
|
109
|
-
onChange={ onLabelChange }
|
|
110
|
-
/>
|
|
111
|
-
) : (
|
|
112
|
-
<StaticLabel
|
|
113
|
-
label={ siblingLabel }
|
|
114
|
-
index={ index }
|
|
115
|
-
/>
|
|
116
|
-
) }
|
|
117
|
-
</button>
|
|
118
|
-
);
|
|
119
|
-
} ) }
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
}
|
package/src/tabs/editor.scss
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.wp-block-tabs.wp-block {
|
|
2
|
-
.wp-block-tabs__tab-item__inserter {
|
|
3
|
-
height: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
}
|
|
7
|
-
.wp-block-tab.wp-block {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
gap: var(--wp--style--unstable-tabs-gap);
|
|
11
|
-
& > section {
|
|
12
|
-
flex-grow: 1;
|
|
13
|
-
& > .wp-block:first-child {
|
|
14
|
-
margin-top: 0;
|
|
15
|
-
}
|
|
16
|
-
& > .wp-block:last-child {
|
|
17
|
-
margin-bottom: 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
&.is-vertical {
|
|
22
|
-
& > .wp-block-tab.wp-block {
|
|
23
|
-
flex-direction: row;
|
|
24
|
-
}
|
|
25
|
-
.wp-block-tabs__tab-item__inserter {
|
|
26
|
-
align-items: flex-start;
|
|
27
|
-
margin-right: -1px; // Hack to get the inserter to align with the tab border
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|