@elementor/editor-editing-panel 4.3.0-998 → 4.3.0-beta1
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/dist/index.d.mts +142 -143
- package/dist/index.d.ts +142 -143
- package/dist/index.js +1867 -1141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1774 -1047
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/css-classes/css-class-menu.tsx +29 -30
- package/src/components/css-classes/css-class-selector.tsx +1 -0
- package/src/components/editing-panel-tabs.tsx +4 -10
- package/src/components/style-sections/position-section/position-section.tsx +8 -3
- package/src/components/style-sections-definition.ts +119 -0
- package/src/components/style-sections.tsx +22 -0
- package/src/components/style-states/pseudo-state-menu-items.tsx +44 -0
- package/src/components/style-states/pseudo-states.ts +17 -0
- package/src/components/style-states/use-pseudo-states.ts +18 -0
- package/src/components/style-tab.tsx +8 -123
- package/src/contexts/styles-inheritance-context.tsx +17 -1
- package/src/controls-registry/controls-registry.tsx +2 -2
- package/src/controls-registry/element-controls/accordion-items-control/accordion-items-control.tsx +141 -0
- package/src/controls-registry/element-controls/accordion-items-control/use-actions.ts +235 -0
- package/src/controls-registry/element-controls/accordion-items-control/use-show-icon-write-through.ts +135 -0
- package/src/controls-registry/element-controls/list-items-control/list-actions.ts +129 -0
- package/src/controls-registry/element-controls/list-items-control/list-items-control.tsx +152 -0
- package/src/controls-registry/element-controls/list-items-control/use-show-markers-write-through.ts +89 -0
- package/src/controls-registry/element-controls/registry.ts +4 -0
- package/src/hooks/use-default-style-tag-from-preview.ts +14 -0
- package/src/index.ts +21 -4
- package/src/init.ts +1 -1
- package/src/panel.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-beta1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.3.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.3.0-
|
|
44
|
-
"@elementor/editor-controls": "4.3.0-
|
|
45
|
-
"@elementor/editor-documents": "4.3.0-
|
|
46
|
-
"@elementor/editor-elements": "4.3.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.3.0-
|
|
48
|
-
"@elementor/editor-notifications": "4.3.0-
|
|
49
|
-
"@elementor/editor-panels": "4.3.0-
|
|
50
|
-
"@elementor/editor-props": "4.3.0-
|
|
51
|
-
"@elementor/editor-responsive": "4.3.0-
|
|
52
|
-
"@elementor/editor-styles": "4.3.0-
|
|
53
|
-
"@elementor/editor-styles-repository": "4.3.0-
|
|
54
|
-
"@elementor/editor-ui": "4.3.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.3.0-
|
|
56
|
-
"@elementor/http-client": "4.3.0-
|
|
42
|
+
"@elementor/editor": "4.3.0-beta1",
|
|
43
|
+
"@elementor/editor-canvas": "4.3.0-beta1",
|
|
44
|
+
"@elementor/editor-controls": "4.3.0-beta1",
|
|
45
|
+
"@elementor/editor-documents": "4.3.0-beta1",
|
|
46
|
+
"@elementor/editor-elements": "4.3.0-beta1",
|
|
47
|
+
"@elementor/editor-interactions": "4.3.0-beta1",
|
|
48
|
+
"@elementor/editor-notifications": "4.3.0-beta1",
|
|
49
|
+
"@elementor/editor-panels": "4.3.0-beta1",
|
|
50
|
+
"@elementor/editor-props": "4.3.0-beta1",
|
|
51
|
+
"@elementor/editor-responsive": "4.3.0-beta1",
|
|
52
|
+
"@elementor/editor-styles": "4.3.0-beta1",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.3.0-beta1",
|
|
54
|
+
"@elementor/editor-ui": "4.3.0-beta1",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.3.0-beta1",
|
|
56
|
+
"@elementor/http-client": "4.3.0-beta1",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.3.0-
|
|
59
|
-
"@elementor/locations": "4.3.0-
|
|
60
|
-
"@elementor/menus": "4.3.0-
|
|
61
|
-
"@elementor/query": "4.3.0-
|
|
62
|
-
"@elementor/schema": "4.3.0-
|
|
63
|
-
"@elementor/session": "4.3.0-
|
|
58
|
+
"@elementor/editor-variables": "4.3.0-beta1",
|
|
59
|
+
"@elementor/locations": "4.3.0-beta1",
|
|
60
|
+
"@elementor/menus": "4.3.0-beta1",
|
|
61
|
+
"@elementor/query": "4.3.0-beta1",
|
|
62
|
+
"@elementor/schema": "4.3.0-beta1",
|
|
63
|
+
"@elementor/session": "4.3.0-beta1",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.3.0-
|
|
66
|
-
"@elementor/wp-media": "4.3.0-
|
|
65
|
+
"@elementor/utils": "4.3.0-beta1",
|
|
66
|
+
"@elementor/wp-media": "4.3.0-beta1",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -16,37 +16,12 @@ import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/ty
|
|
|
16
16
|
import { getTempStylesProviderThemeColor } from '../../utils/get-styles-provider-color';
|
|
17
17
|
import { trackStyles } from '../../utils/tracking/subscribe';
|
|
18
18
|
import { StyleIndicator } from '../style-indicator';
|
|
19
|
+
import { usePseudoStates } from '../style-states/use-pseudo-states';
|
|
19
20
|
import { useCssClass } from './css-class-context';
|
|
20
21
|
import { DuplicateClassMenuItem } from './duplicate-class-menu-item';
|
|
21
22
|
import { LocalClassSubMenu } from './local-class-sub-menu';
|
|
22
23
|
import { useUndoableUnapplyClass } from './use-apply-and-unapply-class';
|
|
23
24
|
|
|
24
|
-
type State = {
|
|
25
|
-
key: StyleDefinitionStateWithNormal;
|
|
26
|
-
value: StyleDefinitionState | null;
|
|
27
|
-
label: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const DEFAULT_PSEUDO_STATES: State[] = [
|
|
31
|
-
{ key: 'normal', value: null, label: __( 'normal', 'elementor' ) },
|
|
32
|
-
{ key: 'hover', value: 'hover', label: __( 'hover', 'elementor' ) },
|
|
33
|
-
{ key: 'focus', value: 'focus', label: __( 'focus', 'elementor' ) },
|
|
34
|
-
{ key: 'active', value: 'active', label: __( 'active', 'elementor' ) },
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
function usePseudoStates(): State[] {
|
|
38
|
-
const { elementType } = useElement();
|
|
39
|
-
const { pseudoStates = [] } = elementType;
|
|
40
|
-
|
|
41
|
-
const additionalStates: State[] = pseudoStates.map( ( { name, value } ) => ( {
|
|
42
|
-
key: value as StyleDefinitionStateWithNormal,
|
|
43
|
-
value: value as StyleDefinitionState,
|
|
44
|
-
label: name,
|
|
45
|
-
} ) );
|
|
46
|
-
|
|
47
|
-
return [ ...DEFAULT_PSEUDO_STATES, ...additionalStates ];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
25
|
type CssClassMenuProps = {
|
|
51
26
|
popupState: PopupState;
|
|
52
27
|
anchorEl: HTMLElement | null;
|
|
@@ -81,8 +56,19 @@ export function CssClassMenu( { popupState, anchorEl, fixed }: CssClassMenuProps
|
|
|
81
56
|
>
|
|
82
57
|
{ isLocalStyle && <LocalClassSubMenu popupState={ popupState } /> }
|
|
83
58
|
{ /* It has to be an array since MUI menu doesn't accept a Fragment as a child, and wrapping the items with an HTML element disrupts keyboard navigation */ }
|
|
84
|
-
{ getMenuItemsByProvider( {
|
|
85
|
-
|
|
59
|
+
{ getMenuItemsByProvider( {
|
|
60
|
+
provider,
|
|
61
|
+
closeMenu: popupState.close,
|
|
62
|
+
fixed,
|
|
63
|
+
} ) }
|
|
64
|
+
<MenuSubheader
|
|
65
|
+
sx={ {
|
|
66
|
+
typography: 'caption',
|
|
67
|
+
color: 'text.secondary',
|
|
68
|
+
pb: 0.5,
|
|
69
|
+
pt: 1,
|
|
70
|
+
} }
|
|
71
|
+
>
|
|
86
72
|
{ __( 'States', 'elementor' ) }
|
|
87
73
|
</MenuSubheader>
|
|
88
74
|
{ pseudoStates.map( ( state ) => {
|
|
@@ -113,7 +99,14 @@ function ClassStatesMenu( { closeMenu }: { closeMenu: () => void } ) {
|
|
|
113
99
|
return (
|
|
114
100
|
<>
|
|
115
101
|
<Divider />
|
|
116
|
-
<MenuSubheader
|
|
102
|
+
<MenuSubheader
|
|
103
|
+
sx={ {
|
|
104
|
+
typography: 'caption',
|
|
105
|
+
color: 'text.secondary',
|
|
106
|
+
pb: 0.5,
|
|
107
|
+
pt: 1,
|
|
108
|
+
} }
|
|
109
|
+
>
|
|
117
110
|
{ customTitle }
|
|
118
111
|
</MenuSubheader>
|
|
119
112
|
{ elementStates.map( ( state ) => {
|
|
@@ -201,7 +194,13 @@ function getMenuItemsByProvider( {
|
|
|
201
194
|
actions.unshift(
|
|
202
195
|
<MenuSubheader
|
|
203
196
|
key="provider-label"
|
|
204
|
-
sx={ {
|
|
197
|
+
sx={ {
|
|
198
|
+
typography: 'caption',
|
|
199
|
+
color: 'text.secondary',
|
|
200
|
+
pb: 0.5,
|
|
201
|
+
pt: 1,
|
|
202
|
+
textTransform: 'capitalize',
|
|
203
|
+
} }
|
|
205
204
|
>
|
|
206
205
|
{ providerInstance?.labels?.singular }
|
|
207
206
|
</MenuSubheader>
|
|
@@ -300,6 +300,7 @@ function useOptions() {
|
|
|
300
300
|
|
|
301
301
|
return useProviders()
|
|
302
302
|
.filter( isProviderEditable )
|
|
303
|
+
.filter( ( provider ) => provider.getKey() !== 'default-styles' )
|
|
303
304
|
.flatMap< StyleDefOption >( ( provider ) => {
|
|
304
305
|
const isElements = isElementsStylesProvider( provider.getKey() );
|
|
305
306
|
const styleDefs = provider.actions.all( { elementId: element.id } );
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { getWidgetsCache } from '@elementor/editor-elements';
|
|
4
|
-
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
4
|
import { Divider, Stack, Tab, TabPanel, Tabs, useTabs } from '@elementor/ui';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
@@ -31,7 +30,6 @@ const PanelTabContent = () => {
|
|
|
31
30
|
const { element } = useElement();
|
|
32
31
|
const editorDefaults = useDefaultPanelSettings();
|
|
33
32
|
const defaultComponentTab = editorDefaults.defaultTab as TabValue;
|
|
34
|
-
const isInteractionsActive = isExperimentActive( 'e_interactions' );
|
|
35
33
|
const isPromotedElement = !! getWidgetsCache()?.[ element.type ]?.meta?.is_pro_promotion;
|
|
36
34
|
|
|
37
35
|
const [ storedTab, setCurrentTab ] = useStateByElement< TabValue >( 'tab', defaultComponentTab );
|
|
@@ -55,9 +53,7 @@ const PanelTabContent = () => {
|
|
|
55
53
|
<Tab label={ __( 'General', 'elementor' ) } { ...getTabProps( 'settings' ) } />
|
|
56
54
|
) }
|
|
57
55
|
<Tab label={ __( 'Style', 'elementor' ) } { ...getTabProps( 'style' ) } />
|
|
58
|
-
{
|
|
59
|
-
<Tab label={ __( 'Interactions', 'elementor' ) } { ...getTabProps( 'interactions' ) } />
|
|
60
|
-
) }
|
|
56
|
+
<Tab label={ __( 'Interactions', 'elementor' ) } { ...getTabProps( 'interactions' ) } />
|
|
61
57
|
</Tabs>
|
|
62
58
|
<Divider />
|
|
63
59
|
</Stack>
|
|
@@ -69,11 +65,9 @@ const PanelTabContent = () => {
|
|
|
69
65
|
<TabPanel { ...getTabPanelProps( 'style' ) } disablePadding>
|
|
70
66
|
<StyleTab />
|
|
71
67
|
</TabPanel>
|
|
72
|
-
{
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
</TabPanel>
|
|
76
|
-
) }
|
|
68
|
+
<TabPanel { ...getTabPanelProps( 'interactions' ) } disablePadding>
|
|
69
|
+
<InteractionsTab />
|
|
70
|
+
</TabPanel>
|
|
77
71
|
</Stack>
|
|
78
72
|
</ScrollProvider>
|
|
79
73
|
);
|
|
@@ -6,6 +6,7 @@ import { styled } from '@elementor/ui';
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
8
|
import { useStyle } from '../../../contexts/style-context';
|
|
9
|
+
import { useInheritedValues } from '../../../contexts/styles-inheritance-context';
|
|
9
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
11
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
11
12
|
import { PanelDivider } from '../../panel-divider';
|
|
@@ -38,6 +39,10 @@ const DEPENDENT_PROP_NAMES: Array< keyof DependentValues > = [
|
|
|
38
39
|
|
|
39
40
|
export const PositionSection = () => {
|
|
40
41
|
const { value: position } = useStylesField< StringPropValue >( 'position', withHistoryLabel( POSITION_LABEL ) );
|
|
42
|
+
const inheritedPosition = useInheritedValues( [ 'position' ] ).position as StringPropValue | null;
|
|
43
|
+
const resolvedPosition = position ?? inheritedPosition ?? null;
|
|
44
|
+
const isPositionUnsetOrStatic = ! resolvedPosition || resolvedPosition.value === POSITION_STATIC;
|
|
45
|
+
|
|
41
46
|
const positionPrevRef = useRef( position );
|
|
42
47
|
const { values: dependentValues, setValues: setDependentValues } =
|
|
43
48
|
useStylesFields< DependentValues >( DEPENDENT_PROP_NAMES );
|
|
@@ -55,19 +60,19 @@ export const PositionSection = () => {
|
|
|
55
60
|
clearHistory();
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
if (
|
|
63
|
+
if ( isPositionUnsetOrStatic && dependentValues?.[ 'z-index' ] ) {
|
|
59
64
|
setDependentValues( { 'z-index': null }, withHistoryLabel( DIMENSIONS_LABEL ) );
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
positionPrevRef.current = position;
|
|
63
68
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
-
}, [ position?.value ] );
|
|
69
|
+
}, [ position?.value, isPositionUnsetOrStatic ] );
|
|
65
70
|
|
|
66
71
|
return (
|
|
67
72
|
<StyledSectionContent>
|
|
68
73
|
<PositionField />
|
|
69
74
|
<DimensionsField />
|
|
70
|
-
<ZIndexField disabled={
|
|
75
|
+
<ZIndexField disabled={ isPositionUnsetOrStatic } />
|
|
71
76
|
<PanelDivider />
|
|
72
77
|
<OffsetField />
|
|
73
78
|
</StyledSectionContent>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
|
|
4
|
+
import { BackgroundSection } from './style-sections/background-section/background-section';
|
|
5
|
+
import { BorderSection } from './style-sections/border-section/border-section';
|
|
6
|
+
import { EffectsSection } from './style-sections/effects-section/effects-section';
|
|
7
|
+
import { LayoutSection } from './style-sections/layout-section/layout-section';
|
|
8
|
+
import { PositionSection } from './style-sections/position-section/position-section';
|
|
9
|
+
import { SizeSection } from './style-sections/size-section/size-section';
|
|
10
|
+
import { SpacingSection } from './style-sections/spacing-section/spacing-section';
|
|
11
|
+
import { TypographySection } from './style-sections/typography-section/typography-section';
|
|
12
|
+
|
|
13
|
+
export type StyleSectionDefinition = {
|
|
14
|
+
name: string;
|
|
15
|
+
title: string;
|
|
16
|
+
component: () => React.JSX.Element;
|
|
17
|
+
fields: string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const STYLE_SECTIONS: StyleSectionDefinition[] = [
|
|
21
|
+
{
|
|
22
|
+
name: 'Layout',
|
|
23
|
+
title: __( 'Layout', 'elementor' ),
|
|
24
|
+
component: LayoutSection,
|
|
25
|
+
fields: [
|
|
26
|
+
'display',
|
|
27
|
+
'flex-direction',
|
|
28
|
+
'flex-wrap',
|
|
29
|
+
'justify-content',
|
|
30
|
+
'align-items',
|
|
31
|
+
'align-content',
|
|
32
|
+
'align-self',
|
|
33
|
+
'gap',
|
|
34
|
+
'order',
|
|
35
|
+
'grid-column',
|
|
36
|
+
'grid-row',
|
|
37
|
+
'grid-auto-rows',
|
|
38
|
+
'grid-auto-columns',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Spacing',
|
|
43
|
+
title: __( 'Spacing', 'elementor' ),
|
|
44
|
+
component: SpacingSection,
|
|
45
|
+
fields: [ 'margin', 'padding' ],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Size',
|
|
49
|
+
title: __( 'Size', 'elementor' ),
|
|
50
|
+
component: SizeSection,
|
|
51
|
+
fields: [
|
|
52
|
+
'width',
|
|
53
|
+
'min-width',
|
|
54
|
+
'max-width',
|
|
55
|
+
'height',
|
|
56
|
+
'min-height',
|
|
57
|
+
'max-height',
|
|
58
|
+
'overflow',
|
|
59
|
+
'aspect-ratio',
|
|
60
|
+
'object-fit',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Position',
|
|
65
|
+
title: __( 'Position', 'elementor' ),
|
|
66
|
+
component: PositionSection,
|
|
67
|
+
fields: [ 'position', 'z-index', 'scroll-margin-top' ],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Typography',
|
|
71
|
+
title: __( 'Typography', 'elementor' ),
|
|
72
|
+
component: TypographySection,
|
|
73
|
+
fields: [
|
|
74
|
+
'font-family',
|
|
75
|
+
'font-weight',
|
|
76
|
+
'font-size',
|
|
77
|
+
'text-align',
|
|
78
|
+
'color',
|
|
79
|
+
'line-height',
|
|
80
|
+
'letter-spacing',
|
|
81
|
+
'word-spacing',
|
|
82
|
+
'column-count',
|
|
83
|
+
'text-decoration',
|
|
84
|
+
'text-transform',
|
|
85
|
+
'direction',
|
|
86
|
+
'font-style',
|
|
87
|
+
'stroke',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Background',
|
|
92
|
+
title: __( 'Background', 'elementor' ),
|
|
93
|
+
component: BackgroundSection,
|
|
94
|
+
fields: [ 'background' ],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Border',
|
|
98
|
+
title: __( 'Border', 'elementor' ),
|
|
99
|
+
component: BorderSection,
|
|
100
|
+
fields: [ 'border-radius', 'border-width', 'border-color', 'border-style' ],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Effects',
|
|
104
|
+
title: __( 'Effects', 'elementor' ),
|
|
105
|
+
component: EffectsSection,
|
|
106
|
+
fields: [
|
|
107
|
+
'mix-blend-mode',
|
|
108
|
+
'box-shadow',
|
|
109
|
+
'opacity',
|
|
110
|
+
'transform',
|
|
111
|
+
'filter',
|
|
112
|
+
'backdrop-filter',
|
|
113
|
+
'transform-origin',
|
|
114
|
+
'transition',
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export const STYLE_SECTION_NAMES = STYLE_SECTIONS.map( ( section ) => section.name );
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { STYLE_SECTIONS } from './style-sections-definition';
|
|
4
|
+
import { StyleTabSection } from './style-tab-section';
|
|
5
|
+
|
|
6
|
+
export const StyleSections = () => {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
{ STYLE_SECTIONS.map( ( section ) => (
|
|
10
|
+
<StyleTabSection
|
|
11
|
+
key={ section.name }
|
|
12
|
+
section={ {
|
|
13
|
+
component: section.component,
|
|
14
|
+
name: section.name,
|
|
15
|
+
title: section.title,
|
|
16
|
+
} }
|
|
17
|
+
fields={ section.fields }
|
|
18
|
+
/>
|
|
19
|
+
) ) }
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
3
|
+
import { MenuListItem } from '@elementor/editor-ui';
|
|
4
|
+
import { MenuSubheader } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { type PseudoStateOption } from './pseudo-states';
|
|
8
|
+
|
|
9
|
+
type PseudoStateMenuItemsProps = {
|
|
10
|
+
states: PseudoStateOption[];
|
|
11
|
+
activeState: StyleDefinitionState | null;
|
|
12
|
+
onSelectState: ( state: StyleDefinitionState | null ) => void;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function PseudoStateMenuItems( { states, activeState, onSelectState, onClose }: PseudoStateMenuItemsProps ) {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<MenuSubheader
|
|
20
|
+
sx={ {
|
|
21
|
+
typography: 'caption',
|
|
22
|
+
color: 'text.secondary',
|
|
23
|
+
pb: 0.5,
|
|
24
|
+
pt: 1,
|
|
25
|
+
} }
|
|
26
|
+
>
|
|
27
|
+
{ __( 'States', 'elementor' ) }
|
|
28
|
+
</MenuSubheader>
|
|
29
|
+
{ states.map( ( state ) => (
|
|
30
|
+
<MenuListItem
|
|
31
|
+
key={ state.key }
|
|
32
|
+
selected={ state.value === activeState }
|
|
33
|
+
sx={ { textTransform: 'capitalize' } }
|
|
34
|
+
onClick={ () => {
|
|
35
|
+
onSelectState( state.value );
|
|
36
|
+
onClose?.();
|
|
37
|
+
} }
|
|
38
|
+
>
|
|
39
|
+
{ state.label }
|
|
40
|
+
</MenuListItem>
|
|
41
|
+
) ) }
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
|
|
4
|
+
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
5
|
+
|
|
6
|
+
export type PseudoStateOption = {
|
|
7
|
+
key: StyleDefinitionStateWithNormal;
|
|
8
|
+
value: StyleDefinitionState | null;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_PSEUDO_STATES: PseudoStateOption[] = [
|
|
13
|
+
{ key: 'normal', value: null, label: __( 'normal', 'elementor' ) },
|
|
14
|
+
{ key: 'hover', value: 'hover', label: __( 'hover', 'elementor' ) },
|
|
15
|
+
{ key: 'focus', value: 'focus', label: __( 'focus', 'elementor' ) },
|
|
16
|
+
{ key: 'active', value: 'active', label: __( 'active', 'elementor' ) },
|
|
17
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
2
|
+
|
|
3
|
+
import { useElement } from '../../contexts/element-context';
|
|
4
|
+
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
5
|
+
import { DEFAULT_PSEUDO_STATES, type PseudoStateOption } from './pseudo-states';
|
|
6
|
+
|
|
7
|
+
export function usePseudoStates(): PseudoStateOption[] {
|
|
8
|
+
const { elementType } = useElement();
|
|
9
|
+
const { pseudoStates = [] } = elementType;
|
|
10
|
+
|
|
11
|
+
const additionalStates: PseudoStateOption[] = pseudoStates.map( ( { name, value } ) => ( {
|
|
12
|
+
key: value as StyleDefinitionStateWithNormal,
|
|
13
|
+
value: value as StyleDefinitionState,
|
|
14
|
+
label: name,
|
|
15
|
+
} ) );
|
|
16
|
+
|
|
17
|
+
return [ ...DEFAULT_PSEUDO_STATES, ...additionalStates ];
|
|
18
|
+
}
|
|
@@ -6,7 +6,6 @@ import { type StyleDefinitionID, type StyleDefinitionState } from '@elementor/ed
|
|
|
6
6
|
import { createLocation } from '@elementor/locations';
|
|
7
7
|
import { SessionStorageProvider } from '@elementor/session';
|
|
8
8
|
import { Box, Divider, Stack } from '@elementor/ui';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
9
|
|
|
11
10
|
import { ClassesPropProvider } from '../contexts/classes-prop-context';
|
|
12
11
|
import { useElement } from '../contexts/element-context';
|
|
@@ -16,15 +15,7 @@ import { StyleInheritanceProvider } from '../contexts/styles-inheritance-context
|
|
|
16
15
|
import { useActiveStyleDefId } from '../hooks/use-active-style-def-id';
|
|
17
16
|
import { CssClassSelector } from './css-classes/css-class-selector';
|
|
18
17
|
import { SectionsList } from './sections-list';
|
|
19
|
-
import {
|
|
20
|
-
import { BorderSection } from './style-sections/border-section/border-section';
|
|
21
|
-
import { EffectsSection } from './style-sections/effects-section/effects-section';
|
|
22
|
-
import { LayoutSection } from './style-sections/layout-section/layout-section';
|
|
23
|
-
import { PositionSection } from './style-sections/position-section/position-section';
|
|
24
|
-
import { SizeSection } from './style-sections/size-section/size-section';
|
|
25
|
-
import { SpacingSection } from './style-sections/spacing-section/spacing-section';
|
|
26
|
-
import { TypographySection } from './style-sections/typography-section/typography-section';
|
|
27
|
-
import { StyleTabSection } from './style-tab-section';
|
|
18
|
+
import { StyleSections } from './style-sections';
|
|
28
19
|
|
|
29
20
|
const TABS_HEADER_HEIGHT = '37px';
|
|
30
21
|
|
|
@@ -66,118 +57,7 @@ export const StyleTab = () => {
|
|
|
66
57
|
<Divider />
|
|
67
58
|
</ClassesHeader>
|
|
68
59
|
<SectionsList>
|
|
69
|
-
<
|
|
70
|
-
section={ {
|
|
71
|
-
component: LayoutSection,
|
|
72
|
-
name: 'Layout',
|
|
73
|
-
title: __( 'Layout', 'elementor' ),
|
|
74
|
-
} }
|
|
75
|
-
fields={ [
|
|
76
|
-
'display',
|
|
77
|
-
'flex-direction',
|
|
78
|
-
'flex-wrap',
|
|
79
|
-
'justify-content',
|
|
80
|
-
'align-items',
|
|
81
|
-
'align-content',
|
|
82
|
-
'align-self',
|
|
83
|
-
'gap',
|
|
84
|
-
'order',
|
|
85
|
-
'grid-column',
|
|
86
|
-
'grid-row',
|
|
87
|
-
'grid-auto-rows',
|
|
88
|
-
'grid-auto-columns',
|
|
89
|
-
] }
|
|
90
|
-
/>
|
|
91
|
-
<StyleTabSection
|
|
92
|
-
section={ {
|
|
93
|
-
component: SpacingSection,
|
|
94
|
-
name: 'Spacing',
|
|
95
|
-
title: __( 'Spacing', 'elementor' ),
|
|
96
|
-
} }
|
|
97
|
-
fields={ [ 'margin', 'padding' ] }
|
|
98
|
-
/>
|
|
99
|
-
<StyleTabSection
|
|
100
|
-
section={ {
|
|
101
|
-
component: SizeSection,
|
|
102
|
-
name: 'Size',
|
|
103
|
-
title: __( 'Size', 'elementor' ),
|
|
104
|
-
} }
|
|
105
|
-
fields={ [
|
|
106
|
-
'width',
|
|
107
|
-
'min-width',
|
|
108
|
-
'max-width',
|
|
109
|
-
'height',
|
|
110
|
-
'min-height',
|
|
111
|
-
'max-height',
|
|
112
|
-
'overflow',
|
|
113
|
-
'aspect-ratio',
|
|
114
|
-
'object-fit',
|
|
115
|
-
] }
|
|
116
|
-
/>
|
|
117
|
-
<StyleTabSection
|
|
118
|
-
section={ {
|
|
119
|
-
component: PositionSection,
|
|
120
|
-
name: 'Position',
|
|
121
|
-
title: __( 'Position', 'elementor' ),
|
|
122
|
-
} }
|
|
123
|
-
fields={ [ 'position', 'z-index', 'scroll-margin-top' ] }
|
|
124
|
-
/>
|
|
125
|
-
<StyleTabSection
|
|
126
|
-
section={ {
|
|
127
|
-
component: TypographySection,
|
|
128
|
-
name: 'Typography',
|
|
129
|
-
title: __( 'Typography', 'elementor' ),
|
|
130
|
-
} }
|
|
131
|
-
fields={ [
|
|
132
|
-
'font-family',
|
|
133
|
-
'font-weight',
|
|
134
|
-
'font-size',
|
|
135
|
-
'text-align',
|
|
136
|
-
'color',
|
|
137
|
-
'line-height',
|
|
138
|
-
'letter-spacing',
|
|
139
|
-
'word-spacing',
|
|
140
|
-
'column-count',
|
|
141
|
-
'text-decoration',
|
|
142
|
-
'text-transform',
|
|
143
|
-
'direction',
|
|
144
|
-
'font-style',
|
|
145
|
-
'stroke',
|
|
146
|
-
] }
|
|
147
|
-
/>
|
|
148
|
-
<StyleTabSection
|
|
149
|
-
section={ {
|
|
150
|
-
component: BackgroundSection,
|
|
151
|
-
name: 'Background',
|
|
152
|
-
title: __( 'Background', 'elementor' ),
|
|
153
|
-
} }
|
|
154
|
-
fields={ [ 'background' ] }
|
|
155
|
-
/>
|
|
156
|
-
<StyleTabSection
|
|
157
|
-
section={ {
|
|
158
|
-
component: BorderSection,
|
|
159
|
-
name: 'Border',
|
|
160
|
-
title: __( 'Border', 'elementor' ),
|
|
161
|
-
} }
|
|
162
|
-
fields={ [ 'border-radius', 'border-width', 'border-color', 'border-style' ] }
|
|
163
|
-
/>
|
|
164
|
-
<StyleTabSection
|
|
165
|
-
section={ {
|
|
166
|
-
component: EffectsSection,
|
|
167
|
-
name: 'Effects',
|
|
168
|
-
title: __( 'Effects', 'elementor' ),
|
|
169
|
-
} }
|
|
170
|
-
fields={ [
|
|
171
|
-
'mix-blend-mode',
|
|
172
|
-
'box-shadow',
|
|
173
|
-
'opacity',
|
|
174
|
-
'transform',
|
|
175
|
-
'filter',
|
|
176
|
-
'backdrop-filter',
|
|
177
|
-
'transform-origin',
|
|
178
|
-
'transition',
|
|
179
|
-
] }
|
|
180
|
-
/>
|
|
60
|
+
<StyleSections />
|
|
181
61
|
<StyleTabSlot />
|
|
182
62
|
</SectionsList>
|
|
183
63
|
<Box sx={ { height: '150px' } } />
|
|
@@ -192,7 +72,12 @@ function ClassesHeader( { children }: { children: React.ReactNode } ) {
|
|
|
192
72
|
const scrollDirection = useScrollDirection();
|
|
193
73
|
|
|
194
74
|
return (
|
|
195
|
-
<Stack
|
|
75
|
+
<Stack
|
|
76
|
+
sx={ {
|
|
77
|
+
...stickyHeaderStyles,
|
|
78
|
+
top: scrollDirection === 'up' ? TABS_HEADER_HEIGHT : 0,
|
|
79
|
+
} }
|
|
80
|
+
>
|
|
196
81
|
{ children }
|
|
197
82
|
</Stack>
|
|
198
83
|
);
|
|
@@ -6,6 +6,7 @@ import { getBreakpointsTree } from '@elementor/editor-responsive';
|
|
|
6
6
|
import { getStylesSchema } from '@elementor/editor-styles';
|
|
7
7
|
import { stylesRepository } from '@elementor/editor-styles-repository';
|
|
8
8
|
|
|
9
|
+
import { useDefaultStyleTagFromPreview } from '../hooks/use-default-style-tag-from-preview';
|
|
9
10
|
import { useStylesRerender } from '../hooks/use-styles-rerender';
|
|
10
11
|
import { createStylesInheritance } from '../styles-inheritance/create-styles-inheritance';
|
|
11
12
|
import {
|
|
@@ -81,6 +82,8 @@ export function useInheritedValues( propKeys: string[] ): Record< string, PropVa
|
|
|
81
82
|
const useAppliedStyles = () => {
|
|
82
83
|
const currentClassesProp = useClassesProp();
|
|
83
84
|
const baseStyles = useBaseStyles();
|
|
85
|
+
const defaultTagStyleId = useDefaultTagStyleId();
|
|
86
|
+
const { id: activeStyleId } = useStyle();
|
|
84
87
|
|
|
85
88
|
useStylesRerender();
|
|
86
89
|
|
|
@@ -88,7 +91,14 @@ const useAppliedStyles = () => {
|
|
|
88
91
|
|
|
89
92
|
const appliedStyles = classesPropTypeUtil.extract( classesProp ) ?? [];
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
const applicableIds = [
|
|
95
|
+
...baseStyles,
|
|
96
|
+
...appliedStyles,
|
|
97
|
+
...( defaultTagStyleId ? [ defaultTagStyleId ] : [] ),
|
|
98
|
+
...( activeStyleId ? [ activeStyleId ] : [] ),
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
return stylesRepository.all().filter( ( style ) => applicableIds.includes( style.id ) );
|
|
92
102
|
};
|
|
93
103
|
|
|
94
104
|
const useBaseStyles = () => {
|
|
@@ -98,3 +108,9 @@ const useBaseStyles = () => {
|
|
|
98
108
|
|
|
99
109
|
return Object.keys( widgetCache?.base_styles ?? {} );
|
|
100
110
|
};
|
|
111
|
+
|
|
112
|
+
const useDefaultTagStyleId = () => {
|
|
113
|
+
const { element } = useElement();
|
|
114
|
+
|
|
115
|
+
return useDefaultStyleTagFromPreview( element.id );
|
|
116
|
+
};
|