@elementor/editor-editing-panel 1.11.1 → 1.13.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 (42) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/index.js +431 -426
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +383 -378
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +8 -8
  7. package/src/components/add-or-remove-content.tsx +5 -3
  8. package/src/components/collapsible-content.tsx +2 -1
  9. package/src/components/css-classes/css-class-item.tsx +2 -0
  10. package/src/components/css-classes/css-class-selector.tsx +2 -7
  11. package/src/components/panel-divider.tsx +4 -0
  12. package/src/components/popover-content.tsx +15 -0
  13. package/src/components/section-content.tsx +16 -0
  14. package/src/components/style-sections/border-section/border-color-field.tsx +1 -1
  15. package/src/components/style-sections/border-section/border-radius-field.tsx +5 -6
  16. package/src/components/style-sections/border-section/border-section.tsx +5 -4
  17. package/src/components/style-sections/border-section/border-style-field.tsx +2 -2
  18. package/src/components/style-sections/border-section/border-width-field.tsx +1 -1
  19. package/src/components/style-sections/effects-section/effects-section.tsx +3 -3
  20. package/src/components/style-sections/layout-section/flex-order-field.tsx +4 -3
  21. package/src/components/style-sections/layout-section/flex-size-field.tsx +4 -3
  22. package/src/components/style-sections/layout-section/layout-section.tsx +6 -5
  23. package/src/components/style-sections/position-section/position-field.tsx +1 -1
  24. package/src/components/style-sections/position-section/position-section.tsx +3 -3
  25. package/src/components/style-sections/size-section/overflow-field.tsx +2 -2
  26. package/src/components/style-sections/size-section/size-section.tsx +10 -8
  27. package/src/components/style-sections/spacing-section/spacing-section.tsx +5 -4
  28. package/src/components/style-sections/typography-section/font-family-field.tsx +2 -2
  29. package/src/components/style-sections/typography-section/font-size-field.tsx +1 -1
  30. package/src/components/style-sections/typography-section/font-style-field.tsx +36 -0
  31. package/src/components/style-sections/typography-section/font-weight-field.tsx +2 -2
  32. package/src/components/style-sections/typography-section/letter-spacing-field.tsx +1 -1
  33. package/src/components/style-sections/typography-section/line-height-field.tsx +1 -1
  34. package/src/components/style-sections/typography-section/text-color-field.tsx +1 -1
  35. package/src/components/style-sections/typography-section/{text-style-field.tsx → text-decoration-field.tsx} +3 -24
  36. package/src/components/style-sections/typography-section/text-stroke-field.tsx +1 -1
  37. package/src/components/style-sections/typography-section/transform-field.tsx +1 -1
  38. package/src/components/style-sections/typography-section/typography-section.tsx +12 -9
  39. package/src/components/style-sections/typography-section/word-spacing-field.tsx +1 -1
  40. package/src/controls-registry/settings-field.tsx +1 -7
  41. package/src/dynamics/components/dynamic-selection-control.tsx +4 -3
  42. package/src/dynamics/components/dynamic-selection.tsx +5 -4
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ControlLabel } from '@elementor/editor-controls';
3
3
  import { type StringPropValue } from '@elementor/editor-props';
4
- import { ItalicIcon, StrikethroughIcon, UnderlineIcon } from '@elementor/icons';
4
+ import { StrikethroughIcon, UnderlineIcon } from '@elementor/icons';
5
5
  import { Grid, ToggleButton as ToggleButtonBase, ToggleButtonGroup, type ToggleButtonProps } from '@elementor/ui';
6
6
  import { __ } from '@wordpress/i18n';
7
7
 
@@ -9,23 +9,10 @@ import { useStylesField } from '../../../hooks/use-styles-field';
9
9
 
10
10
  const buttonSize = 'tiny';
11
11
 
