@elementor/editor-controls 0.19.1 → 0.21.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 (32) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/index.d.mts +2 -2
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +304 -294
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +240 -230
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +3 -2
  9. package/src/components/control-form-label.tsx +6 -0
  10. package/src/components/control-label.tsx +12 -3
  11. package/src/components/repeater.tsx +9 -2
  12. package/src/components/text-field-inner-selection.tsx +4 -3
  13. package/src/controls/background-control/background-control.tsx +2 -2
  14. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx +2 -2
  15. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +6 -5
  16. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx +2 -2
  17. package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx +2 -2
  18. package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +18 -4
  19. package/src/controls/color-control.tsx +1 -1
  20. package/src/controls/equal-unequal-sizes-control.tsx +3 -1
  21. package/src/controls/font-family-control/font-family-control.tsx +4 -3
  22. package/src/controls/gap-control.tsx +3 -2
  23. package/src/controls/image-control.tsx +3 -3
  24. package/src/controls/link-control.tsx +6 -6
  25. package/src/controls/linked-dimensions-control.tsx +7 -6
  26. package/src/controls/select-control.tsx +4 -3
  27. package/src/controls/stroke-control.tsx +2 -2
  28. package/src/controls/svg-media-control.tsx +2 -2
  29. package/src/hooks/use-sync-external-state.tsx +1 -0
  30. package/src/index.ts +2 -1
  31. package/src/control-adornments/control-label-with-adornments.tsx +0 -15
  32. package/src/utils/link-restriction.ts +0 -47
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-controls",
3
3
  "description": "This package contains the controls model and utils for the Elementor editor",
4
- "version": "0.19.1",
4
+ "version": "0.21.0",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -41,8 +41,9 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@elementor/editor-current-user": "0.3.0",
44
- "@elementor/editor-elements": "0.6.6",
44
+ "@elementor/editor-elements": "0.7.0",
45
45
  "@elementor/editor-props": "0.11.1",
46
+ "@elementor/editor-ui": "0.5.1",
46
47
  "@elementor/env": "0.3.5",
47
48
  "@elementor/http": "0.1.4",
48
49
  "@elementor/icons": "1.37.0",
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { FormLabel } from '@elementor/ui';
3
+
4
+ export const ControlFormLabel = ( { children }: { children: React.ReactNode } ) => {
5
+ return <FormLabel size="tiny">{ children }</FormLabel>;
6
+ };
@@ -1,6 +1,15 @@
1
1
  import * as React from 'react';
2
- import { FormLabel } from '@elementor/ui';
2
+ import { type PropsWithChildren } from 'react';
3
+ import { Stack } from '@elementor/ui';
3
4
 
