@elementor/editor-editing-panel 1.43.1 → 1.45.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.
- package/CHANGELOG.md +41 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1247 -977
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1025 -755
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/action.tsx +1 -1
- package/src/components/add-or-remove-content.tsx +3 -4
- package/src/components/collapsible-content.tsx +42 -14
- package/src/components/control-label.tsx +1 -1
- package/src/components/section.tsx +21 -7
- package/src/components/style-sections/border-section/border-field.tsx +2 -1
- package/src/components/style-sections/border-section/border-radius-field.tsx +12 -9
- package/src/components/style-sections/layout-section/align-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/align-items-field.tsx +13 -17
- package/src/components/style-sections/layout-section/align-self-child-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +13 -17
- package/src/components/style-sections/layout-section/flex-order-field.tsx +30 -33
- package/src/components/style-sections/layout-section/flex-size-field.tsx +60 -59
- package/src/components/style-sections/layout-section/justify-content-field.tsx +10 -14
- package/src/components/style-sections/layout-section/wrap-field.tsx +13 -17
- package/src/components/style-sections/position-section/dimensions-field.tsx +33 -15
- package/src/components/style-sections/position-section/offset-field.tsx +5 -2
- package/src/components/style-sections/size-section/size-section.tsx +54 -39
- package/src/components/style-sections/spacing-section/spacing-section.tsx +1 -1
- package/src/components/style-sections/typography-section/column-gap-field.tsx +5 -2
- package/src/components/style-sections/typography-section/font-size-field.tsx +5 -2
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +5 -2
- package/src/components/style-sections/typography-section/line-height-field.tsx +5 -2
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +12 -9
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +2 -1
- package/src/components/style-sections/typography-section/typography-section.tsx +15 -3
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +5 -2
- package/src/components/style-tab-collapsible-content.tsx +22 -0
- package/src/components/style-tab-section.tsx +30 -0
- package/src/components/style-tab.tsx +51 -35
- package/src/controls-registry/styles-field.tsx +1 -1
- package/src/dynamics/components/background-control-dynamic-tag.tsx +48 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +11 -15
- package/src/dynamics/init.ts +21 -0
- package/src/index.ts +1 -0
- package/src/popover-action.tsx +3 -9
- package/src/styles-inheritance/components/{label-chip.tsx → infotip/label-chip.tsx} +1 -1
- package/src/styles-inheritance/{styles-inheritance-indicator.tsx → components/styles-inheritance-indicator.tsx} +8 -8
- package/src/styles-inheritance/{styles-inheritance-infotip.tsx → components/styles-inheritance-infotip.tsx} +7 -7
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +113 -0
- package/src/styles-inheritance/components/ui-providers.tsx +18 -0
- /package/src/styles-inheritance/components/{action-icons.tsx → infotip/action-icons.tsx} +0 -0
- /package/src/styles-inheritance/components/{breakpoint-icon.tsx → infotip/breakpoint-icon.tsx} +0 -0
- /package/src/styles-inheritance/components/{index.ts → infotip/index.ts} +0 -0
- /package/src/styles-inheritance/components/{value-component.tsx → infotip/value-component.tsx} +0 -0
|
@@ -6,6 +6,7 @@ import { useStyle } from '../../../contexts/style-context';
|
|
|
6
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
7
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
8
|
import { AddOrRemoveContent } from '../../add-or-remove-content';
|
|
9
|
+
import { ControlLabel } from '../../control-label';
|
|
9
10
|
|
|
10
11
|
const initTextStroke = {
|
|
11
12
|
$$type: 'stroke',
|
|
@@ -41,11 +42,11 @@ export const TextStrokeField = () => {
|
|
|
41
42
|
return (
|
|
42
43
|
<StylesField bind={ 'stroke' }>
|
|
43
44
|
<AddOrRemoveContent
|
|
44
|
-
label={ __( 'Text stroke', 'elementor' ) }
|
|
45
45
|
isAdded={ hasTextStroke }
|
|
46
46
|
onAdd={ addTextStroke }
|
|
47
47
|
onRemove={ removeTextStroke }
|
|
48
48
|
disabled={ ! canEdit }
|
|
49
|
+
renderLabel={ () => <ControlLabel>{ __( 'Text stroke', 'elementor' ) }</ControlLabel> }
|
|
49
50
|
>
|
|
50
51
|
<StrokeControl />
|
|
51
52
|
</AddOrRemoveContent>
|
|
@@ -3,9 +3,9 @@ import type { NumberPropValue } from '@elementor/editor-props';
|
|
|
3
3
|
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
4
|
|
|
5
5
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
6
|
-
import { CollapsibleContent } from '../../collapsible-content';
|
|
7
6
|
import { PanelDivider } from '../../panel-divider';
|
|
8
7
|
import { SectionContent } from '../../section-content';
|
|
8
|
+
import { StyleTabCollapsibleContent } from '../../style-tab-collapsible-content';
|
|
9
9
|
import { ColumnCountField } from './column-count-field';
|
|
10
10
|
import { ColumnGapField } from './column-gap-field';
|
|
11
11
|
import { FontFamilyField } from './font-family-field';
|
|
@@ -34,7 +34,19 @@ export const TypographySection = () => {
|
|
|
34
34
|
<PanelDivider />
|
|
35
35
|
<TextAlignmentField />
|
|
36
36
|
<TextColorField />
|
|
37
|
-
<
|
|
37
|
+
<StyleTabCollapsibleContent
|
|
38
|
+
fields={ [
|
|
39
|
+
'line-height',
|
|
40
|
+
'letter-spacing',
|
|
41
|
+
'word-spacing',
|
|
42
|
+
'column-count',
|
|
43
|
+
'text-decoration',
|
|
44
|
+
'text-transform',
|
|
45
|
+
'direction',
|
|
46
|
+
'font-style',
|
|
47
|
+
'stroke',
|
|
48
|
+
] }
|
|
49
|
+
>
|
|
38
50
|
<SectionContent sx={ { pt: 2 } }>
|
|
39
51
|
<LineHeightField />
|
|
40
52
|
<LetterSpacingField />
|
|
@@ -52,7 +64,7 @@ export const TypographySection = () => {
|
|
|
52
64
|
<FontStyleField />
|
|
53
65
|
<TextStrokeField />
|
|
54
66
|
</SectionContent>
|
|
55
|
-
</
|
|
67
|
+
</StyleTabCollapsibleContent>
|
|
56
68
|
</SectionContent>
|
|
57
69
|
);
|
|
58
70
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type MutableRefObject, useRef } from 'react';
|
|
2
3
|
import { SizeControl } from '@elementor/editor-controls';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
@@ -7,14 +8,16 @@ import { StylesField } from '../../../controls-registry/styles-field';
|
|
|
7
8
|
import { ControlLabel } from '../../control-label';
|
|
8
9
|
|
|
9
10
|
export const WordSpacingField = () => {
|
|
11
|
+
const rowRef: MutableRefObject< HTMLElement | undefined > = useRef();
|
|
12
|
+
|
|
10
13
|
return (
|
|
11
14
|
<StylesField bind="word-spacing">
|
|
12
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
15
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap" ref={ rowRef }>
|
|
13
16
|
<Grid item xs={ 6 }>
|
|
14
17
|
<ControlLabel>{ __( 'Word spacing', 'elementor' ) }</ControlLabel>
|
|
15
18
|
</Grid>
|
|
16
19
|
<Grid item xs={ 6 }>
|
|
17
|
-
<SizeControl />
|
|
20
|
+
<SizeControl anchorRef={ rowRef } />
|
|
18
21
|
</Grid>
|
|
19
22
|
</Grid>
|
|
20
23
|
</StylesField>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PropsWithChildren } from 'react';
|
|
3
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
4
|
+
|
|
5
|
+
import { StylesInheritanceSectionIndicators } from '../styles-inheritance/components/styles-inheritance-section-indicators';
|
|
6
|
+
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
7
|
+
import { CollapsibleContent } from './collapsible-content';
|
|
8
|
+
type Props = PropsWithChildren< { fields?: string[] } >;
|
|
9
|
+
|
|
10
|
+
export const StyleTabCollapsibleContent = ( { fields = [], children }: Props ) => {
|
|
11
|
+
return <CollapsibleContent titleEnd={ getStylesInheritanceIndicators( fields ) }>{ children }</CollapsibleContent>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function getStylesInheritanceIndicators( fields: string[] ) {
|
|
15
|
+
const isUsingFieldsIndicators = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 );
|
|
16
|
+
|
|
17
|
+
if ( fields.length === 0 || ! isUsingFieldsIndicators ) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return ( isOpen: boolean ) => ( ! isOpen ? <StylesInheritanceSectionIndicators fields={ fields } /> : null );
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
3
|
+
|
|
4
|
+
import { useDefaultPanelSettings } from '../hooks/use-default-panel-settings';
|
|
5
|
+
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
6
|
+
import { Section } from './section';
|
|
7
|
+
import { getStylesInheritanceIndicators } from './style-tab-collapsible-content';
|
|
8
|
+
|
|
9
|
+
type Section = {
|
|
10
|
+
component: () => React.JSX.Element;
|
|
11
|
+
name: string;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type Props = { section: Section; fields?: string[] };
|
|
16
|
+
|
|
17
|
+
export const StyleTabSection = ( { section, fields = [] }: Props ) => {
|
|
18
|
+
const { component, name, title } = section;
|
|
19
|
+
const tabDefaults = useDefaultPanelSettings();
|
|
20
|
+
const SectionComponent = component;
|
|
21
|
+
const isExpanded = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 )
|
|
22
|
+
? tabDefaults.defaultSectionsExpanded.style?.includes( name )
|
|
23
|
+
: false;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Section title={ title } defaultExpanded={ isExpanded } titleEnd={ getStylesInheritanceIndicators( fields ) }>
|
|
27
|
+
<SectionComponent />
|
|
28
|
+
</Section>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -3,7 +3,6 @@ import { useState } from 'react';
|
|
|
3
3
|
import { CLASSES_PROP_KEY } from '@elementor/editor-props';
|
|
4
4
|
import { useActiveBreakpoint } from '@elementor/editor-responsive';
|
|
5
5
|
import { type StyleDefinitionID, type StyleDefinitionState } from '@elementor/editor-styles';
|
|
6
|
-
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
7
6
|
import { SessionStorageProvider } from '@elementor/session';
|
|
8
7
|
import { Divider, Stack } from '@elementor/ui';
|
|
9
8
|
import { __ } from '@wordpress/i18n';
|
|
@@ -14,10 +13,7 @@ import { useScrollDirection } from '../contexts/scroll-context';
|
|
|
14
13
|
import { StyleProvider } from '../contexts/style-context';
|
|
15
14
|
import { StyleInheritanceProvider } from '../contexts/styles-inheritance-context';
|
|
16
15
|
import { useActiveStyleDefId } from '../hooks/use-active-style-def-id';
|
|
17
|
-
import { useDefaultPanelSettings } from '../hooks/use-default-panel-settings';
|
|
18
|
-
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
19
16
|
import { CssClassSelector } from './css-classes/css-class-selector';
|
|
20
|
-
import { Section } from './section';
|
|
21
17
|
import { SectionsList } from './sections-list';
|
|
22
18
|
import { BackgroundSection } from './style-sections/background-section/background-section';
|
|
23
19
|
import { BorderSection } from './style-sections/border-section/border-section';
|
|
@@ -27,6 +23,7 @@ import { PositionSection } from './style-sections/position-section/position-sect
|
|
|
27
23
|
import { SizeSection } from './style-sections/size-section/size-section';
|
|
28
24
|
import { SpacingSection } from './style-sections/spacing-section/spacing-section';
|
|
29
25
|
import { TypographySection } from './style-sections/typography-section/typography-section';
|
|
26
|
+
import { StyleTabSection } from './style-tab-section';
|
|
30
27
|
|
|
31
28
|
const TABS_HEADER_HEIGHT = '37px';
|
|
32
29
|
|
|
@@ -38,27 +35,6 @@ export const stickyHeaderStyles = {
|
|
|
38
35
|
transition: 'top 300ms ease',
|
|
39
36
|
};
|
|
40
37
|
|
|
41
|
-
type Section = {
|
|
42
|
-
component: () => React.JSX.Element;
|
|
43
|
-
name: string;
|
|
44
|
-
title: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const PanelSection = ( { section }: { section: Section } ) => {
|
|
48
|
-
const { component, name, title } = section;
|
|
49
|
-
const tabDefaults = useDefaultPanelSettings();
|
|
50
|
-
const SectionComponent = component;
|
|
51
|
-
const isExpanded = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 )
|
|
52
|
-
? tabDefaults.defaultSectionsExpanded.style?.includes( name )
|
|
53
|
-
: false;
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<Section title={ title } defaultExpanded={ isExpanded }>
|
|
57
|
-
<SectionComponent />
|
|
58
|
-
</Section>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
38
|
export const StyleTab = () => {
|
|
63
39
|
const currentClassesProp = useCurrentClassesProp();
|
|
64
40
|
const [ activeStyleDefId, setActiveStyleDefId ] = useActiveStyleDefId( currentClassesProp );
|
|
@@ -83,61 +59,103 @@ export const StyleTab = () => {
|
|
|
83
59
|
<Divider />
|
|
84
60
|
</ClassesHeader>
|
|
85
61
|
<SectionsList>
|
|
86
|
-
<
|
|
62
|
+
<StyleTabSection
|
|
87
63
|
section={ {
|
|
88
64
|
component: LayoutSection,
|
|
89
65
|
name: 'Layout',
|
|
90
66
|
title: __( 'Layout', 'elementor' ),
|
|
91
67
|
} }
|
|
68
|
+
fields={ [
|
|
69
|
+
'display',
|
|
70
|
+
'flex-direction',
|
|
71
|
+
'flex-wrap',
|
|
72
|
+
'justify-content',
|
|
73
|
+
'align-items',
|
|
74
|
+
'align-content',
|
|
75
|
+
'align-self',
|
|
76
|
+
'gap',
|
|
77
|
+
] }
|
|
92
78
|
/>
|
|
93
|
-
<
|
|
79
|
+
<StyleTabSection
|
|
94
80
|
section={ {
|
|
95
81
|
component: SpacingSection,
|
|
96
82
|
name: 'Spacing',
|
|
97
83
|
title: __( 'Spacing', 'elementor' ),
|
|
98
84
|
} }
|
|
85
|
+
fields={ [ 'margin', 'padding' ] }
|
|
99
86
|
/>
|
|
100
|
-
<
|
|
87
|
+
<StyleTabSection
|
|
101
88
|
section={ {
|
|
102
89
|
component: SizeSection,
|
|
103
90
|
name: 'Size',
|
|
104
91
|
title: __( 'Size', 'elementor' ),
|
|
105
92
|
} }
|
|
93
|
+
fields={ [
|
|
94
|
+
'width',
|
|
95
|
+
'min-width',
|
|
96
|
+
'max-width',
|
|
97
|
+
'height',
|
|
98
|
+
'min-height',
|
|
99
|
+
'max-height',
|
|
100
|
+
'overflow',
|
|
101
|
+
'aspect-ratio',
|
|
102
|
+
'object-fit',
|
|
103
|
+
] }
|
|
106
104
|
/>
|
|
107
|
-
<
|
|
105
|
+
<StyleTabSection
|
|
108
106
|
section={ {
|
|
109
107
|
component: PositionSection,
|
|
110
108
|
name: 'Position',
|
|
111
109
|
title: __( 'Position', 'elementor' ),
|
|
112
110
|
} }
|
|
111
|
+
fields={ [ 'position', 'z-index', 'scroll-margin-top' ] }
|
|
113
112
|
/>
|
|
114
|
-
<
|
|
113
|
+
<StyleTabSection
|
|
115
114
|
section={ {
|
|
116
115
|
component: TypographySection,
|
|
117
116
|
name: 'Typography',
|
|
118
117
|
title: __( 'Typography', 'elementor' ),
|
|
119
118
|
} }
|
|
119
|
+
fields={ [
|
|
120
|
+
'font-family',
|
|
121
|
+
'font-weight',
|
|
122
|
+
'font-size',
|
|
123
|
+
'text-align',
|
|
124
|
+
'color',
|
|
125
|
+
'line-height',
|
|
126
|
+
'letter-spacing',
|
|
127
|
+
'word-spacing',
|
|
128
|
+
'column-count',
|
|
129
|
+
'text-decoration',
|
|
130
|
+
'text-transform',
|
|
131
|
+
'direction',
|
|
132
|
+
'font-style',
|
|
133
|
+
'stroke',
|
|
134
|
+
] }
|
|
120
135
|
/>
|
|
121
|
-
<
|
|
136
|
+
<StyleTabSection
|
|
122
137
|
section={ {
|
|
123
138
|
component: BackgroundSection,
|
|
124
139
|
name: 'Background',
|
|
125
140
|
title: __( 'Background', 'elementor' ),
|
|
126
141
|
} }
|
|
142
|
+
fields={ [ 'background' ] }
|
|
127
143
|
/>
|
|
128
|
-
<
|
|
144
|
+
<StyleTabSection
|
|
129
145
|
section={ {
|
|
130
146
|
component: BorderSection,
|
|
131
147
|
name: 'Border',
|
|
132
148
|
title: __( 'Border', 'elementor' ),
|
|
133
149
|
} }
|
|
150
|
+
fields={ [ 'border-radius', 'border-width', 'border-color', 'border-style' ] }
|
|
134
151
|
/>
|
|
135
|
-
<
|
|
152
|
+
<StyleTabSection
|
|
136
153
|
section={ {
|
|
137
154
|
component: EffectsSection,
|
|
138
155
|
name: 'Effects',
|
|
139
156
|
title: __( 'Effects', 'elementor' ),
|
|
140
157
|
} }
|
|
158
|
+
fields={ [ 'box-shadow' ] }
|
|
141
159
|
/>
|
|
142
160
|
</SectionsList>
|
|
143
161
|
</StyleInheritanceProvider>
|
|
@@ -170,5 +188,3 @@ function useCurrentClassesProp(): string {
|
|
|
170
188
|
|
|
171
189
|
return prop[ 0 ];
|
|
172
190
|
}
|
|
173
|
-
|
|
174
|
-
export { PanelSection as StyleTabSection };
|
|
@@ -5,7 +5,7 @@ import { getStylesSchema } from '@elementor/editor-styles';
|
|
|
5
5
|
|
|
6
6
|
import { useStyle } from '../contexts/style-context';
|
|
7
7
|
import { useStylesField } from '../hooks/use-styles-field';
|
|
8
|
-
import { StylesInheritanceIndicator } from '../styles-inheritance/styles-inheritance-indicator';
|
|
8
|
+
import { StylesInheritanceIndicator } from '../styles-inheritance/components/styles-inheritance-indicator';
|
|
9
9
|
import { createTopLevelOjectType } from './create-top-level-object-type';
|
|
10
10
|
|
|
11
11
|
export type StylesFieldProps = {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropKeyProvider, PropProvider, useBoundProp } from '@elementor/editor-controls';
|
|
3
|
+
import {
|
|
4
|
+
backgroundImageOverlayPropTypeUtil,
|
|
5
|
+
type BackgroundOverlayImagePropType,
|
|
6
|
+
type BackgroundOverlayPropType,
|
|
7
|
+
type ObjectPropType,
|
|
8
|
+
type UnionPropType,
|
|
9
|
+
} from '@elementor/editor-props';
|
|
10
|
+
import { DatabaseIcon } from '@elementor/icons';
|
|
11
|
+
|
|
12
|
+
import { useDynamicTag } from '../hooks/use-dynamic-tag';
|
|
13
|
+
|
|
14
|
+
// Since this is injected, the initial prop provider does not dig into the nested structure of the value.
|
|
15
|
+
// We need to synthetically create a type that matches the expected structure of the value.
|
|
16
|
+
|
|
17
|
+
export const BackgroundControlDynamicTagIcon = () => <DatabaseIcon fontSize="tiny" />;
|
|
18
|
+
|
|
19
|
+
export const BackgroundControlDynamicTagLabel = ( { value }: { value: BackgroundOverlayPropType } ) => {
|
|
20
|
+
const context = useBoundProp( backgroundImageOverlayPropTypeUtil );
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<PropProvider { ...context } value={ value.value }>
|
|
24
|
+
<PropKeyProvider bind="image">
|
|
25
|
+
<Wrapper rawValue={ value.value } />
|
|
26
|
+
</PropKeyProvider>
|
|
27
|
+
</PropProvider>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const Wrapper = ( { rawValue }: { rawValue: BackgroundOverlayPropType[ 'value' ] } ) => {
|
|
32
|
+
const { propType } = useBoundProp< BackgroundOverlayPropType, UnionPropType >();
|
|
33
|
+
|
|
34
|
+
const imageOverlayPropType = propType.prop_types[ 'background-image-overlay' ] as ObjectPropType;
|
|
35
|
+
return (
|
|
36
|
+
<PropProvider propType={ imageOverlayPropType.shape.image } value={ rawValue } setValue={ () => void 0 }>
|
|
37
|
+
<PropKeyProvider bind="src">
|
|
38
|
+
<Content rawValue={ rawValue.image } />
|
|
39
|
+
</PropKeyProvider>
|
|
40
|
+
</PropProvider>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const Content = ( { rawValue }: { rawValue: BackgroundOverlayImagePropType } ) => {
|
|
45
|
+
const src = rawValue.value.src;
|
|
46
|
+
const dynamicTag = useDynamicTag( src.value.name || '' );
|
|
47
|
+
return <React.Fragment>{ dynamicTag?.label }</React.Fragment>;
|
|
48
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ControlFormLabel, useBoundProp } from '@elementor/editor-controls';
|
|
3
3
|
import type { Control, ControlsSection } from '@elementor/editor-elements';
|
|
4
|
+
import { PopoverHeader } from '@elementor/editor-ui';
|
|
4
5
|
import { DatabaseIcon, SettingsIcon, XIcon } from '@elementor/icons';
|
|
5
6
|
import {
|
|
6
7
|
bindPopover,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
Tab,
|
|
16
17
|
TabPanel,
|
|
17
18
|
Tabs,
|
|
18
|
-
Typography,
|
|
19
19
|
UnstableTag as Tag,
|
|
20
20
|
usePopupState,
|
|
21
21
|
useTabs,
|
|
@@ -81,13 +81,11 @@ export const DynamicSelectionControl = () => {
|
|
|
81
81
|
{ ...bindPopover( selectionPopoverState ) }
|
|
82
82
|
>
|
|
83
83
|
<Stack>
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</IconButton>
|
|
90
|
-
</Stack>
|
|
84
|
+
<PopoverHeader
|
|
85
|
+
title={ __( 'Dynamic tags', 'elementor' ) }
|
|
86
|
+
onClose={ selectionPopoverState.close }
|
|
87
|
+
icon={ <DatabaseIcon fontSize={ SIZE } /> }
|
|
88
|
+
/>
|
|
91
89
|
<DynamicSelection onSelect={ selectionPopoverState.close } />
|
|
92
90
|
</Stack>
|
|
93
91
|
</Popover>
|
|
@@ -116,13 +114,11 @@ export const DynamicSettingsPopover = ( { dynamicTag }: { dynamicTag: DynamicTag
|
|
|
116
114
|
{ ...bindPopover( popupState ) }
|
|
117
115
|
>
|
|
118
116
|
<Paper component={ Stack } sx={ { minHeight: '300px', width: '220px' } }>
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</IconButton>
|
|
125
|
-
</Stack>
|
|
117
|
+
<PopoverHeader
|
|
118
|
+
title={ dynamicTag.label }
|
|
119
|
+
onClose={ popupState.close }
|
|
120
|
+
icon={ <DatabaseIcon fontSize={ SIZE } /> }
|
|
121
|
+
/>
|
|
126
122
|
<DynamicSettings controls={ dynamicTag.atomic_controls } />
|
|
127
123
|
</Paper>
|
|
128
124
|
</Popover>
|
package/src/dynamics/init.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { settingsTransformersRegistry, styleTransformersRegistry } from '@elementor/editor-canvas';
|
|
2
|
+
import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from '@elementor/editor-controls';
|
|
3
|
+
import { type BackgroundOverlayPropType, type PropValue } from '@elementor/editor-props';
|
|
4
|
+
import { type InjectedComponent } from '@elementor/locations';
|
|
2
5
|
|
|
3
6
|
import { registerControlReplacement } from '../control-replacement';
|
|
4
7
|
import { controlActionsMenu } from '../controls-actions';
|
|
8
|
+
import {
|
|
9
|
+
BackgroundControlDynamicTagIcon,
|
|
10
|
+
BackgroundControlDynamicTagLabel,
|
|
11
|
+
} from './components/background-control-dynamic-tag';
|
|
5
12
|
import { DynamicSelectionControl } from './components/dynamic-selection-control';
|
|
6
13
|
import { dynamicTransformer } from './dynamic-transformer';
|
|
7
14
|
import { usePropDynamicAction } from './hooks/use-prop-dynamic-action';
|
|
@@ -15,6 +22,20 @@ export const init = () => {
|
|
|
15
22
|
condition: ( { value } ) => isDynamicPropValue( value ),
|
|
16
23
|
} );
|
|
17
24
|
|
|
25
|
+
injectIntoRepeaterItemLabel( {
|
|
26
|
+
id: 'dynamic-background-image',
|
|
27
|
+
condition: ( { value } ) =>
|
|
28
|
+
isDynamicPropValue( ( value as BackgroundOverlayPropType ).value?.image?.value?.src ),
|
|
29
|
+
component: BackgroundControlDynamicTagLabel as InjectedComponent< { value: PropValue } >,
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
injectIntoRepeaterItemIcon( {
|
|
33
|
+
id: 'dynamic-background-image',
|
|
34
|
+
condition: ( { value } ) =>
|
|
35
|
+
isDynamicPropValue( ( value as BackgroundOverlayPropType ).value?.image?.value?.src ),
|
|
36
|
+
component: BackgroundControlDynamicTagIcon,
|
|
37
|
+
} );
|
|
38
|
+
|
|
18
39
|
registerPopoverAction( {
|
|
19
40
|
id: 'dynamic-tags',
|
|
20
41
|
useProps: usePropDynamicAction,
|
package/src/index.ts
CHANGED
|
@@ -5,5 +5,6 @@ export { injectIntoClassSelectorActions } from './components/css-classes/css-cla
|
|
|
5
5
|
export { usePanelActions, usePanelStatus } from './panel';
|
|
6
6
|
export { type ValidationResult, type ValidationEvent } from './components/creatable-autocomplete';
|
|
7
7
|
export { controlActionsMenu } from './controls-actions';
|
|
8
|
+
export { useFontFamilies } from './components/style-sections/typography-section/hooks/use-font-families';
|
|
8
9
|
|
|
9
10
|
export { init } from './init';
|
package/src/popover-action.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ComponentType, type ElementType as ReactElementType, useId } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { bindPopover, bindToggle, IconButton, Popover,
|
|
3
|
+
import { PopoverHeader } from '@elementor/editor-ui';
|
|
4
|
+
import { bindPopover, bindToggle, IconButton, Popover, Tooltip, usePopupState } from '@elementor/ui';
|
|
5
5
|
|
|
6
6
|
const SIZE = 'tiny';
|
|
7
7
|
|
|
@@ -44,13 +44,7 @@ export default function PopoverAction( {
|
|
|
44
44
|
} }
|
|
45
45
|
{ ...bindPopover( popupState ) }
|
|
46
46
|
>
|
|
47
|
-
<
|
|
48
|
-
<Icon fontSize={ SIZE } sx={ { mr: 0.5 } } />
|
|
49
|
-
<Typography variant="subtitle2">{ title }</Typography>
|
|
50
|
-
<IconButton sx={ { ml: 'auto' } } size={ SIZE } onClick={ popupState.close }>
|
|
51
|
-
<XIcon fontSize={ SIZE } />
|
|
52
|
-
</IconButton>
|
|
53
|
-
</Stack>
|
|
47
|
+
<PopoverHeader title={ title } onClose={ popupState.close } icon={ <Icon fontSize={ SIZE } /> } />
|
|
54
48
|
<PopoverContent closePopover={ popupState.close } />
|
|
55
49
|
</Popover>
|
|
56
50
|
</>
|
|
@@ -4,7 +4,7 @@ import { InfoCircleIcon } from '@elementor/icons';
|
|
|
4
4
|
import { Chip, type Theme, Tooltip } from '@elementor/ui';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
|
-
import { type ChipColors } from '
|
|
7
|
+
import { type ChipColors } from '../../types';
|
|
8
8
|
|
|
9
9
|
type Props = {
|
|
10
10
|
displayLabel: string;
|
|
@@ -6,12 +6,12 @@ import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
|
6
6
|
import { Tooltip } from '@elementor/ui';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
|
-
import { StyleIndicator } from '
|
|
10
|
-
import { useStyle } from '
|
|
11
|
-
import { useStylesInheritanceChain } from '
|
|
12
|
-
import { EXPERIMENTAL_FEATURES } from '
|
|
13
|
-
import { isUsingIndicatorPopover } from '
|
|
14
|
-
import {
|
|
9
|
+
import { StyleIndicator } from '../../components/style-indicator';
|
|
10
|
+
import { useStyle } from '../../contexts/style-context';
|
|
11
|
+
import { useStylesInheritanceChain } from '../../contexts/styles-inheritance-context';
|
|
12
|
+
import { EXPERIMENTAL_FEATURES } from '../../sync/experiments-flags';
|
|
13
|
+
import { isUsingIndicatorPopover } from '../consts';
|
|
14
|
+
import { StylesInheritanceInfotip } from './styles-inheritance-infotip';
|
|
15
15
|
|
|
16
16
|
export const StylesInheritanceIndicator = () => {
|
|
17
17
|
const { path, propType } = useBoundProp();
|
|
@@ -61,14 +61,14 @@ export const StylesInheritanceIndicator = () => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<
|
|
64
|
+
<StylesInheritanceInfotip
|
|
65
65
|
inheritanceChain={ inheritanceChain }
|
|
66
66
|
path={ finalPath }
|
|
67
67
|
propType={ propType }
|
|
68
68
|
label={ label }
|
|
69
69
|
>
|
|
70
70
|
<StyleIndicator variant={ variantType } />
|
|
71
|
-
</
|
|
71
|
+
</StylesInheritanceInfotip>
|
|
72
72
|
);
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
} from '@elementor/ui';
|
|
19
19
|
import { __ } from '@wordpress/i18n';
|
|
20
20
|
|
|
21
|
-
import { useSectionContentRef } from '
|
|
22
|
-
import { useDirection } from '
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
21
|
+
import { useSectionContentRef } from '../../components/section-content';
|
|
22
|
+
import { useDirection } from '../../hooks/use-direction';
|
|
23
|
+
import { useNormalizedInheritanceChainItems } from '../hooks/use-normalized-inheritance-chain-items';
|
|
24
|
+
import { stylesInheritanceTransformersRegistry } from '../styles-inheritance-transformers-registry';
|
|
25
|
+
import { type SnapshotPropValue } from '../types';
|
|
26
|
+
import { ActionIcons, BreakpointIcon, LabelChip, ValueComponent } from './infotip';
|
|
27
27
|
|
|
28
28
|
type Props = {
|
|
29
29
|
inheritanceChain: SnapshotPropValue[];
|
|
@@ -35,7 +35,7 @@ type Props = {
|
|
|
35
35
|
|
|
36
36
|
const SIZE = 'tiny';
|
|
37
37
|
|
|
38
|
-
export const
|
|
38
|
+
export const StylesInheritanceInfotip = ( { inheritanceChain, propType, path, label, children }: Props ) => {
|
|
39
39
|
const [ showInfotip, setShowInfotip ] = useState< boolean >( false );
|
|
40
40
|
const toggleInfotip = () => setShowInfotip( ( prev ) => ! prev );
|
|
41
41
|
const closeInfotip = () => setShowInfotip( false );
|