@elementor/editor-editing-panel 1.46.0 → 1.48.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 +85 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +1094 -889
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +979 -780
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -18
- package/src/components/popover-scrollable-content.tsx +12 -0
- package/src/components/section-content.tsx +6 -16
- package/src/components/section.tsx +8 -4
- package/src/components/settings-tab.tsx +5 -2
- package/src/components/style-sections/background-section/background-section.tsx +4 -1
- package/src/components/style-sections/border-section/border-color-field.tsx +10 -16
- package/src/components/style-sections/border-section/border-field.tsx +14 -7
- package/src/components/style-sections/border-section/border-radius-field.tsx +4 -2
- package/src/components/style-sections/border-section/border-style-field.tsx +11 -16
- package/src/components/style-sections/border-section/border-width-field.tsx +4 -2
- package/src/components/style-sections/effects-section/effects-section.tsx +29 -6
- package/src/components/style-sections/layout-section/align-content-field.tsx +11 -12
- package/src/components/style-sections/layout-section/align-items-field.tsx +8 -11
- package/src/components/style-sections/layout-section/align-self-child-field.tsx +11 -16
- package/src/components/style-sections/layout-section/display-field.tsx +6 -6
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +11 -14
- package/src/components/style-sections/layout-section/flex-order-field.tsx +23 -20
- package/src/components/style-sections/layout-section/flex-size-field.tsx +42 -64
- package/src/components/style-sections/layout-section/gap-control-field.tsx +5 -6
- package/src/components/style-sections/layout-section/justify-content-field.tsx +11 -12
- package/src/components/style-sections/layout-section/layout-section.tsx +9 -2
- package/src/components/style-sections/layout-section/opacity-control-field.tsx +9 -13
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +6 -1
- package/src/components/style-sections/layout-section/wrap-field.tsx +10 -14
- package/src/components/style-sections/position-section/dimensions-field.tsx +4 -4
- package/src/components/style-sections/position-section/offset-field.tsx +12 -14
- package/src/components/style-sections/position-section/position-field.tsx +7 -11
- package/src/components/style-sections/position-section/position-section.tsx +19 -8
- package/src/components/style-sections/position-section/z-index-field.tsx +7 -11
- package/src/components/style-sections/size-section/object-fit-field.tsx +7 -11
- package/src/components/style-sections/size-section/object-position-field.tsx +4 -1
- package/src/components/style-sections/size-section/overflow-field.tsx +7 -11
- package/src/components/style-sections/size-section/size-section.tsx +13 -8
- package/src/components/style-sections/spacing-section/spacing-section.tsx +7 -4
- package/src/components/style-sections/typography-section/column-count-field.tsx +7 -11
- package/src/components/style-sections/typography-section/column-gap-field.tsx +9 -13
- package/src/components/style-sections/typography-section/font-family-field.tsx +9 -11
- package/src/components/style-sections/typography-section/font-size-field.tsx +9 -13
- package/src/components/style-sections/typography-section/font-style-field.tsx +13 -13
- package/src/components/style-sections/typography-section/font-weight-field.tsx +7 -11
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +9 -13
- package/src/components/style-sections/typography-section/line-height-field.tsx +9 -13
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +11 -14
- package/src/components/style-sections/typography-section/text-color-field.tsx +7 -11
- package/src/components/style-sections/typography-section/text-decoration-field.tsx +7 -11
- package/src/components/style-sections/typography-section/text-direction-field.tsx +7 -11
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +7 -3
- package/src/components/style-sections/typography-section/transform-field.tsx +7 -11
- package/src/components/style-sections/typography-section/typography-section.tsx +6 -1
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +9 -13
- package/src/components/style-tab.tsx +1 -1
- package/src/components/styles-field-layout.tsx +50 -0
- package/src/contexts/section-context.tsx +14 -0
- package/src/controls-registry/control-type-container.tsx +6 -2
- package/src/controls-registry/controls-registry.tsx +1 -1
- package/src/controls-registry/settings-field.tsx +85 -10
- package/src/controls-registry/styles-field.tsx +15 -5
- package/src/dynamics/components/dynamic-selection-control.tsx +10 -4
- package/src/dynamics/components/dynamic-selection.tsx +18 -14
- package/src/hooks/use-default-panel-settings.ts +4 -0
- package/src/hooks/use-styles-field.ts +3 -4
- package/src/hooks/use-styles-fields.ts +141 -73
- package/src/index.ts +4 -0
- package/src/init.ts +0 -6
- package/src/popover-action.tsx +8 -1
- package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +4 -1
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +9 -19
- package/src/sync/experiments-flags.ts +1 -0
- package/src/components/popover-content.tsx +0 -15
|
@@ -11,9 +11,12 @@ import { useStylesField } from '../../../hooks/use-styles-field';
|
|
|
11
11
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
12
12
|
import { ControlLabel } from '../../control-label';
|
|
13
13
|
import { SectionContent } from '../../section-content';
|
|
14
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
14
15
|
|
|
15
16
|
type GroupControlItemOption = 'first' | 'last' | 'custom';
|
|
16
17
|
|
|
18
|
+
const ORDER_LABEL = __( 'Order', 'elementor' );
|
|
19
|
+
|
|
17
20
|
export const FIRST_DEFAULT_VALUE = -99999;
|
|
18
21
|
export const LAST_DEFAULT_VALUE = 99999;
|
|
19
22
|
const FIRST = 'first';
|
|
@@ -47,7 +50,13 @@ const items: ToggleButtonGroupItem< GroupControlItemOption >[] = [
|
|
|
47
50
|
];
|
|
48
51
|
|
|
49
52
|
export const FlexOrderField = () => {
|
|
50
|
-
const {
|
|
53
|
+
const {
|
|
54
|
+
value: order,
|
|
55
|
+
setValue: setOrder,
|
|
56
|
+
canEdit,
|
|
57
|
+
} = useStylesField< NumberPropValue | null >( 'order', {
|
|
58
|
+
history: { propDisplayName: ORDER_LABEL },
|
|
59
|
+
} );
|
|
51
60
|
|
|
52
61
|
const [ groupControlValue, setGroupControlValue ] = useState( getGroupControlValue( order?.value || null ) );
|
|
53
62
|
|
|
@@ -64,24 +73,18 @@ export const FlexOrderField = () => {
|
|
|
64
73
|
};
|
|
65
74
|
|
|
66
75
|
return (
|
|
67
|
-
<
|
|
68
|
-
<
|
|
76
|
+
<StylesField bind="order" propDisplayName={ ORDER_LABEL }>
|
|
77
|
+
<UiProviders>
|
|
69
78
|
<SectionContent>
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
exclusive={ true }
|
|
80
|
-
disabled={ ! canEdit }
|
|
81
|
-
/>
|
|
82
|
-
</Grid>
|
|
83
|
-
</Grid>
|
|
84
|
-
|
|
79
|
+
<StylesFieldLayout label={ ORDER_LABEL }>
|
|
80
|
+
<ControlToggleButtonGroup
|
|
81
|
+
items={ items }
|
|
82
|
+
value={ groupControlValue }
|
|
83
|
+
onChange={ handleToggleButtonChange }
|
|
84
|
+
exclusive={ true }
|
|
85
|
+
disabled={ ! canEdit }
|
|
86
|
+
/>
|
|
87
|
+
</StylesFieldLayout>
|
|
85
88
|
{ CUSTOM === groupControlValue && (
|
|
86
89
|
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
87
90
|
<Grid item xs={ 6 }>
|
|
@@ -97,8 +100,8 @@ export const FlexOrderField = () => {
|
|
|
97
100
|
</Grid>
|
|
98
101
|
) }
|
|
99
102
|
</SectionContent>
|
|
100
|
-
</
|
|
101
|
-
</
|
|
103
|
+
</UiProviders>
|
|
104
|
+
</StylesField>
|
|
102
105
|
);
|
|
103
106
|
};
|
|
104
107
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useRef, useState } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
ControlToggleButtonGroup,
|
|
5
5
|
NumberControl,
|
|
@@ -8,17 +8,18 @@ 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 { Grid } from '@elementor/ui';
|
|
12
11
|
import { __ } from '@wordpress/i18n';
|
|
13
12
|
|
|
14
13
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
14
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
16
15
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
17
|
-
import { ControlLabel } from '../../control-label';
|
|
18
16
|
import { SectionContent } from '../../section-content';
|
|
17
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
19
18
|
|
|
20
19
|
type GroupItem = 'flex-grow' | 'flex-shrink' | 'custom';
|
|
21
20
|
|
|
21
|
+
const FLEX_SIZE_LABEL = __( 'Flex Size', 'elementor' );
|
|
22
|
+
|
|
22
23
|
const DEFAULT = 1;
|
|
23
24
|
|
|
24
25
|
const items: ToggleButtonGroupItem< GroupItem >[] = [
|
|
@@ -59,53 +60,45 @@ export const FlexSizeField = () => {
|
|
|
59
60
|
const onChangeGroup = ( group: GroupItem | null = null ) => {
|
|
60
61
|
setActiveGroup( group );
|
|
61
62
|
|
|
63
|
+
let props;
|
|
64
|
+
|
|
62
65
|
if ( ! group || group === 'custom' ) {
|
|
63
|
-
|
|
66
|
+
props = {
|
|
64
67
|
'flex-basis': null,
|
|
65
68
|
'flex-grow': null,
|
|
66
69
|
'flex-shrink': null,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if ( group === 'flex-grow' ) {
|
|
73
|
-
setValues( {
|
|
70
|
+
};
|
|
71
|
+
} else if ( group === 'flex-grow' ) {
|
|
72
|
+
props = {
|
|
74
73
|
'flex-basis': null,
|
|
75
74
|
'flex-grow': numberPropTypeUtil.create( DEFAULT ),
|
|
76
75
|
'flex-shrink': null,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
};
|
|
77
|
+
} else {
|
|
78
|
+
props = {
|
|
79
|
+
'flex-basis': null,
|
|
80
|
+
'flex-grow': null,
|
|
81
|
+
'flex-shrink': numberPropTypeUtil.create( DEFAULT ),
|
|
82
|
+
};
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
setValues( {
|
|
83
|
-
'flex-basis': null,
|
|
84
|
-
'flex-grow': null,
|
|
85
|
-
'flex-shrink': numberPropTypeUtil.create( DEFAULT ),
|
|
86
|
-
} );
|
|
85
|
+
setValues( props, { history: { propDisplayName: FLEX_SIZE_LABEL } } );
|
|
87
86
|
};
|
|
88
87
|
|
|
89
88
|
return (
|
|
90
89
|
<UiProviders>
|
|
91
90
|
<SectionContent>
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
items={ items }
|
|
104
|
-
exclusive={ true }
|
|
105
|
-
/>
|
|
106
|
-
</Grid>
|
|
107
|
-
</StylesField>
|
|
108
|
-
</Grid>
|
|
91
|
+
<StylesField bind={ activeGroup ?? '' } propDisplayName={ FLEX_SIZE_LABEL }>
|
|
92
|
+
<StylesFieldLayout label={ FLEX_SIZE_LABEL }>
|
|
93
|
+
<ControlToggleButtonGroup
|
|
94
|
+
value={ activeGroup }
|
|
95
|
+
onChange={ onChangeGroup }
|
|
96
|
+
disabled={ ! canEdit }
|
|
97
|
+
items={ items }
|
|
98
|
+
exclusive={ true }
|
|
99
|
+
/>
|
|
100
|
+
</StylesFieldLayout>
|
|
101
|
+
</StylesField>
|
|
109
102
|
{ 'custom' === activeGroup && <FlexCustomField /> }
|
|
110
103
|
</SectionContent>
|
|
111
104
|
</UiProviders>
|
|
@@ -113,39 +106,24 @@ export const FlexSizeField = () => {
|
|
|
113
106
|
};
|
|
114
107
|
|
|
115
108
|
const FlexCustomField = () => {
|
|
116
|
-
const flexBasisRowRef
|
|
109
|
+
const flexBasisRowRef = useRef< HTMLDivElement >( null );
|
|
117
110
|
|
|
118
111
|
return (
|
|
119
112
|
<>
|
|
120
|
-
<StylesField bind=
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
</Grid>
|
|
125
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
126
|
-
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
127
|
-
</Grid>
|
|
128
|
-
</Grid>
|
|
113
|
+
<StylesField bind="flex-grow" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
114
|
+
<StylesFieldLayout label={ __( 'Grow', 'elementor' ) }>
|
|
115
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
116
|
+
</StylesFieldLayout>
|
|
129
117
|
</StylesField>
|
|
130
|
-
<StylesField bind=
|
|
131
|
-
<
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
</Grid>
|
|
135
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
136
|
-
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
137
|
-
</Grid>
|
|
138
|
-
</Grid>
|
|
118
|
+
<StylesField bind="flex-shrink" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
119
|
+
<StylesFieldLayout label={ __( 'Shrink', 'elementor' ) }>
|
|
120
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
121
|
+
</StylesFieldLayout>
|
|
139
122
|
</StylesField>
|
|
140
|
-
<StylesField bind=
|
|
141
|
-
<
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
</Grid>
|
|
145
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
146
|
-
<SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
|
|
147
|
-
</Grid>
|
|
148
|
-
</Grid>
|
|
123
|
+
<StylesField bind="flex-basis" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
124
|
+
<StylesFieldLayout label={ __( 'Basis', 'elementor' ) } ref={ flexBasisRowRef }>
|
|
125
|
+
<SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
|
|
126
|
+
</StylesFieldLayout>
|
|
149
127
|
</StylesField>
|
|
150
128
|
</>
|
|
151
129
|
);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GapControl } from '@elementor/editor-controls';
|
|
3
|
-
import { Stack } from '@elementor/ui';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
5
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
6
|
|
|
7
|
+
const GAPS_LABEL = __( 'Gaps', 'elementor' );
|
|
8
|
+
|
|
8
9
|
export const GapControlField = () => {
|
|
9
10
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
</StylesField>
|
|
14
|
-
</Stack>
|
|
11
|
+
<StylesField bind={ 'gap' } propDisplayName={ GAPS_LABEL }>
|
|
12
|
+
<GapControl label={ GAPS_LABEL } />
|
|
13
|
+
</StylesField>
|
|
15
14
|
);
|
|
16
15
|
};
|
|
@@ -8,16 +8,18 @@ import {
|
|
|
8
8
|
JustifySpaceBetweenVerticalIcon as BetweenIcon,
|
|
9
9
|
JustifyTopIcon,
|
|
10
10
|
} from '@elementor/icons';
|
|
11
|
-
import {
|
|
11
|
+
import { withDirection } from '@elementor/ui';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
15
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
16
|
-
import {
|
|
16
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
17
17
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
18
18
|
|
|
19
19
|
type JustifyContent = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
20
20
|
|
|
21
|
+
const JUSTIFY_CONTENT_LABEL = __( 'Justify content', 'elementor' );
|
|
22
|
+
|
|
21
23
|
const StartIcon = withDirection( JustifyTopIcon );
|
|
22
24
|
const EndIcon = withDirection( JustifyBottomIcon );
|
|
23
25
|
|
|
@@ -65,15 +67,12 @@ const options: ToggleButtonGroupItem< JustifyContent >[] = [
|
|
|
65
67
|
},
|
|
66
68
|
];
|
|
67
69
|
|
|
68
|
-
export const JustifyContentField = () =>
|
|
69
|
-
|
|
70
|
+
export const JustifyContentField = () => (
|
|
71
|
+
<StylesField bind="justify-content" propDisplayName={ JUSTIFY_CONTENT_LABEL }>
|
|
70
72
|
<UiProviders>
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
<ToggleControl options={ options } fullWidth={ true } />
|
|
75
|
-
</Stack>
|
|
76
|
-
</StylesField>
|
|
73
|
+
<StylesFieldLayout label={ JUSTIFY_CONTENT_LABEL } direction="column">
|
|
74
|
+
<ToggleControl options={ options } fullWidth={ true } />
|
|
75
|
+
</StylesFieldLayout>
|
|
77
76
|
</UiProviders>
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
</StylesField>
|
|
78
|
+
);
|
|
@@ -20,8 +20,13 @@ import { GapControlField } from './gap-control-field';
|
|
|
20
20
|
import { JustifyContentField } from './justify-content-field';
|
|
21
21
|
import { WrapField } from './wrap-field';
|
|
22
22
|
|
|
23
|
+
const DISPLAY_LABEL = __( 'Display', 'elementor' );
|
|
24
|
+
const FLEX_WRAP_LABEL = __( 'Flex wrap', 'elementor' );
|
|
25
|
+
|
|
23
26
|
export const LayoutSection = () => {
|
|
24
|
-
const { value: display } = useStylesField< StringPropValue >( 'display'
|
|
27
|
+
const { value: display } = useStylesField< StringPropValue >( 'display', {
|
|
28
|
+
history: { propDisplayName: DISPLAY_LABEL },
|
|
29
|
+
} );
|
|
25
30
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
26
31
|
const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
|
|
27
32
|
const { element } = useElement();
|
|
@@ -39,7 +44,9 @@ export const LayoutSection = () => {
|
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
const FlexFields = () => {
|
|
42
|
-
const { value: flexWrap } = useStylesField< StringPropValue >( 'flex-wrap'
|
|
47
|
+
const { value: flexWrap } = useStylesField< StringPropValue >( 'flex-wrap', {
|
|
48
|
+
history: { propDisplayName: FLEX_WRAP_LABEL },
|
|
49
|
+
} );
|
|
43
50
|
|
|
44
51
|
return (
|
|
45
52
|
<>
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from 'react';
|
|
3
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
4
|
-
import { Grid } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
-
import {
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
|
+
|
|
9
|
+
const OPACITY_LABEL = __( 'Opacity', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const OpacityControlField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement | null >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind={ 'opacity' }>
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl units={ [ '%' ] } anchorRef={ rowRef } defaultUnit="%" />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind={ 'opacity' } propDisplayName={ OPACITY_LABEL }>
|
|
16
|
+
<StylesFieldLayout ref={ rowRef } label={ OPACITY_LABEL }>
|
|
17
|
+
<SizeControl units={ [ '%' ] } anchorRef={ rowRef } defaultUnit="%" />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
4
4
|
import { type ToggleButtonProps, useTheme } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
import { useStylesField } from '../../../../hooks/use-styles-field';
|
|
7
8
|
import type { FlexDirection } from '../flex-direction-field';
|
|
@@ -14,6 +15,8 @@ type Props = {
|
|
|
14
15
|
disableRotationForReversed?: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
const FLEX_DIRECTION_LABEL = __( 'Flex direction', 'elementor' );
|
|
19
|
+
|
|
17
20
|
const CLOCKWISE_ANGLES: Record< FlexDirection, number > = {
|
|
18
21
|
row: 0,
|
|
19
22
|
column: 90,
|
|
@@ -48,7 +51,9 @@ const useGetTargetAngle = (
|
|
|
48
51
|
disableRotationForReversed: boolean,
|
|
49
52
|
existingRef?: React.MutableRefObject< number >
|
|
50
53
|
) => {
|
|
51
|
-
const { value: direction } = useStylesField< StringPropValue >( 'flex-direction'
|
|
54
|
+
const { value: direction } = useStylesField< StringPropValue >( 'flex-direction', {
|
|
55
|
+
history: { propDisplayName: FLEX_DIRECTION_LABEL },
|
|
56
|
+
} );
|
|
52
57
|
const isRtl = 'rtl' === useTheme().direction;
|
|
53
58
|
const rotationMultiplier = isRtl ? -1 : 1;
|
|
54
59
|
const angleMap = isClockwise ? CLOCKWISE_ANGLES : COUNTER_CLOCKWISE_ANGLES;
|
|
@@ -1,15 +1,16 @@
|
|
|
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 { Grid } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
7
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
9
|
-
import {
|
|
8
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
10
9
|
|
|
11
10
|
type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
12
11
|
|
|
12
|
+
const FLEX_WRAP_LABEL = __( 'Wrap', 'elementor' );
|
|
13
|
+
|
|
13
14
|
const options: ToggleButtonGroupItem< FlexWrap >[] = [
|
|
14
15
|
{
|
|
15
16
|
value: 'nowrap',
|
|
@@ -33,17 +34,12 @@ const options: ToggleButtonGroupItem< FlexWrap >[] = [
|
|
|
33
34
|
|
|
34
35
|
export const WrapField = () => {
|
|
35
36
|
return (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<ToggleControl options={ options } />
|
|
44
|
-
</Grid>
|
|
45
|
-
</Grid>
|
|
46
|
-
</StylesField>
|
|
47
|
-
</UiProviders>
|
|
37
|
+
<StylesField bind="flex-wrap" propDisplayName={ FLEX_WRAP_LABEL }>
|
|
38
|
+
<UiProviders>
|
|
39
|
+
<StylesFieldLayout label={ FLEX_WRAP_LABEL }>
|
|
40
|
+
<ToggleControl options={ options } />
|
|
41
|
+
</StylesFieldLayout>
|
|
42
|
+
</UiProviders>
|
|
43
|
+
</StylesField>
|
|
48
44
|
);
|
|
49
45
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from 'react';
|
|
3
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
4
4
|
import { SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
5
5
|
import { Grid, Stack, withDirection } from '@elementor/ui';
|
|
@@ -31,7 +31,7 @@ const getInlineEndLabel = ( isSiteRtl: boolean ) =>
|
|
|
31
31
|
|
|
32
32
|
export const DimensionsField = () => {
|
|
33
33
|
const { isSiteRtl } = useDirection();
|
|
34
|
-
const rowRefs
|
|
34
|
+
const rowRefs = [ useRef< HTMLDivElement >( null ), useRef< HTMLDivElement >( null ) ];
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<UiProviders>
|
|
@@ -62,9 +62,9 @@ const DimensionField = ( {
|
|
|
62
62
|
}: {
|
|
63
63
|
side: Side;
|
|
64
64
|
label: string;
|
|
65
|
-
rowRef:
|
|
65
|
+
rowRef: React.RefObject< HTMLDivElement >;
|
|
66
66
|
} ) => (
|
|
67
|
-
<StylesField bind={ side }>
|
|
67
|
+
<StylesField bind={ side } propDisplayName={ label }>
|
|
68
68
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
69
69
|
<Grid item xs={ 12 }>
|
|
70
70
|
<ControlLabel>{ label }</ControlLabel>
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SizeControl } from '@elementor/editor-controls';
|
|
4
|
-
import { Grid } from '@elementor/ui';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { SizeControl, type Unit } from '@elementor/editor-controls';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
-
import {
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
|
+
|
|
9
|
+
const OFFSET_LABEL = __( 'Anchor offset', 'elementor' );
|
|
10
|
+
|
|
11
|
+
const UNITS: Unit[] = [ 'px', 'em', 'rem', 'vw', 'vh' ];
|
|
9
12
|
|
|
10
13
|
export const OffsetField = () => {
|
|
11
|
-
const rowRef
|
|
14
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
15
|
|
|
13
16
|
return (
|
|
14
|
-
<StylesField bind="scroll-margin-top">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl units={ [ 'px', 'em', 'rem', 'vw', 'vh' ] } anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
17
|
+
<StylesField bind="scroll-margin-top" propDisplayName={ OFFSET_LABEL }>
|
|
18
|
+
<StylesFieldLayout label={ OFFSET_LABEL } ref={ rowRef }>
|
|
19
|
+
<SizeControl units={ UNITS } anchorRef={ rowRef } />
|
|
20
|
+
</StylesFieldLayout>
|
|
23
21
|
</StylesField>
|
|
24
22
|
);
|
|
25
23
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SelectControl } from '@elementor/editor-controls';
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
5
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import {
|
|
6
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
7
|
+
|
|
8
|
+
const POSITION_LABEL = __( 'Position', 'elementor' );
|
|
8
9
|
|
|
9
10
|
const positionOptions = [
|
|
10
11
|
{ label: __( 'Static', 'elementor' ), value: 'static' },
|
|
@@ -20,15 +21,10 @@ type Props = {
|
|
|
20
21
|
|
|
21
22
|
export const PositionField = ( { onChange }: Props ) => {
|
|
22
23
|
return (
|
|
23
|
-
<StylesField bind="position">
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
</Grid>
|
|
28
|
-
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
29
|
-
<SelectControl options={ positionOptions } onChange={ onChange } />
|
|
30
|
-
</Grid>
|
|
31
|
-
</Grid>
|
|
24
|
+
<StylesField bind="position" propDisplayName={ POSITION_LABEL }>
|
|
25
|
+
<StylesFieldLayout label={ POSITION_LABEL }>
|
|
26
|
+
<SelectControl options={ positionOptions } onChange={ onChange } />
|
|
27
|
+
</StylesFieldLayout>
|
|
32
28
|
</StylesField>
|
|
33
29
|
);
|
|
34
30
|
};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
4
|
import { useSessionStorage } from '@elementor/session';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
import { useStyle } from '../../../contexts/style-context';
|
|
7
8
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
@@ -28,8 +29,13 @@ type DimensionsValues = {
|
|
|
28
29
|
'inset-inline-end': DimensionValue;
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
const POSITION_LABEL = __( 'Position', 'elementor' );
|
|
33
|
+
const DIMENSIONS_LABEL = __( 'Dimensions', 'elementor' );
|
|
34
|
+
|
|
31
35
|
export const PositionSection = () => {
|
|
32
|
-
const { value: positionValue } = useStylesField< StringPropValue >( 'position'
|
|
36
|
+
const { value: positionValue } = useStylesField< StringPropValue >( 'position', {
|
|
37
|
+
history: { propDisplayName: POSITION_LABEL },
|
|
38
|
+
} );
|
|
33
39
|
const { values: dimensions, setValues: setDimensions } = useStylesFields< DimensionsValues >( [
|
|
34
40
|
'inset-block-start',
|
|
35
41
|
'inset-block-end',
|
|
@@ -41,19 +47,24 @@ export const PositionSection = () => {
|
|
|
41
47
|
const isCssIdFeatureActive = isExperimentActive( 'e_v_3_30' );
|
|
42
48
|
|
|
43
49
|
const onPositionChange = ( newPosition: string | null, previousPosition: string | null | undefined ) => {
|
|
50
|
+
const meta = { history: { propDisplayName: DIMENSIONS_LABEL } };
|
|
51
|
+
|
|
44
52
|
if ( newPosition === 'static' ) {
|
|
45
53
|
if ( dimensions ) {
|
|
46
54
|
updateDimensionsHistory( dimensions );
|
|
47
|
-
setDimensions(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
setDimensions(
|
|
56
|
+
{
|
|
57
|
+
'inset-block-start': undefined,
|
|
58
|
+
'inset-block-end': undefined,
|
|
59
|
+
'inset-inline-start': undefined,
|
|
60
|
+
'inset-inline-end': undefined,
|
|
61
|
+
},
|
|
62
|
+
meta
|
|
63
|
+
);
|
|
53
64
|
}
|
|
54
65
|
} else if ( previousPosition === 'static' ) {
|
|
55
66
|
if ( dimensionsValuesFromHistory ) {
|
|
56
|
-
setDimensions( dimensionsValuesFromHistory );
|
|
67
|
+
setDimensions( dimensionsValuesFromHistory, meta );
|
|
57
68
|
clearDimensionsHistory();
|
|
58
69
|
}
|
|
59
70
|
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { NumberControl } from '@elementor/editor-controls';
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
5
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import {
|
|
6
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
7
|
+
|
|
8
|
+
const Z_INDEX_LABEL = __( 'Z-index', 'elementor' );
|
|
8
9
|
|
|
9
10
|
export const ZIndexField = () => {
|
|
10
11
|
return (
|
|
11
|
-
<StylesField bind="z-index">
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</Grid>
|
|
16
|
-
<Grid item xs={ 6 }>
|
|
17
|
-
<NumberControl />
|
|
18
|
-
</Grid>
|
|
19
|
-
</Grid>
|
|
12
|
+
<StylesField bind="z-index" propDisplayName={ Z_INDEX_LABEL }>
|
|
13
|
+
<StylesFieldLayout label={ Z_INDEX_LABEL }>
|
|
14
|
+
<NumberControl />
|
|
15
|
+
</StylesFieldLayout>
|
|
20
16
|
</StylesField>
|
|
21
17
|
);
|
|
22
18
|
};
|