@elementor/editor-controls 0.35.0 → 1.0.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 +31 -0
- package/dist/index.d.mts +24 -13
- package/dist/index.d.ts +24 -13
- package/dist/index.js +809 -558
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +748 -491
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
- package/src/bound-prop-context/use-bound-prop.ts +4 -1
- package/src/components/control-form-label.tsx +3 -3
- package/src/components/control-label.tsx +1 -1
- package/src/components/font-family-selector.tsx +8 -10
- package/src/components/popover-grid-container.tsx +7 -10
- package/src/components/repeater.tsx +2 -4
- package/src/components/size-control/size-input.tsx +125 -0
- package/src/components/{text-field-inner-selection.tsx → size-control/text-field-inner-selection.tsx} +33 -16
- package/src/components/sortable.tsx +4 -2
- package/src/components/text-field-popover.tsx +47 -0
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +14 -5
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx +9 -4
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +1 -1
- package/src/controls/box-shadow-repeater-control.tsx +11 -9
- package/src/controls/equal-unequal-sizes-control.tsx +38 -18
- package/src/controls/font-family-control/font-family-control.tsx +3 -1
- package/src/controls/gap-control.tsx +20 -7
- package/src/controls/image-control.tsx +2 -2
- package/src/controls/link-control.tsx +1 -1
- package/src/controls/linked-dimensions-control.tsx +71 -83
- package/src/controls/size-control.tsx +179 -149
- package/src/controls/stroke-control.tsx +9 -6
- package/src/hooks/use-size-extended-options.ts +21 -0
- package/src/index.ts +2 -1
- package/src/utils/size-control.ts +10 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type ReactNode, useId, useRef } from 'react';
|
|
2
|
+
import { type MutableRefObject, type ReactNode, useId, useRef } from 'react';
|
|
3
3
|
import { type PropKey, type PropTypeUtil, sizePropTypeUtil, type SizePropValue } from '@elementor/editor-props';
|
|
4
4
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
5
|
import { bindPopover, bindToggle, Grid, Popover, Stack, ToggleButton, Tooltip, usePopupState } from '@elementor/ui';
|
|
@@ -52,7 +52,6 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
52
52
|
multiSizePropTypeUtil,
|
|
53
53
|
}: Props< TMultiPropType, TPropValue > ) {
|
|
54
54
|
const popupId = useId();
|
|
55
|
-
const controlRef = useRef< HTMLElement >( null );
|
|
56
55
|
const popupState = usePopupState( { variant: 'popover', popupId } );
|
|
57
56
|
|
|
58
57
|
const {
|
|
@@ -62,7 +61,9 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
62
61
|
disabled: multiSizeDisabled,
|
|
63
62
|
} = useBoundProp( multiSizePropTypeUtil );
|
|
64
63
|
|
|
65
|
-
const { value: sizeValue, setValue: setSizeValue
|
|
64
|
+
const { value: sizeValue, setValue: setSizeValue } = useBoundProp( sizePropTypeUtil );
|
|
65
|
+
|
|
66
|
+
const rowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef() ];
|
|
66
67
|
|
|
67
68
|
const splitEqualValue = () => {
|
|
68
69
|
if ( ! sizeValue ) {
|
|
@@ -98,17 +99,26 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
98
99
|
return splitEqualValue() ?? null;
|
|
99
100
|
};
|
|
100
101
|
|
|
102
|
+
const isShowingGeneralIndicator = ! isExperimentActive( 'e_v_3_30' ) || ! popupState.isOpen;
|
|
103
|
+
|
|
101
104
|
const isMixed = !! multiSizeValue;
|
|
102
105
|
|
|
103
106
|
return (
|
|
104
107
|
<>
|
|
105
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={
|
|
108
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRefs[ 0 ] }>
|
|
106
109
|
<Grid item xs={ 6 }>
|
|
107
|
-
|
|
110
|
+
{ ! isShowingGeneralIndicator ? (
|
|
111
|
+
<ControlFormLabel>{ label }</ControlFormLabel>
|
|
112
|
+
) : (
|
|
113
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
114
|
+
) }
|
|
108
115
|
</Grid>
|
|
109
116
|
<Grid item xs={ 6 }>
|
|
110
117
|
<Stack direction="row" alignItems="center" gap={ 1 }>
|
|
111
|
-
<SizeControl
|
|
118
|
+
<SizeControl
|
|
119
|
+
placeholder={ isMixed ? __( 'Mixed', 'elementor' ) : undefined }
|
|
120
|
+
anchorRef={ rowRefs[ 0 ] }
|
|
121
|
+
/>
|
|
112
122
|
<Tooltip title={ tooltipLabel } placement="top">
|
|
113
123
|
<ToggleButton
|
|
114
124
|
size={ 'tiny' }
|
|
@@ -117,7 +127,6 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
117
127
|
{ ...bindToggle( popupState ) }
|
|
118
128
|
selected={ popupState.isOpen }
|
|
119
129
|
aria-label={ tooltipLabel }
|
|
120
|
-
disabled={ multiSizeDisabled || sizeDisabled }
|
|
121
130
|
>
|
|
122
131
|
{ icon }
|
|
123
132
|
</ToggleButton>
|
|
@@ -138,18 +147,23 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
138
147
|
} }
|
|
139
148
|
{ ...bindPopover( popupState ) }
|
|
140
149
|
slotProps={ {
|
|
141
|
-
paper: { sx: { mt: 0.5, width:
|
|
150
|
+
paper: { sx: { mt: 0.5, width: rowRefs[ 0 ].current?.getBoundingClientRect().width } },
|
|
142
151
|
} }
|
|
143
152
|
>
|
|
144
|
-
<PropProvider
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
<PropProvider
|
|
154
|
+
propType={ multiSizePropType }
|
|
155
|
+
value={ getMultiSizeValues() }
|
|
156
|
+
setValue={ setNestedProp }
|
|
157
|
+
disabled={ multiSizeDisabled }
|
|
158
|
+
>
|
|
159
|
+
<PopoverContent p={ 1.5 }>
|
|
160
|
+
<PopoverGridContainer ref={ rowRefs[ 1 ] }>
|
|
161
|
+
<MultiSizeValueControl item={ items[ 0 ] } rowRef={ rowRefs[ 1 ] } />
|
|
162
|
+
<MultiSizeValueControl item={ items[ 1 ] } rowRef={ rowRefs[ 1 ] } />
|
|
149
163
|
</PopoverGridContainer>
|
|
150
|
-
<PopoverGridContainer>
|
|
151
|
-
<MultiSizeValueControl item={ items[ 2 ] } />
|
|
152
|
-
<MultiSizeValueControl item={ items[ 3 ] } />
|
|
164
|
+
<PopoverGridContainer ref={ rowRefs[ 2 ] }>
|
|
165
|
+
<MultiSizeValueControl item={ items[ 2 ] } rowRef={ rowRefs[ 2 ] } />
|
|
166
|
+
<MultiSizeValueControl item={ items[ 3 ] } rowRef={ rowRefs[ 2 ] } />
|
|
153
167
|
</PopoverGridContainer>
|
|
154
168
|
</PopoverContent>
|
|
155
169
|
</PropProvider>
|
|
@@ -158,7 +172,13 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
|
|
|
158
172
|
);
|
|
159
173
|
}
|
|
160
174
|
|
|
161
|
-
const MultiSizeValueControl = ( {
|
|
175
|
+
const MultiSizeValueControl = ( {
|
|
176
|
+
item,
|
|
177
|
+
rowRef,
|
|
178
|
+
}: {
|
|
179
|
+
item: Item;
|
|
180
|
+
rowRef: MutableRefObject< HTMLElement | undefined >;
|
|
181
|
+
} ) => {
|
|
162
182
|
const isUsingNestedProps = isExperimentActive( 'e_v_3_30' );
|
|
163
183
|
|
|
164
184
|
return (
|
|
@@ -173,7 +193,7 @@ const MultiSizeValueControl = ( { item }: { item: Item } ) => {
|
|
|
173
193
|
) }
|
|
174
194
|
</Grid>
|
|
175
195
|
<Grid item xs={ 12 }>
|
|
176
|
-
<SizeControl startIcon={ item.icon } />
|
|
196
|
+
<SizeControl startIcon={ item.icon } anchorRef={ rowRef } />
|
|
177
197
|
</Grid>
|
|
178
198
|
</Grid>
|
|
179
199
|
</Grid>
|
|
@@ -17,6 +17,8 @@ type FontFamilyControlProps = {
|
|
|
17
17
|
fontFamilies: FontCategory[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const SIZE = 'tiny';
|
|
21
|
+
|
|
20
22
|
export const FontFamilyControl = createControl( ( { fontFamilies }: FontFamilyControlProps ) => {
|
|
21
23
|
const { value: fontFamily, setValue: setFontFamily, disabled } = useBoundProp( stringPropTypeUtil );
|
|
22
24
|
|
|
@@ -28,7 +30,7 @@ export const FontFamilyControl = createControl( ( { fontFamilies }: FontFamilyCo
|
|
|
28
30
|
<UnstableTag
|
|
29
31
|
variant="outlined"
|
|
30
32
|
label={ fontFamily }
|
|
31
|
-
endIcon={ <ChevronDownIcon fontSize=
|
|
33
|
+
endIcon={ <ChevronDownIcon fontSize={ SIZE } /> }
|
|
32
34
|
{ ...bindTrigger( popoverState ) }
|
|
33
35
|
fullWidth
|
|
34
36
|
disabled={ disabled }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { layoutDirectionPropTypeUtil, type PropKey, sizePropTypeUtil } from '@elementor/editor-props';
|
|
3
4
|
import { DetachIcon, LinkIcon } from '@elementor/icons';
|
|
4
5
|
import { Grid, Stack, ToggleButton, Tooltip } from '@elementor/ui';
|
|
@@ -18,6 +19,8 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
18
19
|
disabled: directionDisabled,
|
|
19
20
|
} = useBoundProp( layoutDirectionPropTypeUtil );
|
|
20
21
|
|
|
22
|
+
const stackRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
23
|
+
|
|
21
24
|
const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp( sizePropTypeUtil );
|
|
22
25
|
|
|
23
26
|
const isLinked = ! directionValue && ! sizeValue ? true : !! sizeValue;
|
|
@@ -44,6 +47,8 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
44
47
|
// translators: %s: Tooltip title.
|
|
45
48
|
const unlinkedLabel = __( 'Unlink %s', 'elementor' ).replace( '%s', tooltipLabel );
|
|
46
49
|
|
|
50
|
+
const disabled = sizeDisabled || directionDisabled;
|
|
51
|
+
|
|
47
52
|
return (
|
|
48
53
|
<PropProvider propType={ propType } value={ directionValue } setValue={ setDirectionValue }>
|
|
49
54
|
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
@@ -56,19 +61,19 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
56
61
|
selected={ isLinked }
|
|
57
62
|
sx={ { marginLeft: 'auto' } }
|
|
58
63
|
onChange={ onLinkToggle }
|
|
59
|
-
disabled={
|
|
64
|
+
disabled={ disabled }
|
|
60
65
|
>
|
|
61
66
|
<LinkedIcon fontSize={ 'tiny' } />
|
|
62
67
|
</ToggleButton>
|
|
63
68
|
</Tooltip>
|
|
64
69
|
</Stack>
|
|
65
|
-
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
70
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap" ref={ stackRef }>
|
|
66
71
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
67
72
|
<Grid item xs={ 12 }>
|
|
68
73
|
<ControlFormLabel>{ __( 'Column', 'elementor' ) }</ControlFormLabel>
|
|
69
74
|
</Grid>
|
|
70
75
|
<Grid item xs={ 12 }>
|
|
71
|
-
<Control bind={ 'column' } isLinked={ isLinked } />
|
|
76
|
+
<Control bind={ 'column' } isLinked={ isLinked } anchorRef={ stackRef } />
|
|
72
77
|
</Grid>
|
|
73
78
|
</Grid>
|
|
74
79
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
@@ -76,7 +81,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
76
81
|
<ControlFormLabel>{ __( 'Row', 'elementor' ) }</ControlFormLabel>
|
|
77
82
|
</Grid>
|
|
78
83
|
<Grid item xs={ 12 }>
|
|
79
|
-
<Control bind={ 'row' } isLinked={ isLinked } />
|
|
84
|
+
<Control bind={ 'row' } isLinked={ isLinked } anchorRef={ stackRef } />
|
|
80
85
|
</Grid>
|
|
81
86
|
</Grid>
|
|
82
87
|
</Stack>
|
|
@@ -84,14 +89,22 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
84
89
|
);
|
|
85
90
|
} );
|
|
86
91
|
|
|
87
|
-
const Control = ( {
|
|
92
|
+
const Control = ( {
|
|
93
|
+
bind,
|
|
94
|
+
isLinked,
|
|
95
|
+
anchorRef,
|
|
96
|
+
}: {
|
|
97
|
+
bind: PropKey;
|
|
98
|
+
isLinked: boolean;
|
|
99
|
+
anchorRef: MutableRefObject< HTMLElement | undefined >;
|
|
100
|
+
} ) => {
|
|
88
101
|
if ( isLinked ) {
|
|
89
|
-
return <SizeControl />;
|
|
102
|
+
return <SizeControl anchorRef={ anchorRef } />;
|
|
90
103
|
}
|
|
91
104
|
|
|
92
105
|
return (
|
|
93
106
|
<PropKeyProvider bind={ bind }>
|
|
94
|
-
<SizeControl />
|
|
107
|
+
<SizeControl anchorRef={ anchorRef } />
|
|
95
108
|
</PropKeyProvider>
|
|
96
109
|
);
|
|
97
110
|
};
|
|
@@ -29,7 +29,7 @@ export const ImageControl = createControl(
|
|
|
29
29
|
<Stack gap={ 1.5 }>
|
|
30
30
|
{ [ 'all', 'media' ].includes( showMode ) ? (
|
|
31
31
|
<PropKeyProvider bind={ 'src' }>
|
|
32
|
-
<ControlFormLabel>
|
|
32
|
+
<ControlFormLabel>{ __( 'Image', 'elementor' ) }</ControlFormLabel>
|
|
33
33
|
<ImageMediaControl mediaTypes={ mediaTypes } />
|
|
34
34
|
</PropKeyProvider>
|
|
35
35
|
) : null }
|
|
@@ -37,7 +37,7 @@ export const ImageControl = createControl(
|
|
|
37
37
|
<PropKeyProvider bind={ 'size' }>
|
|
38
38
|
<Grid container gap={ 1.5 } alignItems="center" flexWrap="nowrap">
|
|
39
39
|
<Grid item xs={ 6 }>
|
|
40
|
-
<ControlFormLabel>
|
|
40
|
+
<ControlFormLabel>{ resolutionLabel }</ControlFormLabel>
|
|
41
41
|
</Grid>
|
|
42
42
|
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
43
43
|
<SelectControl options={ sizes } />
|
|
@@ -189,7 +189,7 @@ export const LinkControl = createControl( ( props: Props ) => {
|
|
|
189
189
|
</ControlActions>
|
|
190
190
|
</PropKeyProvider>
|
|
191
191
|
<PropKeyProvider bind={ 'isTargetBlank' }>
|
|
192
|
-
<SwitchControl disabled={ ! value } />
|
|
192
|
+
<SwitchControl disabled={ propContext.disabled || ! value } />
|
|
193
193
|
</PropKeyProvider>
|
|
194
194
|
</Stack>
|
|
195
195
|
</Collapse>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { dimensionsPropTypeUtil, type PropKey, sizePropTypeUtil } from '@elementor/editor-props';
|
|
3
4
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
5
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
@@ -9,19 +10,21 @@ import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-conte
|
|
|
9
10
|
import { ControlFormLabel } from '../components/control-form-label';
|
|
10
11
|
import { ControlLabel } from '../components/control-label';
|
|
11
12
|
import { createControl } from '../create-control';
|
|
12
|
-
import { type
|
|
13
|
+
import { type ExtendedOption } from '../utils/size-control';
|
|
14
|
+
import { SizeControl } from './size-control';
|
|
13
15
|
|
|
14
16
|
export const LinkedDimensionsControl = createControl(
|
|
15
17
|
( {
|
|
16
18
|
label,
|
|
17
19
|
isSiteRtl = false,
|
|
18
|
-
|
|
20
|
+
extendedOptions,
|
|
19
21
|
}: {
|
|
20
22
|
label: string;
|
|
21
23
|
isSiteRtl?: boolean;
|
|
22
|
-
|
|
24
|
+
extendedOptions?: ExtendedOption[];
|
|
23
25
|
} ) => {
|
|
24
26
|
const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp( sizePropTypeUtil );
|
|
27
|
+
const gridRowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef() ];
|
|
25
28
|
|
|
26
29
|
const {
|
|
27
30
|
value: dimensionsValue,
|
|
@@ -58,8 +61,15 @@ export const LinkedDimensionsControl = createControl(
|
|
|
58
61
|
// translators: %s: Tooltip title.
|
|
59
62
|
const unlinkedLabel = __( 'Unlink %s', 'elementor' ).replace( '%s', tooltipLabel );
|
|
60
63
|
|
|
64
|
+
const disabled = sizeDisabled || dimensionsDisabled;
|
|
65
|
+
|
|
61
66
|
return (
|
|
62
|
-
<PropProvider
|
|
67
|
+
<PropProvider
|
|
68
|
+
propType={ propType }
|
|
69
|
+
value={ dimensionsValue }
|
|
70
|
+
setValue={ setDimensionsValue }
|
|
71
|
+
disabled={ disabled }
|
|
72
|
+
>
|
|
63
73
|
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
64
74
|
{ isUsingNestedProps ? (
|
|
65
75
|
<ControlFormLabel>{ label }</ControlFormLabel>
|
|
@@ -74,86 +84,33 @@ export const LinkedDimensionsControl = createControl(
|
|
|
74
84
|
selected={ isLinked }
|
|
75
85
|
sx={ { marginLeft: 'auto' } }
|
|
76
86
|
onChange={ onLinkToggle }
|
|
77
|
-
disabled={
|
|
87
|
+
disabled={ disabled }
|
|
78
88
|
>
|
|
79
89
|
<LinkedIcon fontSize={ 'tiny' } />
|
|
80
90
|
</ToggleButton>
|
|
81
91
|
</Tooltip>
|
|
82
92
|
</Stack>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<Grid item xs={ 12 }>
|
|
105
|
-
<Control
|
|
106
|
-
bind={ 'inline-end' }
|
|
107
|
-
startIcon={
|
|
108
|
-
isSiteRtl ? (
|
|
109
|
-
<SideLeftIcon fontSize={ 'tiny' } />
|
|
110
|
-
) : (
|
|
111
|
-
<SideRightIcon fontSize={ 'tiny' } />
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
isLinked={ isLinked }
|
|
115
|
-
extendedValues={ extendedValues }
|
|
116
|
-
/>
|
|
117
|
-
</Grid>
|
|
118
|
-
</Grid>
|
|
119
|
-
</Stack>
|
|
120
|
-
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
121
|
-
<Grid container gap={ 0.75 } alignItems="center">
|
|
122
|
-
<Grid item xs={ 12 }>
|
|
123
|
-
<Label bind="block-end" label={ __( 'Bottom', 'elementor' ) } />
|
|
124
|
-
</Grid>
|
|
125
|
-
<Grid item xs={ 12 }>
|
|
126
|
-
<Control
|
|
127
|
-
bind={ 'block-end' }
|
|
128
|
-
startIcon={ <SideBottomIcon fontSize={ 'tiny' } /> }
|
|
129
|
-
isLinked={ isLinked }
|
|
130
|
-
extendedValues={ extendedValues }
|
|
131
|
-
/>
|
|
132
|
-
</Grid>
|
|
133
|
-
</Grid>
|
|
134
|
-
<Grid container gap={ 0.75 } alignItems="center">
|
|
135
|
-
<Grid item xs={ 12 }>
|
|
136
|
-
<Label
|
|
137
|
-
bind="inline-start"
|
|
138
|
-
label={ isSiteRtl ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' ) }
|
|
139
|
-
/>
|
|
140
|
-
</Grid>
|
|
141
|
-
<Grid item xs={ 12 }>
|
|
142
|
-
<Control
|
|
143
|
-
bind={ 'inline-start' }
|
|
144
|
-
startIcon={
|
|
145
|
-
isSiteRtl ? (
|
|
146
|
-
<SideRightIcon fontSize={ 'tiny' } />
|
|
147
|
-
) : (
|
|
148
|
-
<SideLeftIcon fontSize={ 'tiny' } />
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
isLinked={ isLinked }
|
|
152
|
-
extendedValues={ extendedValues }
|
|
153
|
-
/>
|
|
154
|
-
</Grid>
|
|
155
|
-
</Grid>
|
|
156
|
-
</Stack>
|
|
93
|
+
|
|
94
|
+
{ getCssMarginProps( isSiteRtl ).map( ( row, index ) => (
|
|
95
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap" key={ index } ref={ gridRowRefs[ index ] }>
|
|
96
|
+
{ row.map( ( { icon, ...props } ) => (
|
|
97
|
+
<Grid container gap={ 0.75 } alignItems="center" key={ props.bind }>
|
|
98
|
+
<Grid item xs={ 12 }>
|
|
99
|
+
<Label { ...props } />
|
|
100
|
+
</Grid>
|
|
101
|
+
<Grid item xs={ 12 }>
|
|
102
|
+
<Control
|
|
103
|
+
bind={ props.bind }
|
|
104
|
+
startIcon={ icon }
|
|
105
|
+
isLinked={ isLinked }
|
|
106
|
+
extendedOptions={ extendedOptions }
|
|
107
|
+
anchorRef={ gridRowRefs[ index ] }
|
|
108
|
+
/>
|
|
109
|
+
</Grid>
|
|
110
|
+
</Grid>
|
|
111
|
+
) ) }
|
|
112
|
+
</Stack>
|
|
113
|
+
) ) }
|
|
157
114
|
</PropProvider>
|
|
158
115
|
);
|
|
159
116
|
}
|
|
@@ -163,20 +120,22 @@ const Control = ( {
|
|
|
163
120
|
bind,
|
|
164
121
|
startIcon,
|
|
165
122
|
isLinked,
|
|
166
|
-
|
|
123
|
+
extendedOptions,
|
|
124
|
+
anchorRef,
|
|
167
125
|
}: {
|
|
168
126
|
bind: PropKey;
|
|
169
127
|
startIcon: React.ReactNode;
|
|
170
128
|
isLinked: boolean;
|
|
171
|
-
|
|
129
|
+
extendedOptions?: ExtendedOption[];
|
|
130
|
+
anchorRef: MutableRefObject< HTMLElement | undefined >;
|
|
172
131
|
} ) => {
|
|
173
132
|
if ( isLinked ) {
|
|
174
|
-
return <SizeControl startIcon={ startIcon }
|
|
133
|
+
return <SizeControl startIcon={ startIcon } extendedOptions={ extendedOptions } anchorRef={ anchorRef } />;
|
|
175
134
|
}
|
|
176
135
|
|
|
177
136
|
return (
|
|
178
137
|
<PropKeyProvider bind={ bind }>
|
|
179
|
-
<SizeControl startIcon={ startIcon }
|
|
138
|
+
<SizeControl startIcon={ startIcon } extendedOptions={ extendedOptions } anchorRef={ anchorRef } />
|
|
180
139
|
</PropKeyProvider>
|
|
181
140
|
);
|
|
182
141
|
};
|
|
@@ -194,3 +153,32 @@ const Label = ( { label, bind }: { label: string; bind: PropKey } ) => {
|
|
|
194
153
|
</PropKeyProvider>
|
|
195
154
|
);
|
|
196
155
|
};
|
|
156
|
+
|
|
157
|
+
function getCssMarginProps( isSiteRtl: boolean ) {
|
|
158
|
+
return [
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
bind: 'block-start',
|
|
162
|
+
label: __( 'Top', 'elementor' ),
|
|
163
|
+
icon: <SideTopIcon fontSize={ 'tiny' } />,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
bind: 'inline-end',
|
|
167
|
+
label: isSiteRtl ? __( 'Left', 'elementor' ) : __( 'Right', 'elementor' ),
|
|
168
|
+
icon: isSiteRtl ? <SideLeftIcon fontSize={ 'tiny' } /> : <SideRightIcon fontSize={ 'tiny' } />,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
{
|
|
173
|
+
bind: 'block-end',
|
|
174
|
+
label: __( 'Bottom', 'elementor' ),
|
|
175
|
+
icon: <SideBottomIcon fontSize={ 'tiny' } />,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
bind: 'inline-start',
|
|
179
|
+
label: isSiteRtl ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' ),
|
|
180
|
+
icon: isSiteRtl ? <SideRightIcon fontSize={ 'tiny' } /> : <SideLeftIcon fontSize={ 'tiny' } />,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
];
|
|
184
|
+
}
|