@wordpress/block-editor 10.1.1-next.4d3b314fd5.0 → 10.3.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 +14 -0
- package/README.md +41 -0
- package/build/components/block-controls/slot.js +2 -2
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +4 -2
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-inspector/index.js +4 -5
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-compact.native.js +1 -0
- package/build/components/block-list/block-list-compact.native.js.map +1 -1
- package/build/components/block-list/block.js +72 -14
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +79 -12
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -23
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +9 -6
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +5 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/drop-zone.js +85 -0
- package/build/components/block-popover/drop-zone.js.map +1 -0
- package/build/components/block-popover/inbetween.js +3 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +22 -17
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +6 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-preview/live.js +3 -7
- package/build/components/block-preview/live.js.map +1 -1
- package/build/components/block-selection-clearer/index.js +9 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +22 -16
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +18 -42
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +4 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +50 -20
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +15 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +256 -0
- package/build/components/font-sizes/fluid-utils.js.map +1 -0
- package/build/components/font-sizes/index.js +8 -0
- package/build/components/font-sizes/index.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +2 -2
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +151 -78
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/menu.js +14 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-items.js +2 -17
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +4 -2
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/preview-options/index.js +2 -3
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +17 -0
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +10 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +40 -9
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +98 -57
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +12 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/types.js +6 -0
- package/build/components/use-on-block-drop/types.js.map +1 -0
- package/build/hooks/align.js +1 -3
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +1 -7
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/font-size.js +60 -0
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/margin.js +6 -5
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +2 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +126 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-typography-props.js +17 -3
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/store/actions.js +59 -45
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +3 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +36 -18
- package/build/store/reducer.js.map +1 -1
- package/build/utils/math.js +14 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/pre-parse-patterns.js +19 -2
- package/build/utils/pre-parse-patterns.js.map +1 -1
- package/build-module/components/block-controls/slot.js +3 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +7 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-inspector/index.js +5 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-compact.native.js +1 -0
- package/build-module/components/block-list/block-list-compact.native.js.map +1 -1
- package/build-module/components/block-list/block.js +72 -14
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +80 -13
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +8 -24
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +10 -8
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +5 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/drop-zone.js +70 -0
- package/build-module/components/block-popover/drop-zone.js.map +1 -0
- package/build-module/components/block-popover/inbetween.js +3 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +22 -17
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +6 -9
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-preview/live.js +3 -6
- package/build-module/components/block-preview/live.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js +9 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +25 -19
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +19 -44
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +4 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +48 -20
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +15 -3
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +2 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +3 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +245 -0
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -0
- package/build-module/components/font-sizes/index.js +1 -0
- package/build-module/components/font-sizes/index.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +2 -2
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +148 -81
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +10 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-items.js +3 -17
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -2
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -3
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -0
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +10 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +40 -10
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +98 -58
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +12 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/types.js +2 -0
- package/build-module/components/use-on-block-drop/types.js.map +1 -0
- package/build-module/hooks/align.js +1 -2
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -6
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/font-size.js +59 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/margin.js +6 -5
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +2 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +124 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +17 -4
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +2 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/actions.js +55 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +3 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +36 -19
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/math.js +12 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/pre-parse-patterns.js +19 -2
- package/build-module/utils/pre-parse-patterns.js.map +1 -1
- package/build-style/style-rtl.css +256 -152
- package/build-style/style.css +256 -152
- package/package.json +28 -29
- package/src/components/block-breadcrumb/test/index.js +1 -1
- package/src/components/block-controls/slot.js +3 -3
- package/src/components/block-draggable/draggable-chip.js +4 -2
- package/src/components/block-inspector/index.js +8 -11
- package/src/components/block-list/block-list-compact.native.js +1 -0
- package/src/components/block-list/block.js +111 -7
- package/src/components/block-list/block.native.js +123 -9
- package/src/components/block-list/style.scss +93 -126
- package/src/components/block-list/use-in-between-inserter.js +8 -19
- package/src/components/block-lock/modal.js +12 -7
- package/src/components/block-mover/style.scss +0 -1
- package/src/components/block-parent-selector/index.js +5 -5
- package/src/components/block-patterns-list/index.js +9 -5
- package/src/components/block-patterns-list/style.scss +7 -3
- package/src/components/block-popover/README.md +8 -0
- package/src/components/block-popover/drop-zone.js +63 -0
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +39 -22
- package/src/components/block-popover/style.scss +17 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/index.js +7 -8
- package/src/components/block-preview/live.js +2 -7
- package/src/components/block-preview/test/index.js +1 -7
- package/src/components/block-selection-clearer/index.js +7 -2
- package/src/components/block-selection-clearer/test/index.js +118 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -18
- package/src/components/block-settings-menu/test/block-mode-toggle.js +17 -17
- package/src/components/block-styles/index.js +26 -49
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +104 -33
- package/src/components/block-switcher/test/index.js +121 -61
- package/src/components/block-toolbar/index.js +4 -6
- package/src/components/block-toolbar/style.scss +38 -14
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/insertion-point.js +42 -17
- package/src/components/block-tools/selected-block-popover.js +14 -1
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +32 -52
- package/src/components/color-palette/test/control.js +11 -15
- package/src/components/colors-gradients/control.js +2 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +3 -4
- package/src/components/colors-gradients/test/control.js +49 -77
- package/src/components/font-sizes/fluid-utils.js +296 -0
- package/src/components/font-sizes/index.js +1 -0
- package/src/components/font-sizes/test/fluid-utils.js +168 -0
- package/src/components/image-editor/use-transform-image.js +2 -2
- package/src/components/image-size-control/test/index.js +47 -60
- package/src/components/index.js +0 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/src/components/inserter/block-patterns-tab.js +232 -98
- package/src/components/inserter/block-types-tab.js +3 -3
- package/src/components/inserter/menu.js +15 -2
- package/src/components/inserter/search-items.js +3 -15
- package/src/components/inserter/style.scss +94 -9
- package/src/components/inserter/test/reusable-blocks-tab.js +6 -6
- package/src/components/inserter/test/search-items.js +4 -0
- package/src/components/inserter-draggable-blocks/index.js +12 -2
- package/src/components/inserter-list-item/style.scss +20 -1
- package/src/components/inspector-controls/slot.js +6 -2
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/use-list-view-drop-zone.js +4 -18
- package/src/components/panel-color-settings/test/index.js +4 -4
- package/src/components/preview-options/index.js +2 -2
- package/src/components/preview-options/style.scss +1 -1
- package/src/components/provider/test/use-block-sync.js +131 -165
- package/src/components/responsive-block-control/test/index.js +77 -122
- package/src/components/rich-text/index.js +22 -0
- package/src/components/spacing-sizes-control/index.js +15 -3
- package/src/components/spacing-sizes-control/spacing-input-control.js +24 -9
- package/src/components/spacing-sizes-control/style.scss +42 -31
- package/src/components/use-block-drop-zone/index.js +136 -79
- package/src/components/use-block-drop-zone/test/index.js +333 -81
- package/src/components/use-on-block-drop/index.js +11 -12
- package/src/components/use-on-block-drop/types.ts +1 -0
- package/src/hooks/align.js +3 -2
- package/src/hooks/align.native.js +5 -8
- package/src/hooks/font-size.js +75 -0
- package/src/hooks/margin.js +5 -4
- package/src/hooks/padding.js +1 -0
- package/src/hooks/style.js +122 -3
- package/src/hooks/test/style.js +206 -1
- package/src/hooks/test/use-typography-props.js +22 -0
- package/src/hooks/use-typography-props.js +18 -3
- package/src/hooks/utils.js +6 -2
- package/src/store/actions.js +20 -12
- package/src/store/defaults.js +3 -0
- package/src/store/reducer.js +35 -28
- package/src/store/test/actions.js +0 -9
- package/src/utils/math.js +17 -0
- package/src/utils/pre-parse-patterns.js +12 -7
- package/build/components/inserter/pattern-panel.js +0 -87
- package/build/components/inserter/pattern-panel.js.map +0 -1
- package/build-module/components/inserter/pattern-panel.js +0 -74
- package/build-module/components/inserter/pattern-panel.js.map +0 -1
- package/src/components/inserter/pattern-panel.js +0 -93
|
@@ -17,14 +17,15 @@ import { useReducedMotion } from '@wordpress/compose';
|
|
|
17
17
|
import Inserter from '../inserter';
|
|
18
18
|
import { store as blockEditorStore } from '../../store';
|
|
19
19
|
import BlockPopoverInbetween from '../block-popover/inbetween';
|
|
20
|
+
import BlockDropZonePopover from '../block-popover/drop-zone';
|
|
20
21
|
|
|
21
22
|
export const InsertionPointOpenRef = createContext();
|
|
22
23
|
|
|
23
|
-
function
|
|
24
|
+
function InbetweenInsertionPointPopover( {
|
|
24
25
|
__unstablePopoverSlot,
|
|
25
26
|
__unstableContentRef,
|
|
26
27
|
} ) {
|
|
27
|
-
const { selectBlock
|
|
28
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
28
29
|
const openRef = useContext( InsertionPointOpenRef );
|
|
29
30
|
const ref = useRef();
|
|
30
31
|
const {
|
|
@@ -33,6 +34,8 @@ function InsertionPointPopover( {
|
|
|
33
34
|
nextClientId,
|
|
34
35
|
rootClientId,
|
|
35
36
|
isInserterShown,
|
|
37
|
+
isDistractionFree,
|
|
38
|
+
isNavigationMode,
|
|
36
39
|
} = useSelect( ( select ) => {
|
|
37
40
|
const {
|
|
38
41
|
getBlockOrder,
|
|
@@ -41,6 +44,8 @@ function InsertionPointPopover( {
|
|
|
41
44
|
isBlockBeingDragged,
|
|
42
45
|
getPreviousBlockClientId,
|
|
43
46
|
getNextBlockClientId,
|
|
47
|
+
getSettings,
|
|
48
|
+
isNavigationMode: _isNavigationMode,
|
|
44
49
|
} = select( blockEditorStore );
|
|
45
50
|
const insertionPoint = getBlockInsertionPoint();
|
|
46
51
|
const order = getBlockOrder( insertionPoint.rootClientId );
|
|
@@ -60,6 +65,8 @@ function InsertionPointPopover( {
|
|
|
60
65
|
_nextClientId = getNextBlockClientId( _nextClientId );
|
|
61
66
|
}
|
|
62
67
|
|
|
68
|
+
const settings = getSettings();
|
|
69
|
+
|
|
63
70
|
return {
|
|
64
71
|
previousClientId: _previousClientId,
|
|
65
72
|
nextClientId: _nextClientId,
|
|
@@ -67,6 +74,8 @@ function InsertionPointPopover( {
|
|
|
67
74
|
getBlockListSettings( insertionPoint.rootClientId )
|
|
68
75
|
?.orientation || 'vertical',
|
|
69
76
|
rootClientId: insertionPoint.rootClientId,
|
|
77
|
+
isNavigationMode: _isNavigationMode(),
|
|
78
|
+
isDistractionFree: settings.isDistractionFree,
|
|
70
79
|
isInserterShown: insertionPoint?.__unstableWithInserter,
|
|
71
80
|
};
|
|
72
81
|
}, [] );
|
|
@@ -88,14 +97,6 @@ function InsertionPointPopover( {
|
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
function maybeHideInserterPoint( event ) {
|
|
92
|
-
// Only hide the inserter if it's triggered on the wrapper,
|
|
93
|
-
// and the inserter is not open.
|
|
94
|
-
if ( event.target === ref.current && ! openRef.current ) {
|
|
95
|
-
hideInsertionPoint();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
100
|
// Define animation variants for the line element.
|
|
100
101
|
const horizontalLine = {
|
|
101
102
|
start: {
|
|
@@ -149,13 +150,13 @@ function InsertionPointPopover( {
|
|
|
149
150
|
...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),
|
|
150
151
|
opacity: 1,
|
|
151
152
|
borderRadius: '2px',
|
|
152
|
-
transition: { delay: isInserterShown ? 0.
|
|
153
|
+
transition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },
|
|
153
154
|
},
|
|
154
155
|
hover: {
|
|
155
156
|
...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),
|
|
156
157
|
opacity: 1,
|
|
157
158
|
borderRadius: '2px',
|
|
158
|
-
transition: { delay: 0.
|
|
159
|
+
transition: { delay: 0.5, type: 'tween' },
|
|
159
160
|
},
|
|
160
161
|
};
|
|
161
162
|
|
|
@@ -165,10 +166,14 @@ function InsertionPointPopover( {
|
|
|
165
166
|
},
|
|
166
167
|
rest: {
|
|
167
168
|
scale: 1,
|
|
168
|
-
transition: { type: 'tween' },
|
|
169
|
+
transition: { delay: 0.4, type: 'tween' },
|
|
169
170
|
},
|
|
170
171
|
};
|
|
171
172
|
|
|
173
|
+
if ( isDistractionFree && ! isNavigationMode ) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
172
177
|
const className = classnames(
|
|
173
178
|
'block-editor-block-list__insertion-point',
|
|
174
179
|
'is-' + orientation
|
|
@@ -195,7 +200,6 @@ function InsertionPointPopover( {
|
|
|
195
200
|
className={ classnames( className, {
|
|
196
201
|
'is-with-inserter': isInserterShown,
|
|
197
202
|
} ) }
|
|
198
|
-
onHoverEnd={ maybeHideInserterPoint }
|
|
199
203
|
>
|
|
200
204
|
<motion.div
|
|
201
205
|
variants={ lineVariants }
|
|
@@ -229,9 +233,30 @@ function InsertionPointPopover( {
|
|
|
229
233
|
}
|
|
230
234
|
|
|
231
235
|
export default function InsertionPoint( props ) {
|
|
232
|
-
const isVisible = useSelect( ( select ) => {
|
|
233
|
-
|
|
236
|
+
const { insertionPoint, isVisible } = useSelect( ( select ) => {
|
|
237
|
+
const { getBlockInsertionPoint, isBlockInsertionPointVisible } =
|
|
238
|
+
select( blockEditorStore );
|
|
239
|
+
return {
|
|
240
|
+
insertionPoint: getBlockInsertionPoint(),
|
|
241
|
+
isVisible: isBlockInsertionPointVisible(),
|
|
242
|
+
};
|
|
234
243
|
}, [] );
|
|
235
244
|
|
|
236
|
-
|
|
245
|
+
if ( ! isVisible ) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Render a popover that overlays the block when the desired operation is to replace it.
|
|
251
|
+
* Otherwise, render a popover in between blocks for the indication of inserting between them.
|
|
252
|
+
*/
|
|
253
|
+
return insertionPoint.operation === 'replace' ? (
|
|
254
|
+
<BlockDropZonePopover
|
|
255
|
+
// Force remount to trigger the animation.
|
|
256
|
+
key={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }
|
|
257
|
+
{ ...props }
|
|
258
|
+
/>
|
|
259
|
+
) : (
|
|
260
|
+
<InbetweenInsertionPointPopover { ...props } />
|
|
261
|
+
);
|
|
237
262
|
}
|
|
@@ -36,6 +36,7 @@ function selector( select ) {
|
|
|
36
36
|
isMultiSelecting: isMultiSelecting(),
|
|
37
37
|
isTyping: isTyping(),
|
|
38
38
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
39
|
+
isDistractionFree: getSettings().isDistractionFree,
|
|
39
40
|
lastClientId: hasMultiSelection()
|
|
40
41
|
? getLastMultiSelectedBlockClientId()
|
|
41
42
|
: null,
|
|
@@ -46,6 +47,7 @@ function SelectedBlockPopover( {
|
|
|
46
47
|
clientId,
|
|
47
48
|
rootClientId,
|
|
48
49
|
isEmptyDefaultBlock,
|
|
50
|
+
showContents, // we may need to mount an empty popover because we reuse
|
|
49
51
|
capturingClientId,
|
|
50
52
|
__unstablePopoverSlot,
|
|
51
53
|
__unstableContentRef,
|
|
@@ -55,6 +57,7 @@ function SelectedBlockPopover( {
|
|
|
55
57
|
isMultiSelecting,
|
|
56
58
|
isTyping,
|
|
57
59
|
hasFixedToolbar,
|
|
60
|
+
isDistractionFree,
|
|
58
61
|
lastClientId,
|
|
59
62
|
} = useSelect( selector, [] );
|
|
60
63
|
const isInsertionPointVisible = useSelect(
|
|
@@ -94,6 +97,7 @@ function SelectedBlockPopover( {
|
|
|
94
97
|
editorMode === 'edit' &&
|
|
95
98
|
! shouldShowContextualToolbar &&
|
|
96
99
|
! hasFixedToolbar &&
|
|
100
|
+
! isDistractionFree &&
|
|
97
101
|
! isEmptyDefaultBlock;
|
|
98
102
|
|
|
99
103
|
useShortcut(
|
|
@@ -136,7 +140,7 @@ function SelectedBlockPopover( {
|
|
|
136
140
|
resize={ false }
|
|
137
141
|
{ ...popoverProps }
|
|
138
142
|
>
|
|
139
|
-
{ shouldShowContextualToolbar && (
|
|
143
|
+
{ shouldShowContextualToolbar && showContents && (
|
|
140
144
|
<BlockContextualToolbar
|
|
141
145
|
// If the toolbar is being shown because of being forced
|
|
142
146
|
// it should focus the toolbar right after the mount.
|
|
@@ -169,6 +173,8 @@ function wrapperSelector( select ) {
|
|
|
169
173
|
getBlockRootClientId,
|
|
170
174
|
getBlock,
|
|
171
175
|
getBlockParents,
|
|
176
|
+
getSettings,
|
|
177
|
+
isNavigationMode: _isNavigationMode,
|
|
172
178
|
__experimentalGetBlockListSettingsForBlocks,
|
|
173
179
|
} = select( blockEditorStore );
|
|
174
180
|
|
|
@@ -195,10 +201,14 @@ function wrapperSelector( select ) {
|
|
|
195
201
|
?.__experimentalCaptureToolbars
|
|
196
202
|
);
|
|
197
203
|
|
|
204
|
+
const settings = getSettings();
|
|
205
|
+
|
|
198
206
|
return {
|
|
199
207
|
clientId,
|
|
200
208
|
rootClientId: getBlockRootClientId( clientId ),
|
|
201
209
|
name,
|
|
210
|
+
isDistractionFree: settings.isDistractionFree,
|
|
211
|
+
isNavigationMode: _isNavigationMode(),
|
|
202
212
|
isEmptyDefaultBlock:
|
|
203
213
|
name && isUnmodifiedDefaultBlock( { name, attributes } ),
|
|
204
214
|
capturingClientId,
|
|
@@ -221,6 +231,8 @@ export default function WrappedBlockPopover( {
|
|
|
221
231
|
name,
|
|
222
232
|
isEmptyDefaultBlock,
|
|
223
233
|
capturingClientId,
|
|
234
|
+
isDistractionFree,
|
|
235
|
+
isNavigationMode,
|
|
224
236
|
} = selected;
|
|
225
237
|
|
|
226
238
|
if ( ! name ) {
|
|
@@ -232,6 +244,7 @@ export default function WrappedBlockPopover( {
|
|
|
232
244
|
clientId={ clientId }
|
|
233
245
|
rootClientId={ rootClientId }
|
|
234
246
|
isEmptyDefaultBlock={ isEmptyDefaultBlock }
|
|
247
|
+
showContents={ ! isDistractionFree || isNavigationMode }
|
|
235
248
|
capturingClientId={ capturingClientId }
|
|
236
249
|
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
237
250
|
__unstableContentRef={ __unstableContentRef }
|
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
// When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state.
|
|
36
36
|
.block-list-appender:only-child {
|
|
37
37
|
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &,
|
|
38
|
-
.is-layout-flow.block-editor-block-list__block:not(.is-selected) >
|
|
38
|
+
.is-layout-flow.block-editor-block-list__block:not(.is-selected) > &,
|
|
39
|
+
// Legacy groups have an inner container so need to be targeted separately
|
|
40
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .wp-block-group__inner-container > &,
|
|
41
|
+
.is-layout-flow.block-editor-block-list__block:not(.is-selected) > .wp-block-group__inner-container > & {
|
|
39
42
|
pointer-events: none;
|
|
40
43
|
|
|
41
44
|
&::after {
|
|
@@ -46,6 +49,7 @@
|
|
|
46
49
|
bottom: 0;
|
|
47
50
|
left: 0;
|
|
48
51
|
pointer-events: none;
|
|
52
|
+
border: $border-width dashed currentColor;
|
|
49
53
|
@include placeholder-style();
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -118,67 +118,61 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
<div
|
|
121
|
-
|
|
121
|
+
class="components-base-control block-editor-color-gradient-control emotion-0 emotion-1"
|
|
122
122
|
>
|
|
123
123
|
<div
|
|
124
|
-
|
|
124
|
+
class="components-base-control__field emotion-2 emotion-3"
|
|
125
125
|
>
|
|
126
126
|
<fieldset
|
|
127
|
-
|
|
127
|
+
class="block-editor-color-gradient-control__fieldset"
|
|
128
128
|
>
|
|
129
129
|
<div
|
|
130
|
-
|
|
131
|
-
data-wp-c16t=
|
|
130
|
+
class="components-flex components-h-stack components-v-stack emotion-4 emotion-5"
|
|
131
|
+
data-wp-c16t="true"
|
|
132
132
|
data-wp-component="VStack"
|
|
133
133
|
>
|
|
134
134
|
<legend>
|
|
135
135
|
<div
|
|
136
|
-
|
|
136
|
+
class="block-editor-color-gradient-control__color-indicator"
|
|
137
137
|
>
|
|
138
138
|
<span
|
|
139
|
-
|
|
139
|
+
class="components-base-control__label emotion-6 emotion-7"
|
|
140
140
|
>
|
|
141
141
|
Test Color
|
|
142
142
|
</span>
|
|
143
143
|
</div>
|
|
144
144
|
</legend>
|
|
145
145
|
<div
|
|
146
|
-
|
|
146
|
+
class="block-editor-color-gradient-control__panel"
|
|
147
147
|
>
|
|
148
148
|
<div
|
|
149
|
-
|
|
150
|
-
data-wp-c16t=
|
|
149
|
+
class="components-flex components-h-stack components-v-stack emotion-8 emotion-5"
|
|
150
|
+
data-wp-c16t="true"
|
|
151
151
|
data-wp-component="VStack"
|
|
152
152
|
>
|
|
153
153
|
<div
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
class="components-dropdown"
|
|
155
|
+
tabindex="-1"
|
|
156
156
|
>
|
|
157
157
|
<button
|
|
158
|
-
aria-expanded=
|
|
158
|
+
aria-expanded="false"
|
|
159
159
|
aria-haspopup="true"
|
|
160
160
|
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
161
|
-
|
|
162
|
-
data-wp-c16t=
|
|
161
|
+
class="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
162
|
+
data-wp-c16t="true"
|
|
163
163
|
data-wp-component="Flex"
|
|
164
|
-
|
|
165
|
-
style={
|
|
166
|
-
Object {
|
|
167
|
-
"background": "#f00",
|
|
168
|
-
"color": "#000",
|
|
169
|
-
}
|
|
170
|
-
}
|
|
164
|
+
style="background: rgb(255, 0, 0); color: rgb(0, 0, 0);"
|
|
171
165
|
>
|
|
172
166
|
<span
|
|
173
|
-
|
|
174
|
-
data-wp-c16t=
|
|
167
|
+
class="components-truncate components-flex-item components-color-palette__custom-color-name emotion-5 emotion-13 emotion-5"
|
|
168
|
+
data-wp-c16t="true"
|
|
175
169
|
data-wp-component="FlexItem"
|
|
176
170
|
>
|
|
177
171
|
red
|
|
178
172
|
</span>
|
|
179
173
|
<span
|
|
180
|
-
|
|
181
|
-
data-wp-c16t=
|
|
174
|
+
class="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
175
|
+
data-wp-c16t="true"
|
|
182
176
|
data-wp-component="FlexItem"
|
|
183
177
|
>
|
|
184
178
|
f00
|
|
@@ -186,40 +180,28 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
186
180
|
</button>
|
|
187
181
|
</div>
|
|
188
182
|
<div
|
|
189
|
-
|
|
183
|
+
class="components-circular-option-picker"
|
|
190
184
|
>
|
|
191
185
|
<div
|
|
192
|
-
|
|
186
|
+
class="components-circular-option-picker__swatches"
|
|
193
187
|
>
|
|
194
188
|
<div
|
|
195
|
-
|
|
189
|
+
class="components-circular-option-picker__option-wrapper"
|
|
196
190
|
>
|
|
197
191
|
<button
|
|
198
|
-
aria-describedby={null}
|
|
199
192
|
aria-label="Color: red"
|
|
200
|
-
aria-pressed=
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
onClick={[Function]}
|
|
204
|
-
onFocus={[Function]}
|
|
205
|
-
onMouseDown={[Function]}
|
|
206
|
-
onMouseEnter={[Function]}
|
|
207
|
-
onMouseLeave={[Function]}
|
|
208
|
-
style={
|
|
209
|
-
Object {
|
|
210
|
-
"backgroundColor": "#f00",
|
|
211
|
-
"color": "#f00",
|
|
212
|
-
}
|
|
213
|
-
}
|
|
193
|
+
aria-pressed="true"
|
|
194
|
+
class="components-button components-circular-option-picker__option is-pressed"
|
|
195
|
+
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|
|
214
196
|
type="button"
|
|
215
197
|
/>
|
|
216
198
|
<svg
|
|
217
|
-
aria-hidden=
|
|
199
|
+
aria-hidden="true"
|
|
218
200
|
fill="#000"
|
|
219
|
-
focusable=
|
|
220
|
-
height=
|
|
201
|
+
focusable="false"
|
|
202
|
+
height="24"
|
|
221
203
|
viewBox="0 0 24 24"
|
|
222
|
-
width=
|
|
204
|
+
width="24"
|
|
223
205
|
xmlns="http://www.w3.org/2000/svg"
|
|
224
206
|
>
|
|
225
207
|
<path
|
|
@@ -229,12 +211,10 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
229
211
|
</div>
|
|
230
212
|
</div>
|
|
231
213
|
<div
|
|
232
|
-
|
|
214
|
+
class="components-circular-option-picker__custom-clear-wrapper"
|
|
233
215
|
>
|
|
234
216
|
<button
|
|
235
|
-
|
|
236
|
-
className="components-button components-circular-option-picker__clear is-tertiary"
|
|
237
|
-
onClick={[Function]}
|
|
217
|
+
class="components-button components-circular-option-picker__clear is-tertiary"
|
|
238
218
|
type="button"
|
|
239
219
|
>
|
|
240
220
|
Clear
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -12,20 +12,16 @@ const noop = () => {};
|
|
|
12
12
|
|
|
13
13
|
describe( 'ColorPaletteControl', () => {
|
|
14
14
|
it( 'matches the snapshot', async () => {
|
|
15
|
-
|
|
15
|
+
const { container } = render(
|
|
16
|
+
<ColorPaletteControl
|
|
17
|
+
label="Test Color"
|
|
18
|
+
value="#f00"
|
|
19
|
+
colors={ [ { color: '#f00', name: 'red' } ] }
|
|
20
|
+
disableCustomColors={ false }
|
|
21
|
+
onChange={ noop }
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
root = create(
|
|
19
|
-
<ColorPaletteControl
|
|
20
|
-
label="Test Color"
|
|
21
|
-
value="#f00"
|
|
22
|
-
colors={ [ { color: '#f00', name: 'red' } ] }
|
|
23
|
-
disableCustomColors={ false }
|
|
24
|
-
onChange={ noop }
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
} );
|
|
28
|
-
|
|
29
|
-
expect( root.toJSON() ).toMatchSnapshot();
|
|
25
|
+
expect( container.firstChild ).toMatchSnapshot();
|
|
30
26
|
} );
|
|
31
27
|
} );
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { isEmpty } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -180,7 +180,7 @@ function ColorGradientControlSelect( props ) {
|
|
|
180
180
|
|
|
181
181
|
function ColorGradientControl( props ) {
|
|
182
182
|
if (
|
|
183
|
-
every(
|
|
183
|
+
colorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )
|
|
184
184
|
) {
|
|
185
185
|
return <ColorGradientControlInner { ...props } />;
|
|
186
186
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { isEmpty } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -50,8 +50,7 @@ export const PanelColorGradientSettingsInner = ( {
|
|
|
50
50
|
isEmpty( gradients ) &&
|
|
51
51
|
disableCustomColors &&
|
|
52
52
|
disableCustomGradients &&
|
|
53
|
-
every(
|
|
54
|
-
settings,
|
|
53
|
+
settings?.every(
|
|
55
54
|
( setting ) =>
|
|
56
55
|
isEmpty( setting.colors ) &&
|
|
57
56
|
isEmpty( setting.gradients ) &&
|
|
@@ -137,7 +136,7 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
|
|
|
137
136
|
|
|
138
137
|
const PanelColorGradientSettings = ( props ) => {
|
|
139
138
|
if (
|
|
140
|
-
every(
|
|
139
|
+
colorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )
|
|
141
140
|
) {
|
|
142
141
|
return <PanelColorGradientSettingsInner { ...props } />;
|
|
143
142
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
|
-
import { create, act } from 'react-test-renderer';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
@@ -11,15 +10,6 @@ import ColorGradientControl from '../control';
|
|
|
11
10
|
|
|
12
11
|
const noop = () => {};
|
|
13
12
|
|
|
14
|
-
const getButtonWithAriaLabelStartPredicate =
|
|
15
|
-
( ariaLabelStart ) => ( element ) => {
|
|
16
|
-
return (
|
|
17
|
-
element.type === 'button' &&
|
|
18
|
-
element.props[ 'aria-label' ] &&
|
|
19
|
-
element.props[ 'aria-label' ].startsWith( ariaLabelStart )
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
13
|
describe( 'ColorPaletteControl', () => {
|
|
24
14
|
it( 'renders tabs if it is possible to select a color and a gradient rendering a color picker at the start', async () => {
|
|
25
15
|
render(
|
|
@@ -64,25 +54,21 @@ describe( 'ColorPaletteControl', () => {
|
|
|
64
54
|
} );
|
|
65
55
|
|
|
66
56
|
it( 'renders the color picker and does not render tabs if it is only possible to select a color', async () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onGradientChange={ noop }
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
} );
|
|
57
|
+
render(
|
|
58
|
+
<ColorGradientControl
|
|
59
|
+
label="Test Color Gradient"
|
|
60
|
+
colorValue="#f00"
|
|
61
|
+
colors={ [
|
|
62
|
+
{ color: '#f00', name: 'red' },
|
|
63
|
+
{ color: '#0f0', name: 'green' },
|
|
64
|
+
] }
|
|
65
|
+
gradients={ [] }
|
|
66
|
+
disableCustomColors={ false }
|
|
67
|
+
disableCustomGradients={ true }
|
|
68
|
+
onColorChange={ noop }
|
|
69
|
+
onGradientChange={ noop }
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
86
72
|
|
|
87
73
|
// Is not showing the two tab buttons.
|
|
88
74
|
expect(
|
|
@@ -93,43 +79,35 @@ describe( 'ColorPaletteControl', () => {
|
|
|
93
79
|
).not.toBeInTheDocument();
|
|
94
80
|
|
|
95
81
|
// Is showing the two predefined Colors.
|
|
96
|
-
expect(
|
|
97
|
-
wrapper.root.findAll(
|
|
98
|
-
getButtonWithAriaLabelStartPredicate( 'Color:' )
|
|
99
|
-
)
|
|
100
|
-
).toHaveLength( 2 );
|
|
82
|
+
expect( screen.getAllByLabelText( /^Color:/ ) ).toHaveLength( 2 );
|
|
101
83
|
} );
|
|
102
84
|
|
|
103
85
|
it( 'renders the gradient picker and does not render tabs if it is only possible to select a gradient', async () => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onGradientChange={ noop }
|
|
130
|
-
/>
|
|
131
|
-
);
|
|
132
|
-
} );
|
|
86
|
+
render(
|
|
87
|
+
<ColorGradientControl
|
|
88
|
+
label="Test Color Gradient"
|
|
89
|
+
colorValue="#f00"
|
|
90
|
+
colors={ [] }
|
|
91
|
+
gradients={ [
|
|
92
|
+
{
|
|
93
|
+
gradient:
|
|
94
|
+
'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%',
|
|
95
|
+
name: 'Vivid cyan blue to vivid purple',
|
|
96
|
+
slug: 'vivid-cyan-blue-to-vivid-purple',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
gradient:
|
|
100
|
+
'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',
|
|
101
|
+
name: 'Light green cyan to vivid green cyan',
|
|
102
|
+
slug: 'light-green-cyan-to-vivid-green-cyan',
|
|
103
|
+
},
|
|
104
|
+
] }
|
|
105
|
+
disableCustomColors={ true }
|
|
106
|
+
disableCustomGradients={ false }
|
|
107
|
+
onColorChange={ noop }
|
|
108
|
+
onGradientChange={ noop }
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
133
111
|
|
|
134
112
|
// Is not showing the two tab buttons.
|
|
135
113
|
expect(
|
|
@@ -140,22 +118,16 @@ describe( 'ColorPaletteControl', () => {
|
|
|
140
118
|
).not.toBeInTheDocument();
|
|
141
119
|
|
|
142
120
|
// Is showing the two predefined Gradients.
|
|
143
|
-
expect(
|
|
144
|
-
wrapper.root.findAll(
|
|
145
|
-
getButtonWithAriaLabelStartPredicate( 'Gradient:' )
|
|
146
|
-
)
|
|
147
|
-
).toHaveLength( 2 );
|
|
121
|
+
expect( screen.getAllByLabelText( /^Gradient:/ ) ).toHaveLength( 2 );
|
|
148
122
|
|
|
149
123
|
// Is showing the custom gradient picker.
|
|
150
124
|
expect(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
).length
|
|
159
|
-
).toBeGreaterThanOrEqual( 1 );
|
|
125
|
+
screen.getAllByRole( 'button', {
|
|
126
|
+
expanded: false,
|
|
127
|
+
name: /^Gradient control point at position/,
|
|
128
|
+
} )[ 0 ]
|
|
129
|
+
).toHaveClass(
|
|
130
|
+
'components-custom-gradient-picker__control-point-button'
|
|
131
|
+
);
|
|
160
132
|
} );
|
|
161
133
|
} );
|