@elementor/editor-editing-panel 0.16.0 → 0.18.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 +44 -0
- package/dist/index.d.mts +26 -9
- package/dist/index.d.ts +26 -9
- package/dist/index.js +910 -360
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +886 -327
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -7
- package/src/components/settings-tab.tsx +5 -2
- package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +224 -0
- package/src/components/style-sections/effects-section/effects-section.tsx +18 -0
- package/src/components/style-sections/position-section/z-index-control.tsx +11 -7
- package/src/components/style-sections/size-section.tsx +23 -20
- package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +62 -47
- package/src/components/style-sections/typography-section/font-size-control.tsx +10 -6
- package/src/components/style-sections/typography-section/font-weight-control.tsx +16 -12
- package/src/components/style-sections/typography-section/letter-spacing-control.tsx +10 -6
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +47 -0
- package/src/components/style-sections/typography-section/text-color-control.tsx +10 -6
- package/src/components/style-sections/typography-section/text-direction-control.tsx +37 -0
- package/src/components/style-sections/typography-section/text-style-control.tsx +37 -34
- package/src/components/style-sections/typography-section/transform-control.tsx +14 -12
- package/src/components/style-sections/typography-section/typography-section.tsx +4 -0
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +10 -6
- package/src/components/style-tab.tsx +5 -1
- package/src/controls/components/control-type-container.tsx +28 -0
- package/src/controls/components/repeater.tsx +197 -0
- package/src/controls/control-actions/actions/popover-action.tsx +58 -0
- package/src/controls/control-actions/control-actions-menu.ts +8 -0
- package/src/controls/control-actions/control-actions.tsx +43 -0
- package/src/controls/control-replacement.ts +15 -7
- package/src/controls/control-types/color-control.tsx +21 -18
- package/src/controls/control-types/image-control.tsx +56 -59
- package/src/controls/control-types/image-media-control.tsx +73 -0
- package/src/controls/control-types/number-control.tsx +13 -9
- package/src/controls/control-types/select-control.tsx +13 -9
- package/src/controls/control-types/size-control.tsx +17 -13
- package/src/controls/control-types/text-area-control.tsx +15 -11
- package/src/controls/control-types/text-control.tsx +9 -3
- package/src/controls/control-types/toggle-control.tsx +3 -2
- package/src/controls/control.tsx +1 -7
- package/src/controls/controls-registry.tsx +19 -10
- package/src/controls/create-control.tsx +31 -0
- package/src/controls/settings-control.tsx +2 -9
- package/src/dynamics/components/dynamic-selection-control.tsx +4 -3
- package/src/dynamics/components/dynamic-selection.tsx +19 -8
- package/src/dynamics/dynamic-control.tsx +1 -1
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +23 -0
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +4 -4
- package/src/dynamics/hooks/use-prop-value-history.ts +26 -0
- package/src/dynamics/init.ts +9 -0
- package/src/dynamics/types.ts +6 -3
- package/src/dynamics/utils.ts +18 -5
- package/src/index.ts +2 -0
- package/src/types.ts +35 -14
- package/src/controls/components/control-container.tsx +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,16 +39,17 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "^0.
|
|
43
|
-
"@elementor/editor-panels": "^0.
|
|
42
|
+
"@elementor/editor": "^0.15.0",
|
|
43
|
+
"@elementor/editor-panels": "^0.8.0",
|
|
44
44
|
"@elementor/editor-responsive": "^0.12.1",
|
|
45
|
-
"@elementor/editor-style": "^0.
|
|
45
|
+
"@elementor/editor-style": "^0.4.1",
|
|
46
46
|
"@elementor/editor-v1-adapters": "^0.8.2",
|
|
47
|
-
"@elementor/icons": "^1.
|
|
47
|
+
"@elementor/icons": "^1.17.0",
|
|
48
|
+
"@elementor/menus": "^0.1.0",
|
|
48
49
|
"@elementor/schema": "^0.1.0",
|
|
49
|
-
"@elementor/ui": "^1.
|
|
50
|
+
"@elementor/ui": "^1.21.1",
|
|
50
51
|
"@elementor/utils": "^0.2.1",
|
|
51
|
-
"@elementor/wp-media": "^0.
|
|
52
|
+
"@elementor/wp-media": "^0.2.0",
|
|
52
53
|
"@wordpress/i18n": "^4.45.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
@@ -6,6 +6,7 @@ import { AccordionSection } from './accordion-section';
|
|
|
6
6
|
import type { Control } from '../types';
|
|
7
7
|
import { Control as BaseControl } from '../controls/control';
|
|
8
8
|
import { ControlType, getControlByType } from '../controls/controls-registry';
|
|
9
|
+
import { ControlTypeContainer } from '../controls/components/control-type-container';
|
|
9
10
|
|
|
10
11
|
export const SettingsTab = () => {
|
|
11
12
|
const { elementType } = useElementContext();
|
|
@@ -46,8 +47,10 @@ const Control = ( { control }: { control: Control[ 'value' ] } ) => {
|
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
49
|
<SettingsControl bind={ control.bind }>
|
|
49
|
-
{ control.
|
|
50
|
-
|
|
50
|
+
<ControlTypeContainer controlType={ control.type as ControlType }>
|
|
51
|
+
{ control.label ? <SettingsControl.Label>{ control.label }</SettingsControl.Label> : null }
|
|
52
|
+
<BaseControl type={ control.type as ControlType } props={ control.props } />
|
|
53
|
+
</ControlTypeContainer>
|
|
51
54
|
</SettingsControl>
|
|
52
55
|
);
|
|
53
56
|
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid, Stack, UnstableColorIndicator } from '@elementor/ui';
|
|
4
|
+
import { Repeater } from '../../../controls/components/repeater';
|
|
5
|
+
import { ControlContext, useControl } from '../../../controls/control-context';
|
|
6
|
+
import { PropValue, TransformablePropValue } from '../../../types';
|
|
7
|
+
import { SizeControl, SizeControlValue } from '../../../controls/control-types/size-control';
|
|
8
|
+
import { ColorControl, ColorPropValue } from '../../../controls/control-types/color-control';
|
|
9
|
+
import { ControlLabel } from '../../control-label';
|
|
10
|
+
import { SelectControl } from '../../../controls/control-types/select-control';
|
|
11
|
+
|
|
12
|
+
type SetContextValue = ( v: PropValue ) => void;
|
|
13
|
+
|
|
14
|
+
export type BoxShadow = TransformablePropValue< 'box-shadow', Shadow[] >;
|
|
15
|
+
|
|
16
|
+
export type Shadow = TransformablePropValue<
|
|
17
|
+
'shadow',
|
|
18
|
+
{
|
|
19
|
+
position: string;
|
|
20
|
+
hOffset: SizeControlValue;
|
|
21
|
+
vOffset: SizeControlValue;
|
|
22
|
+
blur: SizeControlValue;
|
|
23
|
+
spread: SizeControlValue;
|
|
24
|
+
color: ColorPropValue;
|
|
25
|
+
}
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export const BoxShadowRepeater = () => {
|
|
29
|
+
const { value, setValue } = useControl< BoxShadow >();
|
|
30
|
+
|
|
31
|
+
const boxShadowValues = value?.value;
|
|
32
|
+
|
|
33
|
+
const setBoxShadow = ( newValue: BoxShadow[ 'value' ] ) => {
|
|
34
|
+
setValue( {
|
|
35
|
+
$$type: 'box-shadow',
|
|
36
|
+
value: newValue,
|
|
37
|
+
} );
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Repeater
|
|
42
|
+
values={ boxShadowValues }
|
|
43
|
+
setValues={ setBoxShadow }
|
|
44
|
+
label={ __( 'Box shadow', 'elementor' ) }
|
|
45
|
+
itemSettings={ {
|
|
46
|
+
Icon: ItemIcon,
|
|
47
|
+
Label: ItemLabel,
|
|
48
|
+
Content: ItemContent,
|
|
49
|
+
initialValues: initialShadow,
|
|
50
|
+
} }
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const ItemIcon = ( { value }: { value: Shadow } ) => (
|
|
56
|
+
<UnstableColorIndicator size="inherit" component="span" value={ value.value.color.value } />
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const ItemContent = ( {
|
|
60
|
+
anchorEl,
|
|
61
|
+
value,
|
|
62
|
+
setValue,
|
|
63
|
+
}: {
|
|
64
|
+
anchorEl: HTMLElement | null;
|
|
65
|
+
value: Shadow;
|
|
66
|
+
setValue: ( newValue: Shadow ) => void;
|
|
67
|
+
} ) => {
|
|
68
|
+
const setShadow = ( newValue: Shadow[ 'value' ] ) => {
|
|
69
|
+
setValue( {
|
|
70
|
+
$$type: 'shadow',
|
|
71
|
+
value: newValue,
|
|
72
|
+
} );
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Stack gap={ 1.5 }>
|
|
77
|
+
<Grid container spacing={ 1 }>
|
|
78
|
+
<Control
|
|
79
|
+
bind="color"
|
|
80
|
+
value={ value.value.color }
|
|
81
|
+
label={ __( 'Color', 'elementor' ) }
|
|
82
|
+
setValue={ ( v: ColorPropValue ) => setShadow( { ...value.value, color: v } ) }
|
|
83
|
+
>
|
|
84
|
+
<ColorControl
|
|
85
|
+
anchorEl={ anchorEl }
|
|
86
|
+
anchorOrigin={ {
|
|
87
|
+
vertical: 'top',
|
|
88
|
+
horizontal: 'right',
|
|
89
|
+
} }
|
|
90
|
+
transformOrigin={ {
|
|
91
|
+
vertical: 'top',
|
|
92
|
+
horizontal: -10,
|
|
93
|
+
} }
|
|
94
|
+
/>
|
|
95
|
+
</Control>
|
|
96
|
+
<Control
|
|
97
|
+
bind="position"
|
|
98
|
+
value={ value.value.position }
|
|
99
|
+
label={ __( 'Position', 'elementor' ) }
|
|
100
|
+
setValue={ ( v: string ) => setShadow( { ...value.value, position: v } ) }
|
|
101
|
+
>
|
|
102
|
+
<SelectControl
|
|
103
|
+
options={ [
|
|
104
|
+
{ label: 'Inset', value: 'inset' },
|
|
105
|
+
{ label: 'Outset', value: 'outset' },
|
|
106
|
+
] }
|
|
107
|
+
/>
|
|
108
|
+
</Control>
|
|
109
|
+
</Grid>
|
|
110
|
+
<Grid container spacing={ 1 }>
|
|
111
|
+
<Control
|
|
112
|
+
bind="hOffset"
|
|
113
|
+
label={ __( 'Horizontal', 'elementor' ) }
|
|
114
|
+
value={ value.value.hOffset }
|
|
115
|
+
setValue={ ( v: SizeControlValue ) => setShadow( { ...value.value, hOffset: v } ) }
|
|
116
|
+
>
|
|
117
|
+
<SizeControl />
|
|
118
|
+
</Control>
|
|
119
|
+
<Control
|
|
120
|
+
label={ __( 'Vertical', 'elementor' ) }
|
|
121
|
+
bind="vOffset"
|
|
122
|
+
value={ value.value.vOffset }
|
|
123
|
+
setValue={ ( v: SizeControlValue ) => setShadow( { ...value.value, vOffset: v } ) }
|
|
124
|
+
>
|
|
125
|
+
<SizeControl />
|
|
126
|
+
</Control>
|
|
127
|
+
</Grid>
|
|
128
|
+
<Grid container spacing={ 1 }>
|
|
129
|
+
<Control
|
|
130
|
+
bind="blur"
|
|
131
|
+
value={ value.value.blur }
|
|
132
|
+
label={ __( 'Blur', 'elementor' ) }
|
|
133
|
+
setValue={ ( v: SizeControlValue ) => setShadow( { ...value.value, blur: v } ) }
|
|
134
|
+
>
|
|
135
|
+
<SizeControl />
|
|
136
|
+
</Control>
|
|
137
|
+
<Control
|
|
138
|
+
bind="spread"
|
|
139
|
+
label={ __( 'Spread', 'elementor' ) }
|
|
140
|
+
value={ value.value.spread }
|
|
141
|
+
setValue={ ( v: SizeControlValue ) => setShadow( { ...value.value, spread: v } ) }
|
|
142
|
+
>
|
|
143
|
+
<SizeControl />
|
|
144
|
+
</Control>
|
|
145
|
+
</Grid>
|
|
146
|
+
</Stack>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const Control = < T extends PropValue >( {
|
|
151
|
+
value,
|
|
152
|
+
setValue,
|
|
153
|
+
label,
|
|
154
|
+
bind,
|
|
155
|
+
children,
|
|
156
|
+
}: {
|
|
157
|
+
value: T;
|
|
158
|
+
bind: string;
|
|
159
|
+
label: string;
|
|
160
|
+
children: React.ReactNode;
|
|
161
|
+
setValue: ( v: T ) => void;
|
|
162
|
+
} ) => (
|
|
163
|
+
<ControlContext.Provider value={ { value, setValue: setValue as SetContextValue, bind } }>
|
|
164
|
+
<Grid item xs={ 6 }>
|
|
165
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
166
|
+
<Grid item xs={ 12 }>
|
|
167
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
168
|
+
</Grid>
|
|
169
|
+
<Grid item xs={ 12 }>
|
|
170
|
+
{ children }
|
|
171
|
+
</Grid>
|
|
172
|
+
</Grid>
|
|
173
|
+
</Grid>
|
|
174
|
+
</ControlContext.Provider>
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const ItemLabel = ( { value }: { value: Shadow } ) => {
|
|
178
|
+
const { position, hOffset, vOffset, blur, spread } = value.value;
|
|
179
|
+
|
|
180
|
+
const { size: hOffsetSize, unit: hOffsetUnit } = hOffset.value;
|
|
181
|
+
const { size: vOffsetSize, unit: vOffsetUnit } = vOffset.value;
|
|
182
|
+
const { size: blurSize, unit: blurUnit } = blur.value;
|
|
183
|
+
const { size: spreadSize, unit: spreadUnit } = spread.value;
|
|
184
|
+
|
|
185
|
+
const sizes = [
|
|
186
|
+
hOffsetSize + hOffsetUnit,
|
|
187
|
+
vOffsetSize + vOffsetUnit,
|
|
188
|
+
blurSize + blurUnit,
|
|
189
|
+
spreadSize + spreadUnit,
|
|
190
|
+
].join( ' ' );
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<span style={ { textTransform: 'capitalize' } }>
|
|
194
|
+
{ position }: { sizes }
|
|
195
|
+
</span>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const initialShadow: Shadow = {
|
|
200
|
+
$$type: 'shadow',
|
|
201
|
+
value: {
|
|
202
|
+
hOffset: {
|
|
203
|
+
$$type: 'size',
|
|
204
|
+
value: { unit: 'px', size: 0 },
|
|
205
|
+
},
|
|
206
|
+
vOffset: {
|
|
207
|
+
$$type: 'size',
|
|
208
|
+
value: { unit: 'px', size: 0 },
|
|
209
|
+
},
|
|
210
|
+
blur: {
|
|
211
|
+
$$type: 'size',
|
|
212
|
+
value: { unit: 'px', size: 0 },
|
|
213
|
+
},
|
|
214
|
+
spread: {
|
|
215
|
+
$$type: 'size',
|
|
216
|
+
value: { unit: 'px', size: 0 },
|
|
217
|
+
},
|
|
218
|
+
color: {
|
|
219
|
+
$$type: 'color',
|
|
220
|
+
value: 'rgba(0, 0, 0, 0)',
|
|
221
|
+
},
|
|
222
|
+
position: 'inset',
|
|
223
|
+
},
|
|
224
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Stack } from '@elementor/ui';
|
|
4
|
+
import { AccordionSection } from '../../accordion-section';
|
|
5
|
+
import { StyleControl } from '../../../controls/style-control';
|
|
6
|
+
import { BoxShadowRepeater } from './box-shadow-repeater';
|
|
7
|
+
|
|
8
|
+
export const EffectsSection = () => {
|
|
9
|
+
return (
|
|
10
|
+
<AccordionSection title={ __( 'Effects', 'elementor' ) }>
|
|
11
|
+
<Stack gap={ 1.5 }>
|
|
12
|
+
<StyleControl bind="box-shadow">
|
|
13
|
+
<BoxShadowRepeater />
|
|
14
|
+
</StyleControl>
|
|
15
|
+
</Stack>
|
|
16
|
+
</AccordionSection>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleControl } from '../../../controls/style-control';
|
|
3
|
-
import { ControlContainer } from '../../../controls/components/control-container';
|
|
4
2
|
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { StyleControl } from '../../../controls/style-control';
|
|
5
5
|
import { NumberControl } from '../../../controls/control-types/number-control';
|
|
6
6
|
|
|
7
7
|
export const ZIndexControl = () => {
|
|
8
8
|
return (
|
|
9
|
-
<StyleControl bind="
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
<StyleControl bind="z-index">
|
|
10
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
11
|
+
<Grid item xs={ 6 }>
|
|
12
|
+
<StyleControl.Label>{ __( 'Z-Index', 'elementor' ) }</StyleControl.Label>
|
|
13
|
+
</Grid>
|
|
14
|
+
<Grid item xs={ 6 }>
|
|
15
|
+
<NumberControl />
|
|
16
|
+
</Grid>
|
|
17
|
+
</Grid>
|
|
14
18
|
</StyleControl>
|
|
15
19
|
);
|
|
16
20
|
};
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AccordionSection } from '../accordion-section';
|
|
3
3
|
import { StyleControl, StyleControlProps } from '../../controls/style-control';
|
|
4
|
-
import { Stack } from '@elementor/ui';
|
|
4
|
+
import { Grid, Stack } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { Control as BaseControl } from '../../controls/control';
|
|
7
|
-
import { ControlContainer } from '../../controls/components/control-container';
|
|
8
7
|
|
|
9
8
|
export const SizeSection = () => {
|
|
10
9
|
return (
|
|
11
10
|
<AccordionSection title={ __( 'Size', 'elementor' ) }>
|
|
12
11
|
<Stack gap={ 1.5 }>
|
|
13
|
-
<
|
|
12
|
+
<Grid container spacing={ 2 }>
|
|
14
13
|
<Control bind="width" label={ __( 'Width', 'elementor' ) } />
|
|
15
14
|
<Control bind="height" label={ __( 'Height', 'elementor' ) } />
|
|
16
|
-
</
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</Stack>
|
|
26
|
-
</Stack>
|
|
15
|
+
</Grid>
|
|
16
|
+
<Grid container spacing={ 2 }>
|
|
17
|
+
<Control bind="min-width" label={ __( 'Min. Width', 'elementor' ) } />
|
|
18
|
+
<Control bind="min-height" label={ __( 'Min. Height', 'elementor' ) } />
|
|
19
|
+
</Grid>
|
|
20
|
+
<Grid container spacing={ 2 }>
|
|
21
|
+
<Control bind="max-width" label={ __( 'Max. Width', 'elementor' ) } />
|
|
22
|
+
<Control bind="max-height" label={ __( 'Max. Height', 'elementor' ) } />
|
|
23
|
+
</Grid>
|
|
27
24
|
</Stack>
|
|
28
25
|
</AccordionSection>
|
|
29
26
|
);
|
|
@@ -36,11 +33,17 @@ type ControlProps = {
|
|
|
36
33
|
|
|
37
34
|
const Control = ( { label, bind }: ControlProps ) => {
|
|
38
35
|
return (
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
<Grid item xs={ 6 }>
|
|
37
|
+
<StyleControl bind={ bind }>
|
|
38
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
39
|
+
<Grid item xs={ 12 }>
|
|
40
|
+
<StyleControl.Label>{ label }</StyleControl.Label>
|
|
41
|
+
</Grid>
|
|
42
|
+
<Grid item xs={ 12 }>
|
|
43
|
+
<BaseControl type={ 'size' } />
|
|
44
|
+
</Grid>
|
|
45
|
+
</Grid>
|
|
46
|
+
</StyleControl>
|
|
47
|
+
</Grid>
|
|
45
48
|
);
|
|
46
49
|
};
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { PropValue } from '../../../types';
|
|
2
|
-
import { SizeControl } from '../../../controls/control-types/size-control';
|
|
3
1
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { Stack, ToggleButton } from '@elementor/ui';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid, Stack, ToggleButton } from '@elementor/ui';
|
|
6
4
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
5
|
+
import { PropValue, TransformablePropValue } from '../../../types';
|
|
6
|
+
import { SizeControl } from '../../../controls/control-types/size-control';
|
|
7
7
|
import { ControlLabel } from '../../control-label';
|
|
8
8
|
import { ControlContext, useControl } from '../../../controls/control-context';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
9
|
|
|
11
10
|
export type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
12
11
|
|
|
13
|
-
export type LinkedDimensionsValue =
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export type LinkedDimensionsValue = TransformablePropValue<
|
|
13
|
+
'linked-dimensions',
|
|
14
|
+
{
|
|
16
15
|
isLinked: boolean;
|
|
17
16
|
top: PropValue;
|
|
18
17
|
right: PropValue;
|
|
19
18
|
bottom: PropValue;
|
|
20
19
|
left: PropValue;
|
|
21
|
-
}
|
|
22
|
-
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
23
22
|
|
|
24
23
|
export const LinkedDimensionsControl = ( { label }: { label: string } ) => {
|
|
25
24
|
const { value, setValue } = useControl< LinkedDimensionsValue >();
|
|
26
|
-
const { top, right, bottom, left, isLinked =
|
|
25
|
+
const { top, right, bottom, left, isLinked = true } = value?.value || {};
|
|
27
26
|
|
|
28
27
|
const setLinkedValue = ( position: Position, newValue: PropValue ) => {
|
|
29
28
|
const updatedValue = {
|
|
@@ -74,44 +73,60 @@ export const LinkedDimensionsControl = ( { label }: { label: string } ) => {
|
|
|
74
73
|
</ToggleButton>
|
|
75
74
|
</Stack>
|
|
76
75
|
<Stack direction="row" gap={ 2 }>
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
77
|
+
<Grid item xs={ 12 }>
|
|
78
|
+
<ControlLabel>{ __( 'Top', 'elementor' ) }</ControlLabel>
|
|
79
|
+
</Grid>
|
|
80
|
+
<Grid item xs={ 12 }>
|
|
81
|
+
<Control
|
|
82
|
+
bind={ 'top' }
|
|
83
|
+
value={ top }
|
|
84
|
+
setValue={ setLinkedValue }
|
|
85
|
+
startIcon={ <SideTopIcon fontSize={ 'tiny' } /> }
|
|
86
|
+
/>
|
|
87
|
+
</Grid>
|
|
88
|
+
</Grid>
|
|
89
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
90
|
+
<Grid item xs={ 12 }>
|
|
91
|
+
<ControlLabel>{ __( 'Right', 'elementor' ) }</ControlLabel>
|
|
92
|
+
</Grid>
|
|
93
|
+
<Grid item xs={ 12 }>
|
|
94
|
+
<Control
|
|
95
|
+
bind={ 'right' }
|
|
96
|
+
value={ right }
|
|
97
|
+
setValue={ setLinkedValue }
|
|
98
|
+
startIcon={ <SideRightIcon fontSize={ 'tiny' } /> }
|
|
99
|
+
/>
|
|
100
|
+
</Grid>
|
|
101
|
+
</Grid>
|
|
95
102
|
</Stack>
|
|
96
103
|
<Stack direction="row" gap={ 2 }>
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
105
|
+
<Grid item xs={ 12 }>
|
|
106
|
+
<ControlLabel>{ __( 'Bottom', 'elementor' ) }</ControlLabel>
|
|
107
|
+
</Grid>
|
|
108
|
+
<Grid item xs={ 12 }>
|
|
109
|
+
<Control
|
|
110
|
+
bind={ 'bottom' }
|
|
111
|
+
value={ bottom }
|
|
112
|
+
setValue={ setLinkedValue }
|
|
113
|
+
startIcon={ <SideBottomIcon fontSize={ 'tiny' } /> }
|
|
114
|
+
/>
|
|
115
|
+
</Grid>
|
|
116
|
+
</Grid>
|
|
117
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
118
|
+
<Grid item xs={ 12 }>
|
|
119
|
+
<ControlLabel>{ __( 'Left', 'elementor' ) }</ControlLabel>
|
|
120
|
+
</Grid>
|
|
121
|
+
<Grid item xs={ 12 }>
|
|
122
|
+
<Control
|
|
123
|
+
bind={ 'left' }
|
|
124
|
+
value={ left }
|
|
125
|
+
setValue={ setLinkedValue }
|
|
126
|
+
startIcon={ <SideLeftIcon fontSize={ 'tiny' } /> }
|
|
127
|
+
/>
|
|
128
|
+
</Grid>
|
|
129
|
+
</Grid>
|
|
115
130
|
</Stack>
|
|
116
131
|
</>
|
|
117
132
|
);
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
2
4
|
import { StyleControl } from '../../../controls/style-control';
|
|
3
5
|
import { SizeControl } from '../../../controls/control-types/size-control';
|
|
4
|
-
import { ControlContainer } from '../../../controls/components/control-container';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
export const FontSizeControl = () => {
|
|
8
8
|
return (
|
|
9
9
|
<StyleControl bind="font-size">
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
11
|
+
<Grid item xs={ 6 }>
|
|
12
|
+
<StyleControl.Label>{ __( 'Font Size', 'elementor' ) }</StyleControl.Label>
|
|
13
|
+
</Grid>
|
|
14
|
+
<Grid item xs={ 6 }>
|
|
15
|
+
<SizeControl />
|
|
16
|
+
</Grid>
|
|
17
|
+
</Grid>
|
|
14
18
|
</StyleControl>
|
|
15
19
|
);
|
|
16
20
|
};
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
2
4
|
import { StyleControl } from '../../../controls/style-control';
|
|
3
5
|
import { SelectControl } from '../../../controls/control-types/select-control';
|
|
4
|
-
import { ControlContainer } from '../../../controls/components/control-container';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
const fontWeightOptions = [
|
|
8
|
-
{ label: __( 'Light - 400', 'elementor' ), value: 400 },
|
|
9
|
-
{ label: __( 'Regular - 500', 'elementor' ), value: 500 },
|
|
10
|
-
{ label: __( 'Semi Bold - 600', 'elementor' ), value: 600 },
|
|
11
|
-
{ label: __( 'Bold - 700', 'elementor' ), value: 700 },
|
|
12
|
-
{ label: __( 'Black - 900', 'elementor' ), value: 900 },
|
|
8
|
+
{ label: __( 'Light - 400', 'elementor' ), value: '400' },
|
|
9
|
+
{ label: __( 'Regular - 500', 'elementor' ), value: '500' },
|
|
10
|
+
{ label: __( 'Semi Bold - 600', 'elementor' ), value: '600' },
|
|
11
|
+
{ label: __( 'Bold - 700', 'elementor' ), value: '700' },
|
|
12
|
+
{ label: __( 'Black - 900', 'elementor' ), value: '900' },
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
export const FontWeightControl = () => {
|
|
16
16
|
return (
|
|
17
|
-
<StyleControl bind="
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
<StyleControl bind="font-weight">
|
|
18
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
19
|
+
<Grid item xs={ 6 }>
|
|
20
|
+
<StyleControl.Label>{ __( 'Font Weight', 'elementor' ) }</StyleControl.Label>
|
|
21
|
+
</Grid>
|
|
22
|
+
<Grid item xs={ 6 }>
|
|
23
|
+
<SelectControl options={ fontWeightOptions } />
|
|
24
|
+
</Grid>
|
|
25
|
+
</Grid>
|
|
22
26
|
</StyleControl>
|
|
23
27
|
);
|
|
24
28
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
2
4
|
import { StyleControl } from '../../../controls/style-control';
|
|
3
5
|
import { SizeControl } from '../../../controls/control-types/size-control';
|
|
4
|
-
import { ControlContainer } from '../../../controls/components/control-container';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
export const LetterSpacingControl = () => {
|
|
8
8
|
return (
|
|
9
9
|
<StyleControl bind="letter-spacing">
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
11
|
+
<Grid item xs={ 6 }>
|
|
12
|
+
<StyleControl.Label>{ __( 'Letter Spacing', 'elementor' ) }</StyleControl.Label>
|
|
13
|
+
</Grid>
|
|
14
|
+
<Grid item xs={ 6 }>
|
|
15
|
+
<SizeControl />
|
|
16
|
+
</Grid>
|
|
17
|
+
</Grid>
|
|
14
18
|
</StyleControl>
|
|
15
19
|
);
|
|
16
20
|
};
|