@elementor/editor-editing-panel 0.19.0 → 1.0.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 +51 -0
- package/dist/index.d.mts +5 -22
- package/dist/index.d.ts +5 -22
- package/dist/index.js +1444 -1165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1434 -1148
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -14
- package/src/components/accordion-section.tsx +3 -2
- package/src/components/add-or-remove-content.tsx +42 -0
- package/src/components/collapsible-field.tsx +34 -0
- package/src/components/editing-panel.tsx +15 -18
- package/src/components/settings-tab.tsx +11 -10
- package/src/components/style-sections/background-section/background-color-field.tsx +21 -0
- package/src/components/style-sections/background-section/background-section.tsx +2 -2
- package/src/components/style-sections/border-section/border-color-field.tsx +21 -0
- package/src/components/style-sections/border-section/border-field.tsx +47 -0
- package/src/components/style-sections/border-section/border-radius-field.tsx +48 -0
- package/src/components/style-sections/border-section/border-section.tsx +16 -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 +42 -0
- package/src/components/style-sections/effects-section/effects-section.tsx +5 -5
- 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 +15 -2
- 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 +55 -0
- package/src/components/style-sections/spacing-section/spacing-section.tsx +6 -6
- 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} +7 -6
- package/src/components/style-sections/typography-section/letter-spacing-field.tsx +21 -0
- package/src/components/style-sections/typography-section/{text-alignment-control.tsx → text-alignment-field.tsx} +7 -7
- 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} +7 -7
- 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} +4 -4
- package/src/components/style-sections/typography-section/{transform-control.tsx → transform-field.tsx} +7 -6
- package/src/components/style-sections/typography-section/typography-section.tsx +20 -18
- package/src/components/style-sections/typography-section/word-spacing-field.tsx +21 -0
- package/src/components/style-tab.tsx +42 -25
- 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 +8 -22
- package/src/control-replacement.tsx +1 -1
- package/src/controls/bound-prop-context.tsx +30 -0
- package/src/controls/components/control-toggle-button-group.tsx +15 -6
- package/src/controls/components/repeater.tsx +1 -1
- package/src/controls/components/text-field-inner-selection.tsx +20 -24
- package/src/controls/control-actions/control-actions-context.tsx +27 -0
- package/src/controls/control-actions/control-actions-menu.ts +6 -7
- package/src/controls/control-actions/control-actions.tsx +14 -26
- package/src/{components/style-sections/effects-section/box-shadow-repeater.tsx → controls/controls/box-shadow-repeater-control.tsx} +51 -65
- package/src/controls/controls/color-control.tsx +25 -0
- package/src/controls/controls/equal-unequal-sizes-control.tsx +196 -0
- package/src/controls/{control-types → controls}/image-control.tsx +15 -23
- package/src/controls/{control-types → controls}/image-media-control.tsx +5 -14
- package/src/{components/style-sections/spacing-section → controls/controls}/linked-dimensions-control.tsx +10 -26
- package/src/controls/{control-types → controls}/number-control.tsx +2 -2
- package/src/controls/{control-types → controls}/select-control.tsx +4 -4
- package/src/controls/{control-types → controls}/size-control.tsx +8 -8
- package/src/controls/controls/stroke-control.tsx +105 -0
- package/src/controls/{control-types → controls}/text-area-control.tsx +3 -3
- package/src/controls/{control-types → controls}/text-control.tsx +3 -3
- package/src/controls/{control-types → controls}/toggle-control.tsx +4 -4
- package/src/controls/create-control-replacement.tsx +3 -3
- package/src/controls/index.ts +24 -0
- package/src/controls-actions.ts +8 -0
- package/src/{controls/components → controls-registry}/control-type-container.tsx +1 -1
- package/src/{controls → controls-registry}/controls-registry.tsx +1 -6
- package/src/controls-registry/settings-field.tsx +35 -0
- package/src/controls-registry/styles-field.tsx +19 -0
- package/src/dynamics/components/dynamic-selection-control.tsx +11 -11
- package/src/dynamics/components/dynamic-selection.tsx +3 -3
- package/src/dynamics/dynamic-control.tsx +6 -5
- package/src/dynamics/hooks/use-dynamic-tag.ts +1 -1
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +6 -6
- package/src/dynamics/hooks/use-prop-dynamic-tags.ts +2 -2
- package/src/dynamics/hooks/use-prop-value-history.ts +2 -2
- package/src/dynamics/init.ts +1 -3
- package/src/dynamics/types.ts +2 -2
- package/src/dynamics/utils.ts +1 -2
- package/src/hooks/use-styles-field.ts +30 -0
- package/src/index.ts +2 -3
- package/src/sync/should-use-v2-panel.ts +1 -2
- package/src/sync/types.ts +3 -3
- package/src/components/style-sections/background-section/background-color-control.tsx +0 -20
- 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/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-color-control.tsx +0 -20
- package/src/components/style-sections/typography-section/word-spacing-control.tsx +0 -20
- 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/hooks/use-style-control.ts +0 -29
- 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/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
- package/src/{controls → controls-registry}/control.tsx +0 -0
- package/src/{controls/control-actions/actions/popover-action.tsx → popover-action.tsx} +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
13
14
|
"import": "./dist/index.mjs",
|
|
14
|
-
"require": "./dist/index.js"
|
|
15
|
-
"types": "./dist/index.d.ts"
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./package.json": "./package.json"
|
|
18
18
|
},
|
|
@@ -39,17 +39,18 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "^0.
|
|
43
|
-
"@elementor/editor-
|
|
44
|
-
"@elementor/editor-
|
|
45
|
-
"@elementor/editor-
|
|
46
|
-
"@elementor/editor-
|
|
47
|
-
"@elementor/
|
|
48
|
-
"@elementor/
|
|
49
|
-
"@elementor/
|
|
50
|
-
"@elementor/
|
|
51
|
-
"@elementor/
|
|
52
|
-
"@elementor/
|
|
42
|
+
"@elementor/editor": "^0.16.0",
|
|
43
|
+
"@elementor/editor-elements": "^0.2.0",
|
|
44
|
+
"@elementor/editor-props": "^0.2.0",
|
|
45
|
+
"@elementor/editor-panels": "^0.9.0",
|
|
46
|
+
"@elementor/editor-responsive": "^0.12.2",
|
|
47
|
+
"@elementor/editor-styles": "^0.2.0",
|
|
48
|
+
"@elementor/editor-v1-adapters": "^0.8.3",
|
|
49
|
+
"@elementor/icons": "^1.18.1",
|
|
50
|
+
"@elementor/menus": "^0.1.1",
|
|
51
|
+
"@elementor/ui": "^1.21.7",
|
|
52
|
+
"@elementor/utils": "^0.2.2",
|
|
53
|
+
"@elementor/wp-media": "^0.2.1",
|
|
53
54
|
"@wordpress/i18n": "^4.45.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
@@ -4,16 +4,17 @@ import { Accordion, AccordionSummary, AccordionDetails, AccordionSummaryText, St
|
|
|
4
4
|
|
|
5
5
|
export type AccordionSectionProps = React.PropsWithChildren< {
|
|
6
6
|
title: React.ReactNode;
|
|
7
|
+
defaultExpanded?: boolean;
|
|
7
8
|
} >;
|
|
8
9
|
|
|
9
|
-
export const AccordionSection = ( { title, children }: AccordionSectionProps ) => {
|
|
10
|
+
export const AccordionSection = ( { title, children, defaultExpanded = false }: AccordionSectionProps ) => {
|
|
10
11
|
const uid = useId();
|
|
11
12
|
const labelId = `label-${ uid }`;
|
|
12
13
|
const contentId = `content-${ uid }`;
|
|
13
14
|
|
|
14
15
|
// TODO: Change to collapsible list item
|
|
15
16
|
return (
|
|
16
|
-
<Accordion disableGutters defaultExpanded>
|
|
17
|
+
<Accordion disableGutters defaultExpanded={ defaultExpanded }>
|
|
17
18
|
<AccordionSummary aria-controls={ contentId } id={ labelId }>
|
|
18
19
|
<AccordionSummaryText primaryTypographyProps={ { variant: 'caption' } }>{ title }</AccordionSummaryText>
|
|
19
20
|
</AccordionSummary>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { MinusIcon, PlusIcon } from '@elementor/icons';
|
|
4
|
+
import { Collapse, IconButton, Stack } from '@elementor/ui';
|
|
5
|
+
import { ControlLabel } from './control-label';
|
|
6
|
+
|
|
7
|
+
const SIZE = 'tiny';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
label: string;
|
|
11
|
+
isAdded: boolean;
|
|
12
|
+
onAdd: () => void;
|
|
13
|
+
onRemove: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const AddOrRemoveContent = ( { isAdded, label, onAdd, onRemove, children }: PropsWithChildren< Props > ) => {
|
|
17
|
+
return (
|
|
18
|
+
<Stack gap={ 1.5 }>
|
|
19
|
+
<Stack
|
|
20
|
+
direction="row"
|
|
21
|
+
sx={ {
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
} }
|
|
25
|
+
>
|
|
26
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
27
|
+
{ isAdded ? (
|
|
28
|
+
<IconButton size={ SIZE } onClick={ onRemove }>
|
|
29
|
+
<MinusIcon fontSize={ SIZE } />
|
|
30
|
+
</IconButton>
|
|
31
|
+
) : (
|
|
32
|
+
<IconButton size={ SIZE } onClick={ onAdd }>
|
|
33
|
+
<PlusIcon fontSize={ SIZE } />
|
|
34
|
+
</IconButton>
|
|
35
|
+
) }
|
|
36
|
+
</Stack>
|
|
37
|
+
<Collapse in={ isAdded }>
|
|
38
|
+
<Stack gap={ 1.5 }>{ children }</Stack>
|
|
39
|
+
</Collapse>
|
|
40
|
+
</Stack>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { Collapse, IconButton, Stack } from '@elementor/ui';
|
|
5
|
+
import { MinusIcon, PlusIcon } from '@elementor/icons';
|
|
6
|
+
|
|
7
|
+
type CollapsibleFieldProps = React.PropsWithChildren< {
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
} >;
|
|
11
|
+
|
|
12
|
+
export const CollapsibleField = ( { label, children, defaultOpen = false }: CollapsibleFieldProps ) => {
|
|
13
|
+
const [ open, setOpen ] = useState( defaultOpen );
|
|
14
|
+
|
|
15
|
+
const handleToggle = () => {
|
|
16
|
+
setOpen( ( prevOpen ) => ! prevOpen );
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Stack gap={ 1.5 }>
|
|
21
|
+
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={ { py: 0.5 } }>
|
|
22
|
+
{ label }
|
|
23
|
+
<IconButton
|
|
24
|
+
onClick={ handleToggle }
|
|
25
|
+
size="tiny"
|
|
26
|
+
aria-label={ open ? __( 'Close', 'elementor' ) : __( 'Expand', 'elementor' ) }
|
|
27
|
+
>
|
|
28
|
+
{ open ? <MinusIcon fontSize="tiny" /> : <PlusIcon fontSize="tiny" /> }
|
|
29
|
+
</IconButton>
|
|
30
|
+
</Stack>
|
|
31
|
+
<Collapse in={ open }>{ children }</Collapse>
|
|
32
|
+
</Stack>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
|
-
import
|
|
3
|
+
import { useSelectedElement } from '@elementor/editor-elements';
|
|
4
4
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from '@elementor/editor-panels';
|
|
5
|
-
import { ElementProvider } from '../controls/providers/element-provider';
|
|
6
|
-
import useElementType from '../hooks/use-element-type';
|
|
7
5
|
import { EditingPanelTabs } from './editing-panel-tabs';
|
|
8
|
-
import { ControlReplacementProvider } from '../controls
|
|
6
|
+
import { ControlActionsProvider, ControlReplacementProvider } from '../controls';
|
|
9
7
|
import { getControlReplacement } from '../control-replacement';
|
|
10
8
|
import { ErrorBoundary } from '@elementor/ui';
|
|
11
9
|
import { EditorPanelErrorFallback } from './editing-panel-error-fallback';
|
|
10
|
+
import { ElementProvider } from '../contexts/element-context';
|
|
11
|
+
import { useMenuItems } from '../controls-actions';
|
|
12
12
|
|
|
13
13
|
export const EditingPanel = () => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
// TODO: Move this into the provider.
|
|
19
|
-
const elementType = useElementType( selectedElement?.type );
|
|
14
|
+
const { element, elementType } = useSelectedElement();
|
|
15
|
+
const controlReplacement = getControlReplacement();
|
|
16
|
+
const menuItems = useMenuItems().default;
|
|
20
17
|
|
|
21
|
-
if (
|
|
18
|
+
if ( ! element || ! elementType ) {
|
|
22
19
|
return null;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
const controlReplacement = getControlReplacement();
|
|
26
|
-
|
|
27
22
|
/* translators: %s: Element type title. */
|
|
28
23
|
const panelTitle = __( 'Edit %s', 'elementor' ).replace( '%s', elementType.title );
|
|
29
24
|
|
|
@@ -34,11 +29,13 @@ export const EditingPanel = () => {
|
|
|
34
29
|
<PanelHeaderTitle>{ panelTitle }</PanelHeaderTitle>
|
|
35
30
|
</PanelHeader>
|
|
36
31
|
<PanelBody>
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
<ControlActionsProvider items={ menuItems }>
|
|
33
|
+
<ControlReplacementProvider { ...controlReplacement }>
|
|
34
|
+
<ElementProvider element={ element } elementType={ elementType }>
|
|
35
|
+
<EditingPanelTabs />
|
|
36
|
+
</ElementProvider>
|
|
37
|
+
</ControlReplacementProvider>
|
|
38
|
+
</ControlActionsProvider>
|
|
42
39
|
</PanelBody>
|
|
43
40
|
</Panel>
|
|
44
41
|
</ErrorBoundary>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Stack } from '@elementor/ui';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { type Control } from '@elementor/editor-elements';
|
|
4
|
+
import { SettingsField } from '../controls-registry/settings-field';
|
|
5
5
|
import { AccordionSection } from './accordion-section';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Control as BaseControl } from '../controls-registry/control';
|
|
7
|
+
import { ControlType, getControlByType } from '../controls-registry/controls-registry';
|
|
8
|
+
import { ControlTypeContainer } from '../controls-registry/control-type-container';
|
|
9
|
+
import { ControlLabel } from './control-label';
|
|
10
|
+
import { useElement } from '../contexts/element-context';
|
|
10
11
|
|
|
11
12
|
export const SettingsTab = () => {
|
|
12
13
|
const { elementType } = useElement();
|
|
@@ -20,7 +21,7 @@ export const SettingsTab = () => {
|
|
|
20
21
|
|
|
21
22
|
if ( type === 'section' ) {
|
|
22
23
|
return (
|
|
23
|
-
<AccordionSection key={ type + '.' + index } title={ value.label }>
|
|
24
|
+
<AccordionSection key={ type + '.' + index } title={ value.label } defaultExpanded>
|
|
24
25
|
{ value.items?.map( ( item ) => {
|
|
25
26
|
if ( item.type === 'control' ) {
|
|
26
27
|
return <Control key={ item.value.bind } control={ item.value } />;
|
|
@@ -46,11 +47,11 @@ const Control = ( { control }: { control: Control[ 'value' ] } ) => {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<
|
|
50
|
+
<SettingsField bind={ control.bind }>
|
|
50
51
|
<ControlTypeContainer controlType={ control.type as ControlType }>
|
|
51
|
-
{ control.label ? <
|
|
52
|
+
{ control.label ? <ControlLabel>{ control.label }</ControlLabel> : null }
|
|
52
53
|
<BaseControl type={ control.type as ControlType } props={ control.props } />
|
|
53
54
|
</ControlTypeContainer>
|
|
54
|
-
</
|
|
55
|
+
</SettingsField>
|
|
55
56
|
);
|
|
56
57
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
+
import { ControlLabel } from '../../control-label';
|
|
6
|
+
import { ColorControl } from '../../../controls';
|
|
7
|
+
|
|
8
|
+
export const BackgroundColorField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="background-color">
|
|
11
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Color', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<ColorControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -2,13 +2,13 @@ import * as React from 'react';
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { Stack } from '@elementor/ui';
|
|
4
4
|
import { AccordionSection } from '../../accordion-section';
|
|
5
|
-
import {
|
|
5
|
+
import { BackgroundColorField } from './background-color-field';
|
|
6
6
|
|
|
7
7
|
export const BackgroundSection = () => {
|
|
8
8
|
return (
|
|
9
9
|
<AccordionSection title={ __( 'Background', 'elementor' ) }>
|
|
10
10
|
<Stack gap={ 1.5 }>
|
|
11
|
-
<
|
|
11
|
+
<BackgroundColorField />
|
|
12
12
|
</Stack>
|
|
13
13
|
</AccordionSection>
|
|
14
14
|
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { ColorControl } from '../../../controls';
|
|
5
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
+
import { ControlLabel } from '../../control-label';
|
|
7
|
+
|
|
8
|
+
export const BorderColorField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind={ 'border-color' }>
|
|
11
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
12
|
+
<Grid item xs={ 6 }>
|
|
13
|
+
<ControlLabel>{ __( 'Border Color', 'elementor' ) }</ControlLabel>
|
|
14
|
+
</Grid>
|
|
15
|
+
<Grid item xs={ 6 }>
|
|
16
|
+
<ColorControl />
|
|
17
|
+
</Grid>
|
|
18
|
+
</Grid>
|
|
19
|
+
</StylesField>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { BorderWidthField } from './border-width-field';
|
|
4
|
+
import { BorderColorField } from './border-color-field';
|
|
5
|
+
import { BorderStyleField } from './border-style-field';
|
|
6
|
+
import { AddOrRemoveContent } from '../../add-or-remove-content';
|
|
7
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
|
+
|
|
9
|
+
const initialSize = { $$type: 'size', value: { size: 1, unit: 'px' } };
|
|
10
|
+
const initialBorderWidth = {
|
|
11
|
+
$$type: 'border-width',
|
|
12
|
+
value: { top: initialSize, right: initialSize, bottom: initialSize, left: initialSize },
|
|
13
|
+
};
|
|
14
|
+
const initialBorderColor = { $$type: 'color', value: '#000000' };
|
|
15
|
+
const initialBorderStyle = 'solid';
|
|
16
|
+
|
|
17
|
+
export const BorderField = () => {
|
|
18
|
+
const [ borderWidth, setBorderWidth ] = useStylesField( 'border-width' );
|
|
19
|
+
const [ borderColor, setBorderColor ] = useStylesField( 'border-color' );
|
|
20
|
+
const [ borderStyle, setBorderStyle ] = useStylesField( 'border-style' );
|
|
21
|
+
|
|
22
|
+
const addBorder = () => {
|
|
23
|
+
setBorderWidth( initialBorderWidth );
|
|
24
|
+
setBorderColor( initialBorderColor );
|
|
25
|
+
setBorderStyle( initialBorderStyle );
|
|
26
|
+
};
|
|
27
|
+
const removeBorder = () => {
|
|
28
|
+
setBorderWidth( null );
|
|
29
|
+
setBorderColor( null );
|
|
30
|
+
setBorderStyle( null );
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const hasBorder = Boolean( borderWidth || borderColor || borderStyle );
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<AddOrRemoveContent
|
|
37
|
+
label={ __( 'Border', 'elementor' ) }
|
|
38
|
+
isAdded={ hasBorder }
|
|
39
|
+
onAdd={ addBorder }
|
|
40
|
+
onRemove={ removeBorder }
|
|
41
|
+
>
|
|
42
|
+
<BorderWidthField />
|
|
43
|
+
<BorderColorField />
|
|
44
|
+
<BorderStyleField />
|
|
45
|
+
</AddOrRemoveContent>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import {
|
|
4
|
+
BorderCornersIcon,
|
|
5
|
+
RadiusBottomLeftIcon,
|
|
6
|
+
RadiusBottomRightIcon,
|
|
7
|
+
RadiusTopLeftIcon,
|
|
8
|
+
RadiusTopRightIcon,
|
|
9
|
+
} from '@elementor/icons';
|
|
10
|
+
import type { BorderRadiusPropValue } from '@elementor/editor-props';
|
|
11
|
+
import { EqualUnequalItems, EqualUnequalSizesControl } from '../../../controls/controls/equal-unequal-sizes-control';
|
|
12
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
13
|
+
|
|
14
|
+
const corners: EqualUnequalItems< BorderRadiusPropValue[ '$$type' ], BorderRadiusPropValue > = [
|
|
15
|
+
{
|
|
16
|
+
label: __( 'Top Left', 'elementor' ),
|
|
17
|
+
icon: <RadiusTopLeftIcon fontSize={ 'tiny' } />,
|
|
18
|
+
bind: 'top-left',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: __( 'Top Right', 'elementor' ),
|
|
22
|
+
icon: <RadiusTopRightIcon fontSize={ 'tiny' } />,
|
|
23
|
+
bind: 'top-right',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: __( 'Bottom Right', 'elementor' ),
|
|
27
|
+
icon: <RadiusBottomRightIcon fontSize={ 'tiny' } />,
|
|
28
|
+
bind: 'bottom-right',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: __( 'Bottom Left', 'elementor' ),
|
|
32
|
+
icon: <RadiusBottomLeftIcon fontSize={ 'tiny' } />,
|
|
33
|
+
bind: 'bottom-left',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export const BorderRadiusField = () => {
|
|
38
|
+
return (
|
|
39
|
+
<StylesField bind={ 'border-radius' }>
|
|
40
|
+
<EqualUnequalSizesControl
|
|
41
|
+
label={ __( 'Border Radius', 'elementor' ) }
|
|
42
|
+
icon={ <BorderCornersIcon fontSize={ 'tiny' } /> }
|
|
43
|
+
items={ corners }
|
|
44
|
+
multiSizeType={ 'border-radius' }
|
|
45
|
+
/>
|
|
46
|
+
</StylesField>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AccordionSection } from '../../accordion-section';
|
|
3
|
+
import { Divider, Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { BorderRadiusField } from './border-radius-field';
|
|
6
|
+
import { BorderField } from './border-field';
|
|
7
|
+
|
|
8
|
+
export const BorderSection = () => (
|
|
9
|
+
<AccordionSection title={ __( 'Border', 'elementor' ) }>
|
|
10
|
+
<Stack gap={ 1.5 }>
|
|
11
|
+
<BorderRadiusField />
|
|
12
|
+
<Divider />
|
|
13
|
+
<BorderField />
|
|
14
|
+
</Stack>
|
|
15
|
+
</AccordionSection>
|
|
16
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { SelectControl } from '../../../controls';
|
|
4
|
+
import { Grid } from '@elementor/ui';
|
|
5
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
+
import { ControlLabel } from '../../control-label';
|
|
7
|
+
|
|
8
|
+
const borderStyles = [
|
|
9
|
+
{ value: 'none', label: __( 'None', 'elementor' ) },
|
|
10
|
+
{ value: 'solid', label: __( 'Solid', 'elementor' ) },
|
|
11
|
+
{ value: 'dashed', label: __( 'Dashed', 'elementor' ) },
|
|
12
|
+
{ value: 'dotted', label: __( 'Dotted', 'elementor' ) },
|
|
13
|
+
{ value: 'double', label: __( 'Double', 'elementor' ) },
|
|
14
|
+
{ value: 'groove', label: __( 'Groove', 'elementor' ) },
|
|
15
|
+
{ value: 'ridge', label: __( 'Ridge', 'elementor' ) },
|
|
16
|
+
{ value: 'inset', label: __( 'Inset', 'elementor' ) },
|
|
17
|
+
{ value: 'outset', label: __( 'Outset', 'elementor' ) },
|
|
18
|
+
];
|
|
19
|
+
export const BorderStyleField = () => {
|
|
20
|
+
return (
|
|
21
|
+
<StylesField bind={ 'border-style' }>
|
|
22
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
23
|
+
<Grid item xs={ 6 }>
|
|
24
|
+
<ControlLabel>{ __( 'Border Type', 'elementor' ) }</ControlLabel>
|
|
25
|
+
</Grid>
|
|
26
|
+
<Grid item xs={ 6 }>
|
|
27
|
+
<SelectControl options={ borderStyles } />
|
|
28
|
+
</Grid>
|
|
29
|
+
</Grid>
|
|
30
|
+
</StylesField>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon, SideAllIcon } from '@elementor/icons';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { BorderWidthPropValue } from '@elementor/editor-props';
|
|
5
|
+
import { EqualUnequalItems, EqualUnequalSizesControl } from '../../../controls/controls/equal-unequal-sizes-control';
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
|
|
8
|
+
const edges: EqualUnequalItems< BorderWidthPropValue[ '$$type' ], BorderWidthPropValue > = [
|
|
9
|
+
{
|
|
10
|
+
label: __( 'Top', 'elementor' ),
|
|
11
|
+
icon: <SideTopIcon fontSize={ 'tiny' } />,
|
|
12
|
+
bind: 'top',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: __( 'Right', 'elementor' ),
|
|
16
|
+
icon: <SideRightIcon fontSize={ 'tiny' } />,
|
|
17
|
+
bind: 'right',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: __( 'Bottom', 'elementor' ),
|
|
21
|
+
icon: <SideBottomIcon fontSize={ 'tiny' } />,
|
|
22
|
+
bind: 'bottom',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: __( 'Left', 'elementor' ),
|
|
26
|
+
icon: <SideLeftIcon fontSize={ 'tiny' } />,
|
|
27
|
+
bind: 'left',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const BorderWidthField = () => {
|
|
32
|
+
return (
|
|
33
|
+
<StylesField bind={ 'border-width' }>
|
|
34
|
+
<EqualUnequalSizesControl
|
|
35
|
+
label={ __( 'Border Width', 'elementor' ) }
|
|
36
|
+
icon={ <SideAllIcon fontSize={ 'tiny' } /> }
|
|
37
|
+
items={ edges }
|
|
38
|
+
multiSizeType={ 'border-width' }
|
|
39
|
+
/>
|
|
40
|
+
</StylesField>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -2,16 +2,16 @@ import * as React from 'react';
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { Stack } from '@elementor/ui';
|
|
4
4
|
import { AccordionSection } from '../../accordion-section';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
+
import { BoxShadowRepeaterControl } from '../../../controls';
|
|
7
7
|
|
|
8
8
|
export const EffectsSection = () => {
|
|
9
9
|
return (
|
|
10
10
|
<AccordionSection title={ __( 'Effects', 'elementor' ) }>
|
|
11
11
|
<Stack gap={ 1.5 }>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
</
|
|
12
|
+
<StylesField bind="box-shadow">
|
|
13
|
+
<BoxShadowRepeaterControl />
|
|
14
|
+
</StylesField>
|
|
15
15
|
</Stack>
|
|
16
16
|
</AccordionSection>
|
|
17
17
|
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Grid, Stack } from '@elementor/ui';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
|
|
5
|
+
import { ControlLabel } from '../../control-label';
|
|
6
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
+
import { SizeControl } from '../../../controls';
|
|
8
|
+
|
|
9
|
+
export type Side = 'left' | 'right' | 'top' | 'bottom';
|
|
10
|
+
|
|
11
|
+
const sideIcons = {
|
|
12
|
+
left: <SideLeftIcon fontSize={ 'tiny' } />,
|
|
13
|
+
right: <SideRightIcon fontSize={ 'tiny' } />,
|
|
14
|
+
top: <SideTopIcon fontSize={ 'tiny' } />,
|
|
15
|
+
bottom: <SideBottomIcon fontSize={ 'tiny' } />,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const DimensionsField = () => {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Stack direction="row" gap={ 2 }>
|
|
22
|
+
<DimensionField side="top" label={ __( 'Top', 'elementor' ) } />
|
|
23
|
+
<DimensionField side="right" label={ __( 'Right', 'elementor' ) } />
|
|
24
|
+
</Stack>
|
|
25
|
+
<Stack direction="row" gap={ 2 }>
|
|
26
|
+
<DimensionField side="bottom" label={ __( 'Bottom', 'elementor' ) } />
|
|
27
|
+
<DimensionField side="left" label={ __( 'Left', 'elementor' ) } />
|
|
28
|
+
</Stack>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const DimensionField = ( { side, label }: { side: Side; label: string } ) => {
|
|
34
|
+
return (
|
|
35
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
36
|
+
<Grid item xs={ 12 }>
|
|
37
|
+
<ControlLabel>{ label }</ControlLabel>
|
|
38
|
+
</Grid>
|
|
39
|
+
<Grid item xs={ 12 }>
|
|
40
|
+
<StylesField bind={ side }>
|
|
41
|
+
<SizeControl startIcon={ sideIcons[ side ] } />
|
|
42
|
+
</StylesField>
|
|
43
|
+
</Grid>
|
|
44
|
+
</Grid>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { SelectControl } from '../../../controls';
|
|
5
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
+
import { ControlLabel } from '../../control-label';
|
|
7
|
+
|
|
8
|
+
const positionOptions = [
|
|
9
|
+
{ label: __( 'Static', 'elementor' ), value: 'static' },
|
|
10
|
+
{ label: __( 'Relative', 'elementor' ), value: 'relative' },
|
|
11
|
+
{ label: __( 'Absolute', 'elementor' ), value: 'absolute' },
|
|
12
|
+
{ label: __( 'Fixed', 'elementor' ), value: 'fixed' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const PositionField = () => {
|
|
16
|
+
return (
|
|
17
|
+
<StylesField bind="position">
|
|
18
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
19
|
+
<Grid item xs={ 6 }>
|
|
20
|
+
<ControlLabel>{ __( 'Position', 'elementor' ) }</ControlLabel>
|
|
21
|
+
</Grid>
|
|
22
|
+
<Grid item xs={ 6 }>
|
|
23
|
+
<SelectControl options={ positionOptions } />
|
|
24
|
+
</Grid>
|
|
25
|
+
</Grid>
|
|
26
|
+
</StylesField>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AccordionSection } from '../../accordion-section';
|
|
3
3
|
import { Stack } from '@elementor/ui';
|
|
4
|
-
import {
|
|
4
|
+
import { ZIndexField } from './z-index-field';
|
|
5
|
+
import { PositionField } from './position-field';
|
|
5
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
|
+
import { DimensionsField } from './dimensions-field';
|
|
6
9
|
|
|
7
10
|
export const PositionSection = () => {
|
|
11
|
+
const [ positionValue ] = useStylesField( 'position' );
|
|
12
|
+
|
|
13
|
+
const isNotStatic = positionValue && positionValue !== 'static';
|
|
14
|
+
|
|
8
15
|
return (
|
|
9
16
|
<AccordionSection title={ __( 'Position', 'elementor' ) }>
|
|
10
17
|
<Stack gap={ 1.5 }>
|
|
11
|
-
<
|
|
18
|
+
<PositionField />
|
|
19
|
+
{ isNotStatic ? (
|
|
20
|
+
<>
|
|
21
|
+
<DimensionsField />
|
|
22
|
+
<ZIndexField />
|
|
23
|
+
</>
|
|
24
|
+
) : null }
|
|
12
25
|
</Stack>
|
|
13
26
|
</AccordionSection>
|
|
14
27
|
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { Grid } from '@elementor/ui';
|
|
4
|
+
import { StylesField } from '../../../controls-registry/styles-field';
|
|
5
|
+
import { NumberControl } from '../../../controls';
|
|
6
|
+
import { ControlLabel } from '../../control-label';
|
|
7
|
+
|
|
8
|
+
export const ZIndexField = () => {
|
|
9
|
+
return (
|
|
10
|
+
<StylesField bind="z-index">
|
|
11
|
+
<Grid container spacing={ 1 } alignItems="center">
|
|
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
|
+
};
|