Skip to content

Commit f2703e0

Browse files
GambitGambit
authored andcommitted
change request part 2
-hover state notice -orange indicator -reset button -bug fixes
1 parent 991b929 commit f2703e0

File tree

10 files changed

+279
-86
lines changed

10 files changed

+279
-86
lines changed

src/block/columns/editor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
.stk-block-columns > .stk-block-content > .block-editor-inner-blocks > .block-editor-block-list__layout {
3030
column-gap: var(--stk-column-gap, 0px);
31-
row-gap: var(--stk-column-row-gap, 0px);
31+
row-gap: var(--stk-columns-row-gap, 0px);
3232
}
3333

3434
// For Firefox polyfill

src/block/columns/style.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
}
1010

1111
.stk-block-columns > .stk-block-content {
12-
// --stk-column-gap: 0px; // For nested columns, this takes precedence.
13-
column-gap: var(--stk-column-gap, 0px);
12+
--stk-column-gap: var(--stk-columns-column-gap, 0px); // For nested columns, this takes precedence.
13+
column-gap: var(--stk-column-gap);
14+
row-gap: var(--stk-columns-row-gap, 0px);
1415
margin-left: auto;
1516
margin-right: auto;
1617
}

src/components/base-control2/hover-state-toggle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ const HoverStateToggle = props => {
9494
}
9595
return state
9696
} ).map( state => {
97+
if ( props.forceUpdateHoverState ) {
98+
return {
99+
...state,
100+
hasValue: props.hasHoverStateValue?.[ state.value ] ?? false,
101+
}
102+
}
103+
97104
if ( state.value === 'normal' || ! props.attribute ) {
98105
return state
99106
}
@@ -118,6 +125,7 @@ HoverStateToggle.defaultProps = {
118125
attribute: '',
119126
hasResponsive: false, // Wether the attribute has responsive attributes (where we have hover states per device type)
120127
forceUpdateHoverState: false,
128+
hasHoverStateValue: undefined,
121129
}
122130

123131
export default memo( HoverStateToggle )

src/components/base-control2/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export const BaseControl = props => {
8888
attribute={ props.attribute }
8989
hasResponsive={ hasResponsive }
9090
forceUpdateHoverState={ props.forceUpdateHoverState }
91+
hasHoverStateValue={ props.hasHoverStateValue }
9192
/>
9293
) }
9394
</div>
@@ -141,6 +142,12 @@ BaseControl.defaultProps = {
141142
helpTooltip: EMPTY_OBJ, // If supplied, displays a help tooltip when hovering on the label.
142143

143144
forceUpdateHoverState: false,
145+
146+
// If hasHoverStateValue is supplied, it should contain the following:
147+
// { hover: boolean, 'parent-hover': boolean }
148+
// If 'hover' or 'parent-hover' is true, then the hover toggle will be highlighted to show that the hover state value has been set
149+
hasHoverStateValue: undefined,
150+
144151
}
145152

146153
const AdvancedControl = props => {
@@ -195,6 +202,11 @@ AdvancedControl.defaultProps = {
195202
helpTooltip: EMPTY_OBJ, // If supplied, displays a help tooltip when hovering on the label.
196203

197204
forceUpdateHoverState: false,
205+
206+
// If hasHoverStateValue is supplied, it should contain the following:
207+
// { hover: boolean, 'parent-hover': boolean }
208+
// If 'hover' or 'parent-hover' is true, then the hover toggle will be highlighted to show that the hover state value has been set
209+
hasHoverStateValue: undefined,
198210
}
199211

200212
export default AdvancedControl

src/components/help-tooltip/index.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const HelpTooltip = props => {
2626
placement="left"
2727
offset={ 28 }
2828
noArrow={ false }
29-
onFocusOutside={ props.onClose }
30-
onEscape={ props.onClose }
29+
onFocusOutside={ props.closeOnEscape ? props.onClose : NOOP }
30+
onEscape={ props.closeOnEscape ? props.onClose : NOOP }
3131
>
3232
<PanelBody>
3333
<button
@@ -48,12 +48,14 @@ const HelpTooltip = props => {
4848
}
4949
<h4>{ props.title }</h4>
5050
<p>{ props.description }</p>
51-
<CheckboxControl
52-
label={ __( 'Stop showing tooltips', i18n ) }
53-
className="ugb-help-tooltip__checkbox"
54-
checked={ ! props.tooltipsEnabled }
55-
onChange={ checked => props.onTooltipsEnabledChange( ! checked ) }
56-
/>
51+
{ props.showTooltipCheckbox &&
52+
<CheckboxControl
53+
label={ __( 'Stop showing tooltips', i18n ) }
54+
className="ugb-help-tooltip__checkbox"
55+
checked={ ! props.tooltipsEnabled }
56+
onChange={ checked => props.onTooltipsEnabledChange( ! checked ) }
57+
/>
58+
}
5759
</PanelBody>
5860
</Popover>
5961
}
@@ -62,7 +64,9 @@ HelpTooltip.defaultProps = {
6264
title: '',
6365
video: '',
6466
description: '',
67+
closeOnEscape: true,
6568
onClose: NOOP,
69+
showTooltipCheckbox: true,
6670
tooltipsEnabled: true,
6771
onTooltipsEnabledChange: NOOP,
6872
}

0 commit comments

Comments
 (0)