@elementor/editor-editing-panel 1.43.1 → 1.45.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 +41 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1247 -977
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1025 -755
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/action.tsx +1 -1
- package/src/components/add-or-remove-content.tsx +3 -4
- package/src/components/collapsible-content.tsx +42 -14
- package/src/components/control-label.tsx +1 -1
- package/src/components/section.tsx +21 -7
- package/src/components/style-sections/border-section/border-field.tsx +2 -1
- package/src/components/style-sections/border-section/border-radius-field.tsx +12 -9
- package/src/components/style-sections/layout-section/align-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/align-items-field.tsx +13 -17
- package/src/components/style-sections/layout-section/align-self-child-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-order-field.tsx +30 -33
- package/src/components/style-sections/layout-section/flex-size-field.tsx +60 -59
- package/src/components/style-sections/layout-section/justify-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/wrap-field.tsx +13 -17
- package/src/components/style-sections/position-section/dimensions-field.tsx +33 -15
- package/src/components/style-sections/position-section/offset-field.tsx +5 -2
- package/src/components/style-sections/size-section/size-section.tsx +54 -39
- package/src/components/style-sections/spacing-section/spacing-section.tsx +1 -1
- package/src/components/style-sections/typography-section/column-gap-field.tsx +5 -2
- package/src/components/style-sections/typography-section/font-size-field.tsx +5 -2
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +5 -2
- package/src/components/style-sections/typography-section/line-height-field.tsx +5 -2
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +12 -9
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +2 -1
- package/src/components/style-sections/typography-section/typography-section.tsx +15 -3
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +5 -2
- package/src/components/style-tab-collapsible-content.tsx +22 -0
- package/src/components/style-tab-section.tsx +30 -0
- package/src/components/style-tab.tsx +51 -35
- package/src/controls-registry/styles-field.tsx +1 -1
- package/src/dynamics/components/background-control-dynamic-tag.tsx +48 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +11 -15
- package/src/dynamics/init.ts +21 -0
- package/src/index.ts +1 -0
- package/src/popover-action.tsx +3 -9
- package/src/styles-inheritance/components/{label-chip.tsx → infotip/label-chip.tsx} +1 -1
- package/src/styles-inheritance/{styles-inheritance-indicator.tsx → components/styles-inheritance-indicator.tsx} +8 -8
- package/src/styles-inheritance/{styles-inheritance-infotip.tsx → components/styles-inheritance-infotip.tsx} +7 -7
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +113 -0
- package/src/styles-inheritance/components/ui-providers.tsx +18 -0
- /package/src/styles-inheritance/components/{action-icons.tsx → infotip/action-icons.tsx} +0 -0
- /package/src/styles-inheritance/components/{breakpoint-icon.tsx → infotip/breakpoint-icon.tsx} +0 -0
- /package/src/styles-inheritance/components/{index.ts → infotip/index.ts} +0 -0
- /package/src/styles-inheritance/components/{value-component.tsx → infotip/value-component.tsx} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useMemo, useState } from 'react';
|
|
2
|
+
import { type MutableRefObject, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
ControlToggleButtonGroup,
|
|
5
5
|
NumberControl,
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
} from '@elementor/editor-controls';
|
|
9
9
|
import { numberPropTypeUtil, type NumberPropValue, type SizePropValue } from '@elementor/editor-props';
|
|
10
10
|
import { ExpandIcon, PencilIcon, ShrinkIcon } from '@elementor/icons';
|
|
11
|
-
import {
|
|
11
|
+
import { Grid } from '@elementor/ui';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
import { useStyle } from '../../../contexts/style-context';
|
|
15
15
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
16
|
-
import { useDirection } from '../../../hooks/use-direction';
|
|
17
16
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
17
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
18
18
|
import { ControlLabel } from '../../control-label';
|
|
19
19
|
import { SectionContent } from '../../section-content';
|
|
20
20
|
|
|
@@ -44,7 +44,6 @@ const items: ToggleButtonGroupItem< GroupItem >[] = [
|
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
export const FlexSizeField = () => {
|
|
47
|
-
const { isSiteRtl } = useDirection();
|
|
48
47
|
const { canEdit } = useStyle();
|
|
49
48
|
|
|
50
49
|
const [ fields, setFields ] = useStylesFields< {
|
|
@@ -91,67 +90,69 @@ export const FlexSizeField = () => {
|
|
|
91
90
|
};
|
|
92
91
|
|
|
93
92
|
return (
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</ThemeProvider>
|
|
117
|
-
</DirectionProvider>
|
|
93
|
+
<UiProviders>
|
|
94
|
+
<SectionContent>
|
|
95
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
96
|
+
<StylesField bind={ activeGroup ?? '' }>
|
|
97
|
+
<Grid item xs={ 6 }>
|
|
98
|
+
<ControlLabel>{ __( 'Size', 'elementor' ) }</ControlLabel>
|
|
99
|
+
</Grid>
|
|
100
|
+
|
|
101
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
102
|
+
<ControlToggleButtonGroup
|
|
103
|
+
value={ activeGroup }
|
|
104
|
+
onChange={ onChangeGroup }
|
|
105
|
+
disabled={ ! canEdit }
|
|
106
|
+
items={ items }
|
|
107
|
+
exclusive={ true }
|
|
108
|
+
/>
|
|
109
|
+
</Grid>
|
|
110
|
+
</StylesField>
|
|
111
|
+
</Grid>
|
|
112
|
+
{ 'custom' === activeGroup && <FlexCustomField /> }
|
|
113
|
+
</SectionContent>
|
|
114
|
+
</UiProviders>
|
|
118
115
|
);
|
|
119
116
|
};
|
|
120
117
|
|
|
121
|
-
const FlexCustomField = () =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
135
|
-
<Grid item xs={ 6 }>
|
|
136
|
-
<ControlLabel>{ __( 'Shrink', 'elementor' ) }</ControlLabel>
|
|
137
|
-
</Grid>
|
|
138
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
139
|
-
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
118
|
+
const FlexCustomField = () => {
|
|
119
|
+
const flexBasisRowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<StylesField bind={ 'flex-grow' }>
|
|
124
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
125
|
+
<Grid item xs={ 6 }>
|
|
126
|
+
<ControlLabel>{ __( 'Grow', 'elementor' ) }</ControlLabel>
|
|
127
|
+
</Grid>
|
|
128
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
129
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
130
|
+
</Grid>
|
|
140
131
|
</Grid>
|
|
141
|
-
</
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
</StylesField>
|
|
133
|
+
<StylesField bind={ 'flex-shrink' }>
|
|
134
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
135
|
+
<Grid item xs={ 6 }>
|
|
136
|
+
<ControlLabel>{ __( 'Shrink', 'elementor' ) }</ControlLabel>
|
|
137
|
+
</Grid>
|
|
138
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
139
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
140
|
+
</Grid>
|
|
147
141
|
</Grid>
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
</StylesField>
|
|
143
|
+
<StylesField bind={ 'flex-basis' }>
|
|
144
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ flexBasisRowRef }>
|
|
145
|
+
<Grid item xs={ 6 }>
|
|
146
|
+
<ControlLabel>{ __( 'Basis', 'elementor' ) }</ControlLabel>
|
|
147
|
+
</Grid>
|
|
148
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
149
|
+
<SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
|
|
150
|
+
</Grid>
|
|
150
151
|
</Grid>
|
|
151
|
-
</
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
</StylesField>
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
155
156
|
|
|
156
157
|
const getActiveGroup = ( {
|
|
157
158
|
grow,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
JustifySpaceBetweenVerticalIcon as BetweenIcon,
|
|
9
9
|
JustifyTopIcon,
|
|
10
10
|
} from '@elementor/icons';
|
|
11
|
-
import {
|
|
11
|
+
import { Stack, withDirection } from '@elementor/ui';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
|
-
import {
|
|
15
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
16
16
|
import { ControlLabel } from '../../control-label';
|
|
17
17
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
18
18
|
|
|
@@ -66,18 +66,14 @@ const options: ToggleButtonGroupItem< JustifyContent >[] = [
|
|
|
66
66
|
];
|
|
67
67
|
|
|
68
68
|
export const JustifyContentField = () => {
|
|
69
|
-
const { isSiteRtl } = useDirection();
|
|
70
|
-
|
|
71
69
|
return (
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</ThemeProvider>
|
|
81
|
-
</DirectionProvider>
|
|
70
|
+
<UiProviders>
|
|
71
|
+
<StylesField bind="justify-content">
|
|
72
|
+
<Stack gap={ 0.75 }>
|
|
73
|
+
<ControlLabel>{ __( 'Justify content', 'elementor' ) }</ControlLabel>
|
|
74
|
+
<ToggleControl options={ options } fullWidth={ true } />
|
|
75
|
+
</Stack>
|
|
76
|
+
</StylesField>
|
|
77
|
+
</UiProviders>
|
|
82
78
|
);
|
|
83
79
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { ArrowBackIcon, ArrowForwardIcon, ArrowRightIcon } from '@elementor/icons';
|
|
4
|
-
import {
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
-
import {
|
|
8
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
9
9
|
import { ControlLabel } from '../../control-label';
|
|
10
10
|
|
|
11
11
|
type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
@@ -32,22 +32,18 @@ const options: ToggleButtonGroupItem< FlexWrap >[] = [
|
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
export const WrapField = () => {
|
|
35
|
-
const { isSiteRtl } = useDirection();
|
|
36
|
-
|
|
37
35
|
return (
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
<Grid
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
<ToggleControl options={ options } />
|
|
47
|
-
</Grid>
|
|
36
|
+
<UiProviders>
|
|
37
|
+
<StylesField bind={ 'flex-wrap' }>
|
|
38
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
39
|
+
<Grid item xs={ 6 }>
|
|
40
|
+
<ControlLabel>{ __( 'Wrap', 'elementor' ) }</ControlLabel>
|
|
41
|
+
</Grid>
|
|
42
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
43
|
+
<ToggleControl options={ options } />
|
|
48
44
|
</Grid>
|
|
49
|
-
</
|
|
50
|
-
</
|
|
51
|
-
</
|
|
45
|
+
</Grid>
|
|
46
|
+
</StylesField>
|
|
47
|
+
</UiProviders>
|
|
52
48
|
);
|
|
53
49
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
4
5
|
import { Grid, Stack, withDirection } from '@elementor/ui';
|
|
@@ -6,6 +7,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
7
|
|
|
7
8
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
9
|
import { useDirection } from '../../../hooks/use-direction';
|
|
10
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
9
11
|
import { ControlLabel } from '../../control-label';
|
|
10
12
|
import { RotatedIcon } from '../layout-section/utils/rotated-icon';
|
|
11
13
|
|
|
@@ -29,31 +31,47 @@ const getInlineEndLabel = ( isSiteRtl: boolean ) =>
|
|
|
29
31
|
|
|
30
32
|
export const DimensionsField = () => {
|
|
31
33
|
const { isSiteRtl } = useDirection();
|
|
34
|
+
const rowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef() ];
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
|
-
|
|
35
|
-
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
36
|
-
<DimensionField side="inset-block-start" label={ __( 'Top', 'elementor' ) } />
|
|
37
|
-
<DimensionField
|
|
37
|
+
<UiProviders>
|
|
38
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap" ref={ rowRefs[ 0 ] }>
|
|
39
|
+
<DimensionField side="inset-block-start" label={ __( 'Top', 'elementor' ) } rowRef={ rowRefs[ 0 ] } />
|
|
40
|
+
<DimensionField
|
|
41
|
+
side="inset-inline-end"
|
|
42
|
+
label={ getInlineEndLabel( isSiteRtl ) }
|
|
43
|
+
rowRef={ rowRefs[ 0 ] }
|
|
44
|
+
/>
|
|
38
45
|
</Stack>
|
|
39
|
-
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
40
|
-
<DimensionField side="inset-block-end" label={ __( 'Bottom', 'elementor' ) } />
|
|
41
|
-
<DimensionField
|
|
46
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap" ref={ rowRefs[ 1 ] }>
|
|
47
|
+
<DimensionField side="inset-block-end" label={ __( 'Bottom', 'elementor' ) } rowRef={ rowRefs[ 1 ] } />
|
|
48
|
+
<DimensionField
|
|
49
|
+
side="inset-inline-start"
|
|
50
|
+
label={ getInlineStartLabel( isSiteRtl ) }
|
|
51
|
+
rowRef={ rowRefs[ 1 ] }
|
|
52
|
+
/>
|
|
42
53
|
</Stack>
|
|
43
|
-
|
|
54
|
+
</UiProviders>
|
|
44
55
|
);
|
|
45
56
|
};
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
|
|
58
|
+
const DimensionField = ( {
|
|
59
|
+
side,
|
|
60
|
+
label,
|
|
61
|
+
rowRef,
|
|
62
|
+
}: {
|
|
63
|
+
side: Side;
|
|
64
|
+
label: string;
|
|
65
|
+
rowRef: MutableRefObject< HTMLElement | undefined >;
|
|
66
|
+
} ) => (
|
|
67
|
+
<StylesField bind={ side }>
|
|
48
68
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
49
69
|
<Grid item xs={ 12 }>
|
|
50
70
|
<ControlLabel>{ label }</ControlLabel>
|
|
51
71
|
</Grid>
|
|
52
72
|
<Grid item xs={ 12 }>
|
|
53
|
-
<
|
|
54
|
-
<SizeControl startIcon={ sideIcons[ side ] } extendedValues={ [ 'auto' ] } />
|
|
55
|
-
</StylesField>
|
|
73
|
+
<SizeControl startIcon={ sideIcons[ side ] } extendedOptions={ [ 'auto' ] } anchorRef={ rowRef } />
|
|
56
74
|
</Grid>
|
|
57
75
|
</Grid>
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
</StylesField>
|
|
77
|
+
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const OffsetField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="scroll-margin-top">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Anchor offset', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl units={ [ 'px', 'em', 'rem', 'vw', 'vh' ] } />
|
|
20
|
+
<SizeControl units={ [ 'px', 'em', 'rem', 'vw', 'vh' ] } anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
3
|
+
import { AspectRatioControl, type ExtendedOption, SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import type { StringPropValue } from '@elementor/editor-props';
|
|
4
5
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
6
|
import { Grid, Stack } from '@elementor/ui';
|
|
@@ -7,61 +8,74 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
8
|
|
|
8
9
|
import { StylesField, type StylesFieldProps } from '../../../controls-registry/styles-field';
|
|
9
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
|
-
import { CollapsibleContent } from '../../collapsible-content';
|
|
11
11
|
import { ControlLabel } from '../../control-label';
|
|
12
12
|
import { PanelDivider } from '../../panel-divider';
|
|
13
13
|
import { SectionContent } from '../../section-content';
|
|
14
|
+
import { StyleTabCollapsibleContent } from '../../style-tab-collapsible-content';
|
|
14
15
|
import { ObjectFitField } from './object-fit-field';
|
|
15
16
|
import { ObjectPositionField } from './object-position-field';
|
|
16
17
|
import { OverflowField } from './overflow-field';
|
|
17
18
|
|
|
19
|
+
const EXPERIMENT_ID = 'e_v_3_30';
|
|
20
|
+
|
|
21
|
+
const CssSizeProps = [
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
bind: 'width',
|
|
25
|
+
label: __( 'Width', 'elementor' ),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
bind: 'height',
|
|
29
|
+
label: __( 'Height', 'elementor' ),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
bind: 'min-width',
|
|
35
|
+
label: __( 'Min width', 'elementor' ),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
bind: 'min-height',
|
|
39
|
+
label: __( 'Min height', 'elementor' ),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
bind: 'max-width',
|
|
45
|
+
label: __( 'Max width', 'elementor' ),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
bind: 'max-height',
|
|
49
|
+
label: __( 'Max height', 'elementor' ),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
];
|
|
53
|
+
|
|
18
54
|
export const SizeSection = () => {
|
|
19
55
|
const [ fitValue ] = useStylesField< StringPropValue >( 'object-fit' );
|
|
20
56
|
|
|
21
57
|
const isNotFill = fitValue && fitValue?.value !== 'fill';
|
|
22
58
|
|
|
23
|
-
const
|
|
59
|
+
const gridRowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef(), useRef() ];
|
|
60
|
+
const isVersion330Active = isExperimentActive( EXPERIMENT_ID );
|
|
24
61
|
|
|
25
62
|
return (
|
|
26
63
|
<SectionContent>
|
|
27
|
-
|
|
28
|
-
<Grid
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</Grid>
|
|
35
|
-
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
36
|
-
<Grid item xs={ 6 }>
|
|
37
|
-
<SizeField
|
|
38
|
-
bind="min-width"
|
|
39
|
-
label={ __( 'Min width', 'elementor' ) }
|
|
40
|
-
extendedValues={ [ 'auto' ] }
|
|
41
|
-
/>
|
|
64
|
+
{ CssSizeProps.map( ( row, rowIndex ) => (
|
|
65
|
+
<Grid key={ rowIndex } container gap={ 2 } flexWrap="nowrap" ref={ gridRowRefs[ rowIndex ] }>
|
|
66
|
+
{ row.map( ( props ) => (
|
|
67
|
+
<Grid item xs={ 6 } key={ props.bind }>
|
|
68
|
+
<SizeField { ...props } rowRef={ gridRowRefs[ rowIndex ] } extendedOptions={ [ 'auto' ] } />
|
|
69
|
+
</Grid>
|
|
70
|
+
) ) }
|
|
42
71
|
</Grid>
|
|
43
|
-
|
|
44
|
-
<SizeField
|
|
45
|
-
bind="min-height"
|
|
46
|
-
label={ __( 'Min height', 'elementor' ) }
|
|
47
|
-
extendedValues={ [ 'auto' ] }
|
|
48
|
-
/>
|
|
49
|
-
</Grid>
|
|
50
|
-
</Grid>
|
|
51
|
-
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
52
|
-
<Grid item xs={ 6 }>
|
|
53
|
-
<SizeField bind="max-width" label={ __( 'Max width', 'elementor' ) } />
|
|
54
|
-
</Grid>
|
|
55
|
-
<Grid item xs={ 6 }>
|
|
56
|
-
<SizeField bind="max-height" label={ __( 'Max height', 'elementor' ) } />
|
|
57
|
-
</Grid>
|
|
58
|
-
</Grid>
|
|
72
|
+
) ) }
|
|
59
73
|
<PanelDivider />
|
|
60
74
|
<Stack>
|
|
61
75
|
<OverflowField />
|
|
62
76
|
</Stack>
|
|
63
77
|
{ isVersion330Active && (
|
|
64
|
-
<
|
|
78
|
+
<StyleTabCollapsibleContent fields={ [ 'aspect-ratio', 'object-fit' ] }>
|
|
65
79
|
<Stack gap={ 2 }>
|
|
66
80
|
<StylesField bind={ 'aspect-ratio' }>
|
|
67
81
|
<AspectRatioControl label={ __( 'Aspect Ratio', 'elementor' ) } />
|
|
@@ -74,7 +88,7 @@ export const SizeSection = () => {
|
|
|
74
88
|
</Grid>
|
|
75
89
|
) }
|
|
76
90
|
</Stack>
|
|
77
|
-
</
|
|
91
|
+
</StyleTabCollapsibleContent>
|
|
78
92
|
) }
|
|
79
93
|
</SectionContent>
|
|
80
94
|
);
|
|
@@ -83,10 +97,11 @@ export const SizeSection = () => {
|
|
|
83
97
|
type ControlProps = {
|
|
84
98
|
bind: StylesFieldProps[ 'bind' ];
|
|
85
99
|
label: string;
|
|
86
|
-
|
|
100
|
+
rowRef: MutableRefObject< HTMLElement | undefined >;
|
|
101
|
+
extendedOptions?: ExtendedOption[];
|
|
87
102
|
};
|
|
88
103
|
|
|
89
|
-
const SizeField = ( { label, bind,
|
|
104
|
+
const SizeField = ( { label, bind, rowRef, extendedOptions }: ControlProps ) => {
|
|
90
105
|
return (
|
|
91
106
|
<StylesField bind={ bind }>
|
|
92
107
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
@@ -94,7 +109,7 @@ const SizeField = ( { label, bind, extendedValues }: ControlProps ) => {
|
|
|
94
109
|
<ControlLabel>{ label }</ControlLabel>
|
|
95
110
|
</Grid>
|
|
96
111
|
<Grid item xs={ 12 }>
|
|
97
|
-
<SizeControl
|
|
112
|
+
<SizeControl extendedOptions={ extendedOptions } anchorRef={ rowRef } />
|
|
98
113
|
</Grid>
|
|
99
114
|
</Grid>
|
|
100
115
|
</StylesField>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const ColumnGapField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="column-gap">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Column gap', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl />
|
|
20
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const FontSizeField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="font-size">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Font size', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl />
|
|
20
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const LetterSpacingField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="letter-spacing">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Letter spacing', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl />
|
|
20
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const LineHeightField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="line-height">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Line height', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl />
|
|
20
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -5,6 +5,7 @@ import { Grid, withDirection } from '@elementor/ui';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
8
9
|
import { ControlLabel } from '../../control-label';
|
|
9
10
|
|
|
10
11
|
type Alignments = 'start' | 'center' | 'end' | 'justify';
|
|
@@ -41,15 +42,17 @@ const options: ToggleButtonGroupItem< Alignments >[] = [
|
|
|
41
42
|
|
|
42
43
|
export const TextAlignmentField = () => {
|
|
43
44
|
return (
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
<Grid
|
|
47
|
-
<
|
|
45
|
+
<UiProviders>
|
|
46
|
+
<StylesField bind={ 'text-align' }>
|
|
47
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
48
|
+
<Grid item xs={ 6 }>
|
|
49
|
+
<ControlLabel>{ __( 'Text align', 'elementor' ) }</ControlLabel>
|
|
50
|
+
</Grid>
|
|
51
|
+
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
52
|
+
<ToggleControl options={ options } />
|
|
53
|
+
</Grid>
|
|
48
54
|
</Grid>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Grid>
|
|
52
|
-
</Grid>
|
|
53
|
-
</StylesField>
|
|
55
|
+
</StylesField>
|
|
56
|
+
</UiProviders>
|
|
54
57
|
);
|
|
55
58
|
};
|