@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.
Files changed (77) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/index.d.mts +12 -1
  3. package/dist/index.d.ts +12 -1
  4. package/dist/index.js +1094 -889
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +979 -780
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +17 -18
  9. package/src/components/popover-scrollable-content.tsx +12 -0
  10. package/src/components/section-content.tsx +6 -16
  11. package/src/components/section.tsx +8 -4
  12. package/src/components/settings-tab.tsx +5 -2
  13. package/src/components/style-sections/background-section/background-section.tsx +4 -1
  14. package/src/components/style-sections/border-section/border-color-field.tsx +10 -16
  15. package/src/components/style-sections/border-section/border-field.tsx +14 -7
  16. package/src/components/style-sections/border-section/border-radius-field.tsx +4 -2
  17. package/src/components/style-sections/border-section/border-style-field.tsx +11 -16
  18. package/src/components/style-sections/border-section/border-width-field.tsx +4 -2
  19. package/src/components/style-sections/effects-section/effects-section.tsx +29 -6
  20. package/src/components/style-sections/layout-section/align-content-field.tsx +11 -12
  21. package/src/components/style-sections/layout-section/align-items-field.tsx +8 -11
  22. package/src/components/style-sections/layout-section/align-self-child-field.tsx +11 -16
  23. package/src/components/style-sections/layout-section/display-field.tsx +6 -6
  24. package/src/components/style-sections/layout-section/flex-direction-field.tsx +11 -14
  25. package/src/components/style-sections/layout-section/flex-order-field.tsx +23 -20
  26. package/src/components/style-sections/layout-section/flex-size-field.tsx +42 -64
  27. package/src/components/style-sections/layout-section/gap-control-field.tsx +5 -6
  28. package/src/components/style-sections/layout-section/justify-content-field.tsx +11 -12
  29. package/src/components/style-sections/layout-section/layout-section.tsx +9 -2
  30. package/src/components/style-sections/layout-section/opacity-control-field.tsx +9 -13
  31. package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +6 -1
  32. package/src/components/style-sections/layout-section/wrap-field.tsx +10 -14
  33. package/src/components/style-sections/position-section/dimensions-field.tsx +4 -4
  34. package/src/components/style-sections/position-section/offset-field.tsx +12 -14
  35. package/src/components/style-sections/position-section/position-field.tsx +7 -11
  36. package/src/components/style-sections/position-section/position-section.tsx +19 -8
  37. package/src/components/style-sections/position-section/z-index-field.tsx +7 -11
  38. package/src/components/style-sections/size-section/object-fit-field.tsx +7 -11
  39. package/src/components/style-sections/size-section/object-position-field.tsx +4 -1
  40. package/src/components/style-sections/size-section/overflow-field.tsx +7 -11
  41. package/src/components/style-sections/size-section/size-section.tsx +13 -8
  42. package/src/components/style-sections/spacing-section/spacing-section.tsx +7 -4
  43. package/src/components/style-sections/typography-section/column-count-field.tsx +7 -11
  44. package/src/components/style-sections/typography-section/column-gap-field.tsx +9 -13
  45. package/src/components/style-sections/typography-section/font-family-field.tsx +9 -11
  46. package/src/components/style-sections/typography-section/font-size-field.tsx +9 -13
  47. package/src/components/style-sections/typography-section/font-style-field.tsx +13 -13
  48. package/src/components/style-sections/typography-section/font-weight-field.tsx +7 -11
  49. package/src/components/style-sections/typography-section/letter-spacing-field.tsx +9 -13
  50. package/src/components/style-sections/typography-section/line-height-field.tsx +9 -13
  51. package/src/components/style-sections/typography-section/text-alignment-field.tsx +11 -14
  52. package/src/components/style-sections/typography-section/text-color-field.tsx +7 -11
  53. package/src/components/style-sections/typography-section/text-decoration-field.tsx +7 -11
  54. package/src/components/style-sections/typography-section/text-direction-field.tsx +7 -11
  55. package/src/components/style-sections/typography-section/text-stroke-field.tsx +7 -3
  56. package/src/components/style-sections/typography-section/transform-field.tsx +7 -11
  57. package/src/components/style-sections/typography-section/typography-section.tsx +6 -1
  58. package/src/components/style-sections/typography-section/word-spacing-field.tsx +9 -13
  59. package/src/components/style-tab.tsx +1 -1
  60. package/src/components/styles-field-layout.tsx +50 -0
  61. package/src/contexts/section-context.tsx +14 -0
  62. package/src/controls-registry/control-type-container.tsx +6 -2
  63. package/src/controls-registry/controls-registry.tsx +1 -1
  64. package/src/controls-registry/settings-field.tsx +85 -10
  65. package/src/controls-registry/styles-field.tsx +15 -5
  66. package/src/dynamics/components/dynamic-selection-control.tsx +10 -4
  67. package/src/dynamics/components/dynamic-selection.tsx +18 -14
  68. package/src/hooks/use-default-panel-settings.ts +4 -0
  69. package/src/hooks/use-styles-field.ts +3 -4
  70. package/src/hooks/use-styles-fields.ts +141 -73
  71. package/src/index.ts +4 -0
  72. package/src/init.ts +0 -6
  73. package/src/popover-action.tsx +8 -1
  74. package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +4 -1
  75. package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +9 -19
  76. package/src/sync/experiments-flags.ts +1 -0
  77. 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 { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
21
- <Grid item xs={ 6 }>
22
- <ControlLabel>{ __( 'Object fit', 'elementor' ) }</ControlLabel>
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,11 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { PositionControl } from '@elementor/editor-controls';
3
+ import { __ } from '@wordpress/i18n';
3
4
 
4
5
  import { StylesField } from '../../../controls-registry/styles-field';
5
6
 
7
+ const OBJECT_POSITION_LABEL = __( 'Object position', 'elementor' );
8
+
6
9
  export const ObjectPositionField = () => {
7
10
  return (
8
- <StylesField bind="object-position">
11
+ <StylesField bind="object-position" propDisplayName={ OBJECT_POSITION_LABEL }>
9
12
  <PositionControl />
10
13
  </StylesField>
11
14
  );
@@ -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 { ControlLabel } from '../../control-label';
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={ 'overflow' }>
36
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
37
- <Grid item xs={ 6 }>
38
- <ControlLabel>{ __( 'Overflow', 'elementor' ) }</ControlLabel>
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 MutableRefObject, useRef } from 'react';
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,17 @@ const CssSizeProps = [
51
51
  ],
52
52
  ];
