@elementor/editor-editing-panel 1.43.1 → 1.44.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 +21 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1087 -905
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +857 -677
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- 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/position-section/dimensions-field.tsx +8 -8
- package/src/components/style-sections/size-section/size-section.tsx +3 -3
- 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-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/dynamic-selection-control.tsx +11 -15
- 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/{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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@elementor/editor": "0.19.4",
|
|
43
|
-
"@elementor/editor-canvas": "0.22.
|
|
44
|
-
"@elementor/editor-controls": "0.
|
|
43
|
+
"@elementor/editor-canvas": "0.22.3",
|
|
44
|
+
"@elementor/editor-controls": "0.36.0",
|
|
45
45
|
"@elementor/editor-current-user": "0.5.0",
|
|
46
46
|
"@elementor/editor-documents": "0.13.6",
|
|
47
47
|
"@elementor/editor-elements": "0.8.4",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@elementor/editor-responsive": "0.13.5",
|
|
51
51
|
"@elementor/editor-styles": "0.6.8",
|
|
52
52
|
"@elementor/editor-styles-repository": "0.10.1",
|
|
53
|
-
"@elementor/editor-ui": "0.
|
|
53
|
+
"@elementor/editor-ui": "0.11.0",
|
|
54
54
|
"@elementor/editor-v1-adapters": "0.12.0",
|
|
55
55
|
"@elementor/icons": "1.44.0",
|
|
56
56
|
"@elementor/locations": "0.8.0",
|
package/src/action.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export default function Action( { title, visible = true, icon: Icon, onClick }:
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<Tooltip placement="
|
|
20
|
+
<Tooltip placement="top" title={ title } arrow={ true }>
|
|
21
21
|
<IconButton aria-label={ title } size={ SIZE } onClick={ onClick }>
|
|
22
22
|
<Icon fontSize={ SIZE } />
|
|
23
23
|
</IconButton>
|
|
@@ -3,26 +3,25 @@ import { type PropsWithChildren } from 'react';
|
|
|
3
3
|
import { MinusIcon, PlusIcon } from '@elementor/icons';
|
|
4
4
|
import { Collapse, IconButton, Stack } from '@elementor/ui';
|
|
5
5
|
|
|
6
|
-
import { ControlLabel } from './control-label';
|
|
7
6
|
import { SectionContent } from './section-content';
|
|
8
7
|
|
|
9
8
|
const SIZE = 'tiny';
|
|
10
9
|
|
|
11
10
|
type Props = {
|
|
12
|
-
label: string;
|
|
13
11
|
isAdded: boolean;
|
|
14
12
|
onAdd: () => void;
|
|
15
13
|
onRemove: () => void;
|
|
16
14
|
disabled?: boolean;
|
|
15
|
+
renderLabel: () => React.ReactNode;
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const AddOrRemoveContent = ( {
|
|
20
19
|
isAdded,
|
|
21
|
-
label,
|
|
22
20
|
onAdd,
|
|
23
21
|
onRemove,
|
|
24
22
|
children,
|
|
25
23
|
disabled,
|
|
24
|
+
renderLabel,
|
|
26
25
|
}: PropsWithChildren< Props > ) => {
|
|
27
26
|
return (
|
|
28
27
|
<SectionContent>
|
|
@@ -34,7 +33,7 @@ export const AddOrRemoveContent = ( {
|
|
|
34
33
|
marginInlineEnd: -0.75,
|
|
35
34
|
} }
|
|
36
35
|
>
|
|
37
|
-
|
|
36
|
+
{ renderLabel() }
|
|
38
37
|
{ isAdded ? (
|
|
39
38
|
<IconButton size={ SIZE } onClick={ onRemove } aria-label="Remove" disabled={ disabled }>
|
|
40
39
|
<MinusIcon fontSize={ SIZE } />
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Button, Collapse, Stack } from '@elementor/ui';
|
|
2
|
+
import { type ReactNode, useState } from 'react';
|
|
3
|
+
import { Button, Collapse, Stack, styled } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
import { CollapseIcon } from './collapse-icon';
|
|
7
7
|
|
|
8
|
+
type StaticItem< T = unknown > = T extends ( ...args: unknown[] ) => unknown ? never : T;
|
|
9
|
+
|
|
10
|
+
type CallbackItem< T > = ( isOpen: boolean ) => T;
|
|
11
|
+
export type CollapsibleValue< T > = CallbackItem< T > | StaticItem< T >;
|
|
12
|
+
|
|
8
13
|
type CollapsibleContentProps = React.PropsWithChildren< {
|
|
9
14
|
defaultOpen?: boolean;
|
|
15
|
+
titleEnd?: CollapsibleValue< ReactNode | string > | null;
|
|
10
16
|
} >;
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
const IndicatorsWrapper = styled( 'div' )`
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: ${ ( { theme } ) => theme.spacing( 3 ) };
|
|
22
|
+
height: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const CollapsibleContent = ( { children, defaultOpen = false, titleEnd = null }: CollapsibleContentProps ) => {
|
|
13
30
|
const [ open, setOpen ] = useState( defaultOpen );
|
|
14
31
|
|
|
15
32
|
const handleToggle = () => {
|
|
@@ -18,20 +35,31 @@ export const CollapsibleContent = ( { children, defaultOpen = false }: Collapsib
|
|
|
18
35
|
|
|
19
36
|
return (
|
|
20
37
|
<Stack>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
<Stack sx={ { position: 'relative' } }>
|
|
39
|
+
<Button
|
|
40
|
+
fullWidth
|
|
41
|
+
size="small"
|
|
42
|
+
color="secondary"
|
|
43
|
+
variant="outlined"
|
|
44
|
+
onClick={ handleToggle }
|
|
45
|
+
endIcon={ <CollapseIcon open={ open } /> }
|
|
46
|
+
sx={ { my: 0.5 } }
|
|
47
|
+
>
|
|
48
|
+
{ open ? __( 'Show less', 'elementor' ) : __( 'Show more', 'elementor' ) }
|
|
49
|
+
</Button>
|
|
50
|
+
{ titleEnd && <IndicatorsWrapper>{ getCollapsibleValue( titleEnd, open ) }</IndicatorsWrapper> }
|
|
51
|
+
</Stack>
|
|
32
52
|
<Collapse in={ open } timeout="auto" unmountOnExit>
|
|
33
53
|
{ children }
|
|
34
54
|
</Collapse>
|
|
35
55
|
</Stack>
|
|
36
56
|
);
|
|
37
57
|
};
|
|
58
|
+
|
|
59
|
+
export function getCollapsibleValue< T >( value: CollapsibleValue< T >, isOpen: boolean ): T {
|
|
60
|
+
if ( typeof value === 'function' ) {
|
|
61
|
+
return ( value as CallbackItem< T > )( isOpen );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
@@ -5,7 +5,7 @@ import { Stack } from '@elementor/ui';
|
|
|
5
5
|
|
|
6
6
|
export const ControlLabel = ( { children }: PropsWithChildren< object > ) => {
|
|
7
7
|
return (
|
|
8
|
-
<Stack direction="row" alignItems="center" justifyItems="start" gap={
|
|
8
|
+
<Stack direction="row" alignItems="center" justifyItems="start" gap={ 0.25 }>
|
|
9
9
|
<ControlFormLabel>{ children }</ControlFormLabel>
|
|
10
10
|
<ControlAdornments />
|
|
11
11
|
</Stack>
|
|
@@ -1,34 +1,48 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type PropsWithChildren, useId } from 'react';
|
|
2
|
+
import { type PropsWithChildren, type ReactNode, useId } from 'react';
|
|
3
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
3
4
|
import { Collapse, Divider, ListItemButton, ListItemText, Stack } from '@elementor/ui';
|
|
4
5
|
|
|
5
6
|
import { useStateByElement } from '../hooks/use-state-by-element';
|
|
7
|
+
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
6
8
|
import { CollapseIcon } from './collapse-icon';
|
|
9
|
+
import { type CollapsibleValue, getCollapsibleValue } from './collapsible-content';
|
|
7
10
|
|
|
8
11
|
type Props = PropsWithChildren< {
|
|
9
12
|
title: string;
|
|
10
13
|
defaultExpanded?: boolean;
|
|
14
|
+
titleEnd?: CollapsibleValue< ReactNode | string >;
|
|
11
15
|
} >;
|
|
12
16
|
|
|
13
|
-
export function Section( { title, children, defaultExpanded = false }: Props ) {
|
|
17
|
+
export function Section( { title, children, defaultExpanded = false, titleEnd }: Props ) {
|
|
14
18
|
const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
|
|
15
19
|
|
|
20
|
+
const handleClick = () => {
|
|
21
|
+
setIsOpen( ! isOpen );
|
|
22
|
+
};
|
|
23
|
+
|
|
16
24
|
const id = useId();
|
|
17
25
|
const labelId = `label-${ id }`;
|
|
18
26
|
const contentId = `content-${ id }`;
|
|
19
27
|
|
|
28
|
+
const isUsingTitleEnd = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_30 );
|
|
29
|
+
|
|
20
30
|
return (
|
|
21
31
|
<>
|
|
22
32
|
<ListItemButton
|
|
23
33
|
id={ labelId }
|
|
24
34
|
aria-controls={ contentId }
|
|
25
|
-
onClick={
|
|
35
|
+
onClick={ handleClick }
|
|
26
36
|
sx={ { '&:hover': { backgroundColor: 'transparent' } } }
|
|
27
37
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
<Stack direction="row" alignItems="center" justifyItems="start" flexGrow={ 1 } gap={ 0.5 }>
|
|
39
|
+
<ListItemText
|
|
40
|
+
secondary={ title }
|
|
41
|
+
secondaryTypographyProps={ { color: 'text.primary', variant: 'caption', fontWeight: 'bold' } }
|
|
42
|
+
sx={ { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 } }
|
|
43
|
+
/>
|
|
44
|
+
{ isUsingTitleEnd ? getCollapsibleValue( titleEnd, isOpen ) : null }
|
|
45
|
+
</Stack>
|
|
32
46
|
<CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
|
|
33
47
|
</ListItemButton>
|
|
34
48
|
<Collapse id={ contentId } aria-labelledby={ labelId } in={ isOpen } timeout="auto" unmountOnExit>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ControlFormLabel } from '@elementor/editor-controls';
|
|
2
3
|
import { __ } from '@wordpress/i18n';
|
|
3
4
|
|
|
4
5
|
import { useStyle } from '../../../contexts/style-context';
|
|
@@ -34,11 +35,11 @@ export const BorderField = () => {
|
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
37
|
<AddOrRemoveContent
|
|
37
|
-
label={ __( 'Border', 'elementor' ) }
|
|
38
38
|
isAdded={ hasBorder }
|
|
39
39
|
onAdd={ addBorder }
|
|
40
40
|
onRemove={ removeBorder }
|
|
41
41
|
disabled={ ! canEdit }
|
|
42
|
+
renderLabel={ () => <ControlFormLabel>{ __( 'Border', 'elementor' ) }</ControlFormLabel> }
|
|
42
43
|
>
|
|
43
44
|
<BorderWidthField />
|
|
44
45
|
<BorderColorField />
|
|
@@ -45,15 +45,15 @@ export const DimensionsField = () => {
|
|
|
45
45
|
};
|
|
46
46
|
const DimensionField = ( { side, label }: { side: Side; label: string } ) => {
|
|
47
47
|
return (
|
|
48
|
-
<
|
|
49
|
-
<Grid
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
48
|
+
<StylesField bind={ side }>
|
|
49
|
+
<Grid container gap={ 0.75 } alignItems="center">
|
|
50
|
+
<Grid item xs={ 12 }>
|
|
51
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
52
|
+
</Grid>
|
|
53
|
+
<Grid item xs={ 12 }>
|
|
54
54
|
<SizeControl startIcon={ sideIcons[ side ] } extendedValues={ [ 'auto' ] } />
|
|
55
|
-
</
|
|
55
|
+
</Grid>
|
|
56
56
|
</Grid>
|
|
57
|
-
</
|
|
57
|
+
</StylesField>
|
|
58
58
|
);
|
|
59
59
|
};
|
|
@@ -7,10 +7,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
|
|
8
8
|
import { StylesField, type StylesFieldProps } from '../../../controls-registry/styles-field';
|
|
9
9
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
|
-
import { CollapsibleContent } from '../../collapsible-content';
|
|
11
10
|
import { ControlLabel } from '../../control-label';
|
|
12
11
|
import { PanelDivider } from '../../panel-divider';
|
|
13
12
|
import { SectionContent } from '../../section-content';
|
|
13
|
+
import { StyleTabCollapsibleContent } from '../../style-tab-collapsible-content';
|
|
14
14
|
import { ObjectFitField } from './object-fit-field';
|
|
15
15
|
import { ObjectPositionField } from './object-position-field';
|
|
16
16
|
import { OverflowField } from './overflow-field';
|
|
@@ -61,7 +61,7 @@ export const SizeSection = () => {
|
|
|
61
61
|
<OverflowField />
|
|
62
62
|
</Stack>
|
|
63
63
|
{ isVersion330Active && (
|
|
64
|
-
<
|
|
64
|
+
<StyleTabCollapsibleContent fields={ [ 'aspect-ratio', 'object-fit' ] }>
|
|
65
65
|
<Stack gap={ 2 }>
|
|
66
66
|
<StylesField bind={ 'aspect-ratio' }>
|
|
67
67
|
<AspectRatioControl label={ __( 'Aspect Ratio', 'elementor' ) } />
|
|
@@ -74,7 +74,7 @@ export const SizeSection = () => {
|
|
|
74
74
|
</Grid>
|
|
75
75
|
) }
|
|
76
76
|
</Stack>
|
|
77
|
-
</
|
|
77
|
+
</StyleTabCollapsibleContent>
|
|
78
78
|
) }
|
|
79
79
|
</SectionContent>
|
|
80
80
|
);
|
|
@@ -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
|
};
|
|
@@ -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 = {
|
|
@@ -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/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';
|