@elementor/editor-editing-panel 1.0.0 → 1.1.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 +46 -0
- package/dist/index.d.mts +10 -19
- package/dist/index.d.ts +10 -19
- package/dist/index.js +1283 -1751
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1305 -1762
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/add-or-remove-content.tsx +3 -3
- package/src/components/collapse-icon.tsx +12 -0
- package/src/components/collapsible-content.tsx +5 -14
- package/src/components/collapsible-field.tsx +5 -3
- package/src/components/css-class-selector-section.tsx +76 -0
- package/src/components/editing-panel-hooks.tsx +2 -0
- package/src/components/editing-panel-tabs.tsx +23 -13
- package/src/components/editing-panel.tsx +9 -6
- package/src/components/multi-combobox/index.ts +3 -0
- package/src/components/multi-combobox/multi-combobox.tsx +120 -0
- package/src/components/multi-combobox/types.ts +26 -0
- package/src/components/multi-combobox/use-combobox-actions.ts +62 -0
- package/src/components/section.tsx +37 -0
- package/src/components/sections-list.tsx +6 -0
- package/src/components/settings-tab.tsx +11 -11
- package/src/components/style-sections/background-section/background-color-field.tsx +4 -4
- package/src/components/style-sections/background-section/background-section.tsx +9 -7
- package/src/components/style-sections/border-section/border-color-field.tsx +4 -4
- package/src/components/style-sections/border-section/border-field.tsx +4 -3
- package/src/components/style-sections/border-section/border-radius-field.tsx +4 -3
- package/src/components/style-sections/border-section/border-section.tsx +7 -10
- package/src/components/style-sections/border-section/border-style-field.tsx +4 -4
- package/src/components/style-sections/border-section/border-width-field.tsx +4 -3
- package/src/components/style-sections/effects-section/effects-section.tsx +7 -10
- package/src/components/style-sections/layout-section/display-field.tsx +32 -0
- package/src/components/style-sections/layout-section/justify-content-field.tsx +82 -0
- package/src/components/style-sections/layout-section/layout-section.tsx +17 -0
- package/src/components/style-sections/layout-section/utils/rotate-flex-icon.ts +12 -0
- package/src/components/style-sections/position-section/dimensions-field.tsx +6 -6
- package/src/components/style-sections/position-section/position-field.tsx +4 -4
- package/src/components/style-sections/position-section/position-section.tsx +45 -15
- package/src/components/style-sections/position-section/z-index-field.tsx +4 -4
- package/src/components/style-sections/size-section/overflow-field.tsx +8 -8
- package/src/components/style-sections/size-section/size-section.tsx +33 -26
- package/src/components/style-sections/spacing-section/spacing-section.tsx +11 -13
- package/src/components/style-sections/typography-section/font-family-field.tsx +40 -0
- package/src/components/style-sections/typography-section/font-size-field.tsx +4 -4
- package/src/components/style-sections/typography-section/font-weight-field.tsx +4 -4
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +9 -9
- package/src/components/style-sections/typography-section/text-color-field.tsx +4 -4
- package/src/components/style-sections/typography-section/text-direction-field.tsx +7 -7
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +3 -3
- package/src/components/style-sections/typography-section/text-style-field.tsx +5 -4
- package/src/components/style-sections/typography-section/transform-field.tsx +23 -9
- package/src/components/style-sections/typography-section/typography-section.tsx +26 -27
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +4 -4
- package/src/components/style-tab.tsx +67 -31
- package/src/contexts/classes-prop-context.tsx +1 -1
- package/src/contexts/element-context.tsx +2 -2
- package/src/contexts/style-context.tsx +6 -5
- package/src/control-replacement.tsx +1 -1
- package/src/controls-actions.ts +3 -2
- package/src/controls-registry/control-type-container.tsx +3 -2
- package/src/controls-registry/control.tsx +2 -1
- package/src/controls-registry/controls-registry.tsx +8 -1
- package/src/controls-registry/settings-field.tsx +5 -4
- package/src/controls-registry/styles-field.tsx +3 -2
- package/src/dynamics/components/dynamic-selection-control.tsx +15 -14
- package/src/dynamics/components/dynamic-selection.tsx +9 -8
- package/src/dynamics/dynamic-control.tsx +4 -4
- package/src/dynamics/hooks/use-dynamic-tag.ts +3 -2
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +6 -5
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +3 -2
- package/src/dynamics/init.ts +5 -3
- package/src/dynamics/sync/get-elementor-config.ts +1 -1
- package/src/dynamics/types.ts +2 -2
- package/src/dynamics/utils.ts +3 -2
- package/src/hooks/use-close-editor-panel.ts +23 -0
- package/src/hooks/use-direction.ts +13 -0
- package/src/hooks/use-open-editor-panel.ts +4 -3
- package/src/hooks/use-prop-value-history.ts +45 -0
- package/src/hooks/use-style-prop-history.ts +75 -0
- package/src/hooks/use-styles-field.ts +25 -4
- package/src/index.ts +1 -1
- package/src/init.ts +5 -4
- package/src/panel.ts +1 -0
- package/src/popover-action.tsx +1 -1
- package/src/sync/enqueue-font.ts +7 -0
- package/src/sync/get-elementor-config.ts +7 -0
- package/src/sync/{should-use-v2-panel.ts → is-atomic-widget-selected.ts} +1 -1
- package/src/sync/types.ts +20 -21
- package/src/components/accordion-section.tsx +0 -26
- package/src/components/control-label.tsx +0 -10
- package/src/controls/bound-prop-context.tsx +0 -30
- package/src/controls/components/control-toggle-button-group.tsx +0 -68
- package/src/controls/components/repeater.tsx +0 -197
- package/src/controls/components/text-field-inner-selection.tsx +0 -75
- package/src/controls/control-actions/control-actions-context.tsx +0 -27
- package/src/controls/control-actions/control-actions-menu.ts +0 -7
- package/src/controls/control-actions/control-actions.tsx +0 -31
- package/src/controls/controls/box-shadow-repeater-control.tsx +0 -210
- package/src/controls/controls/color-control.tsx +0 -25
- package/src/controls/controls/equal-unequal-sizes-control.tsx +0 -196
- package/src/controls/controls/image-control.tsx +0 -58
- package/src/controls/controls/image-media-control.tsx +0 -64
- package/src/controls/controls/linked-dimensions-control.tsx +0 -139
- package/src/controls/controls/number-control.tsx +0 -29
- package/src/controls/controls/select-control.tsx +0 -30
- package/src/controls/controls/size-control.tsx +0 -71
- package/src/controls/controls/stroke-control.tsx +0 -105
- package/src/controls/controls/text-area-control.tsx +0 -31
- package/src/controls/controls/text-control.tsx +0 -17
- package/src/controls/controls/toggle-control.tsx +0 -26
- package/src/controls/create-control-replacement.tsx +0 -53
- package/src/controls/create-control.tsx +0 -40
- package/src/controls/hooks/use-sync-external-state.tsx +0 -51
- package/src/controls/index.ts +0 -24
- package/src/dynamics/hooks/use-prop-value-history.ts +0 -26
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ColorControl, ControlLabel } from '@elementor/editor-controls';
|
|
3
3
|
import { Grid } from '@elementor/ui';
|
|
4
|
-
import {
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
5
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
export const BorderColorField = () => {
|
|
9
9
|
return (
|
|
10
10
|
<StylesField bind={ 'border-color' }>
|
|
11
|
-
<Grid container
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
12
|
<Grid item xs={ 6 }>
|
|
13
13
|
<ControlLabel>{ __( 'Border Color', 'elementor' ) }</ControlLabel>
|
|
14
14
|
</Grid>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
5
|
+
import { AddOrRemoveContent } from '../../add-or-remove-content';
|
|
4
6
|
import { BorderColorField } from './border-color-field';
|
|
5
7
|
import { BorderStyleField } from './border-style-field';
|
|
6
|
-
import {
|
|
7
|
-
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
|
+
import { BorderWidthField } from './border-width-field';
|
|
8
9
|
|
|
9
10
|
const initialSize = { $$type: 'size', value: { size: 1, unit: 'px' } };
|
|
10
11
|
const initialBorderWidth = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type EqualUnequalItems, EqualUnequalSizesControl } from '@elementor/editor-controls';
|
|
3
|
+
import type { BorderRadiusPropValue } from '@elementor/editor-props';
|
|
3
4
|
import {
|
|
4
5
|
BorderCornersIcon,
|
|
5
6
|
RadiusBottomLeftIcon,
|
|
@@ -7,8 +8,8 @@ import {
|
|
|
7
8
|
RadiusTopLeftIcon,
|
|
8
9
|
RadiusTopRightIcon,
|
|
9
10
|
} from '@elementor/icons';
|
|
10
|
-
import
|
|
11
|
-
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
|
|
12
13
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
14
|
|
|
14
15
|
const corners: EqualUnequalItems< BorderRadiusPropValue[ '$$type' ], BorderRadiusPropValue > = [
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AccordionSection } from '../../accordion-section';
|
|
3
2
|
import { Divider, Stack } from '@elementor/ui';
|
|
4
|
-
|
|
5
|
-
import { BorderRadiusField } from './border-radius-field';
|
|
3
|
+
|
|
6
4
|
import { BorderField } from './border-field';
|
|
5
|
+
import { BorderRadiusField } from './border-radius-field';
|
|
7
6
|
|
|
8
7
|
export const BorderSection = () => (
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</Stack>
|
|
15
|
-
</AccordionSection>
|
|
8
|
+
<Stack gap={ 1.5 }>
|
|
9
|
+
<BorderRadiusField />
|
|
10
|
+
<Divider />
|
|
11
|
+
<BorderField />
|
|
12
|
+
</Stack>
|
|
16
13
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectControl } from '../../../controls';
|
|
2
|
+
import { ControlLabel, SelectControl } from '@elementor/editor-controls';
|
|
4
3
|
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
5
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
const borderStyles = [
|
|
9
9
|
{ value: 'none', label: __( 'None', 'elementor' ) },
|
|
@@ -19,7 +19,7 @@ const borderStyles = [
|
|
|
19
19
|
export const BorderStyleField = () => {
|
|
20
20
|
return (
|
|
21
21
|
<StylesField bind={ 'border-style' }>
|
|
22
|
-
<Grid container
|
|
22
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
23
23
|
<Grid item xs={ 6 }>
|
|
24
24
|
<ControlLabel>{ __( 'Border Type', 'elementor' ) }</ControlLabel>
|
|
25
25
|
</Grid>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type EqualUnequalItems, EqualUnequalSizesControl } from '@elementor/editor-controls';
|
|
3
|
+
import { type BorderWidthPropValue } from '@elementor/editor-props';
|
|
4
|
+
import { SideAllIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
3
5
|
import { __ } from '@wordpress/i18n';
|
|
4
|
-
|
|
5
|
-
import { EqualUnequalItems, EqualUnequalSizesControl } from '../../../controls/controls/equal-unequal-sizes-control';
|
|
6
|
+
|
|
6
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
8
|
|
|
8
9
|
const edges: EqualUnequalItems< BorderWidthPropValue[ '$$type' ], BorderWidthPropValue > = [
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BoxShadowRepeaterControl } from '@elementor/editor-controls';
|
|
3
3
|
import { Stack } from '@elementor/ui';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { BoxShadowRepeaterControl } from '../../../controls';
|
|
7
6
|
|
|
8
7
|
export const EffectsSection = () => {
|
|
9
8
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</Stack>
|
|
16
|
-
</AccordionSection>
|
|
9
|
+
<Stack gap={ 1.5 }>
|
|
10
|
+
<StylesField bind="box-shadow">
|
|
11
|
+
<BoxShadowRepeaterControl />
|
|
12
|
+
</StylesField>
|
|
13
|
+
</Stack>
|
|
17
14
|
);
|
|
18
15
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
|
|
8
|
+
type Displays = 'block' | 'flex';
|
|
9
|
+
|
|
10
|
+
export const DisplayField = () => {
|
|
11
|
+
const options: ToggleButtonGroupItem< Displays >[] = [
|
|
12
|
+
{
|
|
13
|
+
value: 'block',
|
|
14
|
+
renderContent: () => __( 'Block', 'elementor' ),
|
|
15
|
+
label: __( 'Block', 'elementor' ),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: 'flex',
|
|
19
|
+
renderContent: () => __( 'Flex', 'elementor' ),
|
|
20
|
+
label: __( 'Flex', 'elementor' ),
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<StylesField bind="display">
|
|
26
|
+
<Stack gap={ 1 }>
|
|
27
|
+
<ControlLabel>{ __( 'Display', 'elementor' ) }</ControlLabel>
|
|
28
|
+
<ToggleControl options={ options } fullWidth={ true } />
|
|
29
|
+
</Stack>
|
|
30
|
+
</StylesField>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import {
|
|
4
|
+
JustifyBottomIcon,
|
|
5
|
+
JustifyCenterIcon,
|
|
6
|
+
JustifyDistributeVerticalIcon,
|
|
7
|
+
JustifySpaceAroundVerticalIcon,
|
|
8
|
+
JustifySpaceBetweenVerticalIcon,
|
|
9
|
+
JustifyTopIcon,
|
|
10
|
+
} from '@elementor/icons';
|
|
11
|
+
import { Stack } from '@elementor/ui';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
|
|
14
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
15
|
+
import { useDirection } from '../../../hooks/use-direction';
|
|
16
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
17
|
+
import { rotateFlexIcon } from './utils/rotate-flex-icon';
|
|
18
|
+
|
|
19
|
+
type JustifyContent = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
20
|
+
|
|
21
|
+
export const JustifyContentField = () => {
|
|
22
|
+
const [ direction ] = useStylesField( 'flex-direction' );
|
|
23
|
+
|
|
24
|
+
const { isUiRtl, isSiteRtl } = useDirection(),
|
|
25
|
+
sx = { transform: rotateFlexIcon( direction as string, -1 ) } as const,
|
|
26
|
+
shouldReverseOrder = isSiteRtl !== isUiRtl;
|
|
27
|
+
|
|
28
|
+
const StartIcon = isSiteRtl ? JustifyBottomIcon : JustifyTopIcon,
|
|
29
|
+
EndIcon = isSiteRtl ? JustifyTopIcon : JustifyBottomIcon;
|
|
30
|
+
|
|
31
|
+
const options: ToggleButtonGroupItem< JustifyContent >[] = [
|
|
32
|
+
{
|
|
33
|
+
value: 'start',
|
|
34
|
+
label: __( 'Start', 'elementor' ),
|
|
35
|
+
renderContent: ( { size } ) => <StartIcon fontSize={ size } sx={ sx } />,
|
|
36
|
+
showTooltip: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 'center',
|
|
40
|
+
label: __( 'Center', 'elementor' ),
|
|
41
|
+
renderContent: ( { size } ) => <JustifyCenterIcon fontSize={ size } sx={ sx } />,
|
|
42
|
+
showTooltip: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: 'end',
|
|
46
|
+
label: __( 'End', 'elementor' ),
|
|
47
|
+
renderContent: ( { size } ) => <EndIcon fontSize={ size } sx={ sx } />,
|
|
48
|
+
showTooltip: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'space-between',
|
|
52
|
+
label: __( 'Space Between', 'elementor' ),
|
|
53
|
+
renderContent: ( { size } ) => <JustifySpaceBetweenVerticalIcon fontSize={ size } sx={ sx } />,
|
|
54
|
+
showTooltip: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: 'space-around',
|
|
58
|
+
label: __( 'Space Around', 'elementor' ),
|
|
59
|
+
renderContent: ( { size } ) => <JustifySpaceAroundVerticalIcon fontSize={ size } sx={ sx } />,
|
|
60
|
+
showTooltip: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: 'space-evenly',
|
|
64
|
+
label: __( 'Space Evenly', 'elementor' ),
|
|
65
|
+
renderContent: ( { size } ) => <JustifyDistributeVerticalIcon fontSize={ size } sx={ sx } />,
|
|
66
|
+
showTooltip: true,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
if ( shouldReverseOrder ) {
|
|
71
|
+
options.reverse();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<StylesField bind="justify-content">
|
|
76
|
+
<Stack gap={ 1 }>
|
|
77
|
+
<ControlLabel>{ __( 'Justify Content', 'elementor' ) }</ControlLabel>
|
|
78
|
+
<ToggleControl options={ options } fullWidth={ true } />
|
|
79
|
+
</Stack>
|
|
80
|
+
</StylesField>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Stack } from '@elementor/ui';
|
|
3
|
+
|
|
4
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
5
|
+
import { DisplayField } from './display-field';
|
|
6
|
+
import { JustifyContentField } from './justify-content-field';
|
|
7
|
+
|
|
8
|
+
export const LayoutSection = () => {
|
|
9
|
+
const [ display ] = useStylesField( 'display' );
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Stack gap={ 2 }>
|
|
13
|
+
<DisplayField />
|
|
14
|
+
{ 'flex' === display && <JustifyContentField /> }
|
|
15
|
+
</Stack>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function rotateFlexIcon( direction: string | null = 'row', initValue: number ) {
|
|
2
|
+
const rotationIndexMap: Record< string, number > = {
|
|
3
|
+
row: 0,
|
|
4
|
+
column: 1,
|
|
5
|
+
'row-reverse': 2,
|
|
6
|
+
'column-reverse': 3,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const rotationIndex = initValue + ( rotationIndexMap[ direction || 'row' ] ?? 0 );
|
|
10
|
+
|
|
11
|
+
return `rotate(calc(90deg * ${ rotationIndex }))`;
|
|
12
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } from '@elementor/editor-controls';
|
|
3
|
+
import { SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
2
4
|
import { Grid, Stack } from '@elementor/ui';
|
|
3
5
|
import { __ } from '@wordpress/i18n';
|
|
4
|
-
|
|
5
|
-
import { ControlLabel } from '../../control-label';
|
|
6
|
+
|
|
6
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import { SizeControl } from '../../../controls';
|
|
8
8
|
|
|
9
9
|
export type Side = 'left' | 'right' | 'top' | 'bottom';
|
|
10
10
|
|
|
@@ -18,11 +18,11 @@ const sideIcons = {
|
|
|
18
18
|
export const DimensionsField = () => {
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
|
-
<Stack direction="row" gap={ 2 }>
|
|
21
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
22
22
|
<DimensionField side="top" label={ __( 'Top', 'elementor' ) } />
|
|
23
23
|
<DimensionField side="right" label={ __( 'Right', 'elementor' ) } />
|
|
24
24
|
</Stack>
|
|
25
|
-
<Stack direction="row" gap={ 2 }>
|
|
25
|
+
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
26
26
|
<DimensionField side="bottom" label={ __( 'Bottom', 'elementor' ) } />
|
|
27
27
|
<DimensionField side="left" label={ __( 'Left', 'elementor' ) } />
|
|
28
28
|
</Stack>
|
|
@@ -32,7 +32,7 @@ export const DimensionsField = () => {
|
|
|
32
32
|
|
|
33
33
|
const DimensionField = ( { side, label }: { side: Side; label: string } ) => {
|
|
34
34
|
return (
|
|
35
|
-
<Grid container
|
|
35
|
+
<Grid container gap={ 1 } alignItems="center">
|
|
36
36
|
<Grid item xs={ 12 }>
|
|
37
37
|
<ControlLabel>{ label }</ControlLabel>
|
|
38
38
|
</Grid>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ControlLabel, SelectControl } from '@elementor/editor-controls';
|
|
3
3
|
import { Grid } from '@elementor/ui';
|
|
4
|
-
import {
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
5
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
const positionOptions = [
|
|
9
9
|
{ label: __( 'Static', 'elementor' ), value: 'static' },
|
|
@@ -15,7 +15,7 @@ const positionOptions = [
|
|
|
15
15
|
export const PositionField = () => {
|
|
16
16
|
return (
|
|
17
17
|
<StylesField bind="position">
|
|
18
|
-
<Grid container
|
|
18
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
19
19
|
<Grid item xs={ 6 }>
|
|
20
20
|
<ControlLabel>{ __( 'Position', 'elementor' ) }</ControlLabel>
|
|
21
21
|
</Grid>
|
|
@@ -1,28 +1,58 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import type { PropValue } from '@elementor/editor-props';
|
|
3
4
|
import { Stack } from '@elementor/ui';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { useStylePropsHistory } from '../../../hooks/use-style-prop-history';
|
|
7
7
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
8
|
import { DimensionsField } from './dimensions-field';
|
|
9
|
+
import { PositionField } from './position-field';
|
|
10
|
+
import { ZIndexField } from './z-index-field';
|
|
11
|
+
|
|
12
|
+
const dimensionsPropKeys = [ 'top', 'bottom', 'left', 'right' ];
|
|
9
13
|
|
|
10
14
|
export const PositionSection = () => {
|
|
11
15
|
const [ positionValue ] = useStylesField( 'position' );
|
|
16
|
+
usePositionChangeHandler();
|
|
12
17
|
|
|
13
18
|
const isNotStatic = positionValue && positionValue !== 'static';
|
|
14
19
|
|
|
15
20
|
return (
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
<Stack gap={ 1.5 }>
|
|
22
|
+
<PositionField />
|
|
23
|
+
{ isNotStatic ? (
|
|
24
|
+
<>
|
|
25
|
+
<DimensionsField />
|
|
26
|
+
<ZIndexField />
|
|
27
|
+
</>
|
|
28
|
+
) : null }
|
|
29
|
+
</Stack>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const usePositionChangeHandler = () => {
|
|
34
|
+
const dimensionsHistory = useStylePropsHistory( dimensionsPropKeys );
|
|
35
|
+
|
|
36
|
+
const onPositionChange = useCallback(
|
|
37
|
+
( newPositionValue: PropValue, previousPosition: PropValue ) => {
|
|
38
|
+
if ( ! dimensionsHistory ) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const { saveStylePropsHistory, updateStylePropsFromHistory, clearCurrentStyleProps } = dimensionsHistory;
|
|
43
|
+
|
|
44
|
+
if ( newPositionValue === 'static' ) {
|
|
45
|
+
saveStylePropsHistory();
|
|
46
|
+
clearCurrentStyleProps();
|
|
47
|
+
} else if ( previousPosition === 'static' ) {
|
|
48
|
+
updateStylePropsFromHistory();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
previousPosition = newPositionValue;
|
|
52
|
+
},
|
|
53
|
+
[ dimensionsHistory ]
|
|
27
54
|
);
|
|
55
|
+
|
|
56
|
+
const [ , , registerChangeListener ] = useStylesField< PropValue >( 'position' );
|
|
57
|
+
registerChangeListener?.( onPositionChange );
|
|
28
58
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ControlLabel, NumberControl } from '@elementor/editor-controls';
|
|
3
3
|
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
4
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
-
import { NumberControl } from '../../../controls';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
export const ZIndexField = () => {
|
|
9
9
|
return (
|
|
10
10
|
<StylesField bind="z-index">
|
|
11
|
-
<Grid container
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
12
|
<Grid item xs={ 6 }>
|
|
13
13
|
<ControlLabel>{ __( 'Z-Index', 'elementor' ) }</ControlLabel>
|
|
14
14
|
</Grid>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { ExpandBottomIcon, EyeIcon, EyeOffIcon } from '@elementor/icons';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
|
-
import {
|
|
5
|
-
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
6
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
import { ControlLabel } from '../../control-label';
|
|
8
8
|
|
|
9
9
|
type Overflows = 'visible' | 'hidden' | 'auto';
|
|
10
10
|
|
|
@@ -12,19 +12,19 @@ const options: ToggleButtonGroupItem< Overflows >[] = [
|
|
|
12
12
|
{
|
|
13
13
|
value: 'visible',
|
|
14
14
|
label: __( 'Visible', 'elementor' ),
|
|
15
|
-
|
|
15
|
+
renderContent: ( { size } ) => <EyeIcon fontSize={ size } />,
|
|
16
16
|
showTooltip: true,
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
value: 'hidden',
|
|
20
20
|
label: __( 'Hidden', 'elementor' ),
|
|
21
|
-
|
|
21
|
+
renderContent: ( { size } ) => <EyeOffIcon fontSize={ size } />,
|
|
22
22
|
showTooltip: true,
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
value: 'auto',
|
|
26
26
|
label: __( 'Auto', 'elementor' ),
|
|
27
|
-
|
|
27
|
+
renderContent: ( { size } ) => <ExpandBottomIcon fontSize={ size } />,
|
|
28
28
|
showTooltip: true,
|
|
29
29
|
},
|
|
30
30
|
];
|
|
@@ -32,7 +32,7 @@ const options: ToggleButtonGroupItem< Overflows >[] = [
|
|
|
32
32
|
export const OverflowField = () => {
|
|
33
33
|
return (
|
|
34
34
|
<StylesField bind={ 'overflow' }>
|
|
35
|
-
<Grid container
|
|
35
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
36
36
|
<Grid item xs={ 6 }>
|
|
37
37
|
<ControlLabel>{ __( 'Overflow', 'elementor' ) }</ControlLabel>
|
|
38
38
|
</Grid>
|
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } from '@elementor/editor-controls';
|
|
2
3
|
import { Divider, Grid, Stack } from '@elementor/ui';
|
|
3
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField, type StylesFieldProps } from '../../../controls-registry/styles-field';
|
|
4
7
|
import { OverflowField } from './overflow-field';
|
|
5
|
-
import { AccordionSection } from '../../accordion-section';
|
|
6
|
-
import { StylesField, StylesFieldProps } from '../../../controls-registry/styles-field';
|
|
7
|
-
import { ControlLabel } from '../../control-label';
|
|
8
|
-
import { SizeControl } from '../../../controls';
|
|
9
8
|
|
|
10
9
|
export const SizeSection = () => {
|
|
11
10
|
return (
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<Grid
|
|
11
|
+
<Stack gap={ 1.5 }>
|
|
12
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
13
|
+
<Grid item xs={ 6 }>
|
|
15
14
|
<SizeField bind="width" label={ __( 'Width', 'elementor' ) } />
|
|
15
|
+
</Grid>
|
|
16
|
+
<Grid item xs={ 6 }>
|
|
16
17
|
<SizeField bind="height" label={ __( 'Height', 'elementor' ) } />
|
|
17
18
|
</Grid>
|
|
18
|
-
|
|
19
|
+
</Grid>
|
|
20
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
21
|
+
<Grid item xs={ 6 }>
|
|
19
22
|
<SizeField bind="min-width" label={ __( 'Min. Width', 'elementor' ) } />
|
|
23
|
+
</Grid>
|
|
24
|
+
<Grid item xs={ 6 }>
|
|
20
25
|
<SizeField bind="min-height" label={ __( 'Min. Height', 'elementor' ) } />
|
|
21
26
|
</Grid>
|
|
22
|
-
|
|
27
|
+
</Grid>
|
|
28
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
29
|
+
<Grid item xs={ 6 }>
|
|
23
30
|
<SizeField bind="max-width" label={ __( 'Max. Width', 'elementor' ) } />
|
|
31
|
+
</Grid>
|
|
32
|
+
<Grid item xs={ 6 }>
|
|
24
33
|
<SizeField bind="max-height" label={ __( 'Max. Height', 'elementor' ) } />
|
|
25
34
|
</Grid>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
</Grid>
|
|
36
|
+
<Divider />
|
|
37
|
+
<Stack>
|
|
38
|
+
<OverflowField />
|
|
30
39
|
</Stack>
|
|
31
|
-
</
|
|
40
|
+
</Stack>
|
|
32
41
|
);
|
|
33
42
|
};
|
|
34
43
|
|
|
@@ -39,17 +48,15 @@ type ControlProps = {
|
|
|
39
48
|
|
|
40
49
|
const SizeField = ( { label, bind }: ControlProps ) => {
|
|
41
50
|
return (
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<Grid
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</StylesField>
|
|
53
|
-
</Grid>
|
|
51
|
+
<StylesField bind={ bind }>
|
|
52
|
+
<Grid container gap={ 1 } alignItems="center">
|
|
53
|
+
<Grid item xs={ 12 }>
|
|
54
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
55
|
+
</Grid>
|
|
56
|
+
<Grid item xs={ 12 }>
|
|
57
|
+
<SizeControl />
|
|
58
|
+
</Grid>
|
|
59
|
+
</Grid>
|
|
60
|
+
</StylesField>
|
|
54
61
|
);
|
|
55
62
|
};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkedDimensionsControl } from '@elementor/editor-controls';
|
|
3
3
|
import { Divider, Stack } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
5
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { LinkedDimensionsControl } from '../../../controls/controls/linked-dimensions-control';
|
|
7
7
|
|
|
8
8
|
export const SpacingSection = () => {
|
|
9
9
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</Stack>
|
|
20
|
-
</AccordionSection>
|
|
10
|
+
<Stack gap={ 1.5 }>
|
|
11
|
+
<StylesField bind={ 'padding' }>
|
|
12
|
+
<LinkedDimensionsControl label={ __( 'Padding', 'elementor' ) } />
|
|
13
|
+
</StylesField>
|
|
14
|
+
<Divider />
|
|
15
|
+
<StylesField bind={ 'margin' }>
|
|
16
|
+
<LinkedDimensionsControl label={ __( 'Margin', 'elementor' ) } />
|
|
17
|
+
</StylesField>
|
|
18
|
+
</Stack>
|
|
21
19
|
);
|
|
22
20
|
};
|