@elementor/editor-editing-panel 1.50.0 → 3.32.0-20

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 (55) hide show
  1. package/CHANGELOG.md +0 -27
  2. package/dist/index.d.mts +78 -47
  3. package/dist/index.d.ts +78 -47
  4. package/dist/index.js +1723 -1384
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1510 -1143
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +22 -22
  9. package/src/components/css-classes/css-class-convert-local.tsx +77 -0
  10. package/src/components/css-classes/css-class-item.tsx +15 -1
  11. package/src/components/css-classes/css-class-menu.tsx +8 -1
  12. package/src/components/css-classes/local-class-sub-menu.tsx +23 -0
  13. package/src/components/css-classes/use-apply-and-unapply-class.ts +7 -50
  14. package/src/components/css-classes/use-can-convert-local-class-to-global.ts +22 -0
  15. package/src/components/custom-css.tsx +21 -0
  16. package/src/components/editing-panel-tabs.tsx +1 -5
  17. package/src/components/section.tsx +1 -5
  18. package/src/components/settings-tab.tsx +6 -15
  19. package/src/components/style-sections/effects-section/effects-section.tsx +30 -22
  20. package/src/components/style-sections/layout-section/display-field.tsx +11 -20
  21. package/src/components/style-sections/layout-section/flex-size-field.tsx +86 -52
  22. package/src/components/style-sections/position-section/offset-field.tsx +2 -2
  23. package/src/components/style-sections/position-section/position-section.tsx +2 -8
  24. package/src/components/style-sections/size-section/size-section.tsx +16 -31
  25. package/src/components/style-sections/typography-section/typography-section.tsx +2 -19
  26. package/src/components/style-tab-collapsible-content.tsx +1 -5
  27. package/src/components/style-tab-section.tsx +1 -5
  28. package/src/components/style-tab.tsx +15 -2
  29. package/src/controls-actions.ts +1 -1
  30. package/src/controls-registry/conditional-field.tsx +26 -0
  31. package/src/controls-registry/control.tsx +2 -2
  32. package/src/controls-registry/controls-registry.tsx +44 -3
  33. package/src/controls-registry/settings-field.tsx +33 -45
  34. package/src/controls-registry/styles-field.tsx +14 -14
  35. package/src/dynamics/components/dynamic-selection-control.tsx +2 -2
  36. package/src/errors.ts +10 -0
  37. package/src/hooks/use-custom-css.ts +184 -0
  38. package/src/hooks/use-state-by-element.ts +1 -4
  39. package/src/hooks/use-styles-fields.ts +129 -106
  40. package/src/index.ts +9 -10
  41. package/src/init.ts +2 -5
  42. package/src/popover-action.tsx +36 -15
  43. package/src/reset-style-props.tsx +2 -6
  44. package/src/styles-inheritance/components/infotip/value-component.tsx +1 -0
  45. package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +6 -23
  46. package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +17 -8
  47. package/src/styles-inheritance/consts.ts +0 -4
  48. package/src/styles-inheritance/init.ts +1 -4
  49. package/src/styles-inheritance/transformers/background-color-overlay-transformer.tsx +5 -1
  50. package/src/styles-inheritance/transformers/background-gradient-overlay-transformer.tsx +3 -3
  51. package/src/styles-inheritance/transformers/background-image-overlay-transformer.tsx +2 -1
  52. package/src/utils/prop-dependency-utils.ts +156 -0
  53. package/src/components/style-sections/size-section/object-position-field.tsx +0 -15
  54. package/src/sync/experiments-flags.ts +0 -5
  55. /package/src/components/style-sections/{layout-section → effects-section}/opacity-control-field.tsx +0 -0
@@ -1,37 +1,43 @@
1
1
  import { useMemo } from 'react';
2
- import { createElementStyle, deleteElementStyle, type ElementID, getElementLabel } from '@elementor/editor-elements';
2
+ import {
3
+ createElementStyle,
4
+ deleteElementStyle,
5
+ type ElementID,
6
+ getElementLabel,
7
+ shouldCreateNewLocalStyle,
8
+ } from '@elementor/editor-elements';
3
9
  import type { Props } from '@elementor/editor-props';
4
10
  import { getVariantByMeta, type StyleDefinition, type StyleDefinitionVariant } from '@elementor/editor-styles';
5
11
  import { isElementsStylesProvider, type StylesProvider } from '@elementor/editor-styles-repository';