12
- export const TextStyleField = () => {
13
- const [ fontStyle, setFontStyle ] = useStylesField< StringPropValue | null >( 'font-style' );
12
+ export const TextDecorationField = () => {
14
13
  const [ textDecoration, setTextDecoration ] = useStylesField< StringPropValue | null >( 'text-decoration' );
15
14
 
16
- const formats = [ fontStyle?.value, ...( textDecoration?.value || '' ).split( ' ' ) ];
17
-
18
- const handleSetFontStyle = ( newValue: string | null ) => {
19
- if ( newValue === null ) {
20
- return setFontStyle( null );
21
- }
22
-
23
- setFontStyle( {
24
- $$type: 'string',
25
- value: newValue,
26
- } );
27
- };
28
-
15
+ const formats = [ ...( textDecoration?.value || '' ).split( ' ' ) ];
29
16
  const handleSetTextDecoration = ( newValue: string | null ) => {
30
17
  if ( newValue === null ) {
31
18
  return setTextDecoration( null );
@@ -44,14 +31,6 @@ export const TextStyleField = () => {
44
31
  </Grid>
45
32
  <Grid item xs={ 6 } display="flex" justifyContent="end">
46
33
  <ToggleButtonGroup value={ formats }>
47
- <ToggleButton
48
- value="italic"
49
- onChange={ ( v ) => handleSetFontStyle( fontStyle?.value === v ? null : v ) }
50
- aria-label="italic"
51
- sx={ { marginLeft: 'auto' } }
52
- >
53
- <ItalicIcon fontSize={ buttonSize } />
54
- </ToggleButton>
55
34
  <ShorthandControl
56
35
  value="line-through"
57
36
  currentValues={ textDecoration?.value || '' }
@@ -38,7 +38,7 @@ export const TextStrokeField = () => {
38
38
 
39
39
  return (
40
40
  <AddOrRemoveContent
41
- label={ __( 'Text Stroke', 'elementor' ) }
41
+ label={ __( 'Text stroke', 'elementor' ) }
42
42
  isAdded={ hasTextStroke }
43
43
  onAdd={ addTextStroke }
44
44
  onRemove={ removeTextStroke }
@@ -39,7 +39,7 @@ export const TransformField = () => (
39
39
  <StylesField bind={ 'text-transform' }>
40
40
  <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
41
41
  <Grid item xs={ 6 }>
42
- <ControlLabel>{ __( 'Text Transform', 'elementor' ) }</ControlLabel>
42
+ <ControlLabel>{ __( 'Text transform', 'elementor' ) }</ControlLabel>
43
43
  </Grid>
44
44
  <Grid item xs={ 6 } display="flex" justifyContent="end">
45
45
  <ToggleControl options={ options } />
@@ -1,41 +1,44 @@
1
1
  import * as React from 'react';
2
- import { Divider, Stack } from '@elementor/ui';
3
2
 
4
3
  import { CollapsibleContent } from '../../collapsible-content';
4
+ import { PanelDivider } from '../../panel-divider';
5
+ import { SectionContent } from '../../section-content';
5
6
  import { FontFamilyField } from './font-family-field';
6
7
  import { FontSizeField } from './font-size-field';
8
+ import { FontStyleField } from './font-style-field';
7
9
  import { FontWeightField } from './font-weight-field';
8
10
  import { LetterSpacingField } from './letter-spacing-field';
9
11
  import { LineHeightField } from './line-height-field';
10
12
  import { TextAlignmentField } from './text-alignment-field';
11
13
  import { TextColorField } from './text-color-field';
14
+ import { TextDecorationField } from './text-decoration-field';
12
15
  import { TextDirectionField } from './text-direction-field';
13
16
  import { TextStrokeField } from './text-stroke-field';
14
- import { TextStyleField } from './text-style-field';
15
17
  import { TransformField } from './transform-field';
16
18
  import { WordSpacingField } from './word-spacing-field';
17
19
 
18
20
  export const TypographySection = () => {
19
21
  return (
20
- <Stack gap={ 1.5 }>
22
+ <SectionContent>
21
23
  <FontFamilyField />
22
24
  <FontWeightField />
23
25
  <FontSizeField />
24
- <Divider />
26
+ <PanelDivider />
25
27
  <TextAlignmentField />
26
28
  <TextColorField />
27
29
  <CollapsibleContent>
28
- <Stack gap={ 1.5 } sx={ { pt: 1.5 } }>
30
+ <SectionContent sx={ { pt: 2 } }>
29
31
  <LineHeightField />
30
32
  <LetterSpacingField />
31
33
  <WordSpacingField />
32
- <Divider />
33
- <TextStyleField />
34
+ <PanelDivider />
35
+ <TextDecorationField />
34
36
  <TransformField />
35
37
  <TextDirectionField />
38
+ <FontStyleField />
36
39
  <TextStrokeField />
37
- </Stack>
40
+ </SectionContent>
38
41
  </CollapsibleContent>
39
- </Stack>
42
+ </SectionContent>
40
43
  );
41
44
  };
@@ -10,7 +10,7 @@ export const WordSpacingField = () => {
10
10
  <StylesField bind="word-spacing">
11
11
  <Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
12
12
  <Grid item xs={ 6 }>
13
- <ControlLabel>{ __( 'Word Spacing', 'elementor' ) }</ControlLabel>
13
+ <ControlLabel>{ __( 'Word spacing', 'elementor' ) }</ControlLabel>
14
14
  </Grid>
15
15
  <Grid item xs={ 6 }>
16
16
  <SizeControl />
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { PropKeyProvider, PropProvider } from '@elementor/editor-controls';
3
3
  import { updateElementSettings, useElementSetting } from '@elementor/editor-elements';
4
- import { type LinkPropValue, type PropKey, type PropValue } from '@elementor/editor-props';
4
+ import { type PropKey, type PropValue } from '@elementor/editor-props';
5
5
 
6
6
  import { useElement } from '../contexts/element-context';
7
7
  import { createTopLevelOjectType } from './create-top-level-object-type';
@@ -16,16 +16,10 @@ export const SettingsField = ( { bind, children }: Props ) => {
16
16
 
17
17
  const settingsValue = useElementSetting< PropValue >( element.id, bind );
18
18
 
19
- const linkValue = useElementSetting< PropValue >( element.id, 'link' ) as LinkPropValue;
20
-
21
19
  const value = { [ bind ]: settingsValue };
22
20
 
23
21
  const propType = createTopLevelOjectType( { schema: elementType.propsSchema } );
24
22
 
25
- if ( bind === 'tag' && linkValue?.value && 'div-block' === elementType.key ) {
26
- return null;
27
- }
28
-
29
23
  const setValue = ( newValue: Record< string, PropValue > ) => {
30
24
  updateElementSettings( {
31
25
  id: element.id,
@@ -22,6 +22,7 @@ import {
22
22
  } from '@elementor/ui';
23
23
  import { __ } from '@wordpress/i18n';
24
24
 
25
+ import { PopoverContent } from '../../components/popover-content';
25
26
  import { Control as BaseControl } from '../../controls-registry/control';
26
27
  import { type ControlType, getControlByType } from '../../controls-registry/controls-registry';
27
28
  import { usePersistDynamicValue } from '../../hooks/use-persist-dynamic-value';
@@ -153,15 +154,15 @@ const DynamicSettings = ( { controls }: { controls: DynamicTag[ 'atomic_controls
153
154
 
154
155
  { tabs.map( ( { value }, index ) => {
155
156
  return (
156
- <TabPanel key={ index } sx={ { flexGrow: 1 } } { ...getTabPanelProps( index ) }>
157
- <Stack gap={ 1 } px={ 2 }>
157
+ <TabPanel key={ index } sx={ { flexGrow: 1, py: 0 } } { ...getTabPanelProps( index ) }>
158
+ <PopoverContent p={ 1.5 }>
158
159
  { value.items.map( ( item ) => {
159
160
  if ( item.type === 'control' ) {
160
161
  return <Control key={ item.value.bind } control={ item.value } />;
161
162
  }
162
163
  return null;
163
164
  } ) }
164
- </Stack>
165
+ </PopoverContent>
165
166
  </TabPanel>
166
167
  );
167
168
  } ) }
@@ -16,6 +16,7 @@ import {
16
16
  } from '@elementor/ui';
17
17
  import { __ } from '@wordpress/i18n';
18
18
 
19
+ import { PopoverContent } from '../../components/popover-content';
19
20
  import { usePersistDynamicValue } from '../../hooks/use-persist-dynamic-value';
20
21
  import { usePropDynamicTags } from '../hooks/use-prop-dynamic-tags';
21
22
  import { getAtomicDynamicTags } from '../sync/get-atomic-dynamic-tags';
@@ -85,7 +86,7 @@ export const DynamicSelection = ( { onSelect }: DynamicSelectionProps ) => {
85
86
  <MenuList role="listbox" tabIndex={ 0 }>
86
87
  { options.map( ( [ category, items ], index ) => (
87
88
  <Fragment key={ index }>
88
- <ListSubheader sx={ { typography: 'caption', color: 'text.tertiary' } }>
89
+ <ListSubheader sx={ { px: 1.5, typography: 'caption', color: 'text.tertiary' } }>
89
90
  { dynamicGroups?.[ category ]?.title || category }
90
91
  </ListSubheader>
91
92
  { items.map( ( { value, label: tagLabel } ) => {
@@ -97,7 +98,7 @@ export const DynamicSelection = ( { onSelect }: DynamicSelectionProps ) => {
97
98
  selected={ isSelected }
98
99
  // eslint-disable-next-line jsx-a11y/no-autofocus
99
100
  autoFocus={ isSelected }
100
- sx={ { typography: 'caption' } }
101
+ sx={ { px: 1.5, typography: 'caption' } }
101
102
  onClick={ () => handleSetDynamicTag( value ) }
102
103
  >
103
104
  { tagLabel }
@@ -108,7 +109,7 @@ export const DynamicSelection = ( { onSelect }: DynamicSelectionProps ) => {
108
109
  ) ) }
109
110
  </MenuList>
110
111
  ) : (
111
- <Stack alignItems="center" p={ 2.5 } gap={ 1.5 }>
112
+ <PopoverContent alignItems="center" p={ 2.5 }>
112
113
  <PhotoIcon fontSize="large" />
113
114
  <Typography align="center" variant="caption" color="text.secondary">
114
115
  { __( 'Sorry, nothing matched', 'elementor' ) }
@@ -127,7 +128,7 @@ export const DynamicSelection = ( { onSelect }: DynamicSelectionProps ) => {
127
128
  &nbsp;
128
129
  { __( 'and try again.', 'elementor' ) }
129
130
  </Typography>
130
- </Stack>
131
+ </PopoverContent>
131
132
  ) }
132
133
  </Box>
133
134
  </Stack>