53
53
 
54
+ const ASPECT_RATIO_LABEL = __( 'Aspect Ratio', 'elementor' );
55
+ const OBJECT_FIT_LABEL = __( 'Object fit', 'elementor' );
56
+
54
57
  export const SizeSection = () => {
55
- const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit' );
58
+ const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit', {
59
+ history: { propDisplayName: OBJECT_FIT_LABEL },
60
+ } );
56
61
 
57
62
  const isNotFill = fitValue && fitValue?.value !== 'fill';
58
63
 
59
- const gridRowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef(), useRef() ];
64
+ const gridRowRefs: RefObject< HTMLDivElement >[] = [ useRef( null ), useRef( null ), useRef( null ) ];
60
65
  const isVersion330Active = isExperimentActive( EXPERIMENT_ID );
61
66
 
62
67
  return (
@@ -76,9 +81,9 @@ export const SizeSection = () => {
76
81
  </Stack>
77
82
  { isVersion330Active && (
78
83
  <StyleTabCollapsibleContent fields={ [ 'aspect-ratio', 'object-fit' ] }>
79
- <Stack gap={ 2 }>
80
- <StylesField bind={ 'aspect-ratio' }>
81
- <AspectRatioControl label={ __( 'Aspect Ratio', 'elementor' ) } />
84
+ <Stack gap={ 2 } pt={ 2 }>
85
+ <StylesField bind="aspect-ratio" propDisplayName={ ASPECT_RATIO_LABEL }>
86
+ <AspectRatioControl label={ ASPECT_RATIO_LABEL } />
82
87
  </StylesField>
83
88
  <PanelDivider />
84
89
  <ObjectFitField />
@@ -97,13 +102,13 @@ export const SizeSection = () => {
97
102
  type ControlProps = {
98
103
  bind: StylesFieldProps[ 'bind' ];
99
104
  label: string;
100
- rowRef: MutableRefObject< HTMLElement | undefined >;
105
+ rowRef: React.RefObject< HTMLDivElement >;
101
106
  extendedOptions?: ExtendedOption[];
102
107
  };
103
108
 
104
109
  const SizeField = ( { label, bind, rowRef, extendedOptions }: ControlProps ) => {
105
110
  return (
106
- <StylesField bind={ bind }>
111
+ <StylesField bind={ bind } propDisplayName={ label }>
107
112
  <Grid container gap={ 0.75 } alignItems="center">
108
113
  <Grid item xs={ 12 }>
109
114
  <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={ __( 'Margin', 'elementor' ) }
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={ __( 'Padding', 'elementor' ) } isSiteRtl={ isSiteRtl } />
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 { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
13
- <Grid item xs={ 6 }>
14
- <ControlLabel>{ __( 'Columns', 'elementor' ) }</ControlLabel>
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 { type MutableRefObject, useRef } from 'react';
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 { ControlLabel } from '../../control-label';
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: MutableRefObject< HTMLElement | undefined > = useRef();
12
+ const rowRef = useRef< HTMLDivElement >( null );
12
13
 
13
14
  return (
14
- <StylesField bind="column-gap">
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Column gap', 'elementor' ) }</ControlLabel>
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 { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
20
- <Grid item xs={ 6 }>
21
- <ControlLabel>{ __( 'Font family', 'elementor' ) }</ControlLabel>
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 { type MutableRefObject, useRef } from 'react';
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 { ControlLabel } from '../../control-label';
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: MutableRefObject< HTMLElement | undefined > = useRef();
12
+ const rowRef = useRef< HTMLDivElement >( null );
12
13
 
13
14
  return (
14
- <StylesField bind="font-size">
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Font size', 'elementor' ) }</ControlLabel>
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 { ControlFormLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
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
- <StylesField bind="font-style">
27
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
28
- <Grid item xs={ 6 }>
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
- </Grid>
34
- </Grid>
35
- </StylesField>
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 { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
25
- <Grid item xs={ 6 }>
26
- <ControlLabel>{ __( 'Font weight', 'elementor' ) }</ControlLabel>
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 { type MutableRefObject, useRef } from 'react';
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 { ControlLabel } from '../../control-label';
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: MutableRefObject< HTMLElement | undefined > = useRef();
12
+ const rowRef = useRef< HTMLDivElement >( null );
12
13
 
13
14
  return (
14
- <StylesField bind="letter-spacing">
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Letter spacing', 'elementor' ) }</ControlLabel>
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 { type MutableRefObject, useRef } from 'react';
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 { ControlLabel } from '../../control-label';
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: MutableRefObject< HTMLElement | undefined > = useRef();
12
+ const rowRef = useRef< HTMLDivElement >( null );
12
13
 
13
14
  return (
14
- <StylesField bind="line-height">
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Line height', 'elementor' ) }</ControlLabel>
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 { Grid, withDirection } from '@elementor/ui';
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 { ControlLabel } from '../../control-label';
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
- <UiProviders>
46
- <StylesField bind={ 'text-align' }>
47
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
48
- <Grid item xs={ 6 }>
49
- <ControlLabel>{ __( 'Text align', 'elementor' ) }</ControlLabel>
50
- </Grid>
51
- <Grid item xs={ 6 } display="flex" justifyContent="end">
52
- <ToggleControl options={ options } />
53
- </Grid>
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 { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
13
- <Grid item xs={ 6 }>
14
- <ControlLabel>{ __( 'Text color', 'elementor' ) }</ControlLabel>
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 { ControlLabel } from '../../control-label';
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={ 'text-decoration' }>
41
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
42
- <Grid item xs={ 6 }>
43
- <ControlLabel>{ __( 'Line decoration', 'elementor' ) }</ControlLabel>
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 { ControlLabel } from '../../control-label';
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={ 'direction' }>
30
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
31
- <Grid item xs={ 6 }>
32
- <ControlLabel>{ __( 'Direction', 'elementor' ) }</ControlLabel>
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
  };