@wordpress/block-editor 7.0.4 → 8.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 +11 -0
- package/README.md +31 -0
- package/build/components/alignment-control/ui.js +1 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +4 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +22 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +8 -47
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +81 -6
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -2
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +27 -15
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +20 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +5 -4
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inspector-controls/groups.js +3 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +88 -35
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +19 -6
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +12 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +49 -23
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +92 -73
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +39 -16
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +1 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +8 -58
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +1 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +2 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/url-input/index.js +11 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +2 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/duotone.js +16 -5
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +37 -16
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +8 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +108 -8
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +120 -28
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +303 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +23 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -35
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +4 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +24 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +12 -53
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +82 -6
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/duotone-control/index.js +5 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +23 -15
- package/build-module/components/font-appearance-control/index.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/index.js +3 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +3 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +88 -36
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +19 -7
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +11 -3
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +49 -24
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +92 -73
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +41 -18
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +1 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +8 -58
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +1 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +2 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +2 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -5
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +33 -16
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- 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/letter-spacing.js +40 -7
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +124 -32
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +266 -241
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +23 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +42 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +160 -57
- package/build-style/style.css +160 -57
- package/package.json +13 -14
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +0 -2
- package/src/components/alignment-control/ui.js +1 -4
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-inspector/index.js +5 -0
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +19 -7
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +88 -63
- package/src/components/colors-gradients/control.js +19 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +76 -6
- package/src/components/colors-gradients/style.scss +3 -14
- package/src/components/colors-gradients/test/control.js +0 -16
- package/src/components/duotone-control/index.js +6 -0
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/font-appearance-control/index.js +22 -14
- package/src/components/iframe/index.js +1 -1
- package/src/components/index.js +3 -4
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/index.js +4 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -80
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/style.scss +64 -1
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inspector-controls/groups.js +4 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +7 -0
- package/src/components/link-control/index.js +99 -34
- package/src/components/link-control/link-preview.js +21 -9
- package/src/components/link-control/search-input.js +9 -3
- package/src/components/link-control/style.scss +32 -16
- package/src/components/link-control/test/index.js +179 -4
- package/src/components/list-view/block.js +67 -23
- package/src/components/list-view/branch.js +113 -91
- package/src/components/list-view/index.js +58 -19
- package/src/components/list-view/leaf.js +1 -1
- package/src/components/list-view/style.scss +14 -3
- package/src/components/list-view/use-list-view-client-ids.js +7 -66
- package/src/components/rich-text/embed-handler-picker.native.js +1 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +3 -0
- package/src/components/url-input/index.js +14 -4
- package/src/components/use-setting/index.js +49 -11
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +1 -0
- package/src/hooks/duotone.js +21 -7
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +29 -13
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/index.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +3 -1
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +137 -41
- package/src/store/actions.js +223 -391
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +36 -18
- package/src/store/selectors.js +52 -47
- package/src/store/test/actions.js +395 -694
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +127 -167
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
|
@@ -29,11 +29,6 @@ export function TextTransformEdit( props ) {
|
|
|
29
29
|
attributes: { style },
|
|
30
30
|
setAttributes,
|
|
31
31
|
} = props;
|
|
32
|
-
const isDisabled = useIsTextTransformDisabled( props );
|
|
33
|
-
|
|
34
|
-
if ( isDisabled ) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
32
|
|
|
38
33
|
function onChange( newTransform ) {
|
|
39
34
|
setAttributes( {
|
|
@@ -67,6 +62,39 @@ export function useIsTextTransformDisabled( { name: blockName } = {} ) {
|
|
|
67
62
|
blockName,
|
|
68
63
|
TEXT_TRANSFORM_SUPPORT_KEY
|
|
69
64
|
);
|
|
70
|
-
const hasTextTransforms = useSetting( 'typography.
|
|
65
|
+
const hasTextTransforms = useSetting( 'typography.textTransform' );
|
|
71
66
|
return notSupported || ! hasTextTransforms;
|
|
72
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Checks if there is a current value set for the text transform block support.
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} props Block props.
|
|
73
|
+
* @return {boolean} Whether or not the block has a text transform set.
|
|
74
|
+
*/
|
|
75
|
+
export function hasTextTransformValue( props ) {
|
|
76
|
+
return !! props.attributes.style?.typography?.textTransform;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Resets the text transform block support attribute. This can be used when
|
|
81
|
+
* disabling the text transform support controls for a block via a progressive
|
|
82
|
+
* discovery panel.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} props Block props.
|
|
85
|
+
* @param {Object} props.attributes Block's attributes.
|
|
86
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
87
|
+
*/
|
|
88
|
+
export function resetTextTransform( { attributes = {}, setAttributes } ) {
|
|
89
|
+
const { style } = attributes;
|
|
90
|
+
|
|
91
|
+
setAttributes( {
|
|
92
|
+
style: cleanEmptyObject( {
|
|
93
|
+
...style,
|
|
94
|
+
typography: {
|
|
95
|
+
...style?.typography,
|
|
96
|
+
textTransform: undefined,
|
|
97
|
+
},
|
|
98
|
+
} ),
|
|
99
|
+
} );
|
|
100
|
+
}
|
package/src/hooks/typography.js
CHANGED
|
@@ -1,51 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
5
|
-
|
|
6
|
-
* External dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { PanelBody } from '@wordpress/components';
|
|
4
|
+
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
5
|
+
import { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
9
6
|
import { __ } from '@wordpress/i18n';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* Internal dependencies
|
|
13
10
|
*/
|
|
14
11
|
import InspectorControls from '../components/inspector-controls';
|
|
15
|
-
import
|
|
12
|
+
import { getFontAppearanceLabel } from '../components/font-appearance-control';
|
|
16
13
|
|
|
17
14
|
import {
|
|
18
15
|
LINE_HEIGHT_SUPPORT_KEY,
|
|
19
16
|
LineHeightEdit,
|
|
17
|
+
hasLineHeightValue,
|
|
18
|
+
resetLineHeight,
|
|
20
19
|
useIsLineHeightDisabled,
|
|
21
20
|
} from './line-height';
|
|
22
21
|
import {
|
|
23
22
|
FONT_STYLE_SUPPORT_KEY,
|
|
24
23
|
FONT_WEIGHT_SUPPORT_KEY,
|
|
25
24
|
FontAppearanceEdit,
|
|
25
|
+
hasFontAppearanceValue,
|
|
26
|
+
resetFontAppearance,
|
|
26
27
|
useIsFontAppearanceDisabled,
|
|
28
|
+
useIsFontStyleDisabled,
|
|
29
|
+
useIsFontWeightDisabled,
|
|
27
30
|
} from './font-appearance';
|
|
28
31
|
import {
|
|
29
32
|
FONT_FAMILY_SUPPORT_KEY,
|
|
30
33
|
FontFamilyEdit,
|
|
34
|
+
hasFontFamilyValue,
|
|
35
|
+
resetFontFamily,
|
|
31
36
|
useIsFontFamilyDisabled,
|
|
32
37
|
} from './font-family';
|
|
33
38
|
import {
|
|
34
39
|
FONT_SIZE_SUPPORT_KEY,
|
|
35
40
|
FontSizeEdit,
|
|
41
|
+
hasFontSizeValue,
|
|
42
|
+
resetFontSize,
|
|
36
43
|
useIsFontSizeDisabled,
|
|
37
44
|
} from './font-size';
|
|
38
45
|
import {
|
|
39
46
|
TEXT_DECORATION_SUPPORT_KEY,
|
|
47
|
+
TextDecorationEdit,
|
|
48
|
+
hasTextDecorationValue,
|
|
49
|
+
resetTextDecoration,
|
|
40
50
|
useIsTextDecorationDisabled,
|
|
41
51
|
} from './text-decoration';
|
|
42
52
|
import {
|
|
43
53
|
TEXT_TRANSFORM_SUPPORT_KEY,
|
|
54
|
+
TextTransformEdit,
|
|
55
|
+
hasTextTransformValue,
|
|
56
|
+
resetTextTransform,
|
|
44
57
|
useIsTextTransformDisabled,
|
|
45
58
|
} from './text-transform';
|
|
46
59
|
import {
|
|
47
60
|
LETTER_SPACING_SUPPORT_KEY,
|
|
48
61
|
LetterSpacingEdit,
|
|
62
|
+
hasLetterSpacingValue,
|
|
63
|
+
resetLetterSpacing,
|
|
49
64
|
useIsLetterSpacingDisabled,
|
|
50
65
|
} from './letter-spacing';
|
|
51
66
|
|
|
@@ -62,21 +77,156 @@ export const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
|
62
77
|
];
|
|
63
78
|
|
|
64
79
|
export function TypographyPanel( props ) {
|
|
80
|
+
const { clientId } = props;
|
|
81
|
+
const isFontFamilyDisabled = useIsFontFamilyDisabled( props );
|
|
82
|
+
const isFontSizeDisabled = useIsFontSizeDisabled( props );
|
|
83
|
+
const isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );
|
|
84
|
+
const isLineHeightDisabled = useIsLineHeightDisabled( props );
|
|
85
|
+
const isTextDecorationDisabled = useIsTextDecorationDisabled( props );
|
|
86
|
+
const isTextTransformDisabled = useIsTextTransformDisabled( props );
|
|
87
|
+
const isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );
|
|
88
|
+
|
|
89
|
+
const hasFontStyles = ! useIsFontStyleDisabled( props );
|
|
90
|
+
const hasFontWeights = ! useIsFontWeightDisabled( props );
|
|
91
|
+
|
|
65
92
|
const isDisabled = useIsTypographyDisabled( props );
|
|
66
93
|
const isSupported = hasTypographySupport( props.name );
|
|
67
94
|
|
|
68
95
|
if ( isDisabled || ! isSupported ) return null;
|
|
69
96
|
|
|
97
|
+
const defaultControls = getBlockSupport( props.name, [
|
|
98
|
+
TYPOGRAPHY_SUPPORT_KEY,
|
|
99
|
+
'__experimentalDefaultControls',
|
|
100
|
+
] );
|
|
101
|
+
|
|
102
|
+
const createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {
|
|
103
|
+
...newAttributes,
|
|
104
|
+
style: {
|
|
105
|
+
...newAttributes.style,
|
|
106
|
+
typography: {
|
|
107
|
+
...newAttributes.style?.typography,
|
|
108
|
+
[ attribute ]: undefined,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
} );
|
|
112
|
+
|
|
70
113
|
return (
|
|
71
|
-
<InspectorControls>
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
114
|
+
<InspectorControls __experimentalGroup="typography">
|
|
115
|
+
{ ! isFontFamilyDisabled && (
|
|
116
|
+
<ToolsPanelItem
|
|
117
|
+
hasValue={ () => hasFontFamilyValue( props ) }
|
|
118
|
+
label={ __( 'Font family' ) }
|
|
119
|
+
onDeselect={ () => resetFontFamily( props ) }
|
|
120
|
+
isShownByDefault={ defaultControls?.fontFamily }
|
|
121
|
+
resetAllFilter={ ( newAttributes ) => ( {
|
|
122
|
+
...newAttributes,
|
|
123
|
+
fontFamily: undefined,
|
|
124
|
+
} ) }
|
|
125
|
+
panelId={ clientId }
|
|
126
|
+
>
|
|
127
|
+
<FontFamilyEdit { ...props } />
|
|
128
|
+
</ToolsPanelItem>
|
|
129
|
+
) }
|
|
130
|
+
{ ! isFontSizeDisabled && (
|
|
131
|
+
<ToolsPanelItem
|
|
132
|
+
hasValue={ () => hasFontSizeValue( props ) }
|
|
133
|
+
label={ __( 'Font size' ) }
|
|
134
|
+
onDeselect={ () => resetFontSize( props ) }
|
|
135
|
+
isShownByDefault={ defaultControls?.fontSize }
|
|
136
|
+
resetAllFilter={ ( newAttributes ) => ( {
|
|
137
|
+
...newAttributes,
|
|
138
|
+
fontSize: undefined,
|
|
139
|
+
style: {
|
|
140
|
+
...newAttributes.style,
|
|
141
|
+
typography: {
|
|
142
|
+
...newAttributes.style?.typography,
|
|
143
|
+
fontSize: undefined,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
} ) }
|
|
147
|
+
panelId={ clientId }
|
|
148
|
+
>
|
|
149
|
+
<FontSizeEdit { ...props } />
|
|
150
|
+
</ToolsPanelItem>
|
|
151
|
+
) }
|
|
152
|
+
{ ! isFontAppearanceDisabled && (
|
|
153
|
+
<ToolsPanelItem
|
|
154
|
+
className="single-column"
|
|
155
|
+
hasValue={ () => hasFontAppearanceValue( props ) }
|
|
156
|
+
label={ getFontAppearanceLabel(
|
|
157
|
+
hasFontStyles,
|
|
158
|
+
hasFontWeights
|
|
159
|
+
) }
|
|
160
|
+
onDeselect={ () => resetFontAppearance( props ) }
|
|
161
|
+
isShownByDefault={ defaultControls?.fontAppearance }
|
|
162
|
+
resetAllFilter={ ( newAttributes ) => ( {
|
|
163
|
+
...newAttributes,
|
|
164
|
+
style: {
|
|
165
|
+
...newAttributes.style,
|
|
166
|
+
typography: {
|
|
167
|
+
...newAttributes.style?.typography,
|
|
168
|
+
fontStyle: undefined,
|
|
169
|
+
fontWeight: undefined,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
} ) }
|
|
173
|
+
panelId={ clientId }
|
|
174
|
+
>
|
|
175
|
+
<FontAppearanceEdit { ...props } />
|
|
176
|
+
</ToolsPanelItem>
|
|
177
|
+
) }
|
|
178
|
+
{ ! isLineHeightDisabled && (
|
|
179
|
+
<ToolsPanelItem
|
|
180
|
+
className="single-column"
|
|
181
|
+
hasValue={ () => hasLineHeightValue( props ) }
|
|
182
|
+
label={ __( 'Line height' ) }
|
|
183
|
+
onDeselect={ () => resetLineHeight( props ) }
|
|
184
|
+
isShownByDefault={ defaultControls?.lineHeight }
|
|
185
|
+
resetAllFilter={ createResetAllFilter( 'lineHeight' ) }
|
|
186
|
+
panelId={ clientId }
|
|
187
|
+
>
|
|
188
|
+
<LineHeightEdit { ...props } />
|
|
189
|
+
</ToolsPanelItem>
|
|
190
|
+
) }
|
|
191
|
+
{ ! isTextDecorationDisabled && (
|
|
192
|
+
<ToolsPanelItem
|
|
193
|
+
className="single-column"
|
|
194
|
+
hasValue={ () => hasTextDecorationValue( props ) }
|
|
195
|
+
label={ __( 'Decoration' ) }
|
|
196
|
+
onDeselect={ () => resetTextDecoration( props ) }
|
|
197
|
+
isShownByDefault={ defaultControls?.textDecoration }
|
|
198
|
+
resetAllFilter={ createResetAllFilter( 'textDecoration' ) }
|
|
199
|
+
panelId={ clientId }
|
|
200
|
+
>
|
|
201
|
+
<TextDecorationEdit { ...props } />
|
|
202
|
+
</ToolsPanelItem>
|
|
203
|
+
) }
|
|
204
|
+
{ ! isTextTransformDisabled && (
|
|
205
|
+
<ToolsPanelItem
|
|
206
|
+
className="single-column"
|
|
207
|
+
hasValue={ () => hasTextTransformValue( props ) }
|
|
208
|
+
label={ __( 'Letter case' ) }
|
|
209
|
+
onDeselect={ () => resetTextTransform( props ) }
|
|
210
|
+
isShownByDefault={ defaultControls?.textTransform }
|
|
211
|
+
resetAllFilter={ createResetAllFilter( 'textTransform' ) }
|
|
212
|
+
panelId={ clientId }
|
|
213
|
+
>
|
|
214
|
+
<TextTransformEdit { ...props } />
|
|
215
|
+
</ToolsPanelItem>
|
|
216
|
+
) }
|
|
217
|
+
{ ! isLetterSpacingDisabled && (
|
|
218
|
+
<ToolsPanelItem
|
|
219
|
+
className="single-column"
|
|
220
|
+
hasValue={ () => hasLetterSpacingValue( props ) }
|
|
221
|
+
label={ __( 'Letter-spacing' ) }
|
|
222
|
+
onDeselect={ () => resetLetterSpacing( props ) }
|
|
223
|
+
isShownByDefault={ defaultControls?.letterSpacing }
|
|
224
|
+
resetAllFilter={ createResetAllFilter( 'letterSpacing' ) }
|
|
225
|
+
panelId={ clientId }
|
|
226
|
+
>
|
|
227
|
+
<LetterSpacingEdit { ...props } />
|
|
228
|
+
</ToolsPanelItem>
|
|
229
|
+
) }
|
|
80
230
|
</InspectorControls>
|
|
81
231
|
);
|
|
82
232
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.typography-block-support-panel {
|
|
2
|
+
.components-font-appearance-control,
|
|
3
|
+
.components-font-size-picker__controls,
|
|
4
|
+
.block-editor-text-decoration-control__buttons,
|
|
5
|
+
.block-editor-text-transform-control__buttons {
|
|
6
|
+
margin-bottom: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.block-editor-line-height-control input {
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.single-column {
|
|
14
|
+
grid-column: span 1;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Keeps an up-to-date copy of the passed value and returns it. If value becomes falsy, it will return the last truthy copy.
|
|
8
|
+
*
|
|
9
|
+
* @param {any} value
|
|
10
|
+
* @return {any} value
|
|
11
|
+
*/
|
|
12
|
+
export function useCachedTruthy( value ) {
|
|
13
|
+
const [ cachedValue, setCachedValue ] = useState( value );
|
|
14
|
+
useEffect( () => {
|
|
15
|
+
if ( value ) {
|
|
16
|
+
setCachedValue( value );
|
|
17
|
+
}
|
|
18
|
+
}, [ value ] );
|
|
19
|
+
return cachedValue;
|
|
20
|
+
}
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export {
|
|
|
9
9
|
useColorProps as __experimentalUseColorProps,
|
|
10
10
|
useCustomSides as __experimentalUseCustomSides,
|
|
11
11
|
getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
|
|
12
|
+
useCachedTruthy,
|
|
12
13
|
} from './hooks';
|
|
13
14
|
export * from './components';
|
|
14
15
|
export * from './utils';
|
package/src/layouts/flex.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
justifyCenter,
|
|
8
8
|
justifyRight,
|
|
9
9
|
justifySpaceBetween,
|
|
10
|
+
arrowRight,
|
|
11
|
+
arrowDown,
|
|
10
12
|
} from '@wordpress/icons';
|
|
11
|
-
import { Button } from '@wordpress/components';
|
|
13
|
+
import { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -17,6 +19,7 @@ import { appendSelectors } from './utils';
|
|
|
17
19
|
import useSetting from '../components/use-setting';
|
|
18
20
|
import { BlockControls, JustifyContentControl } from '../components';
|
|
19
21
|
|
|
22
|
+
// Used with the default, horizontal flex orientation.
|
|
20
23
|
const justifyContentMap = {
|
|
21
24
|
left: 'flex-start',
|
|
22
25
|
right: 'flex-end',
|
|
@@ -24,6 +27,15 @@ const justifyContentMap = {
|
|
|
24
27
|
'space-between': 'space-between',
|
|
25
28
|
};
|
|
26
29
|
|
|
30
|
+
// Used with the vertical (column) flex orientation.
|
|
31
|
+
const alignItemsMap = {
|
|
32
|
+
left: 'flex-start',
|
|
33
|
+
right: 'flex-end',
|
|
34
|
+
center: 'center',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const flexWrapOptions = [ 'wrap', 'nowrap' ];
|
|
38
|
+
|
|
27
39
|
export default {
|
|
28
40
|
name: 'flex',
|
|
29
41
|
label: __( 'Flex' ),
|
|
@@ -31,11 +43,27 @@ export default {
|
|
|
31
43
|
layout = {},
|
|
32
44
|
onChange,
|
|
33
45
|
} ) {
|
|
46
|
+
const { allowOrientation = true } = layout;
|
|
34
47
|
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
<>
|
|
49
|
+
<Flex>
|
|
50
|
+
<FlexItem>
|
|
51
|
+
<FlexLayoutJustifyContentControl
|
|
52
|
+
layout={ layout }
|
|
53
|
+
onChange={ onChange }
|
|
54
|
+
/>
|
|
55
|
+
</FlexItem>
|
|
56
|
+
<FlexItem>
|
|
57
|
+
{ allowOrientation && (
|
|
58
|
+
<OrientationControl
|
|
59
|
+
layout={ layout }
|
|
60
|
+
onChange={ onChange }
|
|
61
|
+
/>
|
|
62
|
+
) }
|
|
63
|
+
</FlexItem>
|
|
64
|
+
</Flex>
|
|
65
|
+
<FlexWrapControl layout={ layout } onChange={ onChange } />
|
|
66
|
+
</>
|
|
39
67
|
);
|
|
40
68
|
},
|
|
41
69
|
toolBarControls: function FlexLayoutToolbarControls( {
|
|
@@ -57,10 +85,30 @@ export default {
|
|
|
57
85
|
);
|
|
58
86
|
},
|
|
59
87
|
save: function FlexLayoutStyle( { selector, layout } ) {
|
|
88
|
+
const { orientation = 'horizontal' } = layout;
|
|
60
89
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
61
90
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
62
91
|
const justifyContent =
|
|
63
|
-
justifyContentMap[ layout.justifyContent ] ||
|
|
92
|
+
justifyContentMap[ layout.justifyContent ] ||
|
|
93
|
+
justifyContentMap.left;
|
|
94
|
+
const flexWrap = flexWrapOptions.includes( layout.flexWrap )
|
|
95
|
+
? layout.flexWrap
|
|
96
|
+
: 'wrap';
|
|
97
|
+
// --justification-setting allows children to inherit the value
|
|
98
|
+
// regardless or row or column direction.
|
|
99
|
+
const rowOrientation = `
|
|
100
|
+
flex-direction: row;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: ${ justifyContent };
|
|
103
|
+
--justification-setting: ${ justifyContent };
|
|
104
|
+
`;
|
|
105
|
+
const alignItems =
|
|
106
|
+
alignItemsMap[ layout.justifyContent ] || alignItemsMap.left;
|
|
107
|
+
const columnOrientation = `
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
align-items: ${ alignItems };
|
|
110
|
+
--justification-setting: ${ alignItems };
|
|
111
|
+
`;
|
|
64
112
|
return (
|
|
65
113
|
<style>{ `
|
|
66
114
|
${ appendSelectors( selector ) } {
|
|
@@ -70,10 +118,8 @@ export default {
|
|
|
70
118
|
? 'var( --wp--style--block-gap, 0.5em )'
|
|
71
119
|
: '0.5em'
|
|
72
120
|
};
|
|
73
|
-
flex-wrap:
|
|
74
|
-
|
|
75
|
-
flex-direction: row;
|
|
76
|
-
justify-content: ${ justifyContent };
|
|
121
|
+
flex-wrap: ${ flexWrap };
|
|
122
|
+
${ orientation === 'horizontal' ? rowOrientation : columnOrientation }
|
|
77
123
|
}
|
|
78
124
|
|
|
79
125
|
${ appendSelectors( selector, '> *' ) } {
|
|
@@ -82,57 +128,35 @@ export default {
|
|
|
82
128
|
` }</style>
|
|
83
129
|
);
|
|
84
130
|
},
|
|
85
|
-
getOrientation() {
|
|
86
|
-
|
|
131
|
+
getOrientation( layout ) {
|
|
132
|
+
const { orientation = 'horizontal' } = layout;
|
|
133
|
+
return orientation;
|
|
87
134
|
},
|
|
88
135
|
getAlignments() {
|
|
89
136
|
return [];
|
|
90
137
|
},
|
|
91
138
|
};
|
|
92
139
|
|
|
93
|
-
const justificationOptions = [
|
|
94
|
-
{
|
|
95
|
-
value: 'left',
|
|
96
|
-
icon: justifyLeft,
|
|
97
|
-
label: __( 'Justify items left' ),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
value: 'center',
|
|
101
|
-
icon: justifyCenter,
|
|
102
|
-
label: __( 'Justify items center' ),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
value: 'right',
|
|
106
|
-
icon: justifyRight,
|
|
107
|
-
label: __( 'Justify items right' ),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
value: 'space-between',
|
|
111
|
-
icon: justifySpaceBetween,
|
|
112
|
-
label: __( 'Space between items' ),
|
|
113
|
-
},
|
|
114
|
-
];
|
|
115
140
|
function FlexLayoutJustifyContentControl( {
|
|
116
141
|
layout,
|
|
117
142
|
onChange,
|
|
118
143
|
isToolbar = false,
|
|
119
144
|
} ) {
|
|
120
|
-
const { justifyContent = 'left' } = layout;
|
|
145
|
+
const { justifyContent = 'left', orientation = 'horizontal' } = layout;
|
|
121
146
|
const onJustificationChange = ( value ) => {
|
|
122
147
|
onChange( {
|
|
123
148
|
...layout,
|
|
124
149
|
justifyContent: value,
|
|
125
150
|
} );
|
|
126
151
|
};
|
|
152
|
+
const allowedControls = [ 'left', 'center', 'right' ];
|
|
153
|
+
if ( orientation === 'horizontal' ) {
|
|
154
|
+
allowedControls.push( 'space-between' );
|
|
155
|
+
}
|
|
127
156
|
if ( isToolbar ) {
|
|
128
157
|
return (
|
|
129
158
|
<JustifyContentControl
|
|
130
|
-
allowedControls={
|
|
131
|
-
'left',
|
|
132
|
-
'center',
|
|
133
|
-
'right',
|
|
134
|
-
'space-between',
|
|
135
|
-
] }
|
|
159
|
+
allowedControls={ allowedControls }
|
|
136
160
|
value={ justifyContent }
|
|
137
161
|
onChange={ onJustificationChange }
|
|
138
162
|
popoverProps={ {
|
|
@@ -143,6 +167,31 @@ function FlexLayoutJustifyContentControl( {
|
|
|
143
167
|
);
|
|
144
168
|
}
|
|
145
169
|
|
|
170
|
+
const justificationOptions = [
|
|
171
|
+
{
|
|
172
|
+
value: 'left',
|
|
173
|
+
icon: justifyLeft,
|
|
174
|
+
label: __( 'Justify items left' ),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
value: 'center',
|
|
178
|
+
icon: justifyCenter,
|
|
179
|
+
label: __( 'Justify items center' ),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
value: 'right',
|
|
183
|
+
icon: justifyRight,
|
|
184
|
+
label: __( 'Justify items right' ),
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
if ( orientation === 'horizontal' ) {
|
|
188
|
+
justificationOptions.push( {
|
|
189
|
+
value: 'space-between',
|
|
190
|
+
icon: justifySpaceBetween,
|
|
191
|
+
label: __( 'Space between items' ),
|
|
192
|
+
} );
|
|
193
|
+
}
|
|
194
|
+
|
|
146
195
|
return (
|
|
147
196
|
<fieldset className="block-editor-hooks__flex-layout-justification-controls">
|
|
148
197
|
<legend>{ __( 'Justification' ) }</legend>
|
|
@@ -162,3 +211,50 @@ function FlexLayoutJustifyContentControl( {
|
|
|
162
211
|
</fieldset>
|
|
163
212
|
);
|
|
164
213
|
}
|
|
214
|
+
|
|
215
|
+
function FlexWrapControl( { layout, onChange } ) {
|
|
216
|
+
const { flexWrap = 'wrap' } = layout;
|
|
217
|
+
return (
|
|
218
|
+
<ToggleControl
|
|
219
|
+
label={ __( 'Allow to wrap to multiple lines' ) }
|
|
220
|
+
onChange={ ( value ) => {
|
|
221
|
+
onChange( {
|
|
222
|
+
...layout,
|
|
223
|
+
flexWrap: value ? 'wrap' : 'nowrap',
|
|
224
|
+
} );
|
|
225
|
+
} }
|
|
226
|
+
checked={ flexWrap === 'wrap' }
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function OrientationControl( { layout, onChange } ) {
|
|
232
|
+
const { orientation = 'horizontal' } = layout;
|
|
233
|
+
return (
|
|
234
|
+
<fieldset className="block-editor-hooks__flex-layout-orientation-controls">
|
|
235
|
+
<legend>{ __( 'Orientation' ) }</legend>
|
|
236
|
+
<Button
|
|
237
|
+
label={ 'horizontal' }
|
|
238
|
+
icon={ arrowRight }
|
|
239
|
+
isPressed={ orientation === 'horizontal' }
|
|
240
|
+
onClick={ () =>
|
|
241
|
+
onChange( {
|
|
242
|
+
...layout,
|
|
243
|
+
orientation: 'horizontal',
|
|
244
|
+
} )
|
|
245
|
+
}
|
|
246
|
+
/>
|
|
247
|
+
<Button
|
|
248
|
+
label={ 'vertical' }
|
|
249
|
+
icon={ arrowDown }
|
|
250
|
+
isPressed={ orientation === 'vertical' }
|
|
251
|
+
onClick={ () =>
|
|
252
|
+
onChange( {
|
|
253
|
+
...layout,
|
|
254
|
+
orientation: 'vertical',
|
|
255
|
+
} )
|
|
256
|
+
}
|
|
257
|
+
/>
|
|
258
|
+
</fieldset>
|
|
259
|
+
);
|
|
260
|
+
}
|