@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
|
@@ -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
|
};
|
|
@@ -29,8 +29,8 @@ type DimensionsValues = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export const PositionSection = () => {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const { value: positionValue } = useStylesField< StringPropValue >( 'position' );
|
|
33
|
+
const { values: dimensions, setValues: setDimensions } = useStylesFields< DimensionsValues >( [
|
|
34
34
|
'inset-block-start',
|
|
35
35
|
'inset-block-end',
|
|
36
36
|
'inset-inline-start',
|
|
@@ -42,9 +42,9 @@ export const PositionSection = () => {
|
|
|
42
42
|
|
|
43
43
|
const onPositionChange = ( newPosition: string | null, previousPosition: string | null | undefined ) => {
|
|
44
44
|
if ( newPosition === 'static' ) {
|
|
45
|
-
if (
|
|
46
|
-
updateDimensionsHistory(
|
|
47
|
-
|
|
45
|
+
if ( dimensions ) {
|
|
46
|
+
updateDimensionsHistory( dimensions );
|
|
47
|
+
setDimensions( {
|
|
48
48
|
'inset-block-start': undefined,
|
|
49
49
|
'inset-block-end': undefined,
|
|
50
50
|
'inset-inline-start': undefined,
|
|
@@ -53,7 +53,7 @@ export const PositionSection = () => {
|
|
|
53
53
|
}
|
|
54
54
|
} else if ( previousPosition === 'static' ) {
|
|
55
55
|
if ( dimensionsValuesFromHistory ) {
|
|
56
|
-
|
|
56
|
+
setDimensions( dimensionsValuesFromHistory );
|
|
57
57
|
clearDimensionsHistory();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -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
|
};
|
|
@@ -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 OBJECT_FIT_LABEL = __( 'Object fit', 'elementor' );
|
|
8
9
|
|
|
9
10
|
const positionOptions = [
|
|
10
11
|
{ label: __( 'Fill', 'elementor' ), value: 'fill' },
|
|
@@ -16,15 +17,10 @@ const positionOptions = [
|
|
|
16
17
|
|
|
17
18
|
export const ObjectFitField = () => {
|
|
18
19
|
return (
|
|
19
|
-
<StylesField bind="object-fit">
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
</Grid>
|
|
24
|
-
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
25
|
-
<SelectControl options={ positionOptions } />
|
|
26
|
-
</Grid>
|
|
27
|
-
</Grid>
|
|
20
|
+
<StylesField bind="object-fit" propDisplayName={ OBJECT_FIT_LABEL }>
|
|
21
|
+
<StylesFieldLayout label={ OBJECT_FIT_LABEL }>
|
|
22
|
+
<SelectControl options={ positionOptions } />
|
|
23
|
+
</StylesFieldLayout>
|
|
28
24
|
</StylesField>
|
|
29
25
|
);
|
|
30
26
|
};
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
2
|
+
import { PositionControl } from '@elementor/editor-controls';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
5
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import { ControlLabel } from '../../control-label';
|
|
8
6
|
|
|
9
|
-
const
|
|
10
|
-
{ label: __( 'Center center', 'elementor' ), value: 'center center' },
|
|
11
|
-
{ label: __( 'Center left', 'elementor' ), value: 'center left' },
|
|
12
|
-
{ label: __( 'Center right', 'elementor' ), value: 'center right' },
|
|
13
|
-
{ label: __( 'Top center', 'elementor' ), value: 'top center' },
|
|
14
|
-
{ label: __( 'Top left', 'elementor' ), value: 'top left' },
|
|
15
|
-
{ label: __( 'Top right', 'elementor' ), value: 'top right' },
|
|
16
|
-
{ label: __( 'Bottom center', 'elementor' ), value: 'bottom center' },
|
|
17
|
-
{ label: __( 'Bottom left', 'elementor' ), value: 'bottom left' },
|
|
18
|
-
{ label: __( 'Bottom right', 'elementor' ), value: 'bottom right' },
|
|
19
|
-
];
|
|
7
|
+
const OBJECT_POSITION_LABEL = __( 'Object position', 'elementor' );
|
|
20
8
|
|
|
21
9
|
export const ObjectPositionField = () => {
|
|
22
10
|
return (
|
|
23
|
-
<StylesField bind="object-position">
|
|
24
|
-
<
|
|
25
|
-
<Grid item xs={ 6 }>
|
|
26
|
-
<ControlLabel>{ __( 'Object position', 'elementor' ) }</ControlLabel>
|
|
27
|
-
</Grid>
|
|
28
|
-
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
29
|
-
<SelectControl options={ positionOptions } />
|
|
30
|
-
</Grid>
|
|
31
|
-
</Grid>
|
|
11
|
+
<StylesField bind="object-position" propDisplayName={ OBJECT_POSITION_LABEL }>
|
|
12
|
+
<PositionControl />
|
|
32
13
|
</StylesField>
|
|
33
14
|
);
|
|
34
15
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { EyeIcon, EyeOffIcon, LetterAIcon } 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
|
-
import {
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
9
8
|
|
|
10
9
|
type Overflows = 'visible' | 'hidden' | 'auto';
|
|
11
10
|
|
|
11
|
+
const OVERFLOW_LABEL = __( 'Overflow', 'elementor' );
|
|
12
|
+
|
|
12
13
|
const options: ToggleButtonGroupItem< Overflows >[] = [
|
|
13
14
|
{
|
|
14
15
|
value: 'visible',
|
|
@@ -32,15 +33,10 @@ const options: ToggleButtonGroupItem< Overflows >[] = [
|
|
|
32
33
|
|
|
33
34
|
export const OverflowField = () => {
|
|
34
35
|
return (
|
|
35
|
-
<StylesField bind={
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
</Grid>
|
|
40
|
-
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
41
|
-
<ToggleControl options={ options } />
|
|
42
|
-
</Grid>
|
|
43
|
-
</Grid>
|
|
36
|
+
<StylesField bind="overflow" propDisplayName={ OVERFLOW_LABEL }>
|
|
37
|
+
<StylesFieldLayout label={ OVERFLOW_LABEL }>
|
|
38
|
+
<ToggleControl options={ options } />
|
|
39
|
+
</StylesFieldLayout>
|
|
44
40
|
</StylesField>
|
|
45
41
|
);
|
|
46
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RefObject, useRef } from 'react';
|
|
3
3
|
import { AspectRatioControl, type ExtendedOption, SizeControl } from '@elementor/editor-controls';
|
|
4
4
|
import type { StringPropValue } from '@elementor/editor-props';
|
|
5
5
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
@@ -51,12 +51,14 @@ const CssSizeProps = [
|
|
|
51
51
|
],
|
|
52
52
|
];
|
|
53
53
|
|
|
54
|
+
const ASPECT_RATIO_LABEL = __( 'Aspect Ratio', 'elementor' );
|
|
55
|
+
|
|
54
56
|
export const SizeSection = () => {
|
|
55
|
-
const
|
|
57
|
+
const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit' );
|
|
56
58
|
|
|
57
59
|
const isNotFill = fitValue && fitValue?.value !== 'fill';
|
|
58
60
|
|
|
59
|
-
const gridRowRefs:
|
|
61
|
+
const gridRowRefs: RefObject< HTMLDivElement >[] = [ useRef( null ), useRef( null ), useRef( null ) ];
|
|
60
62
|
const isVersion330Active = isExperimentActive( EXPERIMENT_ID );
|
|
61
63
|
|
|
62
64
|
return (
|
|
@@ -76,9 +78,9 @@ export const SizeSection = () => {
|
|
|
76
78
|
</Stack>
|
|
77
79
|
{ isVersion330Active && (
|
|
78
80
|
<StyleTabCollapsibleContent fields={ [ 'aspect-ratio', 'object-fit' ] }>
|
|
79
|
-
<Stack gap={ 2 }>
|
|
80
|
-
<StylesField bind=
|
|
81
|
-
<AspectRatioControl label={
|
|
81
|
+
<Stack gap={ 2 } pt={ 2 }>
|
|
82
|
+
<StylesField bind="aspect-ratio" propDisplayName={ ASPECT_RATIO_LABEL }>
|
|
83
|
+
<AspectRatioControl label={ ASPECT_RATIO_LABEL } />
|
|
82
84
|
</StylesField>
|
|
83
85
|
<PanelDivider />
|
|
84
86
|
<ObjectFitField />
|
|
@@ -97,13 +99,13 @@ export const SizeSection = () => {
|
|
|
97
99
|
type ControlProps = {
|
|
98
100
|
bind: StylesFieldProps[ 'bind' ];
|
|
99
101
|
label: string;
|
|
100
|
-
rowRef:
|
|
102
|
+
rowRef: React.RefObject< HTMLDivElement >;
|
|
101
103
|
extendedOptions?: ExtendedOption[];
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
const SizeField = ( { label, bind, rowRef, extendedOptions }: ControlProps ) => {
|
|
105
107
|
return (
|
|
106
|
-
<StylesField bind={ bind }>
|
|
108
|
+
<StylesField bind={ bind } propDisplayName={ label }>
|
|
107
109
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
108
110
|
<Grid item xs={ 12 }>
|
|
109
111
|
<ControlLabel>{ label }</ControlLabel>
|
|
@@ -7,21 +7,24 @@ import { useDirection } from '../../../hooks/use-direction';
|
|
|
7
7
|
import { PanelDivider } from '../../panel-divider';
|
|
8
8
|
import { SectionContent } from '../../section-content';
|
|
9
9
|
|
|
10
|
+
const MARGIN_LABEL = __( 'Margin', 'elementor' );
|
|
11
|
+
const PADDING_LABEL = __( 'Padding', 'elementor' );
|
|
12
|
+
|
|
10
13
|
export const SpacingSection = () => {
|
|
11
14
|
const { isSiteRtl } = useDirection();
|
|
12
15
|
|
|
13
16
|
return (
|
|
14
17
|
<SectionContent>
|
|
15
|
-
<StylesField bind={ 'margin' }>
|
|
18
|
+
<StylesField bind={ 'margin' } propDisplayName={ MARGIN_LABEL }>
|
|
16
19
|
<LinkedDimensionsControl
|
|
17
|
-
label={
|
|
20
|
+
label={ MARGIN_LABEL }
|
|
18
21
|
isSiteRtl={ isSiteRtl }
|
|
19
22
|
extendedOptions={ [ 'auto' ] }
|
|
20
23
|
/>
|
|
21
24
|
</StylesField>
|
|
22
25
|
<PanelDivider />
|
|
23
|
-
<StylesField bind={ 'padding' }>
|
|
24
|
-
<LinkedDimensionsControl label={
|
|
26
|
+
<StylesField bind={ 'padding' } propDisplayName={ PADDING_LABEL }>
|
|
27
|
+
<LinkedDimensionsControl label={ PADDING_LABEL } isSiteRtl={ isSiteRtl } />
|
|
25
28
|
</StylesField>
|
|
26
29
|
</SectionContent>
|
|
27
30
|
);
|
|
@@ -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 COLUMN_COUNT_LABEL = __( 'Columns', 'elementor' );
|
|
8
9
|
|
|
9
10
|
export const ColumnCountField = () => {
|
|
10
11
|
return (
|
|
11
|
-
<StylesField bind="column-count">
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</Grid>
|
|
16
|
-
<Grid item xs={ 6 }>
|
|
17
|
-
<NumberControl shouldForceInt min={ 0 } step={ 1 } />
|
|
18
|
-
</Grid>
|
|
19
|
-
</Grid>
|
|
12
|
+
<StylesField bind="column-count" propDisplayName={ COLUMN_COUNT_LABEL }>
|
|
13
|
+
<StylesFieldLayout label={ COLUMN_COUNT_LABEL }>
|
|
14
|
+
<NumberControl shouldForceInt min={ 0 } step={ 1 } />
|
|
15
|
+
</StylesFieldLayout>
|
|
20
16
|
</StylesField>
|
|
21
17
|
);
|
|
22
18
|
};
|
|
@@ -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 COLUMN_GAP_LABEL = __( 'Column gap', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const ColumnGapField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind="column-gap">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind="column-gap" propDisplayName={ COLUMN_GAP_LABEL }>
|
|
16
|
+
<StylesFieldLayout label={ COLUMN_GAP_LABEL } ref={ rowRef }>
|
|
17
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FontFamilyControl } from '@elementor/editor-controls';
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
5
|
+
import { useSectionWidth } from '../../../contexts/section-context';
|
|
6
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import {
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
8
|
import { useFontFamilies } from './hooks/use-font-families';
|
|
9
9
|
|
|
10
|
+
const FONT_FAMILY_LABEL = __( 'Font family', 'elementor' );
|
|
11
|
+
|
|
10
12
|
export const FontFamilyField = () => {
|
|
11
13
|
const fontFamilies = useFontFamilies();
|
|
14
|
+
const sectionWidth = useSectionWidth();
|
|
12
15
|
|
|
13
16
|
if ( fontFamilies.length === 0 ) {
|
|
14
17
|
return null;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
return (
|
|
18
|
-
<StylesField bind="font-family">
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
</Grid>
|
|
23
|
-
<Grid item xs={ 6 } sx={ { minWidth: 0 } }>
|
|
24
|
-
<FontFamilyControl fontFamilies={ fontFamilies } />
|
|
25
|
-
</Grid>
|
|
26
|
-
</Grid>
|
|
21
|
+
<StylesField bind="font-family" propDisplayName={ FONT_FAMILY_LABEL }>
|
|
22
|
+
<StylesFieldLayout label={ FONT_FAMILY_LABEL }>
|
|
23
|
+
<FontFamilyControl fontFamilies={ fontFamilies } sectionWidth={ sectionWidth } />
|
|
24
|
+
</StylesFieldLayout>
|
|
27
25
|
</StylesField>
|
|
28
26
|
);
|
|
29
27
|
};
|
|
@@ -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 FONT_SIZE_LABEL = __( 'Font size', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const FontSizeField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind="font-size">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind="font-size" propDisplayName={ FONT_SIZE_LABEL }>
|
|
16
|
+
<StylesFieldLayout label={ FONT_SIZE_LABEL } ref={ rowRef }>
|
|
17
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { ItalicIcon, MinusIcon } 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';
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
8
8
|
|
|
9
9
|
type FontStyle = 'normal' | 'italic';
|
|
10
|
+
|
|
11
|
+
const FONT_STYLE_LABEL = __( 'Font style', 'elementor' );
|
|
12
|
+
|
|
10
13
|
const options: ToggleButtonGroupItem< FontStyle >[] = [
|
|
11
14
|
{
|
|
12
15
|
value: 'normal',
|
|
@@ -22,15 +25,12 @@ const options: ToggleButtonGroupItem< FontStyle >[] = [
|
|
|
22
25
|
},
|
|
23
26
|
];
|
|
24
27
|
|
|
25
|
-
export const FontStyleField = () =>
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<ControlFormLabel>{ __( 'Font style', 'elementor' ) }</ControlFormLabel>
|
|
30
|
-
</Grid>
|
|
31
|
-
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
28
|
+
export const FontStyleField = () => {
|
|
29
|
+
return (
|
|
30
|
+
<StylesField bind="font-style" propDisplayName={ FONT_STYLE_LABEL }>
|
|
31
|
+
<StylesFieldLayout label={ FONT_STYLE_LABEL }>
|
|
32
32
|
<ToggleControl options={ options } />
|
|
33
|
-
</
|
|
34
|
-
</
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
</StylesFieldLayout>
|
|
34
|
+
</StylesField>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -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 FONT_WEIGHT_LABEL = __( 'Font weight', 'elementor' );
|
|
8
9
|
|
|
9
10
|
const fontWeightOptions = [
|
|
10
11
|
{ value: '100', label: __( '100 - Thin', 'elementor' ) },
|
|
@@ -20,15 +21,10 @@ const fontWeightOptions = [
|
|
|
20
21
|
|
|
21
22
|
export const FontWeightField = () => {
|
|
22
23
|
return (
|
|
23
|
-
<StylesField bind="font-weight">
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
</Grid>
|
|
28
|
-
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
29
|
-
<SelectControl options={ fontWeightOptions } />
|
|
30
|
-
</Grid>
|
|
31
|
-
</Grid>
|
|
24
|
+
<StylesField bind="font-weight" propDisplayName={ FONT_WEIGHT_LABEL }>
|
|
25
|
+
<StylesFieldLayout label={ FONT_WEIGHT_LABEL }>
|
|
26
|
+
<SelectControl options={ fontWeightOptions } />
|
|
27
|
+
</StylesFieldLayout>
|
|
32
28
|
</StylesField>
|
|
33
29
|
);
|
|
34
30
|
};
|
|
@@ -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 LETTER_SPACING_LABEL = __( 'Letter spacing', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const LetterSpacingField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind="letter-spacing">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind="letter-spacing" propDisplayName={ LETTER_SPACING_LABEL }>
|
|
16
|
+
<StylesFieldLayout label={ LETTER_SPACING_LABEL } ref={ rowRef }>
|
|
17
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -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 LINE_HEIGHT_LABEL = __( 'Line height', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const LineHeightField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind="line-height">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind="line-height" propDisplayName={ LINE_HEIGHT_LABEL }>
|
|
16
|
+
<StylesFieldLayout label={ LINE_HEIGHT_LABEL } ref={ rowRef }>
|
|
17
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { AlignCenterIcon, AlignJustifiedIcon, AlignLeftIcon, AlignRightIcon } 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
|
type Alignments = 'start' | 'center' | 'end' | 'justify';
|
|
12
12
|
|
|
13
|
+
const TEXT_ALIGNMENT_LABEL = __( 'Text align', 'elementor' );
|
|
14
|
+
|
|
13
15
|
const AlignStartIcon = withDirection( AlignLeftIcon );
|
|
14
16
|
const AlignEndIcon = withDirection( AlignRightIcon );
|
|
15
17
|
|
|
@@ -42,17 +44,12 @@ const options: ToggleButtonGroupItem< Alignments >[] = [
|
|
|
42
44
|
|
|
43
45
|
export const TextAlignmentField = () => {
|
|
44
46
|
return (
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<ToggleControl options={ options } />
|
|
53
|
-
</Grid>
|
|
54
|
-
</Grid>
|
|
55
|
-
</StylesField>
|
|
56
|
-
</UiProviders>
|
|
47
|
+
<StylesField bind="text-align" propDisplayName={ TEXT_ALIGNMENT_LABEL }>
|
|
48
|
+
<UiProviders>
|
|
49
|
+
<StylesFieldLayout label={ TEXT_ALIGNMENT_LABEL }>
|
|
50
|
+
<ToggleControl options={ options } />
|
|
51
|
+
</StylesFieldLayout>
|
|
52
|
+
</UiProviders>
|
|
53
|
+
</StylesField>
|
|
57
54
|
);
|
|
58
55
|
};
|