@wordpress/block-editor 14.9.0 → 14.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/README.md +40 -0
- package/build/components/audio-player/index.native.js +1 -1
- package/build/components/audio-player/index.native.js.map +1 -1
- package/build/components/background-image-control/index.js +4 -0
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +32 -0
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-card/index.js +45 -8
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-edit/edit.js +147 -10
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/index.js +1 -2
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +20 -3
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/utils.js +3 -3
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -5
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +6 -0
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +51 -11
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +1 -1
- package/build/components/contrast-checker/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +7 -16
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +9 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/color-panel.js +3 -0
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +1 -1
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +9 -0
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +12 -1
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +11 -11
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +1 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/index.js +6 -15
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -13
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +9 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +26 -26
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/plain-text/index.js +34 -0
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/provider/index.js +61 -5
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-media-upload-settings.js +28 -0
- package/build/components/provider/use-media-upload-settings.js.map +1 -0
- package/build/components/resolution-tool/index.js +3 -1
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/delete.js +7 -1
- package/build/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +2 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/background.js +2 -0
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +15 -14
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js +2 -2
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +7 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/style.js +7 -7
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -7
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +6 -6
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-zoom-out.js +12 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +11 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +93 -12
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +95 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +2 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +5 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +32 -0
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -8
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +148 -11
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +20 -3
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/utils.js +3 -3
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -6
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +7 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +51 -11
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +2 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +7 -16
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +8 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +1 -1
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +9 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +12 -1
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +12 -12
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +1 -2
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/index.js +6 -15
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -13
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +2 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +8 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +28 -28
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +34 -0
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/provider/index.js +62 -5
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-media-upload-settings.js +22 -0
- package/build-module/components/provider/use-media-upload-settings.js.map +1 -0
- package/build-module/components/resolution-tool/index.js +3 -1
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +7 -1
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +2 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/background.js +2 -0
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +13 -12
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js +2 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/style.js +7 -7
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -7
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +6 -6
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +12 -2
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +93 -12
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +90 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/style-rtl.css +27 -9
- package/build-style/style.css +27 -9
- package/package.json +33 -33
- package/src/components/audio-player/index.native.js +2 -2
- package/src/components/background-image-control/index.js +4 -0
- package/src/components/background-image-control/style.scss +4 -2
- package/src/components/block-alignment-matrix-control/README.md +29 -6
- package/src/components/block-alignment-matrix-control/index.js +31 -0
- package/src/components/block-alignment-matrix-control/stories/index.story.js +78 -0
- package/src/components/block-card/README.md +7 -0
- package/src/components/block-card/index.js +41 -12
- package/src/components/block-card/stories/index.story.js +79 -0
- package/src/components/block-card/style.scss +9 -1
- package/src/components/block-edit/edit.js +218 -11
- package/src/components/block-list/index.js +2 -7
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/zoom-out-separator.js +30 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +17 -20
- package/src/components/block-styles/utils.js +3 -3
- package/src/components/block-title/stories/index.story.js +76 -0
- package/src/components/block-tools/style.scss +1 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +21 -3
- package/src/components/border-radius-control/README.md +59 -0
- package/src/components/border-radius-control/stories/index.story.js +58 -0
- package/src/components/button-block-appender/index.js +2 -7
- package/src/components/child-layout-control/index.js +14 -0
- package/src/components/colors-gradients/dropdown.js +57 -8
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/contrast-checker/index.native.js +2 -2
- package/src/components/contrast-checker/stories/index.story.js +117 -0
- package/src/components/date-format-picker/README.md +6 -13
- package/src/components/date-format-picker/index.js +10 -17
- package/src/components/date-format-picker/stories/index.story.js +69 -0
- package/src/components/date-format-picker/style.scss +3 -1
- package/src/components/default-block-appender/content.scss +1 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/index.story.js +2 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +2 -1
- package/src/components/font-appearance-control/index.js +15 -0
- package/src/components/font-family/README.md +1 -0
- package/src/components/font-family/index.js +17 -1
- package/src/components/font-family/stories/index.story.js +1 -0
- package/src/components/global-styles/color-panel.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/grid/grid-visualizer.js +11 -0
- package/src/components/grid/utils.js +19 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +17 -10
- package/src/components/inserter/block-patterns-explorer/index.js +2 -3
- package/src/components/inserter/block-patterns-tab/index.js +3 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/src/components/inserter/category-tabs/index.js +3 -2
- package/src/components/inserter/index.js +1 -13
- package/src/components/inserter/quick-inserter.js +2 -25
- package/src/components/keyboard-shortcuts/index.js +2 -2
- package/src/components/line-height-control/README.md +1 -0
- package/src/components/line-height-control/index.js +12 -0
- package/src/components/line-height-control/stories/index.story.js +1 -0
- package/src/components/line-height-control/test/index.js +7 -1
- package/src/components/list-view/style.scss +10 -5
- package/src/components/media-placeholder/index.js +3 -3
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +28 -36
- package/src/components/media-replace-flow/style.scss +6 -6
- package/src/components/plain-text/README.md +2 -2
- package/src/components/plain-text/index.js +34 -0
- package/src/components/plain-text/stories/index.story.js +75 -0
- package/src/components/provider/index.js +81 -4
- package/src/components/provider/use-media-upload-settings.js +25 -0
- package/src/components/resolution-tool/index.js +2 -0
- package/src/components/resolution-tool/stories/index.story.js +36 -8
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/rich-text/event-listeners/delete.js +6 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/text-alignment-control/README.md +49 -0
- package/src/components/text-alignment-control/stories/index.story.js +56 -18
- package/src/components/text-decoration-control/README.md +0 -1
- package/src/components/text-decoration-control/stories/index.story.js +51 -16
- package/src/components/text-transform-control/README.md +3 -4
- package/src/components/text-transform-control/stories/index.story.js +53 -16
- package/src/components/use-block-drop-zone/index.js +8 -1
- package/src/components/warning/stories/index.story.js +86 -0
- package/src/hooks/background.js +6 -0
- package/src/hooks/block-bindings.js +17 -18
- package/src/hooks/border.js +9 -3
- package/src/hooks/color.js +1 -1
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/font-family.js +1 -1
- package/src/hooks/gap.js +2 -2
- package/src/hooks/index.js +0 -1
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +13 -7
- package/src/hooks/supports.js +7 -7
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/typography.js +6 -6
- package/src/hooks/use-zoom-out.js +10 -2
- package/src/hooks/utils.js +1 -1
- package/src/store/private-actions.js +1 -0
- package/src/store/private-selectors.js +15 -5
- package/src/store/reducer.js +112 -19
- package/src/store/selectors.js +6 -8
- package/src/store/test/private-selectors.js +53 -9
- package/src/store/test/reducer.js +172 -166
- package/src/store/test/selectors.js +23 -0
- package/src/utils/block-bindings.js +95 -0
- package/tsconfig.json +2 -5
- package/build/hooks/use-bindings-attributes.js +0 -262
- package/build/hooks/use-bindings-attributes.js.map +0 -1
- package/build-module/hooks/use-bindings-attributes.js +0 -253
- package/build-module/hooks/use-bindings-attributes.js.map +0 -1
- package/src/hooks/use-bindings-attributes.js +0 -322
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
5
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { ExperimentalBlockEditorProvider } from '../../provider';
|
|
11
|
+
import BlockTitle from '../';
|
|
12
|
+
|
|
13
|
+
// Register core blocks for the story environment
|
|
14
|
+
registerCoreBlocks();
|
|
15
|
+
|
|
16
|
+
// Sample blocks for testing
|
|
17
|
+
const blocks = [ createBlock( 'core/paragraph' ) ];
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
title: 'BlockEditor/BlockTitle',
|
|
21
|
+
component: BlockTitle,
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
canvas: { sourceState: 'shown' },
|
|
25
|
+
description: {
|
|
26
|
+
component:
|
|
27
|
+
"Renders the block's configured title as a string, or empty if the title cannot be determined.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
decorators: [
|
|
32
|
+
( Story ) => (
|
|
33
|
+
<ExperimentalBlockEditorProvider value={ blocks }>
|
|
34
|
+
<Story />
|
|
35
|
+
</ExperimentalBlockEditorProvider>
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
argTypes: {
|
|
39
|
+
clientId: {
|
|
40
|
+
control: { type: null },
|
|
41
|
+
description: 'Client ID of block.',
|
|
42
|
+
table: {
|
|
43
|
+
type: {
|
|
44
|
+
summary: 'string',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
maximumLength: {
|
|
49
|
+
control: { type: 'number' },
|
|
50
|
+
description:
|
|
51
|
+
'The maximum length that the block title string may be before truncated.',
|
|
52
|
+
table: {
|
|
53
|
+
type: {
|
|
54
|
+
summary: 'number',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
context: {
|
|
59
|
+
control: { type: 'text' },
|
|
60
|
+
description: 'The context to pass to `getBlockLabel`.',
|
|
61
|
+
table: {
|
|
62
|
+
type: {
|
|
63
|
+
summary: 'string',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default meta;
|
|
71
|
+
|
|
72
|
+
export const Default = {
|
|
73
|
+
args: {
|
|
74
|
+
clientId: blocks[ 0 ].clientId,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -20,6 +20,8 @@ function ZoomOutModeInserters() {
|
|
|
20
20
|
setInserterIsOpened,
|
|
21
21
|
sectionRootClientId,
|
|
22
22
|
selectedBlockClientId,
|
|
23
|
+
blockInsertionPoint,
|
|
24
|
+
insertionPointVisible,
|
|
23
25
|
} = useSelect( ( select ) => {
|
|
24
26
|
const {
|
|
25
27
|
getSettings,
|
|
@@ -27,6 +29,8 @@ function ZoomOutModeInserters() {
|
|
|
27
29
|
getSelectionStart,
|
|
28
30
|
getSelectedBlockClientId,
|
|
29
31
|
getSectionRootClientId,
|
|
32
|
+
getBlockInsertionPoint,
|
|
33
|
+
isBlockInsertionPointVisible,
|
|
30
34
|
} = unlock( select( blockEditorStore ) );
|
|
31
35
|
|
|
32
36
|
const root = getSectionRootClientId();
|
|
@@ -38,6 +42,8 @@ function ZoomOutModeInserters() {
|
|
|
38
42
|
setInserterIsOpened:
|
|
39
43
|
getSettings().__experimentalSetIsInserterOpened,
|
|
40
44
|
selectedBlockClientId: getSelectedBlockClientId(),
|
|
45
|
+
blockInsertionPoint: getBlockInsertionPoint(),
|
|
46
|
+
insertionPointVisible: isBlockInsertionPointVisible(),
|
|
41
47
|
};
|
|
42
48
|
}, [] );
|
|
43
49
|
|
|
@@ -62,7 +68,19 @@ function ZoomOutModeInserters() {
|
|
|
62
68
|
const index = blockOrder.findIndex(
|
|
63
69
|
( clientId ) => selectedBlockClientId === clientId
|
|
64
70
|
);
|
|
65
|
-
|
|
71
|
+
|
|
72
|
+
const insertionIndex = index + 1;
|
|
73
|
+
|
|
74
|
+
const nextClientId = blockOrder[ insertionIndex ];
|
|
75
|
+
|
|
76
|
+
// If the block insertion point is visible, and the insertion
|
|
77
|
+
// Indices match then we don't need to render the inserter.
|
|
78
|
+
if (
|
|
79
|
+
insertionPointVisible &&
|
|
80
|
+
blockInsertionPoint?.index === insertionIndex
|
|
81
|
+
) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
66
84
|
|
|
67
85
|
return (
|
|
68
86
|
<BlockPopoverInbetween
|
|
@@ -73,11 +91,11 @@ function ZoomOutModeInserters() {
|
|
|
73
91
|
onClick={ () => {
|
|
74
92
|
setInserterIsOpened( {
|
|
75
93
|
rootClientId: sectionRootClientId,
|
|
76
|
-
insertionIndex
|
|
94
|
+
insertionIndex,
|
|
77
95
|
tab: 'patterns',
|
|
78
96
|
category: 'all',
|
|
79
97
|
} );
|
|
80
|
-
showInsertionPoint( sectionRootClientId,
|
|
98
|
+
showInsertionPoint( sectionRootClientId, insertionIndex, {
|
|
81
99
|
operation: 'insert',
|
|
82
100
|
} );
|
|
83
101
|
} }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# BorderRadiusControl
|
|
2
|
+
|
|
3
|
+
`BorderRadiusControl` is a React component that provides a user interface for managing border radius values. It allows users to control the border radius of each corner independently or link them together for uniform values.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';
|
|
12
|
+
import { useState } from '@wordpress/element';
|
|
13
|
+
|
|
14
|
+
const MyBorderRadiusControl = () => {
|
|
15
|
+
const [values, setValues] = useState({
|
|
16
|
+
topLeft: '10px',
|
|
17
|
+
topRight: '10px',
|
|
18
|
+
bottomLeft: '10px',
|
|
19
|
+
bottomRight: '10px',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<BorderRadiusControl
|
|
24
|
+
values={values}
|
|
25
|
+
onChange={setValues}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Props
|
|
32
|
+
|
|
33
|
+
### values
|
|
34
|
+
|
|
35
|
+
An object containing the border radius values for each corner.
|
|
36
|
+
|
|
37
|
+
- **Type:** `Object`
|
|
38
|
+
- **Required:** No
|
|
39
|
+
- **Default:** `undefined`
|
|
40
|
+
|
|
41
|
+
The values object has the following schema:
|
|
42
|
+
|
|
43
|
+
| Property | Description | Type |
|
|
44
|
+
| ----------- | ------------------------------------ | ------ |
|
|
45
|
+
| topLeft | Border radius for top left corner | string |
|
|
46
|
+
| topRight | Border radius for top right corner | string |
|
|
47
|
+
| bottomLeft | Border radius for bottom left corner | string |
|
|
48
|
+
| bottomRight | Border radius for bottom right corner| string |
|
|
49
|
+
|
|
50
|
+
Each value should be a valid CSS border radius value (e.g., '10px', '1em').
|
|
51
|
+
|
|
52
|
+
### onChange
|
|
53
|
+
|
|
54
|
+
Callback function that is called when any border radius value changes.
|
|
55
|
+
|
|
56
|
+
- **Type:** `Function`
|
|
57
|
+
- **Required:** Yes
|
|
58
|
+
|
|
59
|
+
The function receives the updated values object as its argument.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import BorderRadiusControl from '../';
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'BlockEditor/BorderRadiusControl',
|
|
13
|
+
component: BorderRadiusControl,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
canvas: { sourceState: 'shown' },
|
|
17
|
+
description: {
|
|
18
|
+
component: 'Control to display border radius options.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
values: {
|
|
24
|
+
control: 'object',
|
|
25
|
+
description: 'Border radius values.',
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'object' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
onChange: {
|
|
31
|
+
action: 'onChange',
|
|
32
|
+
control: { type: null },
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'function' },
|
|
35
|
+
},
|
|
36
|
+
description: 'Callback to handle onChange.',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
|
|
43
|
+
export const Default = {
|
|
44
|
+
render: function Template( { onChange, ...args } ) {
|
|
45
|
+
const [ values, setValues ] = useState( args.values );
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<BorderRadiusControl
|
|
49
|
+
{ ...args }
|
|
50
|
+
values={ values }
|
|
51
|
+
onChange={ ( ...changeArgs ) => {
|
|
52
|
+
setValues( ...changeArgs );
|
|
53
|
+
onChange( ...changeArgs );
|
|
54
|
+
} }
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Button } from '@wordpress/components';
|
|
10
|
-
import { forwardRef
|
|
10
|
+
import { forwardRef } from '@wordpress/element';
|
|
11
11
|
import { _x, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { Icon, plus } from '@wordpress/icons';
|
|
13
13
|
import deprecated from '@wordpress/deprecated';
|
|
@@ -16,15 +16,11 @@ import deprecated from '@wordpress/deprecated';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import Inserter from '../inserter';
|
|
19
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
20
19
|
|
|
21
20
|
function ButtonBlockAppender(
|
|
22
21
|
{ rootClientId, className, onFocus, tabIndex, onSelect },
|
|
23
22
|
ref
|
|
24
23
|
) {
|
|
25
|
-
const inserterButtonRef = useRef();
|
|
26
|
-
|
|
27
|
-
const mergedInserterButtonRef = useMergeRefs( [ inserterButtonRef, ref ] );
|
|
28
24
|
return (
|
|
29
25
|
<Inserter
|
|
30
26
|
position="bottom center"
|
|
@@ -34,7 +30,6 @@ function ButtonBlockAppender(
|
|
|
34
30
|
if ( onSelect && typeof onSelect === 'function' ) {
|
|
35
31
|
onSelect( ...args );
|
|
36
32
|
}
|
|
37
|
-
inserterButtonRef.current?.focus();
|
|
38
33
|
} }
|
|
39
34
|
renderToggle={ ( {
|
|
40
35
|
onToggle,
|
|
@@ -61,7 +56,7 @@ function ButtonBlockAppender(
|
|
|
61
56
|
return (
|
|
62
57
|
<Button
|
|
63
58
|
__next40pxDefaultSize
|
|
64
|
-
ref={
|
|
59
|
+
ref={ ref }
|
|
65
60
|
onFocus={ onFocus }
|
|
66
61
|
tabIndex={ tabIndex }
|
|
67
62
|
className={ clsx(
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
|
+
__experimentalUseCustomUnits as useCustomUnits,
|
|
12
13
|
Flex,
|
|
13
14
|
FlexItem,
|
|
14
15
|
} from '@wordpress/components';
|
|
@@ -21,6 +22,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
21
22
|
*/
|
|
22
23
|
import { useGetNumberOfBlocksBeforeCell } from '../grid/use-get-number-of-blocks-before-cell';
|
|
23
24
|
import { store as blockEditorStore } from '../../store';
|
|
25
|
+
import { useSettings } from '../use-settings';
|
|
24
26
|
|
|
25
27
|
function helpText( selfStretch, parentLayout ) {
|
|
26
28
|
const { orientation = 'horizontal' } = parentLayout;
|
|
@@ -98,6 +100,17 @@ function FlexControls( {
|
|
|
98
100
|
const hasFlexValue = () => !! selfStretch;
|
|
99
101
|
const flexResetLabel =
|
|
100
102
|
orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );
|
|
103
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
104
|
+
const units = useCustomUnits( {
|
|
105
|
+
availableUnits: availableUnits || [
|
|
106
|
+
'%',
|
|
107
|
+
'px',
|
|
108
|
+
'em',
|
|
109
|
+
'rem',
|
|
110
|
+
'vh',
|
|
111
|
+
'vw',
|
|
112
|
+
],
|
|
113
|
+
} );
|
|
101
114
|
const resetFlex = () => {
|
|
102
115
|
onChange( {
|
|
103
116
|
selfStretch: undefined,
|
|
@@ -167,6 +180,7 @@ function FlexControls( {
|
|
|
167
180
|
{ selfStretch === 'fixed' && (
|
|
168
181
|
<UnitControl
|
|
169
182
|
size="__unstable-large"
|
|
183
|
+
units={ units }
|
|
170
184
|
onChange={ ( value ) => {
|
|
171
185
|
onChange( {
|
|
172
186
|
selfStretch,
|
|
@@ -15,6 +15,13 @@ import {
|
|
|
15
15
|
__experimentalHStack as HStack,
|
|
16
16
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
17
17
|
} from '@wordpress/components';
|
|
18
|
+
import { useRef } from '@wordpress/element';
|
|
19
|
+
import { __ } from '@wordpress/i18n';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import { reset as resetIcon } from '@wordpress/icons';
|
|
18
25
|
|
|
19
26
|
/**
|
|
20
27
|
* Internal dependencies
|
|
@@ -76,7 +83,15 @@ const LabeledColorIndicator = ( { colorValue, label } ) => (
|
|
|
76
83
|
const renderToggle =
|
|
77
84
|
( settings ) =>
|
|
78
85
|
( { onToggle, isOpen } ) => {
|
|
79
|
-
const {
|
|
86
|
+
const {
|
|
87
|
+
clearable,
|
|
88
|
+
colorValue,
|
|
89
|
+
gradientValue,
|
|
90
|
+
onColorChange,
|
|
91
|
+
onGradientChange,
|
|
92
|
+
label,
|
|
93
|
+
} = settings;
|
|
94
|
+
const colorButtonRef = useRef( undefined );
|
|
80
95
|
|
|
81
96
|
const toggleProps = {
|
|
82
97
|
onClick: onToggle,
|
|
@@ -85,15 +100,45 @@ const renderToggle =
|
|
|
85
100
|
{ 'is-open': isOpen }
|
|
86
101
|
),
|
|
87
102
|
'aria-expanded': isOpen,
|
|
103
|
+
ref: colorButtonRef,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const clearValue = () => {
|
|
107
|
+
if ( colorValue ) {
|
|
108
|
+
onColorChange();
|
|
109
|
+
} else if ( gradientValue ) {
|
|
110
|
+
onGradientChange();
|
|
111
|
+
}
|
|
88
112
|
};
|
|
89
113
|
|
|
114
|
+
const value = colorValue ?? gradientValue;
|
|
115
|
+
|
|
90
116
|
return (
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
117
|
+
<>
|
|
118
|
+
<Button __next40pxDefaultSize { ...toggleProps }>
|
|
119
|
+
<LabeledColorIndicator
|
|
120
|
+
colorValue={ value }
|
|
121
|
+
label={ label }
|
|
122
|
+
/>
|
|
123
|
+
</Button>
|
|
124
|
+
{ clearable && value && (
|
|
125
|
+
<Button
|
|
126
|
+
__next40pxDefaultSize
|
|
127
|
+
label={ __( 'Reset' ) }
|
|
128
|
+
className="block-editor-panel-color-gradient-settings__reset"
|
|
129
|
+
size="small"
|
|
130
|
+
icon={ resetIcon }
|
|
131
|
+
onClick={ () => {
|
|
132
|
+
clearValue();
|
|
133
|
+
if ( isOpen ) {
|
|
134
|
+
onToggle();
|
|
135
|
+
}
|
|
136
|
+
// Return focus to parent button
|
|
137
|
+
colorButtonRef.current?.focus();
|
|
138
|
+
} }
|
|
139
|
+
/>
|
|
140
|
+
) }
|
|
141
|
+
</>
|
|
97
142
|
);
|
|
98
143
|
};
|
|
99
144
|
|
|
@@ -143,8 +188,12 @@ export default function ColorGradientSettingsDropdown( {
|
|
|
143
188
|
...setting,
|
|
144
189
|
};
|
|
145
190
|
const toggleSettings = {
|
|
146
|
-
|
|
191
|
+
clearable: setting.clearable,
|
|
147
192
|
label: setting.label,
|
|
193
|
+
colorValue: setting.colorValue,
|
|
194
|
+
gradientValue: setting.gradientValue,
|
|
195
|
+
onColorChange: setting.onColorChange,
|
|
196
|
+
onGradientChange: setting.onGradientChange,
|
|
148
197
|
};
|
|
149
198
|
|
|
150
199
|
return (
|
|
@@ -13,7 +13,7 @@ import { speak } from '@wordpress/a11y';
|
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { useEffect } from '@wordpress/element';
|
|
15
15
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
16
|
-
import { Icon,
|
|
16
|
+
import { Icon, cautionFilled } from '@wordpress/icons';
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
@@ -52,7 +52,7 @@ function ContrastCheckerMessage( {
|
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
54
|
<View style={ styles[ 'block-editor-contrast-checker' ] }>
|
|
55
|
-
<Icon style={ iconStyle } icon={
|
|
55
|
+
<Icon style={ iconStyle } icon={ cautionFilled } />
|
|
56
56
|
<Text style={ msgStyle }>{ msg }</Text>
|
|
57
57
|
</View>
|
|
58
58
|
);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import ContrastChecker from '../';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'BlockEditor/ContrastChecker',
|
|
8
|
+
component: ContrastChecker,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
canvas: { sourceState: 'shown' },
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'Determines if contrast for text styles is sufficient (WCAG 2.0 AA) when used with a given background color.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
backgroundColor: {
|
|
20
|
+
control: 'color',
|
|
21
|
+
description:
|
|
22
|
+
'The background color to check the contrast of text against.',
|
|
23
|
+
table: {
|
|
24
|
+
type: {
|
|
25
|
+
summary: 'string',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
fallbackBackgroundColor: {
|
|
30
|
+
control: 'color',
|
|
31
|
+
description:
|
|
32
|
+
'A fallback background color value, in case `backgroundColor` is not available.',
|
|
33
|
+
table: {
|
|
34
|
+
type: {
|
|
35
|
+
summary: 'string',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
textColor: {
|
|
40
|
+
control: 'color',
|
|
41
|
+
description:
|
|
42
|
+
'The text color to check the contrast of the background against.',
|
|
43
|
+
table: {
|
|
44
|
+
type: {
|
|
45
|
+
summary: 'string',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
fallbackTextColor: {
|
|
50
|
+
control: 'color',
|
|
51
|
+
description:
|
|
52
|
+
'A fallback text color value, in case `textColor` is not available.',
|
|
53
|
+
table: {
|
|
54
|
+
type: {
|
|
55
|
+
summary: 'string',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
fontSize: {
|
|
60
|
+
control: 'number',
|
|
61
|
+
description:
|
|
62
|
+
'The font-size (as a `px` value) of the text to check the contrast against.',
|
|
63
|
+
table: {
|
|
64
|
+
type: {
|
|
65
|
+
summary: 'number',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
isLargeText: {
|
|
70
|
+
control: 'boolean',
|
|
71
|
+
description:
|
|
72
|
+
'Whether the text is large (approximately `24px` or higher).',
|
|
73
|
+
table: {
|
|
74
|
+
type: {
|
|
75
|
+
summary: 'boolean',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
linkColor: {
|
|
80
|
+
control: 'color',
|
|
81
|
+
description: 'The link color to check the contrast against.',
|
|
82
|
+
table: {
|
|
83
|
+
type: {
|
|
84
|
+
summary: 'string',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
fallbackLinkColor: {
|
|
89
|
+
control: 'color',
|
|
90
|
+
description: 'Fallback link color if linkColor is not available.',
|
|
91
|
+
table: {
|
|
92
|
+
type: {
|
|
93
|
+
summary: 'string',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
enableAlphaChecker: {
|
|
98
|
+
control: 'boolean',
|
|
99
|
+
description: 'Whether to enable checking for transparent colors.',
|
|
100
|
+
table: {
|
|
101
|
+
type: {
|
|
102
|
+
summary: 'boolean',
|
|
103
|
+
},
|
|
104
|
+
defaultValue: { summary: false },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default meta;
|
|
111
|
+
|
|
112
|
+
export const Default = {
|
|
113
|
+
args: {
|
|
114
|
+
backgroundColor: '#ffffff',
|
|
115
|
+
textColor: '#ffffff',
|
|
116
|
+
},
|
|
117
|
+
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
# DateFormatPicker
|
|
2
2
|
|
|
3
|
-
The `DateFormatPicker` component renders controls that let the user choose a
|
|
4
|
-
_date format_. That is, how they want their dates to be formatted.
|
|
3
|
+
The `DateFormatPicker` component renders controls that let the user choose a _date format_. That is, how they want their dates to be formatted.
|
|
5
4
|
|
|
6
|
-
A user can pick _Default_ to use the default date format (usually set at the
|
|
7
|
-
site level).
|
|
5
|
+
A user can pick _Default_ to use the default date format (usually set at the site level).
|
|
8
6
|
|
|
9
|
-
Otherwise, a user may choose a suggested date format or type in their own date
|
|
10
|
-
format by selecting _Custom_.
|
|
7
|
+
Otherwise, a user may choose a suggested date format or type in their own date format by selecting _Custom_.
|
|
11
8
|
|
|
12
|
-
All date format strings should be in the format accepted by by the [`dateI18n`
|
|
13
|
-
function in
|
|
14
|
-
`@wordpress/date`](https://github.com/WordPress/gutenberg/tree/trunk/packages/date#datei18n).
|
|
9
|
+
All date format strings should be in the format accepted by by the [`dateI18n` function in `@wordpress/date`](https://github.com/WordPress/gutenberg/tree/trunk/packages/date#datei18n).
|
|
15
10
|
|
|
16
11
|
## Usage
|
|
17
12
|
|
|
@@ -43,16 +38,14 @@ The current date format selected by the user. If `null`, _Default_ is selected.
|
|
|
43
38
|
|
|
44
39
|
### `defaultFormat`
|
|
45
40
|
|
|
46
|
-
The default format string. Used to show to the user what the date will look like
|
|
47
|
-
if _Default_ is selected.
|
|
41
|
+
The default format string. Used to show to the user what the date will look like if _Default_ is selected.
|
|
48
42
|
|
|
49
43
|
- Type: `string`
|
|
50
44
|
- Required: Yes
|
|
51
45
|
|
|
52
46
|
### `onChange`
|
|
53
47
|
|
|
54
|
-
Called when the user makes a selection, or when the user types in a date format.
|
|
55
|
-
`null` indicates that _Default_ is selected.
|
|
48
|
+
Called when the user makes a selection, or when the user types in a date format. `null` indicates that _Default_ is selected.
|
|
56
49
|
|
|
57
50
|
- Type: `( format: string|null ) => void`
|
|
58
51
|
- Required: Yes
|
|
@@ -29,21 +29,10 @@ if ( exampleDate.getMonth() === 4 ) {
|
|
|
29
29
|
*
|
|
30
30
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md
|
|
31
31
|
*
|
|
32
|
-
* @param {Object}
|
|
33
|
-
* @param {string|null}
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* _Default_ is
|
|
37
|
-
* selected.
|
|
38
|
-
* @param {string} props.defaultFormat The date format that
|
|
39
|
-
* will be used if the
|
|
40
|
-
* user selects
|
|
41
|
-
* 'Default'.
|
|
42
|
-
* @param {( format: string|null ) => void} props.onChange Called when a
|
|
43
|
-
* selection is
|
|
44
|
-
* made. If `null`,
|
|
45
|
-
* _Default_ is
|
|
46
|
-
* selected.
|
|
32
|
+
* @param {Object} props
|
|
33
|
+
* @param {string|null} props.format The selected date format. If `null`, _Default_ is selected.
|
|
34
|
+
* @param {string} props.defaultFormat The date format that will be used if the user selects 'Default'.
|
|
35
|
+
* @param {Function} props.onChange Called when a selection is made. If `null`, _Default_ is selected.
|
|
47
36
|
*/
|
|
48
37
|
export default function DateFormatPicker( {
|
|
49
38
|
format,
|
|
@@ -51,7 +40,11 @@ export default function DateFormatPicker( {
|
|
|
51
40
|
onChange,
|
|
52
41
|
} ) {
|
|
53
42
|
return (
|
|
54
|
-
<
|
|
43
|
+
<VStack
|
|
44
|
+
as="fieldset"
|
|
45
|
+
spacing={ 4 }
|
|
46
|
+
className="block-editor-date-format-picker"
|
|
47
|
+
>
|
|
55
48
|
<VisuallyHidden as="legend">{ __( 'Date format' ) }</VisuallyHidden>
|
|
56
49
|
<ToggleControl
|
|
57
50
|
__nextHasNoMarginBottom
|
|
@@ -68,7 +61,7 @@ export default function DateFormatPicker( {
|
|
|
68
61
|
{ format && (
|
|
69
62
|
<NonDefaultControls format={ format } onChange={ onChange } />
|
|
70
63
|
) }
|
|
71
|
-
</
|
|
64
|
+
</VStack>
|
|
72
65
|
);
|
|
73
66
|
}
|
|
74
67
|
|