@wordpress/block-editor 15.19.1-next.v.202605131032.0 → 15.20.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 +15 -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/index.cjs +1 -1
- 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 +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/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 +11 -5
- 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/index.cjs +0 -3
- package/build/components/iframe/index.cjs.map +2 -2
- 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/media-tab/utils.cjs +1 -1
- package/build/components/inserter/media-tab/utils.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 +26 -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/index.mjs +1 -1
- 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 +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/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 +14 -5
- 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/index.mjs +0 -3
- package/build-module/components/iframe/index.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/media-tab/utils.mjs +1 -1
- package/build-module/components/inserter/media-tab/utils.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 +25 -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 +41 -41
- 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/index.js +1 -1
- 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/colors/test/with-colors.js +1 -1
- 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 +17 -4
- 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/index.js +0 -3
- 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/media-tab/utils.js +1 -1
- 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 +44 -2
- package/src/store/reducer.js +105 -1
- package/src/store/test/private-actions.js +26 -0
- package/src/store/test/private-selectors.js +90 -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
|
@@ -29,10 +29,17 @@ import ChildLayoutControl from '../child-layout-control';
|
|
|
29
29
|
import AspectRatioTool from '../dimensions-tool/aspect-ratio-tool';
|
|
30
30
|
import { cleanEmptyObject } from '../../hooks/utils';
|
|
31
31
|
import { setImmutably } from '../../utils/object';
|
|
32
|
+
import {
|
|
33
|
+
DEFAULT_BLOCK_STYLE_STATE,
|
|
34
|
+
hasPseudoBlockStyleState,
|
|
35
|
+
} from '../../hooks/block-style-state';
|
|
32
36
|
|
|
33
37
|
const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
34
38
|
|
|
35
|
-
export function useHasDimensionsPanel(
|
|
39
|
+
export function useHasDimensionsPanel(
|
|
40
|
+
settings,
|
|
41
|
+
styleState = DEFAULT_BLOCK_STYLE_STATE
|
|
42
|
+
) {
|
|
36
43
|
return (
|
|
37
44
|
Platform.OS === 'web' &&
|
|
38
45
|
( hasContentSize( settings ) ||
|
|
@@ -45,7 +52,7 @@ export function useHasDimensionsPanel( settings ) {
|
|
|
45
52
|
hasMinWidth( settings ) ||
|
|
46
53
|
hasWidth( settings ) ||
|
|
47
54
|
hasAspectRatio( settings ) ||
|
|
48
|
-
hasChildLayout( settings ) )
|
|
55
|
+
hasChildLayout( settings, styleState ) )
|
|
49
56
|
);
|
|
50
57
|
}
|
|
51
58
|
|
|
@@ -89,7 +96,11 @@ function hasAspectRatio( settings ) {
|
|
|
89
96
|
return settings?.dimensions?.aspectRatio;
|
|
90
97
|
}
|
|
91
98
|
|
|
92
|
-
function hasChildLayout( settings ) {
|
|
99
|
+
function hasChildLayout( settings, styleState = DEFAULT_BLOCK_STYLE_STATE ) {
|
|
100
|
+
if ( hasPseudoBlockStyleState( styleState ) ) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
const {
|
|
94
105
|
type: parentLayoutType = 'default',
|
|
95
106
|
default: { type: defaultParentLayoutType = 'default' } = {},
|
|
@@ -231,6 +242,7 @@ export default function DimensionsPanel( {
|
|
|
231
242
|
// Special case because the layout controls are not part of the dimensions panel
|
|
232
243
|
// in global styles but not in block inspector.
|
|
233
244
|
includeLayoutControls = false,
|
|
245
|
+
styleState = DEFAULT_BLOCK_STYLE_STATE,
|
|
234
246
|
} ) {
|
|
235
247
|
const { dimensions, spacing } = settings;
|
|
236
248
|
|
|
@@ -490,13 +502,14 @@ export default function DimensionsPanel( {
|
|
|
490
502
|
const hasAspectRatioValue = () => !! value?.dimensions?.aspectRatio;
|
|
491
503
|
|
|
492
504
|
// Child Layout
|
|
493
|
-
const showChildLayoutControl = hasChildLayout( settings );
|
|
505
|
+
const showChildLayoutControl = hasChildLayout( settings, styleState );
|
|
494
506
|
const childLayout = inheritedValue?.layout;
|
|
495
507
|
|
|
496
508
|
const setChildLayout = ( newChildLayout ) => {
|
|
497
509
|
onChange( {
|
|
498
510
|
...value,
|
|
499
511
|
layout: {
|
|
512
|
+
...value?.layout,
|
|
500
513
|
...newChildLayout,
|
|
501
514
|
},
|
|
502
515
|
} );
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
FlexItem,
|
|
12
12
|
Dropdown,
|
|
13
13
|
Composite,
|
|
14
|
-
Tooltip,
|
|
15
14
|
} from '@wordpress/components';
|
|
16
15
|
import { useMemo, useRef } from '@wordpress/element';
|
|
17
16
|
import { shadow as shadowIcon, Icon, check, reset } from '@wordpress/icons';
|
|
@@ -21,6 +20,9 @@ import { shadow as shadowIcon, Icon, check, reset } from '@wordpress/icons';
|
|
|
21
20
|
*/
|
|
22
21
|
import clsx from 'clsx';
|
|
23
22
|
|
|
23
|
+
// 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.
|
|
24
|
+
import { Tooltip } from '@wordpress/ui';
|
|
25
|
+
|
|
24
26
|
/**
|
|
25
27
|
* Shared reference to an empty array for cases where it is important to avoid
|
|
26
28
|
* returning a new array reference on every invocation.
|
|
@@ -82,31 +84,39 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) {
|
|
|
82
84
|
|
|
83
85
|
export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) {
|
|
84
86
|
return (
|
|
85
|
-
<Tooltip
|
|
86
|
-
<
|
|
87
|
-
role="option"
|
|
88
|
-
aria-label={ label }
|
|
89
|
-
aria-selected={ isActive }
|
|
90
|
-
className={ clsx( 'block-editor-global-styles__shadow__item', {
|
|
91
|
-
'is-active': isActive,
|
|
92
|
-
} ) }
|
|
87
|
+
<Tooltip.Root>
|
|
88
|
+
<Tooltip.Trigger
|
|
93
89
|
render={
|
|
94
|
-
<
|
|
90
|
+
<Composite.Item
|
|
91
|
+
role="option"
|
|
92
|
+
aria-label={ label }
|
|
93
|
+
aria-selected={ isActive }
|
|
95
94
|
className={ clsx(
|
|
96
|
-
'block-editor-global-
|
|
95
|
+
'block-editor-global-styles__shadow__item',
|
|
97
96
|
{
|
|
98
|
-
|
|
97
|
+
'is-active': isActive,
|
|
99
98
|
}
|
|
100
99
|
) }
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
render={
|
|
101
|
+
<button
|
|
102
|
+
className={ clsx(
|
|
103
|
+
'block-editor-global-styles__shadow-indicator',
|
|
104
|
+
{
|
|
105
|
+
unset: type === 'unset',
|
|
106
|
+
}
|
|
107
|
+
) }
|
|
108
|
+
onClick={ onSelect }
|
|
109
|
+
style={ { boxShadow: shadow } }
|
|
110
|
+
aria-label={ label }
|
|
111
|
+
>
|
|
112
|
+
{ isActive && <Icon icon={ check } /> }
|
|
113
|
+
</button>
|
|
114
|
+
}
|
|
115
|
+
/>
|
|
107
116
|
}
|
|
108
117
|
/>
|
|
109
|
-
|
|
118
|
+
<Tooltip.Popup>{ label }</Tooltip.Popup>
|
|
119
|
+
</Tooltip.Root>
|
|
110
120
|
);
|
|
111
121
|
}
|
|
112
122
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
|
+
import { Stack } from '@wordpress/ui';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { unlock } from '../../lock-unlock';
|
|
11
|
+
|
|
12
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
13
|
+
|
|
14
|
+
export default function StateControlBadges( {
|
|
15
|
+
viewportStates = [],
|
|
16
|
+
pseudoStates = [],
|
|
17
|
+
viewportValue = 'default',
|
|
18
|
+
pseudoStateValue = 'default',
|
|
19
|
+
className = 'block-editor-global-styles-state-control__badges',
|
|
20
|
+
} ) {
|
|
21
|
+
const activeStates = [];
|
|
22
|
+
const selectedViewport = viewportStates.find(
|
|
23
|
+
( state ) => state.value === viewportValue
|
|
24
|
+
);
|
|
25
|
+
const selectedPseudoState = pseudoStates.find(
|
|
26
|
+
( state ) => state.value === pseudoStateValue
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if ( selectedViewport ) {
|
|
30
|
+
activeStates.push( {
|
|
31
|
+
key: `viewport-${ selectedViewport.value }`,
|
|
32
|
+
label: selectedViewport.label,
|
|
33
|
+
} );
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ( selectedPseudoState ) {
|
|
37
|
+
activeStates.push( {
|
|
38
|
+
key: `pseudo-${ selectedPseudoState.value }`,
|
|
39
|
+
label: selectedPseudoState.label,
|
|
40
|
+
} );
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Stack
|
|
45
|
+
className={ className }
|
|
46
|
+
direction="row"
|
|
47
|
+
justify="flex-start"
|
|
48
|
+
gap="xs"
|
|
49
|
+
wrap="wrap"
|
|
50
|
+
>
|
|
51
|
+
{ activeStates.map( ( state ) => (
|
|
52
|
+
<WCBadge key={ state.key } intent="info">
|
|
53
|
+
{ state.label }
|
|
54
|
+
</WCBadge>
|
|
55
|
+
) ) }
|
|
56
|
+
</Stack>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -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
|
+
} );
|
|
@@ -125,9 +125,6 @@ function getIframeSrc( resolvedAssets ) {
|
|
|
125
125
|
${ resolvedAssets.styles ?? '' }
|
|
126
126
|
${ resolvedAssets.scripts ?? '' }
|
|
127
127
|
</head>
|
|
128
|
-
<body>
|
|
129
|
-
<script>document.currentScript.parentElement.remove()</script>
|
|
130
|
-
</body>
|
|
131
128
|
</html>`;
|
|
132
129
|
|
|
133
130
|
src = URL.createObjectURL( new Blob( [ html ], { type: 'text/html' } ) );
|
|
@@ -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 }
|
|
@@ -34,7 +34,7 @@ export function getBlockAndPreviewFromMedia( media, mediaType ) {
|
|
|
34
34
|
src={ media.previewUrl || mediaSrc }
|
|
35
35
|
alt={ alt }
|
|
36
36
|
controls={ mediaType === 'audio' ? true : undefined }
|
|
37
|
-
inert
|
|
37
|
+
inert
|
|
38
38
|
onError={ ( { currentTarget } ) => {
|
|
39
39
|
// Fall back to the media source if the preview cannot be loaded.
|
|
40
40
|
if ( currentTarget.src === media.previewUrl ) {
|
|
@@ -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
|