6
12
  import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-repository';
7
- import { isExperimentActive, undoable } from '@elementor/editor-v1-adapters';
13
+ import { undoable } from '@elementor/editor-v1-adapters';
8
14
  import { __ } from '@wordpress/i18n';
9
15
 
10
16
  import { useClassesProp } from '../contexts/classes-prop-context';
11
17
  import { useElement } from '../contexts/element-context';
12
18
  import { useStyle } from '../contexts/style-context';
13
19
  import { StyleNotFoundUnderProviderError, StylesProviderCannotUpdatePropsError } from '../errors';
14
- import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
15
20
  import { useStylesRerender } from './use-styles-rerender';
16
21
 
22
+ export const HISTORY_DEBOUNCE_WAIT = 800;
23
+
17
24
  export function useStylesFields< T extends Props >( propNames: ( keyof T & string )[] ) {
18
25
  const {
19
26
  element: { id: elementId },
20
27
  } = useElement();
21
28
  const { id: styleId, meta, provider, canEdit } = useStyle();
22
29
 
23
- const undoableUpdateStyle = useUndoableUpdateStyle( { elementId, meta } );
24
- const undoableCreateElementStyle = useUndoableCreateElementStyle( { elementId, meta } );
30
+ const undoableUpdateStyle = useUndoableActions( { elementId, meta } );
25
31
 
26
32
  useStylesRerender();
27
33
 
28
34
  const values = getProps< T >( { elementId, styleId, provider, meta, propNames } );
29
35
 
30
36
  const setValues = ( props: T, { history: { propDisplayName } }: { history: { propDisplayName: string } } ) => {
31
- if ( styleId === null ) {
32
- undoableCreateElementStyle( { props, propDisplayName } );
37
+ if ( ! styleId ) {
38
+ undoableUpdateStyle( { styleId: null, provider: null, props, propDisplayName } );
33
39
  } else {
34
- undoableUpdateStyle( { provider, styleId, props, propDisplayName } );
40
+ undoableUpdateStyle( { styleId, provider, props, propDisplayName } );
35
41
  }
36
42
  };
37
43
 
@@ -68,14 +74,36 @@ function getProps< T extends Props >( { styleId, elementId, provider, meta, prop
68
74
  ) as NullableValues< T >;
69
75
  }
70
76
 
71
- type UndoableCreateElementStyleArgs = {
77
+ type UpdateStyleArgs = {
78
+ styleId: StyleDefinition[ 'id' ];
79
+ provider: StylesProvider;
72
80
  props: Props;
73
81
  propDisplayName: string;
74
82
  };
75
83
 
76
- function useUndoableCreateElementStyle( {
84
+ type CreateStyleArgs = {
85
+ styleId: null;
86
+ provider: null;
87
+ props: Props;
88
+ propDisplayName: string;
89
+ };
90
+
91
+ type UpdateStyleReturn = {
92
+ styleId: StyleDefinition[ 'id' ];
93
+ provider: StylesProvider;
94
+ prevProps: Props;
95
+ };
96
+
97
+ type CreateStyleReturn = {
98
+ createdStyleId: StyleDefinition[ 'id' ];
99
+ };
100
+
101
+ type UndoableUpdateStylePayload = UpdateStyleArgs | CreateStyleArgs;
102
+ type UndoableUpdateStyleReturn = UpdateStyleReturn | CreateStyleReturn;
103
+
104
+ function useUndoableActions( {
77
105
  elementId,
78
- meta,
106
+ meta: { breakpoint, state },
79
107
  }: {
80
108
  elementId: ElementID;
81
109
  meta: StyleDefinitionVariant[ 'meta' ];
@@ -83,108 +111,72 @@ function useUndoableCreateElementStyle( {
83
111
  const classesProp = useClassesProp();
84
112
 
85
113
  return useMemo( () => {
86
- const isVersion331Active = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 );
114
+ const meta = { breakpoint, state };
87
115
 
88
116
  const createStyleArgs = { elementId, classesProp, meta, label: ELEMENTS_STYLES_RESERVED_LABEL };
89
117
 
90
118
  return undoable(
91
119
  {
92
- do: ( { props }: UndoableCreateElementStyleArgs ) => {
93
- return createElementStyle( { ...createStyleArgs, props } );
120
+ do: ( payload: UndoableUpdateStylePayload ): UndoableUpdateStyleReturn => {
121
+ if ( shouldCreateNewLocalStyle< StylesProvider >( payload ) ) {
122
+ return create( payload as CreateStyleArgs );
123
+ }
124
+ return update( payload as UpdateStyleArgs );
94
125
  },
126
+ undo: ( payload: UndoableUpdateStylePayload, doReturn: UndoableUpdateStyleReturn ) => {
127
+ const wasLocalStyleCreated = shouldCreateNewLocalStyle< StylesProvider >( payload );
95
128
 
96
- undo: ( _, styleId ) => {
97
- deleteElementStyle( elementId, styleId );
129
+ if ( wasLocalStyleCreated ) {
130
+ return undoCreate( payload as CreateStyleArgs, doReturn as CreateStyleReturn );
131
+ }
132
+ return undo( payload as UpdateStyleArgs, doReturn as UpdateStyleReturn );
98
133
  },
134
+ redo: ( payload: UndoableUpdateStylePayload, doReturn: UndoableUpdateStyleReturn ) => {
135
+ const wasLocalStyleCreated = shouldCreateNewLocalStyle< StylesProvider >( payload );
99
136
 
100
- redo: ( { props }, styleId ) => {
101
- return createElementStyle( { ...createStyleArgs, props, styleId } );
137
+ if ( wasLocalStyleCreated ) {
138
+ return create( payload as CreateStyleArgs, doReturn as CreateStyleReturn );
139
+ }
140
+ return update( payload as UpdateStyleArgs );
102
141
  },
103
142
  },
104
143
  {
105
- title: () => {
106
- if ( isVersion331Active ) {
107
- return localStyleHistoryTitlesV331.title( { elementId } );
108
- }
109
- return historyTitlesV330.title( { elementId } );
110
- },
111
- subtitle: ( { propDisplayName } ) => {
112
- if ( isVersion331Active ) {
113
- return localStyleHistoryTitlesV331.subtitle( { propDisplayName } );
114
- }
115
- return historyTitlesV330.subtitle;
116
- },
144
+ title: ( { provider, styleId } ) => getTitle( { provider, styleId, elementId } ),
145
+ subtitle: ( { provider, styleId, propDisplayName } ) =>
146
+ getSubtitle( { provider, styleId, elementId, propDisplayName } ),
147
+ debounce: { wait: HISTORY_DEBOUNCE_WAIT },
117
148
  }
118
149
  );
119
- }, [ classesProp, elementId, meta ] );
120
- }
121
150
 
122
- type UndoableUpdateStyleArgs = {
123
- styleId: StyleDefinition[ 'id' ];
124
- provider: StylesProvider;
125
- props: Props;
126
- propDisplayName: string;
127
- };
151
+ function create( { props }: CreateStyleArgs, redoArgs?: CreateStyleReturn ): CreateStyleReturn {
152
+ const createdStyle = createElementStyle( { ...createStyleArgs, props, styleId: redoArgs?.createdStyleId } );
128
153
 
129
- function useUndoableUpdateStyle( {
130
- elementId,
131
- meta,
132
- }: {
133
- elementId: ElementID;
134
-
135
- meta: StyleDefinitionVariant[ 'meta' ];
136
- } ) {
137
- return useMemo( () => {
138
- const isVersion331Active = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 );
154
+ return { createdStyleId: createdStyle };
155
+ }
139
156
 
140
- return undoable(
141
- {
142
- do: ( { provider, styleId, props }: UndoableUpdateStyleArgs ) => {
143
- if ( ! provider.actions.updateProps ) {
144
- throw new StylesProviderCannotUpdatePropsError( {
145
- context: { providerKey: provider.getKey() },
146
- } );
147
- }
157
+ function undoCreate( _: UndoableUpdateStylePayload, { createdStyleId }: CreateStyleReturn ) {
158
+ deleteElementStyle( elementId, createdStyleId );
159
+ }
148
160
 
149
- const style = provider.actions.get( styleId, { elementId } );
161
+ function update( { provider, styleId, props }: UpdateStyleArgs ): UpdateStyleReturn {
162
+ if ( ! provider.actions.updateProps ) {
163
+ throw new StylesProviderCannotUpdatePropsError( {
164
+ context: { providerKey: provider.getKey() },
165
+ } );
166
+ }
150
167
 
151
- const prevProps = getCurrentProps( style, meta );
168
+ const style = provider.actions.get( styleId, { elementId } );
169
+ const prevProps = getCurrentProps( style, meta );
152
170
 
153
- provider.actions.updateProps( { id: styleId, meta, props }, { elementId } );
171
+ provider.actions.updateProps( { id: styleId, meta, props }, { elementId } );
154
172
 
155
- return prevProps;
156
- },
173
+ return { styleId, provider, prevProps };
174
+ }
157
175
 
158
- undo: ( { provider, styleId }, prevProps ) => {
159
- provider.actions.updateProps?.( { id: styleId, meta, props: prevProps }, { elementId } );
160
- },
161
- },
162
- {
163
- title: ( { provider } ) => {
164
- if ( isVersion331Active ) {
165
- const isLocal = isElementsStylesProvider( provider.getKey() );
166
-
167
- if ( isLocal ) {
168
- return localStyleHistoryTitlesV331.title( { elementId } );
169
- }
170
- return defaultHistoryTitlesV331.title( { provider } );
171
- }
172
- return historyTitlesV330.title( { elementId } );
173
- },
174
- subtitle: ( { provider, styleId, propDisplayName } ) => {
175
- if ( isVersion331Active ) {
176
- const isLocal = isElementsStylesProvider( provider.getKey() );
177
-
178
- if ( isLocal ) {
179
- return localStyleHistoryTitlesV331.subtitle( { propDisplayName } );
180
- }
181
- return defaultHistoryTitlesV331.subtitle( { provider, styleId, elementId, propDisplayName } );
182
- }
183
- return historyTitlesV330.subtitle;
184
- },
185
- }
186
- );
187
- }, [ elementId, meta ] );
176
+ function undo( _: UndoableUpdateStylePayload, { styleId, provider, prevProps }: UpdateStyleReturn ) {
177
+ provider.actions.updateProps?.( { id: styleId, meta, props: prevProps }, { elementId } );
178
+ }
179
+ }, [ elementId, breakpoint, state, classesProp ] );
188
180
  }
189
181
 
190
182
  function getCurrentProps( style: StyleDefinition | null, meta: StyleDefinitionVariant[ 'meta' ] ) {
@@ -199,28 +191,23 @@ function getCurrentProps( style: StyleDefinition | null, meta: StyleDefinitionVa
199
191
  return structuredClone( props );
200
192
  }
201
193
 
202
- const historyTitlesV330 = {
203
- title: ( { elementId }: { elementId: ElementID } ) => getElementLabel( elementId ),
204
- subtitle: __( 'Style edited', 'elementor' ),
205
- };
206
-
207
- type DefaultHistoryTitleV331Args = {
194
+ type DefaultHistoryTitleArgs = {
208
195
  provider: StylesProvider;
209
196
  };
210
197
 
211
- type DefaultHistorySubtitleV331Args = {
198
+ type DefaultHistorySubtitleArgs = {
212
199
  provider: StylesProvider;
213
200
  styleId: StyleDefinition[ 'id' ];
214
201
  elementId: ElementID;
215
202
  propDisplayName: string;
216
203
  };
217
204
 
218
- const defaultHistoryTitlesV331 = {
219
- title: ( { provider }: DefaultHistoryTitleV331Args ) => {
205
+ const defaultHistoryTitles = {
206
+ title: ( { provider }: DefaultHistoryTitleArgs ) => {
220
207
  const providerLabel = provider.labels?.singular;
221
208
  return providerLabel ? capitalize( providerLabel ) : __( 'Style', 'elementor' );
222
209
  },
223
- subtitle: ( { provider, styleId, elementId, propDisplayName }: DefaultHistorySubtitleV331Args ) => {
210
+ subtitle: ( { provider, styleId, elementId, propDisplayName }: DefaultHistorySubtitleArgs ) => {
224
211
  const styleLabel = provider.actions.get( styleId, { elementId } )?.label;
225
212
 
226
213
  if ( ! styleLabel ) {
@@ -232,17 +219,17 @@ const defaultHistoryTitlesV331 = {
232
219
  },
233
220
  };
234
221
 
235
- type LocalStyleHistoryTitleV331Args = {
222
+ type LocalStyleHistoryTitleArgs = {
236
223
  elementId: ElementID;
237
224
  };
238
225
 
239
- type LocalStyleHistorySubtitleV331Args = {
226
+ type LocalStyleHistorySubtitleArgs = {
240
227
  propDisplayName: string;
241
228
  };
242
229
 
243
- const localStyleHistoryTitlesV331 = {
244
- title: ( { elementId }: LocalStyleHistoryTitleV331Args ) => getElementLabel( elementId ),
245
- subtitle: ( { propDisplayName }: LocalStyleHistorySubtitleV331Args ) =>
230
+ const localStyleHistoryTitles = {
231
+ title: ( { elementId }: LocalStyleHistoryTitleArgs ) => getElementLabel( elementId ),
232
+ subtitle: ( { propDisplayName }: LocalStyleHistorySubtitleArgs ) =>
246
233
  // translators: %s is the name of the style property being edited
247
234
  __( `%s edited`, 'elementor' ).replace( '%s', propDisplayName ),
248
235
  };
@@ -250,3 +237,39 @@ const localStyleHistoryTitlesV331 = {
250
237
  function capitalize( str: string ) {
251
238
  return str.charAt( 0 ).toUpperCase() + str.slice( 1 );
252
239
  }
240
+
241
+ const isLocalStyle = ( provider: StylesProvider | null, styleId: StyleDefinition[ 'id' ] | null ) =>
242
+ ! provider || ! styleId || isElementsStylesProvider( provider.getKey() );
243
+
244
+ type TitleOptions = {
245
+ provider: StylesProvider | null;
246
+ styleId: string | null;
247
+ elementId: string;
248
+ };
249
+
250
+ type SubtitleOptions = TitleOptions & { propDisplayName: string };
251
+
252
+ export const getTitle = ( { provider, styleId, elementId }: TitleOptions ) => {
253
+ const isLocal = isLocalStyle( provider, styleId );
254
+
255
+ if ( isLocal ) {
256
+ return localStyleHistoryTitles.title( { elementId } );
257
+ }
258
+
259
+ return defaultHistoryTitles.title( { provider: provider as StylesProvider } );
260
+ };
261
+
262
+ export const getSubtitle = ( { provider, styleId, propDisplayName, elementId }: SubtitleOptions ) => {
263
+ const isLocal = isLocalStyle( provider, styleId );
264
+
265
+ if ( isLocal ) {
266
+ return localStyleHistoryTitles.subtitle( { propDisplayName } );
267
+ }
268
+
269
+ return defaultHistoryTitles.subtitle( {
270
+ provider: provider as StylesProvider,
271
+ styleId: styleId as StyleDefinition[ 'id' ],
272
+ elementId,
273
+ propDisplayName,
274
+ } );
275
+ };
package/src/index.ts CHANGED
@@ -1,15 +1,14 @@
1
- export { EXPERIMENTAL_FEATURES } from './sync/experiments-flags';
2
-
3
1
  export { useBoundProp } from '@elementor/editor-controls';
4
- export type { PopoverActionProps } from './popover-action';
5
- export { registerControlReplacement } from './control-replacement';
6
- export { registerStyleProviderToColors } from './provider-colors-registry';
2
+ export { type ValidationEvent, type ValidationResult } from './components/creatable-autocomplete';
3
+ export { injectIntoCssClassConvert } from './components/css-classes/css-class-convert-local';
7
4
  export { injectIntoClassSelectorActions } from './components/css-classes/css-class-selector';
8
- export { usePanelActions, usePanelStatus } from './panel';
9
- export { type ValidationResult, type ValidationEvent } from './components/creatable-autocomplete';
10
- export { controlActionsMenu } from './controls-actions';
11
- export { useFontFamilies } from './components/style-sections/typography-section/hooks/use-font-families';
12
5
  export { PopoverBody } from './components/popover-body';
6
+ export { useFontFamilies } from './components/style-sections/typography-section/hooks/use-font-families';
13
7
  export { useSectionWidth } from './contexts/section-context';
14
-
8
+ export { registerControlReplacement } from './control-replacement';
9
+ export { controlActionsMenu } from './controls-actions';
15
10
  export { init } from './init';
11
+ export { usePanelActions, usePanelStatus } from './panel';
12
+ export type { PopoverActionProps } from './popover-action';
13
+ export { registerStyleProviderToColors } from './provider-colors-registry';
14
+ export { stylesInheritanceTransformersRegistry } from './styles-inheritance/styles-inheritance-transformers-registry';
package/src/init.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import { injectIntoLogic } from '@elementor/editor';
2
2
  import { __registerPanel as registerPanel } from '@elementor/editor-panels';
3
- import { blockCommand, isExperimentActive } from '@elementor/editor-v1-adapters';
3
+ import { blockCommand } from '@elementor/editor-v1-adapters';
4
4
 
5
5
  import { EditingPanelHooks } from './components/editing-panel-hooks';
6
6
  import { init as initDynamics } from './dynamics/init';
7
7
  import { panel } from './panel';
8
8
  import { initResetStyleProps } from './reset-style-props';
9
9
  import { init as initStylesInheritance } from './styles-inheritance/init';
10
- import { EXPERIMENTAL_FEATURES } from './sync/experiments-flags';
11
10
  import { isAtomicWidgetSelected } from './sync/is-atomic-widget-selected';
12
11
 
13
12
  export function init() {
@@ -25,9 +24,7 @@ export function init() {
25
24
  // TODO: Move it from here once we have styles-inheritance package.
26
25
  initStylesInheritance();
27
26
 
28
- if ( isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 ) ) {
29
- initResetStyleProps();
30
- }
27
+ initResetStyleProps();
31
28
  }
32
29
 
33
30
  const blockV1Panel = () => {
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import { type ComponentType, type ElementType as ReactElementType, useId } from 'react';
3
- import { bindPopover, bindToggle, IconButton, Popover, Tooltip, usePopupState } from '@elementor/ui';
2
+ import { type ComponentType, type ElementType as ReactElementType } from 'react';
3
+ import { useFloatingActionsBar } from '@elementor/editor-controls';
4
+ import { bindPopover, bindTrigger, IconButton, Popover, Tooltip, usePopupState } from '@elementor/ui';
4
5
 
5
6
  const SIZE = 'tiny';
6
7
 
@@ -11,17 +12,8 @@ export type PopoverActionProps = {
11
12
  content: ComponentType< { close: () => void } >;
12
13
  };
13
14
 
14
- export default function PopoverAction( {
15
- title,
16
- visible = true,
17
- icon: Icon,
18
- content: PopoverContent,
19
- }: PopoverActionProps ) {
20
- const id = useId();
21
- const popupState = usePopupState( {
22
- variant: 'popover',
23
- popupId: `elementor-popover-action-${ id }`,
24
- } );
15
+ export function PopoverAction( { title, visible = true, icon: Icon, content: PopoverContent }: PopoverActionProps ) {
16
+ const { popupState, triggerProps, popoverProps } = useFloatingActionsPopover();
25
17
 
26
18
  if ( ! visible ) {
27
19
  return null;
@@ -30,7 +22,7 @@ export default function PopoverAction( {
30
22
  return (
31
23
  <>
32
24
  <Tooltip placement="top" title={ title }>
33
- <IconButton aria-label={ title } key={ id } size={ SIZE } { ...bindToggle( popupState ) }>
25
+ <IconButton aria-label={ title } size={ SIZE } { ...triggerProps }>
34
26
  <Icon fontSize={ SIZE } />
35
27
  </IconButton>
36
28
  </Tooltip>
@@ -48,10 +40,39 @@ export default function PopoverAction( {
48
40
  PaperProps={ {
49
41
  sx: { my: 2.5 },
50
42
  } }
51
- { ...bindPopover( popupState ) }
43
+ { ...popoverProps }
52
44
  >
53
45
  <PopoverContent close={ popupState.close } />
54
46
  </Popover>
55
47
  </>
56
48
  );
57
49
  }
50
+
51
+ export function useFloatingActionsPopover() {
52
+ const { setOpen } = useFloatingActionsBar();
53
+ const popupState = usePopupState( { variant: 'popover' } );
54
+
55
+ const triggerProps = bindTrigger( popupState );
56
+ const popoverProps = bindPopover( popupState );
57
+
58
+ const onClick = ( e: React.MouseEvent ) => {
59
+ triggerProps.onClick( e );
60
+ setOpen( true );
61
+ };
62
+
63
+ const onClose = () => {
64
+ popoverProps.onClose();
65
+ setOpen( false );
66
+ };
67
+
68
+ const close = () => {
69
+ popupState.close();
70
+ setOpen( false );
71
+ };
72
+
73
+ return {
74
+ popupState: { ...popupState, close },
75
+ triggerProps: { ...triggerProps, onClick },
76
+ popoverProps: { ...popoverProps, onClose },
77
+ };
78
+ }
@@ -14,16 +14,12 @@ export function initResetStyleProps() {
14
14
  } );
15
15
  }
16
16
 
17
- // Temporary fix for the issue with ControlToggleButtonGroup.
18
- const EXCLUDED_BINDS = [ 'flex-grow', 'flex-shrink', 'flex-basis' ];
19
-
20
17
  export function useResetStyleValueProps() {
21
18
  const isStyle = useIsStyle();
22
- const { value, setValue, path, bind } = useBoundProp();
19
+ const { value, setValue, path } = useBoundProp();
23
20
 
24
21
  return {
25
- visible:
26
- isStyle && value !== null && value !== undefined && path.length <= 2 && ! EXCLUDED_BINDS.includes( bind ),
22
+ visible: isStyle && value !== null && value !== undefined && path.length <= 2,
27
23
  title: __( 'Clear', 'elementor' ),
28
24
  icon: BrushBigIcon,
29
25
  onClick: () => setValue( null ),
@@ -17,6 +17,7 @@ export const ValueComponent = ( { index, value }: Props ) => {
17
17
  overflow: 'hidden',
18
18
  textOverflow: 'ellipsis',
19
19
  whiteSpace: 'nowrap',
20
+ pl: 2.5,
20
21
  } }
21
22
  >
22
23
  { value }
@@ -3,34 +3,28 @@ import { type ComponentProps } from 'react';
3
3
  import { useBoundProp } from '@elementor/editor-controls';
4
4
  import { isEmpty, type PropType } from '@elementor/editor-props';
5
5
  import { ELEMENTS_BASE_STYLES_PROVIDER_KEY } from '@elementor/editor-styles-repository';
6
- import { isExperimentActive } from '@elementor/editor-v1-adapters';
7
- import { Tooltip } from '@elementor/ui';
8
6
  import { __ } from '@wordpress/i18n';
9
7
 
10
8
  import { StyleIndicator } from '../../components/style-indicator';
11
9
  import { useStyle } from '../../contexts/style-context';
12
10
  import { useStylesInheritanceChain } from '../../contexts/styles-inheritance-context';
13
- import { EXPERIMENTAL_FEATURES } from '../../sync/experiments-flags';
14
11
  import { getStylesProviderThemeColor } from '../../utils/get-styles-provider-color';
15
- import { isUsingIndicatorPopover } from '../consts';
16
12
  import { type SnapshotPropValue } from '../types';
17
13
  import { getValueFromInheritanceChain } from '../utils';
18
14
  import { StylesInheritanceInfotip } from './styles-inheritance-infotip';
19
15
 
16
+ const skipControls = [ 'box-shadow', 'background-overlay', 'filter', 'backdrop-filter', 'transform' ];
17
+
20
18
  export const StylesInheritanceIndicator = () => {
21
19
  const { path, propType } = useBoundProp();
22
20
 
23
- const isUsingNestedProps = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 );
24
-
25
- const finalPath = isUsingNestedProps ? path : path.slice( 0, 1 );
26
-
27
- const inheritanceChain = useStylesInheritanceChain( finalPath );
21
+ const inheritanceChain = useStylesInheritanceChain( path );
28
22
 
29
- if ( ! inheritanceChain.length ) {
23
+ if ( ! path || path.some( ( pathItem ) => skipControls.includes( pathItem ) ) || ! inheritanceChain.length ) {
30
24
  return null;
31
25
  }
32
26
 
33
- return <Indicator inheritanceChain={ inheritanceChain } path={ finalPath } propType={ propType } />;
27
+ return <Indicator inheritanceChain={ inheritanceChain } path={ path } propType={ propType } />;
34
28
  };
35
29
 
36
30
  type IndicatorProps = {
@@ -50,10 +44,7 @@ const Indicator = ( { inheritanceChain, path, propType }: IndicatorProps ) => {
50
44
 
51
45
  const [ actualStyle ] = inheritanceChain;
52
46
 
53
- if (
54
- ! isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 ) &&
55
- actualStyle.provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY
56
- ) {
47
+ if ( actualStyle.provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY ) {
57
48
  return null;
58
49
  }
59
50
 
@@ -69,14 +60,6 @@ const Indicator = ( { inheritanceChain, path, propType }: IndicatorProps ) => {
69
60
  isOverridden: hasValue && ! isFinalValue ? true : undefined,
70
61
  };
71
62
 
72
- if ( ! isUsingIndicatorPopover() ) {
73
- return (
74
- <Tooltip title={ __( 'Style origin', 'elementor' ) } placement="top">
75
- <StyleIndicator { ...styleIndicatorProps } aria-label={ label } />
76
- </Tooltip>
77
- );
78
- }
79
-
80
63
  return (
81
64
  <StylesInheritanceInfotip
82
65
  inheritanceChain={ inheritanceChain }
@@ -59,27 +59,36 @@ export const StylesInheritanceInfotip = ( { inheritanceChain, propType, path, la
59
59
  sx={ {
60
60
  width: `${ sectionWidth - SECTION_PADDING_INLINE }px`,
61
61
  maxWidth: 496,
62
+ maxHeight: 268,
62
63
  overflowX: 'hidden',
64
+ display: 'flex',
65
+ flexDirection: 'column',
63
66
  } }
64
67
  >
68
+ <Box
69
+ sx={ {
70
+ position: 'sticky',
71
+ top: 0,
72
+ zIndex: 1,
73
+ backgroundColor: 'background.paper',
74
+ } }
75
+ >
76
+ <PopoverHeader title={ __( 'Style origin', 'elementor' ) } onClose={ closeInfotip } />
77
+ </Box>
78
+
65
79
  <CardContent
66
80
  sx={ {
67
81
  display: 'flex',
68
- gap: 0.5,
69
82
  flexDirection: 'column',
70
83
  p: 0,
84
+ flex: 1,
85
+ overflow: 'auto',
71
86
  '&:last-child': {
72
87
  pb: 0,
73
88
  },
74
89
  } }
75
90
  >
76
- <PopoverHeader title={ __( 'Style origin', 'elementor' ) } onClose={ closeInfotip } />
77
-
78
- <Stack
79
- gap={ 1.5 }
80
- sx={ { pl: 2, pr: 1, pb: 2, overflowX: 'hidden', overflowY: 'auto' } }
81
- role="list"
82
- >
91
+ <Stack gap={ 1.5 } sx={ { pl: 3, pr: 1, pb: 2 } } role="list">
83
92
  { items.map( ( item, index ) => {
84
93
  return (
85
94
  <Box
@@ -1,5 +1,3 @@
1
- import { isExperimentActive } from '@elementor/editor-v1-adapters';
2
-
3
1
  // the following prop types' style transformers would be ignored to provide alternative transformers for the styles inheritance popover
4
2
  export const excludePropTypeTransformers = new Set( [
5
3
  'background-color-overlay',
@@ -13,5 +11,3 @@ export const excludePropTypeTransformers = new Set( [
13
11
  'image',
14
12
  'background-overlay',
15
13
  ] );
16
-
17
- export const isUsingIndicatorPopover = () => isExperimentActive( 'e_v_3_30' );
@@ -1,8 +1,5 @@
1
- import { isUsingIndicatorPopover } from './consts';
2
1
  import { initStylesInheritanceTransformers } from './init-styles-inheritance-transformers';
3
2
 
4
3
  export const init = () => {
5
- if ( isUsingIndicatorPopover() ) {
6
- initStylesInheritanceTransformers();
7
- }
4
+ initStylesInheritanceTransformers();
8
5
  };
@@ -7,7 +7,7 @@ export type Color = {
7
7
  };
8
8
 
9
9
  export const backgroundColorOverlayTransformer = createTransformer( ( value: Color ) => (
10
- <Stack direction="row" gap={ 10 }>
10
+ <Stack direction="row" gap={ 1 } alignItems="center">
11
11
  <ItemIconColor value={ value } />
12
12
  <ItemLabelColor value={ value } />
13
13
  </Stack>
@@ -23,5 +23,9 @@ const ItemLabelColor = ( { value: { color } }: { value: Color } ) => {
23
23
  };
24
24
 
25
25
  export const StyledUnstableColorIndicator = styled( UnstableColorIndicator )( ( { theme } ) => ( {
26
+ width: '1em',
27
+ height: '1em',
26
28
  borderRadius: `${ theme.shape.borderRadius / 2 }px`,
29
+ outline: `1px solid ${ theme.palette.action.disabled }`,
30
+ flexShrink: 0,
27
31
  } ) );