@elementor/editor-editing-panel 1.46.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 +48 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +875 -753
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +787 -667
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- 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-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 +19 -5
- 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 +31 -34
- package/src/components/style-sections/layout-section/flex-size-field.tsx +28 -48
- 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/opacity-control-field.tsx +9 -13
- 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/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 +9 -7
- 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 +4 -2
- package/src/components/style-sections/typography-section/transform-field.tsx +7 -11
- 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 +1 -1
- package/src/controls-registry/settings-field.tsx +65 -6
- package/src/controls-registry/styles-field.tsx +10 -2
- 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/index.ts +4 -0
- 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
|
@@ -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
|
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ColorControl } 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 TEXT_COLOR_LABEL = __( 'Text color', 'elementor' );
|
|
8
9
|
|
|
9
10
|
export const TextColorField = () => {
|
|
10
11
|
return (
|
|
11
|
-
<StylesField bind="color">
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
</Grid>
|
|
16
|
-
<Grid item xs={ 6 }>
|
|
17
|
-
<ColorControl />
|
|
18
|
-
</Grid>
|
|
19
|
-
</Grid>
|
|
12
|
+
<StylesField bind="color" propDisplayName={ TEXT_COLOR_LABEL }>
|
|
13
|
+
<StylesFieldLayout label={ TEXT_COLOR_LABEL }>
|
|
14
|
+
<ColorControl />
|
|
15
|
+
</StylesFieldLayout>
|
|
20
16
|
</StylesField>
|
|
21
17
|
);
|
|
22
18
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ToggleControl, type ToggleControlProps } from '@elementor/editor-controls';
|
|
3
3
|
import { MinusIcon, OverlineIcon, StrikethroughIcon, UnderlineIcon } 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 Decoration = 'none' | 'underline' | 'line-through' | 'overline';
|
|
11
10
|
|
|
11
|
+
const TEXT_DECORATION_LABEL = __( 'Line decoration', 'elementor' );
|
|
12
|
+
|
|
12
13
|
const options: ToggleControlProps< Decoration >[ 'options' ] = [
|
|
13
14
|
{
|
|
14
15
|
value: 'none',
|
|
@@ -37,14 +38,9 @@ const options: ToggleControlProps< Decoration >[ 'options' ] = [
|
|
|
37
38
|
},
|
|
38
39
|
];
|
|
39
40
|
export const TextDecorationField = () => (
|
|
40
|
-
<StylesField bind=
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
</Grid>
|
|
45
|
-
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
46
|
-
<ToggleControl options={ options } exclusive={ false } />
|
|
47
|
-
</Grid>
|
|
48
|
-
</Grid>
|
|
41
|
+
<StylesField bind="text-decoration" propDisplayName={ TEXT_DECORATION_LABEL }>
|
|
42
|
+
<StylesFieldLayout label={ TEXT_DECORATION_LABEL }>
|
|
43
|
+
<ToggleControl options={ options } exclusive={ false } />
|
|
44
|
+
</StylesFieldLayout>
|
|
49
45
|
</StylesField>
|
|
50
46
|
);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { TextDirectionLtrIcon, TextDirectionRtlIcon } 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 Direction = 'ltr' | 'rtl';
|
|
11
10
|
|
|
11
|
+
const TEXT_DIRECTION_LABEL = __( 'Direction', 'elementor' );
|
|
12
|
+
|
|
12
13
|
const options: ToggleButtonGroupItem< Direction >[] = [
|
|
13
14
|
{
|
|
14
15
|
value: 'ltr',
|
|
@@ -26,15 +27,10 @@ const options: ToggleButtonGroupItem< Direction >[] = [
|
|
|
26
27
|
|
|
27
28
|
export const TextDirectionField = () => {
|
|
28
29
|
return (
|
|
29
|
-
<StylesField bind={
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
</Grid>
|
|
34
|
-
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
35
|
-
<ToggleControl options={ options } />
|
|
36
|
-
</Grid>
|
|
37
|
-
</Grid>
|
|
30
|
+
<StylesField bind="direction" propDisplayName={ TEXT_DIRECTION_LABEL }>
|
|
31
|
+
<StylesFieldLayout label={ TEXT_DIRECTION_LABEL }>
|
|
32
|
+
<ToggleControl options={ options } />
|
|
33
|
+
</StylesFieldLayout>
|
|
38
34
|
</StylesField>
|
|
39
35
|
);
|
|
40
36
|
};
|
|
@@ -24,6 +24,8 @@ const initTextStroke = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const TEXT_STROKE_LABEL = __( 'Text stroke', 'elementor' );
|
|
28
|
+
|
|
27
29
|
export const TextStrokeField = () => {
|
|
28
30
|
const { value, setValue, canEdit } = useStylesField( 'stroke' );
|
|
29
31
|
|
|
@@ -38,13 +40,13 @@ export const TextStrokeField = () => {
|
|
|
38
40
|
const hasTextStroke = Boolean( value );
|
|
39
41
|
|
|
40
42
|
return (
|
|
41
|
-
<StylesField bind={ 'stroke' }>
|
|
43
|
+
<StylesField bind={ 'stroke' } propDisplayName={ TEXT_STROKE_LABEL }>
|
|
42
44
|
<AddOrRemoveContent
|
|
43
45
|
isAdded={ hasTextStroke }
|
|
44
46
|
onAdd={ addTextStroke }
|
|
45
47
|
onRemove={ removeTextStroke }
|
|
46
48
|
disabled={ ! canEdit }
|
|
47
|
-
renderLabel={ () => <ControlLabel>{
|
|
49
|
+
renderLabel={ () => <ControlLabel>{ TEXT_STROKE_LABEL }</ControlLabel> }
|
|
48
50
|
>
|
|
49
51
|
<StrokeControl />
|
|
50
52
|
</AddOrRemoveContent>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
3
|
import { LetterCaseIcon, LetterCaseLowerIcon, LetterCaseUpperIcon, 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';
|
|
8
|
-
import {
|
|
7
|
+
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
9
8
|
|
|
10
9
|
type Transforms = 'none' | 'capitalize' | 'uppercase' | 'lowercase';
|
|
11
10
|
|
|
11
|
+
const TEXT_TRANSFORM_LABEL = __( 'Text transform', 'elementor' );
|
|
12
|
+
|
|
12
13
|
const options: ToggleButtonGroupItem< Transforms >[] = [
|
|
13
14
|
{
|
|
14
15
|
value: 'none',
|
|
@@ -37,14 +38,9 @@ const options: ToggleButtonGroupItem< Transforms >[] = [
|
|
|
37
38
|
];
|
|
38
39
|
|
|
39
40
|
export const TransformField = () => (
|
|
40
|
-
<StylesField bind=
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
</Grid>
|
|
45
|
-
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
46
|
-
<ToggleControl options={ options } />
|
|
47
|
-
</Grid>
|
|
48
|
-
</Grid>
|
|
41
|
+
<StylesField bind="text-transform" propDisplayName={ TEXT_TRANSFORM_LABEL }>
|
|
42
|
+
<StylesFieldLayout label={ TEXT_TRANSFORM_LABEL }>
|
|
43
|
+
<ToggleControl options={ options } />
|
|
44
|
+
</StylesFieldLayout>
|
|
49
45
|
</StylesField>
|
|
50
46
|
);
|
|
@@ -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 WORD_SPACING_LABEL = __( 'Word spacing', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const WordSpacingField = () => {
|
|
11
|
-
const rowRef
|
|
12
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<StylesField bind="word-spacing">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
</Grid>
|
|
19
|
-
<Grid item xs={ 6 }>
|
|
20
|
-
<SizeControl anchorRef={ rowRef } />
|
|
21
|
-
</Grid>
|
|
22
|
-
</Grid>
|
|
15
|
+
<StylesField bind="word-spacing" propDisplayName={ WORD_SPACING_LABEL }>
|
|
16
|
+
<StylesFieldLayout label={ WORD_SPACING_LABEL } ref={ rowRef }>
|
|
17
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
|
+
</StylesFieldLayout>
|
|
23
19
|
</StylesField>
|
|
24
20
|
);
|
|
25
21
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Grid, Stack, type Theme } from '@elementor/ui';
|
|
3
|
+
|
|
4
|
+
import { ControlLabel } from './control-label';
|
|
5
|
+
|
|
6
|
+
type StylesFieldLayoutProps = {
|
|
7
|
+
label: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
direction?: 'row' | 'column';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const StylesFieldLayout = React.forwardRef< HTMLDivElement, StylesFieldLayoutProps >( ( props, ref ) => {
|
|
13
|
+
const { direction = 'row', children, label } = props;
|
|
14
|
+
|
|
15
|
+
const LayoutComponent = direction === 'row' ? Row : Column;
|
|
16
|
+
|
|
17
|
+
return <LayoutComponent label={ label } ref={ ref } children={ children } />;
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
const Row = React.forwardRef< HTMLDivElement, { label: string; children: React.ReactNode } >(
|
|
21
|
+
( { label, children }, ref ) => {
|
|
22
|
+
return (
|
|
23
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ ref }>
|
|
24
|
+
<Grid item xs={ 6 }>
|
|
25
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
26
|
+
</Grid>
|
|
27
|
+
<Grid
|
|
28
|
+
item
|
|
29
|
+
xs={ 6 }
|
|
30
|
+
sx={ ( theme: Theme ) => ( {
|
|
31
|
+
width: `calc(50% - ${ theme.spacing( 2 ) })`,
|
|
32
|
+
} ) }
|
|
33
|
+
>
|
|
34
|
+
{ children }
|
|
35
|
+
</Grid>
|
|
36
|
+
</Grid>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const Column = React.forwardRef< HTMLDivElement, { label: string; children: React.ReactNode } >(
|
|
42
|
+
( { label, children }, ref ) => {
|
|
43
|
+
return (
|
|
44
|
+
<Stack gap={ 0.75 } ref={ ref }>
|
|
45
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
46
|
+
{ children }
|
|
47
|
+
</Stack>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
|
+
|
|
4
|
+
const FALLBACK_SECTION_WIDTH = 320;
|
|
5
|
+
|
|
6
|
+
export const SectionRefContext = createContext< RefObject< HTMLElement > | null >( null );
|
|
7
|
+
|
|
8
|
+
const useSectionRef = () => useContext( SectionRefContext );
|
|
9
|
+
|
|
10
|
+
export const useSectionWidth = (): number => {
|
|
11
|
+
const sectionRef = useSectionRef();
|
|
12
|
+
|
|
13
|
+
return sectionRef?.current?.offsetWidth ?? FALLBACK_SECTION_WIDTH;
|
|
14
|
+
};
|
|
@@ -3,6 +3,10 @@ import { type ControlLayout } from '@elementor/editor-elements';
|
|
|
3
3
|
import { Box, type BoxProps, styled } from '@elementor/ui';
|
|
4
4
|
|
|
5
5
|
export const ControlTypeContainer = ( { children, layout }: React.PropsWithChildren< { layout?: ControlLayout } > ) => {
|
|
6
|
+
if ( layout === 'custom' ) {
|
|
7
|
+
return children;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
return <StyledContainer layout={ layout }>{ children }</StyledContainer>;
|
|
7
11
|
};
|
|
8
12
|
|
|
@@ -14,10 +18,10 @@ const StyledContainer = styled( Box, {
|
|
|
14
18
|
...getGridLayout( layout ),
|
|
15
19
|
} ) );
|
|
16
20
|
|
|
17
|
-
const getGridLayout = ( layout: ControlLayout ) => ( {
|
|
21
|
+
const getGridLayout = ( layout: Omit< ControlLayout, 'custom' > ) => ( {
|
|
18
22
|
justifyContent: 'space-between',
|
|
19
23
|
gridTemplateColumns: {
|
|
20
24
|
full: 'minmax(0, 1fr)',
|
|
21
25
|
'two-columns': 'repeat(2, minmax(0, 1fr))',
|
|
22
|
-
}[ layout ],
|
|
26
|
+
}[ layout as string ],
|
|
23
27
|
} );
|
|
@@ -37,7 +37,7 @@ const controlTypes = {
|
|
|
37
37
|
textarea: { component: TextAreaControl, layout: 'full', propTypeUtil: stringPropTypeUtil },
|
|
38
38
|
size: { component: SizeControl, layout: 'two-columns', propTypeUtil: sizePropTypeUtil },
|
|
39
39
|
select: { component: SelectControl, layout: 'two-columns', propTypeUtil: stringPropTypeUtil },
|
|
40
|
-
link: { component: LinkControl, layout: '
|
|
40
|
+
link: { component: LinkControl, layout: 'custom', propTypeUtil: linkPropTypeUtil },
|
|
41
41
|
url: { component: UrlControl, layout: 'full', propTypeUtil: stringPropTypeUtil },
|
|
42
42
|
switch: { component: SwitchControl, layout: 'two-columns', propTypeUtil: booleanPropTypeUtil },
|
|
43
43
|
repeatable: { component: RepeatableControl, layout: 'full', propTypeUtil: undefined },
|