@elementor/editor-editing-panel 1.0.0 → 1.2.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 +70 -0
- package/dist/index.d.mts +10 -19
- package/dist/index.d.ts +10 -19
- package/dist/index.js +1539 -1754
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1534 -1723
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- 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.tsx +131 -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 +122 -0
- package/src/components/multi-combobox/types.ts +28 -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/align-items-field.tsx +92 -0
- package/src/components/style-sections/layout-section/display-field.tsx +32 -0
- package/src/components/style-sections/layout-section/flex-direction-field.tsx +64 -0
- package/src/components/style-sections/layout-section/flex-order-field.tsx +114 -0
- package/src/components/style-sections/layout-section/justify-content-field.tsx +109 -0
- package/src/components/style-sections/layout-section/layout-section.tsx +36 -0
- package/src/components/style-sections/layout-section/wrap-field.tsx +52 -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 +42 -7
- 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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel } from '@elementor/editor-controls';
|
|
3
|
+
import { Divider, Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
7
|
+
import { AlignItemsField } from './align-items-field';
|
|
8
|
+
import { DisplayField } from './display-field';
|
|
9
|
+
import { FlexDirectionField } from './flex-direction-field';
|
|
10
|
+
import { FlexOrderField } from './flex-order-field';
|
|
11
|
+
import { JustifyContentField } from './justify-content-field';
|
|
12
|
+
import { WrapField } from './wrap-field';
|
|
13
|
+
|
|
14
|
+
export const LayoutSection = () => {
|
|
15
|
+
const [ display ] = useStylesField( 'display' );
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Stack gap={ 2 }>
|
|
19
|
+
<DisplayField />
|
|
20
|
+
{ 'flex' === display && <FlexFields /> }
|
|
21
|
+
</Stack>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const FlexFields = () => (
|
|
26
|
+
<>
|
|
27
|
+
<FlexDirectionField />
|
|
28
|
+
<JustifyContentField />
|
|
29
|
+
<AlignItemsField />
|
|
30
|
+
<Divider />
|
|
31
|
+
<WrapField />
|
|
32
|
+
<Divider />
|
|
33
|
+
<ControlLabel>{ __( 'Flex child', 'elementor' ) }</ControlLabel>
|
|
34
|
+
<FlexOrderField />
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { ArrowBackIcon, ArrowForwardIcon, ArrowRightIcon } from '@elementor/icons';
|
|
4
|
+
import { DirectionProvider, Grid, ThemeProvider } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
import { useDirection } from '../../../hooks/use-direction';
|
|
9
|
+
|
|
10
|
+
type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
11
|
+
|
|
12
|
+
const options: ToggleButtonGroupItem< FlexWrap >[] = [
|
|
13
|
+
{
|
|
14
|
+
value: 'nowrap',
|
|
15
|
+
label: __( 'No wrap', 'elementor' ),
|
|
16
|
+
renderContent: ( { size } ) => <ArrowRightIcon fontSize={ size } />,
|
|
17
|
+
showTooltip: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 'wrap',
|
|
21
|
+
label: __( 'Wrap', 'elementor' ),
|
|
22
|
+
renderContent: ( { size } ) => <ArrowBackIcon fontSize={ size } />,
|
|
23
|
+
showTooltip: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: 'wrap-reverse',
|
|
27
|
+
label: __( 'Wrap reverse', 'elementor' ),
|
|
28
|
+
renderContent: ( { size } ) => <ArrowForwardIcon fontSize={ size } />,
|
|
29
|
+
showTooltip: true,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const WrapField = () => {
|
|
34
|
+
const { isSiteRtl } = useDirection();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<DirectionProvider rtl={ isSiteRtl }>
|
|
38
|
+
<ThemeProvider>
|
|
39
|
+
<StylesField bind={ 'flex-wrap' }>
|
|
40
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
41
|
+
<Grid item xs={ 6 }>
|
|
42
|
+
<ControlLabel>{ __( 'Wrap', 'elementor' ) }</ControlLabel>
|
|
43
|
+
</Grid>
|
|
44
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
45
|
+
<ToggleControl options={ options } />
|
|
46
|
+
</Grid>
|
|
47
|
+
</Grid>
|
|
48
|
+
</StylesField>
|
|
49
|
+
</ThemeProvider>
|
|
50
|
+
</DirectionProvider>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, FontFamilyControl } from '@elementor/editor-controls';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { getElementorConfig } from '../../../sync/get-elementor-config';
|
|
8
|
+
|
|
9
|
+
export const FontFamilyField = () => {
|
|
10
|
+
const fontFamilies = getFontFamilies();
|
|
11
|
+
|
|
12
|
+
if ( ! fontFamilies ) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<StylesField bind="font-family">
|
|
18
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
19
|
+
<Grid item xs={ 6 }>
|
|
20
|
+
<ControlLabel>{ __( 'Font Family', 'elementor' ) }</ControlLabel>
|
|
21
|
+
</Grid>
|
|
22
|
+
<Grid item xs={ 6 }>
|
|
23
|
+
<FontFamilyControl fontFamilies={ fontFamilies } />
|
|
24
|
+
</Grid>
|
|
25
|
+
</Grid>
|
|
26
|
+
</StylesField>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getFontFamilies = () => {
|
|
31
|
+
const { controls } = getElementorConfig();
|
|
32
|
+
|
|
33
|
+
const options = controls?.font?.options;
|
|
34
|
+
|
|
35
|
+
if ( ! options ) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return options;
|
|
40
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ControlLabel, SizeControl } 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 { SizeControl } from '../../../controls';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
export const FontSizeField = () => {
|
|
9
9
|
return (
|
|
10
10
|
<StylesField bind="font-size">
|
|
11
|
-
<Grid container
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
12
|
<Grid item xs={ 6 }>
|
|
13
13
|
<ControlLabel>{ __( 'Font Size', 'elementor' ) }</ControlLabel>
|
|
14
14
|
</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 { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
4
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
-
import { SelectControl } from '../../../controls';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
const fontWeightOptions = [
|
|
9
9
|
{ label: __( 'Light - 400', 'elementor' ), value: '400' },
|
|
@@ -16,7 +16,7 @@ const fontWeightOptions = [
|
|
|
16
16
|
export const FontWeightField = () => {
|
|
17
17
|
return (
|
|
18
18
|
<StylesField bind="font-weight">
|
|
19
|
-
<Grid container
|
|
19
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
20
20
|
<Grid item xs={ 6 }>
|
|
21
21
|
<ControlLabel>{ __( 'Font Weight', 'elementor' ) }</ControlLabel>
|
|
22
22
|
</Grid>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ControlLabel, SizeControl } 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 { SizeControl } from '../../../controls';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
export const LetterSpacingField = () => {
|
|
9
9
|
return (
|
|
10
10
|
<StylesField bind="letter-spacing">
|
|
11
|
-
<Grid container
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
12
|
<Grid item xs={ 6 }>
|
|
13
13
|
<ControlLabel>{ __( 'Letter Spacing', '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 { AlignCenterIcon, AlignJustifiedIcon, AlignLeftIcon, AlignRightIcon } from '@elementor/icons';
|
|
3
4
|
import { Grid } from '@elementor/ui';
|
|
4
|
-
import {
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
5
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { ToggleControl, ToggleButtonGroupItem } from '../../../controls';
|
|
7
|
-
import { ControlLabel } from '../../control-label';
|
|
8
8
|
|
|
9
9
|
type Alignments = 'left' | 'center' | 'right' | 'justify';
|
|
10
10
|
|
|
@@ -12,29 +12,29 @@ const options: ToggleButtonGroupItem< Alignments >[] = [
|
|
|
12
12
|
{
|
|
13
13
|
value: 'left',
|
|
14
14
|
label: __( 'Left', 'elementor' ),
|
|
15
|
-
|
|
15
|
+
renderContent: ( { size } ) => <AlignLeftIcon fontSize={ size } />,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
value: 'center',
|
|
19
19
|
label: __( 'Center', 'elementor' ),
|
|
20
|
-
|
|
20
|
+
renderContent: ( { size } ) => <AlignCenterIcon fontSize={ size } />,
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
value: 'right',
|
|
24
24
|
label: __( 'Right', 'elementor' ),
|
|
25
|
-
|
|
25
|
+
renderContent: ( { size } ) => <AlignRightIcon fontSize={ size } />,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
value: 'justify',
|
|
29
29
|
label: __( 'Justify', 'elementor' ),
|
|
30
|
-
|
|
30
|
+
renderContent: ( { size } ) => <AlignJustifiedIcon fontSize={ size } />,
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
export const TextAlignmentField = () => {
|
|
35
35
|
return (
|
|
36
36
|
<StylesField bind={ 'text-align' }>
|
|
37
|
-
<Grid container
|
|
37
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
38
38
|
<Grid item xs={ 6 }>
|
|
39
39
|
<ControlLabel>{ __( 'Alignment', 'elementor' ) }</ControlLabel>
|
|
40
40
|
</Grid>
|
|
@@ -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 { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
4
6
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
-
import { ColorControl } from '../../../controls';
|
|
6
|
-
import { ControlLabel } from '../../control-label';
|
|
7
7
|
|
|
8
8
|
export const TextColorField = () => {
|
|
9
9
|
return (
|
|
10
10
|
<StylesField bind="color">
|
|
11
|
-
<Grid container
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
12
|
<Grid item xs={ 6 }>
|
|
13
13
|
<ControlLabel>{ __( 'Text Color', 'elementor' ) }</ControlLabel>
|
|
14
14
|
</Grid>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
4
3
|
import { TextDirectionLtrIcon, TextDirectionRtlIcon } from '@elementor/icons';
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
5
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { ToggleControl, ToggleButtonGroupItem } from '../../../controls';
|
|
7
|
-
import { ControlLabel } from '../../control-label';
|
|
8
8
|
|
|
9
9
|
type Direction = 'ltr' | 'rtl';
|
|
10
10
|
|
|
@@ -12,19 +12,19 @@ const options: ToggleButtonGroupItem< Direction >[] = [
|
|
|
12
12
|
{
|
|
13
13
|
value: 'ltr',
|
|
14
14
|
label: __( 'Left to Right', 'elementor' ),
|
|
15
|
-
|
|
15
|
+
renderContent: ( { size } ) => <TextDirectionLtrIcon fontSize={ size } />,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
value: 'rtl',
|
|
19
19
|
label: __( 'Right to Left', 'elementor' ),
|
|
20
|
-
|
|
20
|
+
renderContent: ( { size } ) => <TextDirectionRtlIcon fontSize={ size } />,
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
export const TextDirectionField = () => {
|
|
25
25
|
return (
|
|
26
26
|
<StylesField bind={ 'direction' }>
|
|
27
|
-
<Grid container
|
|
27
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
28
28
|
<Grid item xs={ 6 }>
|
|
29
29
|
<ControlLabel>{ __( 'Direction', 'elementor' ) }</ControlLabel>
|
|
30
30
|
</Grid>
|