@wordpress/block-library 10.5.2-next.v.202608281122.0 → 11.0.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 +19 -1
- package/build/audio/edit.cjs +5 -5
- package/build/audio/edit.cjs.map +2 -2
- package/build/audio/index.cjs +0 -37
- package/build/audio/index.cjs.map +3 -3
- package/build/button/index.cjs +0 -34
- package/build/button/index.cjs.map +3 -3
- package/build/code/index.cjs +0 -17
- package/build/code/index.cjs.map +3 -3
- package/build/comment-template/edit.cjs.map +1 -1
- package/build/cover/index.cjs +0 -38
- package/build/cover/index.cjs.map +3 -3
- package/build/details/index.cjs +0 -17
- package/build/details/index.cjs.map +3 -3
- package/build/file/index.cjs +0 -43
- package/build/file/index.cjs.map +3 -3
- package/build/footnotes/format.cjs +1 -1
- package/build/footnotes/format.cjs.map +2 -2
- package/build/gallery/dynamic-gallery.cjs +22 -12
- package/build/gallery/dynamic-gallery.cjs.map +2 -2
- package/build/heading/index.cjs +0 -16
- package/build/heading/index.cjs.map +3 -3
- package/build/image/image.cjs +7 -5
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +0 -81
- package/build/image/index.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +81 -14
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +0 -10
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs.map +1 -1
- package/build/list-item/edit.cjs +14 -11
- package/build/list-item/edit.cjs.map +2 -2
- package/build/list-item/hooks/index.cjs +6 -9
- package/build/list-item/hooks/index.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +62 -67
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-merge.cjs +26 -44
- package/build/list-item/hooks/use-merge.cjs.map +3 -3
- package/build/list-item/hooks/use-multi-select-tab.cjs +80 -0
- package/build/list-item/hooks/use-multi-select-tab.cjs.map +7 -0
- package/build/list-item/hooks/use-tab.cjs +65 -0
- package/build/list-item/hooks/use-tab.cjs.map +7 -0
- package/build/list-item/index.cjs +0 -17
- package/build/list-item/index.cjs.map +3 -3
- package/build/list-item/utils.cjs +169 -0
- package/build/list-item/utils.cjs.map +7 -0
- package/build/math/block.json +3 -0
- package/build/media-text/index.cjs +0 -50
- package/build/media-text/index.cjs.map +3 -3
- package/build/media-text/media-container.cjs +16 -11
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/more/index.cjs +0 -18
- package/build/more/index.cjs.map +3 -3
- package/build/navigation/constants.cjs +1 -1
- package/build/navigation/constants.cjs.map +1 -1
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/deprecated.cjs +69 -0
- package/build/navigation-link/deprecated.cjs.map +7 -0
- package/build/navigation-link/index.cjs +6 -74
- package/build/navigation-link/index.cjs.map +4 -4
- package/build/{form-submit-button/init.cjs → navigation-link/variations.cjs} +23 -8
- package/build/navigation-link/variations.cjs.map +7 -0
- package/build/navigation-submenu/index.cjs +0 -32
- package/build/navigation-submenu/index.cjs.map +3 -3
- package/build/paragraph/index.cjs +0 -17
- package/build/paragraph/index.cjs.map +3 -3
- package/build/paragraph/use-enter.cjs +8 -4
- package/build/paragraph/use-enter.cjs.map +2 -2
- package/build/post-template/edit.cjs +3 -1
- package/build/post-template/edit.cjs.map +2 -2
- package/build/preformatted/index.cjs +0 -17
- package/build/preformatted/index.cjs.map +3 -3
- package/build/pullquote/index.cjs +0 -24
- package/build/pullquote/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +13 -5
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +9 -4
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/query-content.cjs +30 -9
- package/build/query/edit/query-content.cjs.map +3 -3
- package/build/query/utils.cjs +11 -4
- package/build/query/utils.cjs.map +2 -2
- package/build/search/edit.cjs +3 -1
- package/build/search/edit.cjs.map +2 -2
- package/build/search/index.cjs +0 -31
- package/build/search/index.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +11 -17
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +12 -18
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-link/index.cjs +0 -31
- package/build/social-link/index.cjs.map +3 -3
- package/build/verse/index.cjs +0 -17
- package/build/verse/index.cjs.map +3 -3
- package/build/video/index.cjs +0 -40
- package/build/video/index.cjs.map +3 -3
- package/build/video/tracks-editor.cjs +2 -3
- package/build/video/tracks-editor.cjs.map +3 -3
- package/build-module/audio/edit.mjs +5 -5
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/audio/index.mjs +0 -37
- package/build-module/audio/index.mjs.map +2 -2
- package/build-module/button/index.mjs +0 -34
- package/build-module/button/index.mjs.map +2 -2
- package/build-module/code/index.mjs +0 -17
- package/build-module/code/index.mjs.map +2 -2
- package/build-module/comment-template/edit.mjs.map +1 -1
- package/build-module/cover/index.mjs +0 -38
- package/build-module/cover/index.mjs.map +2 -2
- package/build-module/details/index.mjs +0 -17
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/file/index.mjs +1 -44
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/footnotes/format.mjs +1 -1
- package/build-module/footnotes/format.mjs.map +2 -2
- package/build-module/gallery/dynamic-gallery.mjs +23 -13
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/heading/index.mjs +1 -21
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/image/image.mjs +7 -5
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +0 -81
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +84 -14
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +0 -10
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs.map +1 -1
- package/build-module/list-item/edit.mjs +20 -18
- package/build-module/list-item/edit.mjs.map +2 -2
- package/build-module/list-item/hooks/index.mjs +8 -10
- package/build-module/list-item/hooks/index.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +63 -58
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-merge.mjs +27 -35
- package/build-module/list-item/hooks/use-merge.mjs.map +2 -2
- package/build-module/list-item/hooks/use-multi-select-tab.mjs +59 -0
- package/build-module/list-item/hooks/use-multi-select-tab.mjs.map +7 -0
- package/build-module/list-item/hooks/use-tab.mjs +44 -0
- package/build-module/list-item/hooks/use-tab.mjs.map +7 -0
- package/build-module/list-item/index.mjs +0 -17
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/list-item/utils.mjs +140 -0
- package/build-module/list-item/utils.mjs.map +7 -0
- package/build-module/math/block.json +3 -0
- package/build-module/media-text/index.mjs +0 -50
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +17 -12
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/more/index.mjs +0 -18
- package/build-module/more/index.mjs.map +2 -2
- package/build-module/navigation/constants.mjs +1 -1
- package/build-module/navigation/constants.mjs.map +1 -1
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/deprecated.mjs +48 -0
- package/build-module/navigation-link/deprecated.mjs.map +7 -0
- package/build-module/navigation-link/index.mjs +7 -75
- package/build-module/navigation-link/index.mjs.map +3 -3
- package/build-module/navigation-link/variations.mjs +22 -0
- package/build-module/navigation-link/variations.mjs.map +7 -0
- package/build-module/navigation-submenu/index.mjs +1 -33
- package/build-module/navigation-submenu/index.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +0 -17
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +8 -4
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/post-template/edit.mjs +3 -1
- package/build-module/post-template/edit.mjs.map +2 -2
- package/build-module/preformatted/index.mjs +0 -17
- package/build-module/preformatted/index.mjs.map +2 -2
- package/build-module/pullquote/index.mjs +0 -24
- package/build-module/pullquote/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +14 -6
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +9 -4
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/query-content.mjs +32 -11
- package/build-module/query/edit/query-content.mjs.map +2 -2
- package/build-module/query/utils.mjs +10 -7
- package/build-module/query/utils.mjs.map +2 -2
- package/build-module/search/edit.mjs +4 -2
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/search/index.mjs +0 -31
- package/build-module/search/index.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +13 -19
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -20
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-link/index.mjs +0 -31
- package/build-module/social-link/index.mjs.map +2 -2
- package/build-module/verse/index.mjs +0 -17
- package/build-module/verse/index.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -40
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +3 -5
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/columns/style-rtl.css +1 -1
- package/build-style/columns/style.css +1 -1
- package/build-style/comment-template/style-rtl.css +0 -1
- package/build-style/comment-template/style.css +0 -1
- package/build-style/cover/style-rtl.css +1 -2
- package/build-style/cover/style.css +1 -2
- package/build-style/editor-rtl.css +20 -81
- package/build-style/editor.css +20 -81
- package/build-style/gallery/style-rtl.css +2 -4
- package/build-style/gallery/style.css +2 -4
- package/build-style/group/theme-rtl.css +1 -1
- package/build-style/group/theme.css +1 -1
- package/build-style/heading/style-rtl.css +1 -1
- package/build-style/heading/style.css +1 -1
- package/build-style/icon/style-rtl.css +3 -0
- package/build-style/icon/style.css +3 -0
- package/build-style/image/editor-rtl.css +0 -1
- package/build-style/image/editor.css +0 -1
- package/build-style/list/style-rtl.css +1 -1
- package/build-style/list/style.css +1 -1
- package/build-style/media-text/style-rtl.css +2 -3
- package/build-style/media-text/style.css +2 -3
- package/build-style/navigation/editor-rtl.css +8 -0
- package/build-style/navigation/editor.css +8 -0
- package/build-style/paragraph/style-rtl.css +1 -1
- package/build-style/paragraph/style.css +1 -1
- package/build-style/playlist/style-rtl.css +1 -2
- package/build-style/playlist/style.css +1 -2
- package/build-style/playlist-track/style-rtl.css +1 -2
- package/build-style/playlist-track/style.css +1 -2
- package/build-style/preformatted/style-rtl.css +1 -1
- package/build-style/preformatted/style.css +1 -1
- package/build-style/query/editor-rtl.css +5 -15
- package/build-style/query/editor.css +5 -15
- package/build-style/read-more/style-rtl.css +0 -1
- package/build-style/read-more/style.css +0 -1
- package/build-style/reset-rtl.css +1 -3
- package/build-style/reset.css +1 -3
- package/build-style/search/style-rtl.css +1 -3
- package/build-style/search/style.css +1 -3
- package/build-style/site-logo/editor-rtl.css +1 -2
- package/build-style/site-logo/editor.css +1 -2
- package/build-style/style-rtl.css +18 -77
- package/build-style/style.css +18 -77
- package/build-style/tab-list/style-rtl.css +1 -3
- package/build-style/tab-list/style.css +1 -3
- package/build-style/template-part/editor-rtl.css +4 -8
- package/build-style/template-part/editor.css +4 -8
- package/build-style/template-part/theme-rtl.css +1 -1
- package/build-style/template-part/theme.css +1 -1
- package/build-style/theme-rtl.css +2 -2
- package/build-style/theme.css +2 -2
- package/build-style/video/style-rtl.css +1 -2
- package/build-style/video/style.css +1 -2
- package/build-types/navigation-link/deprecated.d.ts +48 -0
- package/build-types/navigation-link/deprecated.d.ts.map +1 -0
- package/package.json +43 -43
- package/src/accordion/index.php +2 -2
- package/src/accordion-item/index.php +1 -1
- package/src/audio/edit.jsx +6 -7
- package/src/audio/index.js +0 -37
- package/src/breadcrumbs/index.php +4 -4
- package/src/button/index.js +0 -34
- package/src/button/style.scss +16 -15
- package/src/button/test/{get-experimental-label.js → get-experimental-label.jsdom.test.js} +1 -0
- package/src/button/test/get-updated-link-attributes.js +1 -0
- package/src/button/test/utils.js +1 -0
- package/src/categories/index.php +4 -0
- package/src/code/index.js +0 -18
- package/src/code/test/utils.js +1 -0
- package/src/columns/style.scss +2 -1
- package/src/columns/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/columns/test/utils.js +1 -0
- package/src/comment-template/edit.jsx +1 -1
- package/src/comment-template/index.php +2 -2
- package/src/comment-template/test/index.js +1 -0
- package/src/common.scss +51 -50
- package/src/cover/README.md +37 -0
- package/src/cover/index.js +0 -39
- package/src/cover/style.scss +3 -3
- package/src/cover/test/{edit.js → edit.jsdom.test.js} +18 -17
- package/src/cover/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/details/index.js +0 -18
- package/src/editor.scss +0 -2
- package/src/embed/editor.scss +1 -0
- package/src/embed/test/{index.js → index.jsdom.test.js} +5 -1
- package/src/file/index.js +1 -43
- package/src/footnotes/format.jsx +5 -1
- package/src/gallery/dynamic-gallery.jsx +31 -4
- package/src/gallery/test/dynamic-source.js +1 -0
- package/src/gallery/test/{edit.js → edit.jsdom.test.js} +4 -0
- package/src/gallery/test/responsive-styles.js +1 -0
- package/src/gallery/test/shared.js +1 -0
- package/src/gallery/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/gallery/test/{use-get-new-images.jsx → use-get-new-images.jsdom.test.jsx} +1 -0
- package/src/gallery/test/variations.js +1 -0
- package/src/group/test/{placeholder.jsx → placeholder.jsdom.test.jsx} +1 -0
- package/src/group/theme.scss +1 -1
- package/src/heading/index.js +1 -22
- package/src/heading/index.php +1 -1
- package/src/heading/style.scss +1 -1
- package/src/heading/test/shared.js +1 -0
- package/src/home-link/index.php +2 -2
- package/src/html/test/{index.js → index.jsdom.test.js} +9 -0
- package/src/html/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/icon/index.php +18 -6
- package/src/icon/style.scss +7 -0
- package/src/image/image.jsx +18 -11
- package/src/image/index.js +0 -80
- package/src/image/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/image/test/{use-open-image-media-editor-modal.js → use-open-image-media-editor-modal.jsdom.test.js} +343 -28
- package/src/image/use-open-image-media-editor-modal.js +184 -21
- package/src/index.jsx +0 -11
- package/src/latest-posts/edit.jsx +1 -1
- package/src/latest-posts/test/{deprecated.js → deprecated.jsdom.test.js} +1 -0
- package/src/list/index.php +1 -1
- package/src/list/style.scss +1 -1
- package/src/list-item/edit.jsx +20 -20
- package/src/list-item/hooks/index.js +2 -3
- package/src/list-item/hooks/use-enter.js +82 -70
- package/src/list-item/hooks/use-merge.js +28 -36
- package/src/list-item/hooks/use-multi-select-tab.js +83 -0
- package/src/list-item/hooks/use-tab.js +62 -0
- package/src/list-item/index.js +0 -18
- package/src/list-item/utils.js +236 -0
- package/src/math/README.md +2 -0
- package/src/math/block.json +3 -0
- package/src/media-text/index.js +0 -50
- package/src/media-text/media-container.jsx +22 -12
- package/src/media-text/style.scss +2 -1
- package/src/media-text/test/image-fill.js +1 -0
- package/src/more/index.js +0 -19
- package/src/navigation/constants.js +1 -1
- package/src/navigation/edit/test/are-blocks-dirty.js +1 -0
- package/src/navigation/edit/test/{layout-custom-properties.js → layout-custom-properties.jsdom.test.js} +8 -7
- package/src/navigation/edit/test/{navigation-menu-selector.jsx → navigation-menu-selector.jsdom.test.jsx} +23 -14
- package/src/navigation/edit/test/{overlay-template-part-selector.jsx → overlay-template-part-selector.jsdom.test.jsx} +22 -20
- package/src/navigation/edit/test/{responsive-wrapper.jsx → responsive-wrapper.jsdom.test.jsx} +14 -13
- package/src/navigation/edit/test/{use-create-overlay.js → use-create-overlay.jsdom.test.js} +19 -24
- package/src/navigation/edit/test/utils.js +1 -0
- package/src/navigation/editor.scss +13 -0
- package/src/navigation/index.php +14 -14
- package/src/navigation/test/{menu-items-to-blocks.js → menu-items-to-blocks.jsdom.test.js} +3 -2
- package/src/navigation/test/{use-navigation-menu.js → use-navigation-menu.jsdom.test.js} +7 -4
- package/src/navigation/test/{view.js → view.jsdom.test.js} +4 -2
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/deprecated.tsx +58 -0
- package/src/navigation-link/{index.jsx → index.js} +5 -77
- package/src/navigation-link/index.php +5 -5
- package/src/navigation-link/shared/test/{controls.jsx → controls.jsdom.test.jsx} +18 -18
- package/src/navigation-link/shared/test/update-attributes.test.js +52 -51
- package/src/navigation-link/shared/test/{use-enable-link-status-validation.test.js → use-enable-link-status-validation.jsdom.test.js} +8 -6
- package/src/navigation-link/shared/test/{use-entity-binding.js → use-entity-binding.jsdom.test.js} +12 -11
- package/src/navigation-link/shared/test/{use-handle-link-change.test.js → use-handle-link-change.jsdom.test.js} +23 -20
- package/src/navigation-link/shared/test/{use-link-preview.test.js → use-link-preview.jsdom.test.js} +17 -14
- package/src/navigation-link/test/__snapshots__/{hooks.js.snap → hooks.jsdom.test.js.snap} +23 -6
- package/src/navigation-link/test/block-labelling.js +1 -0
- package/src/navigation-link/test/{hooks.js → hooks.jsdom.test.js} +1 -0
- package/src/navigation-link/variations.js +19 -0
- package/src/navigation-submenu/index.js +1 -33
- package/src/page-list/index.php +10 -10
- package/src/page-list/test/{convert-to-navigation-links.js → convert-to-navigation-links.jsdom.test.js} +3 -2
- package/src/paragraph/index.js +0 -18
- package/src/paragraph/style.scss +1 -1
- package/src/paragraph/use-enter.js +13 -6
- package/src/pattern/test/index.js +1 -0
- package/src/playlist/test/{edit-component.jsx → edit-component.jsdom.test.jsx} +31 -30
- package/src/playlist/test/{edit.js → edit.jsdom.test.js} +1 -0
- package/src/playlist/test/{transforms.js → transforms.jsdom.test.js} +1 -0
- package/src/playlist-track/test/{edit.jsx → edit.jsdom.test.jsx} +20 -19
- package/src/post-author/index.php +3 -3
- package/src/post-author-biography/index.php +3 -3
- package/src/post-author-name/index.php +3 -3
- package/src/post-comments-link/index.php +4 -4
- package/src/post-date/test/{edit.js → edit.jsdom.test.js} +1 -0
- package/src/post-template/edit.jsx +3 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/post-title/style.scss +1 -0
- package/src/preformatted/index.js +0 -18
- package/src/preformatted/style.scss +1 -1
- package/src/pullquote/index.js +0 -24
- package/src/query/edit/inspector-controls/enhanced-pagination-control.jsx +13 -6
- package/src/query/edit/inspector-controls/index.jsx +9 -4
- package/src/query/edit/query-content.jsx +31 -8
- package/src/query/editor.scss +1 -7
- package/src/query/index.php +2 -2
- package/src/query/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/query/utils.js +15 -11
- package/src/quote/test/{migrate.js → migrate.jsdom.test.js} +1 -0
- package/src/read-more/index.php +1 -1
- package/src/search/edit.jsx +12 -2
- package/src/search/index.js +0 -30
- package/src/search/index.php +1 -1
- package/src/separator/test/{edit.jsx → edit.jsdom.test.jsx} +5 -4
- package/src/site-logo/index.php +1 -1
- package/src/site-tagline/edit.jsx +18 -27
- package/src/site-title/edit.jsx +20 -27
- package/src/social-link/index.js +0 -32
- package/src/social-link/index.php +0 -1
- package/src/style.scss +0 -1
- package/src/table/editor.scss +1 -0
- package/src/table/style.scss +2 -0
- package/src/table/test/state.js +1 -0
- package/src/table/test/utils.js +1 -0
- package/src/table-of-contents/index.php +3 -3
- package/src/template-part/theme.scss +1 -1
- package/src/utils/test/search-patterns.js +1 -0
- package/src/utils/test/{style-state.js → style-state.jsdom.test.js} +1 -0
- package/src/utils/test/{waveform-player-dependency.js → waveform-player-dependency.jsdom.test.js} +15 -21
- package/src/verse/index.js +0 -18
- package/src/verse/style.scss +1 -0
- package/src/video/index.js +0 -40
- package/src/video/test/variations.js +1 -0
- package/src/video/tracks-editor.jsx +4 -5
- package/build/form/block.json +0 -65
- package/build/form/deprecated.cjs +0 -111
- package/build/form/deprecated.cjs.map +0 -7
- package/build/form/edit.cjs +0 -180
- package/build/form/edit.cjs.map +0 -7
- package/build/form/icons.cjs +0 -33
- package/build/form/icons.cjs.map +0 -7
- package/build/form/index.cjs +0 -118
- package/build/form/index.cjs.map +0 -7
- package/build/form/init.cjs +0 -28
- package/build/form/init.cjs.map +0 -7
- package/build/form/save.cjs +0 -40
- package/build/form/save.cjs.map +0 -7
- package/build/form/utils.cjs +0 -61
- package/build/form/utils.cjs.map +0 -7
- package/build/form/variations.cjs +0 -152
- package/build/form/variations.cjs.map +0 -7
- package/build/form/view.cjs +0 -48
- package/build/form/view.cjs.map +0 -7
- package/build/form-input/block.json +0 -72
- package/build/form-input/deprecated.cjs +0 -252
- package/build/form-input/deprecated.cjs.map +0 -7
- package/build/form-input/edit.cjs +0 -206
- package/build/form-input/edit.cjs.map +0 -7
- package/build/form-input/icons.cjs +0 -33
- package/build/form-input/icons.cjs.map +0 -7
- package/build/form-input/index.cjs +0 -63
- package/build/form-input/index.cjs.map +0 -7
- package/build/form-input/init.cjs +0 -28
- package/build/form-input/init.cjs.map +0 -7
- package/build/form-input/save.cjs +0 -88
- package/build/form-input/save.cjs.map +0 -7
- package/build/form-input/variations.cjs +0 -105
- package/build/form-input/variations.cjs.map +0 -7
- package/build/form-submission-notification/block.json +0 -19
- package/build/form-submission-notification/edit.cjs +0 -71
- package/build/form-submission-notification/edit.cjs.map +0 -7
- package/build/form-submission-notification/index.cjs +0 -73
- package/build/form-submission-notification/index.cjs.map +0 -7
- package/build/form-submission-notification/init.cjs +0 -28
- package/build/form-submission-notification/init.cjs.map +0 -7
- package/build/form-submission-notification/save.cjs +0 -54
- package/build/form-submission-notification/save.cjs.map +0 -7
- package/build/form-submission-notification/variations.cjs +0 -78
- package/build/form-submission-notification/variations.cjs.map +0 -7
- package/build/form-submit-button/block.json +0 -15
- package/build/form-submit-button/edit.cjs +0 -36
- package/build/form-submit-button/edit.cjs.map +0 -7
- package/build/form-submit-button/index.cjs +0 -75
- package/build/form-submit-button/index.cjs.map +0 -7
- package/build/form-submit-button/init.cjs.map +0 -7
- package/build/form-submit-button/save.cjs +0 -32
- package/build/form-submit-button/save.cjs.map +0 -7
- package/build/list-item/hooks/use-indent-list-item.cjs +0 -79
- package/build/list-item/hooks/use-indent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-outdent-list-item.cjs +0 -106
- package/build/list-item/hooks/use-outdent-list-item.cjs.map +0 -7
- package/build/list-item/hooks/use-space.cjs +0 -83
- package/build/list-item/hooks/use-space.cjs.map +0 -7
- package/build/query/edit/enhanced-pagination-modal.cjs +0 -89
- package/build/query/edit/enhanced-pagination-modal.cjs.map +0 -7
- package/build-module/form/block.json +0 -65
- package/build-module/form/deprecated.mjs +0 -96
- package/build-module/form/deprecated.mjs.map +0 -7
- package/build-module/form/edit.mjs +0 -170
- package/build-module/form/edit.mjs.map +0 -7
- package/build-module/form/icons.mjs +0 -8
- package/build-module/form/icons.mjs.map +0 -7
- package/build-module/form/index.mjs +0 -83
- package/build-module/form/index.mjs.map +0 -7
- package/build-module/form/init.mjs +0 -7
- package/build-module/form/init.mjs.map +0 -7
- package/build-module/form/save.mjs +0 -19
- package/build-module/form/save.mjs.map +0 -7
- package/build-module/form/utils.mjs +0 -35
- package/build-module/form/utils.mjs.map +0 -7
- package/build-module/form/variations.mjs +0 -134
- package/build-module/form/variations.mjs.map +0 -7
- package/build-module/form/view.mjs +0 -46
- package/build-module/form/view.mjs.map +0 -7
- package/build-module/form-input/block.json +0 -72
- package/build-module/form-input/deprecated.mjs +0 -226
- package/build-module/form-input/deprecated.mjs.map +0 -7
- package/build-module/form-input/edit.mjs +0 -186
- package/build-module/form-input/edit.mjs.map +0 -7
- package/build-module/form-input/icons.mjs +0 -8
- package/build-module/form-input/icons.mjs.map +0 -7
- package/build-module/form-input/index.mjs +0 -25
- package/build-module/form-input/index.mjs.map +0 -7
- package/build-module/form-input/init.mjs +0 -7
- package/build-module/form-input/init.mjs.map +0 -7
- package/build-module/form-input/save.mjs +0 -62
- package/build-module/form-input/save.mjs.map +0 -7
- package/build-module/form-input/variations.mjs +0 -84
- package/build-module/form-input/variations.mjs.map +0 -7
- package/build-module/form-submission-notification/block.json +0 -19
- package/build-module/form-submission-notification/edit.mjs +0 -45
- package/build-module/form-submission-notification/edit.mjs.map +0 -7
- package/build-module/form-submission-notification/index.mjs +0 -35
- package/build-module/form-submission-notification/index.mjs.map +0 -7
- package/build-module/form-submission-notification/init.mjs +0 -7
- package/build-module/form-submission-notification/init.mjs.map +0 -7
- package/build-module/form-submission-notification/save.mjs +0 -23
- package/build-module/form-submission-notification/save.mjs.map +0 -7
- package/build-module/form-submission-notification/variations.mjs +0 -57
- package/build-module/form-submission-notification/variations.mjs.map +0 -7
- package/build-module/form-submit-button/block.json +0 -15
- package/build-module/form-submit-button/edit.mjs +0 -15
- package/build-module/form-submit-button/edit.mjs.map +0 -7
- package/build-module/form-submit-button/index.mjs +0 -37
- package/build-module/form-submit-button/index.mjs.map +0 -7
- package/build-module/form-submit-button/init.mjs +0 -7
- package/build-module/form-submit-button/init.mjs.map +0 -7
- package/build-module/form-submit-button/save.mjs +0 -11
- package/build-module/form-submit-button/save.mjs.map +0 -7
- package/build-module/list-item/hooks/use-indent-list-item.mjs +0 -58
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-outdent-list-item.mjs +0 -85
- package/build-module/list-item/hooks/use-outdent-list-item.mjs.map +0 -7
- package/build-module/list-item/hooks/use-space.mjs +0 -52
- package/build-module/list-item/hooks/use-space.mjs.map +0 -7
- package/build-module/query/edit/enhanced-pagination-modal.mjs +0 -72
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +0 -7
- package/build-style/form-input/editor-rtl.css +0 -19
- package/build-style/form-input/editor.css +0 -19
- package/build-style/form-input/style-rtl.css +0 -48
- package/build-style/form-input/style.css +0 -48
- package/build-style/form-submission-notification/editor-rtl.css +0 -30
- package/build-style/form-submission-notification/editor.css +0 -30
- package/build-style/form-submit-button/style-rtl.css +0 -3
- package/build-style/form-submit-button/style.css +0 -3
- package/src/form/README.md +0 -90
- package/src/form/block.json +0 -65
- package/src/form/deprecated.jsx +0 -93
- package/src/form/edit.jsx +0 -169
- package/src/form/icons.jsx +0 -7
- package/src/form/index.js +0 -91
- package/src/form/index.php +0 -197
- package/src/form/init.js +0 -3
- package/src/form/save.jsx +0 -15
- package/src/form/utils.js +0 -36
- package/src/form/variations.js +0 -133
- package/src/form/view.js +0 -54
- package/src/form-input/README.md +0 -74
- package/src/form-input/block.json +0 -72
- package/src/form-input/deprecated.jsx +0 -248
- package/src/form-input/edit.jsx +0 -187
- package/src/form-input/editor.scss +0 -24
- package/src/form-input/icons.jsx +0 -7
- package/src/form-input/index.js +0 -22
- package/src/form-input/index.php +0 -47
- package/src/form-input/init.js +0 -3
- package/src/form-input/save.jsx +0 -89
- package/src/form-input/style.scss +0 -64
- package/src/form-input/variations.js +0 -82
- package/src/form-submission-notification/README.md +0 -50
- package/src/form-submission-notification/block.json +0 -19
- package/src/form-submission-notification/edit.jsx +0 -44
- package/src/form-submission-notification/editor.scss +0 -45
- package/src/form-submission-notification/index.js +0 -33
- package/src/form-submission-notification/index.php +0 -48
- package/src/form-submission-notification/init.js +0 -3
- package/src/form-submission-notification/save.jsx +0 -18
- package/src/form-submission-notification/variations.js +0 -56
- package/src/form-submit-button/README.md +0 -54
- package/src/form-submit-button/block.json +0 -15
- package/src/form-submit-button/edit.jsx +0 -12
- package/src/form-submit-button/index.js +0 -35
- package/src/form-submit-button/init.js +0 -3
- package/src/form-submit-button/save.jsx +0 -10
- package/src/form-submit-button/style.scss +0 -3
- package/src/list-item/hooks/use-indent-list-item.js +0 -73
- package/src/list-item/hooks/use-outdent-list-item.js +0 -100
- package/src/list-item/hooks/use-space.js +0 -66
- package/src/query/edit/enhanced-pagination-modal.jsx +0 -77
- /package/src/utils/test/{waveform-player.jsx → waveform-player.jsdom.test.jsx} +0 -0
- /package/src/utils/test/{waveform-utils.js → waveform-utils.jsdom.test.js} +0 -0
package/src/form/variations.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import {
|
|
3
|
-
formSubmissionNotificationSuccess,
|
|
4
|
-
formSubmissionNotificationError,
|
|
5
|
-
} from './utils.js';
|
|
6
|
-
|
|
7
|
-
const variations = [
|
|
8
|
-
{
|
|
9
|
-
name: 'comment-form',
|
|
10
|
-
title: __( 'Experimental Comment form' ),
|
|
11
|
-
description: __( 'A comment form for posts and pages.' ),
|
|
12
|
-
attributes: {
|
|
13
|
-
submissionMethod: 'custom',
|
|
14
|
-
action: '{SITE_URL}/wp-comments-post.php',
|
|
15
|
-
method: 'post',
|
|
16
|
-
anchor: 'comment-form',
|
|
17
|
-
},
|
|
18
|
-
isDefault: false,
|
|
19
|
-
innerBlocks: [
|
|
20
|
-
[
|
|
21
|
-
'core/form-input',
|
|
22
|
-
{
|
|
23
|
-
type: 'text',
|
|
24
|
-
name: 'author',
|
|
25
|
-
label: __( 'Name' ),
|
|
26
|
-
required: true,
|
|
27
|
-
visibilityPermissions: 'logged-out',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
'core/form-input',
|
|
32
|
-
{
|
|
33
|
-
type: 'email',
|
|
34
|
-
name: 'email',
|
|
35
|
-
label: __( 'Email' ),
|
|
36
|
-
required: true,
|
|
37
|
-
visibilityPermissions: 'logged-out',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
'core/form-input',
|
|
42
|
-
{
|
|
43
|
-
type: 'textarea',
|
|
44
|
-
name: 'comment',
|
|
45
|
-
label: __( 'Comment' ),
|
|
46
|
-
required: true,
|
|
47
|
-
visibilityPermissions: 'all',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
[ 'core/form-submit-button', {} ],
|
|
51
|
-
],
|
|
52
|
-
scope: [ 'inserter', 'transform' ],
|
|
53
|
-
isActive: ( blockAttributes ) =>
|
|
54
|
-
! blockAttributes?.type || blockAttributes?.type === 'text',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'wp-privacy-form',
|
|
58
|
-
title: __( 'Experimental Privacy Request Form' ),
|
|
59
|
-
keywords: [ 'GDPR' ],
|
|
60
|
-
description: __( 'A form to request data exports and/or deletion.' ),
|
|
61
|
-
attributes: {
|
|
62
|
-
submissionMethod: 'custom',
|
|
63
|
-
action: '',
|
|
64
|
-
method: 'post',
|
|
65
|
-
anchor: 'gdpr-form',
|
|
66
|
-
},
|
|
67
|
-
isDefault: false,
|
|
68
|
-
innerBlocks: [
|
|
69
|
-
formSubmissionNotificationSuccess,
|
|
70
|
-
formSubmissionNotificationError,
|
|
71
|
-
[
|
|
72
|
-
'core/paragraph',
|
|
73
|
-
{
|
|
74
|
-
content: __(
|
|
75
|
-
'To request an export or deletion of your personal data on this site, please fill-in the form below. You can define the type of request you wish to perform, and your email address. Once the form is submitted, you will receive a confirmation email with instructions on the next steps.'
|
|
76
|
-
),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
'core/form-input',
|
|
81
|
-
{
|
|
82
|
-
type: 'email',
|
|
83
|
-
name: 'email',
|
|
84
|
-
label: __( 'Enter your email address.' ),
|
|
85
|
-
required: true,
|
|
86
|
-
visibilityPermissions: 'all',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
'core/form-input',
|
|
91
|
-
{
|
|
92
|
-
type: 'checkbox',
|
|
93
|
-
name: 'export_personal_data',
|
|
94
|
-
label: __( 'Request data export' ),
|
|
95
|
-
required: false,
|
|
96
|
-
visibilityPermissions: 'all',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
'core/form-input',
|
|
101
|
-
{
|
|
102
|
-
type: 'checkbox',
|
|
103
|
-
name: 'remove_personal_data',
|
|
104
|
-
label: __( 'Request data deletion' ),
|
|
105
|
-
required: false,
|
|
106
|
-
visibilityPermissions: 'all',
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
[ 'core/form-submit-button', {} ],
|
|
110
|
-
[
|
|
111
|
-
'core/form-input',
|
|
112
|
-
{
|
|
113
|
-
type: 'hidden',
|
|
114
|
-
name: 'wp-action',
|
|
115
|
-
value: 'wp_privacy_send_request',
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
[
|
|
119
|
-
'core/form-input',
|
|
120
|
-
{
|
|
121
|
-
type: 'hidden',
|
|
122
|
-
name: 'wp-privacy-request',
|
|
123
|
-
value: '1',
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
],
|
|
127
|
-
scope: [ 'inserter', 'transform' ],
|
|
128
|
-
isActive: ( blockAttributes ) =>
|
|
129
|
-
! blockAttributes?.type || blockAttributes?.type === 'text',
|
|
130
|
-
},
|
|
131
|
-
];
|
|
132
|
-
|
|
133
|
-
export default variations;
|
package/src/form/view.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
let formSettings;
|
|
2
|
-
try {
|
|
3
|
-
formSettings = JSON.parse(
|
|
4
|
-
document.getElementById(
|
|
5
|
-
'wp-script-module-data-@wordpress/block-library/form/view'
|
|
6
|
-
)?.textContent
|
|
7
|
-
);
|
|
8
|
-
} catch {}
|
|
9
|
-
|
|
10
|
-
document.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {
|
|
11
|
-
// Bail If the form settings not provided or the form is not using the mailto: action.
|
|
12
|
-
if (
|
|
13
|
-
! formSettings ||
|
|
14
|
-
! form.action ||
|
|
15
|
-
! form.action.startsWith( 'mailto:' )
|
|
16
|
-
) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const redirectNotification = ( status ) => {
|
|
21
|
-
const urlParams = new URLSearchParams( window.location.search );
|
|
22
|
-
urlParams.append( 'wp-form-result', status );
|
|
23
|
-
window.location.search = urlParams.toString();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Add an event listener for the form submission.
|
|
27
|
-
form.addEventListener( 'submit', async function ( event ) {
|
|
28
|
-
event.preventDefault();
|
|
29
|
-
// Get the form data and merge it with the form action and nonce.
|
|
30
|
-
const formData = Object.fromEntries( new FormData( form ).entries() );
|
|
31
|
-
formData.formAction = form.action;
|
|
32
|
-
formData._ajax_nonce = formSettings.nonce;
|
|
33
|
-
formData.action = formSettings.action;
|
|
34
|
-
formData._wp_http_referer = window.location.href;
|
|
35
|
-
formData.formAction = form.action;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const response = await fetch( formSettings.ajaxUrl, {
|
|
39
|
-
method: 'POST',
|
|
40
|
-
headers: {
|
|
41
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
42
|
-
},
|
|
43
|
-
body: new URLSearchParams( formData ).toString(),
|
|
44
|
-
} );
|
|
45
|
-
if ( response.ok ) {
|
|
46
|
-
redirectNotification( 'success' );
|
|
47
|
-
} else {
|
|
48
|
-
redirectNotification( 'error' );
|
|
49
|
-
}
|
|
50
|
-
} catch {
|
|
51
|
-
redirectNotification( 'error' );
|
|
52
|
-
}
|
|
53
|
-
} );
|
|
54
|
-
} );
|
package/src/form-input/README.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Input Field
|
|
2
|
-
|
|
3
|
-
<!-- START TOKEN(Autogenerated block API docs) -->
|
|
4
|
-
<div class="callout callout-warning">This block is <strong>experimental</strong> and may change or be removed without notice.</div>
|
|
5
|
-
|
|
6
|
-
The basic building block for forms.
|
|
7
|
-
|
|
8
|
-
- **Name:** `core/form-input`
|
|
9
|
-
- **Category:** [widgets](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-widgets/)
|
|
10
|
-
- **API Version:** [3](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/)
|
|
11
|
-
- **Block Type:** [Hybrid](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/) (static save + server enhancements)
|
|
12
|
-
- **Keywords:** `input`, `form`
|
|
13
|
-
|
|
14
|
-
## Block Relationships
|
|
15
|
-
|
|
16
|
-
**[Ancestor](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#ancestor) blocks:**
|
|
17
|
-
- [`core/form`](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-widgets/core-block-form/)
|
|
18
|
-
|
|
19
|
-
## Attributes
|
|
20
|
-
|
|
21
|
-
_Defined via the [`attributes`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/) property in block.json._
|
|
22
|
-
|
|
23
|
-
| Attribute | [Type](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#type-validation) | [Default](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#default-value) | Description |
|
|
24
|
-
|-----------|------|---------|-------------|
|
|
25
|
-
| `type` | `string` | `"text"` | — |
|
|
26
|
-
| `name` | `string` | — | — |
|
|
27
|
-
| `label` | `rich-text` | `"Label"` | [Source](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `rich-text`. [Selector](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `.wp-block-form-input__label-content`. [Role](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#role): `content` |
|
|
28
|
-
| `inlineLabel` | `boolean` | `false` | — |
|
|
29
|
-
| `required` | `boolean` | `false` | [Source](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `attribute`. [Selector](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `.wp-block-form-input__input`. [HTML attr](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#attribute-source): `required` |
|
|
30
|
-
| `placeholder` | `string` | — | [Source](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `attribute`. [Selector](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `.wp-block-form-input__input`. [HTML attr](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#attribute-source): `placeholder`. [Role](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#role): `content` |
|
|
31
|
-
| `value` | `string` | `""` | [Source](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `attribute`. [Selector](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source): `input`. [HTML attr](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#attribute-source): `value` |
|
|
32
|
-
| `visibilityPermissions` | `string` | `"all"` | — |
|
|
33
|
-
|
|
34
|
-
## Supports
|
|
35
|
-
|
|
36
|
-
_Defined via the [`supports`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) property in block.json._
|
|
37
|
-
|
|
38
|
-
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
39
|
-
- [`reusable`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#reusable): `false`
|
|
40
|
-
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
41
|
-
- `margin`: `["top","bottom"]`
|
|
42
|
-
|
|
43
|
-
## Block Markup
|
|
44
|
-
|
|
45
|
-
This is a [**hybrid block**](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/). It saves static markup that the server may enhance during rendering.
|
|
46
|
-
|
|
47
|
-
```html
|
|
48
|
-
<!-- wp:form-input -->
|
|
49
|
-
<div class="wp-block-form-input"><label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="text" name="label" aria-required="false"/></label></div>
|
|
50
|
-
<!-- /wp:form-input -->
|
|
51
|
-
|
|
52
|
-
<!-- wp:form-input {"type":"email"} -->
|
|
53
|
-
<div class="wp-block-form-input"><label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="email" name="label" aria-required="false"/></label></div>
|
|
54
|
-
<!-- /wp:form-input -->
|
|
55
|
-
|
|
56
|
-
<!-- wp:form-input {"type":"number"} -->
|
|
57
|
-
<div class="wp-block-form-input"><label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="number" name="label" aria-required="false"/></label></div>
|
|
58
|
-
<!-- /wp:form-input -->
|
|
59
|
-
|
|
60
|
-
<!-- wp:form-input {"type":"tel"} -->
|
|
61
|
-
<div class="wp-block-form-input"><label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="tel" name="label" aria-required="false"/></label></div>
|
|
62
|
-
<!-- /wp:form-input -->
|
|
63
|
-
|
|
64
|
-
<!-- wp:form-input {"type":"url"} -->
|
|
65
|
-
<div class="wp-block-form-input"><label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="url" name="label" aria-required="false"/></label></div>
|
|
66
|
-
<!-- /wp:form-input -->
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Source
|
|
70
|
-
|
|
71
|
-
- [block.json](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/form-input/block.json) ([reference](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/))
|
|
72
|
-
- [Source directory](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/form-input/) — browse the `edit` and `save` source files, `index.php`, and more.
|
|
73
|
-
|
|
74
|
-
<!-- END TOKEN(Autogenerated block API docs) -->
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"apiVersion": 3,
|
|
4
|
-
"__experimental": true,
|
|
5
|
-
"name": "core/form-input",
|
|
6
|
-
"title": "Input Field",
|
|
7
|
-
"category": "widgets",
|
|
8
|
-
"ancestor": [ "core/form" ],
|
|
9
|
-
"description": "The basic building block for forms.",
|
|
10
|
-
"keywords": [ "input", "form" ],
|
|
11
|
-
"textdomain": "default",
|
|
12
|
-
"attributes": {
|
|
13
|
-
"type": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"default": "text"
|
|
16
|
-
},
|
|
17
|
-
"name": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"label": {
|
|
21
|
-
"type": "rich-text",
|
|
22
|
-
"default": "Label",
|
|
23
|
-
"selector": ".wp-block-form-input__label-content",
|
|
24
|
-
"source": "rich-text",
|
|
25
|
-
"role": "content"
|
|
26
|
-
},
|
|
27
|
-
"inlineLabel": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"default": false
|
|
30
|
-
},
|
|
31
|
-
"required": {
|
|
32
|
-
"type": "boolean",
|
|
33
|
-
"default": false,
|
|
34
|
-
"selector": ".wp-block-form-input__input",
|
|
35
|
-
"source": "attribute",
|
|
36
|
-
"attribute": "required"
|
|
37
|
-
},
|
|
38
|
-
"placeholder": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"selector": ".wp-block-form-input__input",
|
|
41
|
-
"source": "attribute",
|
|
42
|
-
"attribute": "placeholder",
|
|
43
|
-
"role": "content"
|
|
44
|
-
},
|
|
45
|
-
"value": {
|
|
46
|
-
"type": "string",
|
|
47
|
-
"default": "",
|
|
48
|
-
"selector": "input",
|
|
49
|
-
"source": "attribute",
|
|
50
|
-
"attribute": "value"
|
|
51
|
-
},
|
|
52
|
-
"visibilityPermissions": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"default": "all"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"supports": {
|
|
58
|
-
"anchor": true,
|
|
59
|
-
"reusable": false,
|
|
60
|
-
"spacing": {
|
|
61
|
-
"margin": [ "top", "bottom" ]
|
|
62
|
-
},
|
|
63
|
-
"__experimentalBorder": {
|
|
64
|
-
"radius": true,
|
|
65
|
-
"__experimentalSkipSerialization": true,
|
|
66
|
-
"__experimentalDefaultControls": {
|
|
67
|
-
"radius": true
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"style": [ "wp-block-form-input" ]
|
|
72
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import removeAccents from 'remove-accents';
|
|
3
|
-
import {
|
|
4
|
-
RichText,
|
|
5
|
-
useBlockProps,
|
|
6
|
-
__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
|
|
7
|
-
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
10
|
-
|
|
11
|
-
const getNameFromLabelV1 = ( content ) => {
|
|
12
|
-
return (
|
|
13
|
-
removeAccents( stripHTML( content ) )
|
|
14
|
-
// Convert anything that's not a letter or number to a hyphen.
|
|
15
|
-
.replace( /[^\p{L}\p{N}]+/gu, '-' )
|
|
16
|
-
// Convert to lowercase
|
|
17
|
-
.toLowerCase()
|
|
18
|
-
// Remove any remaining leading or trailing hyphens.
|
|
19
|
-
.replace( /(^-+)|(-+$)/g, '' )
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const v2 = {
|
|
24
|
-
attributes: {
|
|
25
|
-
type: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
default: 'text',
|
|
28
|
-
},
|
|
29
|
-
name: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
},
|
|
32
|
-
label: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
default: 'Label',
|
|
35
|
-
selector: '.wp-block-form-input__label-content',
|
|
36
|
-
source: 'html',
|
|
37
|
-
role: 'content',
|
|
38
|
-
},
|
|
39
|
-
inlineLabel: {
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
43
|
-
required: {
|
|
44
|
-
type: 'boolean',
|
|
45
|
-
default: false,
|
|
46
|
-
selector: '.wp-block-form-input__input',
|
|
47
|
-
source: 'attribute',
|
|
48
|
-
attribute: 'required',
|
|
49
|
-
},
|
|
50
|
-
placeholder: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
selector: '.wp-block-form-input__input',
|
|
53
|
-
source: 'attribute',
|
|
54
|
-
attribute: 'placeholder',
|
|
55
|
-
role: 'content',
|
|
56
|
-
},
|
|
57
|
-
value: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
default: '',
|
|
60
|
-
selector: 'input',
|
|
61
|
-
source: 'attribute',
|
|
62
|
-
attribute: 'value',
|
|
63
|
-
},
|
|
64
|
-
visibilityPermissions: {
|
|
65
|
-
type: 'string',
|
|
66
|
-
default: 'all',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
supports: {
|
|
70
|
-
anchor: true,
|
|
71
|
-
reusable: false,
|
|
72
|
-
spacing: {
|
|
73
|
-
margin: [ 'top', 'bottom' ],
|
|
74
|
-
},
|
|
75
|
-
__experimentalBorder: {
|
|
76
|
-
radius: true,
|
|
77
|
-
__experimentalSkipSerialization: true,
|
|
78
|
-
__experimentalDefaultControls: {
|
|
79
|
-
radius: true,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
save( { attributes } ) {
|
|
84
|
-
const { type, name, label, inlineLabel, required, placeholder, value } =
|
|
85
|
-
attributes;
|
|
86
|
-
|
|
87
|
-
const borderProps = getBorderClassesAndStyles( attributes );
|
|
88
|
-
const colorProps = getColorClassesAndStyles( attributes );
|
|
89
|
-
|
|
90
|
-
const inputStyle = {
|
|
91
|
-
...borderProps.style,
|
|
92
|
-
...colorProps.style,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const inputClasses = clsx(
|
|
96
|
-
'wp-block-form-input__input',
|
|
97
|
-
colorProps.className,
|
|
98
|
-
borderProps.className
|
|
99
|
-
);
|
|
100
|
-
const TagName = type === 'textarea' ? 'textarea' : 'input';
|
|
101
|
-
|
|
102
|
-
const blockProps = useBlockProps.save();
|
|
103
|
-
|
|
104
|
-
if ( 'hidden' === type ) {
|
|
105
|
-
return <input type={ type } name={ name } value={ value } />;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<div { ...blockProps }>
|
|
110
|
-
{ /* eslint-disable jsx-a11y/label-has-associated-control */ }
|
|
111
|
-
<label
|
|
112
|
-
className={ clsx( 'wp-block-form-input__label', {
|
|
113
|
-
'is-label-inline': inlineLabel,
|
|
114
|
-
} ) }
|
|
115
|
-
>
|
|
116
|
-
<span className="wp-block-form-input__label-content">
|
|
117
|
-
<RichText.Content value={ label } />
|
|
118
|
-
</span>
|
|
119
|
-
<TagName
|
|
120
|
-
className={ inputClasses }
|
|
121
|
-
type={ 'textarea' === type ? undefined : type }
|
|
122
|
-
name={ name || getNameFromLabelV1( label ) }
|
|
123
|
-
required={ required }
|
|
124
|
-
aria-required={ required }
|
|
125
|
-
placeholder={ placeholder || undefined }
|
|
126
|
-
style={ inputStyle }
|
|
127
|
-
/>
|
|
128
|
-
</label>
|
|
129
|
-
{ /* eslint-enable jsx-a11y/label-has-associated-control */ }
|
|
130
|
-
</div>
|
|
131
|
-
);
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// Version without wrapper div in saved markup
|
|
136
|
-
// See: https://github.com/WordPress/gutenberg/pull/56507
|
|
137
|
-
const v1 = {
|
|
138
|
-
attributes: {
|
|
139
|
-
type: {
|
|
140
|
-
type: 'string',
|
|
141
|
-
default: 'text',
|
|
142
|
-
},
|
|
143
|
-
name: {
|
|
144
|
-
type: 'string',
|
|
145
|
-
},
|
|
146
|
-
label: {
|
|
147
|
-
type: 'string',
|
|
148
|
-
default: 'Label',
|
|
149
|
-
selector: '.wp-block-form-input__label-content',
|
|
150
|
-
source: 'html',
|
|
151
|
-
role: 'content',
|
|
152
|
-
},
|
|
153
|
-
inlineLabel: {
|
|
154
|
-
type: 'boolean',
|
|
155
|
-
default: false,
|
|
156
|
-
},
|
|
157
|
-
required: {
|
|
158
|
-
type: 'boolean',
|
|
159
|
-
default: false,
|
|
160
|
-
selector: '.wp-block-form-input__input',
|
|
161
|
-
source: 'attribute',
|
|
162
|
-
attribute: 'required',
|
|
163
|
-
},
|
|
164
|
-
placeholder: {
|
|
165
|
-
type: 'string',
|
|
166
|
-
selector: '.wp-block-form-input__input',
|
|
167
|
-
source: 'attribute',
|
|
168
|
-
attribute: 'placeholder',
|
|
169
|
-
role: 'content',
|
|
170
|
-
},
|
|
171
|
-
value: {
|
|
172
|
-
type: 'string',
|
|
173
|
-
default: '',
|
|
174
|
-
selector: 'input',
|
|
175
|
-
source: 'attribute',
|
|
176
|
-
attribute: 'value',
|
|
177
|
-
},
|
|
178
|
-
visibilityPermissions: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
default: 'all',
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
supports: {
|
|
184
|
-
className: false,
|
|
185
|
-
anchor: true,
|
|
186
|
-
reusable: false,
|
|
187
|
-
spacing: {
|
|
188
|
-
margin: [ 'top', 'bottom' ],
|
|
189
|
-
},
|
|
190
|
-
__experimentalBorder: {
|
|
191
|
-
radius: true,
|
|
192
|
-
__experimentalSkipSerialization: true,
|
|
193
|
-
__experimentalDefaultControls: {
|
|
194
|
-
radius: true,
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
save( { attributes } ) {
|
|
199
|
-
const { type, name, label, inlineLabel, required, placeholder, value } =
|
|
200
|
-
attributes;
|
|
201
|
-
|
|
202
|
-
const borderProps = getBorderClassesAndStyles( attributes );
|
|
203
|
-
const colorProps = getColorClassesAndStyles( attributes );
|
|
204
|
-
|
|
205
|
-
const inputStyle = {
|
|
206
|
-
...borderProps.style,
|
|
207
|
-
...colorProps.style,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
const inputClasses = clsx(
|
|
211
|
-
'wp-block-form-input__input',
|
|
212
|
-
colorProps.className,
|
|
213
|
-
borderProps.className
|
|
214
|
-
);
|
|
215
|
-
const TagName = type === 'textarea' ? 'textarea' : 'input';
|
|
216
|
-
|
|
217
|
-
if ( 'hidden' === type ) {
|
|
218
|
-
return <input type={ type } name={ name } value={ value } />;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* eslint-disable jsx-a11y/label-has-associated-control */
|
|
222
|
-
return (
|
|
223
|
-
<label
|
|
224
|
-
className={ clsx( 'wp-block-form-input__label', {
|
|
225
|
-
'is-label-inline': inlineLabel,
|
|
226
|
-
} ) }
|
|
227
|
-
>
|
|
228
|
-
<span className="wp-block-form-input__label-content">
|
|
229
|
-
<RichText.Content value={ label } />
|
|
230
|
-
</span>
|
|
231
|
-
<TagName
|
|
232
|
-
className={ inputClasses }
|
|
233
|
-
type={ 'textarea' === type ? undefined : type }
|
|
234
|
-
name={ name || getNameFromLabelV1( label ) }
|
|
235
|
-
required={ required }
|
|
236
|
-
aria-required={ required }
|
|
237
|
-
placeholder={ placeholder || undefined }
|
|
238
|
-
style={ inputStyle }
|
|
239
|
-
/>
|
|
240
|
-
</label>
|
|
241
|
-
);
|
|
242
|
-
/* eslint-enable jsx-a11y/label-has-associated-control */
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const deprecated = [ v2, v1 ];
|
|
247
|
-
|
|
248
|
-
export default deprecated;
|