@elementor/editor-editing-panel 1.45.0 → 1.47.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 +90 -0
- package/dist/index.d.mts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +1187 -1051
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1027 -893
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -17
- package/src/components/css-classes/css-class-menu.tsx +6 -8
- package/src/components/css-classes/css-class-selector.tsx +17 -11
- 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 +30 -4
- package/src/components/style-indicator.tsx +19 -15
- 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 +4 -6
- 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 +22 -2
- 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 +32 -37
- package/src/components/style-sections/layout-section/flex-size-field.tsx +35 -58
- 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 +2 -2
- package/src/components/style-sections/layout-section/opacity-control-field.tsx +21 -0
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +1 -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 +6 -6
- 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 -23
- package/src/components/style-sections/size-section/overflow-field.tsx +7 -11
- package/src/components/style-sections/size-section/size-section.tsx +10 -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 +8 -8
- package/src/components/style-sections/typography-section/transform-field.tsx +7 -11
- package/src/components/style-sections/typography-section/typography-section.tsx +4 -2
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +9 -13
- 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 +30 -10
- package/src/controls-registry/settings-field.tsx +65 -6
- package/src/controls-registry/styles-field.tsx +11 -5
- package/src/dynamics/components/dynamic-selection-control.tsx +20 -22
- package/src/dynamics/components/dynamic-selection.tsx +64 -79
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +1 -1
- package/src/hooks/use-default-panel-settings.ts +4 -0
- package/src/hooks/use-styles-field.ts +9 -3
- package/src/hooks/use-styles-fields.ts +4 -4
- package/src/index.ts +5 -0
- package/src/popover-action.tsx +11 -6
- package/src/provider-colors-registry.ts +20 -0
- package/src/styles-inheritance/components/infotip/label-chip.tsx +4 -5
- package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +36 -41
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +10 -24
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +29 -44
- package/src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx +1 -17
- package/src/styles-inheritance/types.ts +0 -2
- package/src/styles-inheritance/utils.ts +17 -1
- package/src/sync/experiments-flags.ts +1 -0
- package/src/utils/get-styles-provider-color.ts +28 -0
- package/src/components/popover-content.tsx +0 -15
|
@@ -6,15 +6,17 @@ import {
|
|
|
6
6
|
LayoutAlignRightIcon,
|
|
7
7
|
LayoutDistributeVerticalIcon as JustifyIcon,
|
|
8
8
|
} from '@elementor/icons';
|
|
9
|
-
import {
|
|
9
|
+
import { type ToggleButtonProps, withDirection } from '@elementor/ui';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
13
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
14
|
-
import {
|
|
14
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
15
15
|
import { type FlexDirection } from './flex-direction-field';
|
|
16
16
|
import { RotatedIcon } from './utils/rotated-icon';
|
|
17
17
|
|
|
18
|
+
const ALIGN_SELF_LABEL = __( 'Align self', 'elementor' );
|
|
19
|
+
|
|
18
20
|
const ALIGN_SELF_CHILD_OFFSET_MAP: Record< FlexDirection, number > = {
|
|
19
21
|
row: 90,
|
|
20
22
|
'row-reverse': 90,
|
|
@@ -84,19 +86,12 @@ const getOptions = ( parentStyleDirection: FlexDirection ) => [
|
|
|
84
86
|
},
|
|
85
87
|
];
|
|
86
88
|
|
|
87
|
-
export const AlignSelfChild = ( { parentStyleDirection }: { parentStyleDirection: FlexDirection } ) =>
|
|
88
|
-
|
|
89
|
+
export const AlignSelfChild = ( { parentStyleDirection }: { parentStyleDirection: FlexDirection } ) => (
|
|
90
|
+
<StylesField bind="align-self" propDisplayName={ ALIGN_SELF_LABEL }>
|
|
89
91
|
<UiProviders>
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
<ControlLabel>{ __( 'Align self', 'elementor' ) }</ControlLabel>
|
|
94
|
-
</Grid>
|
|
95
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
96
|
-
<ToggleControl options={ getOptions( parentStyleDirection as FlexDirection ) } />
|
|
97
|
-
</Grid>
|
|
98
|
-
</Grid>
|
|
99
|
-
</StylesField>
|
|
92
|
+
<StylesFieldLayout label={ ALIGN_SELF_LABEL }>
|
|
93
|
+
<ToggleControl options={ getOptions( parentStyleDirection ) } />
|
|
94
|
+
</StylesFieldLayout>
|
|
100
95
|
</UiProviders>
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
</StylesField>
|
|
97
|
+
);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
|
-
import { Stack } from '@elementor/ui';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
import { useStylesInheritanceChain } from '../../../contexts/styles-inheritance-context';
|
|
8
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
9
8
|
import { EXPERIMENTAL_FEATURES } from '../../../sync/experiments-flags';
|
|
10
|
-
import {
|
|
9
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
11
10
|
|
|
12
11
|
type Displays = 'block' | 'flex' | 'inline-block' | 'inline-flex' | 'none';
|
|
13
12
|
|
|
13
|
+
const DISPLAY_LABEL = __( 'Display', 'elementor' );
|
|
14
|
+
|
|
14
15
|
const displayFieldItems: ToggleButtonGroupItem< Displays >[] = [
|
|
15
16
|
{
|
|
16
17
|
value: 'block',
|
|
@@ -55,11 +56,10 @@ export const DisplayField = () => {
|
|
|
55
56
|
const placeholder = useDisplayPlaceholderValue();
|
|
56
57
|
|
|
57
58
|
return (
|
|
58
|
-
<StylesField bind="display" placeholder={ placeholder }>
|
|
59
|
-
<
|
|
60
|
-
<ControlLabel>{ __( 'Display', 'elementor' ) }</ControlLabel>
|
|
59
|
+
<StylesField bind="display" propDisplayName={ DISPLAY_LABEL } placeholder={ placeholder }>
|
|
60
|
+
<StylesFieldLayout label={ DISPLAY_LABEL } direction="column">
|
|
61
61
|
<ToggleControl options={ items } maxItems={ 4 } fullWidth={ true } />
|
|
62
|
-
</
|
|
62
|
+
</StylesFieldLayout>
|
|
63
63
|
</StylesField>
|
|
64
64
|
);
|
|
65
65
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { ArrowDownSmallIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpSmallIcon } from '@elementor/icons';
|
|
4
|
-
import {
|
|
4
|
+
import { withDirection } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
8
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
9
|
-
import {
|
|
9
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
10
10
|
|
|
11
11
|
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
12
12
|
|
|
13
|
+
const FLEX_DIRECTION_LABEL = __( 'Direction', 'elementor' );
|
|
14
|
+
|
|
13
15
|
const options: ToggleButtonGroupItem< FlexDirection >[] = [
|
|
14
16
|
{
|
|
15
17
|
value: 'row',
|
|
@@ -45,17 +47,12 @@ const options: ToggleButtonGroupItem< FlexDirection >[] = [
|
|
|
45
47
|
|
|
46
48
|
export const FlexDirectionField = () => {
|
|
47
49
|
return (
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<ToggleControl options={ options } />
|
|
56
|
-
</Grid>
|
|
57
|
-
</Grid>
|
|
58
|
-
</StylesField>
|
|
59
|
-
</UiProviders>
|
|
50
|
+
<StylesField bind="flex-direction" propDisplayName={ FLEX_DIRECTION_LABEL }>
|
|
51
|
+
<UiProviders>
|
|
52
|
+
<StylesFieldLayout label={ FLEX_DIRECTION_LABEL }>
|
|
53
|
+
<ToggleControl options={ options } />
|
|
54
|
+
</StylesFieldLayout>
|
|
55
|
+
</UiProviders>
|
|
56
|
+
</StylesField>
|
|
60
57
|
);
|
|
61
58
|
};
|
|
@@ -6,15 +6,17 @@ import { ArrowDownSmallIcon, ArrowUpSmallIcon, PencilIcon } from '@elementor/ico
|
|
|
6
6
|
import { Grid } from '@elementor/ui';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
|
-
import { useStyle } from '../../../contexts/style-context';
|
|
10
9
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
11
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
12
11
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
13
12
|
import { ControlLabel } from '../../control-label';
|
|
14
13
|
import { SectionContent } from '../../section-content';
|
|
14
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
15
15
|
|
|
16
16
|
type GroupControlItemOption = 'first' | 'last' | 'custom';
|
|
17
17
|
|
|
18
|
+
const ORDER_LABEL = __( 'Order', 'elementor' );
|
|
19
|
+
|
|
18
20
|
export const FIRST_DEFAULT_VALUE = -99999;
|
|
19
21
|
export const LAST_DEFAULT_VALUE = 99999;
|
|
20
22
|
const FIRST = 'first';
|
|
@@ -48,8 +50,7 @@ const items: ToggleButtonGroupItem< GroupControlItemOption >[] = [
|
|
|
48
50
|
];
|
|
49
51
|
|
|
50
52
|
export const FlexOrderField = () => {
|
|
51
|
-
const
|
|
52
|
-
const { canEdit } = useStyle();
|
|
53
|
+
const { value: order, setValue: setOrder, canEdit } = useStylesField< NumberPropValue | null >( 'order' );
|
|
53
54
|
|
|
54
55
|
const [ groupControlValue, setGroupControlValue ] = useState( getGroupControlValue( order?.value || null ) );
|
|
55
56
|
|
|
@@ -66,41 +67,35 @@ export const FlexOrderField = () => {
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
return (
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
93
|
-
<NumberControl
|
|
94
|
-
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
95
|
-
max={ LAST_DEFAULT_VALUE - 1 }
|
|
96
|
-
shouldForceInt={ true }
|
|
97
|
-
/>
|
|
70
|
+
<StylesField bind="order" propDisplayName={ ORDER_LABEL }>
|
|
71
|
+
<UiProviders>
|
|
72
|
+
<StylesFieldLayout label={ ORDER_LABEL }>
|
|
73
|
+
<SectionContent>
|
|
74
|
+
<ControlToggleButtonGroup
|
|
75
|
+
items={ items }
|
|
76
|
+
value={ groupControlValue }
|
|
77
|
+
onChange={ handleToggleButtonChange }
|
|
78
|
+
exclusive={ true }
|
|
79
|
+
disabled={ ! canEdit }
|
|
80
|
+
/>
|
|
81
|
+
{ CUSTOM === groupControlValue && (
|
|
82
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
83
|
+
<Grid item xs={ 6 }>
|
|
84
|
+
<ControlLabel>{ __( 'Custom order', 'elementor' ) }</ControlLabel>
|
|
85
|
+
</Grid>
|
|
86
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
87
|
+
<NumberControl
|
|
88
|
+
min={ FIRST_DEFAULT_VALUE + 1 }
|
|
89
|
+
max={ LAST_DEFAULT_VALUE - 1 }
|
|
90
|
+
shouldForceInt={ true }
|
|
91
|
+
/>
|
|
92
|
+
</Grid>
|
|
98
93
|
</Grid>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</
|
|
102
|
-
</
|
|
103
|
-
</
|
|
94
|
+
) }
|
|
95
|
+
</SectionContent>
|
|
96
|
+
</StylesFieldLayout>
|
|
97
|
+
</UiProviders>
|
|
98
|
+
</StylesField>
|
|
104
99
|
);
|
|
105
100
|
};
|
|
106
101
|
|
|
@@ -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,18 +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
|
-
import { useStyle } from '../../../contexts/style-context';
|
|
15
13
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
16
14
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
17
15
|
import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
|
|
18
|
-
import { ControlLabel } from '../../control-label';
|
|
19
16
|
import { SectionContent } from '../../section-content';
|
|
17
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
20
18
|
|
|
21
19
|
type GroupItem = 'flex-grow' | 'flex-shrink' | 'custom';
|
|
22
20
|
|
|
21
|
+
const FLEX_SIZE_LABEL = __( 'Flex Size', 'elementor' );
|
|
22
|
+
|
|
23
23
|
const DEFAULT = 1;
|
|
24
24
|
|
|
25
25
|
const items: ToggleButtonGroupItem< GroupItem >[] = [
|
|
@@ -44,17 +44,15 @@ const items: ToggleButtonGroupItem< GroupItem >[] = [
|
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
export const FlexSizeField = () => {
|
|
47
|
-
const { canEdit } =
|
|
48
|
-
|
|
49
|
-
const [ fields, setFields ] = useStylesFields< {
|
|
47
|
+
const { values, setValues, canEdit } = useStylesFields< {
|
|
50
48
|
'flex-grow': NumberPropValue | null;
|
|
51
49
|
'flex-shrink': NumberPropValue | null;
|
|
52
50
|
'flex-basis': SizePropValue | null;
|
|
53
51
|
} >( [ 'flex-grow', 'flex-shrink', 'flex-basis' ] );
|
|
54
52
|
|
|
55
|
-
const grow =
|
|
56
|
-
const shrink =
|
|
57
|
-
const basis =
|
|
53
|
+
const grow = values?.[ 'flex-grow' ]?.value || null;
|
|
54
|
+
const shrink = values?.[ 'flex-shrink' ]?.value || null;
|
|
55
|
+
const basis = values?.[ 'flex-basis' ]?.value || null;
|
|
58
56
|
|
|
59
57
|
const currentGroup = useMemo( () => getActiveGroup( { grow, shrink, basis } ), [ grow, shrink, basis ] ),
|
|
60
58
|
[ activeGroup, setActiveGroup ] = useState( currentGroup );
|
|
@@ -63,7 +61,7 @@ export const FlexSizeField = () => {
|
|
|
63
61
|
setActiveGroup( group );
|
|
64
62
|
|
|
65
63
|
if ( ! group || group === 'custom' ) {
|
|
66
|
-
|
|
64
|
+
setValues( {
|
|
67
65
|
'flex-basis': null,
|
|
68
66
|
'flex-grow': null,
|
|
69
67
|
'flex-shrink': null,
|
|
@@ -73,7 +71,7 @@ export const FlexSizeField = () => {
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
if ( group === 'flex-grow' ) {
|
|
76
|
-
|
|
74
|
+
setValues( {
|
|
77
75
|
'flex-basis': null,
|
|
78
76
|
'flex-grow': numberPropTypeUtil.create( DEFAULT ),
|
|
79
77
|
'flex-shrink': null,
|
|
@@ -82,7 +80,7 @@ export const FlexSizeField = () => {
|
|
|
82
80
|
return;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
setValues( {
|
|
86
84
|
'flex-basis': null,
|
|
87
85
|
'flex-grow': null,
|
|
88
86
|
'flex-shrink': numberPropTypeUtil.create( DEFAULT ),
|
|
@@ -92,23 +90,17 @@ export const FlexSizeField = () => {
|
|
|
92
90
|
return (
|
|
93
91
|
<UiProviders>
|
|
94
92
|
<SectionContent>
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
items={ items }
|
|
107
|
-
exclusive={ true }
|
|
108
|
-
/>
|
|
109
|
-
</Grid>
|
|
110
|
-
</StylesField>
|
|
111
|
-
</Grid>
|
|
93
|
+
<StylesField bind={ activeGroup ?? '' } propDisplayName={ FLEX_SIZE_LABEL }>
|
|
94
|
+
<StylesFieldLayout label={ FLEX_SIZE_LABEL }>
|
|
95
|
+
<ControlToggleButtonGroup
|
|
96
|
+
value={ activeGroup }
|
|
97
|
+
onChange={ onChangeGroup }
|
|
98
|
+
disabled={ ! canEdit }
|
|
99
|
+
items={ items }
|
|
100
|
+
exclusive={ true }
|
|
101
|
+
/>
|
|
102
|
+
</StylesFieldLayout>
|
|
103
|
+
</StylesField>
|
|
112
104
|
{ 'custom' === activeGroup && <FlexCustomField /> }
|
|
113
105
|
</SectionContent>
|
|
114
106
|
</UiProviders>
|
|
@@ -116,39 +108,24 @@ export const FlexSizeField = () => {
|
|
|
116
108
|
};
|
|
117
109
|
|
|
118
110
|
const FlexCustomField = () => {
|
|
119
|
-
const flexBasisRowRef
|
|
111
|
+
const flexBasisRowRef = useRef< HTMLDivElement >( null );
|
|
120
112
|
|
|
121
113
|
return (
|
|
122
114
|
<>
|
|
123
|
-
<StylesField bind=
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
</Grid>
|
|
128
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
129
|
-
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
130
|
-
</Grid>
|
|
131
|
-
</Grid>
|
|
115
|
+
<StylesField bind="flex-grow" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
116
|
+
<StylesFieldLayout label={ __( 'Grow', 'elementor' ) }>
|
|
117
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
118
|
+
</StylesFieldLayout>
|
|
132
119
|
</StylesField>
|
|
133
|
-
<StylesField bind=
|
|
134
|
-
<
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
</Grid>
|
|
138
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
139
|
-
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
140
|
-
</Grid>
|
|
141
|
-
</Grid>
|
|
120
|
+
<StylesField bind="flex-shrink" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
121
|
+
<StylesFieldLayout label={ __( 'Shrink', 'elementor' ) }>
|
|
122
|
+
<NumberControl min={ 0 } shouldForceInt={ true } />
|
|
123
|
+
</StylesFieldLayout>
|
|
142
124
|
</StylesField>
|
|
143
|
-
<StylesField bind=
|
|
144
|
-
<
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
</Grid>
|
|
148
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
|
|
149
|
-
<SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
|
|
150
|
-
</Grid>
|
|
151
|
-
</Grid>
|
|
125
|
+
<StylesField bind="flex-basis" propDisplayName={ FLEX_SIZE_LABEL }>
|
|
126
|
+
<StylesFieldLayout label={ __( 'Basis', 'elementor' ) } ref={ flexBasisRowRef }>
|
|
127
|
+
<SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
|
|
128
|
+
</StylesFieldLayout>
|
|
152
129
|
</StylesField>
|
|
153
130
|
</>
|
|
154
131
|
);
|
|
@@ -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
|
+
);
|
|
@@ -21,7 +21,7 @@ import { JustifyContentField } from './justify-content-field';
|
|
|
21
21
|
import { WrapField } from './wrap-field';
|
|
22
22
|
|
|
23
23
|
export const LayoutSection = () => {
|
|
24
|
-
const
|
|
24
|
+
const { value: display } = useStylesField< StringPropValue >( 'display' );
|
|
25
25
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
26
26
|
const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
|
|
27
27
|
const { element } = useElement();
|
|
@@ -39,7 +39,7 @@ export const LayoutSection = () => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const FlexFields = () => {
|
|
42
|
-
const
|
|
42
|
+
const { value: flexWrap } = useStylesField< StringPropValue >( 'flex-wrap' );
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { SizeControl } from '@elementor/editor-controls';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
|
+
|
|
9
|
+
const OPACITY_LABEL = __( 'Opacity', 'elementor' );
|
|
10
|
+
|
|
11
|
+
export const OpacityControlField = () => {
|
|
12
|
+
const rowRef = useRef< HTMLDivElement | null >( null );
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<StylesField bind={ 'opacity' } propDisplayName={ OPACITY_LABEL }>
|
|
16
|
+
<StylesFieldLayout ref={ rowRef } label={ OPACITY_LABEL }>
|
|
17
|
+
<SizeControl units={ [ '%' ] } anchorRef={ rowRef } defaultUnit="%" />
|
|
18
|
+
</StylesFieldLayout>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -48,7 +48,7 @@ const useGetTargetAngle = (
|
|
|
48
48
|
disableRotationForReversed: boolean,
|
|
49
49
|
existingRef?: React.MutableRefObject< number >
|
|
50
50
|
) => {
|
|
51
|
-
const
|
|
51
|
+
const { value: direction } = useStylesField< StringPropValue >( 'flex-direction' );
|
|
52
52
|
const isRtl = 'rtl' === useTheme().direction;
|
|
53
53
|
const rotationMultiplier = isRtl ? -1 : 1;
|
|
54
54
|
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
|
};
|