@wordpress/block-editor 16.0.0 → 16.1.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 +18 -0
- package/README.md +8 -0
- package/build/components/alignment-control/ui.cjs +2 -4
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +40 -10
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +5 -3
- package/build/components/block-alignment-control/ui.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +73 -46
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +4 -1
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +5 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +2 -3
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
- package/build/components/block-parent-selector/index.cjs +2 -2
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs +4 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-tools/empty-block-inserter.cjs +2 -7
- package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
- package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
- package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
- package/build/components/border-radius-control/utils.cjs +8 -58
- package/build/components/border-radius-control/utils.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +5 -3
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/dimension-control/index.cjs +30 -20
- package/build/components/dimension-control/index.cjs.map +3 -3
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/editor-styles/index.cjs +9 -1
- package/build/components/editor-styles/index.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +66 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +153 -55
- package/build/components/global-styles/border-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +63 -17
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +242 -64
- package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
- package/build/components/global-styles/filters-panel.cjs +59 -20
- package/build/components/global-styles/filters-panel.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +4 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +142 -0
- package/build/components/global-styles/inheritance/index.cjs.map +7 -0
- package/build/components/global-styles/inherited-value-context.cjs +173 -0
- package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
- package/build/components/global-styles/shadow-panel-components.cjs +38 -20
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +1 -1
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +271 -78
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/line-height-control/index.cjs +1 -1
- package/build/components/line-height-control/index.cjs.map +2 -2
- package/build/components/link-control/index.cjs +3 -1
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs +2 -1
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/block-refs-provider.cjs +8 -2
- package/build/components/provider/block-refs-provider.cjs.map +2 -2
- package/build/components/provider/index.cjs +1 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs +18 -6
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/provider/use-media-upload-settings.cjs +3 -1
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +23 -13
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/spacing-sizes-control/utils.cjs +6 -19
- package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
- package/build/components/text-indent-control/index.cjs +8 -2
- package/build/components/text-indent-control/index.cjs.map +2 -2
- package/build/components/url-input/index.cjs +303 -344
- package/build/components/url-input/index.cjs.map +3 -3
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs +24 -1
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-click-selection.cjs +28 -2
- package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
- package/build/components/writing-flow/use-editable-root.cjs +5 -42
- package/build/components/writing-flow/use-editable-root.cjs.map +2 -2
- package/build/components/writing-flow/use-home-end.cjs +1 -1
- package/build/components/writing-flow/use-home-end.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +17 -13
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/components/writing-flow/utils.cjs +3 -14
- package/build/components/writing-flow/utils.cjs.map +2 -2
- package/build/hooks/background.cjs +13 -10
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-style-variation.cjs +4 -45
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/border.cjs +19 -4
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +6 -2
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -4
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs +26 -14
- package/build/hooks/duotone.cjs.map +3 -3
- package/build/hooks/elements.cjs +14 -4
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/line-height.cjs +1 -2
- package/build/hooks/line-height.cjs.map +2 -2
- package/build/hooks/typography.cjs +13 -4
- package/build/hooks/typography.cjs.map +2 -2
- package/build/private-apis.cjs +9 -5
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +9 -4
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +28 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +6 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +23 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/native-undo.cjs +55 -0
- package/build/utils/native-undo.cjs.map +7 -0
- package/build-module/components/alignment-control/ui.mjs +2 -4
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +43 -10
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +5 -3
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +74 -46
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +4 -1
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +5 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +2 -3
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
- package/build-module/components/block-parent-selector/index.mjs +2 -2
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
- package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
- package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
- package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/border-radius-control/utils.mjs +11 -53
- package/build-module/components/border-radius-control/utils.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +5 -3
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/dimension-control/index.mjs +30 -20
- package/build-module/components/dimension-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/editor-styles/index.mjs +9 -1
- package/build-module/components/editor-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +71 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +157 -56
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +63 -17
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +64 -21
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +4 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +108 -0
- package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
- package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
- package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
- package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +1 -1
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +276 -79
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/line-height-control/index.mjs +1 -1
- package/build-module/components/line-height-control/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs +4 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -1
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/block-refs-provider.mjs +8 -2
- package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +1 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +18 -6
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +28 -14
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
- package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
- package/build-module/components/text-indent-control/index.mjs +8 -2
- package/build-module/components/text-indent-control/index.mjs.map +2 -2
- package/build-module/components/url-input/index.mjs +306 -353
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +24 -1
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs +28 -2
- package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
- package/build-module/components/writing-flow/use-editable-root.mjs +5 -37
- package/build-module/components/writing-flow/use-editable-root.mjs.map +2 -2
- package/build-module/components/writing-flow/use-home-end.mjs +1 -1
- package/build-module/components/writing-flow/use-home-end.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +18 -14
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/components/writing-flow/utils.mjs +2 -11
- package/build-module/components/writing-flow/utils.mjs.map +2 -2
- package/build-module/hooks/background.mjs +13 -10
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +8 -44
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/border.mjs +19 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +7 -3
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +15 -4
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs +20 -9
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +14 -4
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/line-height.mjs +1 -2
- package/build-module/hooks/line-height.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +13 -4
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -3
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +9 -4
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +29 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +6 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +23 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/native-undo.mjs +29 -0
- package/build-module/utils/native-undo.mjs.map +7 -0
- package/build-style/content-rtl.css +10 -18
- package/build-style/content.css +10 -18
- package/build-style/style-rtl.css +150 -7
- package/build-style/style.css +150 -7
- package/package.json +40 -41
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
- package/src/components/alignment-control/ui.js +2 -4
- package/src/components/background-image-control/index.js +74 -37
- package/src/components/background-image-control/style.scss +13 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-alignment-control/ui.js +4 -2
- package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-inspector/index.js +60 -31
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/content.scss +1 -11
- package/src/components/block-list/use-block-props/index.js +5 -1
- package/src/components/block-list/use-block-props/use-focus-handler.js +9 -8
- package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
- package/src/components/block-parent-selector/index.js +5 -2
- package/src/components/block-toolbar/switch-section-style.js +5 -2
- package/src/components/block-tools/empty-block-inserter.js +3 -7
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-vertical-alignment-control/test/index.js +18 -2
- package/src/components/block-vertical-alignment-control/ui.js +3 -5
- package/src/components/border-radius-control/test/utils.js +0 -41
- package/src/components/border-radius-control/utils.js +16 -107
- package/src/components/button-block-appender/content.scss +6 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +6 -3
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
- package/src/components/dimension-control/index.js +13 -1
- package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
- package/src/components/editor-styles/index.js +16 -1
- package/src/components/global-styles/background-panel.js +107 -34
- package/src/components/global-styles/border-panel.js +219 -48
- package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
- package/src/components/global-styles/color-panel.js +92 -11
- package/src/components/global-styles/dimensions-panel.js +422 -71
- package/src/components/global-styles/filters-panel.js +88 -28
- package/src/components/global-styles/hooks.js +8 -1
- package/src/components/global-styles/inheritance/index.js +204 -0
- package/src/components/global-styles/inheritance/style.scss +184 -0
- package/src/components/global-styles/inheritance/test/index.js +281 -0
- package/src/components/global-styles/inherited-value-context.js +271 -0
- package/src/components/global-styles/shadow-panel-components.js +48 -26
- package/src/components/global-styles/state-control.js +2 -2
- package/src/components/global-styles/test/background-panel.js +338 -1
- package/src/components/global-styles/test/border-panel.js +441 -0
- package/src/components/global-styles/test/color-panel.js +182 -2
- package/src/components/global-styles/test/dimensions-panel.js +753 -0
- package/src/components/global-styles/test/filters-panel.js +194 -0
- package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
- package/src/components/global-styles/test/inherited-value-context.js +454 -0
- package/src/components/global-styles/test/typography-panel-core.js +185 -0
- package/src/components/global-styles/test/typography-panel.js +849 -12
- package/src/components/global-styles/typography-panel.js +449 -100
- package/src/components/image-editor/style.scss +33 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/line-height-control/index.js +1 -1
- package/src/components/link-control/index.js +7 -2
- package/src/components/preset-input-control/index.js +4 -1
- package/src/components/provider/block-refs-provider.js +12 -2
- package/src/components/provider/index.js +2 -2
- package/src/components/provider/use-block-sync.js +18 -6
- package/src/components/provider/use-media-upload-settings.js +2 -0
- package/src/components/rich-text/index.js +37 -16
- package/src/components/spacing-sizes-control/test/utils.js +16 -5
- package/src/components/spacing-sizes-control/utils.js +11 -28
- package/src/components/text-indent-control/index.js +8 -0
- package/src/components/url-input/index.js +363 -431
- package/src/components/url-input/test/index.js +592 -0
- package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +51 -1
- package/src/components/writing-flow/use-click-selection.js +54 -3
- package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
- package/src/components/writing-flow/use-editable-root.js +7 -77
- package/src/components/writing-flow/use-home-end.js +17 -9
- package/src/components/writing-flow/use-selection-observer.js +32 -15
- package/src/components/writing-flow/utils.js +3 -24
- package/src/hooks/background.js +26 -21
- package/src/hooks/block-fields/rich-text/styles.scss +1 -1
- package/src/hooks/block-style-variation.js +8 -74
- package/src/hooks/border.js +19 -4
- package/src/hooks/custom-css.js +15 -6
- package/src/hooks/dimensions.js +17 -4
- package/src/hooks/duotone.js +26 -8
- package/src/hooks/elements.js +14 -3
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/test/inherited-value-wiring.js +411 -0
- package/src/hooks/test/preset-round-trip.js +456 -0
- package/src/hooks/typography.js +35 -23
- package/src/private-apis.js +11 -2
- package/src/store/actions.js +10 -4
- package/src/store/private-selectors.js +57 -1
- package/src/store/reducer.js +9 -9
- package/src/store/selectors.js +56 -8
- package/src/store/test/private-selectors.js +160 -1
- package/src/style.scss +2 -0
- package/src/utils/native-undo.js +56 -0
- package/build/components/duotone/utils.cjs +0 -87
- package/build/components/duotone/utils.cjs.map +0 -7
- package/build-module/components/duotone/utils.mjs +0 -59
- package/build-module/components/duotone/utils.mjs.map +0 -7
- package/src/components/duotone/utils.js +0 -90
- package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// packages/block-editor/src/components/global-styles/dimensions-panel.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import { __ } from "@wordpress/i18n";
|
|
4
3
|
import {
|
|
5
4
|
__experimentalToolsPanel as ToolsPanel,
|
|
6
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
5
|
BoxControl,
|
|
8
6
|
__experimentalUnitControl as UnitControl,
|
|
9
7
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
10
|
-
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper
|
|
8
|
+
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
|
|
9
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue
|
|
11
10
|
} from "@wordpress/components";
|
|
12
11
|
import { Icon, alignNone, stretchWide } from "@wordpress/icons";
|
|
13
12
|
import { useCallback, useState } from "@wordpress/element";
|
|
@@ -24,8 +23,23 @@ import {
|
|
|
24
23
|
hasPseudoBlockStyleState,
|
|
25
24
|
hasViewportBlockStyleState
|
|
26
25
|
} from "../../hooks/block-style-state.mjs";
|
|
26
|
+
import {
|
|
27
|
+
getInheritanceProps,
|
|
28
|
+
InheritanceToolsPanelItem,
|
|
29
|
+
isGlobalStylesInheritanceEnabled
|
|
30
|
+
} from "./inheritance/index.mjs";
|
|
27
31
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
32
|
var AXIAL_SIDES = ["horizontal", "vertical"];
|
|
33
|
+
function hasSpacingToggle(sides, isPresetsControl) {
|
|
34
|
+
if (sides?.length === 1) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (isPresetsControl) {
|
|
38
|
+
const hasOnlyAxialSides = sides?.includes("horizontal") && sides?.includes("vertical") && sides?.length === 2;
|
|
39
|
+
return !hasOnlyAxialSides;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
29
43
|
function useHasDimensionsPanel(settings, styleState = DEFAULT_BLOCK_STYLE_STATE) {
|
|
30
44
|
return hasContentSize(settings) || hasWideSize(settings) || hasPadding(settings) || hasMargin(settings) || hasGap(settings) || hasHeight(settings) || hasMinHeight(settings) || hasMinWidth(settings) || hasWidth(settings) || hasAspectRatio(settings, styleState) || hasChildLayout(settings, styleState);
|
|
31
45
|
}
|
|
@@ -93,8 +107,19 @@ function filterValuesBySides(values, sides) {
|
|
|
93
107
|
});
|
|
94
108
|
return filteredValues;
|
|
95
109
|
}
|
|
110
|
+
var EMPTY_VALUES = [void 0, null, ""];
|
|
111
|
+
function hasValue(value) {
|
|
112
|
+
return !EMPTY_VALUES.includes(value);
|
|
113
|
+
}
|
|
114
|
+
function getNumericPlaceholder(rawValue) {
|
|
115
|
+
if (!hasValue(rawValue)) {
|
|
116
|
+
return void 0;
|
|
117
|
+
}
|
|
118
|
+
const [quantity] = parseQuantityAndUnitFromRawValue(rawValue);
|
|
119
|
+
return quantity;
|
|
120
|
+
}
|
|
96
121
|
function splitStyleValue(value) {
|
|
97
|
-
if (value && typeof value === "string") {
|
|
122
|
+
if (hasValue(value) && typeof value === "string") {
|
|
98
123
|
return {
|
|
99
124
|
top: value,
|
|
100
125
|
right: value,
|
|
@@ -104,8 +129,41 @@ function splitStyleValue(value) {
|
|
|
104
129
|
}
|
|
105
130
|
return value;
|
|
106
131
|
}
|
|
132
|
+
function getCommonSidesValue(sidesValue) {
|
|
133
|
+
if (!hasValue(sidesValue)) {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
if (typeof sidesValue === "string") {
|
|
137
|
+
return sidesValue !== "" ? sidesValue : void 0;
|
|
138
|
+
}
|
|
139
|
+
if (typeof sidesValue !== "object") {
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
const sideKeys = ["top", "right", "bottom", "left"];
|
|
143
|
+
const values = sideKeys.map((k) => sidesValue[k]);
|
|
144
|
+
const allDefined = values.every(hasValue);
|
|
145
|
+
if (!allDefined) {
|
|
146
|
+
return void 0;
|
|
147
|
+
}
|
|
148
|
+
const first = values[0];
|
|
149
|
+
return values.every((v) => v === first) ? first : void 0;
|
|
150
|
+
}
|
|
151
|
+
function hasAnySideValue(sidesValue) {
|
|
152
|
+
if (!hasValue(sidesValue)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
if (typeof sidesValue === "string") {
|
|
156
|
+
return sidesValue !== "";
|
|
157
|
+
}
|
|
158
|
+
if (typeof sidesValue !== "object") {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return ["top", "right", "bottom", "left"].some(
|
|
162
|
+
(side) => hasValue(sidesValue[side])
|
|
163
|
+
);
|
|
164
|
+
}
|
|
107
165
|
function splitGapValue(value, isAxialGap) {
|
|
108
|
-
if (!value) {
|
|
166
|
+
if (!hasValue(value)) {
|
|
109
167
|
return value;
|
|
110
168
|
}
|
|
111
169
|
if (typeof value === "string") {
|
|
@@ -166,7 +224,8 @@ function DimensionsPanel({
|
|
|
166
224
|
// Special case because the layout controls are not part of the dimensions panel
|
|
167
225
|
// in global styles but not in block inspector.
|
|
168
226
|
includeLayoutControls = false,
|
|
169
|
-
styleState = DEFAULT_BLOCK_STYLE_STATE
|
|
227
|
+
styleState = DEFAULT_BLOCK_STYLE_STATE,
|
|
228
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled()
|
|
170
229
|
}) {
|
|
171
230
|
const { dimensions, spacing } = settings;
|
|
172
231
|
const decodeValue = (rawValue) => {
|
|
@@ -186,6 +245,11 @@ function DimensionsPanel({
|
|
|
186
245
|
rawValue
|
|
187
246
|
);
|
|
188
247
|
};
|
|
248
|
+
const inheritanceProps = (isInherited, hasLocalOverride, className) => getInheritanceProps(
|
|
249
|
+
showInheritanceLabelIndicators && isInherited,
|
|
250
|
+
showInheritanceLabelIndicators && hasLocalOverride,
|
|
251
|
+
className
|
|
252
|
+
);
|
|
189
253
|
const showSpacingPresetsControl = hasSpacingPresets(settings);
|
|
190
254
|
const units = useCustomUnits({
|
|
191
255
|
availableUnits: settings?.spacing?.units || [
|
|
@@ -229,67 +293,100 @@ function DimensionsPanel({
|
|
|
229
293
|
};
|
|
230
294
|
}, []);
|
|
231
295
|
const showContentSizeControl = hasContentSize(settings) && includeLayoutControls;
|
|
232
|
-
const
|
|
296
|
+
const localContentSizeValue = decodeValue(value?.layout?.contentSize);
|
|
297
|
+
const inheritedContentSizeValue = decodeValue(
|
|
298
|
+
inheritedValue?.layout?.contentSize
|
|
299
|
+
);
|
|
300
|
+
const isContentSizePlaceholder = !hasValue(value?.layout?.contentSize) && hasValue(inheritedContentSizeValue);
|
|
233
301
|
const setContentSizeValue = (newValue) => {
|
|
234
302
|
onChange(
|
|
235
303
|
setImmutably(
|
|
236
304
|
value,
|
|
237
305
|
["layout", "contentSize"],
|
|
238
|
-
newValue
|
|
306
|
+
hasValue(newValue) ? newValue : void 0
|
|
239
307
|
)
|
|
240
308
|
);
|
|
241
309
|
};
|
|
242
|
-
const hasUserSetContentSizeValue = () =>
|
|
310
|
+
const hasUserSetContentSizeValue = () => hasValue(value?.layout?.contentSize);
|
|
243
311
|
const resetContentSizeValue = () => setContentSizeValue(void 0);
|
|
244
312
|
const showWideSizeControl = hasWideSize(settings) && includeLayoutControls;
|
|
245
|
-
const
|
|
313
|
+
const localWideSizeValue = decodeValue(value?.layout?.wideSize);
|
|
314
|
+
const inheritedWideSizeValue = decodeValue(
|
|
315
|
+
inheritedValue?.layout?.wideSize
|
|
316
|
+
);
|
|
317
|
+
const isWideSizePlaceholder = !hasValue(value?.layout?.wideSize) && hasValue(inheritedWideSizeValue);
|
|
246
318
|
const setWideSizeValue = (newValue) => {
|
|
247
319
|
onChange(
|
|
248
320
|
setImmutably(
|
|
249
321
|
value,
|
|
250
322
|
["layout", "wideSize"],
|
|
251
|
-
newValue
|
|
323
|
+
hasValue(newValue) ? newValue : void 0
|
|
252
324
|
)
|
|
253
325
|
);
|
|
254
326
|
};
|
|
255
|
-
const hasUserSetWideSizeValue = () =>
|
|
327
|
+
const hasUserSetWideSizeValue = () => hasValue(value?.layout?.wideSize);
|
|
256
328
|
const resetWideSizeValue = () => setWideSizeValue(void 0);
|
|
257
329
|
const showPaddingControl = hasPadding(settings);
|
|
258
|
-
const
|
|
259
|
-
|
|
330
|
+
const inheritedPaddingValues = splitStyleValue(
|
|
331
|
+
decodeValue(inheritedValue?.spacing?.padding)
|
|
332
|
+
);
|
|
333
|
+
const localPaddingValues = splitStyleValue(
|
|
334
|
+
decodeValue(value?.spacing?.padding)
|
|
335
|
+
);
|
|
336
|
+
const paddingValues = hasValue(value?.spacing?.padding) ? localPaddingValues : inheritedPaddingValues;
|
|
337
|
+
const inheritedPaddingPlaceholder = getCommonSidesValue(
|
|
338
|
+
inheritedPaddingValues
|
|
339
|
+
);
|
|
340
|
+
const isPaddingPlaceholder = !hasValue(value?.spacing?.padding) && inheritedPaddingPlaceholder !== void 0;
|
|
341
|
+
const hasInheritedPadding = hasAnySideValue(inheritedPaddingValues);
|
|
342
|
+
const isPaddingInherited = !hasValue(value?.spacing?.padding) && hasInheritedPadding;
|
|
260
343
|
const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides;
|
|
261
344
|
const isAxialPadding = paddingSides && paddingSides.some((side) => AXIAL_SIDES.includes(side));
|
|
262
345
|
const setPaddingValues = (newPaddingValues) => {
|
|
263
346
|
const padding = filterValuesBySides(newPaddingValues, paddingSides);
|
|
264
347
|
onChange(setImmutably(value, ["spacing", "padding"], padding));
|
|
265
348
|
};
|
|
266
|
-
const hasPaddingValue = () =>
|
|
349
|
+
const hasPaddingValue = () => hasValue(value?.spacing?.padding) && Object.keys(value?.spacing?.padding).length;
|
|
267
350
|
const resetPaddingValue = () => setPaddingValues(void 0);
|
|
268
351
|
const onMouseOverPadding = () => onVisualize("padding");
|
|
269
352
|
const showMarginControl = hasMargin(settings);
|
|
270
|
-
const
|
|
271
|
-
|
|
353
|
+
const inheritedMarginValues = splitStyleValue(
|
|
354
|
+
decodeValue(inheritedValue?.spacing?.margin)
|
|
355
|
+
);
|
|
356
|
+
const localMarginValues = splitStyleValue(
|
|
357
|
+
decodeValue(value?.spacing?.margin)
|
|
358
|
+
);
|
|
359
|
+
const marginValues = hasValue(value?.spacing?.margin) ? localMarginValues : inheritedMarginValues;
|
|
360
|
+
const inheritedMarginPlaceholder = getCommonSidesValue(
|
|
361
|
+
inheritedMarginValues
|
|
362
|
+
);
|
|
363
|
+
const isMarginPlaceholder = !hasValue(value?.spacing?.margin) && inheritedMarginPlaceholder !== void 0;
|
|
364
|
+
const hasInheritedMargin = hasAnySideValue(inheritedMarginValues);
|
|
365
|
+
const isMarginInherited = !hasValue(value?.spacing?.margin) && hasInheritedMargin;
|
|
272
366
|
const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides;
|
|
273
367
|
const isAxialMargin = marginSides && marginSides.some((side) => AXIAL_SIDES.includes(side));
|
|
274
368
|
const setMarginValues = (newMarginValues) => {
|
|
275
369
|
const margin = filterValuesBySides(newMarginValues, marginSides);
|
|
276
370
|
onChange(setImmutably(value, ["spacing", "margin"], margin));
|
|
277
371
|
};
|
|
278
|
-
const hasMarginValue = () =>
|
|
372
|
+
const hasMarginValue = () => hasValue(value?.spacing?.margin) && Object.keys(value?.spacing?.margin).length;
|
|
279
373
|
const resetMarginValue = () => setMarginValues(void 0);
|
|
280
374
|
const onMouseOverMargin = () => onVisualize("margin");
|
|
281
375
|
const showGapControl = hasGap(settings);
|
|
282
376
|
const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides;
|
|
283
377
|
const isAxialGap = gapSides && gapSides.some((side) => AXIAL_SIDES.includes(side));
|
|
284
|
-
const
|
|
285
|
-
const
|
|
378
|
+
const localGapRaw = decodeValue(value?.spacing?.blockGap);
|
|
379
|
+
const inheritedGapRaw = decodeValue(inheritedValue?.spacing?.blockGap);
|
|
380
|
+
const gapRawForDisplay = hasValue(value?.spacing?.blockGap) ? localGapRaw : inheritedGapRaw;
|
|
381
|
+
const gapValues = splitGapValue(gapRawForDisplay, isAxialGap);
|
|
382
|
+
const isGapPlaceholder = !hasValue(value?.spacing?.blockGap) && typeof inheritedGapRaw === "string" && inheritedGapRaw !== "";
|
|
286
383
|
const setGapValue = (newGapValue) => {
|
|
287
384
|
onChange(
|
|
288
385
|
setImmutably(value, ["spacing", "blockGap"], newGapValue)
|
|
289
386
|
);
|
|
290
387
|
};
|
|
291
388
|
const setGapValues = (nextBoxGapValue) => {
|
|
292
|
-
if (!nextBoxGapValue) {
|
|
389
|
+
if (!hasValue(nextBoxGapValue)) {
|
|
293
390
|
setGapValue(null);
|
|
294
391
|
}
|
|
295
392
|
if (!isAxialGap && nextBoxGapValue?.hasOwnProperty("top")) {
|
|
@@ -302,9 +399,13 @@ function DimensionsPanel({
|
|
|
302
399
|
}
|
|
303
400
|
};
|
|
304
401
|
const resetGapValue = () => setGapValue(void 0);
|
|
305
|
-
const hasGapValue = () =>
|
|
402
|
+
const hasGapValue = () => hasValue(value?.spacing?.blockGap);
|
|
306
403
|
const showMinHeightControl = hasMinHeight(settings);
|
|
307
|
-
const
|
|
404
|
+
const localMinHeightValue = decodeValue(value?.dimensions?.minHeight);
|
|
405
|
+
const inheritedMinHeightValue = decodeValue(
|
|
406
|
+
inheritedValue?.dimensions?.minHeight
|
|
407
|
+
);
|
|
408
|
+
const isMinHeightPlaceholder = !hasValue(value?.dimensions?.minHeight) && hasValue(inheritedMinHeightValue);
|
|
308
409
|
const setMinHeightValue = (newValue) => {
|
|
309
410
|
const tempValue = setImmutably(
|
|
310
411
|
value,
|
|
@@ -322,9 +423,13 @@ function DimensionsPanel({
|
|
|
322
423
|
const resetMinHeightValue = () => {
|
|
323
424
|
setMinHeightValue(void 0);
|
|
324
425
|
};
|
|
325
|
-
const hasMinHeightValue = () =>
|
|
426
|
+
const hasMinHeightValue = () => hasValue(value?.dimensions?.minHeight);
|
|
326
427
|
const showHeightControl = hasHeight(settings);
|
|
327
|
-
const
|
|
428
|
+
const localHeightValue = decodeValue(value?.dimensions?.height);
|
|
429
|
+
const inheritedHeightValue = decodeValue(
|
|
430
|
+
inheritedValue?.dimensions?.height
|
|
431
|
+
);
|
|
432
|
+
const isHeightPlaceholder = !hasValue(value?.dimensions?.height) && hasValue(inheritedHeightValue);
|
|
328
433
|
const setHeightValue = (newValue) => {
|
|
329
434
|
const tempValue = setImmutably(
|
|
330
435
|
value,
|
|
@@ -342,9 +447,13 @@ function DimensionsPanel({
|
|
|
342
447
|
const resetHeightValue = () => {
|
|
343
448
|
setHeightValue(void 0);
|
|
344
449
|
};
|
|
345
|
-
const hasHeightValue = () =>
|
|
450
|
+
const hasHeightValue = () => hasValue(value?.dimensions?.height);
|
|
346
451
|
const showMinWidthControl = hasMinWidth(settings);
|
|
347
|
-
const
|
|
452
|
+
const localMinWidthValue = decodeValue(value?.dimensions?.minWidth);
|
|
453
|
+
const inheritedMinWidthValue = decodeValue(
|
|
454
|
+
inheritedValue?.dimensions?.minWidth
|
|
455
|
+
);
|
|
456
|
+
const isMinWidthPlaceholder = !hasValue(value?.dimensions?.minWidth) && hasValue(inheritedMinWidthValue);
|
|
348
457
|
const setMinWidthValue = (newValue) => {
|
|
349
458
|
onChange(
|
|
350
459
|
setImmutably(value, ["dimensions", "minWidth"], newValue)
|
|
@@ -353,20 +462,27 @@ function DimensionsPanel({
|
|
|
353
462
|
const resetMinWidthValue = () => {
|
|
354
463
|
setMinWidthValue(void 0);
|
|
355
464
|
};
|
|
356
|
-
const hasMinWidthValue = () =>
|
|
465
|
+
const hasMinWidthValue = () => hasValue(value?.dimensions?.minWidth);
|
|
357
466
|
const showWidthControl = hasWidth(settings);
|
|
358
|
-
const
|
|
467
|
+
const localWidthValue = decodeValue(value?.dimensions?.width);
|
|
468
|
+
const inheritedWidthValue = decodeValue(
|
|
469
|
+
inheritedValue?.dimensions?.width
|
|
470
|
+
);
|
|
471
|
+
const isWidthPlaceholder = !hasValue(value?.dimensions?.width) && hasValue(inheritedWidthValue);
|
|
359
472
|
const setWidthValue = (newValue) => {
|
|
360
473
|
onChange(setImmutably(value, ["dimensions", "width"], newValue));
|
|
361
474
|
};
|
|
362
475
|
const resetWidthValue = () => {
|
|
363
476
|
setWidthValue(void 0);
|
|
364
477
|
};
|
|
365
|
-
const hasWidthValue = () =>
|
|
478
|
+
const hasWidthValue = () => hasValue(value?.dimensions?.width);
|
|
366
479
|
const showAspectRatioControl = hasAspectRatio(settings, styleState);
|
|
367
|
-
const
|
|
480
|
+
const localAspectRatioValue = decodeValue(value?.dimensions?.aspectRatio);
|
|
481
|
+
const inheritedAspectRatioValue = decodeValue(
|
|
368
482
|
inheritedValue?.dimensions?.aspectRatio
|
|
369
483
|
);
|
|
484
|
+
const aspectRatioValue = localAspectRatioValue ?? inheritedAspectRatioValue;
|
|
485
|
+
const isAspectRatioPlaceholder = !hasValue(value?.dimensions?.aspectRatio) && hasValue(inheritedAspectRatioValue);
|
|
370
486
|
const setAspectRatioValue = (newValue) => {
|
|
371
487
|
const tempValue = setImmutably(
|
|
372
488
|
value,
|
|
@@ -377,9 +493,9 @@ function DimensionsPanel({
|
|
|
377
493
|
setImmutably(tempValue, ["dimensions", "minHeight"], void 0)
|
|
378
494
|
);
|
|
379
495
|
};
|
|
380
|
-
const hasAspectRatioValue = () =>
|
|
496
|
+
const hasAspectRatioValue = () => hasValue(value?.dimensions?.aspectRatio);
|
|
381
497
|
const showChildLayoutControl = hasChildLayout(settings, styleState);
|
|
382
|
-
const childLayout =
|
|
498
|
+
const childLayout = value?.layout;
|
|
383
499
|
const setChildLayout = (newChildLayout) => {
|
|
384
500
|
onChange({
|
|
385
501
|
...value,
|
|
@@ -400,8 +516,12 @@ function DimensionsPanel({
|
|
|
400
516
|
children: [
|
|
401
517
|
(showContentSizeControl || showWideSizeControl) && /* @__PURE__ */ jsx("span", { className: "span-columns", children: __("Set the width of the main content area.") }),
|
|
402
518
|
showContentSizeControl && /* @__PURE__ */ jsx(
|
|
403
|
-
|
|
519
|
+
InheritanceToolsPanelItem,
|
|
404
520
|
{
|
|
521
|
+
...inheritanceProps(
|
|
522
|
+
isContentSizePlaceholder,
|
|
523
|
+
hasUserSetContentSizeValue() && inheritedContentSizeValue !== void 0
|
|
524
|
+
),
|
|
405
525
|
label: __("Content width"),
|
|
406
526
|
hasValue: hasUserSetContentSizeValue,
|
|
407
527
|
onDeselect: resetContentSizeValue,
|
|
@@ -412,7 +532,10 @@ function DimensionsPanel({
|
|
|
412
532
|
{
|
|
413
533
|
label: __("Content width"),
|
|
414
534
|
labelPosition: "top",
|
|
415
|
-
value:
|
|
535
|
+
value: localContentSizeValue ?? inheritedContentSizeValue,
|
|
536
|
+
placeholder: isContentSizePlaceholder ? getNumericPlaceholder(
|
|
537
|
+
inheritedContentSizeValue
|
|
538
|
+
) : void 0,
|
|
416
539
|
onChange: (nextContentSize) => {
|
|
417
540
|
setContentSizeValue(nextContentSize);
|
|
418
541
|
},
|
|
@@ -423,8 +546,12 @@ function DimensionsPanel({
|
|
|
423
546
|
}
|
|
424
547
|
),
|
|
425
548
|
showWideSizeControl && /* @__PURE__ */ jsx(
|
|
426
|
-
|
|
549
|
+
InheritanceToolsPanelItem,
|
|
427
550
|
{
|
|
551
|
+
...inheritanceProps(
|
|
552
|
+
isWideSizePlaceholder,
|
|
553
|
+
hasUserSetWideSizeValue() && inheritedWideSizeValue !== void 0
|
|
554
|
+
),
|
|
428
555
|
label: __("Wide width"),
|
|
429
556
|
hasValue: hasUserSetWideSizeValue,
|
|
430
557
|
onDeselect: resetWideSizeValue,
|
|
@@ -435,7 +562,10 @@ function DimensionsPanel({
|
|
|
435
562
|
{
|
|
436
563
|
label: __("Wide width"),
|
|
437
564
|
labelPosition: "top",
|
|
438
|
-
value:
|
|
565
|
+
value: localWideSizeValue ?? inheritedWideSizeValue,
|
|
566
|
+
placeholder: isWideSizePlaceholder ? getNumericPlaceholder(
|
|
567
|
+
inheritedWideSizeValue
|
|
568
|
+
) : void 0,
|
|
439
569
|
onChange: (nextWideSize) => {
|
|
440
570
|
setWideSizeValue(nextWideSize);
|
|
441
571
|
},
|
|
@@ -446,21 +576,29 @@ function DimensionsPanel({
|
|
|
446
576
|
}
|
|
447
577
|
),
|
|
448
578
|
showPaddingControl && /* @__PURE__ */ jsxs(
|
|
449
|
-
|
|
579
|
+
InheritanceToolsPanelItem,
|
|
450
580
|
{
|
|
451
581
|
hasValue: hasPaddingValue,
|
|
452
582
|
label: __("Padding"),
|
|
583
|
+
hasInlineEndToggle: hasSpacingToggle(
|
|
584
|
+
paddingSides,
|
|
585
|
+
showSpacingPresetsControl
|
|
586
|
+
),
|
|
453
587
|
onDeselect: resetPaddingValue,
|
|
454
588
|
isShownByDefault: defaultControls.padding ?? DEFAULT_CONTROLS.padding,
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
589
|
+
...inheritanceProps(
|
|
590
|
+
isPaddingInherited,
|
|
591
|
+
hasPaddingValue() && hasInheritedPadding,
|
|
592
|
+
{
|
|
593
|
+
"tools-panel-item-spacing": showSpacingPresetsControl
|
|
594
|
+
}
|
|
595
|
+
),
|
|
458
596
|
panelId,
|
|
459
597
|
children: [
|
|
460
598
|
!showSpacingPresetsControl && /* @__PURE__ */ jsx(
|
|
461
599
|
BoxControl,
|
|
462
600
|
{
|
|
463
|
-
values:
|
|
601
|
+
values: localPaddingValues,
|
|
464
602
|
onChange: setPaddingValues,
|
|
465
603
|
label: __("Padding"),
|
|
466
604
|
sides: paddingSides,
|
|
@@ -469,7 +607,8 @@ function DimensionsPanel({
|
|
|
469
607
|
splitOnAxis: isAxialPadding,
|
|
470
608
|
inputProps: {
|
|
471
609
|
onMouseOver: onMouseOverPadding,
|
|
472
|
-
onMouseOut: onMouseLeaveControls
|
|
610
|
+
onMouseOut: onMouseLeaveControls,
|
|
611
|
+
placeholder: isPaddingPlaceholder ? inheritedPaddingPlaceholder : void 0
|
|
473
612
|
}
|
|
474
613
|
}
|
|
475
614
|
),
|
|
@@ -490,21 +629,29 @@ function DimensionsPanel({
|
|
|
490
629
|
}
|
|
491
630
|
),
|
|
492
631
|
showMarginControl && /* @__PURE__ */ jsxs(
|
|
493
|
-
|
|
632
|
+
InheritanceToolsPanelItem,
|
|
494
633
|
{
|
|
495
634
|
hasValue: hasMarginValue,
|
|
496
635
|
label: __("Margin"),
|
|
636
|
+
hasInlineEndToggle: hasSpacingToggle(
|
|
637
|
+
marginSides,
|
|
638
|
+
showSpacingPresetsControl
|
|
639
|
+
),
|
|
497
640
|
onDeselect: resetMarginValue,
|
|
498
641
|
isShownByDefault: defaultControls.margin ?? DEFAULT_CONTROLS.margin,
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
642
|
+
...inheritanceProps(
|
|
643
|
+
isMarginInherited,
|
|
644
|
+
hasMarginValue() && hasInheritedMargin,
|
|
645
|
+
{
|
|
646
|
+
"tools-panel-item-spacing": showSpacingPresetsControl
|
|
647
|
+
}
|
|
648
|
+
),
|
|
502
649
|
panelId,
|
|
503
650
|
children: [
|
|
504
651
|
!showSpacingPresetsControl && /* @__PURE__ */ jsx(
|
|
505
652
|
BoxControl,
|
|
506
653
|
{
|
|
507
|
-
values:
|
|
654
|
+
values: localMarginValues,
|
|
508
655
|
onChange: setMarginValues,
|
|
509
656
|
inputProps: {
|
|
510
657
|
min: minMarginValue,
|
|
@@ -515,7 +662,8 @@ function DimensionsPanel({
|
|
|
515
662
|
setMinMarginValue(minimumMargin);
|
|
516
663
|
},
|
|
517
664
|
onMouseOver: onMouseOverMargin,
|
|
518
|
-
onMouseOut: onMouseLeaveControls
|
|
665
|
+
onMouseOut: onMouseLeaveControls,
|
|
666
|
+
placeholder: isMarginPlaceholder ? inheritedMarginPlaceholder : void 0
|
|
519
667
|
},
|
|
520
668
|
label: __("Margin"),
|
|
521
669
|
sides: marginSides,
|
|
@@ -542,19 +690,24 @@ function DimensionsPanel({
|
|
|
542
690
|
}
|
|
543
691
|
),
|
|
544
692
|
showGapControl && /* @__PURE__ */ jsxs(
|
|
545
|
-
|
|
693
|
+
InheritanceToolsPanelItem,
|
|
546
694
|
{
|
|
547
695
|
hasValue: hasGapValue,
|
|
548
696
|
label: __("Block spacing"),
|
|
697
|
+
hasInlineEndToggle: isAxialGap,
|
|
549
698
|
onDeselect: resetGapValue,
|
|
550
699
|
isShownByDefault: defaultControls.blockGap ?? DEFAULT_CONTROLS.blockGap,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
700
|
+
...inheritanceProps(
|
|
701
|
+
isGapPlaceholder,
|
|
702
|
+
hasGapValue() && inheritedGapRaw !== void 0,
|
|
703
|
+
{
|
|
704
|
+
"tools-panel-item-spacing": showSpacingPresetsControl,
|
|
705
|
+
"single-column": (
|
|
706
|
+
// If UnitControl is used, should be single-column.
|
|
707
|
+
!showSpacingPresetsControl && !isAxialGap
|
|
708
|
+
)
|
|
709
|
+
}
|
|
710
|
+
),
|
|
558
711
|
panelId,
|
|
559
712
|
children: [
|
|
560
713
|
!showSpacingPresetsControl && (isAxialGap ? /* @__PURE__ */ jsx(
|
|
@@ -576,7 +729,8 @@ function DimensionsPanel({
|
|
|
576
729
|
min: 0,
|
|
577
730
|
onChange: setGapValue,
|
|
578
731
|
units,
|
|
579
|
-
value:
|
|
732
|
+
value: localGapRaw ?? void 0,
|
|
733
|
+
placeholder: isGapPlaceholder ? inheritedGapRaw : void 0
|
|
580
734
|
}
|
|
581
735
|
)),
|
|
582
736
|
showSpacingPresetsControl && /* @__PURE__ */ jsx(
|
|
@@ -606,8 +760,12 @@ function DimensionsPanel({
|
|
|
606
760
|
}
|
|
607
761
|
),
|
|
608
762
|
showMinHeightControl && /* @__PURE__ */ jsx(
|
|
609
|
-
|
|
763
|
+
InheritanceToolsPanelItem,
|
|
610
764
|
{
|
|
765
|
+
...inheritanceProps(
|
|
766
|
+
isMinHeightPlaceholder,
|
|
767
|
+
hasMinHeightValue() && inheritedMinHeightValue !== void 0
|
|
768
|
+
),
|
|
611
769
|
hasValue: hasMinHeightValue,
|
|
612
770
|
label: __("Minimum height"),
|
|
613
771
|
onDeselect: resetMinHeightValue,
|
|
@@ -617,16 +775,23 @@ function DimensionsPanel({
|
|
|
617
775
|
DimensionControl,
|
|
618
776
|
{
|
|
619
777
|
label: __("Minimum height"),
|
|
620
|
-
value:
|
|
778
|
+
value: localMinHeightValue ?? inheritedMinHeightValue,
|
|
621
779
|
onChange: setMinHeightValue,
|
|
780
|
+
placeholder: isMinHeightPlaceholder ? getNumericPlaceholder(
|
|
781
|
+
inheritedMinHeightValue
|
|
782
|
+
) : void 0,
|
|
622
783
|
dimensionSizes: dimensions?.dimensionSizes
|
|
623
784
|
}
|
|
624
785
|
)
|
|
625
786
|
}
|
|
626
787
|
),
|
|
627
788
|
showMinWidthControl && /* @__PURE__ */ jsx(
|
|
628
|
-
|
|
789
|
+
InheritanceToolsPanelItem,
|
|
629
790
|
{
|
|
791
|
+
...inheritanceProps(
|
|
792
|
+
isMinWidthPlaceholder,
|
|
793
|
+
hasMinWidthValue() && inheritedMinWidthValue !== void 0
|
|
794
|
+
),
|
|
630
795
|
hasValue: hasMinWidthValue,
|
|
631
796
|
label: __("Minimum width"),
|
|
632
797
|
onDeselect: resetMinWidthValue,
|
|
@@ -636,16 +801,23 @@ function DimensionsPanel({
|
|
|
636
801
|
DimensionControl,
|
|
637
802
|
{
|
|
638
803
|
label: __("Minimum width"),
|
|
639
|
-
value:
|
|
804
|
+
value: localMinWidthValue ?? inheritedMinWidthValue,
|
|
640
805
|
onChange: setMinWidthValue,
|
|
806
|
+
placeholder: isMinWidthPlaceholder ? getNumericPlaceholder(
|
|
807
|
+
inheritedMinWidthValue
|
|
808
|
+
) : void 0,
|
|
641
809
|
dimensionSizes: dimensions?.dimensionSizes
|
|
642
810
|
}
|
|
643
811
|
)
|
|
644
812
|
}
|
|
645
813
|
),
|
|
646
814
|
showHeightControl && /* @__PURE__ */ jsx(
|
|
647
|
-
|
|
815
|
+
InheritanceToolsPanelItem,
|
|
648
816
|
{
|
|
817
|
+
...inheritanceProps(
|
|
818
|
+
isHeightPlaceholder,
|
|
819
|
+
hasHeightValue() && inheritedHeightValue !== void 0
|
|
820
|
+
),
|
|
649
821
|
hasValue: hasHeightValue,
|
|
650
822
|
label: __("Height"),
|
|
651
823
|
onDeselect: resetHeightValue,
|
|
@@ -655,16 +827,21 @@ function DimensionsPanel({
|
|
|
655
827
|
DimensionControl,
|
|
656
828
|
{
|
|
657
829
|
label: __("Height"),
|
|
658
|
-
value:
|
|
830
|
+
value: localHeightValue,
|
|
659
831
|
onChange: setHeightValue,
|
|
832
|
+
placeholder: isHeightPlaceholder ? inheritedHeightValue : void 0,
|
|
660
833
|
dimensionSizes: dimensions?.dimensionSizes
|
|
661
834
|
}
|
|
662
835
|
)
|
|
663
836
|
}
|
|
664
837
|
),
|
|
665
838
|
showWidthControl && /* @__PURE__ */ jsx(
|
|
666
|
-
|
|
839
|
+
InheritanceToolsPanelItem,
|
|
667
840
|
{
|
|
841
|
+
...inheritanceProps(
|
|
842
|
+
isWidthPlaceholder,
|
|
843
|
+
hasWidthValue() && inheritedWidthValue !== void 0
|
|
844
|
+
),
|
|
668
845
|
hasValue: hasWidthValue,
|
|
669
846
|
label: __("Width"),
|
|
670
847
|
onDeselect: resetWidthValue,
|
|
@@ -674,8 +851,9 @@ function DimensionsPanel({
|
|
|
674
851
|
DimensionControl,
|
|
675
852
|
{
|
|
676
853
|
label: __("Width"),
|
|
677
|
-
value:
|
|
854
|
+
value: localWidthValue,
|
|
678
855
|
onChange: setWidthValue,
|
|
856
|
+
placeholder: isWidthPlaceholder ? inheritedWidthValue : void 0,
|
|
679
857
|
dimensionSizes: dimensions?.dimensionSizes
|
|
680
858
|
}
|
|
681
859
|
)
|
|
@@ -688,6 +866,10 @@ function DimensionsPanel({
|
|
|
688
866
|
value: aspectRatioValue,
|
|
689
867
|
onChange: setAspectRatioValue,
|
|
690
868
|
panelId,
|
|
869
|
+
...inheritanceProps(
|
|
870
|
+
isAspectRatioPlaceholder,
|
|
871
|
+
hasAspectRatioValue() && inheritedAspectRatioValue !== void 0
|
|
872
|
+
),
|
|
691
873
|
isShownByDefault: defaultControls.aspectRatio ?? DEFAULT_CONTROLS.aspectRatio
|
|
692
874
|
}
|
|
693
875
|
)
|