@wordpress/block-editor 15.19.1-next.v.202605131032.0 → 15.21.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 +17 -1
- package/build/components/block-card/index.cjs +51 -41
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-heading-level-dropdown/heading-level-icon.cjs.map +3 -3
- package/build/components/block-icon/index.cjs +7 -1
- package/build/components/block-icon/index.cjs.map +3 -3
- package/build/components/block-inspector/index.cjs +156 -11
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs +38 -0
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs.map +7 -0
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +3 -4
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +3 -3
- package/build/components/block-list/use-block-props/use-is-hovered.cjs +24 -14
- package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +3 -3
- package/build/components/block-lock/modal.cjs.map +3 -3
- package/build/components/block-patterns-list/index.cjs +13 -2
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs +13 -3
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +3 -3
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
- package/build/components/child-layout-control/index.cjs +10 -5
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +7 -4
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +24 -22
- package/build/components/global-styles/advanced-panel.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +95 -58
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +15 -8
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/index.cjs +3 -0
- package/build/components/global-styles/index.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +38 -26
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +69 -0
- package/build/components/global-styles/state-control-badges.cjs.map +7 -0
- package/build/components/global-styles/state-control.cjs +54 -63
- package/build/components/global-styles/state-control.cjs.map +3 -3
- package/build/components/iframe/use-scale-canvas.cjs +4 -1
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs +4 -6
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs +27 -18
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/panel.cjs.map +3 -3
- package/build/components/inspector-controls/block-support-tools-panel.cjs +10 -2
- package/build/components/inspector-controls/block-support-tools-panel.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +14 -4
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +13 -8
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/settings-tab.cjs +1 -4
- package/build/components/inspector-controls-tabs/settings-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +9 -0
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +11 -5
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +20 -8
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/preset-input-control/custom-value-controls.cjs +10 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs.map +3 -3
- package/build/components/provider/use-media-upload-settings.cjs +1 -0
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +9 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs +4 -4
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/hooks/background.cjs +13 -3
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-fields/link/index.cjs.map +3 -3
- package/build/hooks/block-fields/media/index.cjs.map +3 -3
- package/build/hooks/block-style-state.cjs +112 -0
- package/build/hooks/block-style-state.cjs.map +7 -0
- package/build/hooks/border.cjs +13 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +28 -9
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -6
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +147 -61
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +263 -56
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/state-utils.cjs +94 -0
- package/build/hooks/state-utils.cjs.map +7 -0
- package/build/hooks/states.cjs +124 -0
- package/build/hooks/states.cjs.map +7 -0
- package/build/hooks/style.cjs +304 -17
- package/build/hooks/style.cjs.map +3 -3
- package/build/hooks/typography.cjs +14 -5
- package/build/hooks/typography.cjs.map +2 -2
- package/build/layouts/constrained.cjs +128 -55
- package/build/layouts/constrained.cjs.map +3 -3
- package/build/layouts/flex.cjs +119 -31
- package/build/layouts/flex.cjs.map +3 -3
- package/build/layouts/grid.cjs +103 -40
- package/build/layouts/grid.cjs.map +3 -3
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-actions.cjs +18 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +10 -2
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +32 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +70 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +2 -2
- package/build/utils/color-values.cjs +44 -0
- package/build/utils/color-values.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +52 -45
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs +8 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +166 -13
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs +12 -0
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs.map +7 -0
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +7 -5
- 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-is-hovered.mjs +28 -15
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +4 -4
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +14 -4
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs +13 -3
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +10 -5
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +7 -4
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +25 -27
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +96 -59
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +20 -8
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/index.mjs +2 -0
- package/build-module/components/global-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +39 -28
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +48 -0
- package/build-module/components/global-styles/state-control-badges.mjs.map +7 -0
- package/build-module/components/global-styles/state-control.mjs +57 -71
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs +4 -1
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +8 -7
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs +27 -19
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/panel.mjs +2 -2
- package/build-module/components/inserter/panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs +10 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +18 -5
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +14 -10
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs +1 -4
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +9 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +11 -5
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +20 -9
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs +10 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +1 -0
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +9 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/hooks/background.mjs +18 -3
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +3 -3
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +3 -3
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/block-style-state.mjs +79 -0
- package/build-module/hooks/block-style-state.mjs.map +7 -0
- package/build-module/hooks/border.mjs +18 -3
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +33 -9
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +20 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +141 -61
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +270 -58
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/state-utils.mjs +64 -0
- package/build-module/hooks/state-utils.mjs.map +7 -0
- package/build-module/hooks/states.mjs +85 -0
- package/build-module/hooks/states.mjs.map +7 -0
- package/build-module/hooks/style.mjs +309 -18
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +19 -5
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +130 -57
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +123 -35
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +105 -42
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +4 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +7 -1
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +30 -2
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +69 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/utils.mjs +5 -2
- package/build-module/store/utils.mjs.map +2 -2
- package/build-module/utils/color-values.mjs +19 -0
- package/build-module/utils/color-values.mjs.map +7 -0
- package/build-style/content-rtl.css +18 -3
- package/build-style/content.css +18 -3
- package/build-style/style-rtl.css +14 -17
- package/build-style/style.css +14 -17
- package/package.json +39 -39
- package/src/components/audio-player/index.native.js +7 -3
- package/src/components/block-card/index.js +67 -60
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +2 -2
- package/src/components/block-icon/index.js +5 -2
- package/src/components/block-icon/index.native.js +2 -2
- package/src/components/block-inspector/index.js +153 -7
- package/src/components/block-inspector/inspector-pre-tabs-slot-fill.js +11 -0
- package/src/components/block-list/block-selection-button.native.js +3 -3
- package/src/components/block-list/content.scss +0 -6
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -6
- package/src/components/block-list/use-block-props/use-is-hovered.js +32 -15
- package/src/components/block-lock/modal.js +4 -4
- package/src/components/block-patterns-list/index.js +14 -5
- package/src/components/block-patterns-list/stories/index.story.jsx +2 -0
- package/src/components/block-patterns-list/style.scss +0 -1
- package/src/components/block-popover/index.js +20 -10
- package/src/components/block-toolbar/switch-section-style.js +2 -2
- package/src/components/block-visibility/modal.js +2 -2
- package/src/components/block-visibility/viewport-visibility-info.js +2 -2
- package/src/components/child-layout-control/index.js +15 -8
- package/src/components/child-layout-control/test/index.js +126 -0
- package/src/components/colors-gradients/control.js +10 -8
- package/src/components/colors-gradients/test/control.js +98 -1
- package/src/components/global-styles/advanced-panel.js +44 -39
- package/src/components/global-styles/color-panel.js +133 -60
- package/src/components/global-styles/dimensions-panel.js +29 -8
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/shadow-panel-components.js +29 -19
- package/src/components/global-styles/state-control-badges.js +58 -0
- package/src/components/global-styles/state-control.js +28 -36
- package/src/components/global-styles/test/color-panel.js +135 -0
- package/src/components/iframe/use-scale-canvas.js +8 -2
- package/src/components/inserter/hooks/use-patterns-state.js +12 -7
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/media-tab/media-preview.js +29 -20
- package/src/components/inserter/panel.js +2 -2
- package/src/components/inserter/style.scss +1 -0
- package/src/components/inserter-button/index.native.js +5 -2
- package/src/components/inspector-controls/block-support-tools-panel.js +10 -2
- package/src/components/inspector-controls/fill.js +18 -5
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +9 -5
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -7
- package/src/components/inspector-controls-tabs/styles-tab.js +6 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +13 -7
- package/src/components/list-view/block-select-button.js +19 -9
- package/src/components/list-view/block.js +6 -1
- package/src/components/media-replace-flow/style.scss +0 -18
- package/src/components/preset-input-control/custom-value-controls.js +13 -6
- package/src/components/preset-input-control/index.js +2 -2
- package/src/components/provider/use-media-upload-settings.js +1 -0
- package/src/components/rich-text/event-listeners/enter.js +14 -2
- package/src/components/rich-text/event-listeners/paste-handler.js +5 -4
- package/src/components/unsupported-block-details/index.native.js +6 -2
- package/src/components/video-player/index.native.js +2 -2
- package/src/components/warning/index.native.js +2 -2
- package/src/hooks/background.js +59 -37
- package/src/hooks/block-fields/link/index.js +3 -3
- package/src/hooks/block-fields/media/index.js +3 -3
- package/src/hooks/block-style-state.js +127 -0
- package/src/hooks/border.js +25 -6
- package/src/hooks/color.js +40 -18
- package/src/hooks/dimensions.js +32 -11
- package/src/hooks/layout-child.js +179 -62
- package/src/hooks/layout.js +349 -75
- package/src/hooks/layout.scss +6 -0
- package/src/hooks/state-utils.js +158 -0
- package/src/hooks/states.js +109 -0
- package/src/hooks/style.js +456 -19
- package/src/hooks/test/block-style-state.js +270 -0
- package/src/hooks/test/layout.js +185 -0
- package/src/hooks/test/state-utils.js +193 -0
- package/src/hooks/test/style.js +301 -1
- package/src/hooks/typography.js +33 -14
- package/src/layouts/constrained.js +182 -95
- package/src/layouts/flex.js +141 -36
- package/src/layouts/grid.js +122 -32
- package/src/layouts/test/flex.js +57 -20
- package/src/private-apis.js +4 -0
- package/src/store/private-actions.js +32 -0
- package/src/store/private-keys.js +4 -0
- package/src/store/private-selectors.js +61 -2
- package/src/store/reducer.js +105 -1
- package/src/store/test/private-actions.js +26 -0
- package/src/store/test/private-selectors.js +143 -0
- package/src/store/test/reducer.js +363 -0
- package/src/store/utils.js +6 -2
- package/src/utils/color-values.js +28 -0
- package/src/utils/test/color-values.js +78 -0
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { check, chevronDown } from '@wordpress/icons';
|
|
6
|
-
import {
|
|
7
|
-
DropdownMenu,
|
|
8
|
-
MenuGroup,
|
|
9
|
-
MenuItem,
|
|
10
|
-
privateApis as componentsPrivateApis,
|
|
11
|
-
} from '@wordpress/components';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
import { check, chevronDown, moreVertical } from '@wordpress/icons';
|
|
6
|
+
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
12
7
|
import { Stack } from '@wordpress/ui';
|
|
13
8
|
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import { unlock } from '../../lock-unlock';
|
|
18
|
-
|
|
19
|
-
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
20
|
-
|
|
21
9
|
/**
|
|
22
10
|
* State control for managing viewport and pseudo-state styles.
|
|
23
11
|
* Displays a dropdown menu with separate groups for each selector.
|
|
@@ -29,6 +17,8 @@ const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
|
29
17
|
* @param {string} props.pseudoStateValue Currently selected pseudo state value.
|
|
30
18
|
* @param {Function} props.onChangeViewport Callback when viewport selection changes.
|
|
31
19
|
* @param {Function} props.onChangePseudoState Callback when pseudo state selection changes.
|
|
20
|
+
* @param {boolean} props.showText Whether to show text label on the toggle. Default true.
|
|
21
|
+
* @param {Object} props.popoverProps Popover props for the dropdown menu.
|
|
32
22
|
* @return {Element|null} State control component.
|
|
33
23
|
*/
|
|
34
24
|
export default function StateControl( {
|
|
@@ -38,6 +28,8 @@ export default function StateControl( {
|
|
|
38
28
|
pseudoStateValue = 'default',
|
|
39
29
|
onChangeViewport,
|
|
40
30
|
onChangePseudoState,
|
|
31
|
+
showText = true,
|
|
32
|
+
popoverProps = {},
|
|
41
33
|
} ) {
|
|
42
34
|
if ( ! viewportStates.length && ! pseudoStates.length ) {
|
|
43
35
|
return null;
|
|
@@ -89,6 +81,14 @@ export default function StateControl( {
|
|
|
89
81
|
}
|
|
90
82
|
}
|
|
91
83
|
|
|
84
|
+
const currentStateLabel = activeStates.length
|
|
85
|
+
? activeStates.map( ( state ) => state.label ).join( ', ' )
|
|
86
|
+
: __( 'Default' );
|
|
87
|
+
const icon = showText ? chevronDown : moreVertical;
|
|
88
|
+
const toggleProps = showText
|
|
89
|
+
? { size: 'compact', variant: 'tertiary', iconPosition: 'right' }
|
|
90
|
+
: { size: 'compact', variant: 'tertiary' };
|
|
91
|
+
|
|
92
92
|
return (
|
|
93
93
|
<Stack
|
|
94
94
|
direction="column"
|
|
@@ -97,17 +97,22 @@ export default function StateControl( {
|
|
|
97
97
|
className="block-editor-global-styles-state-control"
|
|
98
98
|
>
|
|
99
99
|
<DropdownMenu
|
|
100
|
-
icon={
|
|
101
|
-
label={
|
|
100
|
+
icon={ icon }
|
|
101
|
+
label={
|
|
102
|
+
showText
|
|
103
|
+
? triggerLabel
|
|
104
|
+
: sprintf(
|
|
105
|
+
/* translators: %s: Current state (e.g. "Hover", "Focus") */
|
|
106
|
+
__( 'State: %s' ),
|
|
107
|
+
currentStateLabel
|
|
108
|
+
)
|
|
109
|
+
}
|
|
102
110
|
popoverProps={ {
|
|
103
111
|
placement: 'right-start',
|
|
112
|
+
...popoverProps,
|
|
104
113
|
} }
|
|
105
|
-
text={ triggerLabel }
|
|
106
|
-
toggleProps={
|
|
107
|
-
size: 'compact',
|
|
108
|
-
variant: 'tertiary',
|
|
109
|
-
iconPosition: 'right',
|
|
110
|
-
} }
|
|
114
|
+
text={ showText ? triggerLabel : undefined }
|
|
115
|
+
toggleProps={ toggleProps }
|
|
111
116
|
>
|
|
112
117
|
{ ( { onClose } ) => (
|
|
113
118
|
<>
|
|
@@ -160,19 +165,6 @@ export default function StateControl( {
|
|
|
160
165
|
</>
|
|
161
166
|
) }
|
|
162
167
|
</DropdownMenu>
|
|
163
|
-
<Stack
|
|
164
|
-
className="block-editor-global-styles-state-control__badges"
|
|
165
|
-
direction="row"
|
|
166
|
-
justify="flex-start"
|
|
167
|
-
gap="xs"
|
|
168
|
-
wrap="wrap"
|
|
169
|
-
>
|
|
170
|
-
{ activeStates.map( ( activeState ) => (
|
|
171
|
-
<WCBadge key={ activeState.key } intent="info">
|
|
172
|
-
{ activeState.label }
|
|
173
|
-
</WCBadge>
|
|
174
|
-
) ) }
|
|
175
|
-
</Stack>
|
|
176
168
|
</Stack>
|
|
177
169
|
);
|
|
178
170
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { screen } from '@testing-library/react';
|
|
5
|
+
import { click, render } from '@ariakit/test/react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import ColorPanel from '../color-panel';
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Shared fixtures
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
// Two palette entries that share the same decoded hex value (#000) but carry
|
|
17
|
+
// distinct slugs. This mirrors the duplicate-color scenario that motivated
|
|
18
|
+
// the slug-based selection work.
|
|
19
|
+
const DUPLICATE_PALETTE_SETTINGS = {
|
|
20
|
+
color: {
|
|
21
|
+
text: true,
|
|
22
|
+
link: false, // keep the panel simple so button queries are unambiguous
|
|
23
|
+
background: false,
|
|
24
|
+
custom: false,
|
|
25
|
+
customGradient: false,
|
|
26
|
+
defaultPalette: false,
|
|
27
|
+
palette: {
|
|
28
|
+
theme: [
|
|
29
|
+
{
|
|
30
|
+
color: '#000',
|
|
31
|
+
name: 'Dark Background',
|
|
32
|
+
slug: 'dark-background',
|
|
33
|
+
},
|
|
34
|
+
{ color: '#000', name: 'Dark Text', slug: 'dark-text' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// ColorPanel — setTextColor behaviour (render tests)
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
describe( 'ColorPanel — setTextColor', () => {
|
|
45
|
+
// Helper: open the Text-color dropdown and return the rendered swatches.
|
|
46
|
+
async function openTextDropdown() {
|
|
47
|
+
await click(
|
|
48
|
+
screen.getByRole( 'button', { name: /Text/, expanded: false } )
|
|
49
|
+
);
|
|
50
|
+
// `findAllByRole` waits for the Popover/portal content to appear.
|
|
51
|
+
return screen.findAllByRole( 'option' );
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
it( 'encodes a slug-selected color as var:preset|color|<slug> rather than falling back to a hex-value lookup', async () => {
|
|
55
|
+
const onChange = jest.fn();
|
|
56
|
+
|
|
57
|
+
await render(
|
|
58
|
+
<ColorPanel
|
|
59
|
+
value={ {} }
|
|
60
|
+
inheritedValue={ {} }
|
|
61
|
+
settings={ DUPLICATE_PALETTE_SETTINGS }
|
|
62
|
+
panelId="test"
|
|
63
|
+
onChange={ onChange }
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const swatches = await openTextDropdown();
|
|
68
|
+
// swatch[0] = 'dark-background', swatch[1] = 'dark-text'
|
|
69
|
+
await click( swatches[ 1 ] );
|
|
70
|
+
|
|
71
|
+
expect( onChange ).toHaveBeenCalledTimes( 1 );
|
|
72
|
+
const result = onChange.mock.calls[ 0 ][ 0 ];
|
|
73
|
+
// The slug must be encoded directly: not looked up by hex value.
|
|
74
|
+
expect( result?.color?.text ).toBe( 'var:preset|color|dark-text' );
|
|
75
|
+
} );
|
|
76
|
+
|
|
77
|
+
it( 'syncs the link color when text and link share the same raw preset reference', async () => {
|
|
78
|
+
const onChange = jest.fn();
|
|
79
|
+
const sharedRef = 'var:preset|color|dark-background';
|
|
80
|
+
|
|
81
|
+
await render(
|
|
82
|
+
<ColorPanel
|
|
83
|
+
value={ {} }
|
|
84
|
+
inheritedValue={ {
|
|
85
|
+
color: { text: sharedRef },
|
|
86
|
+
elements: { link: { color: { text: sharedRef } } },
|
|
87
|
+
} }
|
|
88
|
+
settings={ DUPLICATE_PALETTE_SETTINGS }
|
|
89
|
+
panelId="test"
|
|
90
|
+
onChange={ onChange }
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const swatches = await openTextDropdown();
|
|
95
|
+
await click( swatches[ 1 ] );
|
|
96
|
+
|
|
97
|
+
const result = onChange.mock.calls[ 0 ][ 0 ];
|
|
98
|
+
expect( result?.color?.text ).toBe( 'var:preset|color|dark-text' );
|
|
99
|
+
// Link must be kept in sync because text and link shared the same ref.
|
|
100
|
+
expect( result?.elements?.link?.color?.text ).toBe(
|
|
101
|
+
'var:preset|color|dark-text'
|
|
102
|
+
);
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
it( 'does NOT sync the link color when text and link have different raw refs, even if their decoded hex values match', async () => {
|
|
106
|
+
const onChange = jest.fn();
|
|
107
|
+
|
|
108
|
+
await render(
|
|
109
|
+
<ColorPanel
|
|
110
|
+
value={ {} }
|
|
111
|
+
inheritedValue={ {
|
|
112
|
+
// Both resolve to #000, but they are different preset references.
|
|
113
|
+
color: { text: 'var:preset|color|dark-background' },
|
|
114
|
+
elements: {
|
|
115
|
+
link: {
|
|
116
|
+
color: { text: 'var:preset|color|dark-text' },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
} }
|
|
120
|
+
settings={ DUPLICATE_PALETTE_SETTINGS }
|
|
121
|
+
panelId="test"
|
|
122
|
+
onChange={ onChange }
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const swatches = await openTextDropdown();
|
|
127
|
+
await click( swatches[ 1 ] );
|
|
128
|
+
|
|
129
|
+
const result = onChange.mock.calls[ 0 ][ 0 ];
|
|
130
|
+
expect( result?.color?.text ).toBe( 'var:preset|color|dark-text' );
|
|
131
|
+
// Link must NOT be updated: raw-ref identity is what matters,
|
|
132
|
+
// not decoded-value equality.
|
|
133
|
+
expect( result?.elements?.link?.color?.text ).toBeUndefined();
|
|
134
|
+
} );
|
|
135
|
+
} );
|
|
@@ -312,8 +312,14 @@ export function useScaleCanvas( {
|
|
|
312
312
|
* changes due to the container resizing.
|
|
313
313
|
*/
|
|
314
314
|
useEffect( () => {
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
// Wait for the iframe document so a zoom out state that is already
|
|
316
|
+
// active on mount (e.g. when the canvas is remounted on a viewport
|
|
317
|
+
// change) is still detected as a transition.
|
|
318
|
+
if ( ! iframeDocument ) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const trigger = previousIsZoomedOut.current !== isZoomedOut;
|
|
317
323
|
|
|
318
324
|
previousIsZoomedOut.current = isZoomedOut;
|
|
319
325
|
|
|
@@ -12,7 +12,10 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
12
12
|
*/
|
|
13
13
|
import { store as blockEditorStore } from '../../../store';
|
|
14
14
|
import { unlock } from '../../../lock-unlock';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
isNavigationOverlayContextKey,
|
|
17
|
+
userPatternCategoriesSelectKey,
|
|
18
|
+
} from '../../../store/private-keys';
|
|
16
19
|
import { INSERTER_PATTERN_TYPES } from '../block-patterns-tab/utils';
|
|
17
20
|
import { isFiltered } from '../../../store/utils';
|
|
18
21
|
|
|
@@ -51,17 +54,19 @@ const usePatternsState = (
|
|
|
51
54
|
const { getSettings, __experimentalGetAllowedPatterns } = unlock(
|
|
52
55
|
select( blockEditorStore )
|
|
53
56
|
);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = getSettings();
|
|
57
|
+
const settings = getSettings();
|
|
58
|
+
const userPatternCategoriesSelect =
|
|
59
|
+
settings[ userPatternCategoriesSelectKey ];
|
|
58
60
|
return {
|
|
59
61
|
patterns: __experimentalGetAllowedPatterns(
|
|
60
62
|
rootClientId,
|
|
61
63
|
options
|
|
62
64
|
),
|
|
63
|
-
userPatternCategories:
|
|
64
|
-
|
|
65
|
+
userPatternCategories: userPatternCategoriesSelect
|
|
66
|
+
? userPatternCategoriesSelect( select )
|
|
67
|
+
: settings.__experimentalUserPatternCategories,
|
|
68
|
+
patternCategories:
|
|
69
|
+
settings.__experimentalBlockPatternCategories,
|
|
65
70
|
};
|
|
66
71
|
},
|
|
67
72
|
[ rootClientId, options ]
|
|
@@ -73,6 +73,7 @@ const defaultRenderToggle = ( {
|
|
|
73
73
|
className="block-editor-inserter__toggle"
|
|
74
74
|
aria-haspopup={ ! hasSingleBlockType ? 'true' : false }
|
|
75
75
|
aria-expanded={ ! hasSingleBlockType ? isOpen : false }
|
|
76
|
+
isPressed={ ! hasSingleBlockType && isOpen }
|
|
76
77
|
disabled={ disabled }
|
|
77
78
|
{ ...rest }
|
|
78
79
|
/>
|
|
@@ -7,7 +7,6 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
Tooltip,
|
|
11
10
|
DropdownMenu,
|
|
12
11
|
MenuGroup,
|
|
13
12
|
MenuItem,
|
|
@@ -28,6 +27,9 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
28
27
|
import { isBlobURL } from '@wordpress/blob';
|
|
29
28
|
import { getFilename } from '@wordpress/url';
|
|
30
29
|
|
|
30
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
31
|
+
import { Tooltip } from '@wordpress/ui';
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* Internal dependencies
|
|
33
35
|
*/
|
|
@@ -261,27 +263,34 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
261
263
|
onMouseEnter={ onMouseEnter }
|
|
262
264
|
onMouseLeave={ onMouseLeave }
|
|
263
265
|
>
|
|
264
|
-
<Tooltip
|
|
265
|
-
<
|
|
266
|
+
<Tooltip.Root>
|
|
267
|
+
<Tooltip.Trigger
|
|
266
268
|
render={
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
269
|
+
<Composite.Item
|
|
270
|
+
render={
|
|
271
|
+
<div
|
|
272
|
+
aria-label={ title }
|
|
273
|
+
role="option"
|
|
274
|
+
className="block-editor-inserter__media-list__item"
|
|
275
|
+
/>
|
|
276
|
+
}
|
|
277
|
+
onClick={ () =>
|
|
278
|
+
onMediaInsert( block )
|
|
279
|
+
}
|
|
280
|
+
>
|
|
281
|
+
<div className="block-editor-inserter__media-list__item-preview">
|
|
282
|
+
{ preview }
|
|
283
|
+
{ isInserting && (
|
|
284
|
+
<div className="block-editor-inserter__media-list__item-preview-spinner">
|
|
285
|
+
<Spinner />
|
|
286
|
+
</div>
|
|
287
|
+
) }
|
|
280
288
|
</div>
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
289
|
+
</Composite.Item>
|
|
290
|
+
}
|
|
291
|
+
/>
|
|
292
|
+
<Tooltip.Popup>{ title }</Tooltip.Popup>
|
|
293
|
+
</Tooltip.Root>
|
|
285
294
|
{ ! isInserting && (
|
|
286
295
|
<MediaPreviewOptions
|
|
287
296
|
category={ category }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Icon } from '@wordpress/components';
|
|
4
|
+
import { Icon as WCIcon } from '@wordpress/components';
|
|
5
5
|
|
|
6
6
|
function InserterPanel( { title, icon, children } ) {
|
|
7
7
|
return (
|
|
@@ -10,7 +10,7 @@ function InserterPanel( { title, icon, children } ) {
|
|
|
10
10
|
<h2 className="block-editor-inserter__panel-title">
|
|
11
11
|
{ title }
|
|
12
12
|
</h2>
|
|
13
|
-
<
|
|
13
|
+
<WCIcon icon={ icon } />
|
|
14
14
|
</div>
|
|
15
15
|
<div className="block-editor-inserter__panel-content">
|
|
16
16
|
{ children }
|
|
@@ -7,7 +7,7 @@ import { View, TouchableHighlight, Text } from 'react-native';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useCallback } from '@wordpress/element';
|
|
10
|
-
import { Icon } from '@wordpress/components';
|
|
10
|
+
import { Icon as WCIcon } from '@wordpress/components';
|
|
11
11
|
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
12
12
|
import { __, sprintf } from '@wordpress/i18n';
|
|
13
13
|
|
|
@@ -78,7 +78,10 @@ function MenuItem( {
|
|
|
78
78
|
] }
|
|
79
79
|
>
|
|
80
80
|
{ blockIsNew && (
|
|
81
|
-
<
|
|
81
|
+
<WCIcon
|
|
82
|
+
icon={ sparkles }
|
|
83
|
+
style={ styles.newIndicator }
|
|
84
|
+
/>
|
|
82
85
|
) }
|
|
83
86
|
<View style={ modalIconStyle }>
|
|
84
87
|
<BlockIcon
|
|
@@ -16,6 +16,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) {
|
|
|
16
16
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
17
17
|
const {
|
|
18
18
|
getBlockAttributes,
|
|
19
|
+
getBlockName,
|
|
19
20
|
getMultiSelectedBlockClientIds,
|
|
20
21
|
getSelectedBlockClientId,
|
|
21
22
|
hasMultiSelection,
|
|
@@ -31,13 +32,19 @@ export default function BlockSupportToolsPanel( { children, group, label } ) {
|
|
|
31
32
|
: [ panelId ];
|
|
32
33
|
|
|
33
34
|
clientIds.forEach( ( clientId ) => {
|
|
34
|
-
const
|
|
35
|
+
const blockAttributes = getBlockAttributes( clientId ) || {};
|
|
36
|
+
const { style } = blockAttributes;
|
|
35
37
|
let newBlockAttributes = { style };
|
|
38
|
+
const resetContext = {
|
|
39
|
+
attributes: blockAttributes,
|
|
40
|
+
clientId,
|
|
41
|
+
name: getBlockName( clientId ),
|
|
42
|
+
};
|
|
36
43
|
|
|
37
44
|
resetFilters.forEach( ( resetFilter ) => {
|
|
38
45
|
newBlockAttributes = {
|
|
39
46
|
...newBlockAttributes,
|
|
40
|
-
...resetFilter( newBlockAttributes ),
|
|
47
|
+
...resetFilter( newBlockAttributes, resetContext ),
|
|
41
48
|
};
|
|
42
49
|
} );
|
|
43
50
|
|
|
@@ -54,6 +61,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) {
|
|
|
54
61
|
},
|
|
55
62
|
[
|
|
56
63
|
getBlockAttributes,
|
|
64
|
+
getBlockName,
|
|
57
65
|
getMultiSelectedBlockClientIds,
|
|
58
66
|
hasMultiSelection,
|
|
59
67
|
panelId,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import warning from '@wordpress/warning';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
10
|
-
import { useEffect, useContext } from '@wordpress/element';
|
|
10
|
+
import { useEffect, useContext, useMemo } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -19,6 +19,10 @@ import {
|
|
|
19
19
|
isInListViewBlockSupportTreeKey,
|
|
20
20
|
} from '../block-edit/context';
|
|
21
21
|
import groups from './groups';
|
|
22
|
+
import {
|
|
23
|
+
scopeResetAllFilterToState,
|
|
24
|
+
useBlockStyleState,
|
|
25
|
+
} from '../../hooks/block-style-state';
|
|
22
26
|
import { ListViewContentFill } from './list-view-content-popover';
|
|
23
27
|
|
|
24
28
|
const PATTERN_EDITING_GROUPS = [ 'content', 'list' ];
|
|
@@ -117,18 +121,27 @@ export default function InspectorControlsFill( {
|
|
|
117
121
|
function RegisterResetAll( { resetAllFilter, children } ) {
|
|
118
122
|
const { registerResetAllFilter, deregisterResetAllFilter } =
|
|
119
123
|
useContext( ToolsPanelContext );
|
|
124
|
+
const selectedState = useBlockStyleState();
|
|
125
|
+
const scopedResetAllFilter = useMemo(
|
|
126
|
+
() => scopeResetAllFilterToState( selectedState, resetAllFilter ),
|
|
127
|
+
[ resetAllFilter, selectedState ]
|
|
128
|
+
);
|
|
120
129
|
useEffect( () => {
|
|
121
130
|
if (
|
|
122
|
-
|
|
131
|
+
scopedResetAllFilter &&
|
|
123
132
|
registerResetAllFilter &&
|
|
124
133
|
deregisterResetAllFilter
|
|
125
134
|
) {
|
|
126
|
-
registerResetAllFilter(
|
|
135
|
+
registerResetAllFilter( scopedResetAllFilter );
|
|
127
136
|
return () => {
|
|
128
|
-
deregisterResetAllFilter(
|
|
137
|
+
deregisterResetAllFilter( scopedResetAllFilter );
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
|
-
}, [
|
|
140
|
+
}, [
|
|
141
|
+
scopedResetAllFilter,
|
|
142
|
+
registerResetAllFilter,
|
|
143
|
+
deregisterResetAllFilter,
|
|
144
|
+
] );
|
|
132
145
|
return children;
|
|
133
146
|
}
|
|
134
147
|
|
|
@@ -15,6 +15,7 @@ const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
|
|
|
15
15
|
const InspectorControlsDimensions = createSlotFill(
|
|
16
16
|
'InspectorControlsDimensions'
|
|
17
17
|
);
|
|
18
|
+
const InspectorControlsLayout = createSlotFill( 'InspectorControlsLayout' );
|
|
18
19
|
const InspectorControlsPosition = createSlotFill( 'InspectorControlsPosition' );
|
|
19
20
|
const InspectorControlsTypography = createSlotFill(
|
|
20
21
|
'InspectorControlsTypography'
|
|
@@ -35,6 +36,7 @@ const groups = {
|
|
|
35
36
|
dimensions: InspectorControlsDimensions,
|
|
36
37
|
effects: InspectorControlsEffects,
|
|
37
38
|
filter: InspectorControlsFilter,
|
|
39
|
+
layout: InspectorControlsLayout,
|
|
38
40
|
list: InspectorControlsListView,
|
|
39
41
|
position: InspectorControlsPosition,
|
|
40
42
|
settings: InspectorControlsDefault, // Alias for default.
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
Icon,
|
|
6
|
-
Tooltip,
|
|
5
|
+
Icon as WCIcon,
|
|
7
6
|
privateApis as componentsPrivateApis,
|
|
8
7
|
} from '@wordpress/components';
|
|
9
8
|
import { useEffect, useState, useRef } from '@wordpress/element';
|
|
10
9
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
11
|
|
|
12
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
13
|
+
import { Tooltip } from '@wordpress/ui';
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
15
17
|
*/
|
|
@@ -175,14 +177,16 @@ export default function InspectorControlsTabs( {
|
|
|
175
177
|
{ tab.title }
|
|
176
178
|
</Tabs.Tab>
|
|
177
179
|
) : (
|
|
178
|
-
<Tooltip
|
|
180
|
+
<Tooltip.Root key={ tab.name }>
|
|
179
181
|
<Tabs.Tab
|
|
180
182
|
tabId={ tab.name }
|
|
181
183
|
aria-label={ tab.title }
|
|
184
|
+
render={ <Tooltip.Trigger /> }
|
|
182
185
|
>
|
|
183
|
-
<
|
|
186
|
+
<WCIcon icon={ tab.icon } />
|
|
184
187
|
</Tabs.Tab>
|
|
185
|
-
|
|
188
|
+
<Tooltip.Popup>{ tab.title }</Tooltip.Popup>
|
|
189
|
+
</Tooltip.Root>
|
|
186
190
|
)
|
|
187
191
|
) }
|
|
188
192
|
</Tabs.TabList>
|
|
@@ -7,26 +7,20 @@ import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/component
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import AdvancedControls from './advanced-controls-panel';
|
|
10
|
-
import PositionControls from './position-controls-panel';
|
|
11
10
|
import { default as InspectorControls } from '../inspector-controls';
|
|
12
11
|
import groups from '../inspector-controls/groups';
|
|
13
12
|
|
|
14
13
|
const SettingsTab = ( { showAdvancedControls = false } ) => {
|
|
15
14
|
const defaultFills = useSlotFills( groups.default.name );
|
|
16
|
-
const positionFills = useSlotFills( groups.position.name );
|
|
17
15
|
const bindingsFills = useSlotFills( groups.bindings.name );
|
|
18
16
|
|
|
19
17
|
// Expand the advanced panel when there are no other fills
|
|
20
18
|
// in the settings tab.
|
|
21
|
-
const hasOtherFills =
|
|
22
|
-
!! defaultFills?.length ||
|
|
23
|
-
!! positionFills?.length ||
|
|
24
|
-
!! bindingsFills?.length;
|
|
19
|
+
const hasOtherFills = !! defaultFills?.length || !! bindingsFills?.length;
|
|
25
20
|
|
|
26
21
|
return (
|
|
27
22
|
<>
|
|
28
23
|
<InspectorControls.Slot />
|
|
29
|
-
<PositionControls />
|
|
30
24
|
<InspectorControls.Slot group="bindings" />
|
|
31
25
|
{ showAdvancedControls && (
|
|
32
26
|
<div>
|
|
@@ -9,6 +9,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
import BlockStyles from '../block-styles';
|
|
11
11
|
import InspectorControls from '../inspector-controls';
|
|
12
|
+
import PositionControls from './position-controls-panel';
|
|
12
13
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
13
14
|
import { useBlockSettings } from '../../hooks/utils';
|
|
14
15
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -95,6 +96,10 @@ const StylesTab = ( {
|
|
|
95
96
|
group="typography"
|
|
96
97
|
label={ __( 'Typography' ) }
|
|
97
98
|
/>
|
|
99
|
+
<InspectorControls.Slot
|
|
100
|
+
group="layout"
|
|
101
|
+
label={ __( 'Layout' ) }
|
|
102
|
+
/>
|
|
98
103
|
<InspectorControls.Slot
|
|
99
104
|
group="dimensions"
|
|
100
105
|
label={ __( 'Dimensions' ) }
|
|
@@ -103,6 +108,7 @@ const StylesTab = ( {
|
|
|
103
108
|
group="border"
|
|
104
109
|
label={ borderPanelLabel }
|
|
105
110
|
/>
|
|
111
|
+
<PositionControls />
|
|
106
112
|
<InspectorControls.Slot group="styles" />
|
|
107
113
|
</>
|
|
108
114
|
) }
|