@elementor/editor-editing-panel 0.19.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 +97 -0
- package/dist/index.d.mts +10 -36
- package/dist/index.d.ts +10 -36
- package/dist/index.js +1256 -1445
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1311 -1482
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -14
- package/src/components/add-or-remove-content.tsx +42 -0
- package/src/components/collapse-icon.tsx +12 -0
- package/src/components/collapsible-content.tsx +5 -14
- package/src/components/collapsible-field.tsx +36 -0
- 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 +21 -21
- 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 +17 -16
- package/src/components/style-sections/background-section/background-color-field.tsx +21 -0
- package/src/components/style-sections/background-section/background-section.tsx +10 -8
- package/src/components/style-sections/border-section/border-color-field.tsx +21 -0
- package/src/components/style-sections/border-section/border-field.tsx +48 -0
- package/src/components/style-sections/border-section/border-radius-field.tsx +49 -0
- package/src/components/style-sections/border-section/border-section.tsx +13 -0
- package/src/components/style-sections/border-section/border-style-field.tsx +32 -0
- package/src/components/style-sections/border-section/border-width-field.tsx +43 -0
- package/src/components/style-sections/effects-section/effects-section.tsx +8 -11
- 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 +46 -0
- package/src/components/style-sections/position-section/position-field.tsx +28 -0
- package/src/components/style-sections/position-section/position-section.tsx +51 -8
- package/src/components/style-sections/position-section/z-index-field.tsx +21 -0
- package/src/components/style-sections/size-section/overflow-field.tsx +45 -0
- package/src/components/style-sections/size-section/size-section.tsx +62 -0
- package/src/components/style-sections/spacing-section/spacing-section.tsx +12 -14
- package/src/components/style-sections/typography-section/font-family-field.tsx +40 -0
- package/src/components/style-sections/typography-section/font-size-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{font-weight-control.tsx → font-weight-field.tsx} +9 -8
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +21 -0
- package/src/components/style-sections/typography-section/text-alignment-field.tsx +47 -0
- package/src/components/style-sections/typography-section/text-color-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{text-direction-control.tsx → text-direction-field.tsx} +12 -12
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +16 -0
- package/src/components/style-sections/typography-section/{text-style-control.tsx → text-style-field.tsx} +9 -8
- package/src/components/style-sections/typography-section/transform-field.tsx +40 -0
- package/src/components/style-sections/typography-section/typography-section.tsx +31 -30
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +21 -0
- package/src/components/style-tab.tsx +82 -29
- package/src/contexts/classes-prop-context.tsx +24 -0
- package/src/{controls/providers/element-provider.tsx → contexts/element-context.tsx} +3 -7
- package/src/contexts/style-context.tsx +10 -23
- package/src/control-replacement.tsx +1 -1
- package/src/{controls/control-actions/control-actions-menu.ts → controls-actions.ts} +2 -1
- package/src/{controls/components → controls-registry}/control-type-container.tsx +3 -2
- package/src/{controls → controls-registry}/control.tsx +2 -1
- package/src/{controls → controls-registry}/controls-registry.tsx +8 -6
- package/src/controls-registry/settings-field.tsx +36 -0
- package/src/controls-registry/styles-field.tsx +20 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +18 -17
- package/src/dynamics/components/dynamic-selection.tsx +10 -9
- package/src/dynamics/dynamic-control.tsx +7 -6
- package/src/dynamics/hooks/use-dynamic-tag.ts +3 -2
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +7 -6
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +3 -2
- package/src/dynamics/init.ts +3 -3
- package/src/dynamics/sync/get-elementor-config.ts +1 -1
- package/src/dynamics/types.ts +2 -2
- package/src/dynamics/utils.ts +3 -3
- 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 +51 -0
- package/src/index.ts +2 -3
- package/src/init.ts +5 -4
- package/src/panel.ts +1 -0
- package/src/{controls/control-actions/actions/popover-action.tsx → popover-action.tsx} +2 -2
- 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} +2 -3
- package/src/sync/types.ts +20 -21
- package/src/components/accordion-section.tsx +0 -25
- package/src/components/control-label.tsx +0 -10
- package/src/components/style-sections/background-section/background-color-control.tsx +0 -20
- package/src/components/style-sections/effects-section/box-shadow-repeater.tsx +0 -224
- package/src/components/style-sections/position-section/z-index-control.tsx +0 -20
- package/src/components/style-sections/size-section.tsx +0 -49
- package/src/components/style-sections/spacing-section/linked-dimensions-control.tsx +0 -155
- package/src/components/style-sections/typography-section/font-size-control.tsx +0 -20
- package/src/components/style-sections/typography-section/letter-spacing-control.tsx +0 -20
- package/src/components/style-sections/typography-section/text-alignment-control.tsx +0 -47
- package/src/components/style-sections/typography-section/text-color-control.tsx +0 -20
- package/src/components/style-sections/typography-section/transform-control.tsx +0 -25
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +0 -20
- package/src/controls/components/control-toggle-button-group.tsx +0 -59
- package/src/controls/components/repeater.tsx +0 -197
- package/src/controls/components/text-field-inner-selection.tsx +0 -79
- package/src/controls/control-actions/control-actions.tsx +0 -43
- package/src/controls/control-context.tsx +0 -22
- package/src/controls/control-replacement.ts +0 -34
- package/src/controls/control-types/color-control.tsx +0 -27
- package/src/controls/control-types/image-control.tsx +0 -66
- package/src/controls/control-types/image-media-control.tsx +0 -73
- package/src/controls/control-types/number-control.tsx +0 -29
- package/src/controls/control-types/select-control.tsx +0 -30
- package/src/controls/control-types/size-control.tsx +0 -71
- package/src/controls/control-types/text-area-control.tsx +0 -31
- package/src/controls/control-types/text-control.tsx +0 -17
- package/src/controls/control-types/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-style-control.ts +0 -29
- package/src/controls/hooks/use-sync-external-state.tsx +0 -51
- package/src/controls/hooks/use-widget-settings.ts +0 -16
- package/src/controls/props/is-transformable.ts +0 -13
- package/src/controls/props/types.ts +0 -51
- package/src/controls/settings-control.tsx +0 -37
- package/src/controls/style-control.tsx +0 -20
- package/src/controls/sync/get-container.ts +0 -8
- package/src/controls/sync/update-settings.ts +0 -14
- package/src/controls/types.ts +0 -39
- package/src/dynamics/hooks/use-prop-value-history.ts +0 -26
- package/src/hooks/use-element-style-prop.ts +0 -46
- package/src/hooks/use-element-styles.ts +0 -13
- package/src/hooks/use-element-type.ts +0 -33
- package/src/hooks/use-selected-elements.ts +0 -9
- package/src/sync/get-element-styles.ts +0 -9
- package/src/sync/get-selected-elements.ts +0 -21
- package/src/sync/get-widgets-cache.ts +0 -7
- package/src/sync/update-style.ts +0 -25
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, NumberControl } 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
|
+
|
|
8
|
+
export const ZIndexField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="z-index">
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Z-Index', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<NumberControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { ExpandBottomIcon, EyeIcon, EyeOffIcon } from '@elementor/icons';
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
|
|
9
|
+
type Overflows = 'visible' | 'hidden' | 'auto';
|
|
10
|
+
|
|
11
|
+
const options: ToggleButtonGroupItem< Overflows >[] = [
|
|
12
|
+
{
|
|
13
|
+
value: 'visible',
|
|
14
|
+
label: __( 'Visible', 'elementor' ),
|
|
15
|
+
renderContent: ( { size } ) => <EyeIcon fontSize={ size } />,
|
|
16
|
+
showTooltip: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: 'hidden',
|
|
20
|
+
label: __( 'Hidden', 'elementor' ),
|
|
21
|
+
renderContent: ( { size } ) => <EyeOffIcon fontSize={ size } />,
|
|
22
|
+
showTooltip: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: 'auto',
|
|
26
|
+
label: __( 'Auto', 'elementor' ),
|
|
27
|
+
renderContent: ( { size } ) => <ExpandBottomIcon fontSize={ size } />,
|
|
28
|
+
showTooltip: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const OverflowField = () => {
|
|
33
|
+
return (
|
|
34
|
+
<StylesField bind={ 'overflow' }>
|
|
35
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
36
|
+
<Grid item xs={ 6 }>
|
|
37
|
+
<ControlLabel>{ __( 'Overflow', 'elementor' ) }</ControlLabel>
|
|
38
|
+
</Grid>
|
|
39
|
+
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
40
|
+
<ToggleControl options={ options } />
|
|
41
|
+
</Grid>
|
|
42
|
+
</Grid>
|
|
43
|
+
</StylesField>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } from '@elementor/editor-controls';
|
|
3
|
+
import { Divider, Grid, Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField, type StylesFieldProps } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { OverflowField } from './overflow-field';
|
|
8
|
+
|
|
9
|
+
export const SizeSection = () => {
|
|
10
|
+
return (
|
|
11
|
+
<Stack gap={ 1.5 }>
|
|
12
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
13
|
+
<Grid item xs={ 6 }>
|
|
14
|
+
<SizeField bind="width" label={ __( 'Width', 'elementor' ) } />
|
|
15
|
+
</Grid>
|
|
16
|
+
<Grid item xs={ 6 }>
|
|
17
|
+
<SizeField bind="height" label={ __( 'Height', 'elementor' ) } />
|
|
18
|
+
</Grid>
|
|
19
|
+
</Grid>
|
|
20
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
21
|
+
<Grid item xs={ 6 }>
|
|
22
|
+
<SizeField bind="min-width" label={ __( 'Min. Width', 'elementor' ) } />
|
|
23
|
+
</Grid>
|
|
24
|
+
<Grid item xs={ 6 }>
|
|
25
|
+
<SizeField bind="min-height" label={ __( 'Min. Height', 'elementor' ) } />
|
|
26
|
+
</Grid>
|
|
27
|
+
</Grid>
|
|
28
|
+
<Grid container gap={ 2 } flexWrap="nowrap">
|
|
29
|
+
<Grid item xs={ 6 }>
|
|
30
|
+
<SizeField bind="max-width" label={ __( 'Max. Width', 'elementor' ) } />
|
|
31
|
+
</Grid>
|
|
32
|
+
<Grid item xs={ 6 }>
|
|
33
|
+
<SizeField bind="max-height" label={ __( 'Max. Height', 'elementor' ) } />
|
|
34
|
+
</Grid>
|
|
35
|
+
</Grid>
|
|
36
|
+
<Divider />
|
|
37
|
+
<Stack>
|
|
38
|
+
<OverflowField />
|
|
39
|
+
</Stack>
|
|
40
|
+
</Stack>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type ControlProps = {
|
|
45
|
+
bind: StylesFieldProps[ 'bind' ];
|
|
46
|
+
label: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const SizeField = ( { label, bind }: ControlProps ) => {
|
|
50
|
+
return (
|
|
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>
|
|
61
|
+
);
|
|
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
|
-
|
|
6
|
-
import {
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } 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
|
+
|
|
8
|
+
export const FontSizeField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="font-size">
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Font Size', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<SizeControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -1,8 +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 {
|
|
5
|
-
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
7
|
|
|
7
8
|
const fontWeightOptions = [
|
|
8
9
|
{ label: __( 'Light - 400', 'elementor' ), value: '400' },
|
|
@@ -12,17 +13,17 @@ const fontWeightOptions = [
|
|
|
12
13
|
{ label: __( 'Black - 900', 'elementor' ), value: '900' },
|
|
13
14
|
];
|
|
14
15
|
|
|
15
|
-
export const
|
|
16
|
+
export const FontWeightField = () => {
|
|
16
17
|
return (
|
|
17
|
-
<
|
|
18
|
-
<Grid container
|
|
18
|
+
<StylesField bind="font-weight">
|
|
19
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
19
20
|
<Grid item xs={ 6 }>
|
|
20
|
-
<
|
|
21
|
+
<ControlLabel>{ __( 'Font Weight', 'elementor' ) }</ControlLabel>
|
|
21
22
|
</Grid>
|
|
22
23
|
<Grid item xs={ 6 }>
|
|
23
24
|
<SelectControl options={ fontWeightOptions } />
|
|
24
25
|
</Grid>
|
|
25
26
|
</Grid>
|
|
26
|
-
</
|
|
27
|
+
</StylesField>
|
|
27
28
|
);
|
|
28
29
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } 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
|
+
|
|
8
|
+
export const LetterSpacingField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="letter-spacing">
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Letter Spacing', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<SizeControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { AlignCenterIcon, AlignJustifiedIcon, AlignLeftIcon, AlignRightIcon } from '@elementor/icons';
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
|
|
9
|
+
type Alignments = 'left' | 'center' | 'right' | 'justify';
|
|
10
|
+
|
|
11
|
+
const options: ToggleButtonGroupItem< Alignments >[] = [
|
|
12
|
+
{
|
|
13
|
+
value: 'left',
|
|
14
|
+
label: __( 'Left', 'elementor' ),
|
|
15
|
+
renderContent: ( { size } ) => <AlignLeftIcon fontSize={ size } />,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: 'center',
|
|
19
|
+
label: __( 'Center', 'elementor' ),
|
|
20
|
+
renderContent: ( { size } ) => <AlignCenterIcon fontSize={ size } />,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: 'right',
|
|
24
|
+
label: __( 'Right', 'elementor' ),
|
|
25
|
+
renderContent: ( { size } ) => <AlignRightIcon fontSize={ size } />,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'justify',
|
|
29
|
+
label: __( 'Justify', 'elementor' ),
|
|
30
|
+
renderContent: ( { size } ) => <AlignJustifiedIcon fontSize={ size } />,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const TextAlignmentField = () => {
|
|
35
|
+
return (
|
|
36
|
+
<StylesField bind={ 'text-align' }>
|
|
37
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
38
|
+
<Grid item xs={ 6 }>
|
|
39
|
+
<ControlLabel>{ __( 'Alignment', 'elementor' ) }</ControlLabel>
|
|
40
|
+
</Grid>
|
|
41
|
+
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
42
|
+
<ToggleControl options={ options } />
|
|
43
|
+
</Grid>
|
|
44
|
+
</Grid>
|
|
45
|
+
</StylesField>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ColorControl, ControlLabel } 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
|
+
|
|
8
|
+
export const TextColorField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="color">
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Text Color', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<ColorControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -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';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
8
|
|
|
9
9
|
type Direction = 'ltr' | 'rtl';
|
|
10
10
|
|
|
@@ -12,26 +12,26 @@ 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
|
-
export const
|
|
24
|
+
export const TextDirectionField = () => {
|
|
25
25
|
return (
|
|
26
|
-
<
|
|
27
|
-
<Grid container
|
|
26
|
+
<StylesField bind={ 'direction' }>
|
|
27
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
28
28
|
<Grid item xs={ 6 }>
|
|
29
|
-
<
|
|
29
|
+
<ControlLabel>{ __( 'Direction', 'elementor' ) }</ControlLabel>
|
|
30
30
|
</Grid>
|
|
31
31
|
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
32
32
|
<ToggleControl options={ options } />
|
|
33
33
|
</Grid>
|
|
34
34
|
</Grid>
|
|
35
|
-
</
|
|
35
|
+
</StylesField>
|
|
36
36
|
);
|
|
37
37
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, StrokeControl } from '@elementor/editor-controls';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
|
|
5
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
+
import { CollapsibleField } from '../../collapsible-field';
|
|
7
|
+
|
|
8
|
+
export const TextStrokeField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="-webkit-text-stroke">
|
|
11
|
+
<CollapsibleField label={ <ControlLabel>{ __( 'Text Stroke', 'elementor' ) }</ControlLabel> }>
|
|
12
|
+
<StrokeControl />
|
|
13
|
+
</CollapsibleField>
|
|
14
|
+
</StylesField>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Grid, ToggleButton as ToggleButtonBase, ToggleButtonGroup, ToggleButtonProps } from '@elementor/ui';
|
|
2
|
+
import { ControlLabel } from '@elementor/editor-controls';
|
|
4
3
|
import { ItalicIcon, StrikethroughIcon, UnderlineIcon } from '@elementor/icons';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Grid, ToggleButton as ToggleButtonBase, ToggleButtonGroup, type ToggleButtonProps } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
7
8
|
|
|
8
9
|
const buttonSize = 'tiny';
|
|
9
10
|
|
|
10
|
-
export const
|
|
11
|
-
const [ fontStyle, setFontStyle ] =
|
|
12
|
-
const [ textDecoration, setTextDecoration ] =
|
|
11
|
+
export const TextStyleField = () => {
|
|
12
|
+
const [ fontStyle, setFontStyle ] = useStylesField< string | null >( 'font-style' );
|
|
13
|
+
const [ textDecoration, setTextDecoration ] = useStylesField< string | null >( 'text-decoration' );
|
|
13
14
|
|
|
14
15
|
const formats = [ fontStyle, ...( textDecoration || '' ).split( ' ' ) ];
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
|
-
<Grid container
|
|
18
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
18
19
|
<Grid item xs={ 6 }>
|
|
19
20
|
<ControlLabel>{ __( 'Style', 'elementor' ) }</ControlLabel>
|
|
20
21
|
</Grid>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
3
|
+
import { LetterCaseIcon, LetterCaseLowerIcon, LetterCaseUpperIcon } from '@elementor/icons';
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
|
|
9
|
+
type Transforms = 'capitalize' | 'uppercase' | 'lowercase';
|
|
10
|
+
|
|
11
|
+
const options: ToggleButtonGroupItem< Transforms >[] = [
|
|
12
|
+
{
|
|
13
|
+
value: 'capitalize',
|
|
14
|
+
label: __( 'Capitalize', 'elementor' ),
|
|
15
|
+
renderContent: ( { size } ) => <LetterCaseIcon fontSize={ size } />,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: 'uppercase',
|
|
19
|
+
label: __( 'Uppercase', 'elementor' ),
|
|
20
|
+
renderContent: ( { size } ) => <LetterCaseUpperIcon fontSize={ size } />,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: 'lowercase',
|
|
24
|
+
label: __( 'Lowercase', 'elementor' ),
|
|
25
|
+
renderContent: ( { size } ) => <LetterCaseLowerIcon fontSize={ size } />,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export const TransformField = () => (
|
|
30
|
+
<StylesField bind={ 'text-transform' }>
|
|
31
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
32
|
+
<Grid item xs={ 6 }>
|
|
33
|
+
<ControlLabel>{ __( 'Transform', 'elementor' ) }</ControlLabel>
|
|
34
|
+
</Grid>
|
|
35
|
+
<Grid item xs={ 6 } display="flex" justifyContent="end">
|
|
36
|
+
<ToggleControl options={ options } />
|
|
37
|
+
</Grid>
|
|
38
|
+
</Grid>
|
|
39
|
+
</StylesField>
|
|
40
|
+
);
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AccordionSection } from '../../accordion-section';
|
|
3
2
|
import { Divider, Stack } from '@elementor/ui';
|
|
4
|
-
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { FontSizeControl } from './font-size-control';
|
|
7
|
-
import { FontWeightControl } from './font-weight-control';
|
|
8
|
-
import { TextColorControl } from './text-color-control';
|
|
9
|
-
import { LetterSpacingControl } from './letter-spacing-control';
|
|
10
|
-
import { WordSpacingControl } from './word-spacing-control';
|
|
3
|
+
|
|
11
4
|
import { CollapsibleContent } from '../../collapsible-content';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { FontFamilyField } from './font-family-field';
|
|
6
|
+
import { FontSizeField } from './font-size-field';
|
|
7
|
+
import { FontWeightField } from './font-weight-field';
|
|
8
|
+
import { LetterSpacingField } from './letter-spacing-field';
|
|
9
|
+
import { TextAlignmentField } from './text-alignment-field';
|
|
10
|
+
import { TextColorField } from './text-color-field';
|
|
11
|
+
import { TextDirectionField } from './text-direction-field';
|
|
12
|
+
import { TextStrokeField } from './text-stroke-field';
|
|
13
|
+
import { TextStyleField } from './text-style-field';
|
|
14
|
+
import { TransformField } from './transform-field';
|
|
15
|
+
import { WordSpacingField } from './word-spacing-field';
|
|
15
16
|
|
|
16
17
|
export const TypographySection = () => {
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</
|
|
35
|
-
</
|
|
36
|
-
</
|
|
19
|
+
<Stack gap={ 1.5 }>
|
|
20
|
+
<FontFamilyField />
|
|
21
|
+
<FontWeightField />
|
|
22
|
+
<FontSizeField />
|
|
23
|
+
<Divider />
|
|
24
|
+
<TextColorField />
|
|
25
|
+
<CollapsibleContent>
|
|
26
|
+
<Stack gap={ 1.5 } sx={ { pt: 1.5 } }>
|
|
27
|
+
<LetterSpacingField />
|
|
28
|
+
<WordSpacingField />
|
|
29
|
+
<Divider />
|
|
30
|
+
<TextAlignmentField />
|
|
31
|
+
<TextStyleField />
|
|
32
|
+
<TransformField />
|
|
33
|
+
<TextDirectionField />
|
|
34
|
+
<TextStrokeField />
|
|
35
|
+
</Stack>
|
|
36
|
+
</CollapsibleContent>
|
|
37
|
+
</Stack>
|
|
37
38
|
);
|
|
38
39
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ControlLabel, SizeControl } 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
|
+
|
|
8
|
+
export const WordSpacingField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="word-spacing">
|
|
11
|
+
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Word Spacing', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<SizeControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|