4
- export const ControlLabel = ( { children }: { children: React.ReactNode } ) => {
5
- return <FormLabel size="tiny">{ children }</FormLabel>;
5
+ import { ControlAdornments } from '../control-adornments/control-adornments';
6
+ import { ControlFormLabel } from './control-form-label';
7
+
8
+ export const ControlLabel = ( { children }: PropsWithChildren< object > ) => {
9
+ return (
10
+ <Stack direction="row" alignItems="center" justifyItems="start" gap={ 1 }>
11
+ <ControlFormLabel>{ children }</ControlFormLabel>
12
+ <ControlAdornments />
13
+ </Stack>
14
+ );
6
15
  };
@@ -17,6 +17,7 @@ import {
17
17
  } from '@elementor/ui';
18
18
  import { __ } from '@wordpress/i18n';
19
19
 
20
+ import { ControlAdornments } from '../control-adornments/control-adornments';
20
21
  import { useSyncExternalState } from '../hooks/use-sync-external-state';
21
22
  import { SectionContent } from './section-content';
22
23
  import { SortableItem, SortableProvider } from './sortable';
@@ -139,11 +140,17 @@ export const Repeater = < T, >( {
139
140
 
140
141
  return (
141
142
  <SectionContent>
142
- <Stack direction="row" justifyContent="space-between" alignItems="center">
143
+ <Stack direction="row" justifyContent="start" alignItems="center" gap={ 1 }>
143
144
  <Typography component="label" variant="caption" color="text.secondary">
144
145
  { label }
145
146
  </Typography>
146
- <IconButton size={ SIZE } onClick={ addRepeaterItem } aria-label={ __( 'Add item', 'elementor' ) }>
147
+ <ControlAdornments />
148
+ <IconButton
149
+ sx={ { ml: 'auto' } }
150
+ size={ SIZE }
151
+ onClick={ addRepeaterItem }
152
+ aria-label={ __( 'Add item', 'elementor' ) }
153
+ >
147
154
  <PlusIcon fontSize={ SIZE } />
148
155
  </IconButton>
149
156
  </Stack>
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { forwardRef, useId } from 'react';
3
3
  import { type PropValue } from '@elementor/editor-props';
4
- import { bindMenu, bindTrigger, Button, InputAdornment, Menu, MenuItem, TextField, usePopupState } from '@elementor/ui';
4
+ import { MenuListItem } from '@elementor/editor-ui';
5
+ import { bindMenu, bindTrigger, Button, InputAdornment, Menu, TextField, usePopupState } from '@elementor/ui';
5
6
 
6
7
  type TextFieldInnerSelectionProps = {
7
8
  placeholder?: string;
@@ -66,9 +67,9 @@ export const SelectionEndAdornment = < T extends string >( {
66
67
 
67
68
  <Menu MenuListProps={ { dense: true } } { ...bindMenu( popupState ) }>
68
69
  { options.map( ( option, index ) => (
69
- <MenuItem key={ option } onClick={ () => handleMenuItemClick( index ) }>
70
+ <MenuListItem key={ option } onClick={ () => handleMenuItemClick( index ) }>
70
71
  { option.toUpperCase() }
71
- </MenuItem>
72
+ </MenuListItem>
72
73
  ) ) }
73
74
  </Menu>
74
75
  </InputAdornment>
@@ -4,7 +4,7 @@ import { Grid } from '@elementor/ui';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
6
  import { PropKeyProvider, PropProvider, useBoundProp } from '../../bound-prop-context';
7
- import { ControlLabel } from '../../components/control-label';
7
+ import { ControlFormLabel } from '../../components/control-form-label';
8
8
  import { SectionContent } from '../../components/section-content';
9
9
  import { createControl } from '../../create-control';
10
10
  import { ColorControl } from '../color-control';
@@ -22,7 +22,7 @@ export const BackgroundControl = createControl( () => {
22
22
  <PropKeyProvider bind="color">
23
23
  <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
24
24
  <Grid item xs={ 6 }>
25
- <ControlLabel>{ __( 'Color', 'elementor' ) }</ControlLabel>
25
+ <ControlFormLabel>{ __( 'Color', 'elementor' ) }</ControlFormLabel>
26
26
  </Grid>
27
27
  <Grid item xs={ 6 }>
28
28
  <ColorControl />
@@ -3,7 +3,7 @@ import { PinIcon, PinnedOffIcon } from '@elementor/icons';
3
3
  import { Grid } from '@elementor/ui';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- import { ControlLabel } from '../../../../components/control-label';
6
+ import { ControlFormLabel } from '../../../../components/control-form-label';
7
7
  import { type ToggleButtonGroupItem } from '../../../../components/control-toggle-button-group';
8
8
  import { PopoverGridContainer } from '../../../../components/popover-grid-container';
9
9
  import { ToggleControl } from '../../../toggle-control';
@@ -29,7 +29,7 @@ export const BackgroundImageOverlayAttachment = () => {
29
29
  return (
30
30
  <PopoverGridContainer>
31
31
  <Grid item xs={ 6 }>
32
- <ControlLabel>{ __( 'Attachment', 'elementor' ) }</ControlLabel>
32
+ <ControlFormLabel>{ __( 'Attachment', 'elementor' ) }</ControlFormLabel>
33
33
  </Grid>
34
34
  <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end', overflow: 'hidden' } }>
35
35
  <ToggleControl options={ attachmentControlOptions } />
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil } from '@elementor/editor-props';
3
+ import { MenuListItem } from '@elementor/editor-ui';
3
4
  import { LetterXIcon, LetterYIcon } from '@elementor/icons';
4
- import { Grid, MenuItem, Select, type SelectChangeEvent } from '@elementor/ui';
5
+ import { Grid, Select, type SelectChangeEvent } from '@elementor/ui';
5
6
  import { __ } from '@wordpress/i18n';
6
7
 
7
8
  import { PropKeyProvider, PropProvider, useBoundProp } from '../../../../bound-prop-context';
8
- import { ControlLabel } from '../../../../components/control-label';
9
+ import { ControlFormLabel } from '../../../../components/control-form-label';
9
10
  import { PopoverGridContainer } from '../../../../components/popover-grid-container';
10
11
  import { SizeControl } from '../../../size-control';
11
12
 
@@ -55,7 +56,7 @@ export const BackgroundImageOverlayPosition = () => {
55
56
  <Grid item xs={ 12 }>
56
57
  <PopoverGridContainer>
57
58
  <Grid item xs={ 6 }>
58
- <ControlLabel>{ __( 'Position', 'elementor' ) }</ControlLabel>
59
+ <ControlFormLabel>{ __( 'Position', 'elementor' ) }</ControlFormLabel>
59
60
  </Grid>
60
61
  <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end', overflow: 'hidden' } }>
61
62
  <Select
@@ -65,9 +66,9 @@ export const BackgroundImageOverlayPosition = () => {
65
66
  fullWidth
66
67
  >
67
68
  { backgroundPositionOptions.map( ( { label, value } ) => (
68
- <MenuItem key={ value } value={ value ?? '' }>
69
+ <MenuListItem key={ value } value={ value ?? '' }>
69
70
  { label }
70
- </MenuItem>
71
+ </MenuListItem>
71
72
  ) ) }
72
73
  </Select>
73
74
  </Grid>
@@ -3,7 +3,7 @@ import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon } from '@elem
3
3
  import { Grid } from '@elementor/ui';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- import { ControlLabel } from '../../../../components/control-label';
6
+ import { ControlFormLabel } from '../../../../components/control-form-label';
7
7
  import { type ToggleButtonGroupItem } from '../../../../components/control-toggle-button-group';
8
8
  import { PopoverGridContainer } from '../../../../components/popover-grid-container';
9
9
  import { ToggleControl } from '../../../toggle-control';
@@ -41,7 +41,7 @@ export const BackgroundImageOverlayRepeat = () => {
41
41
  return (
42
42
  <PopoverGridContainer>
43
43
  <Grid item xs={ 6 }>
44
- <ControlLabel>{ __( 'Repeat', 'elementor' ) }</ControlLabel>
44
+ <ControlFormLabel>{ __( 'Repeat', 'elementor' ) }</ControlFormLabel>
45
45
  </Grid>
46
46
  <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
47
47
  <ToggleControl options={ repeatControlOptions } />
@@ -12,7 +12,7 @@ import { Grid } from '@elementor/ui';
12
12
  import { __ } from '@wordpress/i18n';
13
13
 
14
14
  import { PropKeyProvider, PropProvider, useBoundProp } from '../../../../bound-prop-context';
15
- import { ControlLabel } from '../../../../components/control-label';
15
+ import { ControlFormLabel } from '../../../../components/control-form-label';
16
16
  import {
17
17
  ControlToggleButtonGroup,
18
18
  type ToggleButtonGroupItem,
@@ -68,7 +68,7 @@ export const BackgroundImageOverlaySize = () => {
68
68
  <Grid item xs={ 12 }>
69
69
  <PopoverGridContainer>
70
70
  <Grid item xs={ 6 }>
71
- <ControlLabel>{ __( 'Size', 'elementor' ) }</ControlLabel>
71
+ <ControlFormLabel>{ __( 'Size', 'elementor' ) }</ControlFormLabel>
72
72
  </Grid>
73
73
  <Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
74
74
  <ControlToggleButtonGroup
@@ -7,7 +7,7 @@ import {
7
7
  colorPropTypeUtil,
8
8
  type PropKey,
9
9
  } from '@elementor/editor-props';
10
- import { Box, CardMedia, Grid, Tab, TabPanel, Tabs, UnstableColorIndicator } from '@elementor/ui';
10
+ import { Box, CardMedia, Grid, styled, Tab, TabPanel, Tabs, type Theme, UnstableColorIndicator } from '@elementor/ui';
11
11
  import { useWpMediaAttachment } from '@elementor/wp-media';
12
12
  import { __ } from '@wordpress/i18n';
13
13
 
@@ -160,19 +160,29 @@ const extractColorFrom = ( prop: BackgroundOverlayItemPropValue ) => {
160
160
 
161
161
  const ItemIconColor = ( { value: prop }: { value: BackgroundOverlayItemPropValue } ) => {
162
162
  const color = extractColorFrom( prop );
163
- return <UnstableColorIndicator size="inherit" component="span" value={ color } />;
163
+ return <StyledUnstableColorIndicator size="inherit" component="span" value={ color } />;
164
164
  };
165
165
 
166
166
  const ItemIconImage = ( { value }: { value: BackgroundImageOverlay } ) => {
167
167
  const { imageUrl } = useImage( value );
168
168
 
169
- return <CardMedia image={ imageUrl } sx={ { height: 13, width: 13, borderRadius: '4px' } } />;
169
+ return (
170
+ <CardMedia
171
+ image={ imageUrl }
172
+ sx={ ( theme: Theme ) => ( {
173
+ height: '1em',
174
+ width: '1em',
175
+ borderRadius: `${ theme.shape.borderRadius / 2 }px`,
176
+ outline: `1px solid ${ theme.palette.action.disabled }`,
177
+ } ) }
178
+ />
179
+ );
170
180
  };
171
181
 
172
182
  const ItemIconGradient = ( { value }: { value: BackgroundOverlayItemPropValue } ) => {
173
183
  const gradient = getGradientValue( value );
174
184
 
175
- return <UnstableColorIndicator size="inherit" component="span" value={ gradient } />;
185
+ return <StyledUnstableColorIndicator size="inherit" component="span" value={ gradient } />;
176
186
  };
177
187
 
178
188
  const ItemLabel = ( { value }: { value: BackgroundOverlayItemPropValue } ) => {
@@ -249,6 +259,10 @@ const ImageOverlayContent = () => {
249
259
  );
250
260
  };
251
261
 
262
+ const StyledUnstableColorIndicator = styled( UnstableColorIndicator )( ( { theme } ) => ( {
263
+ borderRadius: `${ theme.shape.borderRadius / 2 }px`,
264
+ } ) );
265
+
252
266
  const useImage = ( image: BackgroundImageOverlay ) => {
253
267
  let imageTitle,
254
268
  imageUrl: string | null = null;
@@ -14,7 +14,7 @@ export const ColorControl = createControl( ( { propTypeUtil = colorPropTypeUtil,
14
14
  const { value, setValue } = useBoundProp( propTypeUtil );
15
15
 
16
16
  const handleChange = ( selectedColor: string ) => {
17
- setValue( selectedColor );
17
+ setValue( selectedColor || null );
18
18
  };
19
19
 
20
20
  return (
@@ -5,6 +5,7 @@ import { bindPopover, bindToggle, Grid, Popover, Stack, ToggleButton, Tooltip, u
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
8
+ import { ControlFormLabel } from '../components/control-form-label';
8
9
  import { ControlLabel } from '../components/control-label';
9
10
  import { PopoverContent } from '../components/popover-content';
10
11
  import { PopoverGridContainer } from '../components/popover-grid-container';
@@ -134,6 +135,7 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
134
135
  } }
135
136
  { ...bindPopover( popupState ) }
136
137
  slotProps={ {
138
+ // eslint-disable-next-line react-compiler/react-compiler
137
139
  paper: { sx: { mt: 0.5, width: controlRef.current?.getBoundingClientRect().width } },
138
140
  } }
139
141
  >
@@ -159,7 +161,7 @@ const MultiSizeValueControl = ( { item }: { item: Item } ) => (
159
161
  <Grid item xs={ 6 }>
160
162
  <Grid container gap={ 0.75 } alignItems="center">
161
163
  <Grid item xs={ 12 }>
162
- <ControlLabel>{ item.label }</ControlLabel>
164
+ <ControlFormLabel>{ item.label }</ControlFormLabel>
163
165
  </Grid>
164
166
  <Grid item xs={ 12 }>
165
167
  <SizeControl startIcon={ item.icon } />
@@ -10,8 +10,8 @@ import {
10
10
  IconButton,
11
11
  InputAdornment,
12
12
  Link,
13
- ListSubheader,
14
13
  MenuList,
14
+ MenuSubheader,
15
15
  Popover,
16
16
  Stack,
17
17
  styled,
@@ -189,6 +189,7 @@ const FontList = ( { fontListItems, setFontFamily, handleClose, fontFamily }: Fo
189
189
  () => {
190
190
  virtualizer.scrollToIndex( fontListItems.findIndex( ( item ) => item.value === fontFamily ) );
191
191
  },
192
+ // eslint-disable-next-line react-compiler/react-compiler
192
193
  // eslint-disable-next-line react-hooks/exhaustive-deps
193
194
  [ fontFamily ]
194
195
  );
@@ -221,14 +222,14 @@ const FontList = ( { fontListItems, setFontFamily, handleClose, fontFamily }: Fo
221
222
 
222
223
  if ( item.type === 'category' ) {
223
224
  return (
224
- <ListSubheader
225
+ <MenuSubheader
225
226
  key={ virtualRow.key }
226
227
  style={ {
227
228
  transform: `translateY(${ virtualRow.start }px)`,
228
229
  } }
229
230
  >
230
231
  { item.value }
231
- </ListSubheader>
232
+ </MenuSubheader>
232
233
  );
233
234
  }
234
235
 
@@ -5,6 +5,7 @@ import { Grid, Stack, ToggleButton, Tooltip } from '@elementor/ui';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
8
+ import { ControlFormLabel } from '../components/control-form-label';
8
9
  import { ControlLabel } from '../components/control-label';
9
10
  import { createControl } from '../create-control';
10
11
  import { SizeControl } from './size-control';
@@ -61,7 +62,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
61
62
  <Stack direction="row" gap={ 2 } flexWrap="nowrap">
62
63
  <Grid container gap={ 0.75 } alignItems="center">
63
64
  <Grid item xs={ 12 }>
64
- <ControlLabel>{ __( 'Column', 'elementor' ) }</ControlLabel>
65
+ <ControlFormLabel>{ __( 'Column', 'elementor' ) }</ControlFormLabel>
65
66
  </Grid>
66
67
  <Grid item xs={ 12 }>
67
68
  <Control bind={ 'column' } isLinked={ isLinked } />
@@ -69,7 +70,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
69
70
  </Grid>
70
71
  <Grid container gap={ 0.75 } alignItems="center">
71
72
  <Grid item xs={ 12 }>
72
- <ControlLabel>{ __( 'Row', 'elementor' ) }</ControlLabel>
73
+ <ControlFormLabel>{ __( 'Row', 'elementor' ) }</ControlFormLabel>
73
74
  </Grid>
74
75
  <Grid item xs={ 12 }>
75
76
  <Control bind={ 'row' } isLinked={ isLinked } />
@@ -5,7 +5,7 @@ import { type MediaType } from '@elementor/wp-media';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
8
- import { ControlLabel } from '../components/control-label';
8
+ import { ControlFormLabel } from '../components/control-form-label';
9
9
  import { createControl } from '../create-control';
10
10
  import { useUnfilteredFilesUpload } from '../hooks/use-unfiltered-files-upload';
11
11
  import { ImageMediaControl } from './image-media-control';
@@ -27,13 +27,13 @@ export const ImageControl = createControl(
27
27
  <PropProvider { ...propContext }>
28
28
  <Stack gap={ 1.5 }>
29
29
  <PropKeyProvider bind={ 'src' }>
30
- <ControlLabel> { __( 'Image', 'elementor' ) } </ControlLabel>
30
+ <ControlFormLabel> { __( 'Image', 'elementor' ) } </ControlFormLabel>
31
31
  <ImageMediaControl mediaTypes={ mediaTypes } />
32
32
  </PropKeyProvider>
33
33
  <PropKeyProvider bind={ 'size' }>
34
34
  <Grid container gap={ 1.5 } alignItems="center" flexWrap="nowrap">
35
35
  <Grid item xs={ 6 }>
36
- <ControlLabel> { resolutionLabel } </ControlLabel>
36
+ <ControlFormLabel> { resolutionLabel } </ControlFormLabel>
37
37
  </Grid>
38
38
  <Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
39
39
  <SelectControl options={ sizes } />
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useMemo, useState } from 'react';
3
+ import { getAncestorWithAnchorTag, getDescendantWithAnchorTag } from '@elementor/editor-elements';
3
4
  import {
4
5
  booleanPropTypeUtil,
5
6
  linkPropTypeUtil,
@@ -23,10 +24,9 @@ import {
23
24
  type FlatOption,
24
25
  isCategorizedOptionPool,
25
26
  } from '../components/autocomplete';
26
- import { ControlLabel } from '../components/control-label';
27
+ import { ControlFormLabel } from '../components/control-form-label';
27
28
  import ControlActions from '../control-actions/control-actions';
28
29
  import { createControl } from '../create-control';
29
- import { getLinkRestriction } from '../utils/link-restriction';
30
30
  import { type ControlProps } from '../utils/types';
31
31
 
32
32
  type Props = ControlProps< {
@@ -68,7 +68,7 @@ export const LinkControl = createControl( ( props: Props ) => {
68
68
  );
69
69
 
70
70
  const onEnabledChange = () => {
71
- const { shouldRestrict } = getLinkRestriction( elementId );
71
+ const shouldRestrict = getAncestorWithAnchorTag( elementId ) || getDescendantWithAnchorTag( elementId );
72
72
 
73
73
  if ( shouldRestrict && ! isEnabled ) {
74
74
  return;
@@ -144,7 +144,7 @@ export const LinkControl = createControl( ( props: Props ) => {
144
144
  alignItems: 'center',
145
145
  } }
146
146
  >
147
- <ControlLabel>{ __( 'Link', 'elementor' ) }</ControlLabel>
147
+ <ControlFormLabel>{ __( 'Link', 'elementor' ) }</ControlFormLabel>
148
148
  <ToggleIconControl
149
149
  enabled={ isEnabled }
150
150
  onIconClick={ onEnabledChange }
@@ -159,7 +159,7 @@ export const LinkControl = createControl( ( props: Props ) => {
159
159
  options={ options }
160
160
  allowCustomValues={ allowCustomValues }
161
161
  placeholder={ placeholder }
162
- value={ value?.destination?.value }
162
+ value={ value?.destination?.value?.settings?.label || value?.destination?.value }
163
163
  onOptionChange={ onOptionChange }
164
164
  onTextChange={ onTextChange }
165
165
  minInputLength={ minInputLength }
@@ -201,7 +201,7 @@ const SwitchControl = () => {
201
201
  return (
202
202
  <Grid container alignItems="center" flexWrap="nowrap" justifyContent="space-between">
203
203
  <Grid item>
204
- <ControlLabel>{ __( 'Open in a new tab', 'elementor' ) }</ControlLabel>
204
+ <ControlFormLabel>{ __( 'Open in a new tab', 'elementor' ) }</ControlFormLabel>
205
205
  </Grid>
206
206
  <Grid item>
207
207
  <Switch checked={ value } onClick={ onClick } />
@@ -5,6 +5,7 @@ import { Grid, Stack, ToggleButton, Tooltip } from '@elementor/ui';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
8
+ import { ControlFormLabel } from '../components/control-form-label';
8
9
  import { ControlLabel } from '../components/control-label';
9
10
  import { createControl } from '../create-control';
10
11
  import { type ExtendedValue, SizeControl } from './size-control';
@@ -72,7 +73,7 @@ export const LinkedDimensionsControl = createControl(
72
73
  <Stack direction="row" gap={ 2 } flexWrap="nowrap">
73
74
  <Grid container gap={ 0.75 } alignItems="center">
74
75
  <Grid item xs={ 12 }>
75
- <ControlLabel>{ __( 'Top', 'elementor' ) }</ControlLabel>
76
+ <ControlFormLabel>{ __( 'Top', 'elementor' ) }</ControlFormLabel>
76
77
  </Grid>
77
78
  <Grid item xs={ 12 }>
78
79
  <Control
@@ -85,9 +86,9 @@ export const LinkedDimensionsControl = createControl(
85
86
  </Grid>
86
87
  <Grid container gap={ 0.75 } alignItems="center">
87
88
  <Grid item xs={ 12 }>
88
- <ControlLabel>
89
+ <ControlFormLabel>
89
90
  { isSiteRtl ? __( 'Left', 'elementor' ) : __( 'Right', 'elementor' ) }
90
- </ControlLabel>
91
+ </ControlFormLabel>
91
92
  </Grid>
92
93
  <Grid item xs={ 12 }>
93
94
  <Control
@@ -108,7 +109,7 @@ export const LinkedDimensionsControl = createControl(
108
109
  <Stack direction="row" gap={ 2 } flexWrap="nowrap">
109
110
  <Grid container gap={ 0.75 } alignItems="center">
110
111
  <Grid item xs={ 12 }>
111
- <ControlLabel>{ __( 'Bottom', 'elementor' ) }</ControlLabel>
112
+ <ControlFormLabel>{ __( 'Bottom', 'elementor' ) }</ControlFormLabel>
112
113
  </Grid>
113
114
  <Grid item xs={ 12 }>
114
115
  <Control
@@ -121,9 +122,9 @@ export const LinkedDimensionsControl = createControl(
121
122
  </Grid>
122
123
  <Grid container gap={ 0.75 } alignItems="center">
123
124
  <Grid item xs={ 12 }>
124
- <ControlLabel>
125
+ <ControlFormLabel>
125
126
  { isSiteRtl ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' ) }
126
- </ControlLabel>
127
+ </ControlFormLabel>
127
128
  </Grid>
128
129
  <Grid item xs={ 12 }>
129
130
  <Control
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { stringPropTypeUtil, type StringPropValue } from '@elementor/editor-props';
3
- import { MenuItem, Select, type SelectChangeEvent } from '@elementor/ui';
3
+ import { MenuListItem } from '@elementor/editor-ui';
4
+ import { Select, type SelectChangeEvent } from '@elementor/ui';
4
5
 
5
6
  import { useBoundProp } from '../bound-prop-context';
6
7
  import ControlActions from '../control-actions/control-actions';
@@ -32,9 +33,9 @@ export const SelectControl = createControl( ( { options, onChange }: Props ) =>
32
33
  fullWidth
33
34
  >
34
35
  { options.map( ( { label, ...props } ) => (
35
- <MenuItem key={ props.value } { ...props } value={ props.value ?? '' }>
36
+ <MenuListItem key={ props.value } { ...props } value={ props.value ?? '' }>
36
37
  { label }
37
- </MenuItem>
38
+ </MenuListItem>
38
39
  ) ) }
39
40
  </Select>
40
41
  </ControlActions>
@@ -4,7 +4,7 @@ import { Grid } from '@elementor/ui';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
6
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
7
- import { ControlLabel } from '../components/control-label';
7
+ import { ControlFormLabel } from '../components/control-form-label';
8
8
  import { SectionContent } from '../components/section-content';
9
9
  import { createControl } from '../create-control';
10
10
  import { ColorControl } from './color-control';
@@ -39,7 +39,7 @@ const Control = ( { bind, label, children }: StrokeProps ) => (
39
39
  <PropKeyProvider bind={ bind }>
40
40
  <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
41
41
  <Grid item xs={ 6 }>
42
- <ControlLabel>{ label }</ControlLabel>
42
+ <ControlFormLabel>{ label }</ControlFormLabel>
43
43
  </Grid>
44
44
  <Grid item xs={ 6 }>
45
45
  { children }
@@ -7,7 +7,7 @@ import { type OpenOptions, useWpMediaAttachment, useWpMediaFrame } from '@elemen
7
7
  import { __ } from '@wordpress/i18n';
8
8
 
9
9
  import { useBoundProp } from '../bound-prop-context';
10
- import { ControlLabel } from '../components/control-label';
10
+ import { ControlFormLabel } from '../components/control-form-label';
11
11
  import { EnableUnfilteredModal } from '../components/enable-unfiltered-modal';
12
12
  import ControlActions from '../control-actions/control-actions';
13
13
  import { createControl } from '../create-control';
@@ -83,7 +83,7 @@ export const SvgMediaControl = createControl( () => {
83
83
  return (
84
84
  <Stack gap={ 1 }>
85
85
  <EnableUnfilteredModal open={ unfilteredModalOpenState } onClose={ onCloseUnfilteredModal } />
86
- <ControlLabel> { __( 'SVG', 'elementor' ) } </ControlLabel>
86
+ <ControlFormLabel> { __( 'SVG', 'elementor' ) } </ControlFormLabel>
87
87
  <ControlActions>
88
88
  <StyledCard variant="outlined">
89
89
  <StyledCardMediaContainer>
@@ -34,6 +34,7 @@ export const useSyncExternalState = < TValue, >( {
34
34
  useEffect( () => {
35
35
  setInternal( ( prevInternal ) => toInternal( external, prevInternal ) );
36
36
 
37
+ // eslint-disable-next-line react-compiler/react-compiler
37
38
  // eslint-disable-next-line react-hooks/exhaustive-deps
38
39
  }, [ external ] );
39
40
 
package/src/index.ts CHANGED
@@ -19,7 +19,7 @@ export { SvgMediaControl } from './controls/svg-media-control';
19
19
  export { BackgroundControl } from './controls/background-control/background-control';
20
20
 
21
21
  // components
22
- export { ControlLabel } from './components/control-label';
22
+ export { ControlFormLabel } from './components/control-form-label';
23
23
  export { ControlToggleButtonGroup } from './components/control-toggle-button-group';
24
24
 
25
25
  // types
@@ -39,5 +39,6 @@ export { ControlActionsProvider, useControlActions } from './control-actions/con
39
39
  export { useBoundProp, PropProvider, PropKeyProvider } from './bound-prop-context';
40
40
  export { ControlAdornmentsProvider } from './control-adornments/control-adornments-context';
41
41
  export { ControlAdornments } from './control-adornments/control-adornments';
42
+
42
43
  // hooks
43
44
  export { useSyncExternalState } from './hooks/use-sync-external-state';
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import { type PropsWithChildren } from 'react';
3
- import { Stack } from '@elementor/ui';
4
-
5
- import { ControlLabel } from '../components/control-label';
6
- import { ControlAdornments } from './control-adornments';
7
-
8
- export const ControlLabelWithAdornments = ( { children }: PropsWithChildren< object > ) => {
9
- return (
10
- <Stack direction="row" alignItems="center" justifyItems="start" gap={ 1 }>
11
- <ControlLabel>{ children }</ControlLabel>
12
- <ControlAdornments />
13
- </Stack>
14
- );
15
- };
@@ -1,47 +0,0 @@
1
- import { getContainer } from '@elementor/editor-elements';
2
-
3
- type LinkRestriction =
4
- | {
5
- shouldRestrict: true;
6
- restrictReason: 'ancestor' | 'descendant';
7
- }
8
- | {
9
- shouldRestrict: false;
10
- restrictReason?: never;
11
- };
12
-
13
- export function getLinkRestriction( elementId: string ): LinkRestriction {
14
- if ( getAncestorAnchor( elementId ) ) {
15
- return {
16
- shouldRestrict: true,
17
- restrictReason: 'ancestor',
18
- };
19
- }
20
-
21
- if ( getDescendantAnchor( elementId ) ) {
22
- return {
23
- shouldRestrict: true,
24
- restrictReason: 'descendant',
25
- };
26
- }
27
-
28
- return { shouldRestrict: false };
29
- }
30
-
31
- function getAncestorAnchor( elementId: string ) {
32
- const element = getElementView( elementId );
33
-
34
- return element?.closest( 'a' ) || null;
35
- }
36
-
37
- function getDescendantAnchor( elementId: string ) {
38
- const element = getElementView( elementId );
39
-
40
- return element?.querySelector( 'a' ) || null;
41
- }
42
-
43
- function getElementView( id: string ) {
44
- const elementContainer = getContainer( id );
45
-
46
- return elementContainer?.view?.el || null;
47
- }