@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/index.d.mts +12 -1
  3. package/dist/index.d.ts +12 -1
  4. package/dist/index.js +875 -753
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +787 -667
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +15 -15
  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-radius-field.tsx +4 -2
  16. package/src/components/style-sections/border-section/border-style-field.tsx +11 -16
  17. package/src/components/style-sections/border-section/border-width-field.tsx +4 -2
  18. package/src/components/style-sections/effects-section/effects-section.tsx +19 -5
  19. package/src/components/style-sections/layout-section/align-content-field.tsx +11 -12
  20. package/src/components/style-sections/layout-section/align-items-field.tsx +8 -11
  21. package/src/components/style-sections/layout-section/align-self-child-field.tsx +11 -16
  22. package/src/components/style-sections/layout-section/display-field.tsx +6 -6
  23. package/src/components/style-sections/layout-section/flex-direction-field.tsx +11 -14
  24. package/src/components/style-sections/layout-section/flex-order-field.tsx +31 -34
  25. package/src/components/style-sections/layout-section/flex-size-field.tsx +28 -48
  26. package/src/components/style-sections/layout-section/gap-control-field.tsx +5 -6
  27. package/src/components/style-sections/layout-section/justify-content-field.tsx +11 -12
  28. package/src/components/style-sections/layout-section/opacity-control-field.tsx +9 -13
  29. package/src/components/style-sections/layout-section/wrap-field.tsx +10 -14
  30. package/src/components/style-sections/position-section/dimensions-field.tsx +4 -4
  31. package/src/components/style-sections/position-section/offset-field.tsx +12 -14
  32. package/src/components/style-sections/position-section/position-field.tsx +7 -11
  33. package/src/components/style-sections/position-section/z-index-field.tsx +7 -11
  34. package/src/components/style-sections/size-section/object-fit-field.tsx +7 -11
  35. package/src/components/style-sections/size-section/object-position-field.tsx +4 -1
  36. package/src/components/style-sections/size-section/overflow-field.tsx +7 -11
  37. package/src/components/style-sections/size-section/size-section.tsx +9 -7
  38. package/src/components/style-sections/spacing-section/spacing-section.tsx +7 -4
  39. package/src/components/style-sections/typography-section/column-count-field.tsx +7 -11
  40. package/src/components/style-sections/typography-section/column-gap-field.tsx +9 -13
  41. package/src/components/style-sections/typography-section/font-family-field.tsx +9 -11
  42. package/src/components/style-sections/typography-section/font-size-field.tsx +9 -13
  43. package/src/components/style-sections/typography-section/font-style-field.tsx +13 -13
  44. package/src/components/style-sections/typography-section/font-weight-field.tsx +7 -11
  45. package/src/components/style-sections/typography-section/letter-spacing-field.tsx +9 -13
  46. package/src/components/style-sections/typography-section/line-height-field.tsx +9 -13
  47. package/src/components/style-sections/typography-section/text-alignment-field.tsx +11 -14
  48. package/src/components/style-sections/typography-section/text-color-field.tsx +7 -11
  49. package/src/components/style-sections/typography-section/text-decoration-field.tsx +7 -11
  50. package/src/components/style-sections/typography-section/text-direction-field.tsx +7 -11
  51. package/src/components/style-sections/typography-section/text-stroke-field.tsx +4 -2
  52. package/src/components/style-sections/typography-section/transform-field.tsx +7 -11
  53. package/src/components/style-sections/typography-section/word-spacing-field.tsx +9 -13
  54. package/src/components/styles-field-layout.tsx +50 -0
  55. package/src/contexts/section-context.tsx +14 -0
  56. package/src/controls-registry/control-type-container.tsx +6 -2
  57. package/src/controls-registry/controls-registry.tsx +1 -1
  58. package/src/controls-registry/settings-field.tsx +65 -6
  59. package/src/controls-registry/styles-field.tsx +10 -2
  60. package/src/dynamics/components/dynamic-selection-control.tsx +10 -4
  61. package/src/dynamics/components/dynamic-selection.tsx +18 -14
  62. package/src/hooks/use-default-panel-settings.ts +4 -0
  63. package/src/index.ts +4 -0
  64. package/src/popover-action.tsx +8 -1
  65. package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +4 -1
  66. package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +9 -19
  67. package/src/sync/experiments-flags.ts +1 -0
  68. package/src/components/popover-content.tsx +0 -15
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { type MutableRefObject, useMemo, useRef, useState } from 'react';
2
+ import { useMemo, useRef, useState } from 'react';
3
3
  import {
4
4
  ControlToggleButtonGroup,
5
5
  NumberControl,
@@ -8,17 +8,18 @@ import {
8
8
  } from '@elementor/editor-controls';
9
9
  import { numberPropTypeUtil, type NumberPropValue, type SizePropValue } from '@elementor/editor-props';
10
10
  import { ExpandIcon, PencilIcon, ShrinkIcon } from '@elementor/icons';
11
- import { Grid } from '@elementor/ui';
12
11
  import { __ } from '@wordpress/i18n';
13
12
 
14
13
  import { StylesField } from '../../../controls-registry/styles-field';
15
14
  import { useStylesFields } from '../../../hooks/use-styles-fields';
16
15
  import { UiProviders } from '../../../styles-inheritance/components/ui-providers';
17
- import { ControlLabel } from '../../control-label';
18
16
  import { SectionContent } from '../../section-content';
17
+ import { StylesFieldLayout } from '../../styles-field-layout';
19
18
 
20
19
  type GroupItem = 'flex-grow' | 'flex-shrink' | 'custom';
21
20
 
21
+ const FLEX_SIZE_LABEL = __( 'Flex Size', 'elementor' );
22
+
22
23
  const DEFAULT = 1;
23
24
 
24
25
  const items: ToggleButtonGroupItem< GroupItem >[] = [
@@ -89,23 +90,17 @@ export const FlexSizeField = () => {
89
90
  return (
90
91
  <UiProviders>
91
92
  <SectionContent>
92
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
93
- <StylesField bind={ activeGroup ?? '' }>
94
- <Grid item xs={ 6 }>
95
- <ControlLabel>{ __( 'Size', 'elementor' ) }</ControlLabel>
96
- </Grid>
97
-
98
- <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
99
- <ControlToggleButtonGroup
100
- value={ activeGroup }
101
- onChange={ onChangeGroup }
102
- disabled={ ! canEdit }
103
- items={ items }
104
- exclusive={ true }
105
- />
106
- </Grid>
107
- </StylesField>
108
- </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>
109
104
  { 'custom' === activeGroup && <FlexCustomField /> }
110
105
  </SectionContent>
111
106
  </UiProviders>
@@ -113,39 +108,24 @@ export const FlexSizeField = () => {
113
108
  };
114
109
 
115
110
  const FlexCustomField = () => {
116
- const flexBasisRowRef: MutableRefObject< HTMLElement | undefined > = useRef();
111
+ const flexBasisRowRef = useRef< HTMLDivElement >( null );
117
112
 
118
113
  return (
119
114
  <>
120
- <StylesField bind={ 'flex-grow' }>
121
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
122
- <Grid item xs={ 6 }>
123
- <ControlLabel>{ __( 'Grow', 'elementor' ) }</ControlLabel>
124
- </Grid>
125
- <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
126
- <NumberControl min={ 0 } shouldForceInt={ true } />
127
- </Grid>
128
- </Grid>
115
+ <StylesField bind="flex-grow" propDisplayName={ FLEX_SIZE_LABEL }>
116
+ <StylesFieldLayout label={ __( 'Grow', 'elementor' ) }>
117
+ <NumberControl min={ 0 } shouldForceInt={ true } />
118
+ </StylesFieldLayout>
129
119
  </StylesField>
130
- <StylesField bind={ 'flex-shrink' }>
131
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
132
- <Grid item xs={ 6 }>
133
- <ControlLabel>{ __( 'Shrink', 'elementor' ) }</ControlLabel>
134
- </Grid>
135
- <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
136
- <NumberControl min={ 0 } shouldForceInt={ true } />
137
- </Grid>
138
- </Grid>
120
+ <StylesField bind="flex-shrink" propDisplayName={ FLEX_SIZE_LABEL }>
121
+ <StylesFieldLayout label={ __( 'Shrink', 'elementor' ) }>
122
+ <NumberControl min={ 0 } shouldForceInt={ true } />
123
+ </StylesFieldLayout>
139
124
  </StylesField>
140
- <StylesField bind={ 'flex-basis' }>
141
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ flexBasisRowRef }>
142
- <Grid item xs={ 6 }>
143
- <ControlLabel>{ __( 'Basis', 'elementor' ) }</ControlLabel>
144
- </Grid>
145
- <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'end' } }>
146
- <SizeControl extendedOptions={ [ 'auto' ] } anchorRef={ flexBasisRowRef } />
147
- </Grid>
148
- </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>
149
129
  </StylesField>
150
130
  </>
151
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
- <Stack gap={ 1 }>
11
- <StylesField bind={ 'gap' }>
12
- <GapControl label={ __( 'Gaps', 'elementor' ) } />
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 { Stack, withDirection } from '@elementor/ui';
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 { ControlLabel } from '../../control-label';
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
- return (
70
+ export const JustifyContentField = () => (
71
+ <StylesField bind="justify-content" propDisplayName={ JUSTIFY_CONTENT_LABEL }>
70
72
  <UiProviders>
71
- <StylesField bind="justify-content">
72
- <Stack gap={ 0.75 }>
73
- <ControlLabel>{ __( 'Justify content', 'elementor' ) }</ControlLabel>
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
+ );
@@ -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 OPACITY_LABEL = __( 'Opacity', 'elementor' );
9
10
 
10
11
  export const OpacityControlField = () => {
11
- const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
12
+ const rowRef = useRef< HTMLDivElement | null >( null );
12
13
 
13
14
  return (
14
- <StylesField bind={ 'opacity' }>
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Opacity', 'elementor' ) }</ControlLabel>
18
- </Grid>
19
- <Grid item xs={ 6 }>
20
- <SizeControl units={ [ '%' ] } anchorRef={ rowRef } defaultUnit="%" />
21
- </Grid>
22
- </Grid>
15
+ <StylesField bind={ 'opacity' } propDisplayName={ OPACITY_LABEL }>
16
+ <StylesFieldLayout ref={ rowRef } label={ OPACITY_LABEL }>
17
+ <SizeControl units={ [ '%' ] } anchorRef={ rowRef } defaultUnit="%" />
18
+ </StylesFieldLayout>
23
19
  </StylesField>
24
20
  );
25
21
  };
@@ -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 { ControlLabel } from '../../control-label';
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
- <UiProviders>
37
- <StylesField bind={ 'flex-wrap' }>
38
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
39
- <Grid item xs={ 6 }>
40
- <ControlLabel>{ __( 'Wrap', 'elementor' ) }</ControlLabel>
41
- </Grid>
42
- <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
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 { type MutableRefObject, useRef } from 'react';
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: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef() ];
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: MutableRefObject< HTMLElement | undefined >;
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 { type MutableRefObject, useRef } from 'react';
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 { ControlLabel } from '../../control-label';
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: MutableRefObject< HTMLElement | undefined > = useRef();
14
+ const rowRef = useRef< HTMLDivElement >( null );
12
15
 
13
16
  return (
14
- <StylesField bind="scroll-margin-top">
15
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
16
- <Grid item xs={ 6 }>
17
- <ControlLabel>{ __( 'Anchor offset', 'elementor' ) }</ControlLabel>
18
- </Grid>
19
- <Grid item xs={ 6 }>
20
- <SizeControl units={ [ 'px', 'em', 'rem', 'vw', 'vh' ] } anchorRef={ rowRef } />
21
- </Grid>
22
- </Grid>
17
+ <StylesField bind="scroll-margin-top" propDisplayName={ OFFSET_LABEL }>
18
+ <StylesFieldLayout label={ OFFSET_LABEL } ref={ rowRef }>
19
+ <SizeControl units={ UNITS } anchorRef={ rowRef } />
20
+ </StylesFieldLayout>
23
21
  </StylesField>
24
22
  );
25
23
  };
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { SelectControl } from '@elementor/editor-controls';
3
- import { Grid } from '@elementor/ui';
4
3
  import { __ } from '@wordpress/i18n';
5
4
 
6
5
  import { StylesField } from '../../../controls-registry/styles-field';
7
- import { ControlLabel } from '../../control-label';
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
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
25
- <Grid item xs={ 6 }>
26
- <ControlLabel>{ __( 'Position', 'elementor' ) }</ControlLabel>
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
  };
@@ -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 Z_INDEX_LABEL = __( 'Z-index', 'elementor' );
8
9
 
9
10
  export const ZIndexField = () => {
10
11
  return (
11
- <StylesField bind="z-index">
12
- <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
13
- <Grid item xs={ 6 }>
14
- <ControlLabel>{ __( 'Z-index', 'elementor' ) }</ControlLabel>
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 { 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,14 @@ const CssSizeProps = [
51
51
  ],
52
52
  ];
53
53
 
54
+ const ASPECT_RATIO_LABEL = __( 'Aspect Ratio', 'elementor' );
55
+
54
56
  export const SizeSection = () => {
55
57
  const { value: fitValue } = useStylesField< StringPropValue >( 'object-fit' );
56
58
 
57
59
  const isNotFill = fitValue && fitValue?.value !== 'fill';
58
60
 
59
- const gridRowRefs: MutableRefObject< HTMLElement | undefined >[] = [ useRef(), useRef(), useRef() ];
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={ 'aspect-ratio' }>
81
- <AspectRatioControl label={ __( 'Aspect Ratio', 'elementor' ) } />
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: MutableRefObject< HTMLElement | undefined >;
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={ __( '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
  };